public void GetReviews_UnitOfWorkReturnsReviews_UutReturnsCorrectType()
        {
            mockUnitOfWork.ReviewRepository
            .Find(Arg.Any <Expression <Func <Review, bool> > >())
            .Returns(defaultList);

            var result = uut.GetReviews(defaultReviewDto.BarName);

            Assert.That(result, Is.TypeOf <OkObjectResult>());
        }
Exemple #2
0
        private void FillReviewGrid()
        {
            panelList.Visible = true;
            panelEdit.Visible = false;

            // Get the status filter
            ReviewController.StatusFilter filter = ReviewController.StatusFilter.All;
            if (cmbStatus.SelectedValue == "0")
            {
                filter = ReviewController.StatusFilter.NotApproved;
            }
            else if (cmbStatus.SelectedValue == "1")
            {
                filter = ReviewController.StatusFilter.Approved;
            }

            // Get the review list...
            List <ReviewInfo> reviewList;
            ReviewController  controller = new ReviewController();

            if (cmbProduct.SelectedValue != Null.NullInteger.ToString())
            {
                // Select by product
                reviewList = controller.GetReviewsByProduct(PortalId, int.Parse(cmbProduct.SelectedValue), filter);
            }
            else if (cmbCategory.SelectedValue != Null.NullInteger.ToString())
            {
                // Select by category
                reviewList = controller.GetReviewsByCategory(PortalId, int.Parse(cmbCategory.SelectedValue), filter);
            }
            else
            {
                // Select all reviews
                reviewList = controller.GetReviews(PortalId, filter);
            }

            // Has page index been initialized?
            if (_nav.PageIndex == Null.NullInteger)
            {
                _nav.PageIndex = 0;
            }

            // Update the grid
            if (reviewList.Count <= grdReviews.PageSize)
            {
                grdReviews.AllowPaging = false;
            }
            grdReviews.DataSource       = reviewList;
            grdReviews.CurrentPageIndex = _nav.PageIndex;
            grdReviews.DataBind();
        }
Exemple #3
0
        public async Task GetReviews_Will_ReturnMappedReviews()
        {
            const int productId         = 29;
            var       productReviews    = _fixture.CreateMany <ProductReview>(10);
            var       productReviewDtos = _fixture.CreateMany <ProductReviewDto>(10);

            _reviewManagerMock
            .Setup(x => x.ProductReviews(productId))
            .ReturnsAsync(productReviews);
            _mapperMock
            .Setup(x => x.Map <IEnumerable <ProductReviewDto> >(productReviews))
            .Returns(productReviewDtos);

            var reviews = await _controller.GetReviews(productId);

            _reviewManagerMock.Verify(x => x.ProductReviews(productId), Times.Once);
            _mapperMock.Verify(x => x.Map <IEnumerable <ProductReviewDto> >(productReviews));

            Assert.Same(productReviewDtos, reviews);
        }
Exemple #4
0
        public void GetReview_CheckIfSuccessfullyRetrieved()
        {
            // Arrange
            var controller = new ReviewController(_dbContext);

            UserTempStorage.gameID = 1;


            // Act
            IEnumerable <Review> returnReviewRetrieved = controller.GetReviews();
            var result = returnReviewRetrieved;

            int?gameID = 0;

            foreach (var review in result)
            {
                gameID = review.GameId;
            }


            // Assert
            Assert.AreEqual(gameID, 1);
        }
 public void returnReviews()
 {
     mirr.Setup(s => s.GetReviews()).Returns(dadc.reviews);
     Assert.Equal(dadc.reviews, rc.GetReviews());
 }