コード例 #1
0
      public void GivenBaseNumberWithCompositeUnitOfMeasureWhenMultiplyBaseNumberWithCompositeUnitOfMeasureThenCombinedUnitOfMeasure()
      {
         var left = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec-1"].ToModelUom(), 21.848);
         var right = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec-1"].ToModelUom(), 9.18);

         var product = left.Multiply(right);
         Assert.AreEqual("ft2[sec2]-1", product.UnitOfMeasure.Code);
         Assert.AreEqual(200.56464, product.Value);
      }
コード例 #2
0
      public void GivenBaseNumberWithCompositeUomThatWillCancelWhenMultipliedThenCombinedUnitOfMeasure()
      {
         var left = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["mg1ac1"].ToModelUom(), 352.14);
         var right = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["[m2]-1"].ToModelUom(), 13.6);

         var product = left.Multiply(right);
         Assert.AreEqual("mg", product.UnitOfMeasure.Code);
      }
コード例 #3
0
      public void GivenBaseNumberWithCompositeUnitOfMeasureWhenMultiplyBaseNumberWithCompositeUnitOfMeasureThenUnitsCancel()
      {
         var left = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec1"].ToModelUom(), 5.15);
         var right = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec-1"].ToModelUom(), 7.89);

         var product = left.Multiply(right);
         Assert.AreEqual("ft2", product.UnitOfMeasure.Code);
         Assert.AreEqual(40.6335, product.Value);
      }
コード例 #4
0
      public void GivenBaseNumberWhenMultiplyBaseNumberWithCompositeUnitOfMeasureThenCombinedUnitOfMeasure()
      {
         var left = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 52.78);
         var right = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft1sec-1"].ToModelUom(), 2.85);

         var product = left.Multiply(right);
         Assert.AreEqual("ft2sec-1", product.UnitOfMeasure.Code);
         Assert.AreEqual(150.423, product.Value);
      }
コード例 #5
0
      public void GivenBaseNumberWhenMultiplyBaseNumberThenUnitOfMeasuresCombined()
      {
         var left = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 12);
         var right = new NumericValue(InternalUnitSystemManager.Instance.UnitOfMeasures["ft"].ToModelUom(), 4);

         var product = left.Multiply(right);
         Assert.AreEqual("ft2", product.UnitOfMeasure.Code);
         Assert.AreEqual(48, product.Value);
      }
コード例 #6
0
      public void GivenBaseNumberWhenMultiplyDoubleShouldReturnNewBaseNumberWithSourceMultipliedByDouble()
      {
         var uom = _mileUnitOfMeasure;
         var number = new NumericValue(uom.ToModelUom(), 3.62);

         var result = number.Multiply(1.23);

         Assert.AreEqual(3.62 * 1.23, result.Value, Epsilon);
      }