예제 #1
0
        internal static IHttpActionResult Insert()
        {
            var cartResult = CartImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Cart> >;
            var cartList   = cartResult.Content.ToList();

            var productResult = ProductImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Product> >;
            var productList   = productResult.Content.ToList();

            var cartItems = new List <CartItem>()
            {
                new CartItem()
                {
                    ID = Guid.NewGuid(), CartID = cartList[0].ID, ProductID = productList[0].ID, Qty = 2, Price = 1000, Discount = 100, Description = "Description A",
                },
                new CartItem()
                {
                    ID = Guid.NewGuid(), CartID = cartList[0].ID, ProductID = productList[0].ID, Qty = 2, Price = 1000, Discount = 100, Description = "Description B",
                },
                new CartItem()
                {
                    ID = Guid.NewGuid(), CartID = cartList[0].ID, ProductID = productList[0].ID, Qty = 2, Price = 1000, Discount = 100, Description = "Description C",
                },
            };

            var response = baseController.Insert(cartItems);

            return(response);
        }
예제 #2
0
        public void Test_1_Insert()
        {
            //Act
            var response = CartImplementaion.Insert() as OkNegotiatedContentResult <IEnumerable <Cart> >;

            //Assert
            Assert.IsNotNull(response);
        }
예제 #3
0
        public void Test_5_Delete()
        {
            //Act
            var deleteResult = CartImplementaion.Delete() as OkNegotiatedContentResult <IEnumerable <Guid> >;

            //Assert
            Assert.IsNotNull(deleteResult);
        }
예제 #4
0
        public void Test_4_GetByID()
        {
            // Act
            var productResult = CartImplementaion.GetByID() as OkNegotiatedContentResult <Cart>;

            // Assert
            Assert.IsNotNull(productResult);
        }
예제 #5
0
        public void Test_3_GetAll()
        {
            // Act
            var productResult = CartImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Cart> >;

            // Assert
            Assert.IsNotNull(productResult);
        }
예제 #6
0
        internal static IHttpActionResult Delete()
        {
            var cartResult = CartImplementaion.Delete() as OkNegotiatedContentResult <IEnumerable <Guid> >;

            var _customers  = GetAll() as OkNegotiatedContentResult <IEnumerable <Customer> >;
            var customerIDs = _customers.Content.Select(t => t.ID).ToList();
            var response    = baseController.Delete(customerIDs);

            return(response);
        }