public void GetOhmValueWithValidString() { OhmValueController controller = new OhmValueController(_ohmValueCalculator, _ohmCalculator); JsonResult jsonResult = controller.GetOhmValue("1", "2", "10000000", "9"); Assert.AreEqual(120000000, ((OhmCalculator)(jsonResult.Data)).FinalValue); Assert.AreEqual("ohms and 9% tolerance", ((OhmCalculator)(jsonResult.Data)).Tolerance); }
public void GetOhmValueWithDecimalBandDValue() { OhmValueController controller = new OhmValueController(_ohmValueCalculator, _ohmCalculator); JsonResult jsonResult = controller.GetOhmValue("1", "2", "10", "0.005"); Assert.AreEqual(120, ((OhmCalculator)(jsonResult.Data)).FinalValue); Assert.AreEqual("ohms and 0.005% tolerance", ((OhmCalculator)(jsonResult.Data)).Tolerance); }
public void GetOhmValueWithInvalidString() { OhmValueController controller = new OhmValueController(_ohmValueCalculator, _ohmCalculator); JsonResult jsonResult = controller.GetOhmValue("A", "B", "C", "D"); Assert.AreEqual(0, ((OhmCalculator)(jsonResult.Data)).FinalValue); Assert.AreEqual(null, ((OhmCalculator)(jsonResult.Data)).Tolerance); }
public void GetOhmValueWithAlphaNumeric() { OhmValueController controller = new OhmValueController(_ohmValueCalculator, _ohmCalculator); JsonResult jsonResult = controller.GetOhmValue("1A", "2B", "10C", "9Z"); Assert.AreEqual(0, ((OhmCalculator)(jsonResult.Data)).FinalValue); Assert.AreEqual(null, ((OhmCalculator)(jsonResult.Data)).Tolerance); }