示例#1
0
        public void Example1()
        {
            StandardMeasure <Mass> initialWgt = new StandardMeasure <Mass>(75.0);
            StandardMeasure <Mass> gainedWgt  = new StandardMeasure <Mass>(2.5, Mass.HectoGram);
            StandardMeasure <Mass> newWgt     = initialWgt + gainedWgt;

            Measure <Mass> newWgtInGram     = newWgt[Mass.Gram];
            Measure <Mass> initialWgtInGram = newWgtInGram - gainedWgt;

            Console.WriteLine("Initial weight: {0}", initialWgtInGram);

            Measure <Length>       height = new Measure <Length>(30.0, Length.CentiMeter);
            StandardMeasure <Area> area   = (StandardMeasure <Area>) 0.02;

            StandardMeasure <Volume> vol; ArithmeticOperations.Times(height, area, out vol);
            var maxVol = new StandardMeasure <Volume>(10.0, Volume.Liter);

            if (vol < maxVol)
            {
                Console.WriteLine("Calculated volume is within limits, actual volume: {0}", vol[Volume.Liter]);
            }

#if NUNIT24
            Assert.Ignore();
#else
            Assert.Pass();
#endif
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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);
        }
        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);
        }
示例#6
0
 public void Divide_DivideAreaAndAreaToLength_Throws()
 {
     var numerator   = new StandardMeasure <Area>(8.0);
     var denominator = new StandardMeasure <Area>(200.0, Area.SquareDeciMeter);
     StandardMeasure <Length> throws; ArithmeticOperations.Divide(numerator, denominator, out throws);
 }
示例#7
0
 public void Times_MultiplyAreaAndAreaToVolume_Throws()
 {
     var lhs = new StandardMeasure <Area>(2.0);
     var rhs = new StandardMeasure <Area>(3.0);
     StandardMeasure <Volume> throws; ArithmeticOperations.Times(lhs, rhs, out throws);
 }
 public void Divide_DivideAreaAndAreaToLength_Throws()
 {
     var    numerator   = new Area(8.0);
     var    denominator = new Area(200.0, Area.SquareDeciMeter);
     Length throws; ArithmeticOperations.Divide(numerator, denominator, out throws);
 }
 public void Times_MultiplyAreaAndAreaToVolume_Throws()
 {
     var    lhs = new Area(2.0);
     var    rhs = new Area(3.0);
     Volume throws; ArithmeticOperations.Times(lhs, rhs, out throws);
 }