コード例 #1
0
        public void CommitOrderTest()
        {
            //Arrange
            //--> Intantiate new Order Object
            var order = new Order
            {
                FirstName = "David",
                LastName  = "Thompson",
                Address   = "123 SomeStreet",
                City      = "Dallas",
                State     = "TX",
                Zip       = "75220";

                OrderDetails = new List <OrderDetail>
                {
                    new OrderDetail {
                        ItemCode = "abcd", Description = "Cool Item", PriceEach = 1.2M, Quantity = 1M, Total = 1.2M
                    }
                }
            };
            var svc = new EpicVitamins.OrderService();

            //Act
            var orderID = svc.CommitOrder(order);

            //Assert
            var checkOrder = svc.GetOrder(orderID);

            Assert.AreEqual(order.FirstName, checkOrder.FirstName, "FirstName");
            Assert.AreEqual("abcd", checkOrder.OrderDetails.First().ItemCode);
        }
    }
コード例 #2
0
        public ActionResult Index(EpicVitaminSample.Models.Order model)
        {
            var svc = new EpicVitamins.OrderService();
            var model = svc.GetOrder(id);

            return View(model);
        }
コード例 #3
0
        public void CommitOrderTest()
        {
            //Arrange
            //--> Intantiate new Order Object
            var order = new Order
            {
                FirstName = "David",
                LastName = "Thompson",
                Address = "123 SomeStreet",
                City = "Dallas",
                State = "TX",
                Zip = "75220";

                OrderDetails = new List<OrderDetail>
                {
                    new OrderDetail {ItemCode="abcd", Description="Cool Item", PriceEach=1.2M, Quantity=1M, Total=1.2M}
                }

            };
            var svc = new EpicVitamins.OrderService();

            //Act
            var orderID = svc.CommitOrder(order);

            //Assert
            var checkOrder = svc.GetOrder(orderID);

            Assert.AreEqual(order.FirstName, checkOrder.FirstName, "FirstName");
            Assert.AreEqual("abcd", checkOrder.OrderDetails.First().ItemCode);
        }

        #endregion Methods
    }
コード例 #4
0
        public ActionResult Index(EpicVitaminSample.Models.Order model)
        {
            var svc   = new EpicVitamins.OrderService();
            var model = svc.GetOrder(id);

            return(View(model));
        }