Пример #1
0
        public void ResultSplitter()
        {
            using (Gallio3_1DataSource reader = new Gallio3_1DataSource())
            {
                MbUnit3_1ResultParser parser = new MbUnit3_1ResultParser();
                string        line           = reader.ReadLine();
                StringBuilder result;
                while (line != "running the tests.")
                {                // eat the preamble
                    line = reader.ReadLine().ToLower();
                }
                line = reader.ReadLine();

                string correct;
                result = new StringBuilder();
                parser.ReadNextTextResult(reader, ref line, result);
                correct = "[failed] Test RedGreenPlayground/MbUnitTests/AlwaysFails\nExpected values to be equal.\n\nExpected Value : \"who\'s there\"\nActual Value   : \"who\'s where\"\n\n   at RedGreenPlayground.MbUnitTests.AlwaysFails() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 21\n\n\n";
                Assert.Equal(correct, result.ToString());

                result = new StringBuilder();
                parser.ReadNextTextResult(reader, ref line, result);
                correct = "[passed] Test RedGreenPlayground/MbUnitTests/AlwaysPass\n";
                Assert.Equal(correct, result.ToString());

                result = new StringBuilder();
                parser.ReadNextTextResult(reader, ref line, result);
                correct = "[failed] Test RedGreenPlayground/MbUnitTests/IntFail\nExpected values to be equal.\n\nExpected Value : 0\nActual Value   : 1\n\n   at RedGreenPlayground.MbUnitTests.IntFail() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 28\n\n\n";
                Assert.Equal(correct, result.ToString());

                result = new StringBuilder();
                parser.ReadNextTextResult(reader, ref line, result);
                correct = "[failed] Test RedGreenPlayground/MbUnitTests/NotNull\nExpected value to be non-null.\n\nActual Value : null\n\n   at RedGreenPlayground.MbUnitTests.NotNull() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 41\n\n\n";
                Assert.Equal(correct, result.ToString());

                result = new StringBuilder();
                parser.ReadNextTextResult(reader, ref line, result);
                correct = "[failed] Test RedGreenPlayground/MbUnitTests/Skipped\nExpected values to be equal.\n\nExpected Value : 5\nActual Value   : 500\n\n   at RedGreenPlayground.MbUnitTests.Skipped() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 34\n\n\n";
                Assert.Equal(correct, result.ToString());

                result = new StringBuilder();
                parser.ReadNextTextResult(reader, ref line, result);
                correct = "[failed] Test RedGreenPlayground/MbUnitTests/Throws\nExecute\nSystem.Exception: misc exception\n   at RedGreenPlayground.MbUnitTests.Throws() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 50\n\nHost stopped at 12/16/2009 7:22:44 AM.\nHost process exited with code: 0\nHost started at 12/16/2009 7:22:45 AM.\nRunning under CLR v2.0.50727 runtime.\nHost stopped at 12/16/2009 7:22:47 AM.\nHost process exited with code: 0\nHost started at 12/16/2009 7:22:48 AM.\nRunning under CLR v2.0.50727 runtime.\nHost stopped at 12/16/2009 7:22:53 AM.\nHost process exited with code: 0\nDisposing the test runner.\nStop time: 7:22 AM (Total execution time: 22.019 seconds)\n\n6 run, 1 passed, 5 failed, 0 inconclusive, 0 skipped\n\n\n";
                Assert.Equal(correct, result.ToString());

                Assert.Equal(null, line);
            }
        }
		public void ResultSplitter()
		{
			using (Gallio3_1DataSource reader = new Gallio3_1DataSource())
			{
				MbUnit3_1ResultParser parser = new MbUnit3_1ResultParser();
				string line = reader.ReadLine();
				StringBuilder result;
				while (line != "running the tests.")
				{// eat the preamble
					line = reader.ReadLine().ToLower();
				}
				line = reader.ReadLine();

				string correct;
				result = new StringBuilder();
				parser.ReadNextTextResult(reader, ref line, result);
				correct = "[failed] Test RedGreenPlayground/MbUnitTests/AlwaysFails\nExpected values to be equal.\n\nExpected Value : \"who\'s there\"\nActual Value   : \"who\'s where\"\n\n   at RedGreenPlayground.MbUnitTests.AlwaysFails() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 21\n\n\n";
				Assert.Equal(correct, result.ToString());
	
				result = new StringBuilder();
				parser.ReadNextTextResult(reader, ref line, result);
				correct = "[passed] Test RedGreenPlayground/MbUnitTests/AlwaysPass\n";
				Assert.Equal(correct, result.ToString());
				
				result = new StringBuilder();
				parser.ReadNextTextResult(reader, ref line, result);
				correct = "[failed] Test RedGreenPlayground/MbUnitTests/IntFail\nExpected values to be equal.\n\nExpected Value : 0\nActual Value   : 1\n\n   at RedGreenPlayground.MbUnitTests.IntFail() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 28\n\n\n";
				Assert.Equal(correct, result.ToString());
				
				result = new StringBuilder();
				parser.ReadNextTextResult(reader, ref line, result);
				correct = "[failed] Test RedGreenPlayground/MbUnitTests/NotNull\nExpected value to be non-null.\n\nActual Value : null\n\n   at RedGreenPlayground.MbUnitTests.NotNull() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 41\n\n\n";
				Assert.Equal(correct, result.ToString());
				
				result = new StringBuilder();
				parser.ReadNextTextResult(reader, ref line, result);
				correct = "[failed] Test RedGreenPlayground/MbUnitTests/Skipped\nExpected values to be equal.\n\nExpected Value : 5\nActual Value   : 500\n\n   at RedGreenPlayground.MbUnitTests.Skipped() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 34\n\n\n";
				Assert.Equal(correct, result.ToString());
				
				result = new StringBuilder();
				parser.ReadNextTextResult(reader, ref line, result);
				correct = "[failed] Test RedGreenPlayground/MbUnitTests/Throws\nExecute\nSystem.Exception: misc exception\n   at RedGreenPlayground.MbUnitTests.Throws() in C:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs:line 50\n\nHost stopped at 12/16/2009 7:22:44 AM.\nHost process exited with code: 0\nHost started at 12/16/2009 7:22:45 AM.\nRunning under CLR v2.0.50727 runtime.\nHost stopped at 12/16/2009 7:22:47 AM.\nHost process exited with code: 0\nHost started at 12/16/2009 7:22:48 AM.\nRunning under CLR v2.0.50727 runtime.\nHost stopped at 12/16/2009 7:22:53 AM.\nHost process exited with code: 0\nDisposing the test runner.\nStop time: 7:22 AM (Total execution time: 22.019 seconds)\n\n6 run, 1 passed, 5 failed, 0 inconclusive, 0 skipped\n\n\n";
				Assert.Equal(correct, result.ToString());
			
				Assert.Equal(null, line);
			}
		}