public IActionResult Post([FromBody] RatingAddViewModel ratingAddViewModel) { ratingAddViewModel.UserId = Convert.ToInt32(User.Identity.Name); _ratingService.Add(ratingAddViewModel); return(StatusCode(StatusCodes.Status200OK)); }
public async Task rating_service_add_should_succeed() { var ratingAddViewModel = new RatingAddViewModel { UserId = 1, GameId = 1, Value = 1 }; _ratingService.Add(ratingAddViewModel); _autoMapperMock.Verify(x => x.Map <CreateRatingCommand>(ratingAddViewModel), Times.Once); _mediatorBusMock.Verify(x => x.SendCommand(It.IsAny <CreateRatingCommand>()), Times.Once); }
public void Add(RatingAddViewModel ratingAddViewModel) { var createRatingCommand = _mapper.Map <CreateRatingCommand>(ratingAddViewModel); _bus.SendCommand(createRatingCommand); }