Example #1
0
        public void MustCreateSequence_NoChunking_FalseReturned()
        {
            var rawMessage = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10 };
            var envelope   = new OutboundEnvelope(
                rawMessage,
                null,
                new TestProducerEndpoint("test"));

            var writer = new ChunkSequenceWriter();
            var result = writer.CanHandle(envelope);

            result.Should().BeFalse();
        }
Example #2
0
        public void MustCreateSequence_MessageExceedsChunkSize_TrueReturned()
        {
            var rawMessage = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10 };
            var envelope   = new OutboundEnvelope(
                rawMessage,
                null,
                new TestProducerEndpoint("test")
            {
                Chunk = new ChunkSettings
                {
                    Size = 3
                }
            });

            var writer = new ChunkSequenceWriter();
            var result = writer.CanHandle(envelope);

            result.Should().BeTrue();
        }
Example #3
0
        public void MustCreateSequence_MessageSmallerThanChunkSize_ReturnedAccordingToAlwaysAddHeadersFlag(
            bool alwaysAddHeaders)
        {
            var rawMessage = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10 };
            var envelope   = new OutboundEnvelope(
                rawMessage,
                null,
                new TestProducerEndpoint("test")
            {
                Chunk = new ChunkSettings
                {
                    Size             = 10,
                    AlwaysAddHeaders = alwaysAddHeaders
                }
            });

            var writer = new ChunkSequenceWriter();
            var result = writer.CanHandle(envelope);

            result.Should().Be(alwaysAddHeaders);
        }