public void Regress_Mutation_SubstringOnLastPageWorks()
        {
            Stream stream = StreamHelpers.StringToStream("abcdefg" + new String('x', StreamMappedString.DefaultPageSize));
            StreamMappedString s = new StreamMappedString(stream, false);

            // Move to the second page
            s.GetAt(StreamMappedString.DefaultPageSize);

            // Get a string from the firstPage
            Assert.AreEqual("abc", s.Substring(0, 3));
        }
示例#2
0
 internal string GetCurrentMatchedString(int startPosition)
 {
     return(_sources.Substring(startPosition, _position - startPosition));
 }
        public void Regress_Mutation_SubstringReadPastEndThrowsException()
        {
            Stream stream = StreamHelpers.StringToStream("abcdefg");
            StreamMappedString s = new StreamMappedString(stream, false);

            Assert.AreEqual(String.Empty, s.Substring(1, 30));
        }
        public void Regress_Mutation_SubstringWorksFromPriorPage()
        {
            Stream stream = StreamHelpers.StringToStream("abcxdef");
            StreamMappedString s = new StreamMappedString(stream, false, 7);

            // Move to the last page
            s.GetAt(7);

            // And then extract a string from the beginning page.
            Assert.AreEqual("abcxdef", s.Substring(0, 7));
        }
        public void Regress_Mutation_SubstringWorksWithPageSizeOne()
        {
            Stream stream = StreamHelpers.StringToStream("abcdefg");
            StreamMappedString s = new StreamMappedString(stream, false, /* pageSize */ 1);

            Assert.AreEqual("bcd", s.Substring(1, 3));
        }
        public void Regress_Mutation_SubstringReadPastEndThrowsException()
        {
            Assert.Throws<ArgumentOutOfRangeException>(() =>
            {
                Stream stream = StreamHelpers.StringToStream("abcdefg");
                StreamMappedString s = new StreamMappedString(stream, false);

                Assert.Equal(String.Empty, s.Substring(1, 30));
            }
           );
        }
        public void Regress_Mutation_SubstringWorks()
        {
            Stream stream = StreamHelpers.StringToStream("abcdefg");
            StreamMappedString s = new StreamMappedString(stream, false);

            Assert.Equal("bcd", s.Substring(1, 3));
        }