GetHashCode() public method

public GetHashCode ( ) : int
return int
        public void GetHashCode_TwoIdenticalObjects_BothUninitialized_HashCodesAreEqual()
        {
            // Arrange
            var publishConfiguration1 = new PublishConfiguration();
            var publishConfiguration2 = new PublishConfiguration();

            // Act
            int hashCodeObject1 = publishConfiguration1.GetHashCode();
            int hashCodeObject2 = publishConfiguration2.GetHashCode();

            // Assert
            Assert.AreEqual(hashCodeObject1, hashCodeObject2);
        }
        public void GetHashCode_SameHashCodeIsReturnedEveryTimeTheMethodIsCalled_AsLongAsTheObjectDoesNotChange()
        {
            // Arrange
            string repositoryName = "Some Repository";
            string repositoryPublishLocation = "http://example.com";
            var publishConfiguration = new PublishConfiguration { Name = repositoryName, PublishLocation = repositoryPublishLocation };

            int expectedHashcode = publishConfiguration.GetHashCode();

            for (var i = 0; i < 100; i++)
            {
                // Act
                publishConfiguration.Name = repositoryName;
                publishConfiguration.PublishLocation = repositoryPublishLocation;
                int generatedHashCode = publishConfiguration.GetHashCode();

                // Assert
                Assert.AreEqual(expectedHashcode, generatedHashCode);
            }
        }
        public void GetHashCode_TwoIdenticalObjects_BothInitialized_HashCodesAreEqual()
        {
            // Arrange
            var publishConfiguration1 = new PublishConfiguration { Name = "Some Repository", PublishLocation = "http://nuget.org/api/v2" };
            var publishConfiguration2 = new PublishConfiguration { Name = "Some Repository", PublishLocation = "http://nuget.org/api/v2" };

            // Act
            int hashCodeObject1 = publishConfiguration1.GetHashCode();
            int hashCodeObject2 = publishConfiguration2.GetHashCode();

            // Assert
            Assert.AreEqual(hashCodeObject1, hashCodeObject2);
        }
        public void GetHashCode_ForAllUniqueObject_AUniqueHashCodeIsReturned()
        {
            var hashCodes = new Dictionary<int, PublishConfiguration>();

            for (var i = 0; i < 10000; i++)
            {
                // Act
                var publishConfiguration = new PublishConfiguration { Name = Guid.NewGuid().ToString(), PublishLocation = "http://" + Guid.NewGuid().ToString() };

                int generatedHashCode = publishConfiguration.GetHashCode();

                // Assert
                Assert.IsFalse(hashCodes.ContainsKey(generatedHashCode));
                hashCodes.Add(generatedHashCode, publishConfiguration);
            }
        }