public ActionResult Calculator() { ViewBag.Message = "Electronic Color Code Calculator"; ColorCodes colorCodes = new ColorCodes(); Models.CalculatorViewModel viewModel = new Models.CalculatorViewModel(); viewModel.ColorCodes = colorCodes.getColorCodes().Values; return(View(viewModel)); }
public ActionResult Calculator(Models.CalculatorViewModel viewModel) { ViewBag.Message = "Electronic Color Code Calculator"; ColorCodes colorCodes = new ColorCodes(); viewModel.ColorCodes = colorCodes.getColorCodes().Values; if (!ModelState.IsValid) { return(View(viewModel)); } else { IOhmValueCalculator calculator = new OhmValueCalcuator(new ColorCodes()); OhmRange range = calculator.CalculateOhmValueRange(viewModel.SelectedAColor, viewModel.SelectedBColor, viewModel.SelectedCColor, viewModel.SelectedDColor); viewModel.OhmValueMin = range.MinValue; viewModel.OhmValueMax = range.MaxValue; return(View(viewModel)); } }
public void getColorCodesTest() { Assert.IsNotNull(colorCodes.getColorCodes()); Assert.IsTrue(colorCodes.getColorCodes().Count > 0); }