SEBWIN-219: Fixed broken unit tests.
This commit is contained in:
parent
d3dea29ecd
commit
24c5ea3ba9
5 changed files with 64 additions and 58 deletions
|
@ -23,7 +23,7 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
|
||||||
public class TaskbarOperationTests
|
public class TaskbarOperationTests
|
||||||
{
|
{
|
||||||
private Mock<ILogger> loggerMock;
|
private Mock<ILogger> loggerMock;
|
||||||
private Mock<TaskbarSettings> settingsMock;
|
private TaskbarSettings settings;
|
||||||
private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock;
|
private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock;
|
||||||
private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock;
|
private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock;
|
||||||
private Mock<ISystemComponent<ISystemWirelessNetworkControl>> wirelessNetworkMock;
|
private Mock<ISystemComponent<ISystemWirelessNetworkControl>> wirelessNetworkMock;
|
||||||
|
@ -38,7 +38,7 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
loggerMock = new Mock<ILogger>();
|
loggerMock = new Mock<ILogger>();
|
||||||
settingsMock = new Mock<TaskbarSettings>();
|
settings = new TaskbarSettings();
|
||||||
keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>();
|
keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>();
|
||||||
powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>();
|
powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>();
|
||||||
wirelessNetworkMock = new Mock<ISystemComponent<ISystemWirelessNetworkControl>>();
|
wirelessNetworkMock = new Mock<ISystemComponent<ISystemWirelessNetworkControl>>();
|
||||||
|
@ -47,15 +47,15 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
|
||||||
textMock = new Mock<IText>();
|
textMock = new Mock<IText>();
|
||||||
uiFactoryMock = new Mock<IUserInterfaceFactory>();
|
uiFactoryMock = new Mock<IUserInterfaceFactory>();
|
||||||
|
|
||||||
settingsMock.SetupGet(s => s.AllowApplicationLog).Returns(true);
|
settings.AllowApplicationLog = true;
|
||||||
settingsMock.SetupGet(s => s.AllowKeyboardLayout).Returns(true);
|
settings.AllowKeyboardLayout = true;
|
||||||
settingsMock.SetupGet(s => s.AllowWirelessNetwork).Returns(true);
|
settings.AllowWirelessNetwork = 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);
|
||||||
|
|
||||||
sut = new TaskbarOperation(
|
sut = new TaskbarOperation(
|
||||||
loggerMock.Object,
|
loggerMock.Object,
|
||||||
settingsMock.Object,
|
settings,
|
||||||
keyboardLayoutMock.Object,
|
keyboardLayoutMock.Object,
|
||||||
powerSupplyMock.Object,
|
powerSupplyMock.Object,
|
||||||
wirelessNetworkMock.Object,
|
wirelessNetworkMock.Object,
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Moq;
|
using Moq;
|
||||||
using SafeExamBrowser.Contracts.Behaviour;
|
using SafeExamBrowser.Client.Behaviour;
|
||||||
|
using SafeExamBrowser.Contracts.Behaviour.Operations;
|
||||||
|
using SafeExamBrowser.Contracts.Communication;
|
||||||
using SafeExamBrowser.Contracts.Logging;
|
using SafeExamBrowser.Contracts.Logging;
|
||||||
using SafeExamBrowser.Contracts.Monitoring;
|
using SafeExamBrowser.Contracts.Monitoring;
|
||||||
using SafeExamBrowser.Contracts.UserInterface.Taskbar;
|
using SafeExamBrowser.Contracts.UserInterface.Taskbar;
|
||||||
|
@ -22,10 +24,12 @@ namespace SafeExamBrowser.Client.UnitTests
|
||||||
private Mock<IDisplayMonitor> displayMonitorMock;
|
private Mock<IDisplayMonitor> displayMonitorMock;
|
||||||
private Mock<ILogger> loggerMock;
|
private Mock<ILogger> loggerMock;
|
||||||
private Mock<IProcessMonitor> processMonitorMock;
|
private Mock<IProcessMonitor> processMonitorMock;
|
||||||
|
private Mock<IOperationSequence> operationSequenceMock;
|
||||||
|
private Mock<IRuntimeProxy> runtimeProxyMock;
|
||||||
private Mock<ITaskbar> taskbarMock;
|
private Mock<ITaskbar> taskbarMock;
|
||||||
private Mock<IWindowMonitor> windowMonitorMock;
|
private Mock<IWindowMonitor> windowMonitorMock;
|
||||||
|
|
||||||
//private IClientController sut;
|
private ClientController sut;
|
||||||
|
|
||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
|
@ -33,19 +37,23 @@ namespace SafeExamBrowser.Client.UnitTests
|
||||||
displayMonitorMock = new Mock<IDisplayMonitor>();
|
displayMonitorMock = new Mock<IDisplayMonitor>();
|
||||||
loggerMock = new Mock<ILogger>();
|
loggerMock = new Mock<ILogger>();
|
||||||
processMonitorMock = new Mock<IProcessMonitor>();
|
processMonitorMock = new Mock<IProcessMonitor>();
|
||||||
|
operationSequenceMock = new Mock<IOperationSequence>();
|
||||||
|
runtimeProxyMock = new Mock<IRuntimeProxy>();
|
||||||
taskbarMock = new Mock<ITaskbar>();
|
taskbarMock = new Mock<ITaskbar>();
|
||||||
windowMonitorMock= new Mock<IWindowMonitor>();
|
windowMonitorMock= new Mock<IWindowMonitor>();
|
||||||
|
|
||||||
// TODO
|
operationSequenceMock.Setup(o => o.TryPerform()).Returns(true);
|
||||||
|
|
||||||
//sut = new ClientController(
|
sut = new ClientController(
|
||||||
// displayMonitorMock.Object,
|
displayMonitorMock.Object,
|
||||||
// loggerMock.Object,
|
loggerMock.Object,
|
||||||
// processMonitorMock.Object,
|
operationSequenceMock.Object,
|
||||||
// taskbarMock.Object,
|
processMonitorMock.Object,
|
||||||
// windowMonitorMock.Object);
|
runtimeProxyMock.Object,
|
||||||
|
taskbarMock.Object,
|
||||||
|
windowMonitorMock.Object);
|
||||||
|
|
||||||
// sut.Start();
|
sut.TryStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour.Operations
|
||||||
public class DelayedInitializationOperationTests
|
public class DelayedInitializationOperationTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void Todo()
|
public void TODO()
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
Assert.Fail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public class ConfigurationOperationTests
|
public class ConfigurationOperationTests
|
||||||
{
|
{
|
||||||
private Mock<ILogger> logger;
|
private Mock<ILogger> logger;
|
||||||
private Mock<RuntimeInfo> info;
|
private RuntimeInfo info;
|
||||||
private Mock<IConfigurationRepository> repository;
|
private Mock<IConfigurationRepository> repository;
|
||||||
private Mock<Settings> settings;
|
private Settings settings;
|
||||||
private Mock<IText> text;
|
private Mock<IText> text;
|
||||||
private Mock<IUserInterfaceFactory> uiFactory;
|
private Mock<IUserInterfaceFactory> uiFactory;
|
||||||
private ConfigurationOperation sut;
|
private ConfigurationOperation sut;
|
||||||
|
@ -34,17 +34,17 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
logger = new Mock<ILogger>();
|
logger = new Mock<ILogger>();
|
||||||
info = new Mock<RuntimeInfo>();
|
info = new RuntimeInfo();
|
||||||
repository = new Mock<IConfigurationRepository>();
|
repository = new Mock<IConfigurationRepository>();
|
||||||
settings = new Mock<Settings>();
|
settings = new Settings();
|
||||||
text = new Mock<IText>();
|
text = new Mock<IText>();
|
||||||
uiFactory = new Mock<IUserInterfaceFactory>();
|
uiFactory = new Mock<IUserInterfaceFactory>();
|
||||||
|
|
||||||
info.SetupGet(i => i.AppDataFolder).Returns(@"C:\Not\Really\AppData");
|
info.AppDataFolder = @"C:\Not\Really\AppData";
|
||||||
info.SetupGet(i => i.DefaultSettingsFileName).Returns("SettingsDummy.txt");
|
info.DefaultSettingsFileName = "SettingsDummy.txt";
|
||||||
info.SetupGet(i => i.ProgramDataFolder).Returns(@"C:\Not\Really\ProgramData");
|
info.ProgramDataFolder = @"C:\Not\Really\ProgramData";
|
||||||
repository.Setup(r => r.LoadSettings(It.IsAny<Uri>())).Returns(settings.Object);
|
repository.Setup(r => r.LoadSettings(It.IsAny<Uri>())).Returns(settings);
|
||||||
repository.Setup(r => r.LoadDefaultSettings()).Returns(settings.Object);
|
repository.Setup(r => r.LoadDefaultSettings()).Returns(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -52,11 +52,11 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
{
|
{
|
||||||
repository.Setup(r => r.LoadDefaultSettings());
|
repository.Setup(r => r.LoadDefaultSettings());
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, null);
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, null);
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, new string[] { });
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, new string[] { });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
{
|
{
|
||||||
var path = @"an/invalid\path.'*%yolo/()";
|
var path = @"an/invalid\path.'*%yolo/()";
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, new [] { "blubb.exe", path });
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, new [] { "blubb.exe", path });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,10 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
var path = @"http://www.safeexambrowser.org/whatever.seb";
|
var path = @"http://www.safeexambrowser.org/whatever.seb";
|
||||||
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
||||||
|
|
||||||
info.SetupGet(r => r.ProgramDataFolder).Returns(location);
|
info.ProgramDataFolder = location;
|
||||||
info.SetupGet(r => r.AppDataFolder).Returns(location);
|
info.AppDataFolder = location;
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, new[] { "blubb.exe", path });
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, new[] { "blubb.exe", path });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -94,10 +94,10 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
{
|
{
|
||||||
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
||||||
|
|
||||||
info.SetupGet(r => r.ProgramDataFolder).Returns(location);
|
info.ProgramDataFolder = location;
|
||||||
info.SetupGet(r => r.AppDataFolder).Returns($@"{location}\WRONG");
|
info.AppDataFolder = $@"{location}\WRONG";
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, null);
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, null);
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
{
|
{
|
||||||
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
||||||
|
|
||||||
info.SetupGet(r => r.AppDataFolder).Returns(location);
|
info.AppDataFolder = location;
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, null);
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, null);
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MustFallbackToDefaultsAsLastPrio()
|
public void MustFallbackToDefaultsAsLastPrio()
|
||||||
{
|
{
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, null);
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, null);
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -131,12 +131,10 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void MustAbortIfWishedByUser()
|
public void MustAbortIfWishedByUser()
|
||||||
{
|
{
|
||||||
var location = Path.GetDirectoryName(GetType().Assembly.Location);
|
info.ProgramDataFolder = Path.GetDirectoryName(GetType().Assembly.Location);
|
||||||
|
|
||||||
info.SetupGet(r => r.ProgramDataFolder).Returns(location);
|
|
||||||
uiFactory.Setup(u => u.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>())).Returns(MessageBoxResult.Yes);
|
uiFactory.Setup(u => u.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>())).Returns(MessageBoxResult.Yes);
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, null);
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, null);
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -148,7 +146,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
{
|
{
|
||||||
uiFactory.Setup(u => u.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>())).Returns(MessageBoxResult.No);
|
uiFactory.Setup(u => u.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>())).Returns(MessageBoxResult.No);
|
||||||
|
|
||||||
sut = new ConfigurationOperation(repository.Object, logger.Object, info.Object, text.Object, uiFactory.Object, null);
|
sut = new ConfigurationOperation(repository.Object, logger.Object, info, text.Object, uiFactory.Object, null);
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,12 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void MustConnectToService()
|
public void MustConnectToService()
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(true);
|
service.Setup(s => s.Connect(null)).Returns(true);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Returns(true);
|
service.Setup(s => s.Connect(null)).Returns(true);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -61,22 +61,22 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void MustNotFailIfServiceNotAvailable()
|
public void MustNotFailIfServiceNotAvailable()
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(false);
|
service.Setup(s => s.Connect(null)).Returns(false);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Returns(false);
|
service.Setup(s => s.Connect(null)).Returns(false);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void MustAbortIfServiceMandatoryAndNotAvailable()
|
public void MustAbortIfServiceMandatoryAndNotAvailable()
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(false);
|
service.Setup(s => s.Connect(null)).Returns(false);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void MustNotAbortIfServiceOptionalAndNotAvailable()
|
public void MustNotAbortIfServiceOptionalAndNotAvailable()
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(false);
|
service.Setup(s => s.Connect(null)).Returns(false);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
|
|
||||||
|
@ -108,13 +108,13 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void MustDisconnectWhenReverting()
|
public void MustDisconnectWhenReverting()
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(true);
|
service.Setup(s => s.Connect(null)).Returns(true);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Returns(true);
|
service.Setup(s => s.Connect(null)).Returns(true);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
@ -127,7 +127,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(true);
|
service.Setup(s => s.Connect(null)).Returns(true);
|
||||||
service.Setup(s => s.Disconnect()).Throws<Exception>();
|
service.Setup(s => s.Disconnect()).Throws<Exception>();
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
@ -139,25 +139,25 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations
|
||||||
public void MustNotDisconnnectIfNotAvailable()
|
public void MustNotDisconnnectIfNotAvailable()
|
||||||
{
|
{
|
||||||
service.Setup(s => s.Connect(null)).Returns(false);
|
service.Setup(s => s.Connect(null)).Returns(false);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Returns(false);
|
service.Setup(s => s.Connect(null)).Returns(false);
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Mandatory);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Mandatory });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
|
||||||
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
service.Setup(s => s.Connect(null)).Throws<Exception>();
|
||||||
configuration.SetupGet(s => s.CurrentSettings.ServicePolicy).Returns(ServicePolicy.Optional);
|
configuration.SetupGet(s => s.CurrentSettings).Returns(new Settings { ServicePolicy = ServicePolicy.Optional });
|
||||||
|
|
||||||
sut.Perform();
|
sut.Perform();
|
||||||
sut.Revert();
|
sut.Revert();
|
||||||
|
|
Loading…
Reference in a new issue