コード例 #1
0
        public void calculate_profitTest_forZero()
        {
            // Arrange
            Meaningfulcalculation MCTester = new Meaningfulcalculation();
            decimal sellprice     = 2000;
            decimal purchaseprice = 2000;
            decimal actual_answer;
            decimal expected_answer = 0;

            // Act
            actual_answer = MCTester.calculate_profit(sellprice, purchaseprice);
            // Assert
            Assert.AreEqual(expected_answer, actual_answer);
        }
コード例 #2
0
        public ActionResult Purchase(PurchaseModel model)
        {
            try
            {
                BusinessLogicLayer.Meaningfulcalculation mc = new Meaningfulcalculation();
                model.Profit
                    = mc.calculate_profit(model.OfferedPrice, model.ReservePrice);
                ModelState.Clear();
            }
            catch (Exception ex)
            {
                ViewBag.Exception = ex;
                return(View("Error"));
            }



            return(View(model));
        }