コード例 #1
0
        public void WriteShortNullStreamTest()
        {
            ReportStart();

            Stream s = null;

            try
            {
                ExampleComponent.CallWriteShort(12, s);
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("outputStream", ex.ParamName);
                ReportEnd();
                throw;
            }
        }
コード例 #2
0
        public void WriteShortTest()
        {
            ReportStart();

            MemoryStream s            = new MemoryStream();
            int          valueToWrite = 0x3b2a13;

            ExampleComponent.CallWriteShort(valueToWrite, s);
            s.Seek(0, SeekOrigin.Begin);
            Assert.AreEqual(2, s.Length);               // first byte will have been discarded
            int byte1 = s.ReadByte();
            int byte2 = s.ReadByte();

            Assert.AreEqual(0x13, byte1);
            Assert.AreEqual(0x2a, byte2);

            ReportEnd();
        }