Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public void GetHashCode_NothingSet_ReturnsZero()
        {
            // arrange
            var sut = new EntryCriteria();

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

            // assert
            Assert.That(hashcode, Is.EqualTo(0));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     return(EntryCriteria.GetHashCode() + ResultOrder.GetHashCode());
 }