Example #1
0
        public void TestResultParser_XNullMessage_Zero()
        {
            string message = "Test has failed.\nAssert.NotNull() Failure\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal(String.Empty, expected);
        }
Example #2
0
        public void TestResultParser_NNotNullMessage_Zero()
        {
            string message = "  Expected: not null\n  But was:  null\n\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("not null", expected);
        }
Example #3
0
        public void TestResultParser_MbNotNullMessage_Zero()
        {
            string message = "Expected 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   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.InvokeMethod(Object instance, MethodInfo methodInfo, Int32 testTimeout, Object[] parameters)\n   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.Execute(Object instance, MethodInfo methodInfo, List`1 tasks, Int32 testTimeout, Object[] parameters, Object expectedResult)\n   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.Execute(Object instance, TestMethod test, MethodInfo methodInfo, List`1 tasks, Int32 testTimeout)\n   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.Execute(TestMethodCollection tests, Boolean needToFilterByAssembly)\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("non-null", expected);
        }
Example #4
0
        public void TestResultParser_NIntMessage_Zero()
        {
            string message = "Expected: 0\n  But was:  1\n\nVoid That(System.Object, NUnit.Framework.Constraints.Constraint, System.String, System.Object[])\nVoid AreEqual(Int32, Int32, System.String, System.Object[])\nVoid AreEqual(Int32, Int32)\nC:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\NUnitTests.cs(417, 4) : Void IntFail9()\n\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("0", expected);
        }
        public void TestResultParser_NNotNullMessage_Null()
        {
            string message = "  Expected: not null\n  But was:  null\n\n";

            string actual = TestResultParser.Actual(message);

            Assert.Equal("null", actual);
        }
Example #6
0
        public void TestResultParser_XStringMessage_Who()
        {
            string message = "Assert.Equal() Failure\nPosition: First difference is at position 6\r\nExpected: who's there\r\nActual:   who's where";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("who's there", expected);
        }
Example #7
0
        public void TestResultParser_MbStringMessage_Who()
        {
            string message = "Expected 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   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.InvokeMethod(Object instance, MethodInfo methodInfo, Int32 testTimeout, Object[] parameters)\n   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.Execute(Object instance, MethodInfo methodInfo, List`1 tasks, Int32 testTimeout, Object[] parameters, Object expectedResult)\n   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.Execute(Object instance, TestMethod test, MethodInfo methodInfo, List`1 tasks, Int32 testTimeout)\n   at DevExpress.CodeRush.Core.Testing.UnitTestDomain.Execute(TestMethodCollection tests, Boolean needToFilterByAssembly)\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("\"who's there\"", expected);
        }
Example #8
0
        public void LineNumberParser_XStringFailStackVb_CorrectLineNumber()
        {
            string stack = "Void That(System.Object, NUnit.Framework.Constraints.Constraint, System.String, System.Object[])\nVoid AreEqual(System.Object, System.Object, System.String, System.Object[])\nVoid AreEqual(System.Object, System.Object)\nC:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\VBPlayground\\Class1.vb(11, 9) : Void DoSomething()";

            int lineNumber = TestResultParser.LineNumber(stack);

            Assert.Equal(11, lineNumber);
        }
Example #9
0
        public void LineNumberParser_XStringFailStack_CorrectLineNumber()
        {
            string stack = "Void Equal[T](T, T, System.Collections.Generic.IComparer`1[T])\nVoid Equal[T](T, T)\nC:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\xUnitTests.cs(39, 13) : Void AlwaysFails()\n\n";

            int lineNumber = TestResultParser.LineNumber(stack);

            Assert.Equal(39, lineNumber);
        }
Example #10
0
        public void LineNumberParser_NStringFailStack_CorrectLineNumber()
        {
            string stack = "Void That(System.Object, NUnit.Framework.Constraints.Constraint, System.String, System.Object[])\nVoid AreEqual(System.Object, System.Object, System.String, System.Object[])\nVoid AreEqual(System.Object, System.Object)\nC:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\NUnitTests.cs(410, 4) : Void AlwaysFails9()\n";

            int lineNumber = TestResultParser.LineNumber(stack);

            Assert.Equal(410, lineNumber);
        }
Example #11
0
        public void LineNumberParser_MbStringFailStack_CorrectLineNumber()
        {
            string stack = "c:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\Gallio\\Gallio\\Framework\\Assertions\\AssertionContext.cs(286, 21) : Void ThrowFailureAccordingToBehavior(Gallio.Framework.Assertions.AssertionFailure)\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\Gallio\\Gallio\\Framework\\Assertions\\AssertionContext.cs(243, 21) : Void SubmitFailure(Gallio.Framework.Assertions.AssertionFailure, Boolean)\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\Gallio\\Gallio\\Framework\\Assertions\\AssertionContext.cs(105, 13) : Void SubmitFailure(Gallio.Framework.Assertions.AssertionFailure)\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\Gallio\\Gallio\\Framework\\Assertions\\AssertionHelper.cs(100, 17) : Void Fail(Gallio.Framework.Assertions.AssertionFailure)\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\Gallio\\Gallio\\Framework\\Assertions\\AssertionHelper.cs(90, 13) : Void Verify(Gallio.Common.Func`1[Gallio.Framework.Assertions.AssertionFailure])\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\MbUnit\\MbUnit\\Framework\\Assert.Comparisons.cs(108, 13) : Void AreEqual[T](T, T, Gallio.Common.EqualityComparison`1[T], System.String, System.Object[])\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\MbUnit\\MbUnit\\Framework\\Assert.Comparisons.cs(52, 13) : Void AreEqual[T](T, T, System.String, System.Object[])\nc:\\RelEng\\Projects\\MbUnit v3.1\\Work\\src\\MbUnit\\MbUnit\\Framework\\Assert.Comparisons.cs(38, 13) : Void AreEqual[T](T, T)\nC:\\Users\\JAARGERO.WRPWI\\Documents\\Visual Studio 2005\\Projects\\RedGreenPlayground\\RedGreenPlayground\\MbUnitTests.cs(21, 13) : Void AlwaysFails()";

            int lineNumber = TestResultParser.LineNumber(stack);

            Assert.Equal(21, lineNumber);
        }
        public void TestResultParser_XNullMessage_Empty()
        {
            string message = "Test has failed.\nAssert.NotNull() Failure\n";

            string actual = TestResultParser.Actual(message);

            Assert.Equal(String.Empty, actual);
        }
Example #13
0
        public void TestResultParser_NStringMessageVb_Who()
        {
            string message = "Expected string length 3 but was 4. Strings differ at index 2.\n  Expected: \"who\"\n  But was:  \"what\"\n  -------------^\n\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("\"who\"", expected);
        }
Example #14
0
        public void TestResultParser_XIntMessage_Zero()
        {
            string message = "Assert.Equal() Failure\nExpected: 0\r\nActual:   1\n";

            string expected = TestResultParser.Expected(message);

            Assert.Equal("0", expected);
        }
        public void TestResultParser_XIntMessage_One()
        {
            string message = "Assert.Equal() Failure\nExpected: 0\r\nActual:   1";

            string actual = TestResultParser.Actual(message);

            Assert.Equal("1", actual);
        }
        private static bool parseContent(string contentString, out GraderResult result)
        {
            var parser = new TestResultParser();
            var graderResultBuilder = new GraderResultBuilder();

            var outcome = parser.Parse(contentString.Split('#'), graderResultBuilder, NullLogger.Instance);

            result = graderResultBuilder.ToResult();
            return(outcome);
        }
Example #17
0
        public void TestResultParser_NStringMessageVb_2()
        {
            string message  = "Expected string length 3 but was 4. Strings differ at index 2.\n  Expected: \"who\"\n  But was:  \"what\"\n  -------------^\n\n";
            string expected = TestResultParser.Expected(message);
            string actual   = TestResultParser.Actual(message);

            int differAt = TestResultParser.DifferAt(message, expected, actual);

            Assert.Equal(2, differAt);
        }
Example #18
0
        public void TestResultParser_NIntMessage_0()
        {
            string message  = "  Expected: 0\n  But was:  1\n\n";
            string expected = TestResultParser.Expected(message);
            string actual   = TestResultParser.Actual(message);

            int differAt = TestResultParser.DifferAt(message, expected, actual);

            Assert.Equal(0, differAt);
        }
Example #19
0
        public void TestResultParser_XIntMessage_0()
        {
            string message  = "Assert.Equal() Failure\nExpected: 0\nActual:   1\n";
            string expected = TestResultParser.Expected(message);
            string actual   = TestResultParser.Actual(message);

            int differAt = TestResultParser.DifferAt(message, expected, actual);

            Assert.Equal(0, differAt);
        }
Example #20
0
        public void TestResultParser_XStringMessage_6()
        {
            string message  = "Assert.Equal() Failure\nPosition: First difference is at position 6\nExpected: who's there\nActual:   who's where";
            string expected = TestResultParser.Expected(message);
            string actual   = TestResultParser.Actual(message);

            int differAt = TestResultParser.DifferAt(message, expected, actual);

            Assert.Equal(6, differAt);
        }