public async Task ShouldNotAddCustomHeaderToOtherMessageTypes(Type messageType) { var behavior = new CustomBehavior(); var context = new TestableOutgoingLogicalMessageContext { Message = new OutgoingLogicalMessage(messageType, Activator.CreateInstance(messageType)) }; await behavior.Invoke(context, () => Task.CompletedTask); Assert.IsFalse(context.Headers.ContainsKey("custom-header")); }
public async Task ShouldAddCustomHeaderToMyResponse() { var behavior = new CustomBehavior(); var context = new TestableOutgoingLogicalMessageContext { Message = new OutgoingLogicalMessage(typeof(MyResponse), new MyResponse()) }; await behavior.Invoke(context, () => Task.CompletedTask); Assert.AreEqual("custom header value", context.Headers["custom-header"]); }