public async Task GetRecords_Return_BadRequest__With_Invalid_Filter_Type(string type) { var mockLogger = GetMockLogger <LoansController>(); var mockReportingService = new Mock <IReportingService>(); var controller = new LoansController(mockLogger, mockReportingService.Object); var result = await controller.GetRecords(type) as BadRequestResult; Assert.Equal((int)HttpStatusCode.BadRequest, result.StatusCode); }
public async Task GetRecords_Return_OK_With_Valid_Filter_Type(string type) { var mockLogger = GetMockLogger <LoansController>(); var mockReportingService = new Mock <IReportingService>(); mockReportingService.Setup(x => x.GetLoansReport(type)).ReturnsAsync(loansData); var controller = new LoansController(mockLogger, mockReportingService.Object); var result = await controller.GetRecords(type) as OkObjectResult; Assert.NotNull(result.Value); Assert.Equal((int)HttpStatusCode.OK, result.StatusCode); }