public void execute_the_method_with_a_step_and_store_the_actual() { MethodInfo method = ReflectionHelper.GetMethod<ReflectionTarget>(x => x.GetNameAndAge("", 0)); var grammar = new ReflectionValueCheck(method, new ReflectionTarget()); Step step = new Step("a").With("name", "Jeremy").With("age", 34); grammar.Execute(step).Results.ActualDisplay<string>(method.GetReturnValueAlias()).ShouldEqual("Jeremy is 34"); }
public void create_a_grammar_structure() { MethodInfo method = ReflectionHelper.GetMethod<ReflectionTarget>(x => x.GetNameAndAge("", 0)); var grammar = new ReflectionValueCheck(method, new ReflectionTarget()); var sentence = grammar.ToStructure(new FixtureLibrary()).ShouldBeOfType<Sentence>(); sentence.ShouldEqual(Sentence.For(method.GetTemplate(), Cell.For<string>("name"), Cell.For<int>("age"), Cell.For<string>("theValue"))); }
public void marks_the_testdata_with_wrong_if_the_actual_is_wrong() { MethodInfo method = ReflectionHelper.GetMethod<ReflectionTarget>(x => x.GetNameAndAge("", 0)); var grammar = new ReflectionValueCheck(method, new ReflectionTarget()); Step step = new Step("a").With("name", "Jeremy").With("age", 34).With("theValue", "the wrong value"); var data = new TestContext(); grammar.Execute(step, data); data.Counts.Wrongs.ShouldEqual(1); }