Update Safe Exam Browser Patch to 3.10.0.826
This commit is contained in:
@@ -10,6 +10,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Win32;
|
||||
using Moq;
|
||||
using SafeExamBrowser.Client.Contracts;
|
||||
using SafeExamBrowser.Client.Responsibilities;
|
||||
@@ -363,7 +364,7 @@ namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
.Setup(f => f.CreateLockScreen(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IEnumerable<LockScreenOption>>(), It.IsAny<LockScreenSettings>()))
|
||||
.Returns(lockScreen.Object);
|
||||
|
||||
sentinel.Raise(s => s.SessionChanged += null);
|
||||
sentinel.Raise(s => s.SessionChanged += null, SessionSwitchReason.ConsoleDisconnect);
|
||||
|
||||
coordinator.Verify(c => c.RequestSessionLock(), Times.Once);
|
||||
coordinator.Verify(c => c.ReleaseSessionLock(), Times.Once);
|
||||
@@ -385,7 +386,7 @@ namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
.Callback(new Action<string, string, IEnumerable<LockScreenOption>, LockScreenSettings>((message, title, options, settings) => result.OptionId = options.Last().Id))
|
||||
.Returns(lockScreen.Object);
|
||||
|
||||
sentinel.Raise(s => s.SessionChanged += null);
|
||||
sentinel.Raise(s => s.SessionChanged += null, SessionSwitchReason.ConsoleConnect);
|
||||
|
||||
coordinator.Verify(c => c.RequestSessionLock(), Times.Once);
|
||||
coordinator.Verify(c => c.ReleaseSessionLock(), Times.Once);
|
||||
@@ -406,9 +407,42 @@ namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
.Setup(f => f.CreateLockScreen(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IEnumerable<LockScreenOption>>(), It.IsAny<LockScreenSettings>()))
|
||||
.Returns(lockScreen.Object);
|
||||
|
||||
sentinel.Raise(s => s.SessionChanged += null);
|
||||
sentinel.Raise(s => s.SessionChanged += null, SessionSwitchReason.ConsoleConnect);
|
||||
|
||||
lockScreen.Verify(l => l.Show(), Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SystemMonitor_MustDoNothingIfSessionLockUnlockWithoutService()
|
||||
{
|
||||
var lockScreen = new Mock<ILockScreen>();
|
||||
|
||||
settings.Service.IgnoreService = true;
|
||||
lockScreen.Setup(l => l.WaitForResult()).Returns(new LockScreenResult());
|
||||
uiFactory
|
||||
.Setup(f => f.CreateLockScreen(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IEnumerable<LockScreenOption>>(), It.IsAny<LockScreenSettings>()))
|
||||
.Returns(lockScreen.Object);
|
||||
|
||||
sentinel.Raise(s => s.SessionChanged += null, SessionSwitchReason.SessionLock);
|
||||
|
||||
lockScreen.Verify(l => l.Show(), Times.Never);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SystemMonitor_MustShowLockscreenIfNotSessionLockUnlockWithoutService()
|
||||
{
|
||||
var lockScreen = new Mock<ILockScreen>();
|
||||
|
||||
settings.Service.IgnoreService = true;
|
||||
coordinator.Setup(c => c.RequestSessionLock()).Returns(true);
|
||||
lockScreen.Setup(l => l.WaitForResult()).Returns(new LockScreenResult());
|
||||
uiFactory
|
||||
.Setup(f => f.CreateLockScreen(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IEnumerable<LockScreenOption>>(), It.IsAny<LockScreenSettings>()))
|
||||
.Returns(lockScreen.Object);
|
||||
|
||||
sentinel.Raise(s => s.SessionChanged += null, SessionSwitchReason.ConsoleConnect);
|
||||
|
||||
lockScreen.Verify(l => l.Show(), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ using Moq;
|
||||
using SafeExamBrowser.Client.Responsibilities;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
|
||||
|
||||
namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
{
|
||||
@@ -18,6 +19,8 @@ namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
public class ProctoringResponsibilityTests
|
||||
{
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> logger;
|
||||
private Mock<IMessageBox> messageBox;
|
||||
private Mock<IUserInterfaceFactory> uiFactory;
|
||||
|
||||
private ProctoringResponsibility sut;
|
||||
@@ -25,13 +28,12 @@ namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
var logger = new Mock<ILogger>();
|
||||
|
||||
context = new ClientContext();
|
||||
logger = new Mock<ILogger>();
|
||||
messageBox = new Mock<IMessageBox>();
|
||||
uiFactory = new Mock<IUserInterfaceFactory>();
|
||||
|
||||
sut = new ProctoringResponsibility(context, logger.Object, uiFactory.Object);
|
||||
sut = new ProctoringResponsibility(context, logger.Object, messageBox.Object, uiFactory.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@@ -52,6 +52,7 @@ namespace SafeExamBrowser.Client.UnitTests.Responsibilities
|
||||
taskbar = new Mock<ITaskbar>();
|
||||
uiFactory = new Mock<IUserInterfaceFactory>();
|
||||
|
||||
context.HashAlgorithm = hashAlgorithm.Object;
|
||||
context.MessageBox = messageBox.Object;
|
||||
context.Responsibilities = responsibilities.Object;
|
||||
context.Runtime = runtime.Object;
|
||||
|
Reference in New Issue
Block a user