public void TestPayloadIsNull() { var response = controller.Confirmations(Guid.NewGuid().ToString(), null); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.AreEqual(((System.Net.Http.ObjectContent)response.Content).Value, Messages.ConfirmationDataPassedIsNullOrCouldNotBeParsed); }
public void TestConfirmationServiceReturnsNotOkResponse() { var guid = Guid.NewGuid(); var requestBody = new IntegrationLayerResponse { CorrelationId = guid.ToString(), SourceSystemEntityID = "entity id", SourceSystemStatusCode = HttpStatusCode.OK }; var confirmationService = A.Fake <IConfirmationService>(); A.CallTo(() => confirmationService.ProcessResponse(guid, requestBody)).Returns(new ConfirmationResponse() { StatusCode = HttpStatusCode.BadRequest, Message = "message" }); controller = new ConfirmationController(confirmationService); controller.Request = new System.Net.Http.HttpRequestMessage(); controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); var response = controller.Confirmations(guid.ToString(), requestBody); Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); Assert.AreEqual("message", ((System.Net.Http.ObjectContent)response.Content).Value); }