Exemple #1
0
        public void RunsWithFullParameters()
        {
            var result         = GenerateResultMock();
            var executablePath = "SubMain.CodeItRight.Cmd";
            var executor       = GenerateExecutorMock(
                executablePath,
                "/quiet /severityThreshold:\"None\" /out:\"" + Path.Combine(defaultWorkingDir, "codeitright.xml") +
                "\" /Project:\"" + Path.Combine(defaultWorkingDir, "test.csproj") +
                "\" /outxsl:\"" + Path.Combine(defaultWorkingDir, "test.xsl") +
                "\" /crdata:\"" + Path.Combine(defaultWorkingDir, "test.crdata") +
                "\" /profile:\"profile\"",
                defaultWorkingDir,
                600000);
            var fileSystemMock = this.InitialiseFileSystemMock(defaultWorkingDir);
            var task           = new CodeItRightTask(executor, fileSystemMock)
            {
                Project = "test.csproj",
                CRData  = "test.crdata",
                Xsl     = "test.xsl",
                Profile = "profile"
            };

            Expect.Call(result.Status).PropertyBehavior();
            mocks.ReplayAll();
            result.Status = IntegrationStatus.Unknown;
            task.Run(result);
            mocks.VerifyAll();
        }
        public void RunsFailsIfSeverityExists()
        {
            var result         = GenerateResultMock();
            var executablePath = "SubMain.CodeItRight.Cmd";
            var executor       = GenerateExecutorMock(
                executablePath,
                "/quiet /severityThreshold:\"None\" /out:\"" + Path.Combine(defaultWorkingDir, "codeitright.xml") +
                "\" /Project:\"" + Path.Combine(defaultWorkingDir, "test.csproj") +
                "\" /outxsl:\"" + Path.Combine(defaultWorkingDir, "test.xsl") +
                "\" /crdata:\"" + Path.Combine(defaultWorkingDir, "test.crdata") +
                "\" /profile:\"profile\"",
                defaultWorkingDir,
                600000);
            var fileSystemMock = this.InitialiseFileSystemMock(defaultWorkingDir);
            var task           = new CodeItRightTask(executor, fileSystemMock)
            {
                Project          = "test.csproj",
                CRData           = "test.crdata",
                Xsl              = "test.xsl",
                Profile          = "profile",
                FailureThreshold = CodeItRightTask.Severity.Error
            };

            Mock.Get(result).SetupProperty(_result => _result.Status);
            result.Status = IntegrationStatus.Unknown;
            task.Run(result);
            Assert.AreEqual(IntegrationStatus.Failure, result.Status);
            mocks.VerifyAll();
        }
        public void RunFailsWithoutProjectOrSolution()
        {
            var result         = GenerateResultMock();
            var executablePath = "SubMain.CodeItRight.Cmd";
            var executor       = GenerateExecutorMock(
                executablePath,
                "/quiet /severityThreshold:\"None\" /out:\"" + Path.Combine(defaultWorkingDir, "codeitright.xml") +
                "\" /Project:\"" + Path.Combine(defaultWorkingDir, "test.csproj") +
                "\" /outxsl:\"" + Path.Combine(defaultWorkingDir, "test.xsl") +
                "\" /crdata:\"" + Path.Combine(defaultWorkingDir, "test.crdata") +
                "\" /profile:\"profile\"",
                defaultWorkingDir,
                600000);
            var fileSystemMock = this.InitialiseFileSystemMock(defaultWorkingDir);
            var task           = new CodeItRightTask(executor, fileSystemMock);

            Mock.Get(result).SetupProperty(_result => _result.Status);
            result.Status = IntegrationStatus.Unknown;
            Assert.Throws <CruiseControlException>(() => task.Run(result));
        }
        public void RunsWithDefaultParameters()
        {
            var result         = GenerateResultMock();
            var executablePath = "SubMain.CodeItRight.Cmd";
            var executor       = GenerateExecutorMock(
                executablePath,
                "/quiet /severityThreshold:\"None\" /out:\"" + Path.Combine(defaultWorkingDir, "codeitright.xml") +
                "\" /Solution:\"" + Path.Combine(defaultWorkingDir, "test.sln") + "\"",
                defaultWorkingDir,
                600000);
            var fileSystemMock = this.InitialiseFileSystemMock(defaultWorkingDir);
            var task           = new CodeItRightTask(executor, fileSystemMock)
            {
                Solution = "test.sln"
            };

            Mock.Get(result).SetupProperty(_result => _result.Status);
            result.Status = IntegrationStatus.Unknown;
            task.Run(result);
            mocks.Verify();
        }