public void StartIISWebsiteExecutor_Constructor_Sets_ActivityScriptAndVerificationScript()
        {
            //// Arrange
            var activity         = GetStartIISWebsiteActivity();
            var shellManagerMock = new Mock <IShellManager>(MockBehavior.Strict);

            //// Act
            var executor = new StartIISWebsiteExecutor(activity, shellManagerMock.Object);

            //// Assert
            shellManagerMock.Verify();
            Assert.IsNotNull(executor.ActivityScriptMap);
            Assert.IsFalse(string.IsNullOrWhiteSpace(executor.ActivityScriptMap.ExecutionScript));
            Assert.IsFalse(string.IsNullOrWhiteSpace(executor.ActivityScriptMap.VerificationScript));
        }
        public void StartIISWebsiteExecutor_Execute_CallsShellManager_WithGivenParameters()
        {
            //// Arrange
            var activity         = GetStartIISWebsiteActivity();
            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(), (StartIISWebsiteActivity)activity)),
                                       true)).Returns(new Collection <object>());
            var executor = new StartIISWebsiteExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

            //// Assert
            shellManagerMock.Verify();
        }
        public void StartIISWebsiteExecutor_Execute_Sets_IsSuccessToFalse_DuringException()
        {
            //// Arrange
            var activity         = GetStartIISWebsiteActivity();
            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(), (StartIISWebsiteActivity)activity)),
                                       true)).Throws(new ApplicationException("Sample exception"));
            var executor = new StartIISWebsiteExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

            //// Assert
            shellManagerMock.Verify();
            Assert.IsFalse(executor.Result.IsSuccess);
        }