PageRenderTime 458ms CodeModel.GetById 13ms RepoModel.GetById 0ms 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
Possible License(s): CC-BY-SA-3.0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Bifrost.Fakes.Sagas;
  4. using Bifrost.Sagas;
  5. using Bifrost.Serialization;
  6. using Machine.Specifications;
  7. namespace Bifrost.Specs.Sagas.for_SagaConverter
  8. {
  9. 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
  10. {
  11. static ISaga saga;
  12. Because of = () => saga = saga_converter.ToSaga(saga_holder);
  13. It should_not_be_null = () => saga.ShouldNotBeNull();
  14. It should_be_correct_saga_type = () => saga.ShouldBeOfType<SagaWithOneChapterProperty>();
  15. It should_deserialize_saga = () => serializer_mock.Verify(s => s.FromJson(typeof(SagaWithOneChapterProperty), Moq.It.IsAny<string>(), Moq.It.IsAny<SerializationOptions>()));
  16. It should_deserialize_chapter = () => serializer_mock.Verify(s => s.FromJson(Moq.It.IsAny<List<ChapterHolder>>(), Moq.It.IsAny<string>(), Moq.It.IsAny<SerializationOptions>()));
  17. It should_have_one_chapter_in_saga = () => saga.Chapters.Count().ShouldEqual(1);
  18. It should_have_a_simple_chapter = () => saga.Chapters.First().ShouldBeOfType<SimpleChapter>();
  19. It should_set_current_chapter = () => saga.CurrentChapter.ShouldNotBeNull();
  20. It should_set_current_chapter_to_simple_chapter = () => saga.CurrentChapter.ShouldBeOfType<SimpleChapter>();
  21. It should_be_in_a_state_of_continuing = () => saga.IsContinuing.ShouldBeTrue();
  22. }
  23. }