PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
C# | 33 lines | 29 code | 4 blank | 0 comment | 0 complexity | e8cbda24e655d91792831c1daf33c196 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using Bifrost.Fakes.Sagas;
  3. using Bifrost.Sagas;
  4. using Machine.Specifications;
  5. using Moq;
  6. using It = Machine.Specifications.It;
  7. namespace Bifrost.Specs.Sagas.for_SagaNarrator
  8. {
  9. [Subject(typeof(SagaNarrator))]
  10. public class when_continuing_a_saga_that_has_begun : given.a_saga_narrator
  11. {
  12. static Guid saga_id;
  13. static SagaWithOneChapterProperty saga;
  14. static ISaga returned_saga;
  15. Establish context = () =>
  16. {
  17. saga_id = Guid.NewGuid();
  18. saga = new SagaWithOneChapterProperty();
  19. service_locator_mock.Setup(a => a.GetInstance<SagaWithOneChapterProperty>()).Returns(saga);
  20. service_locator_mock.Setup(a => a.GetInstance(typeof(SimpleChapter))).Returns(new SimpleChapter());
  21. saga = narrator.Begin<SagaWithOneChapterProperty>();
  22. librarian_mock.Setup(a => a.Get(saga_id)).Returns(saga);
  23. };
  24. Because of = () => returned_saga = narrator.Continue(saga_id);
  25. It should_return_the_saga = () => returned_saga.ShouldEqual(saga);
  26. It should_set_the_saga_state_to_continuing = () => returned_saga.IsContinuing.ShouldBeTrue();
  27. It should_have_called_the_on_continue_method = () => saga.OnBeginCalled.ShouldEqual(1);
  28. }
  29. }