Beispiel #1
0
        public void ReadTestNullArgument()
        {
            ReportStart();

            try
            {
                ExampleComponent.CallRead(null);
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("inputStream", ex.ParamName);
                ReportEnd();
                throw;
            }
        }
Beispiel #2
0
        public void ReadTest()
        {
            ReportStart();

            // Write some bytes to a stream and then position it at the start
            byte[] bytes = new byte[]
            {
                21, 18, 69
            };
            Stream s = new MemoryStream();

            s.Write(bytes, 0, bytes.Length);
            s.Seek(0, SeekOrigin.Begin);

            // Use the Read method of GifComponent to read the stream back in
            Assert.AreEqual(21, ExampleComponent.CallRead(s));
            Assert.AreEqual(18, ExampleComponent.CallRead(s));
            Assert.AreEqual(69, ExampleComponent.CallRead(s));
            // There are no more bytes to read, so the next read should return -1
            Assert.AreEqual(-1, ExampleComponent.CallRead(s));

            ReportEnd();
        }