public void ReadDisposesTheStream() { var stream = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())); var service = new ReadStreamAsString(stream, Encoding.UTF8); service.Read(); Assert.IsTrue(stream.CanRead == false); }
public void ReadsTheStream() { string value = Guid.NewGuid().ToString(); var stream = new MemoryStream(Encoding.UTF8.GetBytes(value)); Logger logger = new Logger(); var service = new ReadStreamAsString(stream, Encoding.UTF8); var result = service.Read(); Assert.AreEqual(result.Content, value); }
public void DoesNotThrowExceptionWhenStreamIsDisposed() { var stream = new MemoryStream(); using (var sw = new StreamWriter(stream)) { sw.Write(Guid.NewGuid().ToString()); sw.Flush(); } var service = new ReadStreamAsString(stream, Encoding.UTF8); stream.Dispose(); var result = service.Read(); Assert.IsNotNull(result); }