public void simple_valid_case_of_configure_object_working() { Step step = new Step().With("age", 45); grammar1.Execute(step, context); target.Age.ShouldEqual(45); }
public void using_a_default_value() { var step = new Step(); grammar2.Execute(step, context); target.Name.ShouldEqual(grammar2.DefaultValue); }
public void execute_with_exceptions() { grammar = new ReadGrammar<int>("var", x => { throw new NotImplementedException(); }); Step step = new Step("some grammar").With("var", "1"); grammar.Execute(step).ShouldEqual(0, 0, 1, 0); }
public void negative_case_for_select() { var grammar = grammarForId("select1"); var step = new Step().With("data", "different"); grammar.Execute(step).Counts.ShouldEqual(0, 1, 0, 0); }
public void step_count_of_a_step_with_child_leaves_and_grand_children() { Step step = new Step().WithChildren("a", new Step(), new Step(), new Step().WithChildren("b", new Step()).WithChildren("c", new Step(), new Step())); step.StepCount().ShouldEqual(7); }
public void execute_happy_path() { Step step = new Step("some grammar").With("var", "13"); grammar.Execute(step).ShouldEqual(0, 0, 0, 0); whatWasRead.ShouldEqual(13); }
public static Step AddStep(this IPartHolder holder, string grammarKey) { var step = new Step(grammarKey); holder.Parts.Add(step); return step; }
public void negative_case_with_syntax_error() { var grammar = grammarForId("div1"); var step = new Step(); grammar.Execute(step).Counts.ShouldEqual(0, 0, 0, 1); }
public void positive_case_for_select_verifying_by_display() { var grammar = grammarForId("select1"); var step = new Step().With("data", "b"); grammar.Execute(step).Counts.ShouldEqual(1, 0, 0, 0); }
public void negative_case_against_div() { var grammar = grammarForId("div1"); var step = new Step().With("data", "different text"); grammar.Execute(step).Counts.ShouldEqual(0, 1, 0, 0); }
public void positive_case_against_div() { var grammar = grammarForId("div1"); var step = new Step().With("data", "the div text"); grammar.Execute(step).Counts.ShouldEqual(1, 0, 0, 0); }
public void step_childstepsfor_is_wired_up() { var step = new Step(); var child = new Step(); step.LeafFor("record").Add(child); step.LeafFor("record").AllSteps().ShouldContain(child); step.LeafFor("something else").AllSteps().ShouldNotContain(child); }
public void happy_path_creates_the_object_and_puts_it_on_the_TestContext() { Step step = new Step().With("name", "Josh"); grammar.Execute(step, context); context.CurrentObject.ShouldBeOfType<CreateObjectGrammarTarget>() .Name.ShouldEqual("Josh"); }
public void SetUp() { _theAddress = null; grammar = new ParagraphGrammar(); expression = new ObjectConstructionExpression<Address>(grammar); theStep = new Step(); }
public void read_incorrectly_formatted_step_value_increments_syntax_error() { Step step = new Step().With("DistanceFromOffice:abc"); var context = new TestContext(); match.ReadExpected(context, step, new SetRow()); context.Counts.ShouldEqual(0, 0, 0, 1); }
public void read_correctly_formatted_step_value() { Step step = new Step().With("DistanceFromOffice:112.5"); var row = new SetRow(); match.ReadExpected(new TestContext(), step, row); row.Values["DistanceFromOffice"].ShouldEqual(112.5); }
public void has_checks_the_cache() { var step = new Step("a"); step.Has("b").ShouldBeFalse(); step.Set("b", 123); step.Has("b").ShouldBeTrue(); }
public void happy_path_does_not_increment_the_counts() { Step step = new Step().With("name", "Josh"); grammar.Execute(step, context); context.Counts.ShouldEqual(0, 0, 0, 0); context.CurrentObject.ShouldBeOfType<CreateObjectGrammarTarget>() .Name.ShouldEqual("Josh"); }
public void accept_a_visitor() { var visitor = MockRepository.GenerateMock<ITestVisitor>(); var step = new Step("a"); step.AcceptVisitor(visitor); visitor.AssertWasCalled(x => x.RunStep(step)); }
public void write_preview_when_the_cell_value_is_missing_in_the_step() { var cell = Cell.For<string>("name"); var step = new Step(); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual("MISSING"); }
public void write_preview_when_the_cell_value_is_null_in_the_step() { var cell = Cell.For<string>("name"); var step = new Step(); step.Set("name", null); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual(Step.NULL); }
public void write_preview_when_the_cell_value_is_blank() { var cell = Cell.For<string>("name"); var step = new Step(); step.Set("name", string.Empty); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual(Step.BLANK); }
public void write_preview() { var cell = Cell.For<string>("name"); var step = new Step().With("name:Jeremy"); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual("Jeremy"); tag.HasClass(HtmlClasses.INPUT).ShouldBeTrue(); }
public void shallow_clone() { Step step = new Step("key").With("a:1,b:2,c:3"); IStep clone = step.ShallowClone(); clone.ShouldNotBeTheSameAs(step); clone.GrammarKey.ShouldEqual("key"); clone.Get("a").ShouldEqual(step.Get("a")); clone.Get("b").ShouldEqual(step.Get("b")); clone.Get("c").ShouldEqual(step.Get("c")); }
public void SetUp() { target = new BeforeAndAfterTarget(); grammar = new TableLineGrammar(target); step = new Step().With("FirstName:Jeremy,LastName:Miller,Age:23,State:TX"); StepExecutionResult execute = grammar.Execute(step); results = execute.Results; counts = execute.Counts; }
public void write_results_when_the_cell_is_just_an_input() { var cell = Cell.For<string>("name"); cell.IsResult = false; var step = new Step().With("name:Jeremy"); var tag = new CellTag(cell, step); tag.WriteResults(new StepResults(), new TestContext()); tag.Text().ShouldEqual("Jeremy"); tag.HasClass(HtmlClasses.INPUT).ShouldBeTrue(); }
public void read_step_successfully_if_it_exists_and_is_formatted_correctly() { Step step = new Step().With("City:Dallas,Distance:189"); var row = new SetRow(); var context = new TestContext(); _matchCity.ReadExpected(context, step, row); _matchDistance.ReadExpected(context, step, row); row.Values["City"].ShouldEqual("Dallas"); row.Values["Distance"].ShouldEqual(189); }
public void execute_successfully() { ReflectionAssertion assertion = ReflectionAssertion.Create(x => x.Success(), new AssertionFixture()); var step = new Step(); var context = new TestContext(); assertion.Execute(step, context); context.Counts.ShouldEqual(1, 0, 0, 0); step.Get("returnValue").Parse<bool>().ShouldBeTrue(); context.ResultsFor(step).ActualDisplay<bool>("returnValue").ShouldBeTrue(); }
public void execute_with_exception() { ReflectionAssertion assertion = ReflectionAssertion.Create(x => x.Exception(), new AssertionFixture()); var step = new Step(); var context = new TestContext(); assertion.Execute(step, context); context.Counts.ShouldEqual(0, 0, 1, 0); step.Get("returnValue").Parse<bool>().ShouldBeTrue(); context.ResultsFor(step).ActualDisplay<bool>("returnValue").ShouldBeFalse(); context.ResultsFor(step).ExceptionText.ShouldContain("NotImplementedException"); }
public void SetUp() { grammar = Fixture.VerifyStringList(() => { throw new NotImplementedException(); }).Titled( "The list of strings should be").LeafNameIs("row").Grammar(); step = new Step("anything").WithChildren("row", new Step(), new Step(), new Step()); var context = new TestContext(); grammar.Execute(step, context); counts = context.Counts; rowResults = context.ResultsFor(step).GetResult<IList<SetRow>>(grammar.LeafName); stepResults = context.ResultsFor(step); }