public void Arithmetic() { Assert.AreEqual(-Ounce.S(4), -(Pint.S(0.25))); Assert.AreEqual(Cup.S(1), Ounce.S(4) + Pint.S(0.25)); Assert.AreEqual(Pint.S(-0.25), Quart.S(0.25) - Ounce.S(12)); Assert.AreEqual(-Foot.S(3), Inch.Es(36) - Yard.S(2)); }
public void Arithmetic() { Assert.AreEqual(Tablespoon.S(-3), -Tablespoon.S(3)); Assert.AreEqual(-Cup.S(1.5), Cup.S(6.5) - Cup.S(8)); Assert.AreEqual(-Tablespoon.S(24), Cup.S(6.5) - Gallon.S(0.5)); Assert.AreEqual(-24.Tablespoons(), 6.5.Cups() - 0.5.Gallons()); Assert.AreEqual(-Foot.S(6), Inch.Es(18) - Yard.S(2.5)); }
public void EqualityOfDifferentUnit() { Assert.AreNotEqual(Cup.S(4), Gallon.S(4)); Assert.AreEqual(Teaspoon.S(3), Tablespoon.S(1)); Assert.AreEqual(Ounce.S(16), Quart.S(0.5)); Assert.AreEqual(Gallon.S(3), Teaspoon.S(2304)); Assert.AreEqual(Foot.S(4.5), Yard.S(1.5)); Assert.AreEqual(Mile.S(2), Inch.Es(126720)); Assert.AreNotEqual(Inch.Es(1), Teaspoon.S(1)); Assert.AreNotEqual(Inch.Es(1), Celsius.S(1)); }
public void Hash() { Assert.AreEqual(Tablespoon.S(8).GetHashCode(), Cup.S(0.5).GetHashCode()); Assert.AreEqual(Yard.S(2).GetHashCode(), Inch.Es(72).GetHashCode()); Assert.AreEqual(Fahrenheit.S(50).GetHashCode(), Celsius.Es(10).GetHashCode()); }
public static RatioQuantity Yards(this int amount) => Yard.S(amount);
public static RatioQuantity Yards(this double amount) => Yard.S(amount);