PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/Bifrost.Specs/Sagas/for_SagaNarrator/when_continuing_a_saga_that_has_not_begun.cs

#
C# | 29 lines | 24 code | 5 blank | 0 comment | 0 complexity | 37691d37b56caa99687a621b8b3e2ea7 MD5 | raw file
 1using System;
 2using Bifrost.Fakes.Sagas;
 3using Bifrost.Sagas;
 4using Bifrost.Sagas.Exceptions;
 5using Machine.Specifications;
 6
 7namespace Bifrost.Specs.Sagas.for_SagaNarrator
 8{
 9    [Subject(typeof(SagaNarrator))]
10    public class when_continuing_a_saga_that_has_not_begun : given.a_saga_narrator
11    {
12        static Exception exception;
13
14        static Guid saga_id;
15        static SagaWithOneChapterProperty saga;
16
17        Establish context = () =>
18                                {
19                                    saga_id = Guid.NewGuid();
20                                    saga = new SagaWithOneChapterProperty();
21                                    librarian_mock.Setup(a => a.Get(saga_id)).Returns(saga);
22                                };
23
24        Because of = () => exception = Catch.Exception( () => narrator.Continue(saga_id));
25
26        It should_throw_an_invalid_saga_state_transition_exception = () => exception.ShouldBeOfType<InvalidSagaStateTransitionException>();
27        It should_not_have_called_the_on_continue_method = () => saga.OnContinueCalled.ShouldEqual(0);
28    }
29}