public async Task GetEffect_CallEffectService() { var expectedEffectResponse = new EffectResponse(); var effect = new Effect { Id = 42 }; _effectService.GetEffectAsync(42) .Returns(effect); _mapper.Map <EffectResponse>(effect) .Returns(expectedEffectResponse); var result = await _effectsController.GetEffectAsync(42); result.Value.Should().Be(expectedEffectResponse); }
public async Task <ActionResult <EffectResponse> > GetEffectAsync( [FromRoute] int effectId ) { try { var effect = await _effectService.GetEffectAsync(effectId); var effectResponse = _mapper.Map <EffectResponse>(effect); return(effectResponse); } catch (EffectNotFoundException ex) { throw new HttpErrorException(StatusCodes.Status404NotFound, ex); } }