public void DelimitedParserStateDelimit_InitialState_IsNotComplete()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateDelimit>(',');

            testSubject.Parse(string.Empty);

            Assert.Empty(testSubject.Fields);
        }
        public void DelimitedParseStateDelimit_EmptyFields_DataNotAccumulated()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateDelimit>(',');

            testSubject.Parse("abc,");

            Assert.Empty(testSubject.Fields);
        }
        public void DelimitedParseStateQuote_MissingEndQuote_DoesNotComplete()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateQuote>(',');

            testSubject.Parse("f\"\"oo");

            Assert.Empty(testSubject.Fields);
        }
        public void DelimitedParseStateQuote_NewLine_ParseQuotedField()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateQuote>(',');

            testSubject.Parse("f\r\noo\"");

            Assert.Equal(1, testSubject.Fields.Count);
            Assert.Equal("f\r\noo", testSubject.Fields[0]);
        }
        public void DelimitedParseStateQuote_QuoteAndDelimiter_ParseQuotedField()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateQuote>(',');

            testSubject.Parse("foo,\"\"\",");

            Assert.Equal(1, testSubject.Fields.Count);
            Assert.Equal("foo,\"", testSubject.Fields[0]);
        }
        public void DelimitedParseStateQuote_EscapedNonQuoteCharacter_ParseQuotedField()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateQuote>(',');

            testSubject.Parse("f\\roo\"");

            Assert.Equal(1, testSubject.Fields.Count);
            Assert.Equal("f\\roo", testSubject.Fields[0]);
        }
        public void DelimitedParseStateCapture_LF_DoNotCapture()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateCapture>(',');

            testSubject.Parse("foo\n");

            Assert.Equal(1, testSubject.Fields.Count);
            Assert.Equal("foo", testSubject.Fields[0]);
        }
        public void DelimitedParseStateCapture_EmptyField()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateCapture>(',');

            testSubject.Parse(",");

            Assert.Equal(1, testSubject.Fields.Count);
            Assert.Equal("", testSubject.Fields[0]);
        }
        public void DelimitedParseStateQuote_InitialState_IsNotComplete()
        {
            var testSubject = DelimitedParserStub.Create <DelimitedParserStateQuote>(',');

            Assert.Empty(testSubject.Fields);
        }