Example #1
0
 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));
 }
Example #2
0
        public void EqualityOfUnlikeUnits()
        {
            Assert.AreEqual(Tablespoon.S(6), Ounce.S(3));
            Assert.AreEqual(Tablespoon.S(8), Cup.S(0.5));
            Assert.AreEqual(Cup.S(0.5), Tablespoon.S(8));
            Assert.AreEqual(Gallon.S(2), Teaspoon.S(1536));
            Assert.AreNotEqual(Cup.S(6), Tablespoon.S(6));
            Assert.AreEqual(Inch.S(126720), Mile.S(2));
            Assert.AreNotEqual(Inch.Es(1), Teaspoon.S(1));
            Assert.AreNotEqual(Foot.S(2), Cup.S(0.5));

            Assert.AreEqual(6.Tablespoons(), 3.Ounces());
            Assert.AreEqual(8.Tablespoons(), 0.5.Cups());
            Assert.AreEqual(0.5.Cups(), 8.Tablespoons());
            Assert.AreEqual(2.Gallons(), 1536.Teaspoons());
            Assert.AreNotEqual(6.Cups(), 6.Tablespoons());
            Assert.AreNotEqual(1.Inches(), 1.Teaspoons());
            Assert.AreNotEqual(2.Feet(), 0.5.Cups());
        }
 public static RatioQuantity Miles(this int amount) => Mile.S(amount);
 public static RatioQuantity Miles(this double amount) => Mile.S(amount);