コード例 #1
0
        public void Stream_ReadXid_ThrowsWhenInsufficientBytesRemaining()
        {
            using (var ms = new System.IO.MemoryStream(Xid.Length))
            {
                var x = Xid.NewXid();
                ms.WriteXid(x);

                Assert.AreEqual(Xid.Length, ms.Length);
                Assert.AreEqual(Xid.Length, ms.Position);

                ms.Seek(6, System.IO.SeekOrigin.Begin);
                var y = ms.ReadXid();
            }
        }
コード例 #2
0
        public void Stream_ReadXid_CorrectlyReadsXid()
        {
            using (var ms = new System.IO.MemoryStream(Xid.Length))
            {
                var x = Xid.NewXid();
                ms.WriteXid(x);

                Assert.AreEqual(Xid.Length, ms.Length);
                Assert.AreEqual(Xid.Length, ms.Position);

                ms.Seek(0, System.IO.SeekOrigin.Begin);
                var y = ms.ReadXid();

                Assert.AreEqual(x, y);
                Assert.AreEqual(Xid.Length, ms.Length);
                Assert.AreEqual(Xid.Length, ms.Position);
            }
        }
コード例 #3
0
 public void Stream_ReadXid_ThrowsOnNullStream()
 {
     System.IO.MemoryStream ms = null;
     ms.ReadXid();
 }