This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
gameservicewarden/tests/GameServiceWarden.Core.Tests/UI/IPCMediatorTest.cs

54 lines
1.4 KiB
C#
Raw Normal View History

using System;
2021-04-09 04:05:52 +00:00
using GameServiceWarden.Core.Logging;
using GameServiceWarden.Core.UI;
using Xunit;
2021-04-09 04:05:52 +00:00
using Xunit.Abstractions;
namespace GameServiceWarden.Core.Tests.UI
{
public class IPCMediatorTest
{
2021-04-09 04:05:52 +00:00
public IPCMediatorTest(ITestOutputHelper output)
{
Logger.AddLogListener(new XUnitLogger(output));
}
[Fact]
public void Open_Closed_Opened()
{
//Given
const string NAME = "MEDIATOR";
IPCMediator mediator = new IPCMediator(NAME);
//When
mediator.Open();
//Then
Assert.True(mediator.IsRunning);
}
[Fact]
public void Open_AlreadyOpened_Exception()
{
//Given
const string NAME = "MEDIATOR";
IPCMediator mediator = new IPCMediator(NAME);
//When
mediator.Open();
//Then
Assert.Throws<InvalidOperationException>(() => mediator.Open());
}
[Fact]
public void Close_Opened_Closed()
{
//Given
const string NAME = "MEDIATOR";
IPCMediator mediator = new IPCMediator(NAME);
//When
mediator.Open();
//Then
Assert.True(mediator.IsRunning);
mediator.Close();
Assert.False(mediator.IsRunning);
}
}
}