Beispiel #1
0
        [Test] public void EmptyAndNonEmptyDifferent()
        {
            var table1 = new FixtureTable(Parse.ParseFrom("<table><tr><td>actual</td></tr></table>"));
            var table2 = new FixtureTable(null);

            Assert.AreEqual("expected: null, was '<table>'", table1.Differences(table2));
        }
Beispiel #2
0
        [Test] public void EmptyTablesMatch()
        {
            var table1 = new FixtureTable(null);
            var table2 = new FixtureTable(null);

            Assert.AreEqual(string.Empty, table1.Differences(table2));
        }
Beispiel #3
0
        public override void DoTable(Parse theTable)
        {
            Parse embeddedTables = GetEmbeddedTables(theTable);
            Parse expectedCell   = GetExpectedCell(theTable);

            var storyTest = new StoryTest(new Parse("div", string.Empty, embeddedTables, null), SpecifyWriter);

            storyTest.Execute(Processor.Configuration);

            SetEmbeddedTables(theTable, resultTables);

            if (expectedCell != null)
            {
                var    actual      = new FixtureTable(resultTables);
                var    expected    = new FixtureTable(expectedCell.Parts);
                string differences = actual.Differences(expected);
                if (differences.Length == 0)
                {
                    Right(expectedCell);
                }
                else
                {
                    Wrong(expectedCell);
                    expectedCell.More = ParseNode.MakeCells(Escape(differences));
                    expectedCell.More.SetAttribute(CellAttribute.Status, TestStatus.Wrong);
                }
            }
        }
Beispiel #4
0
        [Test] public void AlternateStackTraceStartsWithExpectedMatches()
        {
            var table1 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same<span class=\"fit_stacktrace\">stack trace blah blah</span></td></tr></table>"));

            var table2 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same<span class=\"fit_label\">stack trace</span></td></tr></table>>"));

            Assert.AreEqual(string.Empty, table1.Differences(table2));
        }
Beispiel #5
0
        [Test] public void StackTraceWithoutExceptionNameMatches()
        {
            var table1 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same<span class=\"fit_stacktrace\">x.y.z: stack: trace</span></td></tr></table>"));

            var table2 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same<span class=\"fit_stacktrace\">stack: trace</span></td></tr></table>>"));

            Assert.AreEqual(string.Empty, table1.Differences(table2));
        }
Beispiel #6
0
        [Test] public void EmptyTableCellsMatch()
        {
            var table1 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same</td><td></td></tr></table>"));

            var table2 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same</td><td></td></tr></table>"));

            Assert.AreEqual(string.Empty, table1.Differences(table2));
        }
Beispiel #7
0
        [Test] public void TableCellTagsDifferent()
        {
            var table1 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td class=\"actual\">same</td></tr></table>"));

            var table2 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same</td></tr></table>"));

            Assert.AreEqual("in <table>, in <tr>, expected: '<td>', was '<td class=\"actual\">'", table1.Differences(table2));
        }
Beispiel #8
0
        [Test] public void TableCellsDifferent()
        {
            var table1 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same</td><td>actual</td></tr></table>"));

            var table2 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same</td><td>expected</td></tr></table>"));

            Assert.AreEqual("in <table>, in <tr>, in <td> body, expected: 'expected', was 'actual'", table1.Differences(table2));
        }
Beispiel #9
0
        [Test] public void StackTraceNoneExpectedDifferent()
        {
            var table1 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same<span class=\"fit_stacktrace\">stack trace blah blah</span></td></tr></table>"));

            var table2 = new FixtureTable(Parse.ParseFrom(
                                              "<table><tr><td>same</td></tr></table>>"));

            Assert.AreEqual("in <table>, in <tr>, in <td> body, expected: null, was 'stack trace blah blah'", table1.Differences(table2));
        }