Example #1
0
        public void CompareTo_ObjectTestStruct_0()
        {
            object other = TestStruct;

            var exp = 0;
            var act = TestStruct.CompareTo(other);

            Assert.AreEqual(exp, act);
        }
Example #2
0
        public void CompareToTest01()
        {
            var gender1 = new Gender {
                GenderNum = 1
            };
            var expected = 1;
            var actual   = gender1.CompareTo(null);

            Assert.Equal(expected, actual);
        }
Example #3
0
        public void CompareToTest02()
        {
            var gender1 = new Gender {
                GenderNum = 0
            };
            var gender2 = new Gender {
                GenderNum = 1
            };
            var expected = -1;
            var actual   = gender1.CompareTo(gender2);

            Assert.Equal(expected, actual);
        }
Example #4
0
        public int CompareTo(object obj)
        {
            Person person = (Person)obj;

            int result = age.CompareTo(person.age);

            if (result == 0)
            {
                result = age - person.age;
            }

            if (result == 1)
            {
                result = gender.CompareTo(person.gender);
            }

            return(result);
        }
Example #5
0
        public int CompareTo(Person other)
        {
            if (!Gender.Equals(other.Gender))
            {
                return(Gender.CompareTo(other.Gender));
            }

            if (!fullName.Equals(other.fullName))
            {
                return(fullName.CompareTo(other.fullName));
            }

            if (Date != other.Date)
            {
                return(Date.CompareTo(other.Date));
            }

            return(0);
        }
Example #6
0
 public int CompareTo(Employee other)
 {
     return(Gender.CompareTo(other.Gender));
 }