public void Stream_WriteXid_ThrowsOnNullStream()
        {
            System.IO.MemoryStream ms = null;
            var x = Xid.NewXid();

            ms.WriteXid(x);
        }
        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();
            }
        }
        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);
            }
        }