From 06eca3c8f0c79674b2121ca57754861d1536106e Mon Sep 17 00:00:00 2001 From: dbuechel Date: Fri, 16 Aug 2019 10:25:58 +0200 Subject: [PATCH] SEBWIN-303: Updated unit tests for audio component & system control. --- .../Operations/ShellOperationTests.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/SafeExamBrowser.Client.UnitTests/Operations/ShellOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/ShellOperationTests.cs index 022a7b4a..ce0480bd 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/ShellOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/ShellOperationTests.cs @@ -183,25 +183,31 @@ namespace SafeExamBrowser.Client.UnitTests.Operations public void Perform_MustInitializeSystemComponents() { actionCenterSettings.EnableActionCenter = true; + actionCenterSettings.ShowAudio = true; actionCenterSettings.ShowKeyboardLayout = true; actionCenterSettings.ShowWirelessNetwork = true; taskbarSettings.EnableTaskbar = true; + taskbarSettings.ShowAudio = true; taskbarSettings.ShowKeyboardLayout = true; taskbarSettings.ShowWirelessNetwork = true; systemInfo.SetupGet(s => s.HasBattery).Returns(true); + uiFactory.Setup(f => f.CreateAudioControl(It.IsAny())).Returns(new Mock().Object); uiFactory.Setup(f => f.CreateKeyboardLayoutControl(It.IsAny())).Returns(new Mock().Object); uiFactory.Setup(f => f.CreatePowerSupplyControl(It.IsAny())).Returns(new Mock().Object); uiFactory.Setup(f => f.CreateWirelessNetworkControl(It.IsAny())).Returns(new Mock().Object); sut.Perform(); + audio.Verify(a => a.Initialize(), Times.Once); keyboardLayout.Verify(k => k.Initialize(), Times.Once); powerSupply.Verify(p => p.Initialize(), Times.Once); wirelessNetwork.Verify(w => w.Initialize(), Times.Once); + actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Once); actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Once); actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Once); actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Once); + taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Once); taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Once); taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Once); taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Once); @@ -211,25 +217,31 @@ namespace SafeExamBrowser.Client.UnitTests.Operations public void Perform_MustNotInitializeSystemComponents() { actionCenterSettings.EnableActionCenter = true; + actionCenterSettings.ShowAudio = false; actionCenterSettings.ShowKeyboardLayout = false; actionCenterSettings.ShowWirelessNetwork = false; taskbarSettings.EnableTaskbar = true; + taskbarSettings.ShowAudio = false; taskbarSettings.ShowKeyboardLayout = false; taskbarSettings.ShowWirelessNetwork = false; systemInfo.SetupGet(s => s.HasBattery).Returns(false); + uiFactory.Setup(f => f.CreateAudioControl(It.IsAny())).Returns(new Mock().Object); uiFactory.Setup(f => f.CreateKeyboardLayoutControl(It.IsAny())).Returns(new Mock().Object); uiFactory.Setup(f => f.CreatePowerSupplyControl(It.IsAny())).Returns(new Mock().Object); uiFactory.Setup(f => f.CreateWirelessNetworkControl(It.IsAny())).Returns(new Mock().Object); sut.Perform(); + audio.Verify(a => a.Initialize(), Times.Once); keyboardLayout.Verify(k => k.Initialize(), Times.Once); powerSupply.Verify(p => p.Initialize(), Times.Once); wirelessNetwork.Verify(w => w.Initialize(), Times.Once); + actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Never); actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Never); actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Never); actionCenter.Verify(a => a.AddSystemControl(It.IsAny()), Times.Never); + taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Never); taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Never); taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Never); taskbar.Verify(t => t.AddSystemControl(It.IsAny()), Times.Never); @@ -284,6 +296,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations sut.Revert(); aboutController.Verify(c => c.Terminate(), Times.Once); + audio.Verify(a => a.Terminate(), Times.Once); logController.Verify(c => c.Terminate(), Times.Once); keyboardLayout.Verify(k => k.Terminate(), Times.Once); powerSupply.Verify(p => p.Terminate(), Times.Once);