public void IssueErrorAndMessageShouldGetGameByUserIdFail() { // Arrange var userId = 1; // Act var result = sutFailure.GetMyGame(userId, getMyGameRequest, true); var message = ((GameResult)((NotFoundObjectResult)result.Result.Result).Value).Message; var statusCode = ((NotFoundObjectResult)result.Result.Result).StatusCode; // Assert Assert.That(result.Result, Is.InstanceOf <ActionResult <Game> >()); Assert.That(message, Is.EqualTo("Status Code 404: Game not Found")); Assert.That(statusCode, Is.EqualTo(404)); }
public void SuccessfullyGetGameByUserId() { // Arrange var userId = 1; // Act var result = sutSuccess.GetMyGame(userId, getMyGameRequest, true); var message = ((GameResult)((OkObjectResult)result.Result.Result).Value).Message; var statusCode = ((OkObjectResult)result.Result.Result).StatusCode; var game = ((GameResult)((OkObjectResult)result.Result.Result).Value).Game; // Assert Assert.That(result.Result, Is.InstanceOf <ActionResult <Game> >()); Assert.That(message, Is.EqualTo("Status Code 200: Game Found")); Assert.That(statusCode, Is.EqualTo(200)); Assert.That(game, Is.InstanceOf <Game>()); }