public async Task HttpContentStreamDisassembler_StringContent_SendsAsFixedLength()
        {
            var sender    = new PayloadSender();
            var transport = new MockTransportSender();

            sender.Connect(transport);

            var content = new ResponseMessageStream(Guid.NewGuid())
            {
                Content = new StringContent("blah blah blah", Encoding.ASCII),
            };

            var disassembler = new ResponseMessageStreamDisassembler(sender, content);

            await disassembler.DisassembleAsync();

            Assert.Equal(2, transport.Buffers.Count);
        }
        public async Task HttpContentStreamDisassembler_ObjectContent_SendsAsFixedLength()
        {
            var sender    = new PayloadSender();
            var transport = new MockTransportSender();

            sender.Connect(transport);

            var content = new ResponseMessageStream(Guid.NewGuid())
            {
                Content = new StringContent("{'a': 55}", Encoding.UTF8, "application/json"),
            };

            var disassembler = new ResponseMessageStreamDisassembler(sender, content);

            await disassembler.DisassembleAsync();

            Assert.AreEqual(2, transport.Buffers.Count);
        }
        public async Task HttpContentStreamDisassembler_ObjectContent_SendsAsFixedLength()
        {
            var sender    = new PayloadSender();
            var transport = new MockTransportSender();

            sender.Connect(transport);

            var content = new ResponseMessageStream(Guid.NewGuid())
            {
                Content = new ObjectContent(typeof(string), "{'a': 55}", new JsonMediaTypeFormatter()),
            };

            var disassembler = new ResponseMessageStreamDisassembler(sender, content);

            await disassembler.DisassembleAsync();

            Assert.AreEqual(2, transport.Buffers.Count);
        }
        public async Task HttpContentStreamDisassembler_StreamContent_SendsAsVariableLength()
        {
            var sender    = new PayloadSender();
            var transport = new MockTransportSender();

            sender.Connect(transport);

            var stream = new PayloadStream(new PayloadStreamAssembler(null, Guid.NewGuid(), "blah", 100));

            var content = new ResponseMessageStream(Guid.NewGuid())
            {
                Content = new StreamContent(stream),
            };

            stream.Write(new byte[100], 0, 100);

            var disassembler = new ResponseMessageStreamDisassembler(sender, content);

            await disassembler.DisassembleAsync();

            Assert.AreEqual(3, transport.Buffers.Count);
        }