PageRenderTime 20ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms 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
 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_stateful_aggregated_root
10	{
11		protected static AggregatedRootRepository<SimpleStatefulAggregatedRoot> 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<SimpleStatefulAggregatedRoot>(command_context_manager_mock.Object);
23		                        command_context_manager_mock.Setup(ccm => ccm.GetCurrent()).Returns(command_context_mock.Object);
24		                    };
25	}
26}