예제 #1
0
        public void TestGetHashCode_HasIdOnly()
        {
            var dto = new SimpleLookupDTO
            {
                Id = 1
            };

            Assert.AreEqual(dto.Id.GetHashCode(), dto.GetHashCode());
        }
예제 #2
0
        public void TestGetHashCode_HasValue()
        {
            var dto = new SimpleLookupDTO
            {
                Id    = 1,
                Value = "value"
            };

            Assert.AreEqual(dto.Value.GetHashCode(), dto.GetHashCode());
        }
예제 #3
0
        public void TestEquals_DifferentObjectType()
        {
            var dto = new SimpleLookupDTO
            {
                Id    = 1,
                Value = "value"
            };

            Assert.IsFalse(dto.Equals(ComparisonType.Equal));
        }
예제 #4
0
        public void TestEquals_NullObject()
        {
            var dto = new SimpleLookupDTO
            {
                Id    = 1,
                Value = "value"
            };

            Assert.IsFalse(dto.Equals(null));
        }
예제 #5
0
        public void TestEquals_OnlyValuesEqual()
        {
            var dto = new SimpleLookupDTO
            {
                Id    = 1,
                Value = "value"
            };
            var otherDto = new SimpleLookupDTO
            {
                Id    = 2,
                Value = "value"
            };

            Assert.IsFalse(dto.Equals(otherDto));
            Assert.IsFalse(otherDto.Equals(dto));
        }
예제 #6
0
        public void TestEquals_AllValuesAreEqual()
        {
            var dto = new SimpleLookupDTO
            {
                Id    = 1,
                Value = "value"
            };
            var otherDto = new SimpleLookupDTO
            {
                Id    = 1,
                Value = "value"
            };

            Assert.IsTrue(dto.Equals(otherDto));
            Assert.IsTrue(otherDto.Equals(dto));
        }