コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void ReadInitialText_MultiLineTextFollowedByEmpty_1stLine()
        {
            Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
                                                 "text\n"));
            SFMReader test = new SFMReader(stream);

            string token = test.ReadInitialText();

            Assert.AreEqual("text\n", token);
        }
コード例 #4
0
        public void ReadInitialText_Empty()
        {
            Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(
                                                 @""));
            SFMReader test = new SFMReader(stream);

            string token = test.ReadInitialText();

            Assert.AreEqual("", token);
        }
コード例 #5
0
ファイル: SFMReaderTest.cs プロジェクト: vkarthim/libpalaso
        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);
        }
コード例 #6
0
ファイル: SFMReaderTest.cs プロジェクト: vkarthim/libpalaso
        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());
        }