コード例 #1
0
        public void Equal(int h1, int m1, int h2, int m2)
        {
            var first  = new HourMinute(h1, m1);
            var second = new HourMinute(h2, m2);

            Assert.Equal(first, second);
            Assert.True(first == second);
            Assert.True(second == first);
            Assert.False(first != second);
            Assert.False(second != first);
            Assert.True(first <= second);
            Assert.True(first >= second);
            Assert.True(second <= first);
            Assert.True(second >= first);
            Assert.False(first < second);
            Assert.False(first > second);
            Assert.False(second < first);
            Assert.False(second > first);
            Assert.True(first.Equals(second));
            Assert.True(second.Equals(first));
            Assert.True(Object.Equals(first, second));
            Assert.True(Object.Equals(second, first));
            Assert.True(((object)first).Equals(second));
            Assert.True(((object)second).Equals(first));
            Assert.Equal(first.GetHashCode(), second.GetHashCode());
            Assert.Equal(0, first.CompareTo(second));
            Assert.Equal(0, second.CompareTo(first));
        }
コード例 #2
0
        public void Greater(int h1, int m1, int h2, int m2)
        {
            var first  = new HourMinute(h1, m1);
            var second = new HourMinute(h2, m2);

            Assert.True(first.CompareTo(second) > 0);
            Assert.True(first > second);
            Assert.True(first >= second);
            Assert.True(((IComparable)first).CompareTo(second) > 0);
        }
コード例 #3
0
        public void Less(int h1, int m1, int h2, int m2)
        {
            var first  = new HourMinute(h1, m1);
            var second = new HourMinute(h2, m2);

            Assert.True(first.CompareTo(second) < 0);
            Assert.True(first < second);
            Assert.True(first <= second);
            Assert.True(((IComparable)first).CompareTo(second) < 0);
        }