public void ReadNextText_MultilineTagStateFollowedByTextOnly_2ndLineText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag\nmore text")); SFMReader test = new SFMReader(stream); Assert.AreEqual("more text", test.ReadNextText()); }
public void ReadNextText_MultilineInitialTextStateFollowedByMedialTag_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "text first\ntext \\tag")); SFMReader test = new SFMReader(stream); Assert.AreEqual(string.Empty, test.ReadNextText()); }
public void ReadNextText_MultilineInitialTextStateFollowedByInitialTagThenText_2ndLineText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "text first\n\\tag more text")); SFMReader test = new SFMReader(stream); Assert.AreEqual("more text", test.ReadNextText()); }
public void ReadNextText_MultilineTagStateFollowedByTagOnly_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag\n\\tag")); SFMReader test = new SFMReader(stream); Assert.AreEqual(string.Empty, test.ReadNextText()); }
public void ReadNextText_MultilineInitialTextStateFollowedByEmpty_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "text first\n")); SFMReader test = new SFMReader(stream); Assert.AreEqual("text first\n", test.ReadInitialText()); Assert.IsNull(test.ReadNextText()); }
public void ReadNextTag_MultilineEmptyFollowedByText_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\ntext")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.IsNull(token); }
public void ReadNextTextThenReadNextTag() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag1 some text\tag2")); SFMReader test = new SFMReader(stream); test.ReadNextText(); Assert.AreEqual("tag2", test.ReadNextTag()); }
public void Offset_ShoeboxModeAfter4LetterTagWithStarAfterEOF_5() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag*")); SFMReader test = new SFMReader(stream); test.Mode = SFMReader.ParseMode.Shoebox; test.ReadNextTag(); test.ReadNextText(); Assert.AreEqual(5, test.Offset); }
public void Offset_After3LetterTag4LetterWordAndASpace_10() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag text ")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); test.ReadNextText(); Assert.AreEqual(10, test.Offset); }
public void ShoeboxMode_TagsWithoutNewline_TreatedAsText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag text first\bf")); SFMReader test = new SFMReader(stream); test.Mode = SFMReader.ParseMode.Shoebox; Assert.AreEqual("text first\\bf", test.ReadNextText()); string token = test.ReadNextTag(); Assert.IsNull(token); }
public void DefaultMode_TagTerminiatedByAsterisk() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag1*some text")); SFMReader test = new SFMReader(stream); Assert.AreEqual("tag1*some", test.ReadNextTag()); Assert.AreEqual("text", test.ReadNextText()); }
public void ReadNextTagThenReadInitialText_Throw() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(@"\tag1 some text\tag2")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); Assert.Throws<InvalidOperationException>( () => test.ReadInitialText()); }
public void ReadNextTag_EmptyTag() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\ some text")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.AreEqual(string.Empty, token); }
public void ReadNextTag_TextOnly_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"text first\bf")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.AreEqual("bf", token); }
public void ReadNextTag_AfterFinalText_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\bf text")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); string token = test.ReadNextTag(); Assert.IsNull(token); }
public void ReadNextTag_MedialTag() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag text first\bf more text")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); string token = test.ReadNextTag(); Assert.AreEqual("bf", token); }
public void ReadInitialText_MultiLineTagFollowedByText_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag\ntext")); SFMReader test = new SFMReader(stream); string token = test.ReadInitialText(); Assert.AreEqual(string.Empty, token); }
public void ReadInitialText_MultiLineTextFollowedByTextAndTag_1stLineAndBeginning2ndLine() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "text\nmore text\\tag")); SFMReader test = new SFMReader(stream); string token = test.ReadInitialText(); Assert.AreEqual("text\nmore text", token); }
public void UsfmMode_TagTerminiatedByAsterisk() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag1*some text")); SFMReader test = new SFMReader(stream); test.Mode = SFMReader.ParseMode.Usfm; Assert.AreEqual("tag1*", test.ReadNextTag()); Assert.AreEqual("some text", test.ReadNextText()); }
public void ReadNextTag_MultilineEmptyFollowedByTagThenText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\n\\tag text")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.AreEqual("tag", token); }
public void Mode_InitializedToDefault() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag text first\bf")); SFMReader test = new SFMReader(stream); Assert.AreEqual(SFMReader.ParseMode.Default, test.Mode); }
public void ReadNextTag_MultilineInitialTextFollowedByText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "initial text\nsome text")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.IsNull(token); }
public void Offset_BeforeAnyTextIsRead_0() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag text more text")); SFMReader test = new SFMReader(stream); Assert.AreEqual(0, test.Offset); }
public void ReadNextTag_MultilineInitialTextFollowedByTextThenTag() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "initial text\ntext\\tag")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.AreEqual("tag", token); }
public void Offset_After5CharactersOfInitialText_5() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "hello")); SFMReader test = new SFMReader(stream); test.ReadInitialText(); Assert.AreEqual(5, test.Offset); }
public void ReadNextTag_MultilineTagModeFollowedByTextOnly_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\taginitial\nsome text")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); string token = test.ReadNextTag(); Assert.IsNull(token); }
public void Offset_After3LetterTagAfterEOF_4() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); test.ReadNextText(); Assert.AreEqual(4, test.Offset); }
public void ReadNextTag_MultilineTagModeFollowedByTagOnly_2ndLineTag() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\taginitial\n\\tag")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); string token = test.ReadNextTag(); Assert.AreEqual("tag", token); }
public void ReadNextText_MultilineTextStateFollowedByMedialTag_1stLineTextAnd2ndLineBeginningText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag text first\ntext \\tag more text")); SFMReader test = new SFMReader(stream); Assert.AreEqual("text first\ntext ", test.ReadNextText()); Assert.AreEqual("more text", test.ReadNextText()); }
public void ReadNextTag_TwoTagsInARow() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag1\tag2")); SFMReader test = new SFMReader(stream); Assert.AreEqual("tag1", test.ReadNextTag()); Assert.AreEqual("tag2", test.ReadNextTag()); }