Пример #1
0
        public void CreateIISWebsiteExecutor_Execute_CallsShellManager_WithGivenParameters()
        {
            //// Arrange
            var activity         = GetCreateIISWebsiteActivity();
            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(), (CreateIISWebsiteActivity)activity)),
                                       true)).Returns(new Collection <object>());
            var executor = new CreateIISWebsiteExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

            //// Assert
            shellManagerMock.Verify();
        }
Пример #2
0
        public void CreateIISWebsiteExecutor_Execute_Sets_IsSuccessToFalse_DuringException()
        {
            //// Arrange
            var activity         = GetCreateIISWebsiteActivity();
            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(), (CreateIISWebsiteActivity)activity)),
                                       true)).Throws(new ApplicationException("Sample exception"));
            var executor = new CreateIISWebsiteExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

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