public void Same_Objects_Are_Equal() { var parameters = new { Id = 10 }; QueryObject queryObject = new QueryObject(Text, parameters, CommandType); QueryObject queryObject2 = new QueryObject(Text, parameters, CommandType); Assert.That(queryObject.Equals(queryObject), Is.True); Assert.That(queryObject.Equals(queryObject2), Is.True); Assert.That(queryObject.GetHashCode() == queryObject2.GetHashCode(), Is.True); }
public void Not_Equal_To_OtherType_Object() { QueryObject queryObject = new QueryObject(Text, CommandType); object other = new object(); Assert.That(queryObject.Equals(other), Is.False); }
public void Different_Objects_Are_Not_Equal() { var parameters = new { Id = 10 }; QueryObject queryObject = new QueryObject(Text, parameters, CommandType); QueryObject queryObject2 = new QueryObject("text", parameters, CommandType); QueryObject queryObject3 = new QueryObject(Text, null, CommandType); QueryObject queryObject4 = new QueryObject(Text, parameters, null); Assert.That(queryObject.Equals(queryObject2), Is.False); Assert.That(queryObject.Equals(queryObject3), Is.False); Assert.That(queryObject.Equals(queryObject4), Is.False); Assert.That(queryObject.GetHashCode() == queryObject2.GetHashCode(), Is.False); Assert.That(queryObject.GetHashCode() == queryObject3.GetHashCode(), Is.False); Assert.That(queryObject.GetHashCode() == queryObject4.GetHashCode(), Is.False); }
public void Not_Equal_To_Null() { QueryObject queryObject = new QueryObject(Text, CommandType); Assert.That(queryObject.Equals(null), Is.False); }