public void Given1LitreAnd1000MilliLitres_WhenAdded_ThenShouldReturns2Litres() { Quantity litres = new Quantity(Unit.LITRE, 1.0); Quantity milliLitre = new Quantity(Unit.MILILITRE, 1000.0); Quantity expectedLitres = new Quantity(Unit.LITRE, 2.0); Quantity addedQuantities = litres.AddValue(milliLitre); Assert.AreEqual(expectedLitres, addedQuantities); }
public void Given1TonneAnd1000Gram_WhenAdded_ThenShouldReturn1001Killogram() { Quantity oneTonne = new Quantity(Unit.TONNE, 1.0); Quantity thousandGram = new Quantity(Unit.GRAM, 1000.0); Quantity expectedKillogram = new Quantity(Unit.KILOGRAM, 1001.0); Quantity addedQuantities = oneTonne.AddValue(thousandGram); Assert.AreEqual(expectedKillogram, addedQuantities); }
public void GivenGallonAndLitre_WhenAdded_ShouldReturnsCorrespndingLitres() { Quantity gallon = new Quantity(Unit.GALLON, 1.0); Quantity litres = new Quantity(Unit.LITRE, 3.78); Quantity expectedLitres = new Quantity(Unit.LITRE, 7.56); Quantity addedQuantity = gallon.AddValue(litres); Assert.AreEqual(expectedLitres, addedQuantity); }
public void GivenInchAndCentimeter_WhenAdded_ThenShouldRetuns3Inch() { Quantity inch = new Quantity(Unit.INCH, 2.0); Quantity centiMeter = new Quantity(Unit.CENTIMETER, 2.5); Quantity expectedInch = new Quantity(Unit.INCH, 3.0); Quantity addedInchAndCentimeter = inch.AddValue(centiMeter); Assert.AreEqual(expectedInch, addedInchAndCentimeter); }
public void Given1FeetAnd1Feet_WhenAdded_ThenShouldRetuns24Inches() { Quantity feet1 = new Quantity(Unit.FEET, 1.0); Quantity feet2 = new Quantity(Unit.FEET, 1.0); Quantity expectedInch = new Quantity(Unit.INCH, 24.0); Quantity addedFeets = feet1.AddValue(feet2); Assert.AreEqual(expectedInch, addedFeets); }
public void Given1FeetAnd2Inches_WhenAdded_ThenShouldRetuns14Inches() { Quantity feet = new Quantity(Unit.FEET, 1.0); Quantity inch = new Quantity(Unit.INCH, 2.0); Quantity expectedInch = new Quantity(Unit.INCH, 14.0); Quantity addedInchAndfeet = feet.AddValue(inch); Assert.AreEqual(expectedInch, addedInchAndfeet); }
public void Given2InchesAnd2Inches_WhenAdded_ThenShouldRetunsFourInches() { Quantity inch1 = new Quantity(Unit.INCH, 2.0); Quantity inch2 = new Quantity(Unit.INCH, 2.0); Quantity expectedInch = new Quantity(Unit.INCH, 4.0); Quantity addedInch = inch1.AddValue(inch2); Assert.AreEqual(expectedInch, addedInch); }
public void Given212Fahrenheitand100Celsius_WhenAdded_ThenShouldReturnInvalidException() { Quantity fahrenheit = new Quantity(Unit.FAHRENHIET, 212.0); Quantity celsius = new Quantity(Unit.CELCIUS, 100.0); QuantityMeasurementException exception = Assert.Throws <QuantityMeasurementException>(() => fahrenheit.AddValue(celsius)); Assert.AreEqual(QuantityMeasurementException.ExceptionType.INVALID_EXCEPTION, exception.Type); }