コード例 #1
0
        internal static IHttpActionResult Insert()
        {
            var receiptResult = ReceiptImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Receipt> >;
            var receiptList   = receiptResult.Content.ToList();

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

            var receipts = productList.Select(t => new ReceiptItem()
            {
                ID                = Guid.NewGuid(),
                ReceiptID         = receiptList[0].ID,
                ProductID         = t.ID,
                Qty               = 10,
                Price             = 1000,
                Description       = "Description",
                Accepted          = true,
                Considerations    = "Considerations",
                WarehouseReceipNo = 123
            }).ToList();

            var response = baseController.Insert(receipts);

            return(response);
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: ProductTest.cs プロジェクト: mostafastn/TahaSoft
        public void Test_5_Delete()
        {
            //Act
            var deleteResult = ProductImplementaion.Delete() as OkNegotiatedContentResult <IEnumerable <Guid> >;

            //Assert
            Assert.IsNotNull(deleteResult);
        }
コード例 #4
0
ファイル: ProductTest.cs プロジェクト: mostafastn/TahaSoft
        public void Test_4_GetByID()
        {
            // Act
            var productResult = ProductImplementaion.GetByID() as OkNegotiatedContentResult <Product>;

            // Assert
            Assert.IsNotNull(productResult);
        }
コード例 #5
0
ファイル: ProductTest.cs プロジェクト: mostafastn/TahaSoft
        public void Test_3_GetAll()
        {
            // Act
            var productResult = ProductImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Product> >;

            // Assert
            Assert.IsNotNull(productResult);
        }
コード例 #6
0
ファイル: ProductTest.cs プロジェクト: mostafastn/TahaSoft
        public void Test_2_Update()
        {
            //Act
            var response = ProductImplementaion.Update() as OkNegotiatedContentResult <IEnumerable <Product> >;

            //Assert
            Assert.IsNotNull(response);
        }
コード例 #7
0
ファイル: CategoryTest.cs プロジェクト: mostafastn/TahaSoft
        internal static IHttpActionResult Delete()
        {
            ProductImplementaion.Delete();

            var _categorys  = GetAll() as OkNegotiatedContentResult <IEnumerable <Category> >;
            var categoryIDs = _categorys.Content.Select(t => t.ID).ToList();
            var response    = baseController.Delete(categoryIDs);

            return(response);
        }