SEBWIN-296: Extended unit tests of runtime proxy.
This commit is contained in:
parent
b0ff5ee0ff
commit
76da1f3585
1 changed files with 28 additions and 1 deletions
|
@ -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<MessageBoxReplyMessage>())).Returns(new SimpleResponse(SimpleResponsePurport.Acknowledged));
|
||||
|
||||
var communication = sut.SubmitMessageBoxResult(requestId, result);
|
||||
|
||||
Assert.IsTrue(communication.Success);
|
||||
proxy.Verify(p => p.Send(It.Is<MessageBoxReplyMessage>(m => m.Result == result && m.RequestId == requestId)), Times.Once);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MustFailIfMessageBoxResultTransmissionNotAcknowledged()
|
||||
{
|
||||
proxy.Setup(p => p.Send(It.IsAny<MessageBoxReplyMessage>())).Returns<Response>(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);
|
||||
|
|
Loading…
Reference in a new issue