Пример #1
0
        public void TestTenor_CompareTo_Negative2()
        {
            Tenor tenorLow = new Tenor(0, 0, 0, 1);

            Assert.ThrowsException <ArgumentException>(() =>
            {
                var x = tenorLow.CompareTo(new object());
            });
        }
Пример #2
0
        public void TestTenor_CompareTo_Positive1()
        {
            Tenor tenorLow  = new Tenor(0, 0, 0, 1);
            Tenor tenorMid  = new Tenor(0, 0, 1, 1);
            Tenor tenorMid2 = new Tenor(0, 0, 0, 8);
            Tenor tenorHigh = new Tenor(0, 1, 1, 1);

            Assert.AreEqual(-1, tenorLow.CompareTo(tenorMid));
            Assert.AreEqual(-1, tenorLow.CompareTo(tenorHigh));
            Assert.AreEqual(-1, tenorMid.CompareTo(tenorHigh));

            Assert.AreEqual(0, tenorLow.CompareTo(tenorLow));
            Assert.AreEqual(0, tenorMid.CompareTo(tenorMid));
            Assert.AreEqual(0, tenorMid.CompareTo(tenorMid2));
            Assert.AreEqual(0, tenorHigh.CompareTo(tenorHigh));

            Assert.AreEqual(1, tenorMid.CompareTo(tenorLow));
            Assert.AreEqual(1, tenorHigh.CompareTo(tenorLow));
            Assert.AreEqual(1, tenorHigh.CompareTo(tenorMid));
        }