Beispiel #1
0
        public void AddSslCertificateExecutor_Execute_CallsShellManager_WithGivenParameters()
        {
            //// Arrange
            var activity         = GetAddSslCertificateActivity();
            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(), (AddSslCertificateActivity)activity)),
                                       true)).Returns(new Collection <object>());
            var executor = new AddSslCertificateExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

            //// Assert
            shellManagerMock.Verify();
        }
Beispiel #2
0
        public void AddSslCertificateExecutor_Execute_Sets_IsSuccessToFalse_DuringException()
        {
            //// Arrange
            var activity         = GetAddSslCertificateActivity();
            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(), (AddSslCertificateActivity)activity)),
                                       true)).Throws(new ApplicationException("Some exception"));
            var executor = new AddSslCertificateExecutor(activity, shellManagerMock.Object);

            //// Act
            executor.Execute();

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