2018-01-23 15:33:54 +01:00
|
|
|
|
/*
|
2019-01-09 11:25:21 +01:00
|
|
|
|
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
2018-01-23 15:33:54 +01:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-01-24 12:34:32 +01:00
|
|
|
|
using System;
|
2018-01-23 15:33:54 +01:00
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
using Moq;
|
2019-06-06 15:44:03 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Communication.Hosts;
|
2018-03-15 14:32:07 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Communication.Proxies;
|
2018-02-06 15:12:11 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Configuration;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Configuration.Settings;
|
2018-10-02 15:45:45 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Core.OperationModel;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
2018-08-31 10:06:27 +02:00
|
|
|
|
using SafeExamBrowser.Runtime.Operations;
|
2018-01-23 15:33:54 +01:00
|
|
|
|
|
2018-08-31 10:06:27 +02:00
|
|
|
|
namespace SafeExamBrowser.Runtime.UnitTests.Operations
|
2018-01-23 15:33:54 +01:00
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
2018-03-21 15:28:59 +01:00
|
|
|
|
public class ServiceOperationTests
|
2018-01-23 15:33:54 +01:00
|
|
|
|
{
|
2018-01-24 12:34:32 +01:00
|
|
|
|
private Mock<ILogger> logger;
|
2019-06-06 15:44:03 +02:00
|
|
|
|
private Mock<IRuntimeHost> runtimeHost;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
private Mock<IServiceProxy> service;
|
2018-10-12 15:23:43 +02:00
|
|
|
|
private Mock<ISessionConfiguration> session;
|
|
|
|
|
private SessionContext sessionContext;
|
2018-03-21 15:28:59 +01:00
|
|
|
|
private Settings settings;
|
2018-03-21 10:23:15 +01:00
|
|
|
|
private ServiceOperation sut;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
|
|
|
|
[TestInitialize]
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
|
|
|
|
logger = new Mock<ILogger>();
|
2019-06-06 15:44:03 +02:00
|
|
|
|
runtimeHost = new Mock<IRuntimeHost>();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
service = new Mock<IServiceProxy>();
|
2018-10-12 15:23:43 +02:00
|
|
|
|
session = new Mock<ISessionConfiguration>();
|
|
|
|
|
sessionContext = new SessionContext();
|
2018-03-21 15:28:59 +01:00
|
|
|
|
settings = new Settings();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2018-10-12 15:23:43 +02:00
|
|
|
|
sessionContext.Current = session.Object;
|
|
|
|
|
sessionContext.Next = session.Object;
|
|
|
|
|
session.SetupGet(s => s.Settings).Returns(settings);
|
2019-06-06 15:44:03 +02:00
|
|
|
|
settings.ServicePolicy = ServicePolicy.Mandatory;
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
sut = new ServiceOperation(logger.Object, runtimeHost.Object, service.Object, sessionContext, 0);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Perform_MustConnectToService()
|
2018-01-24 12:34:32 +01:00
|
|
|
|
{
|
2018-03-15 09:55:04 +01:00
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(true);
|
2018-10-12 15:23:43 +02:00
|
|
|
|
settings.ServicePolicy = ServicePolicy.Mandatory;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
|
|
|
|
sut.Perform();
|
|
|
|
|
|
2018-03-15 09:55:04 +01:00
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(true);
|
2018-10-12 15:23:43 +02:00
|
|
|
|
settings.ServicePolicy = ServicePolicy.Optional;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
|
|
|
|
sut.Perform();
|
|
|
|
|
|
2018-03-15 09:55:04 +01:00
|
|
|
|
service.Verify(s => s.Connect(null, true), Times.Exactly(2));
|
2018-01-24 12:34:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-21 15:28:59 +01:00
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Perform_MustStartSessionIfConnected()
|
2018-03-21 15:28:59 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(true);
|
2018-03-21 15:28:59 +01:00
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(true);
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceSessionStarted += null));
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var result = sut.Perform();
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()), Times.Once);
|
2019-06-06 15:44:03 +02:00
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
2018-03-21 15:28:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Perform_MustFailIfSessionStartUnsuccessful()
|
2018-03-21 15:28:59 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(true);
|
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(true);
|
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceFailed += null));
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var result = sut.Perform();
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Verify(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()), Times.Once);
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
2018-03-21 15:28:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-24 12:34:32 +01:00
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Perform_MustFailIfSessionNotStartedWithinTimeout()
|
2018-01-24 12:34:32 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
const int TIMEOUT = 50;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var after = default(DateTime);
|
|
|
|
|
var before = default(DateTime);
|
|
|
|
|
|
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(true);
|
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(true);
|
|
|
|
|
service.Setup(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>())).Returns(new CommunicationResult(true));
|
|
|
|
|
|
|
|
|
|
sut = new ServiceOperation(logger.Object, runtimeHost.Object, service.Object, sessionContext, TIMEOUT);
|
|
|
|
|
|
|
|
|
|
before = DateTime.Now;
|
|
|
|
|
var result = sut.Perform();
|
|
|
|
|
after = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()), Times.Once);
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
|
|
|
|
Assert.IsTrue(after - before >= new TimeSpan(0, 0, 0, 0, TIMEOUT));
|
|
|
|
|
}
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Perform_MustNotStartSessionIfNotConnected()
|
|
|
|
|
{
|
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(false);
|
2018-03-15 09:55:04 +01:00
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(false);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
|
|
|
|
sut.Perform();
|
2019-06-06 15:44:03 +02:00
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()), Times.Never);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Perform_MustFailIfServiceMandatoryAndNotAvailable()
|
2018-01-24 12:34:32 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(false);
|
2018-03-15 09:55:04 +01:00
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(false);
|
2018-10-12 15:23:43 +02:00
|
|
|
|
settings.ServicePolicy = ServicePolicy.Mandatory;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2018-02-28 15:49:06 +01:00
|
|
|
|
var result = sut.Perform();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2018-02-28 15:49:06 +01:00
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Perform_MustNotFailIfServiceOptionalAndNotAvailable()
|
2018-01-24 12:34:32 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(false);
|
2018-03-15 09:55:04 +01:00
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(false);
|
2018-10-12 15:23:43 +02:00
|
|
|
|
settings.ServicePolicy = ServicePolicy.Optional;
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2018-02-28 15:49:06 +01:00
|
|
|
|
var result = sut.Perform();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2018-01-25 09:50:46 +01:00
|
|
|
|
service.VerifySet(s => s.Ignore = true);
|
2018-02-28 15:49:06 +01:00
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Repeat_MustStopCurrentAndStartNewSession()
|
2018-01-24 12:34:32 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StopSession(It.IsAny<Guid>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceSessionStopped += null));
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
PerformNormally();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var result = sut.Repeat();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Verify(s => s.Connect(It.IsAny<Guid?>(), It.IsAny<bool>()), Times.Once);
|
|
|
|
|
service.Verify(s => s.StopSession(It.IsAny<Guid>()), Times.Once);
|
|
|
|
|
service.Verify(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()), Times.Exactly(2));
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Never);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
2018-01-24 12:34:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-21 15:28:59 +01:00
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Repeat_MustFailIfCurrentSessionWasNotStoppedSuccessfully()
|
2018-03-21 15:28:59 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Setup(s => s.StopSession(It.IsAny<Guid>())).Returns(new CommunicationResult(false));
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
PerformNormally();
|
|
|
|
|
|
|
|
|
|
var result = sut.Repeat();
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StopSession(It.IsAny<Guid>()), Times.Once);
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Verify(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()), Times.Once);
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Never);
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
2018-03-21 15:28:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Revert_MustDisconnect()
|
2018-03-21 15:28:59 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Setup(s => s.Disconnect()).Returns(true).Callback(() => runtimeHost.Raise(h => h.ServiceDisconnected += null));
|
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StopSession(It.IsAny<Guid>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceSessionStopped += null));
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
PerformNormally();
|
2018-03-21 15:28:59 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var result = sut.Revert();
|
|
|
|
|
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Once);
|
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
2018-03-21 15:28:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-25 09:50:46 +01:00
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Revert_MustFailIfServiceNotDisconnectedWithinTimeout()
|
2018-01-25 09:50:46 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
const int TIMEOUT = 50;
|
2018-01-25 09:50:46 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var after = default(DateTime);
|
|
|
|
|
var before = default(DateTime);
|
|
|
|
|
|
|
|
|
|
sut = new ServiceOperation(logger.Object, runtimeHost.Object, service.Object, sessionContext, TIMEOUT);
|
|
|
|
|
|
|
|
|
|
service.Setup(s => s.Disconnect()).Returns(true);
|
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StopSession(It.IsAny<Guid>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceSessionStopped += null));
|
|
|
|
|
|
|
|
|
|
PerformNormally();
|
|
|
|
|
|
|
|
|
|
before = DateTime.Now;
|
|
|
|
|
var result = sut.Revert();
|
|
|
|
|
after = DateTime.Now;
|
2018-01-25 09:50:46 +01:00
|
|
|
|
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Once);
|
2019-06-06 15:44:03 +02:00
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
|
|
|
|
Assert.IsTrue(after - before >= new TimeSpan(0, 0, 0, 0, TIMEOUT));
|
2018-01-25 09:50:46 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-23 15:33:54 +01:00
|
|
|
|
[TestMethod]
|
2019-06-06 15:44:03 +02:00
|
|
|
|
public void Revert_MustStopSessionIfConnected()
|
2018-01-23 15:33:54 +01:00
|
|
|
|
{
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Setup(s => s.Disconnect()).Returns(true).Callback(() => runtimeHost.Raise(h => h.ServiceDisconnected += null));
|
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StopSession(It.IsAny<Guid>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceSessionStopped += null));
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
PerformNormally();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
var result = sut.Revert();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
2019-06-06 15:44:03 +02:00
|
|
|
|
service.Verify(s => s.StopSession(It.IsAny<Guid>()), Times.Once);
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Once);
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Revert_MustHandleCommunicationFailureWhenStoppingSession()
|
|
|
|
|
{
|
|
|
|
|
service.Setup(s => s.StopSession(It.IsAny<Guid>())).Returns(new CommunicationResult(false));
|
|
|
|
|
|
|
|
|
|
PerformNormally();
|
|
|
|
|
|
|
|
|
|
var result = sut.Revert();
|
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StopSession(It.IsAny<Guid>()), Times.Once);
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Once);
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Revert_MustFailIfSessionNotStoppedWithinTimeout()
|
|
|
|
|
{
|
|
|
|
|
const int TIMEOUT = 50;
|
|
|
|
|
|
|
|
|
|
var after = default(DateTime);
|
|
|
|
|
var before = default(DateTime);
|
|
|
|
|
|
|
|
|
|
service.Setup(s => s.StopSession(It.IsAny<Guid>())).Returns(new CommunicationResult(true));
|
|
|
|
|
sut = new ServiceOperation(logger.Object, runtimeHost.Object, service.Object, sessionContext, TIMEOUT);
|
|
|
|
|
|
|
|
|
|
PerformNormally();
|
|
|
|
|
|
|
|
|
|
before = DateTime.Now;
|
|
|
|
|
var result = sut.Revert();
|
|
|
|
|
after = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StopSession(It.IsAny<Guid>()), Times.Once);
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Once);
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(OperationResult.Failed, result);
|
|
|
|
|
Assert.IsTrue(after - before >= new TimeSpan(0, 0, 0, 0, TIMEOUT));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Revert_MustNotStopSessionWhenNotConnected()
|
|
|
|
|
{
|
|
|
|
|
var result = sut.Revert();
|
|
|
|
|
|
|
|
|
|
service.Verify(s => s.StopSession(It.IsAny<Guid>()), Times.Never);
|
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Revert_MustNotDisconnnectIfNotConnected()
|
|
|
|
|
{
|
|
|
|
|
var result = sut.Revert();
|
2018-01-24 12:34:32 +01:00
|
|
|
|
|
|
|
|
|
service.Verify(s => s.Disconnect(), Times.Never);
|
2019-06-06 15:44:03 +02:00
|
|
|
|
Assert.AreEqual(OperationResult.Success, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PerformNormally()
|
|
|
|
|
{
|
|
|
|
|
service.SetupGet(s => s.IsConnected).Returns(true);
|
|
|
|
|
service.Setup(s => s.Connect(null, true)).Returns(true);
|
|
|
|
|
service
|
|
|
|
|
.Setup(s => s.StartSession(It.IsAny<Guid>(), It.IsAny<Settings>()))
|
|
|
|
|
.Returns(new CommunicationResult(true))
|
|
|
|
|
.Callback(() => runtimeHost.Raise(h => h.ServiceSessionStarted += null));
|
|
|
|
|
|
|
|
|
|
sut.Perform();
|
2018-01-23 15:33:54 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|