public void IssueErrorAndMessageShouldSuccessfullyAddUserToAppFail() { // Arrange // Act var result = sutFailure.AddUser(1, 3, baseRequest); var message = ((BaseResult)((NotFoundObjectResult)result.Result).Value).Message; var statusCode = ((NotFoundObjectResult)result.Result).StatusCode; // Assert Assert.That(result.Result, Is.InstanceOf <ActionResult>()); Assert.That(message, Is.EqualTo("Status Code 404: User not Added to App")); Assert.That(statusCode, Is.EqualTo(404)); }
public void ReturnBadRequestResponseShouldLicenseValidationFail() { // Arrange var appId = 1; // Act var resultOne = sutInvalid.GetApp(appId, baseRequest); var messageOne = ((BadRequestObjectResult)resultOne.Result.Result).Value; var statusCodeOne = ((BadRequestObjectResult)resultOne.Result.Result).StatusCode; var resultTwo = sutInvalid.GetApps(baseRequest, true); var messageTwo = ((BadRequestObjectResult)resultTwo.Result.Result).Value; var statusCodeTwo = ((BadRequestObjectResult)resultTwo.Result.Result).StatusCode; var resultThree = sutInvalid.UpdateApp(1, appRequest); var messageThree = ((BadRequestObjectResult)resultThree.Result).Value; var statusCodeThree = ((BadRequestObjectResult)resultThree.Result).StatusCode; var resultFour = sutInvalid.GetAppUsers(1, baseRequest, true); var messageFour = ((BadRequestObjectResult)resultFour.Result.Result).Value; var statusCodeFour = ((BadRequestObjectResult)resultFour.Result.Result).StatusCode; var resultFive = sutInvalid.AddUser(1, 3, baseRequest); var messageFive = ((BadRequestObjectResult)resultFive.Result).Value; var statusCodeFive = ((BadRequestObjectResult)resultFour.Result.Result).StatusCode; var resultSix = sutInvalid.RemoveUser(1, 3, baseRequest); var messageSix = ((BadRequestObjectResult)resultSix.Result).Value; var statusCodeSix = ((BadRequestObjectResult)resultFour.Result.Result).StatusCode; // Assert Assert.That(resultOne.Result, Is.InstanceOf <ActionResult <App> >()); Assert.That(messageOne, Is.EqualTo("Status Code 400: Invalid Request on this License")); Assert.That(statusCodeOne, Is.EqualTo(400)); Assert.That(resultTwo.Result, Is.InstanceOf <ActionResult <IEnumerable <App> > >()); Assert.That(messageTwo, Is.EqualTo("Status Code 400: Invalid Request on this License")); Assert.That(statusCodeTwo, Is.EqualTo(400)); Assert.That(resultThree.Result, Is.InstanceOf <ActionResult>()); Assert.That(messageThree, Is.EqualTo("Status Code 400: Invalid Request on this License")); Assert.That(statusCodeThree, Is.EqualTo(400)); Assert.That(resultFour.Result, Is.InstanceOf <ActionResult <IEnumerable <User> > >()); Assert.That(messageFour, Is.EqualTo("Status Code 400: Invalid Request on this License")); Assert.That(statusCodeFour, Is.EqualTo(400)); Assert.That(resultFive.Result, Is.InstanceOf <ActionResult>()); Assert.That(messageFive, Is.EqualTo("Status Code 400: Invalid Request on this License")); Assert.That(statusCodeFive, Is.EqualTo(400)); Assert.That(resultSix.Result, Is.InstanceOf <ActionResult>()); Assert.That(messageSix, Is.EqualTo("Status Code 400: Invalid Request on this License")); Assert.That(statusCodeSix, Is.EqualTo(400)); }
public void SuccessfullyAddUserToApp() { // Arrange // Act var result = sutSuccess.AddUser(1, 3, baseRequest); var message = ((BaseResult)((OkObjectResult)result.Result).Value).Message; var statusCode = ((OkObjectResult)result.Result).StatusCode; // Assert Assert.That(result.Result, Is.InstanceOf <ActionResult>()); Assert.That(message, Is.EqualTo("Status Code 200: User Added to App")); Assert.That(statusCode, Is.EqualTo(200)); }