public async Task PalindromeService_ValidPalindromeRequest_ReturnsResponseWithNewPalindromeId() { var response = await _palindromeService.PostAsync(new Request() { Value = "Was it a cat I saw?" }); Assert.IsTrue(response.IsValid); Assert.AreEqual(99, response?.Palindromes?.FirstOrDefault()?.Id); }
public async Task <IActionResult> Post([FromBody] Request request) { try { var response = await _palindromeService.PostAsync(request); if (response.IsValid) { return(Accepted()); } } catch (System.Exception ex) { // todo: exception logging & handling } return(new BadRequestResult()); }