Exemple #1
0
        public void WriteStringNullTest()
        {
            ReportStart();

            MemoryStream s = new MemoryStream();

            ExampleComponent.CallWriteString(null, s);
            Assert.AreEqual(0, s.Length);

            ReportEnd();
        }
Exemple #2
0
        public void WriteStringNullStreamTest()
        {
            ReportStart();

            Stream s = null;

            try
            {
                ExampleComponent.CallWriteString("hello", s);
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("outputStream", ex.ParamName);
                ReportEnd();
                throw;
            }
        }
Exemple #3
0
        public void WriteStringTest()
        {
            ReportStart();

            string       text = "hello world";
            MemoryStream s    = new MemoryStream();

            ExampleComponent.CallWriteString(text, s);
            s.Seek(0, SeekOrigin.Begin);
            byte[] bytes = new byte[s.Length];
            s.Read(bytes, 0, (int)s.Length);
            StringBuilder sb = new StringBuilder();

            foreach (byte b in bytes)
            {
                sb.Append((char)b);
            }
            string textRead = sb.ToString();

            Assert.AreEqual(text, textRead);

            ReportEnd();
        }