コード例 #1
0
        public override int GetHashCode()
        {
            var hashCode = 862207841;

            hashCode = (hashCode * -1521134295)
                       + EqualityComparer <string> .Default.GetHashCode(BasePath);

            foreach (var excludedDirectory in ExcludedDirectories)
            {
                hashCode = (hashCode * -1521134295)
                           + EqualityComparer <string> .Default.GetHashCode(
                    excludedDirectory);
            }
            foreach (var fileExtension in FileExtensions)
            {
                hashCode = (hashCode * -1521134295)
                           + EqualityComparer <string> .Default.GetHashCode(
                    fileExtension);
            }
            hashCode = (hashCode * -1521134295)
                       + Recursive.GetHashCode();
            hashCode = (hashCode * -1521134295)
                       + DifferenceType.GetHashCode();
            hashCode = (hashCode * -1521134295)
                       + MaxDurationDifferenceSeconds.GetHashCode();
            hashCode = (hashCode * -1521134295)
                       + MaxDurationDifferencePercent.GetHashCode();
            hashCode = (hashCode * -1521134295)
                       + MaxImageCompares.GetHashCode();
            hashCode = (hashCode * -1521134295)
                       + MaxDifferentImages.GetHashCode();
            hashCode = (hashCode * -1521134295)
                       + MaxImageDifferencePercent.GetHashCode();
            return(hashCode);
        }
コード例 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Filters?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ AutoAddFiles.GetHashCode();
         hashCode = (hashCode * 397) ^ AutoDeleteFiles.GetHashCode();
         hashCode = (hashCode * 397) ^ Recursive.GetHashCode();
         hashCode = (hashCode * 397) ^ (WatchDirectory?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (SyncDirectory?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Delay.GetHashCode());
         return(hashCode);
     }
 }
コード例 #3
0
        public void Nesting()
        {
            var value       = new Recursive();
            var value2      = new Recursive();
            var nestedValue = new Recursive()
            {
                Terminal = "test"
            };
            var nestedValue2 = new Recursive()
            {
                Terminal = "test"
            };

            value.Recurse  = nestedValue;
            value2.Recurse = nestedValue2;

            Assert.IsTrue(value.Equals(value2));
            Assert.AreEqual(value.GetHashCode(), value2.GetHashCode());
        }
コード例 #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (FileMask.Length != 0)
            {
                hash ^= FileMask.GetHashCode();
            }
            if (StartDir.Length != 0)
            {
                hash ^= StartDir.GetHashCode();
            }
            if (Recursive != false)
            {
                hash ^= Recursive.GetHashCode();
            }
            if (IgnoreErrors != false)
            {
                hash ^= IgnoreErrors.GetHashCode();
            }
            return(hash);
        }
コード例 #5
0
        public void ValueObject_Nesting()
        {
            // Arrange
            var valor1         = new Recursive();
            var valor2         = new Recursive();
            var valorAninhado1 = new Recursive()
            {
                Terminal = "teste"
            };
            var valorAninhado2 = new Recursive()
            {
                Terminal = "teste"
            };

            // Act
            valor1.Recurse = valorAninhado1;
            valor2.Recurse = valorAninhado2;

            // Assert
            Assert.True(valor1.Equals(valor2));
            Assert.Equal(valor1.GetHashCode(), valor2.GetHashCode());
        }
コード例 #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (HasID)
            {
                hash ^= ID.GetHashCode();
            }
            if (HasMethod)
            {
                hash ^= Method.GetHashCode();
            }
            if (HasPath)
            {
                hash ^= Path.GetHashCode();
            }
            if (HasVal)
            {
                hash ^= Val.GetHashCode();
            }
            if (HasDir)
            {
                hash ^= Dir.GetHashCode();
            }
            if (HasPrevValue)
            {
                hash ^= PrevValue.GetHashCode();
            }
            if (HasPrevIndex)
            {
                hash ^= PrevIndex.GetHashCode();
            }
            if (HasPrevExist)
            {
                hash ^= PrevExist.GetHashCode();
            }
            if (HasExpiration)
            {
                hash ^= Expiration.GetHashCode();
            }
            if (HasWait)
            {
                hash ^= Wait.GetHashCode();
            }
            if (HasSince)
            {
                hash ^= Since.GetHashCode();
            }
            if (HasRecursive)
            {
                hash ^= Recursive.GetHashCode();
            }
            if (HasSorted)
            {
                hash ^= Sorted.GetHashCode();
            }
            if (HasQuorum)
            {
                hash ^= Quorum.GetHashCode();
            }
            if (HasTime)
            {
                hash ^= Time.GetHashCode();
            }
            if (HasStream)
            {
                hash ^= Stream.GetHashCode();
            }
            if (HasRefresh)
            {
                hash ^= Refresh.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #7
0
        public void Nesting()
        {
            var value = new Recursive();
            var value2 = new Recursive();
            var nestedValue = new Recursive() { Terminal = "test" };
            var nestedValue2 = new Recursive() { Terminal = "test" };

            value.Recurse = nestedValue;
            value2.Recurse = nestedValue2;

            Assert.IsTrue(value.Equals(value2));
            Assert.AreEqual(value.GetHashCode(), value2.GetHashCode());
        }