public void Then_Search_Should_Throw_Exception()
        {
            Action action = () => _provider.SearchOpportunitiesByPostcodeProximityAsync(new OpportunityProximitySearchParametersDto {
                Postcode = "CV1 2WT", SearchRadius = 5, SelectedRouteId = 7, Latitude = "", Longitude = ""
            }).GetAwaiter().GetResult();

            action.Should().ThrowExactly <InvalidOperationException>();
        }
コード例 #2
0
        public When_SqlSearchProvider_Search_Opportunities_Is_Called_With_Valid_Parameters_With_One_Venue_Enabled()
        {
            var logger = Substitute.For <ILogger <Data.SearchProviders.SqlSearchProvider> >();

            _dbContext = new TestConfiguration().GetDbContext();

            _providerVenues = new ValidProviderVenueSearchBuilder().BuildWithOneVenueEnabled();
            _dbContext.AddRange(_providerVenues);
            _dbContext.SaveChanges();

            var provider = new Data.SearchProviders.SqlSearchProvider(logger, _dbContext);

            _results = provider.SearchOpportunitiesByPostcodeProximityAsync(new OpportunityProximitySearchParametersDto {
                Postcode = "CV1 2WT", SearchRadius = 5, SelectedRouteId = 7, Latitude = "52.400997", Longitude = "-1.508122"
            }).GetAwaiter().GetResult();
        }
        public When_SqlSearchProvider_Search_Opportunities_Is_Called_With_Valid_Postcode_But_Provider_Is_Disabled_For_Selected_Route()
        {
            var logger = Substitute.For <ILogger <Data.SearchProviders.SqlSearchProvider> >();

            _dbContext = new TestConfiguration().GetDbContext();

            _providerVenue = new ValidProviderVenueSearchBuilder().BuildWithOneDisabledVenue();
            _dbContext.Add(_providerVenue);
            _dbContext.SaveChanges();

            var provider = new Data.SearchProviders.SqlSearchProvider(logger, _dbContext);

            _results = provider.SearchOpportunitiesByPostcodeProximityAsync(new OpportunityProximitySearchParametersDto {
                Postcode = "MK1 1AD", SelectedRouteId = 7, Latitude = "52.010709", Longitude = "-0.736412"
            }).GetAwaiter().GetResult();
        }