public void ReturnBadRequestMessageWhenPasswordIsInvalid() { // Arrange // Act var result = sutInvalidPassword.RequestToken(tokenRequest); var message = ((BadRequestObjectResult)result.Result).Value; var statusCode = ((BadRequestObjectResult)result.Result).StatusCode; // Assert Assert.That(result, Is.TypeOf <Task <ActionResult> >()); Assert.That(message, Is.EqualTo("Status Code 400: Password Invalid")); Assert.That(statusCode, Is.EqualTo(400)); }
public void AuthenticateUsers() { // Arrange // Act var result = sut.RequestToken(tokenRequest); var returnedValue = ((OkObjectResult)result.Result).Value; var message = ((AuthenticatedUserResult)((OkObjectResult)result.Result).Value).Message; var statusCode = ((OkObjectResult)result.Result).StatusCode; // Assert Assert.That(result, Is.TypeOf <Task <ActionResult> >()); Assert.That(returnedValue, Is.TypeOf <AuthenticatedUserResult>()); Assert.That(message, Is.EqualTo("Status Code 200: User Found")); Assert.That(statusCode, Is.EqualTo(200)); }