Update Safe Exam Browser Patch to 3.10.0.826

This commit is contained in:
2025-09-16 16:32:31 +02:00
parent 4827ae1afc
commit dd82d45ed8
320 changed files with 8445 additions and 5295 deletions

View File

@@ -8,24 +8,27 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SafeExamBrowser.Communication.Contracts.Hosts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts.Display;
using SafeExamBrowser.Runtime.Operations;
using SafeExamBrowser.Runtime.Operations.Events;
using SafeExamBrowser.Runtime.Communication;
using SafeExamBrowser.Runtime.Operations.Session;
using SafeExamBrowser.Settings;
using SafeExamBrowser.Settings.Monitoring;
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
using SafeExamBrowser.UserInterface.Contracts.Windows;
namespace SafeExamBrowser.Runtime.UnitTests.Operations
{
[TestClass]
public class DisplayMonitorOperationTests
{
private SessionContext context;
private RuntimeContext context;
private Mock<IDisplayMonitor> displayMonitor;
private Mock<ILogger> logger;
private Mock<IMessageBox> messageBox;
private AppSettings settings;
private Mock<IText> text;
@@ -34,15 +37,24 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
[TestInitialize]
public void Initialize()
{
context = new SessionContext();
context = new RuntimeContext();
displayMonitor = new Mock<IDisplayMonitor>();
logger = new Mock<ILogger>();
messageBox = new Mock<IMessageBox>();
settings = new AppSettings();
text = new Mock<IText>();
context.Next = new SessionConfiguration();
context.Next.Settings = settings;
sut = new DisplayMonitorOperation(displayMonitor.Object, logger.Object, context, text.Object);
var dependencies = new Dependencies(
new ClientBridge(Mock.Of<IRuntimeHost>(), context),
Mock.Of<ILogger>(),
messageBox.Object,
Mock.Of<IRuntimeWindow>(),
context,
text.Object);
sut = new DisplayMonitorOperation(dependencies, displayMonitor.Object);
}
[TestMethod]
@@ -62,13 +74,10 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
var messageShown = false;
displayMonitor.Setup(m => m.ValidateConfiguration(It.IsAny<DisplaySettings>())).Returns(new ValidationResult { IsAllowed = false });
sut.ActionRequired += (args) =>
{
if (args is MessageEventArgs)
{
messageShown = true;
}
};
messageBox
.Setup(m => m.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>(), It.IsAny<IWindow>()))
.Callback(() => messageShown = true);
text.Setup(t => t.Get(It.IsAny<TextKey>())).Returns(string.Empty);
var result = sut.Perform();
@@ -95,13 +104,10 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
var messageShown = false;
displayMonitor.Setup(m => m.ValidateConfiguration(It.IsAny<DisplaySettings>())).Returns(new ValidationResult { IsAllowed = false });
sut.ActionRequired += (args) =>
{
if (args is MessageEventArgs)
{
messageShown = true;
}
};
messageBox
.Setup(m => m.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>(), It.IsAny<IWindow>()))
.Callback(() => messageShown = true);
text.Setup(t => t.Get(It.IsAny<TextKey>())).Returns(string.Empty);
var result = sut.Repeat();