public async Task TestInsertProductNullName()
 {
     var newProd = new ChemiChemicals.EndPoint.Models.Product
     {
         SupplierName  = "test",
         BinaryContent = "testing binary content",
         Url           = "http://test.com"
     };
     var ex = await Assert.ThrowsAsync <SqlException>(async() => await new DALHandler().InsertProduct(newProd));
 }
Пример #2
0
 public static ChemiChemicals.Repository.Entities.Product ModelMapping(ChemiChemicals.EndPoint.Models.Product product)
 {
     return(new ChemiChemicals.Repository.Entities.Product {
         ID = product.ID,
         ProductName = product.ProductName,
         SupplierName = product.SupplierName,
         BinaryContent = product.BinaryContent,
         Url = product.Url,
         InsertionDate = product.InsertionDate,
         IsChanged = product.IsChanged
     });
 }
        public async Task TestInsertProduct()
        {
            var newProd = new ChemiChemicals.EndPoint.Models.Product
            {
                ProductName   = "test",
                SupplierName  = "test",
                BinaryContent = "testing binary content",
                Url           = "http://test.com"
            };
            var product = await new DALHandler().InsertProduct(newProd);

            Assert.NotNull(product);
            Assert.IsType <ChemiChemicals.EndPoint.Models.Product>(product);
        }
        public async Task TestUpdateProduct()
        {
            var updatingProduct = new ChemiChemicals.EndPoint.Models.Product
            {
                ProductName   = "test update",
                SupplierName  = "test update",
                BinaryContent = "testing update binary content",
                Url           = "http://testupdate.com",
                ID            = Guid.Parse("FAB67A68-0F2D-485E-8197-03E13A1A244B")
            };
            var product = await new DALHandler().UpdateProduct(updatingProduct);

            Assert.NotNull(product);
            Assert.IsType <ChemiChemicals.EndPoint.Models.Product>(product);
        }