SEBWIN-221: Ensured all client operations do not allow repeating.
This commit is contained in:
		
							parent
							
								
									7a57cdf93b
								
							
						
					
					
						commit
						4ca2fac50e
					
				
					 25 changed files with 202 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -63,5 +64,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
 | 
			
		||||
			controllerMock.Verify(c => c.Terminate(), Times.Once);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
| 
						 | 
				
			
			@ -97,13 +98,10 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		public void MustDoNothingOnRepeat()
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			var result = sut.Repeat();
 | 
			
		||||
 | 
			
		||||
			clientHost.VerifyNoOtherCalls();
 | 
			
		||||
 | 
			
		||||
			Assert.AreEqual(OperationResult.Success, result);
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,5 +47,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
 | 
			
		||||
			nativeMethodsMock.Verify(n => n.EmptyClipboard(), Times.Once);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
 | 
			
		||||
 * 
 | 
			
		||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
			
		||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
			
		||||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
using SafeExamBrowser.Contracts.Communication.Proxies;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration;
 | 
			
		||||
using SafeExamBrowser.Contracts.Logging;
 | 
			
		||||
 | 
			
		||||
namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		||||
{
 | 
			
		||||
	[TestClass]
 | 
			
		||||
	public class ConfigurationOperationTests
 | 
			
		||||
	{
 | 
			
		||||
		private ClientConfiguration configuration;
 | 
			
		||||
		private Mock<ILogger> logger;
 | 
			
		||||
		private Mock<IRuntimeProxy> runtime;
 | 
			
		||||
		private ConfigurationOperation sut;
 | 
			
		||||
 | 
			
		||||
		[TestInitialize]
 | 
			
		||||
		public void Initialize()
 | 
			
		||||
		{
 | 
			
		||||
			configuration = new ClientConfiguration();
 | 
			
		||||
			logger = new Mock<ILogger>();
 | 
			
		||||
			runtime = new Mock<IRuntimeProxy>();
 | 
			
		||||
 | 
			
		||||
			sut = new ConfigurationOperation(configuration, logger.Object, runtime.Object);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		public void TODO()
 | 
			
		||||
		{
 | 
			
		||||
			Assert.Fail();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -63,5 +64,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
			displayMonitorMock.Verify(d => d.StopMonitoringDisplayChanges(), Times.Once);
 | 
			
		||||
			displayMonitorMock.Verify(d => d.ResetPrimaryDisplay(), Times.Once);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -49,5 +50,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
 | 
			
		||||
			nativeMethodsMock.Verify(n => n.DeregisterKeyboardHook(It.IsAny<IKeyboardInterceptor>()), Times.Once);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -49,5 +50,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
 | 
			
		||||
			nativeMethodsMock.Verify(n => n.DeregisterMouseHook(It.IsAny<IMouseInterceptor>()), Times.Once);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -70,5 +71,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
			processMonitor.Verify(p => p.StartMonitoringExplorer(), Times.Never);
 | 
			
		||||
			processMonitor.Verify(p => p.StopMonitoringExplorer(), Times.Never);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
 | 
			
		||||
 * 
 | 
			
		||||
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
			
		||||
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
			
		||||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
using SafeExamBrowser.Contracts.Communication.Proxies;
 | 
			
		||||
using SafeExamBrowser.Contracts.Logging;
 | 
			
		||||
 | 
			
		||||
namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		||||
{
 | 
			
		||||
	[TestClass]
 | 
			
		||||
	public class RuntimeConnectionOperationTests
 | 
			
		||||
	{
 | 
			
		||||
		private Mock<ILogger> logger;
 | 
			
		||||
		private Mock<IRuntimeProxy> runtime;
 | 
			
		||||
 | 
			
		||||
		[TestInitialize]
 | 
			
		||||
		public void Initialize()
 | 
			
		||||
		{
 | 
			
		||||
			logger = new Mock<ILogger>();
 | 
			
		||||
			runtime = new Mock<IRuntimeProxy>();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		public void TODO()
 | 
			
		||||
		{
 | 
			
		||||
			Assert.Fail();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			var sut = new RuntimeConnectionOperation(logger.Object, runtime.Object, Guid.Empty);
 | 
			
		||||
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,12 +6,13 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration.Settings;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core;
 | 
			
		||||
using SafeExamBrowser.Contracts.I18n;
 | 
			
		||||
using SafeExamBrowser.Contracts.Logging;
 | 
			
		||||
using SafeExamBrowser.Contracts.SystemComponents;
 | 
			
		||||
| 
						 | 
				
			
			@ -93,5 +94,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
			powerSupplyMock.Verify(p => p.Terminate(), Times.Once);
 | 
			
		||||
			wirelessNetworkMock.Verify(w => w.Terminate(), Times.Once);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Client.Operations;
 | 
			
		||||
| 
						 | 
				
			
			@ -105,5 +106,14 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
 | 
			
		|||
 | 
			
		||||
			windowMonitorMock.VerifyNoOtherCalls();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			var sut = new WindowMonitorOperation(KioskMode.None, loggerMock.Object, windowMonitorMock.Object);
 | 
			
		||||
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,10 +80,12 @@
 | 
			
		|||
    <Compile Include="Operations\BrowserOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\ClientHostDisconnectionOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\ClipboardOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\ConfigurationOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\DisplayMonitorOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\KeyboardInterceptorOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\MouseInterceptorOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\ProcessMonitorOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\RuntimeConnectionOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\TaskbarOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Operations\WindowMonitorOperationTests.cs" />
 | 
			
		||||
    <Compile Include="Communication\ClientHostTests.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +60,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(BrowserOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using SafeExamBrowser.Contracts.Communication.Events;
 | 
			
		||||
using SafeExamBrowser.Contracts.Communication.Hosts;
 | 
			
		||||
| 
						 | 
				
			
			@ -43,7 +44,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(ClientHostDisconnectionOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
using SafeExamBrowser.Contracts.I18n;
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +38,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(ClipboardOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(ConfigurationOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
using SafeExamBrowser.Contracts.I18n;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +46,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(DisplayMonitorOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
using SafeExamBrowser.Contracts.I18n;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +47,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(KeyboardInterceptorOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
using SafeExamBrowser.Contracts.I18n;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +47,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(MouseInterceptorOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration.Settings;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +47,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(ProcessMonitorOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,7 +53,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(RuntimeConnectionOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration.Settings;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core;
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +93,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(TaskbarOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using SafeExamBrowser.Contracts.Configuration.Settings;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +52,7 @@ namespace SafeExamBrowser.Client.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(WindowMonitorOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Moq;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,11 +46,18 @@ namespace SafeExamBrowser.Core.UnitTests.Operations
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		public void MustRepeatCorrectly()
 | 
			
		||||
		public void MustDoNothingOnRevert()
 | 
			
		||||
		{
 | 
			
		||||
			var result = sut.Repeat();
 | 
			
		||||
			sut.Revert();
 | 
			
		||||
 | 
			
		||||
			Assert.AreEqual(OperationResult.Success, result);
 | 
			
		||||
			text.VerifyNoOtherCalls();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[TestMethod]
 | 
			
		||||
		[ExpectedException(typeof(InvalidOperationException))]
 | 
			
		||||
		public void MustNotAllowRepeating()
 | 
			
		||||
		{
 | 
			
		||||
			sut.Repeat();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel;
 | 
			
		||||
using SafeExamBrowser.Contracts.Core.OperationModel.Events;
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +45,7 @@ namespace SafeExamBrowser.Core.Operations
 | 
			
		|||
 | 
			
		||||
		public OperationResult Repeat()
 | 
			
		||||
		{
 | 
			
		||||
			return OperationResult.Success;
 | 
			
		||||
			throw new InvalidOperationException($"The '{nameof(I18nOperation)}' is not meant to be repeated!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public void Revert()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue