public void Should_compare_with_null_instance(double value) { var instance = new Bit(value); Assert.IsFalse(instance.Equals(null), "Equals"); Assert.AreEqual(1, instance.CompareTo(null), "CompareTo"); }
public void Should_compare_with_another_type_of_instance(double value) { var instance1 = new Bit(value); object instance2 = value; Assert.IsFalse(instance1.Equals(instance2), "Equals"); Assert.Throws <ArgumentException>(() => instance1.CompareTo(instance2), "CompareTo"); }
public void Should_compare_with_bigger_value(double baseValue, double biggerValue) { var baseInstance = new Bit(baseValue); var biggerInstance = new Bit(biggerValue); Assert.IsFalse(baseInstance.Equals(biggerInstance), "Equals"); Assert.IsFalse(baseInstance.Equals((object)biggerInstance), "Equals object"); Assert.IsFalse(baseInstance == biggerInstance, "=="); Assert.IsTrue(baseInstance != biggerInstance, "!="); Assert.AreEqual(-1, baseInstance.CompareTo(biggerInstance), "CompareTo"); Assert.AreEqual(-1, baseInstance.CompareTo((object)biggerInstance), "CompareTo object"); Assert.IsTrue(baseInstance < biggerInstance, "<"); Assert.IsFalse(baseInstance > biggerInstance, ">"); Assert.IsTrue(baseInstance <= biggerInstance, "<="); Assert.IsFalse(baseInstance >= biggerInstance, ">="); }
public void Should_compare_with_smaller_value(double baseValue, double smallerValue) { var baseInstance = new Bit(baseValue); var smallerInstance = new Bit(smallerValue); Assert.IsFalse(baseInstance.Equals(smallerInstance), "Equals"); Assert.IsFalse(baseInstance.Equals((object)smallerInstance), "Equals object"); Assert.IsFalse(baseInstance == smallerInstance, "=="); Assert.IsTrue(baseInstance != smallerInstance, "!="); Assert.AreEqual(+1, baseInstance.CompareTo(smallerInstance), "CompareTo"); Assert.AreEqual(+1, baseInstance.CompareTo((object)smallerInstance), "CompareTo object"); Assert.IsFalse(baseInstance < smallerInstance, "<"); Assert.IsTrue(baseInstance > smallerInstance, ">"); Assert.IsFalse(baseInstance <= smallerInstance, "<="); Assert.IsTrue(baseInstance >= smallerInstance, ">="); }
public void Should_compare_with_same_value(double value) { var baseInstance = new Bit(value); var otherInstance = new Bit(value); Assert.IsTrue(baseInstance.Equals(otherInstance), "Equals"); Assert.IsTrue(baseInstance.Equals((object)otherInstance), "Equals object"); Assert.IsTrue(baseInstance == otherInstance, "=="); Assert.IsFalse(baseInstance != otherInstance, "!="); Assert.AreEqual(0, baseInstance.CompareTo(otherInstance), "CompareTo"); Assert.AreEqual(0, baseInstance.CompareTo((object)otherInstance), "CompareTo object"); Assert.IsFalse(baseInstance < otherInstance, "<"); Assert.IsFalse(baseInstance > otherInstance, ">"); Assert.IsTrue(baseInstance <= otherInstance, "<="); Assert.IsTrue(baseInstance >= otherInstance, ">="); }
public void Should_Equal() { var bit = new Bit(1); Assert.AreEqual(1, bit); Assert.AreEqual(true, bit); Assert.IsTrue(bit == 1); Assert.IsTrue(bit.Equals(1)); bit = new Bit(0); Assert.AreEqual(0, bit); Assert.AreEqual(false, bit); Assert.IsTrue(bit == false); Assert.IsTrue(bit == 0); }
public void Should_NotEqual() { var bit = new Bit(1); Assert.AreNotEqual(0, bit); Assert.AreNotEqual(false, bit); Assert.IsFalse(bit == false); Assert.IsFalse(bit.Equals(false)); bit = new Bit(0); Assert.AreNotEqual(1, bit); Assert.AreNotEqual(true, bit); Assert.IsFalse(bit == true); Assert.IsFalse(bit.Equals(true)); }