public void SvnCheckoutExecutor_Execute_CallsShellManager_WithGivenParameters() { //// Arrange var activity = GetSvnCheckoutActivity(); 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(), (SvnCheckoutActivity)activity)), true)).Returns(new Collection <object>()); var executor = new SvnCheckoutExecutor(activity, shellManagerMock.Object); //// Act executor.Execute(); //// Assert shellManagerMock.Verify(); }
public void SvnCheckoutExecutor_Execute_Sets_IsSuccessToFalse_DuringException() { //// Arrange var activity = GetSvnCheckoutActivity(); 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(), (SvnCheckoutActivity)activity)), true)).Throws(new ApplicationException("Sample exception")); var executor = new SvnCheckoutExecutor(activity, shellManagerMock.Object); //// Act executor.Execute(); //// Assert shellManagerMock.Verify(); Assert.IsFalse(executor.Result.IsSuccess); }