public void CreateReview()
        {
            var review = new Review { Id = 1, Title = "This Film is Awesome", Content = "Thrilling plot twists and brilliant acting", Score = 5 };

            Assert.AreEqual(review.Id, 1);
            Assert.AreEqual(review.Title, "This Film is Awesome");
            Assert.AreEqual(review.Content, "Thrilling plot twists and brilliant acting");
            Assert.AreEqual(review.Score, 5);
        }
        /// <summary>
        /// Saves the reviews.
        /// </summary>
        /// <param name="review">The review.</param>
        public void SaveReviewAsync(Review review)
        {
            if (context.Reviews.Count(r => r.Id == review.Id) != 0)
            {
                context.Reviews.Single(r => r.Id == review.Id).Update(review);
            }
            else
            {
                context.Reviews.Add(review);
            }

            context.SaveChangesAsync();
        }
        public void UpdateReview()
        {
            Review newReview = new Review();

            newReview.Title = "Updated Title";

            Reviews.FirstOrDefault(r => r.Id == 1).Update(newReview);
            Review review = Reviews.FirstOrDefault(r => r.Id == 1);

            Assert.AreNotEqual(review.Title, "Testing");
            Assert.AreEqual(review.Title, "Updated Title");
            
        }
        public void Setup()
        {
            var reviews = new List<Review>();
               
            var review = new Review();
            review.Id = 1;
            review.Title = "Testing";
            review.Content = "Testng Reviews";
            review.UserId = "d9274a62-8a8c-46bf-aedc-d1cb3e8626c0";
            review.Username = "******";

            reviews.Add(review);

            this.Reviews = reviews.ToList();
        }
 /// <summary>
 /// Deletes the review.
 /// </summary>
 /// <param name="review">The review.</param>
 public void DeleteReviewAsync(Review review)
 {
     context.Reviews.Remove(review);
     context.SaveChangesAsync();
 }
Exemple #6
0
        /// <summary>
        /// Updates the specified review.
        /// </summary>
        /// <param name="review">The review.</param>
        public void Update(Review review)
        {
            this.ExternalId = review.ExternalId;
            this.Title = review.Title;
            this.content = review.content;
            this.Score = review.Score;
            this.UserId = review.UserId;

            this.Modified = DateTime.Now;
        }