Пример #1
0
        public void EqualityWithNullProperties()
        {
            Release release = new Release(null, null);

            Assert.DoesNotThrow(() => release.Equals(release));
            Assert.DoesNotThrow(() => release.GetHashCode());
        }
Пример #2
0
        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));
        }
Пример #3
0
        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");
        }
Пример #4
0
        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, "!=");
        }
Пример #5
0
        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");
        }
Пример #6
0
        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");
        }
Пример #7
0
        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");
        }
Пример #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));
 }