public void ReadNextText_MultilineTagStateFollowedByMedialTag_1stPartOf2ndLineText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag\ntext \\tag more text")); SFMReader test = new SFMReader(stream); Assert.AreEqual("text ", test.ReadNextText()); Assert.AreEqual("more text", 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_MultilineInitialTextStateFollowedByTagOnly_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "text first\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 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 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 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 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 ReadNextTextThenReadInitialText_Throw() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(@"\tag1 some text\tag2")); SFMReader test = new SFMReader(stream); test.ReadNextText(); Assert.Throws<InvalidOperationException>( () => test.ReadInitialText()); }
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 ReadNextText_TextOnly_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"text first")); SFMReader test = new SFMReader(stream); Assert.IsNull(test.ReadNextText()); }
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 ReadNextText_MultilineEmptyFollowedByTag_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag\n\n\\tag")); SFMReader test = new SFMReader(stream); Assert.AreEqual("\n", test.ReadNextText()); }
public void ReadNextText_TwoTagsInARow_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag1\tag2")); SFMReader test = new SFMReader(stream); string token = test.ReadNextText(); Assert.AreEqual(string.Empty, token); }
public void ReadNextText_NoText_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"")); SFMReader test = new SFMReader(stream); string token = test.ReadNextText(); Assert.IsNull(token); }
public void ReadNextText_TagOnly_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\one")); SFMReader test = new SFMReader(stream); string token = test.ReadNextText(); Assert.AreEqual("", token); }
public void ReadNextText_TagLast_Empty() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\one text first\two")); SFMReader test = new SFMReader(stream); test.ReadNextText(); string token = test.ReadNextText(); Assert.AreEqual(string.Empty, token); }
public void ReadNextText_MedialText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\one text first\bf")); SFMReader test = new SFMReader(stream); string token = test.ReadNextText(); Assert.AreEqual("text first", token); }
public void ReadNextText_MultilineTagStateFollowedByEmpty_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag\n")); SFMReader test = new SFMReader(stream); Assert.AreEqual(string.Empty, test.ReadNextText()); }
public void ReadNextText_MultilineTextStateFollowedByEmpty_1stAnd2ndLineText() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag text first\n")); SFMReader test = new SFMReader(stream); Assert.AreEqual("text first\n", test.ReadNextText()); }