public void CompareTest() { var te = new TimeEntry(10, 40); var te3 = new TimeEntry(10, 30); var mte = new TimeEntry(-10, -40); var dte = new TimeEntry(21, 20); var te2 = new TimeEntry(3, 33); Assert.AreEqual(true, dte == te + te); Assert.AreEqual(true, te == te); Assert.AreEqual(true, te >= te); Assert.AreEqual(true, te <= te); Assert.AreEqual(true, dte != te); Assert.AreEqual(false, te != te); Assert.AreEqual(true, te2 < te); Assert.AreEqual(true, te2 <= te); Assert.AreEqual(true, dte > te); Assert.AreEqual(true, dte >= te); Assert.AreEqual(true, te.Equals(te)); Assert.AreEqual(true, dte.Equals(te + te)); Assert.AreEqual(true, !te.Equals(new object())); Assert.AreEqual(true, !te.Equals(null)); Assert.AreEqual(true, !TimeEntry.Zero.Equals(null)); Assert.AreEqual(0, te.CompareTo(te)); Assert.AreEqual(true, te2.CompareTo(te) < 0); Assert.AreEqual(true, te3.CompareTo(te) < 0); Assert.AreEqual(true, dte.CompareTo(te) > 0); Assert.AreEqual(1, dte.CompareTo(null)); Assert.Throws <ArgumentException>(() => te.CompareTo(new object())); }