public void passes_the_template_to_the_sentence() { var grammar = new CurriedLineGrammar("{a} should be now", (IGrammarWithCells)fixture["Go1"], "b:2,c:3"); Sentence sentence = (Sentence)grammar.ToStructure(new FixtureLibrary()); sentence.PartCount.ShouldEqual(2); sentence.Parts[0].ShouldBeOfType <TextInput>().Cell.Key.ShouldEqual("a"); sentence.Parts[1].ShouldBeOfType <Label>().Text.ShouldEqual(" should be now"); }
public void create_a_curried_grammar_import() { ClassUnderTest.GrammarKey = "StartWith"; ClassUnderTest.CurryAction = new CurryAction() { DefaultValues = "starting:5", Template = "Start with 5" }; CurriedLineGrammar grammar = theGrammarFound.ShouldBeOfType <CurriedLineGrammar>(); grammar.Inner.ShouldBeTheSameAs(fixture["StartWith"]); grammar.Template.ShouldEqual("Start with 5"); // Verifying that the curried grammar has the default values grammar.Execute(new Step()); fixture.TheValueShouldBe().ShouldEqual(5); }
public void should_have_cells_for_everything_that_is_not_optional_in_the_inner_grammar_and_there_is_no_default_3() { var grammar = new CurriedLineGrammar("{a} should be now", (IGrammarWithCells)fixture["Go1"], "b:2,c:3"); grammar.GetCells().ShouldHaveTheSameElementsAs(Cell.For <string>("a")); }
public void should_have_cells_for_an_optional_cell_in_the_inner_that_is_part_of_the_template_in_the_curried_grammar() { var grammar = new CurriedLineGrammar("{a} and {c}", (IGrammarWithCells)fixture["Go2"], "b:2"); grammar.GetCells().ShouldHaveTheSameElementsAs(Cell.For <string>("a"), Cell.For <string>("c")); }