public async Task ShouldMutateMessage() { var mutator = new FakeMutator(); A.CallTo(() => Configuration.Settings.Container.Resolve(A <Type> .Ignored)).Returns(mutator); MutationManager.RegisterMutator("test", typeof(FakeMutator)); var next = A.Fake <Func <Task> >(); var context = new TestableIncomingLogicalMessageContext(); context.UpdateMessageInstance(Fake <Messages.IEvent>()); await Sut.Invoke(context, next).ConfigureAwait(false); A.CallTo(() => next()).MustHaveHappened(); mutator.MutatedIncoming.Should().BeTrue(); }
public async Task ShouldNotMutateReplies() { var mutator = new FakeMutator(); A.CallTo(() => Configuration.Settings.Container.Resolve(A <Type> .Ignored)).Returns(mutator); MutationManager.RegisterMutator("test", typeof(FakeMutator)); var next = A.Fake <Func <Task> >(); var context = new TestableOutgoingLogicalMessageContext(); context.Headers[Headers.MessageIntent] = MessageIntentEnum.Reply.ToString(); context.UpdateMessage(Fake <Messages.IEvent>()); await Sut.Invoke(context, next).ConfigureAwait(false); A.CallTo(() => next()).MustHaveHappened(); mutator.MutatedOutgoing.Should().BeFalse(); }