public void GetAll_ByDefault_ReturnsIEnumerableRatingDto() { _ratingRepositoryMock.Setup(e => e.GetAll()) .Returns(new List <Rating>()); var result = _ratingService.GetAll(); Assert.IsAssignableFrom <IEnumerable <RatingDto> >(result); }
public ActionResult Index() { //get list of platforms from database var platforms = PlatformService.GetAll(); var ratings = RatingService.GetAll(); var ratingsSelectList = new SelectList(ratings, "Id", "Name"); var platformSelectList = new SelectList(platforms, "Id", "Name"); var vm = new NewVideoGameViewModel { RatingOptions = ratingsSelectList, PlatformOptions = platformSelectList }; return(View(vm)); }
public async Task rating_service_get_all_should_succeed() { var ratings = new List <Rating>() { new Rating { UserId = 1, GameId = 1, Value = 2, CreatedDate = DateTime.UtcNow, UpdatedDate = DateTime.UtcNow } }; _ratingRepositoryMock.Setup(x => x.GetAll(It.IsAny <Expression <Func <Rating, object> > >(), It.IsAny <Expression <Func <Rating, object> > >())).Returns(ratings); _ratingService.GetAll(); _ratingRepositoryMock.Verify(x => x.GetAll(It.IsAny <Expression <Func <Rating, object> > >(), It.IsAny <Expression <Func <Rating, object> > >()), Times.Once); _autoMapperMock.Verify(x => x.Map <IList <RateListViewModel> >(ratings), Times.Once); }
public List <Rating> GetAll() { return(_ratingService.GetAll()); }