public ActionResult CalculateOhmValue(string bandAColor, string bandBColor, string bandCColor, string bandDColor) { var cal = new OhmCalculator(); var value = cal.CalculateOhmValue(bandAColor, bandBColor, bandCColor, bandDColor); return(RedirectToAction("Index", new { result = value.OhmValue, tolerance = value.Tolerance, bandAColor = bandAColor, bandBColor = bandBColor, bandCColor = bandCColor, bandDColor = bandDColor, })); }
public void CalculateOhmCalculator() { // Arrange string bandAColor = "Yellow"; string bandBColor = "Violet"; string bandCColor = "Red"; string bandDColor = "Red"; double value = 4700; double tolerance = 2; var calculator = new OhmCalculator(); // Act var result = calculator.CalculateOhmValue(bandAColor, bandBColor, bandCColor, bandDColor); // Assert Assert.AreEqual(result.OhmValue, value); Assert.AreEqual(result.Tolerance, tolerance); }
public void CalculateOhmValue_GreenBlueRed() { var calculatedOhmValue = _ohmCalculator.CalculateOhmValue(Names.Green, Names.Blue, Names.Red); Assert.Equal(5600, calculatedOhmValue); }