public async Task GetReturnsError(HttpStatusCode statusCode, string message, int expectedCode, string expectedMessage) { var pokemonService = new Mock <IPokemonService>(); var errorResult = new ErrorResultContent(statusCode, message); pokemonService.Setup(c => c.GetPokemon(_knownName)) .Returns(Task.FromResult(new Result <ShakespearePokemon>(errorResult))); var controller = new PokemonController(pokemonService.Object); var result = await controller.Get(_knownName); var contentResult = result.Result as ContentResult; Assert.AreEqual(expectedCode, contentResult.StatusCode); Assert.AreEqual(expectedMessage, contentResult.Content); }
public Error(ErrorResultContent errorResult) : base(errorResult) { }
protected Result(ErrorResultContent errorResult) { ErrorResult = errorResult; }
protected Result() { ErrorResult = null; }