public void VerifyInitializedIfExplictCreateRequiredAndCommandExceptionNotDefined() { var aggregate = new FakeAggregateWithExplicitCreate(); var envelope = new CommandEnvelope(GuidStrategy.NewGuid(), new FakeCommand()); var commandHandler = new CommandHandler(typeof(FakeAggregateWithExplicitCreate), typeof(FakeCommand), AggregateStore.Object, (a, c) => ((FakeAggregateWithExplicitCreate)a).Handle((FakeCommand)c)); AggregateStore.Setup(mock => mock.Get(typeof(FakeAggregateWithExplicitCreate), envelope.AggregateId)).Returns(aggregate); using (var context = new CommandContext(GuidStrategy.NewGuid(), HeaderCollection.Empty, envelope)) { commandHandler.Handle(context); Assert.True(aggregate.Handled); } }
public void VerifyInitializedIfExplictCreateRequiredAndCommandExceptionNotDefined() { var aggregate = new FakeAggregateWithExplicitCreate(); var envelope = new CommandEnvelope(GuidStrategy.NewGuid(), new FakeCommand()); var commandHandler = new CommandHandler(typeof(FakeAggregateWithExplicitCreate), typeof(FakeCommand), AggregateStore.Object, (a, c) => ((FakeAggregateWithExplicitCreate)a).Handle((FakeCommand)c)); AggregateStore.Setup(mock => mock.Get(typeof(FakeAggregateWithExplicitCreate), envelope.AggregateId)).Returns(aggregate); using (var context = new CommandContext(GuidStrategy.NewGuid(), HeaderCollection.Empty, envelope)) { commandHandler.Handle(context); Assert.True(aggregate.Handled); } }