/// <nodoc/>
 public override int GetHashCode()
 {
     return(HashCodeHelper.Combine(
                RelativePath.GetHashCode(),
                AzureArtifactsHash.GetHashCode(),
                BuildManifestHash.GetHashCode()));
 }
Exemple #2
0
 /// <inheridoc />
 public override int GetHashCode()
 {
     return(HashCodeHelper.Combine(
                m_absolutePath.GetHashCode(),
                m_packageRelativePath.GetHashCode(),
                m_fileRelativePath.GetHashCode(),
                m_parentCount));
 }
Exemple #3
0
 public override int GetHashCode()
 {
     if (RelativePath == null)
     {
         return(0);
     }
     return(RelativePath.GetHashCode());
 }
Exemple #4
0
 /// <inheridoc/>
 public override int GetHashCode()
 {
     return(HashCodeHelper.Combine(
                m_string != null ? m_string.GetHashCode() : 0,
                m_number,
                m_path.GetHashCode(),
                m_relativePath.GetHashCode(),
                m_pathAtom.GetHashCode(),
                (int)Type));
 }
Exemple #5
0
        public void Equality()
        {
            var          st = new StringTable(0);
            RelativePath a1 = RelativePath.Create(st, @"AAA\CCC");
            RelativePath a2 = RelativePath.Create(st, @"AAA\CCC");
            RelativePath a3 = RelativePath.Create(st, @"BBB\CCC");

            XAssert.IsTrue(a1.Equals(a1));
            XAssert.IsTrue(a1.Equals(a2));
            XAssert.IsTrue(a2.Equals(a1));
            XAssert.IsFalse(a1.Equals(a3));
            XAssert.IsFalse(a2.Equals(a3));

            XAssert.IsTrue(a1.Equals((object)a1));
            XAssert.IsTrue(a1.Equals((object)a2));
            XAssert.IsTrue(a2.Equals((object)a1));
            XAssert.IsFalse(a1.Equals((object)a3));
            XAssert.IsFalse(a2.Equals((object)a3));
            XAssert.IsFalse(a2.Equals("XYZ"));

            XAssert.IsTrue(a1 == a2);
            XAssert.IsTrue(a2 == a1);
            XAssert.IsFalse(a1 == a3);
            XAssert.IsFalse(a2 == a3);

            XAssert.IsFalse(a1 != a2);
            XAssert.IsFalse(a2 != a1);
            XAssert.IsTrue(a1 != a3);
            XAssert.IsTrue(a2 != a3);

            int h1 = a1.GetHashCode();
            int h2 = a2.GetHashCode();

            XAssert.AreEqual(h1, h2);

            a1 = RelativePath.Create(st, string.Empty);
            XAssert.AreEqual(0, a1.GetHashCode());

            XAssert.IsFalse(a1.Equals(a2));
        }
        public void Equality()
        {
            var          st = new StringTable(0);
            RelativePath a1 = RelativePath.Create(st, @"usr/src");
            RelativePath a2 = RelativePath.Create(st, @"usr/src");
            RelativePath a3 = RelativePath.Create(st, @"lib/src");

            XAssert.IsTrue(a1.Equals(a1));
            XAssert.IsTrue(a1.Equals(a2));
            XAssert.IsTrue(a2.Equals(a1));
            XAssert.IsFalse(a1.Equals(a3));
            XAssert.IsFalse(a2.Equals(a3));

            XAssert.IsTrue(a1.Equals((object)a1));
            XAssert.IsTrue(a1.Equals((object)a2));
            XAssert.IsTrue(a2.Equals((object)a1));
            XAssert.IsFalse(a1.Equals((object)a3));
            XAssert.IsFalse(a2.Equals((object)a3));
            XAssert.IsFalse(a2.Equals("home"));

            XAssert.IsTrue(a1 == a2);
            XAssert.IsTrue(a2 == a1);
            XAssert.IsFalse(a1 == a3);
            XAssert.IsFalse(a2 == a3);

            XAssert.IsFalse(a1 != a2);
            XAssert.IsFalse(a2 != a1);
            XAssert.IsTrue(a1 != a3);
            XAssert.IsTrue(a2 != a3);

            int h1 = a1.GetHashCode();
            int h2 = a2.GetHashCode();

            XAssert.AreEqual(h1, h2);

            a1 = RelativePath.Create(st, string.Empty);
            XAssert.AreEqual(HashCodeHelper.Fnv1Basis32, a1.GetHashCode());

            XAssert.IsFalse(a1.Equals(a2));
        }
Exemple #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = RelativePath?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Summary?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Category?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Version?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Architecture.GetHashCode();
         hashCode = (hashCode * 397) ^ NeedsTerminal.GetHashCode();
         return(hashCode);
     }
 }
Exemple #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (RelativePath != null ? RelativePath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Summary != null ? Summary.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Architecture.GetHashCode();
         hashCode = (hashCode * 397) ^ NeedsTerminal.GetHashCode();
         return(hashCode);
     }
 }
Exemple #9
0
 public override int GetHashCode()
 {
     // assuming full to relative conversion is faster:
     return(root.GetHashCode() ^ RelativePath.GetHashCode());
 }
Exemple #10
0
 public override int GetHashCode()
 {
     return(RelativePath.GetHashCode() ^ Hash.GetHashCode());
 }
Exemple #11
0
        public void RelativePath_Unit_GetHashCode_NonEqualObjects()
        {
            String[] nodes = new String[] { "sites", "Chad", "Greer" };
            Char separator = RelativePath.ForwardSlash;
            RelativePath first = new RelativePath(nodes, separator);
            RelativePath second = new RelativePath(nodes.Select(node => node.ToUpperInvariant()).ToArray(), separator);

            Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode());
        }
Exemple #12
0
        public void RelativePath_Unit_GetHashCode_EqualObjects()
        {
            String[] nodes = new String[] { "sites", "Chad", "Greer" };
            Char separator = RelativePath.ForwardSlash;
            RelativePath first = new RelativePath(nodes, separator);
            RelativePath second = new RelativePath(nodes, separator);

            Assert.AreEqual(first.GetHashCode(), second.GetHashCode());
        }