PageRenderTime 46ms CodeModel.GetById 23ms RepoModel.GetById 0ms 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
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using Bifrost.Fakes.Sagas;
  3. using Bifrost.Sagas;
  4. using Bifrost.Sagas.Exceptions;
  5. using Machine.Specifications;
  6. namespace Bifrost.Specs.Sagas.for_SagaNarrator
  7. {
  8. [Subject(typeof(SagaNarrator))]
  9. public class when_continuing_a_saga_that_has_not_begun : given.a_saga_narrator
  10. {
  11. static Exception exception;
  12. static Guid saga_id;
  13. static SagaWithOneChapterProperty saga;
  14. Establish context = () =>
  15. {
  16. saga_id = Guid.NewGuid();
  17. saga = new SagaWithOneChapterProperty();
  18. librarian_mock.Setup(a => a.Get(saga_id)).Returns(saga);
  19. };
  20. Because of = () => exception = Catch.Exception( () => narrator.Continue(saga_id));
  21. It should_throw_an_invalid_saga_state_transition_exception = () => exception.ShouldBeOfType<InvalidSagaStateTransitionException>();
  22. It should_not_have_called_the_on_continue_method = () => saga.OnContinueCalled.ShouldEqual(0);
  23. }
  24. }