예제 #1
0
        public void ShouldOutputDateOfModification()
        {
            string input     = string.Format(@"<cruisecontrol>{0}</cruisecontrol>", ModificationString("2002-10-02 09:55"));
            string actualXml = LoadStylesheetAndTransformInput(input);

            CustomAssertion.AssertContains("2002-10-02 09:55", actualXml);
        }
        public void ShouldRenderErrorMessageAtTheStartOfLine()
        {
            string input = @"error CS1504: Source file 'C:\Beachball\Checkout\shared\Model\beachball-schema1.cs' could not be opened ('The system cannot find the file specified. ')";

            string actualXml = LoadStylesheetAndTransformInput(CreateInfoMessage(input));

            CustomAssertion.AssertContains("error CS1504: Source file", actualXml);
        }
예제 #3
0
        public void ShouldOutputIntegrationRequest()
        {
            string input = @"<cruisecontrol><request>foobar</request></cruisecontrol>";

            string actualXml = LoadStylesheetAndTransformInput(input);

            CustomAssertion.AssertContains("foobar", actualXml);
        }
        public void ShouldRenderWarnings()
        {
            string xml       = WrapInBuildResultsElement(@"<msbuild><warning file=""c:\temp\foo.txt"" line=""10"" column=""23"">Invalid behaviour.</warning></msbuild>");
            string actualXml = LoadStylesheetAndTransformInput(xml);

            CustomAssertion.AssertContains(@"c:\temp\foo.txt", actualXml);
            CustomAssertion.AssertContains("(10,23)", actualXml);
            CustomAssertion.AssertContains("Invalid behaviour.", actualXml);
        }
        public void ShouldRenderNAntBuildErrorElement()
        {
            string xml = string.Format(@"<cruisecontrol><build><buildresults><failure><builderror>
	<message>External Program Failed: D:\tools\cvsexe\cvswithplinkrsh.bat (return code was 1)</message>
</builderror></failure></buildresults></build></cruisecontrol>");

            string actualXml = LoadStylesheetAndTransformInput(CreateInfoMessage(xml));

            CustomAssertion.AssertContains("External Program Failed:", actualXml);
        }
        public void ShouldShowTestDetailsIfIncludingOutputFromNAnt()
        {
            string xml = @"<cruisecontrol><build><buildresults><target><task>
                    <test-results total=""6"" failures=""0"" not-run=""0"" date=""2005-04-29"" time=""9:02 PM"">
						<test-suite />
					</test-results>
				</task></target></buildresults></build></cruisecontrol>"                ;

            string actualXml = LoadStylesheetAndTransformInput(xml);

            CustomAssertion.AssertContains("6\xA0tests", actualXml);
        }
        public void VerifyPowerShellProcessInfoBasic()
        {
            ProcessInfo   info          = null;
            ProcessResult processResult = new ProcessResult("output", "error", 0, false);

            mockProcessExecutor.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).
            Callback <ProcessInfo>(processInfo => info = processInfo).Returns(processResult).Verifiable();
            mytask.Executable = POWERSHELL_PATH;
            mytask.Script     = "MyScipt.ps1";

            mytask.Run(IntegrationResult());

            Assert.AreEqual(POWERSHELL_PATH, info.FileName);
            Assert.AreEqual(PowerShellTask.DefaultBuildTimeOut * 1000, info.TimeOut);
            CustomAssertion.AssertContains(mytask.Script, info.Arguments);
        }
        public void ShouldRenderNAntInternalErrorElement()
        {
            string xml = string.Format(@"<cruisecontrol><build><buildresults><failure><internalerror>
      <type>System.IO.FileNotFoundException</type>
      <message><![CDATA[Could not load file or assembly 'nunit.core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cannot find the file specified.]]></message>
      <stacktrace><![CDATA[   at NAnt.NUnit2.Tasks.NUnit2Task.ExecuteTask()
   at NAnt.Core.Task.Execute()
   at NAnt.Core.Target.Execute()
   at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
   at NAnt.Core.Project.Execute()
   at NAnt.Core.Project.Run()]]></stacktrace>
    </internalerror></failure></buildresults></build></cruisecontrol>");

            string actualXml = LoadStylesheetAndTransformInput(CreateInfoMessage(xml));

            CustomAssertion.AssertContains("Could not load file or assembly 'nunit.core", actualXml);
        }
        public void ShouldRenderTotalTestsWhenAllTestsPass()
        {
            string xml       = WrapInTestsElement(@"<TestRun type=""Microsoft.VisualStudio.TestTools.Common.TestRun"">
<result type=""Microsoft.VisualStudio.TestTools.Common.RunResultAndStatistics"">
  <totalTestCount type=""System.Int32"">29</totalTestCount> 
  <executedTestCount type=""System.Int32"">29</executedTestCount> 
  <passedTestCount type=""System.Int32"">29</passedTestCount> 
</result></TestRun>");
            string actualXml = LoadStylesheetAndTransformInput(xml);

            Console.Out.WriteLine("actualXml = {0}", actualXml);
            CustomAssertion.AssertContains("Tests run: 29", actualXml);
            CustomAssertion.AssertContains("Failures: 0", actualXml);
            CustomAssertion.AssertContains("Not run: 0", actualXml);
            CustomAssertion.AssertContains("All tests passed.", actualXml);
            CustomAssertion.AssertNotContains("FooTest", actualXml);
        }
        public void VerifyPowerShellProcessInfoBasic()
        {
            CollectingConstraint constraint    = new CollectingConstraint();
            ProcessResult        processResult = new ProcessResult("output", "error", 0, false);

            mockProcessExecutor.ExpectAndReturn("Execute", processResult, new object[] { constraint });
            mytask.Executable = POWERSHELL_PATH;
            mytask.Script     = "MyScipt.ps1";

            mytask.Run(IntegrationResult());

            ProcessInfo info = (ProcessInfo)constraint.Parameter;

            Assert.AreEqual(POWERSHELL_PATH, info.FileName);
            Assert.AreEqual(PowerShellTask.DefaultBuildTimeOut * 1000, info.TimeOut);
            CustomAssertion.AssertContains(mytask.Script, info.Arguments);
        }
        public void ShouldRenderFailedTests()
        {
            string xml       = WrapInTestsElement(@"<TestRun type=""Microsoft.VisualStudio.TestTools.Common.TestRun"">
<result type=""Microsoft.VisualStudio.TestTools.Common.RunResultAndStatistics"">
  <totalTestCount type=""System.Int32"">29</totalTestCount> 
  <executedTestCount type=""System.Int32"">28</executedTestCount> 
  <passedTestCount type=""System.Int32"">27</passedTestCount> 
</result></TestRun>
<UnitTestResult type=""Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"">
	<outcome type=""Microsoft.VisualStudio.TestTools.Common.TestOutcome"">
		<value__ type=""System.Int32"">1</value__>
	</outcome>
	<errorInfo type=""Microsoft.VisualStudio.TestTools.Common.TestResultErrorInfo"">
		<message type=""System.String"">
		Test method Com.Suncor.Olt.Common.DataAccess.DatabaseGatewayTest.ShouldNotAcceptWrongNumberOfParameters threw exception:  System.ApplicationException: Received 7 parameters for InsertFoo, expected 1.
		</message>
		<stackTrace type=""System.String"">
    at Com.Suncor.Olt.Common.DataAccess.DatabaseGateway.CheckNumberOfInputParameters(IDbCommand command, String procedureName, Object[] parameters) in C:\Projects\OLT\src\Common\App\DataAccess\DatabaseGateway.cs:line 148
   at Com.Suncor.Olt.Common.DataAccess.DatabaseGateway.ExecuteNonQuery(String procedureName, Object[] parameters) in C:\Projects\OLT\src\Common\App\DataAccess\DatabaseGateway.cs:line 78
   at Com.Suncor.Olt.Common.DataAccess.DatabaseGatewayTest.ShouldNotAcceptWrongNumberOfParameters() in C:\Projects\OLT\src\Common\Test.UnitTest\DataAccess\DatabaseGatewayTest.cs:line 90
		</stackTrace>
	</errorInfo>
	<testName type=""System.String"">ShouldNotAcceptWrongNumberOfParameters</testName>
</UnitTestResult>
<UnitTestResult type=""Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"">
	<outcome type=""Microsoft.VisualStudio.TestTools.Common.TestOutcome"">
		<value__ type=""System.Int32"">10</value__>
	</outcome>
	<testName type=""System.String"">FooTest</testName>
</UnitTestResult>");
            string actualXml = LoadStylesheetAndTransformInput(xml);

            CustomAssertion.AssertContains("Tests run: 28", actualXml);
            CustomAssertion.AssertContains("Failures: 1", actualXml);
            CustomAssertion.AssertContains("Not run: 1", actualXml);
            CustomAssertion.AssertNotContains("All tests passed.", actualXml);
            CustomAssertion.AssertContains("ShouldNotAcceptWrongNumberOfParameters", actualXml);
            CustomAssertion.AssertContains("System.ApplicationException", actualXml);
            CustomAssertion.AssertContains("Stacktrace", actualXml);
            CustomAssertion.AssertNotContains("FooTest", actualXml);
        }