public void CollectCommandsToBePublished() { var sagaCommand1 = new SagaCommand(GuidStrategy.NewGuid(), new HeaderCollection((IEnumerable <Header>)HeaderCollection.Empty), new FakeCommand()); var sagaCommand2 = new SagaCommand(GuidStrategy.NewGuid(), new HeaderCollection((IEnumerable <Header>)HeaderCollection.Empty), new FakeCommand()); using (var context = new SagaContext(typeof(Saga), GuidStrategy.NewGuid(), new FakeEvent())) { context.Publish(sagaCommand1.AggregateId, sagaCommand1.Headers, sagaCommand1.Command); context.Publish(sagaCommand2.AggregateId, sagaCommand2.Headers, sagaCommand2.Command); var publishedCommands = context.GetPublishedCommands().ToArray(); Assert.Equal(sagaCommand1.AggregateId, publishedCommands[0].AggregateId); Assert.Equal(sagaCommand2.AggregateId, publishedCommands[1].AggregateId); } }
public void CollectCommandsToBePublished() { var sagaCommand1 = new SagaCommand(GuidStrategy.NewGuid(), new HeaderCollection((IEnumerable<Header>) HeaderCollection.Empty), new FakeCommand()); var sagaCommand2 = new SagaCommand(GuidStrategy.NewGuid(), new HeaderCollection((IEnumerable<Header>)HeaderCollection.Empty), new FakeCommand()); using (var context = new SagaContext(typeof(Saga), GuidStrategy.NewGuid(), new FakeEvent())) { context.Publish(sagaCommand1.AggregateId, sagaCommand1.Headers, sagaCommand1.Command); context.Publish(sagaCommand2.AggregateId, sagaCommand2.Headers, sagaCommand2.Command); var publishedCommands = context.GetPublishedCommands().ToArray(); Assert.Equal(sagaCommand1.AggregateId, publishedCommands[0].AggregateId); Assert.Equal(sagaCommand2.AggregateId, publishedCommands[1].AggregateId); } }