public void ShouldThrowExceptionIfTestsFailed()
        {
            executorMock.ExpectAndReturn("Execute", ProcessResultFixture.CreateNonZeroExitCodeResult(), new object[] { new IsAnything() });

            task = new NUnitTask((ProcessExecutor)executorMock.MockInstance);
            Assert.That(delegate { task.Run(result); },
                        Throws.TypeOf <CruiseControlException>());
        }
Exemplo n.º 2
0
        public void CreateFailedXmlFromDevenvOutput()
        {
            string stdOut = @"------ Build started: Project: Refactoring, Configuration: Debug .NET ------

Performing main compilation...
D:\dev\Refactoring\Movie.cs(30,2): error CS1513: } expected" + "\0" + @"

Build complete -- 1 errors, 0 warnings";
            string stdErr = @"Package 'Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage, Microsoft.VisualStudio.TeamFoundation.VersionControl, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed to load.";

            string expected = @"<buildresults>" +
                              "<message>------ Build started: Project: Refactoring, Configuration: Debug .NET ------</message>" +
                              "<message>Performing main compilation...</message>" +
                              @"<message>D:\dev\Refactoring\Movie.cs(30,2): error CS1513: } expected</message>" +
                              "<message>Build complete -- 1 errors, 0 warnings</message>" +
                              "<message level=\"error\">Package 'Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage, Microsoft.VisualStudio.TeamFoundation.VersionControl, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed to load.</message>" +
                              "</buildresults>";

            DevenvTaskResult result = new DevenvTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult(stdOut, stdErr), null);

            Assert.AreEqual(expected, result.Data);
        }
        public void FailedIfProcessResultFailed()
        {
            ProcessTaskResult result = new ProcessTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult());

            Assert.IsFalse(result.CheckIfSuccess());
        }
        public void ShouldThrowExceptionIfTestsFailed()
        {
            executorMock.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).Returns(ProcessResultFixture.CreateNonZeroExitCodeResult()).Verifiable();

            task = new NUnitTask((ProcessExecutor)executorMock.Object);
            Assert.That(delegate { task.Run(result); },
                        Throws.TypeOf <CruiseControlException>());
        }