示例#1
0
        public void TestSetup()
        {
            controller = new ECCController();
            var result = controller.Index() as ViewResult;

            ecc     = (ECC)result.ViewData.Model;
            context = new Mock <ControllerContext>();
            session = new Mock <HttpSessionStateBase>();
            context.Setup(m => m.HttpContext.Session).Returns(session.Object);
            controller.ControllerContext = context.Object;
            session.Setup(s => s["ECCModel"]).Returns(ecc);
        }
示例#2
0
        public void TestIndexPostValues()
        {
            ecc.BandAColor = "Yellow";
            ecc.BandBColor = "Violet";
            ecc.BandCColor = "Red";
            ecc.BandDColor = "Gold";
            var result = controller.Index(ecc) as ViewResult;

            ecc = (ECC)result.ViewData.Model;
            Assert.AreEqual(4700, ecc.OhmValue);
            Assert.AreEqual(4465, ecc.LowerBoundValue);
            Assert.AreEqual(4935, ecc.UpperBoundValue);
        }