/Source/Bifrost.Specs/Sagas/for_SagaCommandContext/when_committing_with_uncommitted_events_available_and_saga_has_a_chapter_property.cs

# · C# · 34 lines · 27 code · 7 blank · 0 comment · 0 complexity · d8e069dd94b2427ed70d84d716f3eb91 MD5 · raw file

  1. using Bifrost.Fakes.Sagas;
  2. using Bifrost.Sagas;
  3. using Machine.Specifications;
  4. namespace Bifrost.Specs.Sagas.for_SagaCommandContext
  5. {
  6. public class when_committing_with_uncommitted_events_available_and_saga_has_a_chapter_property : given.a_saga_command_context_with_aggregated_root_that_has_uncommitted_events
  7. {
  8. static SagaWithOneChapterProperty saga;
  9. static SimpleChapter chapter;
  10. Establish context = () =>
  11. {
  12. saga = new SagaWithOneChapterProperty();
  13. chapter = new SimpleChapter();
  14. saga.AddChapter(chapter);
  15. command_context = new SagaCommandContext(
  16. saga,
  17. command_mock.Object,
  18. execution_context_mock.Object,
  19. event_store_mock.Object,
  20. process_method_invoker_mock.Object,
  21. saga_librarian_mock.Object);
  22. command_context.RegisterForTracking(aggregated_root_mock.Object);
  23. };
  24. Because of = () => command_context.Commit();
  25. It should_try_to_process_the_events_on_the_chapter = () => process_method_invoker_mock.Verify(p => p.TryProcess(chapter, simple_event));
  26. }
  27. }