public void Equals_AnyNull_False() { var target = new NamedEntityEqualityComparer(); Assert.IsFalse(target.Equals(null, MockRepository.GenerateMock<INamedEntity>())); Assert.IsFalse(target.Equals(MockRepository.GenerateMock<INamedEntity>(), null)); Assert.IsFalse(target.Equals(null, null)); }
public void GetHashCode_Name_NameHashCode() { var target = new NamedEntityEqualityComparer(); var a = MockRepository.GenerateMock<INamedEntity>(); a.Expect(e => e.Name).Return("a"); Assert.AreEqual("a".GetHashCode(), target.GetHashCode(a)); }
public void Equals_EqualsName_True() { var target = new NamedEntityEqualityComparer(); var a = MockRepository.GenerateMock<INamedEntity>(); a.Expect(e => e.Name).Return("a"); var b = MockRepository.GenerateMock<INamedEntity>(); b.Expect(e => e.Name).Return("a"); Assert.IsTrue(target.Equals(a, b)); }