public void ZeroLines() { var byteArray = Encoding.ASCII.GetBytes("0123456789"); using (var memStream = new MemoryStream(byteArray)) using (var sStream = new SearchableStringStream(memStream)) { sStream.ReadLines(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); } }
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); } }
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); } }