private void ApplieFilter(FilterConfiguration filterConfig) { if (!filterEnabled) { return; } // Update enables cmbFilterBoss.Enabled = filterConfig.BossEnabled; cmbFilterDuration.Enabled = filterConfig.DurationEnabled; txtFilterDuration.Enabled = filterConfig.DurationEnabled; cmbFilterHp.Enabled = filterConfig.HPEnabled; numFilterHpLeft.Enabled = filterConfig.HPEnabled; rbFilterKill.Enabled = filterConfig.SuccsessEnabled; rbFilterWipe.Enabled = filterConfig.SuccsessEnabled; //generate filter string var filter = Logic.GetFilter(filterConfig); dataTable.DefaultView.RowFilter = filter; //update shown if (string.IsNullOrWhiteSpace(filter)) { lblShowenCount.Visible = false; lblShown.Visible = false; } else { lblShowenCount.Text = dataTable.DefaultView.Count.ToString(); lblShowenCount.Visible = true; lblShown.Visible = true; } }
public void BuildFilterConfigHash_ShouldBeAffectedByEventLogName() { var original = new FilterConfiguration("filter", TimeSpan.FromHours(1), 100, "foobar", "bazqux"); var newConfig = new FilterConfiguration("filter", TimeSpan.FromHours(1), 100, "foobar", "foobar"); Assert.That(HashBuilder.BuildFilterConfigHash(original), Is.Not.EqualTo(HashBuilder.BuildFilterConfigHash(newConfig))); }
public string GetFilter(FilterConfiguration filterConfiguration) { List <string> filters = new List <string>(); if (filterConfiguration.BossEnabled) { filters.Add(BossFilter(filterConfiguration.BossName)); } if (filterConfiguration.DurationEnabled) { filters.Add(DurationFilter(filterConfiguration.DurationRelation, filterConfiguration.DurationValue)); } if (filterConfiguration.HPEnabled) { filters.Add(HpFilter(filterConfiguration.HpRelation, filterConfiguration.HpValue)); } if (filterConfiguration.DateFromEnabled) { filters.Add(DateFromFilter(filterConfiguration.DateFrom)); } if (filterConfiguration.DateFromEnabled) { filters.Add(DateToFilter(filterConfiguration.DateTo)); } if (filterConfiguration.SuccsessEnabled) { filters.Add(SuccsessFilter(filterConfiguration.Succsess)); } return(string.Join(" AND ", filters)); }
private void UpdateFilter() { if (!filterEnabled) { return; } if (!TimeSpan.TryParse(txtFilterDuration.Text, out TimeSpan duration)) { duration = new TimeSpan(1, 0, 0); } var filterConfig = new FilterConfiguration( cbFilterBoss.Checked, cmbFilterBoss.Text, cbFilterHpLeft.Checked, cmbFilterHp.Text, (double)numFilterHpLeft.Value, cbFilterDuration.Checked, cmbFilterDuration.Text, duration, cbFilterSuccsess.Checked, rbFilterKill.Checked, dtpFilterFrom.Checked, dtpFilterFrom.Value, dtpFilterTo.Checked, dtpFilterTo.Value ); ApplieFilter(filterConfig); }
public Configuration(IConfigurationDocument document, ILifetimeScope container) { Input = new InputConfiguration(document.Root.Element("Input"), container); Filter = new FilterConfiguration(document.Root.Element("Filter"), container); Output = new OutputConfiguration(document.Root.Element("Output"), container); Patterns = new PatternsConfiguration(document.Root.Element("Patterns")); }
public static FilterConfiguration InventoryFilter(this FilterConfiguration filterConfiguration) { return(filterConfiguration.RangeFacet <VariationContent, double>(x => x.TotalInStock(), (builder, values) => builder .And(x => x.TotalInStock().GreaterThan(values.Min() - 0.1)) .And(x => x.TotalInStock().LessThan(values.Max() + 0.1)))); }
public static FilterConfiguration DefaultPriceFilter(this FilterConfiguration filterConfiguration) { return(filterConfiguration.RangeFacet <VariationContent, double>(x => x.DefaultPrice(), (builder, values) => builder .And(x => x.DefaultPrice().GreaterThan(values.Min() - 0.1)) .And(x => x.DefaultPrice().LessThan(values.Max() + 0.1)))); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebAPIConfiguration.Register); FilterConfiguration.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfiguration.RegisterRoutes(RouteTable.Routes); BundleConfiguration.RegisterBundles(BundleTable.Bundles); }
private void SendReportUsingFilter(string filterString, EventSource source = EventSource.EventLog, string externalEvents = "") { var filterConfig = new FilterConfiguration(filterString, TimeSpan.FromHours(12), 100, "", "Security", eventSource: source, externalEventsXml: externalEvents); var logEventFilter = new LogEventFilter(_eventReader, filterConfig); _radonExecutor = new RadonExecutor(_currentEmailConfig, filterConfig, _mockEventIdentificationStore, logEventFilter); _radonExecutor.SendReport(_radonExecutor.GetLogEvents()); }
public WorkOrderFilterProvider(IOptions <FilterConfiguration> options, IScheduleOfRatesGateway scheduleOfRatesGateway, ICurrentUserService currentUserService ) { _options = options.Value; _scheduleOfRatesGateway = scheduleOfRatesGateway; _currentUserService = currentUserService; }
public FilterContainer( FilterBuilder <TEntity> filterBuilder, FilterConfiguration <TEntity> filterConfiguration) { FilterBuilder = filterBuilder; FilterConfiguration = filterConfiguration; FilterConfiguration.Configure(FilterBuilder); }
private void RunGetDataPageTest(int pageNumber, int pageSize, int expectedLoaded, int expectedTotal, FilterConfiguration <CustomerGridModel> filter) { var request = new DataRequest <CustomerGridModel>(pageNumber, pageSize, this.sort, filter); var dataPage = this.GetService().GetDataPage(request); dataPage.ShouldBeValid(pageNumber, pageSize, expectedLoaded, expectedTotal); }
public void ShouldReturnStringEmptyForFilterStringIfNullPassed() { var filterConfiguration = new FilterConfiguration(null, _timeLimit, _maxMessages, _remoteMachine, _eventLogName); Assert.That(filterConfiguration.FilterString, Is.EqualTo(string.Empty)); var otherConstructorFilterConfiguration = new FilterConfiguration(null, _timeLimit, _maxMessages, _remoteMachine, _eventLogName); Assert.That(otherConstructorFilterConfiguration.FilterString, Is.EqualTo(string.Empty)); }
public PesterConfiguration() { Run = new RunConfiguration(); Filter = new FilterConfiguration(); CodeCoverage = new CodeCoverageConfiguration(); TestResult = new TestResultConfiguration(); Should = new ShouldConfiguration(); Debug = new DebugConfiguration(); Output = new OutputConfiguration(); }
public ContentFilterService( FilterConfiguration filterConfiguration, CheckedOptionsService filterModelFactory, IContentRepository contentRepository, ISynchronizedObjectInstanceCache synchronizedObjectInstanceCache, SearchSortingService searchSorter, ReferenceConverter referenceConverter, IClient client) : base(filterConfiguration, filterModelFactory, contentRepository, synchronizedObjectInstanceCache, searchSorter, referenceConverter, client) { }
public void ShouldNotTrimFilterString() { const string filterString = " filterString "; var filterConfiguration = new FilterConfiguration(filterString, _timeLimit, _maxMessages, _remoteMachine, _eventLogName); Assert.That(filterConfiguration.FilterString, Is.EqualTo(filterString)); var otherConstructorFilterConfiguration = new FilterConfiguration(filterString, _timeLimit, _maxMessages, _remoteMachine, _eventLogName); Assert.That(otherConstructorFilterConfiguration.FilterString, Is.EqualTo(filterString)); }
/// <summary> /// Creates a JSON object from a <see cref="FilterConfiguration"/> object. /// </summary> /// <param name="filterConfiguration"></param> /// <returns></returns> public void FromFilterConfiguration(FilterConfiguration filterConfiguration) { DataVersion = filterConfiguration.DataVersion; ProhibitMlat = filterConfiguration.ProhibitMlat; ProhibitIcaos = filterConfiguration.ProhibitIcaos; var icaoLines = new List <string>(filterConfiguration.Icaos); icaoLines.AddRange(filterConfiguration.IcaoRanges.Select(r => r.ToString())); icaoLines.Sort((lhs, rhs) => String.Compare(lhs, rhs)); Icaos = String.Join("\n", icaoLines.ToArray()); }
public void ShouldNotUseMaxMessagesIfMaxMessagesIsLessThanOne(int maxMessages) { var filterConfiguration = new FilterConfiguration(_filterString, _timeLimit, maxMessages, _remoteMachine, _eventLogName); Assert.That(filterConfiguration.MaxMessages, Is.EqualTo(maxMessages)); Assert.That(filterConfiguration.UseMaxMessages, Is.False); var otherConstructorFilterConfiguration = new FilterConfiguration(_filterString, _timeLimit, maxMessages, _remoteMachine, _eventLogName); Assert.That(otherConstructorFilterConfiguration.MaxMessages, Is.EqualTo(maxMessages)); Assert.That(otherConstructorFilterConfiguration.UseMaxMessages, Is.False); }
public static PesterConfiguration ShallowClone(PesterConfiguration configuration) { var cfg = Default; cfg.Run = RunConfiguration.ShallowClone(configuration.Run); cfg.Filter = FilterConfiguration.ShallowClone(configuration.Filter); cfg.CodeCoverage = CodeCoverageConfiguration.ShallowClone(configuration.CodeCoverage); cfg.TestResult = TestResultConfiguration.ShallowClone(configuration.TestResult); cfg.Should = ShouldConfiguration.ShallowClone(configuration.Should); cfg.Debug = DebugConfiguration.ShallowClone(configuration.Debug); cfg.Output = OutputConfiguration.ShallowClone(configuration.Output); return(cfg); }
private static void ValidateFilterConfiguration(FilterConfiguration filterConfiguration) { if (!Enum.IsDefined(typeof(FilterScope), filterConfiguration.FilterScope)) { throw new ConfigurationErrorException( $"Filter Scope '{filterConfiguration.FilterScope}' is not supported."); } if (filterConfiguration.FilterScope == FilterScope.Group && string.IsNullOrWhiteSpace(filterConfiguration.GroupId)) { throw new ConfigurationErrorException("Group id can not be null, empty or white space for `Group` filter scope."); } }
/// <summary> /// Creates a <see cref="FilterConfiguration"/> from the object. /// </summary> /// <param name="duplicateIcaos"></param> /// <param name="invalidIcaos"></param> /// <returns></returns> public FilterConfiguration ToFilterConfiguration(List <string> duplicateIcaos, List <string> invalidIcaos) { var result = new FilterConfiguration() { DataVersion = DataVersion, ProhibitMlat = ProhibitMlat, ProhibitIcaos = ProhibitIcaos, }; ParseIcaos(Icaos, result.Icaos, result.IcaoRanges, duplicateIcaos, invalidIcaos); return(result); }
public PesterConfiguration(IDictionary configuration) { if (configuration != null) { Run = new RunConfiguration(configuration.GetIDictionaryOrNull("Run")); Filter = new FilterConfiguration(configuration.GetIDictionaryOrNull("Filter")); CodeCoverage = new CodeCoverageConfiguration(configuration.GetIDictionaryOrNull("CodeCoverage")); TestResult = new TestResultConfiguration(configuration.GetIDictionaryOrNull("TestResult")); Should = new ShouldConfiguration(configuration.GetIDictionaryOrNull("Should")); Debug = new DebugConfiguration(configuration.GetIDictionaryOrNull("Debug")); Output = new OutputConfiguration(configuration.GetIDictionaryOrNull("Output")); } }
public void ShouldTrimRemoteMachineAndEventLogName() { const string remoteMachine = " remoteMachine "; const string eventLogName = " eventLogName "; var filterConfiguration = new FilterConfiguration(_filterString, _timeLimit, _maxMessages, remoteMachine, eventLogName); Assert.That(filterConfiguration.RemoteMachine, Is.EqualTo(remoteMachine.Trim())); Assert.That(filterConfiguration.EventLogName, Is.EqualTo(eventLogName.Trim())); var otherConstructorFilterConfiguration = new FilterConfiguration(_filterString, _timeLimit, _maxMessages, remoteMachine, eventLogName); Assert.That(otherConstructorFilterConfiguration.RemoteMachine, Is.EqualTo(remoteMachine.Trim())); Assert.That(otherConstructorFilterConfiguration.EventLogName, Is.EqualTo(eventLogName.Trim())); }
public PesterConfiguration(IDictionary configuration) { if (configuration != null) { Run = new RunConfiguration(configuration.GetIDictionaryOrNull(nameof(Run))); Filter = new FilterConfiguration(configuration.GetIDictionaryOrNull(nameof(Filter))); CodeCoverage = new CodeCoverageConfiguration(configuration.GetIDictionaryOrNull(nameof(CodeCoverage))); TestResult = new TestResultConfiguration(configuration.GetIDictionaryOrNull(nameof(TestResult))); Should = new ShouldConfiguration(configuration.GetIDictionaryOrNull(nameof(Should))); Debug = new DebugConfiguration(configuration.GetIDictionaryOrNull(nameof(Debug))); Output = new OutputConfiguration(configuration.GetIDictionaryOrNull(nameof(Output))); TestDrive = new TestDriveConfiguration(configuration.GetIDictionaryOrNull(nameof(TestDrive))); TestRegistry = new TestRegistryConfiguration(configuration.GetIDictionaryOrNull(nameof(TestRegistry))); } }
public DataRequest(int currentPageNumber, int pageSize, SortConfiguration sortConfiguration, FilterConfiguration <TGridModel> filterConfiguration) { if (sortConfiguration == null) { throw new ArgumentException("sortConfiguration"); } if (filterConfiguration == null) { throw new ArgumentNullException("filterConfiguration"); } this.PageNumber = currentPageNumber; this.PageSize = pageSize; this.FilterConfiguration = filterConfiguration; this.SortConfiguration = sortConfiguration; }
public void ShouldUseExternalEventsSourceIfSelected() { var filterConfig = new FilterConfiguration("1=1", TimeSpan.FromHours(12), 100, "", Path.GetRandomFileName(), EventSource.External, "<Events><Event><Message>External event message</Message></Event></Events>"); var mockConfig = MockRepository.GenerateMock <IRadonConfigurationManager>(); mockConfig.Expect(c => c.GetEmailConfig()).Return(_currentEmailConfig); mockConfig.Expect(c => c.GetFilterConfig()).Return(filterConfig); _radonExecutor = new RadonExecutor(mockConfig); _radonExecutor.SendReport(_radonExecutor.GetLogEvents()); Assert.That(_smtpServer.ReceivedEmailCount, Is.EqualTo(1), "An email should have been sent"); var body = SmtpSenderTest.ParseMessageBody(_smtpServer.ReceivedEmail.Single().Body); Assert.That(body, Does.Contain("External event message")); }
public JobManager( IJobStore jobStore, IJobExecutor jobExecutor, ITypeFilterParser typeFilterParser, IOptions <JobConfiguration> jobConfiguration, IOptions <FilterConfiguration> filterConfiguration, ILogger <JobManager> logger) { EnsureArg.IsNotNull(jobConfiguration, nameof(jobConfiguration)); EnsureArg.IsNotNull(filterConfiguration, nameof(filterConfiguration)); _jobConfiguration = jobConfiguration.Value; _filterConfiguration = filterConfiguration.Value; _jobStore = EnsureArg.IsNotNull(jobStore, nameof(jobStore)); _jobExecutor = EnsureArg.IsNotNull(jobExecutor, nameof(jobExecutor)); _typeFilterParser = EnsureArg.IsNotNull(typeFilterParser, nameof(typeFilterParser)); _logger = EnsureArg.IsNotNull(logger, nameof(logger)); }
protected FilteringServiceBase( FilterConfiguration filterConfiguration, CheckedOptionsService filterModelFactory, IContentRepository contentRepository, ISynchronizedObjectInstanceCache synchronizedObjectInstanceCache, SearchSortingService searchSorter, ReferenceConverter referenceConverter, IClient client) { _filterConfiguration = filterConfiguration; CheckedOptionsService = filterModelFactory; ContentRepository = contentRepository; _synchronizedObjectInstanceCache = synchronizedObjectInstanceCache; SearchSortingService = searchSorter; ReferenceConverter = referenceConverter; Client = client; //FilterContentsWithGenericTypes = new Lazy<IEnumerable<FilterContentModelType>>(FilterContentsWithGenericTypesValueFactory, false); }
public static MutableSyncPoint WithFilterConfiguration(this MutableSyncPoint state, string name, FilterConfiguration filterConfiguration) { Dictionary<string, FilterConfiguration> current; try { current = (Dictionary<string, FilterConfiguration>)state.FilterConfigurations; } catch (Exception) { current = null; } current = current ?? new Dictionary<string, FilterConfiguration>(); current.Add(name, filterConfiguration); state.FilterConfigurations = current; return state; }
public void ShouldReturnCorrectValues() { var filterConfiguration = new FilterConfiguration(_filterString, _timeLimit, _maxMessages, _remoteMachine, _eventLogName); Assert.That(filterConfiguration.FilterString, Is.EqualTo(_filterString)); Assert.That(filterConfiguration.TimeLimit, Is.EqualTo(_timeLimit)); Assert.That(filterConfiguration.MaxMessages, Is.EqualTo(_maxMessages)); Assert.That(filterConfiguration.UseMaxMessages, Is.True); Assert.That(filterConfiguration.RemoteMachine, Is.EqualTo(_remoteMachine)); Assert.That(filterConfiguration.EventLogName, Is.EqualTo(_eventLogName)); var otherConstructorFilterConfiguration = new FilterConfiguration(_filterString, _timeLimit, _maxMessages, _remoteMachine, _eventLogName); Assert.That(otherConstructorFilterConfiguration.FilterString, Is.EqualTo(_filterString)); Assert.That(otherConstructorFilterConfiguration.TimeLimit, Is.EqualTo(_timeLimit)); Assert.That(otherConstructorFilterConfiguration.MaxMessages, Is.EqualTo(_maxMessages)); Assert.That(otherConstructorFilterConfiguration.UseMaxMessages, Is.True); Assert.That(otherConstructorFilterConfiguration.RemoteMachine, Is.EqualTo(_remoteMachine)); Assert.That(otherConstructorFilterConfiguration.EventLogName, Is.EqualTo(_eventLogName)); }
public IChangeFilter GetFilter(FilterConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } switch (configuration.Type) { case FilterType.None: if (m_EmptyChangeFilter == null) { m_EmptyChangeFilter = new EmptyChangeFilter(); } return m_EmptyChangeFilter; case FilterType.MicroscopeQuery: return new MicroscopeChangeFilter(configuration.CustomData); default: throw new NotImplementedException(); } }
public RadonConfigurationManager(EmailSettings email, FilterSettings filter) { _emailConfig = new EmailConfiguration(smtpServerName: email.SmtpServerName, senderAddress: email.SenderAddress, senderName: email.SenderName, portNumber: email.PortNumber, maxIdleTime: email.MaxIdleTime, useWindowsCredentials: email.UseWindowsCredentials, recipients: email.Recipients, subject: email.Subject, username: email.Username, password: email.Password, templateFile: email.TemplateFile, useSsl: email.UseSsl); _filterConfig = new FilterConfiguration(filterString: filter.FilterString, timeLimit: filter.MaxTimespan, maxMessages: filter.MaxMessages, remoteMachine: filter.RemoteMachine, eventLogName: filter.EventLogName, eventSource: filter.EventSource, externalEventsXml: filter.ExternalEventsXml); }