예제 #1
0
        public void GetHashCode_DifferentProperties_DifferentHashCode()
        {
            // arrange
            var sut1 = new EntryCriteria
            {
                PageNumber = 2,
                PageSize   = 10,
                Tag        = "tag"
            };

            var sut2 = new EntryCriteria
            {
                PageNumber = 2,
                PageSize   = 10,
                Tag        = "tag",
                Category   = "cat"
            };

            // act
            var hashcode1 = sut1.GetHashCode();
            var hashcode2 = sut2.GetHashCode();

            // assert
            Assert.That(hashcode1, Is.Not.EqualTo(hashcode2));
        }
예제 #2
0
        public void GetHashCode_NothingSet_ReturnsZero()
        {
            // arrange
            var sut = new EntryCriteria();

            // act
            var hashcode = sut.GetHashCode();

            // assert
            Assert.That(hashcode, Is.EqualTo(0));
        }
예제 #3
0
        public void GetHashCode_SameProperties_SameHashCode()
        {
            // arrange
            var sut1 = new EntryCriteria
            {
                PageNumber = 2,
                PageSize   = 10,
                Tag        = "tag"
            };

            var sut2 = new EntryCriteria
            {
                PageNumber = 2,
                PageSize   = 10,
                Tag        = "tag"
            };

            // act
            var hashcode1 = sut1.GetHashCode();
            var hashcode2 = sut2.GetHashCode();

            // assert
            Assert.That(hashcode1, Is.EqualTo(hashcode2));
        }
예제 #4
0
 public override int GetHashCode()
 {
     return(EntryCriteria.GetHashCode() + ResultOrder.GetHashCode());
 }