public void ReadFullNewLinePatternTest() { InitialState returnToState = new InitialState(',', '"'); NewLinePatternState target = new NewLinePatternState(returnToState); char[] buffer = new char[1]; int bufferPosition = 0; StateReader actualNextState = target.ReadChar((int)'\r', ref buffer, ref bufferPosition); Assert.AreNotEqual('\r', buffer[0]); Assert.IsTrue(actualNextState.GetType() == typeof(EndNewLinePatternState)); actualNextState = actualNextState.ReadChar((int)'\n', ref buffer, ref bufferPosition); Assert.AreNotEqual('\r', buffer[0]); Assert.IsTrue(actualNextState.IsEndState); Assert.IsFalse(actualNextState.ContinueReadingLine); }
public void ReadCharQualifiedTextTest() { StartTextQualifierState target = new StartTextQualifierState('"', new DelimiterState(',', new EndState())); char[] buffer = new char[1]; int bufferPosition = 0; StateReader secondState = target.ReadChar((int)'"', ref buffer, ref bufferPosition); Assert.IsFalse(secondState.IsEndState); Assert.IsTrue(secondState.ContinueReadingLine); Assert.AreEqual(char.MinValue, buffer[0]); StateReader laststate = secondState.ReadChar((int)'"', ref buffer, ref bufferPosition); Assert.IsFalse(laststate.IsEndState); Assert.IsTrue(laststate.ContinueReadingLine); Assert.AreEqual(char.MinValue, buffer[0]); }