public DetailController()
 {
     this._unitOfWork               = new UnitOfWork(_df);
     this._productBusiness          = new ProductBusiness(_df, this._unitOfWork);
     this._ImageBusiness            = new ImageBusiness(_df, this._unitOfWork);
     this._ReviewBusiness           = new ReviewBusiness(_df, this._unitOfWork);
     this._userBusiness             = new UserBusiness(_df, this._unitOfWork);
     this._CategoryBusiness         = new CategoryBusiness(_df, this._unitOfWork);
     this._SubCategoryBusiness      = new SubCategoryBusiness(_df, this._unitOfWork);
     this._productSizeBusiness      = new ProductSizeBusiness(_df, this._unitOfWork);
     this._productAttributeBusiness = new ProductAttributeBusiness(_df, this._unitOfWork);
 }
        public void Getratingsbyid_notfound()
        {
            List <TblRating> restaurantRatings = new List <TblRating>();

            var mockOrder = new Mock <IReviewRepository>();

            mockOrder.Setup(x => x.GetRestaurantRating(It.IsAny <int>())).Returns(restaurantRatings.AsQueryable());
            var orderFoodActionObject = new ReviewBusiness(mockOrder.Object);
            var data = orderFoodActionObject.GetRestaurantRating(1);

            Assert.AreEqual(null, data);
            Assert.IsNull(data);
        }
        public void Nodata_Test_Rating_submit()
        {
            RestaurantRating reviewdetails = new RestaurantRating();

            reviewdetails = null;

            var mockOrder = new Mock <IReviewRepository>();

            mockOrder.Setup(x => x.RestaurantRating(It.IsAny <TblRating>())).Returns(1);
            var orderFoodActionObject = new ReviewBusiness(mockOrder.Object);
            var data = orderFoodActionObject.RestaurantRating(reviewdetails);

            Assert.AreEqual(0, data);
        }
        public void Invalid_Rating_submit()
        {
            RestaurantRating reviewdetails = new RestaurantRating()
            {
                customerId    = 1,
                rating        = 5,
                RestaurantId  = 1,
                user_Comments = "Good"
            };

            var mockOrder = new Mock <IReviewRepository>();

            mockOrder.Setup(x => x.RestaurantRating(It.IsAny <TblRating>())).Returns(0);
            var orderFoodActionObject = new ReviewBusiness(mockOrder.Object);
            var data = orderFoodActionObject.RestaurantRating(reviewdetails);

            Assert.AreEqual(0, data);
        }
        public void Getratingsbyid()
        {
            List <TblRating> restaurantRatings = new List <TblRating>();

            restaurantRatings.Add(new TblRating()
            {
                TblRestaurantId = 1,
                TblCustomerId   = 1,
                Rating          = 5,
                Comments        = "Not Bad",
            });

            var mockOrder = new Mock <IReviewRepository>();

            mockOrder.Setup(x => x.GetRestaurantRating(It.IsAny <int>())).Returns(restaurantRatings.AsQueryable());
            var orderFoodActionObject = new ReviewBusiness(mockOrder.Object);
            var data = orderFoodActionObject.GetRestaurantRating(1);

            Assert.AreEqual(1, data.Count());
            Assert.IsNotNull(data);
        }
 public ReviewsController(BookStoreContext context)
 {
     _reviewBusiness = new ReviewBusiness(context);
 }