Пример #1
0
        public void GetHashCodeUsesAllProperties()
        {
            ReleaseVersion v1 = new ReleaseVersion("10.6.8-alpha3+556");
            ReleaseVersion v2 = new ReleaseVersion("10.6.8-alpha3+556");
            ReleaseVersion v3 = new ReleaseVersion("10.6.8-alpha3");
            ReleaseVersion v4 = new ReleaseVersion("10.6.8");

            Assert.Equal(v1.GetHashCode(), v2.GetHashCode());
            Assert.NotEqual(v1.GetHashCode(), v3.GetHashCode());
            Assert.NotEqual(v1.GetHashCode(), v4.GetHashCode());
            Assert.NotEqual(v3.GetHashCode(), v4.GetHashCode());
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Action.Length != 0)
            {
                hash ^= Action.GetHashCode();
            }
            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (RepoSource.Length != 0)
            {
                hash ^= RepoSource.GetHashCode();
            }
            if (RepoOwner.Length != 0)
            {
                hash ^= RepoOwner.GetHashCode();
            }
            if (ReleaseVersion.Length != 0)
            {
                hash ^= ReleaseVersion.GetHashCode();
            }
            if (ReleaseStatus.Length != 0)
            {
                hash ^= ReleaseStatus.GetHashCode();
            }
            hash ^= events_.GetHashCode();
            if (insertedAtTime_ != null)
            {
                hash ^= InsertedAtTime.GetHashCode();
            }
            if (updatedAtTime_ != null)
            {
                hash ^= UpdatedAtTime.GetHashCode();
            }
            if (duration_ != null)
            {
                hash ^= Duration.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ReleaseVersion.Length != 0)
            {
                hash ^= ReleaseVersion.GetHashCode();
            }
            if (RepoSource.Length != 0)
            {
                hash ^= RepoSource.GetHashCode();
            }
            if (RepoOwner.Length != 0)
            {
                hash ^= RepoOwner.GetHashCode();
            }
            if (RepoName.Length != 0)
            {
                hash ^= RepoName.GetHashCode();
            }
            if (Target.Length != 0)
            {
                hash ^= Target.GetHashCode();
            }
            if (Status.Length != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (Event.Length != 0)
            {
                hash ^= Event.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }