Ejemplo n.º 1
0
        public int ReviewDelete(int id)
        {
            ReviewService r = new ReviewService();

            RestaurantReview.BL.Model.Review model = new RestaurantReview.BL.Model.Review();

            model.Id = id;

            r.Delete(model, 0);

            return 0;
        }
Ejemplo n.º 2
0
        public int ReviewAdd(int restaurantId, int userId, int rating, string comments)
        {
            ReviewService r = new ReviewService();

            RestaurantReview.BL.Model.Review model = new RestaurantReview.BL.Model.Review();

            model.RestaurantID = restaurantId;
            model.UserID = userId;
            model.Rating = rating;
            model.Comments = comments;

            return r.Add(model, 0);
        }
Ejemplo n.º 3
0
        public void DeleteReviewTest()
        {
            //Arrange
            RestaurantReview.BL.Model.Review restaurant =
                new RestaurantReview.BL.Model.Review() { Id = 1, RestaurantID = 0, UserID = 0, Rating = 1, Comments = "test", DateCreated = DateTime.Now };

            //should be done with stored procedure, demonstrating it doesn't have to be
            _mockSet.Setup(m => m.Remove(It.IsAny<DAL.Entity.Review>())).Returns(() =>
            {
                return null;
            });

            //Act
            _service.Delete(restaurant, 1);

            _mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
Ejemplo n.º 4
0
        public void AddReviewTest()
        {
            //Arrange
            RestaurantReview.BL.Model.Review restaurant =
                new RestaurantReview.BL.Model.Review() { Id = 1, RestaurantID = 0, UserID = 0, Rating = 1, Comments = "test", DateCreated = DateTime.Now };

            //should be done with stored procedure, demonstrating it doesn't have to be
            _mockContext.Setup(m => m.ReviewAdd(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>())).Returns(() =>
            {
                return 0;
            });

            //Act
            //Could return ID here.  No real need at this point.
            int rID = _service.Add(restaurant, 1);

            //Assert
            Assert.AreEqual(0, rID);
        }