예제 #1
0
        public void DefaultConstructor_Apply_YieldsZeroAmountStandardUnit()
        {
            var expected = new Measure <Temperature>(0.0, Temperature.Kelvin);
            var actual   = new Measure <Temperature>();

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
예제 #2
0
        public void Constructor_WithNonReferenceUnit_InitializesMeasureInReferenceUnit()
        {
            var expected = new Measure <Time>(180.0, Time.Second);
            var actual   = new StandardMeasure <Time>(3.0, Time.Minute);

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
예제 #3
0
        public void Indexer_SameQuantityNonGenericInterface_YieldsValidMeasureOBject()
        {
            var      expected = new Measure <Volume>(5000.0, Volume.Liter);
            IMeasure meas     = new StandardMeasure <Volume>(5.0);
            var      actual   = meas[Volume.Liter];

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
예제 #4
0
        public void Power_LengthRaisedWith3_ReturnsVolume()
        {
            var expected = new Measure <Volume>(1.0, Volume.CubicDeciMeter);
            var len      = new Measure <Length>(1.0, Length.DeciMeter);
            StandardMeasure <Volume> actual; ArithmeticOperations.Power(len, 3, out actual);

            MeasureAssert.AmountsAreEqual(expected, actual);
        }
예제 #5
0
        public void Divide_DivideVolumeAndLength_ReturnsArea()
        {
            var expected    = new StandardMeasure <Area>(4.0);
            var numerator   = new StandardMeasure <Volume>(8.0);
            var denominator = new StandardMeasure <Length>(200.0, Length.CentiMeter);
            StandardMeasure <Area> actual; ArithmeticOperations.Divide(numerator, denominator, out actual);

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }
예제 #6
0
        public void Times_MultiplyAreaAndLength_ReturnsVolume()
        {
            var expected = new StandardMeasure <Volume>(6.0);
            var lhs      = new StandardMeasure <Area>(2.0);
            var rhs      = new StandardMeasure <Length>(3.0);
            StandardMeasure <Volume> actual; ArithmeticOperations.Times(lhs, rhs, out actual);

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

            MeasureAssert.MeasuresAreEqual(expected, actual);
        }