예제 #1
0
        public void Constructor_WithNonReferenceUnit_InitializesMeasureInReferenceUnit()
        {
            var expected = new Measure <Time>(amount: 180.0, unit: Time.Second);
            var actual   = new Time(amount: 3.0, unit: Time.Minute);

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
        public void Power_LengthRaisedWith3_ReturnsVolume()
        {
            var    expected = new Volume(amount: 1.0, unit: Volume.CubicDeciMeter);
            var    len      = new Measure <Length>(amount: 1.0, unit: Length.DeciMeter);
            Volume actual; ArithmeticOperations.Power(len, iExponent: 3, oResult: out actual);

            MeasureAssert.AmountsAreEqual(expected, actual);
        }
예제 #3
0
        public void Indexer_SameQuantityNonGenericInterface_YieldsValidMeasureObject()
        {
            var      expected = new Measure <Volume>(amount: 5000.0f, unit: Volume.Liter);
            IMeasure meas     = new Volume(amount: 5.0f);
            var      actual   = meas[Volume.Liter];

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
        public void Divide_DivideVolumeAndLength_ReturnsArea()
        {
            var  expected    = new Area(amount: 4.0);
            var  numerator   = new Volume(amount: 8.0);
            var  denominator = new Length(amount: 200.0, unit: Length.CentiMeter);
            Area actual; ArithmeticOperations.Divide(numerator, denominator, out actual);

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
        public void Times_MultiplyAreaAndLength_ReturnsVolume()
        {
            var    expected = new Volume(amount: 6.0);
            var    lhs      = new Area(amount: 2.0);
            var    rhs      = new Length(amount: 3.0);
            Volume actual; ArithmeticOperations.Times(lhs, rhs, out actual);

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }