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 }
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); }
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 Times_MultiplyAreaAndAreaToVolume_Throws() { var lhs = new Area(2.0); var rhs = new Area(3.0); Volume throws; ArithmeticOperations.Times(lhs, rhs, out throws); }