/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
- using System;
- using Bifrost.Fakes.Sagas;
- using Bifrost.Sagas;
- using Machine.Specifications;
- using Moq;
- using It = Machine.Specifications.It;
-
- namespace Bifrost.Specs.Sagas.for_SagaNarrator
- {
- [Subject(typeof(SagaNarrator))]
- public class when_continuing_a_saga_that_has_begun : given.a_saga_narrator
- {
- static Guid saga_id;
- static SagaWithOneChapterProperty saga;
- static ISaga returned_saga;
-
- Establish context = () =>
- {
- saga_id = Guid.NewGuid();
- saga = new SagaWithOneChapterProperty();
- service_locator_mock.Setup(a => a.GetInstance<SagaWithOneChapterProperty>()).Returns(saga);
- service_locator_mock.Setup(a => a.GetInstance(typeof(SimpleChapter))).Returns(new SimpleChapter());
- saga = narrator.Begin<SagaWithOneChapterProperty>();
- librarian_mock.Setup(a => a.Get(saga_id)).Returns(saga);
- };
-
- Because of = () => returned_saga = narrator.Continue(saga_id);
-
- It should_return_the_saga = () => returned_saga.ShouldEqual(saga);
- It should_set_the_saga_state_to_continuing = () => returned_saga.IsContinuing.ShouldBeTrue();
- It should_have_called_the_on_continue_method = () => saga.OnBeginCalled.ShouldEqual(1);
- }
- }