PageRenderTime 17ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

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

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