public void Should_be_possible_to_compare_two_floats_using_not_equals_operator() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("0.5", "0.55", OperationEnumeration.notequal); Assert.IsTrue(compareResult, "the value is not expected for not equals operation"); compareResult = comparator.Compare("10", "11", OperationEnumeration.notequal); Assert.IsTrue(compareResult, "the value is not expected for not equals operation"); }
public void Should_be_possible_to_compare_two_floats_using_equals_operator() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("55.89", "55.89", OperationEnumeration.equals); Assert.IsTrue(compareResult, "the value is not expected for equals operation"); compareResult = comparator.Compare("10", "10", OperationEnumeration.equals); Assert.IsTrue(compareResult, "the value is not expected for equals operation"); compareResult = comparator.Compare("55.89", "55.88", OperationEnumeration.equals); Assert.IsFalse(compareResult, "the value is not expected for equals operation"); }
public void Should_be_possible_to_compare_two_floats_using_less_than_or_equals_operator() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("0.33", "0.33", OperationEnumeration.lessthanorequal); Assert.IsTrue(compareResult, "the value is not expected for less than operation"); compareResult = comparator.Compare("50", "180", OperationEnumeration.lessthanorequal); Assert.IsTrue(compareResult, "the value is not expected for less than operation"); compareResult = comparator.Compare("0.550", "0.550", OperationEnumeration.lessthanorequal); Assert.IsTrue(compareResult, "the value is not expected for less than operation"); }
public void Should_be_possible_to_compare_two_floats_using_greather_than_or_equals_operator() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("0.33", "0.10", OperationEnumeration.greaterthanorequal); Assert.IsTrue(compareResult, "the value is not expected for greater than or equals operation"); compareResult = comparator.Compare("0.33", "0.33", OperationEnumeration.greaterthanorequal); Assert.IsTrue(compareResult, "the value is not expected for greater than or equals operation"); compareResult = comparator.Compare("0.1113", "0.1113", OperationEnumeration.greaterthanorequal); Assert.IsTrue(compareResult, "the value is not expected for greater than or equals operation"); }
public void Should_be_possible_to_compare_two_floats_using_less_than_operator() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("0.33", "0.99", OperationEnumeration.lessthan); Assert.IsTrue(compareResult, "the value is not expected for less than operation"); compareResult = comparator.Compare("50", "180", OperationEnumeration.lessthan); Assert.IsTrue(compareResult, "the value is not expected for less than operation"); // error in convertion case of 0.850. It convert to 850.0 compareResult = comparator.Compare("0.85", "180", OperationEnumeration.lessthan); Assert.IsTrue(compareResult, "the value is not expected for less than operation"); }
public void Should_not_possible_to_compare_elements_with_null_value() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("29", null, OperationEnumeration.equals); Assert.IsFalse(compareResult, "the value is not expected for this operation"); }
public void Should_not_be_possible_two_compare_elements_that_is_not_float_with_any_operator() { FloatComparator comparator = new FloatComparator(); bool compareResult = comparator.Compare("Is not a Float", "15", OperationEnumeration.greaterthanorequal); Assert.IsTrue(compareResult, "the value is not a float number"); }