public async Task<IHttpActionResult> SearchBuildingType(Search search) { var config = new SearchConfiguration<BuildingType>(search); config.SetSortingOrderIfNotExist("Id", SearchSortingOrder.Ascending); var result = await _searchService.Search(config); return Ok(new { data = result }); }
private static int LuceneSearch(LuceneSearchOptions options) { InitSearch(options); SearchConfiguration config = LoadConfiguration(); string path = Directory.GetCurrentDirectory(); Project project = config.Projects.FirstOrDefault( p => path.StartsWith(p.Path, StringComparison.InvariantCultureIgnoreCase)); if (project == null) { throw new ArgumentException($"Current path is not under any known project. Please edit '{ConfigFileName}'."); } FileFilter fileFilter = config.FileFilters.FirstOrDefault(filter => filter.Name.Equals(options.FileFilterName, StringComparison.InvariantCultureIgnoreCase)); if (fileFilter == null) { throw new ArgumentException($"File filter named '{options.FileFilterName}' does not exist. Please edit '{ConfigFileName}'."); } var fileSelector = ExtensibleFileSelectorBuilder.NewFileSelector() .WithExcludedExtensions(config.ExcludedExtensions) .WithExcludedPaths(config.ExcludedPaths) .WithRegexFilter(fileFilter.Regex) .WithExclusionRegex(fileFilter.Exclusion) .WithMaxSize(config.MaxFileSize) .Build(); LuceneContentSelector contentSelector = new LuceneContentSelector(options.Query); string localDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string indexDirectory = Path.Combine(localDirectory, "Indexes", project.Name, fileFilter.Index); var luceneSearcher = new LuceneSearcher(indexDirectory) { MaxSearchResults = Int32.MaxValue }; foreach (var result in luceneSearcher.SearchContentInFolder(path, fileSelector, contentSelector)) { _console.PrintSearchResult(result); } return(0); }
private void btnSearch_Click(object sender, RoutedEventArgs e) { SearchConfiguration filterSettings = new SearchConfiguration(); filterSettings.Title = txtTitle.Text; filterSettings.Director = txtDirector.Text; filterSettings.Genre = txtGenre.Text; filterSettings.Cast = txtCast.Text; filterSettings.Year = string.IsNullOrEmpty(txtYear.Text) ? -1 : Convert.ToInt32(txtYear.Text); filterSettings.Award = txtAward.Text; filterSettings.IsOnShow = rBtnAll.IsChecked ?? true ? SearchConfiguration.OnShow.UNKNOWN : (rBtnNowPlaying.IsChecked ?? true ? SearchConfiguration.OnShow.YES : SearchConfiguration.OnShow.NO); if (OnAdvanceFilterCallback == null) { MessageBox.Show("Unable to do advance search"); return; } OnAdvanceFilterCallback(filterSettings); }
public IEnumerable <SearchResponse.Facet> DecorateFacets( SearchConfiguration searchConfiguration, IEnumerable <API.Common.Models.Search.FacetModel> facets) { var languageMap = searchConfiguration?.LanguageMap; return (facets?.Select(f => new SearchResponse.Facet { Label = Label(f.Name, searchConfiguration, f.Name), Name = f.Name, Values = f.Values.Select(v => new SearchResponse.FacetCount { Label = Label($"{f.Name}.{v.Value}", searchConfiguration, v.Value), Value = v.Value, Count = v.Count }) })); }
public Dictionary <string, object> BuildAttributes( SearchConfiguration searchConfiguration, IndexedItem row) { var fields = searchConfiguration?.DisplayFields; if (fields?.Any() ?? false) { return(fields.ToDictionary(f => Label(f, searchConfiguration, f), f => { var value = row.Fields.ContainsKey(f) ? row.Fields[f] : null; return Label($"{f}.{value}", searchConfiguration, value) as object; }).Where(f => f.Value != null).ToDictionary(f => f.Key, f => f.Value)); } return(null); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddSingleton <ISearchEngineProvider, SearchEngineProvider>(); var searchConfiguration = new SearchConfiguration { InfoTrackSearchUrl = Configuration["SearchConfiguration:InfoTrackSearchPageUrls"], MaxSearchResult = Convert.ToInt32(Configuration["SearchConfiguration:MaxSearchResult"]) }; var searchProvider = services.BuildServiceProvider().GetService <ISearchEngineProvider>(); services.AddSingleton <ISearchService>(new SearchService(searchConfiguration, searchProvider)); services.AddControllers(); services.AddSwaggerGen(c => { var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); } ); }
public QueryBuilderTest() { var propertyMaps = new TestAzureSearchProperties(); var searchConfig = new SearchConfiguration("yyyy-MM-dd", "|"); var mapper = new PropertyMapper(propertyMaps); var dataFormats = new List <IDataFormat>() { new DateTimeFormat(searchConfig), new NullDataFormat(), new NumberFormat(), new StringDataFormat() }; var queryBuilders = new List <IQueryBuilder> { new StandardQueryBuilder(mapper, searchConfig, dataFormats), new CollectionQueryBuilder(mapper, searchConfig, dataFormats) }; _queryBuilder = new SearchQueryBuilder(queryBuilders); }
public async Task <SearchResult> Search(SearchConfiguration config, bool retryOnLimit = false, int retryAfterLimitms = 5000) { string baseUrl = GET_SEARCH_RESULT_URL; NameValueCollection qparams = new NameValueCollection() { { "type", string.Join(",", config.Scope) }, { "q", config.SearchText }, { "limit", config.Amount.ToString() }, { "offset", config.Offset.ToString() }, { "market", "from_token" } }; string url = WebHelper.GetQueryUrl(baseUrl, qparams); SearchResult result = await ExecuteWebrequest <SearchResult>(url); result.Config = config; return(result); }
public IResult <IReadOnlyCollection <Ad> > Search(SearchConfiguration searchConfiguration) { string procedureName = "sp_search_ad"; var mapper = new Mapper <DataSet, Ad> { MapCollection = MapAdCollection }; var values = new Dictionary <string, object> { { "Name", searchConfiguration.Name }, { "State", searchConfiguration.State }, { "Kind", searchConfiguration.Kind }, { "CountryId", searchConfiguration.CountryId }, { "AreaId", searchConfiguration.AreaId }, { "CityId", searchConfiguration.CityId }, { "MinPrice", searchConfiguration.MinPrice }, { "MaxPrice", searchConfiguration.MaxPrice }, { "Categories", this.MapCategoriesToValues(searchConfiguration.Categories) } }; return(base.GetAll(procedureName, mapper, values)); }
public virtual List <string> GetIndexNames() { if (SearchManager.IndexCount > 0) { Type searchManagerType = typeof(SearchManager); SearchConfiguration configuration = searchManagerType.InvokeMember("_configuration", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null) as SearchConfiguration; if (configuration != null && configuration.Indexes.Count > 0) { return(configuration.Indexes.Keys.ToList <string>()); } } return(null); }
private static int LuceneIndex(LuceneIndexOptions options) { SearchConfiguration config = LoadConfiguration(); string path = Directory.GetCurrentDirectory(); Project project = config.Projects.FirstOrDefault( p => path.StartsWith(p.Path, StringComparison.InvariantCultureIgnoreCase)); if (project == null) { throw new ArgumentException($"Current path is not under any known project. Please edit '{ConfigFilePath}'."); } FileFilter fileFilter = config.FileFilters.FirstOrDefault(filter => filter.Name.Equals(options.FileFilterName, StringComparison.InvariantCultureIgnoreCase)); if (fileFilter == null) { throw new ArgumentException($"File filter named '{options.FileFilterName}' does not exist. Please edit '{ConfigFilePath}'."); } var fileSelector = ExtensibleFileSelectorBuilder.NewFileSelector() .WithExcludedExtensions(config.ExcludedExtensions) .WithExcludedPaths(config.ExcludedPaths) .WithRegexFilter(fileFilter.Regex) .WithExclusionRegex(fileFilter.Exclusion) .WithMaxSize(config.MaxFileSize) .Build(); string indexDirectory = _configPathResolver.GetIndexDir(project.Name, fileFilter.Index); var luceneSearcher = new LuceneSearcher(indexDirectory); Console.Write($"Indexing {path}..."); luceneSearcher.IndexContentInFolder(path, fileSelector); Console.WriteLine($" Done."); return(0); }
public void SearchingNotMappedPropertyThrows(string propertyName) { SearchConfiguration.ConfigureSearch(options => { options.Entity <Customer>().Map(propertyName); }); var searchableProperties = new string[] { "CustomerID", "CompanyName", "ContactName", "ContactTitle", "Address", "City", "Region", "PostalCode", "Country", "Phone", "Fax" }; foreach (var prop in searchableProperties) { if (string.Equals(prop, propertyName, StringComparison.OrdinalIgnoreCase)) { // this should work fine Customers.Search(propertyName + ": whatever").Should().NotBeNull(); } else { // this should throw an exception beacuse it shouldn't know what to do with the property Action searchAction = () => { Customers.Search(prop + ": whatever").ToArray(); }; searchAction.Should().Throw <SearchParseException>(); } } }
public async void StartSimpleSearch() { if (string.IsNullOrEmpty(SearchText)) { return; } SetVisibilities(VisibilityConfigs.SearchInProgress); SearchProgressMessage = "Allocating search scope..."; List <string> searchScope = new List <string>(); if (SearchTracks) { searchScope.Add("track"); } if (SearchPlaylists) { searchScope.Add("playlist"); } if (SearchArtists) { searchScope.Add("artist"); } if (SearchAlbums) { searchScope.Add("album"); } if (searchScope.Count > 0) { int itemsAmount = (12 / searchScope.Count) + (int)(4D / (double)searchScope.Count); SearchConfiguration config = new SearchConfiguration() { Amount = itemsAmount, Offset = 0, Scope = searchScope, SearchText = SearchText }; if (_simpleResults != null && _simpleResults.FirstOrDefault(x => x.Config.CompareSearch(config)) is SearchResult sr) { CurrentSimpleResult = sr; } else { SearchProgressMessage = "Waiting for a response from the spotify servers..."; SearchResult result = await DataLoader.GetInstance().Search(config); _simpleResults.Add(result); CurrentSimpleResult = result; } } SetVisibilities(VisibilityConfigs.SimpleResult); NotifyPropertyChanged("SimpleTracksVisibility"); NotifyPropertyChanged("SimplePlaylistsVisibility"); NotifyPropertyChanged("SimpleArtistsVisibility"); NotifyPropertyChanged("SimpleAlbumsVisibility"); }
public SearchResultsPageController() { var config = SearchConfiguration.GetConfig(); _searchService = new SearchService(config); }
public HtmlElement(SearchConfiguration searchConfig) { SearchConfig = searchConfig; }
public HtmlElementsCollection(SearchConfiguration searchConfig) { SearchConfig = searchConfig; }
public FileSearchInclusionPredicate(SearchConfiguration searchConfig) { SearchConfig = searchConfig; }
private string Label(string field, SearchConfiguration searchConfiguration, string defaultValue) { return(searchConfiguration?.LanguageMap != null && (searchConfiguration?.LanguageMap.ContainsKey(field) ?? false) ? searchConfiguration?.LanguageMap[field] : defaultValue); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton <IConfiguration>(Configuration); services.AddOptions(); services.Configure <IdentityProviderConfiguration>(options => { Configuration.GetSection("azuread").Bind(options); IdentityProviderConfiguration.Validate(options); }); services.Configure <SearchConfiguration>(options => { Configuration.GetSection("search").Bind(options); SearchConfiguration.Validate(options); }); services.Configure <CosmosConfiguration>(options => { Configuration.GetSection("documents").Bind(options); CosmosConfiguration.Validate(options); }); services.Configure <StorageConfiguration>((config) => { Configuration.GetSection("storage").Bind(config); StorageConfiguration.Validate(config); }); services.Configure <BatchConfiguration>((config) => { Configuration.GetSection("batch").Bind(config); BatchConfiguration.Validate(config); }); services.Configure <AppInsightsConfiguration>((config) => { Configuration.GetSection("applicationinsights").Bind(config); AppInsightsConfiguration.Validate(config); }); var armTemplatesMap = new ArmTemplatesMap(); services.AddSingleton(armTemplatesMap); var staticAssetsMap = new StaticAssetsMap(); services.AddSingleton(staticAssetsMap); services.AddMemoryCache(); //services // .AddAuthentication(options => // { // options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; // options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; // }) // .AddJwtBearer(options => // { // options.Audience = Configuration["azureADConfig:clientId"]; // options.Authority = Configuration["azureADConfig:authority"]; // options.Events = new JwtBearerEvents // { // OnMessageReceived = FetchAuthTokenFromCookie, // OnTokenValidated = async context => // { // var principal = context.Principal; // var ODREmailList = Configuration["ODRAdminList"].Split(";"); // } // }; // }); //services // .AddAuthentication(options => // { // options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; // }) // .AddJwtBearer(options => // { // options.Audience = Configuration["azureADConfig:clientId"]; // options.Authority = Configuration["azureADConfig:authority"]; // options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters // { // ValidAudience = Configuration["azureADConfig:clientId"], // ValidIssuer = $"https://login.microsoftonline.com/" + Configuration["azureADConfig:tenantId"] + "/v2.0" // }; // options.Events = new JwtBearerEvents // { // OnMessageReceived = FetchAuthTokenFromCookie, // //OnTokenValidated = async context => // //{ // // var principal = context.Principal; // // if (Configuration.GetChildren().Any(item => item.Key == "ODRAdminList") && principal.Claims.Any(c => c.Type == "preferred_username")) // // { // // var ODRAdminsList = Configuration["ODRAdminList"].Split(";").ToList(); // // var testSubject = principal.Claims.FirstOrDefault(c => c.Type == "preferred_username").Value; // // if (ODRAdminsList.Contains(testSubject)) // // { // // var claims = new List<Claim> // // { // // new Claim(ClaimTypes.Role, "ODRAdmin") // // }; // // var appIdentity = new ClaimsIdentity(claims); // // principal.AddIdentity(appIdentity); // // } // // } // //} // }; // }); services .AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { var tenantName = Configuration["AzureAD:Tenant"].Split('.').First(); var policyName = Configuration["AzureAD:Policy"]; var audience = Configuration["AzureAD:Audience"]; options.MetadataAddress = $"https://{tenantName}.b2clogin.com/{tenantName}.onmicrosoft.com/{policyName}/v2.0/.well-known/openid-configuration"; options.Audience = audience; options.Events = new JwtBearerEvents { OnMessageReceived = FetchAuthTokenFromCookie, OnAuthenticationFailed = context => { var ctx = context; return(Task.FromResult(0)); }, }; }); services.AddMvc(); services .AddAuthorization(options => { options.AddPolicy(PolicyNames.MustBeInAdminGroup, policy => { var authorizedAdminUsers = Configuration["AuthorizedAdminUsers"]; policy.Requirements.Add(new AzureActiveDirectoryGroupRequirement(authorizedAdminUsers)); }); }); services.AddSingleton <IAuthorizationHandler, AzureActiveDirectoryGroupHandler>(); //if (CurrentEnvironment.IsDevelopment()) //{ // services.AddSingleton<IAuthorizationHandler, DevelopmentOnlyNoAuthDirectoryGroupHandler>(); //} //else //{ // services.AddSingleton<IAuthorizationHandler, AzureActiveDirectoryGroupHandler>(); //} services.AddScoped <DatasetSearchService>(); services.AddScoped <UserDataSearchService>(); services.AddScoped <DatasetStorageService>(); services.AddScoped <AppInsightsService>(); services.AddScoped <UserDataStorageService>(); services.AddScoped <LicenseStorageService>(); services.AddScoped <SasTokenService>(); services.AddScoped <ValidationService>(); services.AddScoped <ApplicationJobs>(); // In production, the Angular files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ui-app"; }); // Add Swagger generator if (Configuration.GetValue <bool>("Application:EnableSwagger")) { services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info { Title = "MSR ODR Admin API", Version = "v1" }); }); } }
public SearchService(SearchConfiguration searchConfiguration, ISearchEngineProvider provider) { _searchConfiguration = searchConfiguration; _provider = provider; }
public CheckElasticsearchAliases(IElasticsearchClientFactory elasticsearchClientFactory, IConfigurationService configurationService) { _elasticsearchConfiguration = configurationService.Get <SearchConfiguration>(); _elasticsearchClientFactory = elasticsearchClientFactory; }
public DynamicTextField(SearchConfiguration searchConfig) : base(searchConfig) { }
public ChipsList(SearchConfiguration config) : base(config) { }
public RadioGroup(SearchConfiguration config) : base(config) { }
/// <summary> /// Adds the runtime services to the instance. /// </summary> /// <param name="services">The services.</param> public void ConfigureServices(IServiceCollection services) { services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton <IConfiguration>(this.Configuration); services.AddSingleton <ITelemetryInitializer, TelemetryUserAndSessionContext>(); services.AddApplicationInsightsTelemetry(); services.AddOptions(); services.Configure <IdentityProviderConfiguration>(options => { Configuration.GetSection("azuread").Bind(options); IdentityProviderConfiguration.Validate(options); }); services.Configure <SearchConfiguration>(options => { Configuration.GetSection("search").Bind(options); SearchConfiguration.Validate(options); }); services.Configure <CosmosConfiguration>(options => { Configuration.GetSection("documents").Bind(options); CosmosConfiguration.Validate(options); }); services.Configure <StorageConfiguration>((config) => { Configuration.GetSection("storage").Bind(config); StorageConfiguration.Validate(config); }); services.Configure <WebServerConfiguration>(options => { Configuration.GetSection("webserver").Bind(options); WebServerConfiguration.Validate(options); }); services.Configure <BatchConfiguration>((config) => { Configuration.GetSection("batch").Bind(config); BatchConfiguration.Validate(config); }); var armTemplatesMap = Configuration.GetSection("armTemplates").Get <ArmTemplatesMap>(); services.AddSingleton(armTemplatesMap); var staticAssetsMap = Configuration.GetSection("staticAssets").Get <StaticAssetsMap>(); services.AddSingleton(staticAssetsMap); services.AddMemoryCache(); services.AddCors(options => { options.AddPolicy("DefaultPolicy", builder => builder.AllowAnyOrigin() .WithMethods("GET", "POST", "PUT", "DELETE") .AllowAnyHeader() .AllowCredentials()); }); services.AddResponseCompression(opt => { opt.EnableForHttps = true; }); services.AddMvc() .AddMvcOptions(options => { options.Filters.Add(new TelemetryExceptionFilter(new LoggerFactory())); }) .AddJsonOptions(options => { options.SerializerSettings.Converters.Add(new StringEnumConverter { CamelCaseText = true }); }); services.AddScoped <DatasetSearchService>(); services.AddScoped <FileSearchService>(); services.AddScoped <DatasetStorageService>(); services.AddScoped <DatasetOwnersService>(); services.AddScoped <DatasetEditStorageService>(); services.AddScoped <UserDataStorageService>(); services.AddScoped <FileStorageService>(); services.AddScoped <LicenseStorageService>(); services.AddScoped <ValidationService>(); services.AddScoped <SasTokenService>(); services.AddScoped <GenerateFilePreview>(); services.AddScoped <CurrentUserService>(); services.AddScoped <ApplicationJobs>(); if (this.UseSwagger) { services.UseSwagger(this.Configuration); } services .AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { var tenantName = Configuration["AzureAD:Tenant"].Split('.').First(); var policyName = Configuration["AzureAD:Policy"]; var audience = Configuration["AzureAD:Audience"]; options.MetadataAddress = $"https://{tenantName}.b2clogin.com/{tenantName}.onmicrosoft.com/{policyName}/v2.0/.well-known/openid-configuration"; options.Audience = audience; options.Events = new JwtBearerEvents { OnAuthenticationFailed = context => { var ctx = context; return(Task.FromResult(0)); }, }; }); }
public void PassesValidation() { var config = BuildSearchConfiguration(); SearchConfiguration.Validate(config); }
public LogicalOperatorTest() { // Just use defaults for search SearchConfiguration.ConfigureSearch(); }
public virtual ISearcherBuilder <T> GetSearcherBuilder <T>(SearchConfiguration <T> configuration) where T : SearchResultItem { return(new SearcherBuilder <T>(configuration)); }
public async Task Succeeds() { var requestModel = new TestRequest(); var resultModel = new TestResult(); var modelProvider = new Mock <IRequestModelProvider>(); modelProvider.Setup(x => x.GetCurrentRequestModel()).Returns(requestModel); var transferValuesConfiguration = new Mock <ITransferValuesConfiguration>(); transferValuesConfiguration.SetupGet(x => x.ActionName).Returns("Index"); transferValuesConfiguration.SetupGet(x => x.Enabled).Returns(true); var searchConfiguration = new SearchConfiguration(typeof(TestRequest).GetProperty(nameof(TestRequest.Text))) { ResultProperty = typeof(TestResult).GetProperty(nameof(TestResult.Text)) }; var searchConfigurations = new List <ISearchConfiguration> { searchConfiguration }; var propertyConfiguration = new PropertyConfiguration(RequestType.GetProperty("Foo"), ResultType.GetProperty("Foo"), "Bar", false); var propertyConfigurations = new List <IPropertyConfiguration>() { propertyConfiguration }; var pageConfiguration = new PageConfiguration(RequestType.GetProperty("Page"), ResultType.GetProperty("Page"), 1); var rowsConfiguration = new RowsConfiguration(RequestType.GetProperty("Rows"), ResultType.GetProperty("Rows"), 200); var sortColumnConfiguration = new SortColumnConfiguration(RequestType.GetProperty("Ordx"), ResultType.GetProperty("Ordx"), ""); var sortDirectionConfiguration = new SortDirectionConfiguration(RequestType.GetProperty("Ordd"), ResultType.GetProperty("Ordd"), Direction.Ascending); var listConfiguration = new Mock <IListConfiguration>(); listConfiguration.SetupGet(x => x.ResultType).Returns(typeof(TestResult)); listConfiguration.SetupGet(x => x.TransferValuesConfiguration).Returns(transferValuesConfiguration.Object); listConfiguration.SetupGet(x => x.SearchConfigurations).Returns(searchConfigurations); listConfiguration.SetupGet(x => x.PropertyConfigurations).Returns(propertyConfigurations); listConfiguration.SetupGet(x => x.PageConfiguration).Returns(pageConfiguration); listConfiguration.SetupGet(x => x.RowsConfiguration).Returns(rowsConfiguration); listConfiguration.SetupGet(x => x.SortColumnConfiguration).Returns(sortColumnConfiguration); listConfiguration.SetupGet(x => x.SortDirectionConfiguration).Returns(sortDirectionConfiguration); var configurationProvider = new Mock <IListConfigurationProvider>(); configurationProvider.Setup(x => x.GetConfiguration(It.IsAny <Type>())).Returns(listConfiguration.Object); var actionFilter = new TransferValuesActionFilter(modelProvider.Object, configurationProvider.Object); var httpContext = new Mock <HttpContext>(); var actionContext = new ActionContext(httpContext.Object, new RouteData(), new ControllerActionDescriptor() { ActionName = "Index", RouteValues = new Dictionary <string, string>() { ["action"] = "Index" } }); var controller = new Mock <Controller>(); var httpRequest = new Mock <HttpRequest>(); var actionExecutionDelegate = new Mock <ActionExecutionDelegate>(); var result = new JsonResult(resultModel); var actionExecutedContext = new ActionExecutedContext(actionContext, new List <IFilterMetadata>(), controller.Object) { Result = result }; actionExecutionDelegate.Setup(x => x.Invoke()).ReturnsAsync(() => actionExecutedContext); httpContext.SetupGet(x => x.Request).Returns(httpRequest.Object); var actionExecutingContext = new ActionExecutingContext(actionContext, new List <IFilterMetadata>(), new RouteValueDictionary(), controller.Object); await actionFilter.OnActionExecutionAsync(actionExecutingContext, actionExecutionDelegate.Object); resultModel.Text.Should().BeOfType <TextSearch>(); }
public Checkbox(SearchConfiguration config) : base(config) { }
public HtmlButton(SearchConfiguration searchConfig) : base(searchConfig) { }