private void TestSequence(DbGuid small, DbGuid big) { Assert.IsTrue(small != big); Assert.IsTrue(big != small); Assert.IsTrue(small < big); Assert.IsTrue(big > small); Assert.IsTrue(small <= big); Assert.IsTrue(big >= small); Assert.IsFalse(small == big); Assert.IsFalse(big == small); Assert.IsFalse(big < small); Assert.IsFalse(small > big); Assert.IsFalse(big <= small); Assert.IsFalse(small >= big); Assert.IsTrue(small.CompareTo(big) < 0); Assert.IsTrue(big.CompareTo(small) > 0); Assert.IsTrue(DbGuid.Comparer.Compare(small, big) < 0); Assert.IsTrue(DbGuid.Comparer.Compare(big, small) > 0); Assert.IsTrue(small.ToString().CompareTo(big.ToString()) < 0); }
public void GuidCompare() { DbGuid a = DbGuid.NewGuid(); DbGuid b = DbGuid.NewGuid(); Assert.AreEqual(-1, a.CompareTo(b)); Assert.AreEqual(-1, a.ToGuid().CompareTo(b.ToGuid())); }
public void TestRoundTripSqlGuid() { DbGuid testA = DbGuid.NewGuid(); DbGuid dbtest = testA.ToSqlGuid(); Assert.AreEqual(dbtest, testA); Assert.AreEqual(dbtest.GetHashCode(), testA.GetHashCode()); Assert.AreEqual(0, dbtest.CompareTo(testA)); DbGuid testB = dbtest.ToSequenceGuid(); Assert.AreEqual(testA, testB); }
public void TestSequence() { DbGuid last = DbGuid.NewGuid(); for (int i = 0; i < 10000; i++) { DbGuid test = DbGuid.NewGuid(); TestSequence(last, test); TestSequence(last, test.ToSqlGuid()); TestSequence(last.ToSqlGuid(), test); TestSequence(last.ToSqlGuid(), test.ToSqlGuid()); Assert.IsTrue(last.CompareTo(test) < 0); last = test; } }
private void TestSequence(DbGuid small, DbGuid big) { Assert.IsTrue(small != big); Assert.IsTrue(big != small); Assert.IsTrue(small < big); Assert.IsTrue(big > small); Assert.IsTrue(small <= big); Assert.IsTrue(big >= small); Assert.IsFalse(small == big); Assert.IsFalse(big == small); Assert.IsFalse(big < small); Assert.IsFalse(small > big); Assert.IsFalse(big <= small); Assert.IsFalse(small >= big); Assert.IsTrue(small.CompareTo(big) < 0); Assert.IsTrue(big.CompareTo(small) > 0); Assert.IsTrue(DbGuid.Comparer.Compare(small, big) < 0); Assert.IsTrue(DbGuid.Comparer.Compare(big, small) > 0); Assert.IsTrue(small.ToString().CompareTo(big.ToString()) < 0); }