PageRenderTime 101ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Bifrost.Specs/Domain/for_AggregatedRootRepository/given/a_repository_for_a_stateful_aggregated_root.cs

#
C# | 26 lines | 24 code | 2 blank | 0 comment | 0 complexity | 20f88a3a5f58804f12431c6ace1e1c2e MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using Bifrost.Commands;
  2. using Bifrost.Domain;
  3. using Bifrost.Events;
  4. using Machine.Specifications;
  5. using Moq;
  6. namespace Bifrost.Specs.Domain.for_AggregatedRootRepository.given
  7. {
  8. public class a_repository_for_a_stateful_aggregated_root
  9. {
  10. protected static AggregatedRootRepository<SimpleStatefulAggregatedRoot> repository;
  11. protected static Mock<ICommandContext> command_context_mock;
  12. protected static Mock<ICommandContextManager> command_context_manager_mock;
  13. protected static Mock<IEventStore> event_store_mock;
  14. Establish context = () =>
  15. {
  16. command_context_mock = new Mock<ICommandContext>();
  17. command_context_manager_mock = new Mock<ICommandContextManager>();
  18. event_store_mock = new Mock<IEventStore>();
  19. command_context_mock.Setup(c => c.EventStores).Returns(new[] {event_store_mock.Object});
  20. repository = new AggregatedRootRepository<SimpleStatefulAggregatedRoot>(command_context_manager_mock.Object);
  21. command_context_manager_mock.Setup(ccm => ccm.GetCurrent()).Returns(command_context_mock.Object);
  22. };
  23. }
  24. }