示例#1
0
        public async Task Should_build_and_execute_process_but_stop_at_step_three()
        {
            var context = new MyProcessContext();

            var process = new ProcessBuilder <IMyProcessContext>(context)
                          .AddStep(new MyProcessStepOne())
                          .AddStep(new MyProcessStepTwo())
                          .AddStep(new MyProcessStepThree());

            Assert.False(process.SuccessfullyRan);

            await process.ExecuteAsync();

            Assert.False(process.SuccessfullyRan);
            Assert.Equal("MyProcessStepThree", process.ProcessStoppedAt);
        }
示例#2
0
        public async Task Should_build_and_execute_a_process_builder_successfully()
        {
            var context = new MyProcessContext();

            var process = new ProcessBuilder <IMyProcessContext>(context)
                          .AddStep(new MyProcessStepOne())
                          .AddStep(new MyProcessStepTwo());

            Assert.False(process.SuccessfullyRan);

            await process.ExecuteAsync();

            Assert.True(process.SuccessfullyRan);
            Assert.Equal("I applied my change in step 2", context.SomeStringTwo);

            //stringone didnt get updated as it failed the check
            Assert.Null(context.SomeStringOne);
        }