public void Should_cast_from_SquarePicometre(double squarePicometreValue, double expectedValue) { var squarePicometreInstance = new SystemOfUnits.Area.SquareMetre.SquarePicometre(squarePicometreValue); SquareCentimetre actual = squarePicometreInstance; Assert.IsAssignableFrom <SquareCentimetre>(actual); var actualValue = actual.Value; Assert.AreEqual(expectedValue.ToString("E"), actualValue.ToString("E")); }
public void Should_compare_with_smaller_value(double baseValue, double smallerValue) { var baseInstance = new SquareCentimetre(baseValue); var smallerInstance = new SquareCentimetre(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_bigger_value(double baseValue, double biggerValue) { var baseInstance = new SquareCentimetre(baseValue); var biggerInstance = new SquareCentimetre(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_same_value(double value) { var baseInstance = new SquareCentimetre(value); var otherInstance = new SquareCentimetre(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_have_a_symbol(double value) { IUnit actual = new SquareCentimetre(value); Assert.AreEqual(SquareCentimetre.Symbol, actual.Symbol); }