diff --git a/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs b/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs index 1b528c93..903d3d86 100644 --- a/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs +++ b/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs @@ -13,6 +13,7 @@ using Moq; using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Handlers; using SafeExamBrowser.Configuration.Contracts; +using SafeExamBrowser.Configuration.Contracts.Cryptography; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Settings.Browser; @@ -29,6 +30,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers { private AppConfig appConfig; private Mock filter; + private Mock keyGenerator; private Mock logger; private BrowserSettings settings; private WindowSettings windowSettings; @@ -41,11 +43,12 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers { appConfig = new AppConfig(); filter = new Mock(); + keyGenerator = new Mock(); logger = new Mock(); settings = new BrowserSettings(); windowSettings = new WindowSettings(); text = new Mock(); - resourceHandler = new ResourceHandler(appConfig, filter.Object, logger.Object, settings, windowSettings, text.Object); + resourceHandler = new ResourceHandler(appConfig, filter.Object, keyGenerator.Object, logger.Object, settings, windowSettings, text.Object); sut = new TestableRequestHandler(appConfig, filter.Object, logger.Object, resourceHandler, settings, windowSettings, text.Object); } diff --git a/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs b/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs index 45cf3a33..b848f5de 100644 --- a/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs +++ b/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs @@ -15,6 +15,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Configuration.Contracts; +using SafeExamBrowser.Configuration.Contracts.Cryptography; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Settings.Browser; @@ -30,6 +31,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers { private AppConfig appConfig; private Mock filter; + private Mock keyGenerator; private Mock logger; private BrowserSettings settings; private WindowSettings windowSettings; @@ -41,12 +43,13 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers { appConfig = new AppConfig(); filter = new Mock(); + keyGenerator = new Mock(); logger = new Mock(); settings = new BrowserSettings(); windowSettings = new WindowSettings(); text = new Mock(); - sut = new TestableResourceHandler(appConfig, filter.Object, logger.Object, settings, windowSettings, text.Object); + sut = new TestableResourceHandler(appConfig, filter.Object, keyGenerator.Object, logger.Object, settings, windowSettings, text.Object); } [TestMethod] @@ -57,11 +60,13 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers var request = new Mock(); browser.SetupGet(b => b.Address).Returns("http://www.host.org"); + keyGenerator.Setup(g => g.CalculateBrowserExamKeyHash(It.IsAny())).Returns(new Random().Next().ToString()); + keyGenerator.Setup(g => g.CalculateConfigurationKeyHash(It.IsAny())).Returns(new Random().Next().ToString()); request.SetupGet(r => r.Headers).Returns(new NameValueCollection()); request.SetupGet(r => r.Url).Returns("http://www.host.org"); request.SetupSet(r => r.Headers = It.IsAny()).Callback((h) => headers = h); settings.SendConfigurationKey = true; - settings.SendExamKey = true; + settings.SendBrowserExamKey = true; var result = sut.OnBeforeResourceLoad(browser.Object, Mock.Of(), Mock.Of