public void it_can_use_params_at_any_step()
        {
            string secondStep = null;
            var wf = new StatefulWorkflow<ITest>("wf");
            wf.Yield(13);
            wf.Do((x, i) => { x.Ping((int)i["i"]); });
            wf.Do((x, opts) => secondStep = (string)opts["o"]);

            var test = Mock.Of<ITest>(x => (int)x.GetStateId("wf") == 13);
            var mock = Mock.Get(test);
            wf.StartWithParams(test, new { i = 42, o = "hello" });
            mock.Verify(x => x.SetStateId("wf", null));
            mock.Verify(x => x.Ping((int)42));
            secondStep.ShouldBe("hello");
        }
Beispiel #2
0
        public void it_can_use_params_at_any_step()
        {
            string secondStep = null;
            var    wf         = new StatefulWorkflow <ITest>("wf");

            wf.Yield(13);
            wf.Do((x, i) => { x.Ping((int)i["i"]); });
            wf.Do((x, opts) => secondStep = (string)opts["o"]);

            var test = Mock.Of <ITest>(x => (int)x.GetStateId("wf") == 13);
            var mock = Mock.Get(test);

            wf.StartWithParams(test, new { i = 42, o = "hello" });
            mock.Verify(x => x.SetStateId("wf", null));
            mock.Verify(x => x.Ping((int)42));
            secondStep.ShouldBe("hello");
        }
Beispiel #3
0
        public void Operations_work_when_using_objects()
        {
            var wf = new StatefulWorkflow <ITest>("wf");

            wf.Yield(13);
            wf.Do((x, i) => { x.Ping((int)i["i"]); });

            var test = Mock.Of <ITest>(x => (int)x.GetStateId("wf") == 13);
            var mock = Mock.Get(test);

            wf.StartWithParams(test, new { i = 42 });
            mock.Verify(x => x.SetStateId("wf", null));
            mock.Verify(x => x.Ping((int)42));
        }
        public void Operations_work_when_using_objects()
        {
            var wf = new StatefulWorkflow<ITest>("wf");
            wf.Yield(13);
            wf.Do((x, i) => { x.Ping((int)i["i"]); });

            var test = Mock.Of<ITest>(x => (int)x.GetStateId("wf") == 13);
            var mock = Mock.Get(test);
            wf.StartWithParams(test, new { i = 42 });
            mock.Verify(x => x.SetStateId("wf", null));
            mock.Verify(x => x.Ping((int)42));
        }