コード例 #1
0
        public void invoke_with_return_value()
        {
            var target = new Target();
            var method = ReflectionHelper.GetMethod<Target>(x => x.Fullname(null, null, null));

            var values = new StepValues(method.Name);
            values.Store("first", "Jeremy");
            values.Store("middle", "Daniel");
            values.Store("last", "Miller");
            values.Store("returnValue", "foo");

            var invocation = new MethodInvocation(method, target);
            invocation.Compile(target, CellHandling.Basic());

            invocation.Invoke(values).Single().actual.ShouldBe("Jeremy Daniel Miller");

        }
コード例 #2
0
        public void execute()
        {
            var target = new Target();
            var method = ReflectionHelper.GetMethod<Target>(x => x.Go(null, 0, 0));
            var invocation = new MethodInvocation(method, target);

            var values = new StepValues(method.Name);

            values.Store("name", "Jeremy");
            values.Store("age", 41);
            values.Store("percentAwake", 50.1);

            invocation.Invoke(values).ToArray();

            target.Name.ShouldBe("Jeremy");
            target.Age.ShouldBe(41);
            target.PercentAwake.ShouldBe(50.1);
        }
コード例 #3
0
        public void invoke_with_out_parameters_happy_path()
        {
            var age = 0;
            double percentAwake = 0;

            var target = new Target();
            var method = ReflectionHelper.GetMethod<Target>(x => x.GoOutput(null, out age, out percentAwake));

            var values = new StepValues(method.Name);
            values.Store("name", "Grace Potter");
            values.Store("age", 5);
            values.Store("percentAwake", .5);

            var invocation = new MethodInvocation(method, target);
            invocation.Compile(target, CellHandling.Basic());

            var results = invocation.Invoke(values).ToArray();

            results.ShouldHaveTheSameElementsAs(
                new CellResult("age", ResultStatus.success),
                new CellResult("percentAwake", ResultStatus.success)
            );
        }
コード例 #4
0
 public FactCheckMethod(MethodInfo method, object target)
 {
     _invocation = MethodInvocation.For(method, target);
 }
コード例 #5
0
ファイル: ValueCheckMethod.cs プロジェクト: jawn/Storyteller
 public ValueCheckMethod(MethodInfo method, object target)
 {
     _invocation = new MethodInvocation(method, target);
 }
コード例 #6
0
        public ActionMethodGrammar(MethodInfo method, object fixture)
        {
            _method = method;

            _invocation = MethodInvocation.For(method, fixture);
        }
コード例 #7
0
 public FactMethod(MethodInfo method, object target)
 {
     _method     = method;
     _invocation = new MethodInvocation(method, target);
 }