示例#1
0
        public ActionResult Index(CalculatorViewModel cvm)
        {
            OhmValueCalculator oo            = new OhmValueCalculator();
            int ohmValue                     = oo.CalculateOhmValue(cvm.bandAColor, cvm.bandBColor, cvm.bandCColor, cvm.bandDColor);
            BandInfoRepository  bandRepo     = new BandInfoRepository();
            List <BandSpec>     bandColors   = bandRepo.GetBandInfo();
            CalculatorViewModel vmCalculator = new CalculatorViewModel()
            {
                bandAColor = cvm.bandAColor,
                bandBColor = cvm.bandBColor,
                bandCColor = cvm.bandCColor,
                bandDColor = cvm.bandDColor,
                BandInfo   = bandColors,
                OhmValue   = ohmValue
            };

            return(View(vmCalculator));
        }
示例#2
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            BandInfoRepository bandRepo   = new BandInfoRepository();
            List <BandSpec>    bandColors = bandRepo.GetBandInfo();

            CalculatorViewModel vmCalculator = new CalculatorViewModel()
            {
                bandAColor = "Red",
                bandBColor = "Red",
                bandCColor = "Red",
                bandDColor = "Red",
                BandInfo   = null,
                OhmValue   = 0
            };

            // Act
            ViewResult result = controller.Index(vmCalculator) as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }