예제 #1
0
        public ActionResult PassUsingViewData()
        {
            var a = this.rngService.Number(-1000, 1001);
            var b = this.rngService.Number(-1000, 1001);

            this.ViewData["A"]   = a;
            this.ViewData["B"]   = b;
            this.ViewData["Add"] = calcService.Add(a, b);
            this.ViewData["Sub"] = calcService.Sub(a, b);
            this.ViewData["Mul"] = calcService.Mul(a, b);
            if (b == 0)
            {
                this.ViewData["Div"] = "Division by zero";
            }
            else
            {
                this.ViewData["Div"] = calcService.Div(a, b);
            }

            return(this.View());
        }
예제 #2
0
        public void Test_Div()
        {
            double res = _svc.Div(4, 2);

            Assert.AreEqual(2, res);
        }