public void TestGal2Lit() { // // TODO: Add test logic here // Liters2Gallons gallit = new Liters2Gallons(); //Act double actual = gallit.Convert('g', 55.7777); double actualrounded = Math.Round(actual, 2); double expectedrounded = 211.14; //Assert Assert.AreEqual(expectedrounded, actualrounded); }
public void TestLit2Gal() { // // TODO: Add test logic here // Liters2Gallons litgal = new Liters2Gallons(); //Act double actual = litgal.Convert('l', 25.7777); double actualrounded = Math.Round(actual, 2); double expectedrounded = 6.81; //Assert Assert.AreEqual(expectedrounded, actualrounded); }
public ViewResult LitersToGallons(LitGalViewModel model) { try { Liters2Gallons measurement = new Liters2Gallons(); model.Result = measurement.Convert(model.Choice, model.Measurement); ModelState.Clear(); return(View(model)); } catch (InvalidCastException ex) { return(View("Error", new HandleErrorInfo(ex, "Converter", "Error"))); } //This catch block will catch other types of unhandled exceptions catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Converter", "Error"))); } }