PageRenderTime 14ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/Source/Bifrost.Specs/Sagas/for_SagaConverter/when_converting_to_saga.cs

#
C# | 26 lines | 23 code | 3 blank | 0 comment | 0 complexity | 94ea6c9334f81d5471609ccd7b456548 MD5 | raw file
 1using System.Collections.Generic;
 2using System.Linq;
 3using Bifrost.Fakes.Sagas;
 4using Bifrost.Sagas;
 5using Bifrost.Serialization;
 6using Machine.Specifications;
 7
 8namespace Bifrost.Specs.Sagas.for_SagaConverter
 9{
10	public class when_converting_to_saga : given.a_saga_converter_and_a_saga_holder_with_one_chapter_and_one_event_and_chapter_is_current_and_state_is_continuing
11	{
12		static ISaga saga;
13
14		Because of = () => saga = saga_converter.ToSaga(saga_holder);
15
16		It should_not_be_null = () => saga.ShouldNotBeNull();
17		It should_be_correct_saga_type = () => saga.ShouldBeOfType<SagaWithOneChapterProperty>();
18		It should_deserialize_saga = () => serializer_mock.Verify(s => s.FromJson(typeof(SagaWithOneChapterProperty), Moq.It.IsAny<string>(), Moq.It.IsAny<SerializationOptions>()));
19		It should_deserialize_chapter = () => serializer_mock.Verify(s => s.FromJson(Moq.It.IsAny<List<ChapterHolder>>(), Moq.It.IsAny<string>(), Moq.It.IsAny<SerializationOptions>()));
20		It should_have_one_chapter_in_saga = () => saga.Chapters.Count().ShouldEqual(1);
21		It should_have_a_simple_chapter = () => saga.Chapters.First().ShouldBeOfType<SimpleChapter>();
22		It should_set_current_chapter = () => saga.CurrentChapter.ShouldNotBeNull();
23		It should_set_current_chapter_to_simple_chapter = () => saga.CurrentChapter.ShouldBeOfType<SimpleChapter>();
24	    It should_be_in_a_state_of_continuing = () => saga.IsContinuing.ShouldBeTrue();
25	}
26}