public int Addproduct(Product model) { this.productRepository.Add(model); this.unitOfWork.Commit(); return model.ProductID; }
public void CategoryTest() { //var cate = new Category //{ // Picture = null, // Description = "分类测试2", // CategoryName = "分类2" //}; //var product = new Product //{ // ProductName = "product three", // UnitPrice = 30.0M, // UnitsInStock = 300, // Discontinued = true, // //CategoryId=1, // Category = cate //}; var product2 = new Product { ProductName="product five", UnitPrice=25, Discontinued=true, UnitsInStock=550, CategoryId=1 }; //int result= this.productsvc.Addproduct(product); int result2 = this.productsvc.Addproduct(product2); Assert.AreEqual(true,result2>0); }