public void EqualityWithNullProperties()
        {
            Release release = new Release(null, null);

            Assert.DoesNotThrow(() => release.Equals(release));
            Assert.DoesNotThrow(() => release.GetHashCode());
        }
        public void InequalityOther()
        {
            object release = new Release(new Version(1, 0), "http://url.to/some?download#location");
            object obj     = new object();

            Assert.IsFalse(release.Equals(obj));
        }
        public void EqualityOther()
        {
            object releaseA = new Release(new Version(1, 0), "http://url.to/some?download#location");
            object releaseB = new Release(new Version(1, 0), "http://url.to/some?download#location");

            Assert.IsTrue(releaseA.Equals(releaseB), "Equals");
            Assert.AreEqual(releaseA.GetHashCode(), releaseB.GetHashCode(), "GetHashCode");
        }
        public void InequalityVector3()
        {
            Release releaseA = new Release(new Version(1, 0), "http://url.to/some?download#location");
            Release releaseB = new Release(new Version(2, 0), "http://url.to/another?download#location");

            Assert.IsFalse(releaseA.Equals(releaseB), "Equals");
            Assert.IsFalse(releaseA == releaseB, "==");
            Assert.IsTrue(releaseA != releaseB, "!=");
        }
        public void EqualitySelf()
        {
            Release release = new Release(new Version(1, 0), "http://url.to/some?download#location");

            Assert.IsTrue(release.Equals(release), "Equals");
            Assert.IsTrue(release == release, "==");
            Assert.IsFalse(release != release, "!=");
            Assert.AreEqual(release.GetHashCode(), release.GetHashCode(), "GetHashCode");
        }
        public void EqualityVersion()
        {
            Release releaseA = new Release(new Version(1, 0), "http://url.to/some?download#location");
            Release releaseB = new Release(new Version(1, 0), "http://url.to/some?download#location");

            Assert.IsTrue(releaseA.Equals(releaseB), "Equals");
            Assert.IsTrue(releaseA == releaseB, "==");
            Assert.IsFalse(releaseA != releaseB, "!=");
            Assert.AreEqual(releaseA.GetHashCode(), releaseB.GetHashCode(), "GetHashCode");
        }
        public void InequalityNull()
        {
            Release releaseA = new Release(new Version(1, 0), "http://url.to/some?download#location");
            Release releaseB = null;

            Assert.IsFalse(releaseA.Equals(releaseB), "Equals");
            Assert.IsFalse(releaseA == releaseB, "A == B");
            Assert.IsTrue(releaseA != releaseB, "A != B");
            Assert.IsFalse(releaseB == releaseA, "B == A");
            Assert.IsTrue(releaseB != releaseA, "B != A");
        }
Esempio n. 8
0
 public bool Equals(Publication other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(Name, other.Name) &&
            string.Equals(Publisher, other.Publisher) &&
            Release.Equals(other.Release) &&
            string.Equals(Website, other.Website) &&
            string.Equals(Summary, other.Summary));
 }
 public void Equals_WhenProvidedNotEqualReleases_ReturnsFalse(Release left, Release right)
 {
     Assert.False(left.Equals(right));
 }
 public void Equals_WhenProvidedEqualReleases_ReturnsTrue(Release left, Release right)
 {
     Assert.True(left.Equals(right));
 }