Beispiel #1
0
        public void ReadNextText_MultilineTextStateFollowedByInitialTag_1stLineTextThen2ndLineText()
        {
            Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
                                                 "\\tag text first\n\\tag more text"));
            SFMReader test = new SFMReader(stream);

            Assert.AreEqual("text first\n", test.ReadNextText());
            Assert.AreEqual("more text", test.ReadNextText());
        }
Beispiel #2
0
        public void ReadNextText_TextOnly_Null()
        {
            Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
                                                 @"text first"));
            SFMReader test = new SFMReader(stream);

            Assert.IsNull(test.ReadNextText());
        }
Beispiel #3
0
        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());
        }
Beispiel #4
0
        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());
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        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);
        }