PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

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

#
C# | 26 lines | 22 code | 4 blank | 0 comment | 0 complexity | 28e67f0fdf72526c86a6a63b73ab2a06 MD5 | raw file
 1using Bifrost.Fakes.Sagas;
 2using Bifrost.Sagas;
 3using Machine.Specifications;
 4
 5namespace Bifrost.Specs.Sagas.for_SagaNarrator
 6{
 7    [Subject(typeof(SagaNarrator))]
 8    public class when_transitioning_to_chapter_and_chapter_is_already_in_saga : given.a_saga_narrator
 9    {
10        static IChapter first_chapter;
11        static IChapter second_chapter;
12        static SagaWithOneChapterProperty saga;
13
14        Establish context = () =>
15                                {
16                                    first_chapter = new TransitionalChapter();
17                                    second_chapter = new SimpleChapter();
18                                    saga = new SagaWithOneChapterProperty(first_chapter, second_chapter);
19                                };
20
21        Because of = () => narrator.TransitionTo<TransitionalChapter>(saga);
22
23        It should_go_back_to_first_chapter = () => saga.CurrentChapter.ShouldEqual(first_chapter);
24        It should_call_the_on_transitioned_to_on_the_chapter = () => (first_chapter as TransitionalChapter).OnTransitionedToWasCalled.ShouldBeTrue();
25    }
26}