SEBWIN-141: Fixed unit tests for new taskbar configuration and shutdown procedure.
This commit is contained in:
parent
d99d46d086
commit
29b99d8830
2 changed files with 10 additions and 22 deletions
|
@ -179,33 +179,15 @@ namespace SafeExamBrowser.Client.UnitTests
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Communication_MustCorrectlyInitiateShutdown()
|
public void Communication_MustCorrectlyInitiateShutdown()
|
||||||
{
|
{
|
||||||
var order = 0;
|
|
||||||
var taskbarCall = 0;
|
|
||||||
var shutdownCall = 0;
|
|
||||||
|
|
||||||
taskbar.Setup(t => t.Close()).Callback(() => taskbarCall = ++order);
|
|
||||||
shutdown.Setup(s => s()).Callback(() => shutdownCall = ++order);
|
|
||||||
|
|
||||||
sut.TryStart();
|
sut.TryStart();
|
||||||
clientHost.Raise(c => c.Shutdown += null);
|
clientHost.Raise(c => c.Shutdown += null);
|
||||||
|
|
||||||
taskbar.Verify(t => t.Close(), Times.Once);
|
|
||||||
shutdown.Verify(s => s(), Times.Once);
|
shutdown.Verify(s => s(), Times.Once);
|
||||||
|
|
||||||
Assert.AreEqual(1, taskbarCall);
|
|
||||||
Assert.AreEqual(2, shutdownCall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Communication_MustShutdownOnLostConnection()
|
public void Communication_MustShutdownOnLostConnection()
|
||||||
{
|
{
|
||||||
var order = 0;
|
|
||||||
var taskbarCall = 0;
|
|
||||||
var shutdownCall = 0;
|
|
||||||
|
|
||||||
taskbar.Setup(t => t.Close()).Callback(() => taskbarCall = ++order);
|
|
||||||
shutdown.Setup(s => s()).Callback(() => shutdownCall = ++order);
|
|
||||||
|
|
||||||
sut.TryStart();
|
sut.TryStart();
|
||||||
runtimeProxy.Raise(p => p.ConnectionLost += null);
|
runtimeProxy.Raise(p => p.ConnectionLost += null);
|
||||||
|
|
||||||
|
@ -215,11 +197,7 @@ namespace SafeExamBrowser.Client.UnitTests
|
||||||
It.IsAny<MessageBoxAction>(),
|
It.IsAny<MessageBoxAction>(),
|
||||||
It.IsAny<MessageBoxIcon>(),
|
It.IsAny<MessageBoxIcon>(),
|
||||||
It.IsAny<IWindow>()), Times.Once);
|
It.IsAny<IWindow>()), Times.Once);
|
||||||
taskbar.Verify(t => t.Close(), Times.Once);
|
|
||||||
shutdown.Verify(s => s(), Times.Once);
|
shutdown.Verify(s => s(), Times.Once);
|
||||||
|
|
||||||
Assert.AreEqual(1, taskbarCall);
|
|
||||||
Assert.AreEqual(2, shutdownCall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -489,6 +467,14 @@ namespace SafeExamBrowser.Client.UnitTests
|
||||||
Assert.IsTrue(args.Cancel);
|
Assert.IsTrue(args.Cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void Shutdown_MustCloseActionCenterAndTaskbar()
|
||||||
|
{
|
||||||
|
sut.Terminate();
|
||||||
|
actionCenter.Verify(a => a.Close(), Times.Once);
|
||||||
|
taskbar.Verify(o => o.Close(), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Shutdown_MustShowErrorMessageOnCommunicationFailure()
|
public void Shutdown_MustShowErrorMessageOnCommunicationFailure()
|
||||||
{
|
{
|
||||||
|
@ -638,6 +624,7 @@ namespace SafeExamBrowser.Client.UnitTests
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Startup_MustCorrectlyHandleTaskbar()
|
public void Startup_MustCorrectlyHandleTaskbar()
|
||||||
{
|
{
|
||||||
|
settings.Taskbar.EnableTaskbar = true;
|
||||||
operationSequence.Setup(o => o.TryPerform()).Returns(OperationResult.Success);
|
operationSequence.Setup(o => o.TryPerform()).Returns(OperationResult.Success);
|
||||||
sut.TryStart();
|
sut.TryStart();
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
||||||
settings.AllowApplicationLog = true;
|
settings.AllowApplicationLog = true;
|
||||||
settings.AllowKeyboardLayout = true;
|
settings.AllowKeyboardLayout = true;
|
||||||
settings.AllowWirelessNetwork = true;
|
settings.AllowWirelessNetwork = true;
|
||||||
|
settings.EnableTaskbar = true;
|
||||||
systemInfoMock.SetupGet(s => s.HasBattery).Returns(true);
|
systemInfoMock.SetupGet(s => s.HasBattery).Returns(true);
|
||||||
uiFactoryMock.Setup(u => u.CreateNotification(It.IsAny<INotificationInfo>())).Returns(new Mock<INotificationButton>().Object);
|
uiFactoryMock.Setup(u => u.CreateNotification(It.IsAny<INotificationInfo>())).Returns(new Mock<INotificationButton>().Object);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue