示例#1
0
        public void EqualsReturnsTrueWhenEqual()
        {
            ReplacerEntry entry1 = new ReplacerEntry("o", "m");
            ReplacerEntry entry2 = new ReplacerEntry("o", "m");

            Assert.That(entry1.Equals(entry2), Is.True);
        }
示例#2
0
        public void EqualsReturnsFalseWhenDifferent()
        {
            ReplacerEntry entry1 = new ReplacerEntry("o", "m");
            ReplacerEntry entry2 = new ReplacerEntry("o", "t");

            Assert.That(entry1.Equals(entry2), Is.False);

            ReplacerEntry entry3 = new ReplacerEntry("t", "m");

            Assert.That(entry1.Equals(entry3), Is.False);
        }
示例#3
0
        public void HashCodeDependsOnFields()
        {
            ReplacerEntry entry1 = new ReplacerEntry("o", "m");
            ReplacerEntry entry2 = new ReplacerEntry("o", "t");
            ReplacerEntry entry3 = new ReplacerEntry("t", "m");
            ReplacerEntry entry4 = new ReplacerEntry("o", "m");

            Assert.That(entry1.GetHashCode(), Is.EqualTo(entry4.GetHashCode()));
            Assert.That(entry1.GetHashCode(), Is.Not.EqualTo(entry2.GetHashCode()));
            Assert.That(entry1.GetHashCode(), Is.Not.EqualTo(entry3.GetHashCode()));
        }
示例#4
0
        public void EqualityIsLikeEquals()
        {
            ReplacerEntry entry1 = new ReplacerEntry("o", "m");
            ReplacerEntry entry2 = new ReplacerEntry("o", "t");
            ReplacerEntry entry3 = new ReplacerEntry("t", "m");
            ReplacerEntry entry4 = new ReplacerEntry("o", "m");

            Assert.That(entry1 == entry4, Is.True);
            Assert.That(entry1 != entry4, Is.False);
            Assert.That(entry1 == entry2, Is.False);
            Assert.That(entry1 != entry2, Is.True);
            Assert.That(entry1 == entry3, Is.False);
            Assert.That(entry1 != entry3, Is.True);
        }
示例#5
0
        public void EqualsObjReturnsFalseWhenDifferentType()
        {
            ReplacerEntry entry1 = new ReplacerEntry("o", "m");

            Assert.That(entry1.Equals(5), Is.False);
        }