예제 #1
0
        public void Equals_SameJobBan_ReturnTrue()
        {
            var jobA = new JobBan()
            {
                BanId = 18922,
                Job   = "ooc"
            };

            var jobB = new JobBan()
            {
                BanId = 18922,
                Job   = "ooc"
            };

            var comparer = JobBanEqualityComparer.Instance;

            Assert.True(comparer.Equals(jobA, jobB), "Two jobs equal by internal values should be equal");
            Assert.True(comparer.GetHashCode(jobA) == comparer.GetHashCode(jobB), "Two jobs equal by internal values should have the same hashcode");
        }
예제 #2
0
        public void Equals_SameJobBan_DifferentID_ReturnTrue()
        {
            var jobA = new JobBan()
            {
                BanId = 18922,
                Job   = "ooc"
            };

            var jobB = new JobBan()
            {
                BanId = 0,
                Job   = "ooc"
            };

            var comparer = JobBanEqualityComparer.Instance;

            Assert.True(comparer.Equals(jobA, jobB), "Two jobs equal by job, even with differing IDs, should be equal");
            Assert.True(comparer.GetHashCode(jobA) == comparer.GetHashCode(jobB), "Two jobs equal by job, even with differing ids, should have the same hashcode");
        }