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()); }
public void ReadNextTag_FinalTag() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( @"\tag text first\bf")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); string token = test.ReadNextTag(); Assert.AreEqual("bf", token); }
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 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_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 Offset_After3LetterTagAnd4LetterWordASpaceThen4LetterTag_15() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag text \\tag2")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); test.ReadNextText(); test.ReadNextTag(); Assert.AreEqual(15, test.Offset); }
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 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 Offset_After3LetterTagThenSpace_5() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\\tag ")); SFMReader test = new SFMReader(stream); test.ReadNextTag(); Assert.AreEqual(5, test.Offset); }
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_MultilineEmptyFollowedByText_Null() { Stream stream = new MemoryStream(Encoding.ASCII.GetBytes( "\ntext")); SFMReader test = new SFMReader(stream); string token = test.ReadNextTag(); Assert.IsNull(token); }
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 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 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 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 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 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); }