public void AddPartial_CompleteRequestAndSeparatorFollowedBySeparatePartialRequest_OneFrameAvailable()
        {
            var parser = new TabSeparatedInputStreamParser();

            parser.AddPartial("{\"type\":\"requestType\"}\t");
            parser.AddPartial("{\"type\":\"Incomplete request...");
            var frames = parser.GetCompletedFrames().ToArray();

            Assert.True(parser.HasCompletedFrames);
            Assert.Single(frames);
            Assert.Equal("{\"type\":\"requestType\"}", frames[0]);
        }
        public void AddPartial_TwoCompleteFramesSeparatedByTabs_HasTwoFrames()
        {
            var parser = new TabSeparatedInputStreamParser();

            parser.AddPartial("request1\t");
            parser.AddPartial("request2\t");
            var result = parser.GetCompletedFrames().ToArray();

            Assert.Equal(2, result.Length);
            Assert.True(parser.HasCompletedFrames);
            Assert.Equal("request1", result[0]);
            Assert.Equal("request2", result[1]);
        }
        public void AddPartial_PartialRequest_NoFrames()
        {
            var parser = new TabSeparatedInputStreamParser();

            parser.AddPartial("{\"type\":\"the type\",\"id");

            Assert.False(parser.HasCompletedFrames);
            Assert.Empty(parser.GetCompletedFrames());
        }
        public void AddPartial_EmptyString_NoFrames()
        {
            var parser = new TabSeparatedInputStreamParser();

            parser.AddPartial(string.Empty);

            Assert.False(parser.HasCompletedFrames);
            Assert.Empty(parser.GetCompletedFrames());
        }
        public void AddPartial_CompleteRequestWithSeparator_HasOneFrame()
        {
            var parser = new TabSeparatedInputStreamParser();

            parser.AddPartial("{\"type\":\"requestType\"}\t");
            var frames = parser.GetCompletedFrames().ToArray();

            Assert.True(parser.HasCompletedFrames);
            Assert.Single(frames);
            Assert.Equal("{\"type\":\"requestType\"}", frames[0]);
        }