Ejemplo n.º 1
0
        public void ToInt64()
        {
            Guid guid1 = new Guid("00000000-0000-0000-0000-000000000000");
            Guid guid2 = new Guid("00000400-0000-0000-0000-000000000000");
            Guid guid3 = new Guid("7fffffff-0000-0000-0000-000000000000");
            Guid guid4 = new Guid("ffffffff-ffff-7fff-0000-000000000000");

            Assert.AreEqual(0, GuidUtils.ToInt64(guid1), "#1A");
            Assert.AreEqual(0, guid1.ToInt64(), "#1B");

            Assert.AreEqual(1024, GuidUtils.ToInt64(guid2), "#2A");
            Assert.AreEqual(1024, guid2.ToInt64(), "#2B");

            Assert.AreEqual(int.MaxValue, GuidUtils.ToInt64(guid3), "#3A");
            Assert.AreEqual(int.MaxValue, guid3.ToInt64(), "#3B");

            Assert.AreEqual(long.MaxValue, GuidUtils.ToInt64(guid4), "#4A");
            Assert.AreEqual(long.MaxValue, guid4.ToInt64(), "#4B");
        }