Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }