示例#1
0
        public void UpdateReviewTest()
        {
            AdventureWorksDataContext db  = new AdventureWorksDataContext();
            ProductService            pr  = new ProductService();
            ProductReviewService      prs = new ProductReviewService();

            Product product = new Product();

            product.Name          = "Test-Update-ProductReview2";
            product.ProductNumber = "Test-U-PR";

            pr.CreateProduct(product);

            ProductReview productReview = new ProductReview();

            productReview.Rating    = 1;
            productReview.Comments  = "Comments-Test";
            productReview.ProductID = product.ProductID;
            prs.CreateReview(productReview);

            productReview.Comments = "UPDATED-Comments-Test";
            prs.UpdateReview(productReview);

            ProductReview actualProductReview = (from p in db.ProductReview
                                                 where p.ProductID.Equals(product.ProductID)
                                                 select p).First();

            Assert.AreEqual("UPDATED-Comments-Test", actualProductReview.Comments);
            prs.DeleteReview(productReview);
            pr.DeleteProduct(product);
        }
示例#2
0
 public void UpdateReview(ProductReview review)
 {
     productReviewService.UpdateReview(review);
     GetReviews();
 }