public void TestKil2Lbs() { // // TODO: Add test logic here // //Arrange Pounds2Kilograms killbs = new Pounds2Kilograms(); //Act double actual = killbs.Convert('k', 46.6666); double actualrounded = Math.Round(actual, 2); double expectedrounded = 102.67; //Assert Assert.AreEqual(expectedrounded, actualrounded); }
public void TestLbs2Kil() { // // TODO: Add test logic here // //Arrange Pounds2Kilograms lbskil = new Pounds2Kilograms(); //Act double actual = lbskil.Convert('p', 34.7777); double actualrounded = Math.Round(actual, 2); double expectedrounded = 15.81; //Assert Assert.AreEqual(expectedrounded, actualrounded); }
public ViewResult PoundsToKilograms(LbsKilViewModel model) { try { Pounds2Kilograms measurement = new Pounds2Kilograms(); 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"))); } }