コード例 #1
0
        public void Fail_ProcessRecord()
        {
            // Setup
            var workingFolder      = Fakes.RandomString();
            var deploymentFilePath = Fakes.RandomString();
            var serverInstance     = Fakes.RandomString();
            var catalog            = Fakes.RandomString();
            var folder             = Fakes.RandomString();
            var projectName        = Fakes.RandomString();
            var projectPassword    = Fakes.RandomString();
            var eraseSensitiveInfo = Fakes.RandomBool();

            IDeployArguments deployArguments = null;

            _deployerMock.Setup(d => d.Deploy(It.IsAny <IDeployArguments>())).Throws(new Exception("TEST"));

            // Execute
            var powershellCmd = new SsisDeployPowershell
            {
                DeploymentFilePath = deploymentFilePath,
                Folder             = folder,
                Catalog            = catalog,
                ServerInstance     = serverInstance,
                ProjectName        = projectName,
                EraseSensitiveInfo = eraseSensitiveInfo,
                ProjectPassword    = projectPassword
            };

            // Execute
            var exception = Record.Exception(() => powershellCmd.ProcessRecordInternal(_deployerMock.Object, workingFolder));

            Assert.NotNull(exception);
            Assert.IsType <Exception>(exception);
            Assert.Equal("TEST", exception.Message);
        }
コード例 #2
0
        public void Pass_ProcessRecord()
        {
            // Setup
            var workingFolder      = Fakes.RandomString();
            var deploymentFilePath = Fakes.RandomString();
            var serverInstance     = Fakes.RandomString();
            var catalog            = Fakes.RandomString();
            var folder             = Fakes.RandomString();
            var projectName        = Fakes.RandomString();
            var projectPassword    = Fakes.RandomString();
            var eraseSensitiveInfo = Fakes.RandomBool();

            IDeployArguments deployArguments = null;

            _deployerMock.Setup(d => d.Deploy(It.IsAny <IDeployArguments>())).Callback((IDeployArguments da) => { deployArguments = da; });

            // Execute
            var powershellCmd = new SsisDeployPowershell
            {
                DeploymentFilePath = deploymentFilePath,
                Folder             = folder,
                Catalog            = catalog,
                ServerInstance     = serverInstance,
                ProjectName        = projectName,
                EraseSensitiveInfo = eraseSensitiveInfo,
                ProjectPassword    = projectPassword
            };

            powershellCmd.ProcessRecordInternal(_deployerMock.Object, workingFolder);

            // Assert
            Assert.Equal(workingFolder, deployArguments.WorkingFolder);
            Assert.Equal(deploymentFilePath, deployArguments.DeploymentFilePath);
            Assert.Equal(serverInstance, deployArguments.ServerInstance);
            Assert.Equal(catalog, deployArguments.Catalog);
            Assert.Equal(folder, deployArguments.Folder);
            Assert.Equal(projectName, deployArguments.ProjectName);
            Assert.Equal(projectPassword, deployArguments.ProjectPassword);
            Assert.Equal(eraseSensitiveInfo, deployArguments.EraseSensitiveInfo);
        }