public void StopIISWebServerExecutor_Execute_CallsShellManager_WithGivenParameters() { //// Arrange var activity = GetStopIISWebServerActivity(); var shellManagerMock = new Mock <IShellManager>(MockBehavior.Strict); shellManagerMock.Setup(sm => sm.ExecuteCommands( It.Is <String>(s => IsSameHost(s, activity.Host.HostName)), It.Is <List <ScriptWithParameters> >(paramList => ContainsParamsFromActivity(paramList.First(), (StopIISWebServerActivity)activity)), true)).Returns(new Collection <object>()); var executor = new StopIISWebServerExecutor(activity, shellManagerMock.Object); //// Act executor.Execute(); //// Assert shellManagerMock.Verify(); }
public void StopIISWebServerExecutor_Execute_Sets_IsSuccessToFalse_DuringException() { //// Arrange var activity = GetStopIISWebServerActivity(); var shellManagerMock = new Mock <IShellManager>(MockBehavior.Strict); shellManagerMock.Setup(sm => sm.ExecuteCommands( It.Is <String>(s => IsSameHost(s, activity.Host.HostName)), It.Is <List <ScriptWithParameters> >(paramList => ContainsParamsFromActivity(paramList.First(), (StopIISWebServerActivity)activity)), true)).Throws(new ApplicationException("Sample exception")); var executor = new StopIISWebServerExecutor(activity, shellManagerMock.Object); //// Act executor.Execute(); //// Assert shellManagerMock.Verify(); Assert.IsFalse(executor.Result.IsSuccess); }