Esempio n. 1
0
    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"));
    }
Esempio n. 2
0
    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"]);
    }