示例#1
0
        public virtual void TestNullSafeComparator()
        {
            IComparator <int> comp = Comparators.NullSafeNaturalComparator();

            NUnit.Framework.Assert.AreEqual(0, comp.Compare(null, null));
            NUnit.Framework.Assert.AreEqual(-1, comp.Compare(null, int.Parse(42)));
            NUnit.Framework.Assert.AreEqual(1, comp.Compare(int.Parse(42), null));
            NUnit.Framework.Assert.AreEqual(-1, comp.Compare(11, 18));
            NUnit.Framework.Assert.AreEqual(0, comp.Compare(11, 11));
        }