Ejemplo n.º 1
0
        public void ZeroLines()
        {
            var byteArray = Encoding.ASCII.GetBytes("0123456789");

            using (var memStream = new MemoryStream(byteArray))
                using (var sStream = new SearchableStringStream(memStream))
                {
                    sStream.ReadLines(0);
                }
        }
Ejemplo n.º 2
0
        public void GetThreeOfMany()
        {
            var byteArray = Encoding.ASCII.GetBytes("0\n1\n2\n3\n4\n5\n6\n7\n8\n9");

            using (var memStream = new MemoryStream(byteArray))
                using (var sStream = new SearchableStringStream(memStream))
                {
                    var result = sStream.ReadLines(3);

                    Assert.AreEqual("0\n1\n2\n", result);
                }
        }
Ejemplo n.º 3
0
        public void LessLinesThanAskedFor()
        {
            var byteArray = Encoding.ASCII.GetBytes("0123456789");

            using (var memStream = new MemoryStream(byteArray))
                using (var sStream = new SearchableStringStream(memStream))
                {
                    var result = sStream.ReadLines(10);

                    Assert.AreEqual("0123456789", result);
                }
        }
Ejemplo n.º 4
0
        public void StartPostionPastFirstLine_GetThree()
        {
            var byteArray = Encoding.ASCII.GetBytes("0\n1\n2\n3\n4\n5\n6\n7\n8\n9");

            using (var memStream = new MemoryStream(byteArray))
                using (var sStream = new SearchableStringStream(memStream))
                {
                    sStream.Position = 2;
                    var result = sStream.ReadLines(3);

                    Assert.AreEqual("1\n2\n3\n", result);
                }
        }