PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms 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
 1using System;
 2using Bifrost.Fakes.Sagas;
 3using Bifrost.Sagas;
 4using Machine.Specifications;
 5using Moq;
 6using It = Machine.Specifications.It;
 7
 8namespace Bifrost.Specs.Sagas.for_SagaNarrator
 9{
10    [Subject(typeof(SagaNarrator))]
11	public class when_continuing_a_saga_that_has_begun : given.a_saga_narrator
12	{
13		static Guid saga_id;
14        static SagaWithOneChapterProperty saga;
15		static ISaga returned_saga;
16
17		Establish context = () =>
18		                    	{
19		                    		saga_id = Guid.NewGuid();
20                                    saga = new SagaWithOneChapterProperty();
21                                    service_locator_mock.Setup(a => a.GetInstance<SagaWithOneChapterProperty>()).Returns(saga);
22                                    service_locator_mock.Setup(a => a.GetInstance(typeof(SimpleChapter))).Returns(new SimpleChapter());
23                                    saga = narrator.Begin<SagaWithOneChapterProperty>();
24                                    librarian_mock.Setup(a => a.Get(saga_id)).Returns(saga);
25		                    	};
26
27		Because of = () => returned_saga = narrator.Continue(saga_id);
28
29		It should_return_the_saga = () => returned_saga.ShouldEqual(saga);
30	    It should_set_the_saga_state_to_continuing = () => returned_saga.IsContinuing.ShouldBeTrue();
31        It should_have_called_the_on_continue_method = () => saga.OnBeginCalled.ShouldEqual(1);
32	}
33}