diff --git a/SafeExamBrowser.Communication.UnitTests/Proxies/RuntimeProxyTests.cs b/SafeExamBrowser.Communication.UnitTests/Proxies/RuntimeProxyTests.cs index e31cf23c..6ddd2fa4 100644 --- a/SafeExamBrowser.Communication.UnitTests/Proxies/RuntimeProxyTests.cs +++ b/SafeExamBrowser.Communication.UnitTests/Proxies/RuntimeProxyTests.cs @@ -10,11 +10,12 @@ using System; using System.ServiceModel; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using SafeExamBrowser.Communication.Proxies; using SafeExamBrowser.Contracts.Communication.Data; using SafeExamBrowser.Contracts.Communication.Proxies; using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Logging; -using SafeExamBrowser.Communication.Proxies; +using SafeExamBrowser.Contracts.UserInterface.MessageBox; namespace SafeExamBrowser.Communication.UnitTests.Proxies { @@ -167,6 +168,30 @@ namespace SafeExamBrowser.Communication.UnitTests.Proxies Assert.IsFalse(communication.Success); } + [TestMethod] + public void MustCorrectlySubmitMessageBoxResult() + { + var result = MessageBoxResult.Ok; + var requestId = Guid.NewGuid(); + + proxy.Setup(p => p.Send(It.IsAny())).Returns(new SimpleResponse(SimpleResponsePurport.Acknowledged)); + + var communication = sut.SubmitMessageBoxResult(requestId, result); + + Assert.IsTrue(communication.Success); + proxy.Verify(p => p.Send(It.Is(m => m.Result == result && m.RequestId == requestId)), Times.Once); + } + + [TestMethod] + public void MustFailIfMessageBoxResultTransmissionNotAcknowledged() + { + proxy.Setup(p => p.Send(It.IsAny())).Returns(null); + + var communication = sut.SubmitMessageBoxResult(default(Guid), default(MessageBoxResult)); + + Assert.IsFalse(communication.Success); + } + [TestMethod] public void MustExecuteOperationsFailsafe() { @@ -174,12 +199,14 @@ namespace SafeExamBrowser.Communication.UnitTests.Proxies var client = sut.InformClientReady(); var configuration = sut.GetConfiguration(); + var message = sut.SubmitMessageBoxResult(default(Guid), default(MessageBoxResult)); var password = sut.SubmitPassword(default(Guid), false); var reconfiguration = sut.RequestReconfiguration(null); var shutdown = sut.RequestShutdown(); Assert.IsFalse(client.Success); Assert.IsFalse(configuration.Success); + Assert.IsFalse(message.Success); Assert.IsFalse(password.Success); Assert.IsFalse(reconfiguration.Success); Assert.IsFalse(shutdown.Success);