public void TestSurplus() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>BusinessObjectRowFixture</td></tr>"); builder.Append("<tr><td>GetFirstString</td></tr>"); builder.Append("<tr><td>number1</td></tr>"); builder.Append("</table>"); var parse = builder.Parse; BusinessObjectRowFixture.objects = new object[] { new BusinessObject(new[] { "number1" }), new BusinessObject(new[] { "number2" }), new BusinessObject(new[] { "number3" }) }; RunTest(new BusinessObjectRowFixture(), parse); Assert.IsTrue(parse.ToString().IndexOf("number1") > 0); Assert.IsTrue(parse.ToString().IndexOf("number2") > 0); Assert.IsTrue(parse.ToString().IndexOf("number3") > 0); TestUtils.CheckCounts(resultCounts, 1, 2, 0, 0); }
public void SetUp() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>"); builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>"); builder.Append("</table>"); myStoryTest = new StoryTest(builder.Parse, SimpleWriter); myStoryTest.Execute(new Configuration()); }
public void SetUp() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>"); builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>"); builder.Append("</table>"); myStoryTest = new StoryTest(builder.Parse, SimpleWriter); myStoryTest.Execute(new TypeDictionary()); }
public void TestLoadHandler() { Configuration configuration = TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">cell handler loader</td></tr>"); builder.Append("<tr><td>load</td><td>substring handler</td></tr>"); builder.Append("</table>"); Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); StoryTest test = builder.MakeStoryTest(); test.ExecuteOnConfiguration(configuration); Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
public void SetUp() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>"); builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>"); builder.Append("</table>"); table = builder.Parse.Parts; fixture = new ExampleTableFixture {Processor = new Service.Service()}; fixture.DoTable(table); resultCounts = fixture.TestStatus.Counts; }
static Parse BuildTable(IEnumerable<string> values) { var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>BusinessObjectRowFixture</td></tr>"); builder.Append("<tr><td>GetFirstString</td></tr>"); foreach (string value in values) { builder.Append("<tr><td>" + value + "</td></tr>"); } builder.Append("</table>"); return builder.Parse; }
public void TestEmptyHeaderCell() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">string fixture</td></tr>"); builder.Append("<tr><td>field</td><td></td></tr>"); builder.Append("<tr><td>some value</td><td>this is a comment</td></tr>"); builder.Append("</table>"); var table = builder.Parse; RunTest(table); TestUtils.CheckCounts(resultCounts, 0, 0, 0, 0); }
public void TestRemoveHandler() { Configuration configuration = TestUtils.InitAssembliesAndNamespaces(); new Service.Service(configuration).AddOperator(new CompareSubstring()); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">CellHandlerLoader</td></tr>"); builder.Append("<tr><td>remove</td><td>SubstringHandler</td></tr>"); builder.Append("</table>"); Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); var test = builder.MakeStoryTest(); test.ExecuteOnConfiguration(configuration); Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
static Parse BuildTable(IEnumerable <string> values) { var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>BusinessObjectRowFixture</td></tr>"); builder.Append("<tr><td>GetFirstString</td></tr>"); foreach (string value in values) { builder.Append("<tr><td>" + value + "</td></tr>"); } builder.Append("</table>"); return(builder.Parse); }
public void TestLoadHandler() { Configuration configuration = TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">cell handler loader</td></tr>"); builder.Append("<tr><td>load</td><td>substring handler</td></tr>"); builder.Append("</table>"); Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); StoryTest test = builder.MakeStoryTest(); test.ExecuteOnConfiguration(configuration); Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
public void TestEmptyHeaderCell() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">string fixture</td></tr>"); builder.Append("<tr><td>field</td><td></td></tr>"); builder.Append("<tr><td>some value</td><td>this is a comment</td></tr>"); builder.Append("</table>"); var table = builder.Parse; RunTest(new StringFixture(), table); TestUtils.CheckCounts(resultCounts, 0, 0, 0, 0); }
public void TestBlankCell() { var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"6\">string fixture</td></tr>"); builder.Append("<tr><td>field</td><td>field?</td><td>property</td><td>property?</td><td>set</td><td>get?</td></tr>"); builder.Append("<tr><td>blank</td><td>blank</td><td>blank</td><td>blank</td><td>blank</td><td>blank</td></tr>"); builder.Append("</table>"); var parse = builder.Parse; TestUtils.InitAssembliesAndNamespaces(); RunTest(parse); TestUtils.CheckCounts(resultCounts, 3, 0, 0, 0); }
public void TestNullCell() { var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">string fixture</td></tr>"); builder.Append("<tr><td>Field</td><td>Field?</td></tr>"); builder.Append("<tr><td></td><td>null</td></tr>"); builder.Append("</table>"); var parse = builder.Parse; TestUtils.InitAssembliesAndNamespaces(); RunTest(new StringFixture(), parse); TestUtils.CheckCounts(resultCounts, 1, 0, 0, 0); }
public void TestBlankCell() { var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"6\">string fixture</td></tr>"); builder.Append("<tr><td>field</td><td>field?</td><td>property</td><td>property?</td><td>set</td><td>get?</td></tr>"); builder.Append("<tr><td>blank</td><td>blank</td><td>blank</td><td>blank</td><td>blank</td><td>blank</td></tr>"); builder.Append("</table>"); var parse = builder.Parse; TestUtils.InitAssembliesAndNamespaces(); RunTest(new StringFixture(), parse); TestUtils.CheckCounts(resultCounts, 3, 0, 0, 0); }
public void TestNullCell() { var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">string fixture</td></tr>"); builder.Append("<tr><td>Field</td><td>Field?</td></tr>"); builder.Append("<tr><td></td><td>null</td></tr>"); builder.Append("</table>"); var parse = builder.Parse; TestUtils.InitAssembliesAndNamespaces(); RunTest(new StringFixture(), parse); TestUtils.CheckCounts(resultCounts, 1, 0, 0, 0); }
public void SetUp() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan='5'>ExampleTableFixture</td></tr>"); builder.Append("<tr><td>0,0</td><td>0,1</td><td>0,2</td><td>37</td><td></td></tr>"); builder.Append("</table>"); table = builder.Parse.Parts; fixture = new ExampleTableFixture { Processor = new Service.Service() }; fixture.DoTable(table); resultCounts = fixture.TestStatus.Counts; }
public void TestRemoveHandler() { Configuration configuration = TestUtils.InitAssembliesAndNamespaces(); new Service.Service(configuration).AddOperator(new CompareSubstring()); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">CellHandlerLoader</td></tr>"); builder.Append("<tr><td>remove</td><td>SubstringHandler</td></tr>"); builder.Append("</table>"); Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); var test = builder.MakeStoryTest(); test.ExecuteOnConfiguration(configuration); Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); }
public void TestExecuteAtEnd() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">ExecuteTestFixture</td></tr>"); builder.Append("<tr><td>Property</td><td>Property</td></tr>"); builder.Append("<tr><td>first call</td><td>second call</td></tr>"); builder.Append("</table>"); var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service()}; testFixture.DoTable(table); Assert.AreEqual(3, testFixture.Values.Count); Assert.AreEqual("first call", testFixture.Values[0]); Assert.AreEqual("second call", testFixture.Values[1]); Assert.AreEqual("Execute()", testFixture.Values[2]); }
public void TestStartsWithHandlerInSecondColumn() { processor.AddOperator(typeof(CompareStartsWith).FullName); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>people row fixture</td></tr>"); builder.Append("<tr><td>first name</td><td>last name</td></tr>"); builder.Append("<tr><td>Nigel</td><td>Tuf..</td></tr>"); builder.Append("</table>"); PeopleLoaderFixture.people.Clear(); PeopleLoaderFixture.people.Add(new Person("Nigel", "Tufnel")); var tables = builder.Parse; RunTest(new PeopleRowFixture(), tables); Assert.IsTrue(tables.ToString().IndexOf("Tuf..") > -1); Assert.IsFalse(tables.ToString().IndexOf("Tufnel") > -1); TestUtils.CheckCounts(resultCounts, 2, 0, 0, 0); }
public void TestExecuteInMiddle() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">ExecuteTestFixture</td></tr>"); builder.Append("<tr><td>Property</td><td>Property?</td><td>Property</td></tr>"); builder.Append("<tr><td>first call</td><td>null</td><td>second call</td></tr>"); builder.Append("</table>"); var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service() }; testFixture.DoTable(table); Assert.AreEqual(3, testFixture.Values.Count); Assert.AreEqual("first call", testFixture.Values[0]); Assert.AreEqual("Execute()", testFixture.Values[1]); Assert.AreEqual("second call", testFixture.Values[2]); }
public void TestExecuteDoesNotCauseMethodsToGetCalledThrice() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">ExecuteTestFixture</td></tr>"); builder.Append("<tr><td>Method()</td></tr>"); builder.Append("<tr><td>1</td></tr>"); builder.Append("<tr><td>2</td></tr>"); builder.Append("</table>"); var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service()}; testFixture.DoTable(table); Assert.AreEqual(4, testFixture.Values.Count); Assert.AreEqual("Execute()", testFixture.Values[0]); Assert.AreEqual("Method()", testFixture.Values[1]); Assert.AreEqual("Execute()", testFixture.Values[2]); Assert.AreEqual("Method()", testFixture.Values[3]); TestUtils.VerifyCounts(testFixture, 2, 0, 0, 0); }
[Test] public void UsesDynamicTarget() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>dynamic target fixture</td></tr>"); builder.Append("<tr><td>count?</td></tr>"); builder.Append("<tr><td>0</td></tr>"); builder.Append("<tr><td>1</td></tr>"); builder.Append("</table>"); var table = builder.Parse.Parts; var testFixture = new DynamicTargetFixture { Processor = new Service.Service() }; testFixture.DoTable(table); TestUtils.VerifyCounts(testFixture, 2, 0, 0, 0); }
public void TestExecuteDoesNotCauseMethodsToGetCalledThrice() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td colspan=\"2\">ExecuteTestFixture</td></tr>"); builder.Append("<tr><td>Method()</td></tr>"); builder.Append("<tr><td>1</td></tr>"); builder.Append("<tr><td>2</td></tr>"); builder.Append("</table>"); var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service() }; testFixture.DoTable(table); Assert.AreEqual(4, testFixture.Values.Count); Assert.AreEqual("Execute()", testFixture.Values[0]); Assert.AreEqual("Method()", testFixture.Values[1]); Assert.AreEqual("Execute()", testFixture.Values[2]); Assert.AreEqual("Method()", testFixture.Values[3]); TestUtils.VerifyCounts(testFixture, 2, 0, 0, 0); }
public void UsesDynamicTarget() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>dynamic target fixture</td></tr>"); builder.Append("<tr><td>count?</td></tr>"); builder.Append("<tr><td>0</td></tr>"); builder.Append("<tr><td>1</td></tr>"); builder.Append("</table>"); var table = builder.Parse.Parts; var testFixture = new DynamicTargetFixture{ Processor = new Service.Service()}; testFixture.DoTable(table); TestUtils.VerifyCounts(testFixture, 2, 0, 0, 0); }
public void TestStartsWithHandlerInSecondColumn() { processor.AddOperator(typeof(CompareStartsWith).FullName); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>people row fixture</td></tr>"); builder.Append("<tr><td>first name</td><td>last name</td></tr>"); builder.Append("<tr><td>Nigel</td><td>Tuf..</td></tr>"); builder.Append("</table>"); PeopleLoaderFixture.people.Clear(); PeopleLoaderFixture.people.Add(new Person("Nigel", "Tufnel")); var tables = builder.Parse; RunTest(new PeopleRowFixture(), tables); Assert.IsTrue(tables.ToString().IndexOf("Tuf..") > -1); Assert.IsFalse(tables.ToString().IndexOf("Tufnel") > -1); TestUtils.CheckCounts(resultCounts, 2, 0, 0, 0); }
public void TestMissing() { TestUtils.InitAssembliesAndNamespaces(); var builder = new TestBuilder(); builder.Append("<table>"); builder.Append("<tr><td>BusinessObjectRowFixture</td></tr>"); builder.Append("<tr><td>GetFirstString</td></tr>"); builder.Append("<tr><td>number1</td></tr>"); builder.Append("<tr><td>number2</td></tr>"); builder.Append("<tr><td>number3</td></tr>"); builder.Append("</table>"); var parse = builder.Parse; BusinessObjectRowFixture.objects = new object[] { new BusinessObject(new[] {"number1"}), }; RunTest(new BusinessObjectRowFixture(), parse); Assert.IsTrue(parse.ToString().IndexOf("number1") > 0); Assert.IsTrue(parse.ToString().IndexOf("number2") > 0); Assert.IsTrue(parse.ToString().IndexOf("number3") > 0); TestUtils.CheckCounts(resultCounts, 1, 2, 0, 0); }