Beispiel #1
0
        public async Task SearchProviders_GivenNullResultsReturnedFromSearch_ReturnsStatusCode500()
        {
            // Arrange
            SearchRequestViewModel requestModel = new SearchRequestViewModel();

            IProviderSearchService searchService = CreateSearchService();

            searchService
            .PerformSearch(Arg.Any <SearchRequestViewModel>())
            .Returns((ProviderSearchResultViewModel)null);

            ProviderSearchController controller = CreateController(searchService);

            // Act
            IActionResult actionResult = await controller.SearchProviders(requestModel);

            // Asserts
            actionResult
            .Should()
            .BeOfType <StatusCodeResult>();

            StatusCodeResult statusCodeResult = actionResult as StatusCodeResult;

            statusCodeResult
            .StatusCode
            .Should()
            .Be(500);
        }
Beispiel #2
0
        public void SearchCalculationProviderResults_GivenNullRequestObject_ThrowsArgumentNullException()
        {
            // Arrange
            ProviderSearchController controller = CreateController();

            SearchRequestViewModel requestModel = null;

            // Act
            Func <Task> test = async() => await controller.SearchCalculationProviderResults(requestModel);

            // Assert
            test
            .Should()
            .ThrowExactly <ArgumentNullException>();
        }
Beispiel #3
0
        public async Task SearchProviders_GivenResultsReturnedFromSearch_ReturnsOK()
        {
            // Arrange
            SearchRequestViewModel requestModel = new SearchRequestViewModel();

            ProviderSearchResultViewModel results = new ProviderSearchResultViewModel();

            IProviderSearchService searchService = CreateSearchService();

            searchService
            .PerformSearch(Arg.Any <SearchRequestViewModel>())
            .Returns(results);

            ProviderSearchController controller = CreateController(searchService);

            // Act
            IActionResult actionResult = await controller.SearchProviders(requestModel);

            // Asserts
            actionResult
            .Should()
            .BeOfType <OkObjectResult>();
        }