public async Task Should_throw_for_size_above_threshold()
        {
            var path       = Path.Combine(TestContext.CurrentContext.TestDirectory, "payload-too-big");
            var dispatcher = new LearningTransportDispatcher(path, 64);
            var headers    = new Dictionary <string, string> {
                { Headers.EnclosedMessageTypes, "TestMessage" }
            };
            var messageAtThreshold    = new OutgoingMessage("id", headers, new byte[MessageSizeLimit]);
            var messageAboveThreshold = new OutgoingMessage("id", headers, new byte[MessageSizeLimit + 1]);

            await dispatcher.Dispatch(new TransportOperations(new TransportOperation(messageAtThreshold, new UnicastAddressTag("my-destination"))), new TransportTransaction(), new ContextBag());

            var ex = Assert.ThrowsAsync <Exception>(async() => await dispatcher.Dispatch(new TransportOperations(new TransportOperation(messageAboveThreshold, new UnicastAddressTag("my-destination"))), new TransportTransaction(), new ContextBag()));

            StringAssert.Contains("The total size of the 'TestMessage' message", ex.Message);
        }
 public void ConfigureDispatcher()
 {
     Dispatcher = new LearningTransportDispatcher(storagePath, int.MaxValue / 1024);
 }