public void TestSameInstanceEquality() { FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test" }; FindsByAttribute second = first; Assert.That(first == second, Is.True); Assert.That(second == first, Is.True); Assert.That(first.Equals(second), Is.True); Assert.That(second.Equals(first), Is.True); Assert.That(object.ReferenceEquals(first, second), Is.True); }
public void TestInequalityOfPriority() { FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test", Priority = 1 }; FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "Test", Priority = 2 }; Assert.That(first.Equals(second), Is.False); Assert.That(first == second, Is.False); Assert.That(first != second, Is.True); }
public void TestInequalityOfUsing() { FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Hello" }; FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "World" }; Assert.That(first.Equals(second), Is.False); Assert.That(first == second, Is.False); Assert.That(first != second, Is.True); }
public void TestInequalityOfHow() { FindsByAttribute first = new FindsByAttribute() { How = How.Name, Using = "Test" }; FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "Test" }; Assert.IsFalse(first.Equals(second)); Assert.IsFalse(first == second); Assert.IsTrue(first != second); }
public void TestInequalityOfNull() { FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test" }; FindsByAttribute second = null; Assert.That(first.Equals(second), Is.False); // Must test order of arguments for overridden operators Assert.That(first == second, Is.False); Assert.That(first != second, Is.True); Assert.That(second == first, Is.False); Assert.That(second != first, Is.True); }
public void TestEquality() { FindsByAttribute first = new FindsByAttribute() { How = How.Id, Using = "Test" }; FindsByAttribute second = new FindsByAttribute() { How = How.Id, Using = "Test" }; Assert.IsTrue(first.Equals(second)); Assert.IsFalse(object.ReferenceEquals(first, second)); Assert.IsTrue(first == second); Assert.IsFalse(first != second); }