Exemplo n.º 1
0
        public void Equal(int d1, int h1, int m1, int d2, int h2, int m2)
        {
            var first  = new DayHourMinute(d1, h1, m1);
            var second = new DayHourMinute(d2, h2, m1);

            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));
        }
Exemplo n.º 2
0
        public void Equals(
            [Random(1, 31, 5)] int day,
            [Random(0, 23, 5)] int hour,
            [Random(0, 59, 5)] int minute)
        {
            object dhm1 = new DayHourMinute(day, hour, minute);
            object dhm2 = new DayHourMinute(day, hour, minute);

            Assert.That(dhm1.Equals(dhm2), "dhm1.Equals(dhm2)");
            Assert.That(dhm2.Equals(dhm1), "dhm2.Equals(dhm1)");
        }
Exemplo n.º 3
0
        public void NotEqual(int d1, int h1, int m1, int d2, int h2, int m2)
        {
            var first  = new DayHourMinute(d1, h1, m1);
            var second = new DayHourMinute(d2, h2, m2);

            Assert.NotEqual(first, second);
            Assert.False(first == second);
            Assert.False(second == first);
            Assert.True(first != second);
            Assert.True(second != first);
            Assert.False(first.Equals(second));
            Assert.False(second.Equals(first));
            Assert.False(Object.Equals(first, second));
            Assert.False(Object.Equals(second, first));
            Assert.False(((object)first).Equals(second));
            Assert.False(((object)second).Equals(first));
        }