/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

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