public void Test_GetRemainder_When_Buffer_is_NULL()
        {
            // Given
            var parser = new HttpParser(null);

            // When
            parser.ReadLine("abc");
            var remainder = parser.GetRemainder();

            // Then
            Assert.Null(remainder);
        }
        public void Test_IS_Chunk_Compete_Should_Work_For_Given_Minimum_Chunk_Size()
        {
            // Given
            byte[] buffer = Encoding.UTF8.GetBytes("3\r\nabc\r\n2b");
            var    parser = new HttpParser(buffer);

            // When
            parser.ReadLine(NewLine);
            parser = new HttpParser(parser.GetRemainder());
            byte[] byteLine = parser.ReadLine(NewLine);
            // Then
            Assert.True(parser.IsChunkComplete(byteLine, NewLine, 5));
        }
        public void Test_GetRemainder_ShouldReturn_NULL_When_NO_Separator_Has_been_found()
        {
            // Given
            const string data = "1234abc";

            byte[] buffer = Encoding.UTF8.GetBytes(data);
            var    parser = new HttpParser(buffer);

            // When
            parser.ReadLine(NewLine);
            byte[] remainder = parser.GetRemainder();

            // Then
            Assert.Null(remainder);
        }
        public void Test_GetRemainder_After_Simple_Read()
        {
            // Given
            const string data = "1234\r\n\r\nabc";

            byte[] buffer = Encoding.UTF8.GetBytes(data);
            var    parser = new HttpParser(buffer);

            // When
            parser.ReadLine(EmptyLine);
            byte[] remainder = parser.GetRemainder();

            // Then
            Assert.Equal("abc", Encoding.UTF8.GetString(remainder));
        }
        public void Test_GetRemainder_Should_Return_NULL_When_EntireBuffer_WasRead()
        {
            // Given
            const string data      = "1234abc";
            const string separator = "c";

            byte[] buffer = Encoding.UTF8.GetBytes(data);
            var    parser = new HttpParser(buffer);

            // When
            parser.ReadLine(separator);
            byte[] remainder = parser.GetRemainder();

            // Then
            Assert.Null(remainder);
        }