public async Task GetBadRequestIfGetCustomerCallDoesNotContainValidGuidAsCustomerIdAsync() { // Arrange ICustomerManagementService customerManagementService = A.Fake <ICustomerManagementService>(); ILogger logger = A.Fake <ILogger>(); var sut = new CustomerManagementFunctions(customerManagementService); var httpContext = new DefaultHttpContext(); var httpRequest = new DefaultHttpRequest(httpContext); // Act IActionResult actual = await sut.GetCustomerAsync(httpRequest, "123434", logger); // Assert Assert.Equal(HttpStatusCode.BadRequest, (HttpStatusCode)((ObjectResult)actual).StatusCode); }
public async Task BeAbleToGetCustomerAsync() { // Arrange ICustomerManagementService customerManagementService = A.Fake <ICustomerManagementService>(); ILogger logger = A.Fake <ILogger>(); var sut = new CustomerManagementFunctions(customerManagementService); var httpContext = new DefaultHttpContext(); var httpRequest = new DefaultHttpRequest(httpContext); A.CallTo(() => customerManagementService.GetCustomerInformationAsync(TestHelper.CustomerId)) .Returns(TestHelper.GetCustomerInfoWithTestHelperDefaultValues()); // Act IActionResult actual = await sut.GetCustomerAsync(httpRequest, TestHelper.CustomerId.ToString(), logger); // Assert Assert.Equal(HttpStatusCode.OK, (HttpStatusCode)((ObjectResult)actual).StatusCode); Assert.Equal(TestHelper.GetCustomerInfoWithTestHelperDefaultValues().CustomerId, ((CustomerInfo)((ObjectResult)actual).Value).CustomerId); Assert.Equal(TestHelper.GetCustomerInfoWithTestHelperDefaultValues().TenantId, ((CustomerInfo)((ObjectResult)actual).Value).TenantId); }