private static void CreateNormalAndSearchFolderList(UserContext userContext, MailboxSession mailboxSession, bool filterGeekFolder, bool includeSearchFolder, out FolderList deepHierarchyFolderList, out FolderList searchFolderList, out Dictionary <Guid, StoreObjectId> searchFolderGuidToIdMapping) { QueryFilter queryFilter = null; if (filterGeekFolder) { queryFilter = new NotFilter(Utilities.GetObjectClassTypeFilter(true, new string[] { "IPF.Appointment", "IPF.Contact", "IPF.Task", "IPF.Journal", userContext.IsFeatureEnabled(Feature.StickyNotes) ? null : "IPF.StickyNote" })); } FolderList parentFolderList = new FolderList(userContext, mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Configuration), queryFilter, 10000, false, true, true, null, FolderList.FolderTreeQueryProperties); deepHierarchyFolderList = new FolderList(userContext, mailboxSession, userContext.GetRootFolderId(mailboxSession), 10000, false, true, true, parentFolderList); searchFolderList = null; searchFolderGuidToIdMapping = null; if (includeSearchFolder && userContext.IsFeatureEnabled(Feature.SearchFolders)) { searchFolderList = new FolderList(userContext, mailboxSession, userContext.GetSearchFoldersId(mailboxSession).StoreObjectId, 10000, false, false, false, parentFolderList); searchFolderGuidToIdMapping = new Dictionary <Guid, StoreObjectId>(searchFolderList.Count); foreach (StoreObjectId storeObjectId in searchFolderList.GetFolderIds()) { object folderProperty = searchFolderList.GetFolderProperty(storeObjectId, FolderSchema.OutlookSearchFolderClsId); if (folderProperty != null && folderProperty is Guid) { searchFolderGuidToIdMapping[(Guid)folderProperty] = storeObjectId; } } } }
public void Constructor_WithFilter_FieldIsSet() { var filter = new NotFilter(new SelectorFilter("test_dimension", "test_value")); Assert.That(filter.Field, Is.Not.Null); Assert.That(filter.Field, Is.TypeOf <SelectorFilter>()); }
void LoadTests() { runner = new WatchOSRunner(); var categoryFilter = new NotFilter(new CategoryExpression("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingInterpreter,RequiresBSDSockets").Filter); if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUNIT_FILTER_START"))) { var firstChar = Environment.GetEnvironmentVariable("NUNIT_FILTER_START") [0]; var lastChar = Environment.GetEnvironmentVariable("NUNIT_FILTER_END") [0]; var nameFilter = new NameStartsWithFilter() { FirstChar = firstChar, LastChar = lastChar }; runner.Filter = new AndFilter(categoryFilter, nameFilter); } else { runner.Filter = categoryFilter; } runner.Add(GetType().Assembly); TestLoader.AddTestAssemblies(runner); ThreadPool.QueueUserWorkItem((v) => { runner.LoadSync(); BeginInvokeOnMainThread(() => { lblStatus.SetText(string.Format("{0} tests", runner.TestCount)); RenderResults(); cmdRun.SetEnabled(true); cmdRun.SetHidden(false); runner.AutoRun(); }); }); }
// Token: 0x06000DDE RID: 3550 RVA: 0x00040A7C File Offset: 0x0003EC7C private void ConvertNotFilter(NotFilter notFilter) { this.IncrementFilterSize(); this.ldapFilter.Append("(!"); this.BuildLdapFilter(notFilter.Filter, null); this.ldapFilter.Append(")"); }
private TestFilter getTestFilter(Options options) { var testFilter = TestFilter.Empty; if (!string.IsNullOrEmpty(options.Tests)) { testFilter = new SimpleNameFilter(options.Tests); } if (!string.IsNullOrEmpty(options.Categories)) { TestFilter excludeFilter = new NotFilter(new CategoryExpression(options.Categories).Filter); if (testFilter.IsEmpty) { testFilter = excludeFilter; } else if (testFilter is AndFilter) { ((AndFilter)testFilter).Add(excludeFilter); } else { testFilter = new AndFilter(testFilter, excludeFilter); } } var notFilter = testFilter as NotFilter; if (notFilter != null) { notFilter.TopLevel = true; } return(testFilter); }
public override void ExitFilters([NotNull] AntlrSPP.FiltersContext context) { base.ExitFilters(context); var negationContext = context.GetChild <AntlrSPP.NegationContext>(0); var attributeFilterContext = context.GetChild <AntlrSPP.AttributeFilterContext>(0); var rangeFilterContext = context.GetChild <AntlrSPP.RangeFilterContext>(0); IFilter filter = null; if (attributeFilterContext != null) { filter = GetTermFilter(attributeFilterContext); } else if (rangeFilterContext != null) { filter = GetRangeFilter(rangeFilterContext); } if (filter == null) { return; } if (negationContext != null) { filter = new NotFilter { ChildFilter = filter }; } Filters.Add(filter); }
private static OrganizationConfigCache.Item GetOrgSettings(IConfigurationSession tenantConfigSession, ref bool shouldAdd) { Organization orgContainer = tenantConfigSession.GetOrgContainer(); if (orgContainer == null) { TraceWrapper.SearchLibraryTracer.TraceError(0, "ADSystemConfigurationSession.GetOrgContainer returned null", new object[0]); TrackingFatalException.RaiseED(ErrorCode.InvalidADData, "msExchOrganizationContainer object not found", new object[0]); } bool readTrackingEnabled = orgContainer.ReadTrackingEnabled; QueryFilter filter = new NotFilter(new BitMaskAndFilter(AcceptedDomainSchema.AcceptedDomainFlags, 1UL)); ADPagedReader <AcceptedDomain> adpagedReader = tenantConfigSession.FindPaged <AcceptedDomain>(tenantConfigSession.GetOrgContainerId(), QueryScope.SubTree, filter, null, 0); HashSet <string> hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); HashSet <string> hashSet2 = new HashSet <string>(StringComparer.OrdinalIgnoreCase); string text = null; int num = 0; int num2 = 0; foreach (AcceptedDomain acceptedDomain in adpagedReader) { num2++; if (acceptedDomain.Default) { text = acceptedDomain.DomainName.Domain; } if (acceptedDomain.DomainType == AcceptedDomainType.Authoritative) { if (++num > 200) { shouldAdd = false; } hashSet.Add(acceptedDomain.DomainName.Domain); } else if (acceptedDomain.DomainType == AcceptedDomainType.InternalRelay) { if (++num > 200) { shouldAdd = false; } hashSet2.Add(acceptedDomain.DomainName.Domain); } } if (num2 == 0) { TraceWrapper.SearchLibraryTracer.TraceError(0, "No AcceptedDomain objects returned", new object[0]); TrackingFatalException.RaiseED(ErrorCode.InvalidADData, "msExchAcceptedDomain object not found in Organization {0}", new object[] { orgContainer }); } if (string.IsNullOrEmpty(text)) { TraceWrapper.SearchLibraryTracer.TraceError(0, "Null/Empty AcceptedDomainFqdn returned", new object[0]); TrackingFatalException.RaiseED(ErrorCode.InvalidADData, "DefaultDomain not found in Organization {0}", new object[] { orgContainer }); } return(new OrganizationConfigCache.Item(text, readTrackingEnabled, hashSet, hashSet2)); }
public void IsMatchCombinations(bool expectedMatch, bool state) { Filter <object> filter = state ? (Filter <object>) new AnyFilter <object>() : new NoneFilter <object>(); NotFilter <object> combinator = new NotFilter <object>(filter); Assert.AreEqual(expectedMatch, combinator.IsMatch(null)); }
// Token: 0x06000DBF RID: 3519 RVA: 0x0002912C File Offset: 0x0002732C private bool TryGetOrganizationFilter(ADObjectId rootId, ADObjectId objectIdentity, string orgName, out QueryFilter orgFilter) { orgFilter = null; if (rootId != null) { orgFilter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.OrganizationalUnitRoot, rootId); } else { if (objectIdentity != null) { return(false); } if (!string.IsNullOrEmpty(orgName)) { ExchangeConfigurationUnit configurationUnit = base.GetConfigurationUnit(orgName); if (configurationUnit == null) { return(false); } orgFilter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.OrganizationalUnitRoot, configurationUnit.OrganizationalUnitRoot); } else { orgFilter = new NotFilter(new ExistsFilter(ADObjectSchema.OrganizationalUnitRoot)); } } return(true); }
TestResult RunNUnitAssembly( IPNUnitServices services, ConsoleWriter outStream, TestRunner testRunner, string assemblyName) { ITestFilter testFilter = TestFilter.Empty; string excludeFilterString = GetExcludeFilter(); if (!string.IsNullOrEmpty(excludeFilterString)) { testFilter = new NotFilter( new CategoryExpression(excludeFilterString).Filter); } int testCount = testRunner.CountTestCases(testFilter); EventCollector collector = new EventCollector(outStream, testCount, services, assemblyName); TestResult result = testRunner.Run( collector, testFilter, true, LoggingThreshold.All); collector.NotifyProgress(); return(result); }
private TestFilter getTestFilter(Options options) { TestFilter testFilter = TestFilter.Empty; if (options.Tests != null && options.Tests != string.Empty) { testFilter = new SimpleNameFilter(options.Tests); } if (options.Categories != null && options.Categories != string.Empty) { TestFilter excludeFilter = new NotFilter(new CategoryExpression(options.Categories).Filter); if (testFilter.IsEmpty) { testFilter = excludeFilter; } else if (testFilter is AndFilter) { ((AndFilter)testFilter).Add(excludeFilter); } else { testFilter = new AndFilter(testFilter, excludeFilter); } } if (testFilter is NotFilter) { ((NotFilter)testFilter).TopLevel = true; } return(testFilter); }
internal static ADPropertyDefinition Int32BitfieldProperty(string name, int shift, ADPropertyDefinition fieldProperty) { CustomFilterBuilderDelegate customFilterBuilderDelegate = delegate(SinglePropertyFilter filter) { ComparisonFilter comparisonFilter = filter as ComparisonFilter; if (comparisonFilter == null || comparisonFilter.ComparisonOperator != ComparisonOperator.Equal) { throw new ADFilterException(DirectoryStrings.ExceptionUnsupportedFilterForProperty(filter.Property.Name, filter.GetType(), typeof(ComparisonFilter))); } int num = 1; int num2 = ((bool)comparisonFilter.PropertyValue) ? 1 : 0; int num3 = (1 << num) - 1; uint num4 = (uint)((uint)(num2 & num3) << shift); uint num5 = (uint)((uint)(~(uint)num2 & num3) << shift); QueryFilter queryFilter = new NotFilter(new BitMaskOrFilter(fieldProperty, (ulong)num5)); if (num2 != 0) { return(new AndFilter(new QueryFilter[] { new BitMaskAndFilter(fieldProperty, (ulong)num4), queryFilter })); } return(queryFilter); }; return(new ADPropertyDefinition(name, fieldProperty.VersionAdded, typeof(bool), null, ADPropertyDefinitionFlags.Calculated, false, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, new ADPropertyDefinition[] { fieldProperty }, customFilterBuilderDelegate, ADObject.FlagGetterDelegate(1 << shift, fieldProperty), ADObject.FlagSetterDelegate(1 << shift, fieldProperty), null, null)); }
private static Query BuildQueryInternal(QueryFilter filter, Dictionary <PropertyDefinition, int> propertyDefinitionToColumnMap, int depth) { if (depth == 0) { throw new ArgumentException("Depth greater then max depth specified"); } SinglePropertyFilter singlePropertyFilter = filter as SinglePropertyFilter; if (singlePropertyFilter != null) { return(Query.BuildSinglePropertyQuery(singlePropertyFilter, propertyDefinitionToColumnMap)); } CompositeFilter compositeFilter = filter as CompositeFilter; if (compositeFilter != null) { return(Query.BuildCompositeFilter(compositeFilter, propertyDefinitionToColumnMap, depth - 1)); } NotFilter notFilter = filter as NotFilter; if (notFilter != null) { return(new NotQuery(Query.BuildQueryInternal(notFilter.Filter, propertyDefinitionToColumnMap, depth - 1))); } return(null); }
public Dictionary <string, object> VisitNotFilter(Hashtable p, NotFilter filter) { var dic = filter.Accept <Dictionary <String, Object>, Hashtable>(this, p); dic[Not] = true; return(dic); }
public override void ExitFilters(Antlr.SearchPhraseParser.FiltersContext context) { base.ExitFilters(context); var negationContext = context.GetChild <Antlr.SearchPhraseParser.NegationContext>(0); var attributeFilterContext = context.GetChild <Antlr.SearchPhraseParser.AttributeFilterContext>(0); var rangeFilterContext = context.GetChild <Antlr.SearchPhraseParser.RangeFilterContext>(0); IFilter filter = null; if (attributeFilterContext != null) { filter = GetTermFilter(attributeFilterContext); } else if (rangeFilterContext != null) { filter = GetRangeFilter(rangeFilterContext); } if (filter != null) { if (negationContext != null) { filter = new NotFilter { ChildFilter = filter }; } Filters.Add(filter); } }
public static QueryFilter ConvertQueryFilter(QueryFilter filter) { if (filter == null) { return(null); } if (filter is CompositeFilter) { CompositeFilter compositeFilter = (CompositeFilter)filter; QueryFilter[] array = new QueryFilter[compositeFilter.FilterCount]; bool flag = false; int num = 0; foreach (QueryFilter queryFilter in compositeFilter.Filters) { array[num] = DateTimeConverter.ConvertQueryFilter(queryFilter); if (array[num] != queryFilter) { flag = true; } num++; } if (!flag) { return(filter); } if (filter is AndFilter) { return(new AndFilter(array)); } if (filter is OrFilter) { return(new OrFilter(array)); } throw new Exception("Invalid filter type"); } else if (filter is NotFilter) { NotFilter notFilter = filter as NotFilter; QueryFilter queryFilter2 = DateTimeConverter.ConvertQueryFilter(notFilter.Filter); if (queryFilter2 != notFilter) { return(new NotFilter(queryFilter2)); } return(filter); } else { if (!(filter is ComparisonFilter)) { return(filter); } ComparisonFilter comparisonFilter = filter as ComparisonFilter; if (comparisonFilter.PropertyValue is DateTime) { return(new ComparisonFilter(comparisonFilter.ComparisonOperator, comparisonFilter.Property, ((DateTime)comparisonFilter.PropertyValue).ToUniversalTime())); } return(filter); } }
public void ExcludingCategoryDoesNotRunExplicitTestCases() { TestFilter filter = new NotFilter(new CategoryFilter("MockCategory")); TestResult result = mockTestFixture.Run(NullListener.NULL, filter); ResultSummarizer summarizer = new ResultSummarizer(result); Assert.AreEqual(2, summarizer.ResultCount); }
public void CanParseExcludedCategories() { CategoryExpression expr = new CategoryExpression("-One,Two,Three"); NotFilter notFilter = (NotFilter)expr.Filter; CategoryFilter catFilter = (CategoryFilter)notFilter.BaseFilter; Assert.AreEqual(catFilter.Categories, new string[] { "One", "Two", "Three" }); }
public void NotFilter_Constructor() { var filter = new NotFilter(new CategoryFilter("Dummy")); Assert.False(filter.IsEmpty); Assert.False(filter.Match(dummyFixture)); Assert.True(filter.Match(anotherFixture)); }
protected Dictionary <IFilter <IIdentifiedSpectrum>, string> GetFilterMap() { Dictionary <IFilter <IIdentifiedSpectrum>, string> map = new Dictionary <IFilter <IIdentifiedSpectrum>, string>(); Regex reg = new Regex(@"\(([^()]+?)\:([^()]+?)\)"); List <IFilter <IIdentifiedSpectrum> > matchedFilters = new List <IFilter <IIdentifiedSpectrum> >(); string defaultTitle = null; Match match = reg.Match(modifiedAminoacids.Text); if (!match.Success) { throw new Exception("Couldn't recognize modification pattern, it should like \n" + DEFAULT_PATTERN); } while (match.Success) { if (match.Groups[1].Value.Trim().Equals("DEFAULT")) { defaultTitle = match.Groups[2].Value.Trim(); } else { string title = match.Groups[2].Value.Trim(); string[] parts = Regex.Split(match.Groups[1].Value, @"\s+"); List <IFilter <IIdentifiedSpectrum> > filters = new List <IFilter <IIdentifiedSpectrum> >(); foreach (string part in parts) { if (part.Length > 0) { filters.Add(new IdentifiedSpectrumSequenceFilter(part)); } } OrFilter <IIdentifiedSpectrum> filter = new OrFilter <IIdentifiedSpectrum>(filters); map[filter] = title; matchedFilters.Add(filter); } match = match.NextMatch(); } if (defaultTitle == null) { throw new Exception("No default name defined, the pattern should like \n" + DEFAULT_PATTERN); } NotFilter <IIdentifiedSpectrum> notFilter = new NotFilter <IIdentifiedSpectrum>(new OrFilter <IIdentifiedSpectrum>(matchedFilters)); map[notFilter] = defaultTitle; return(map); }
public void TestNotFilter() { ContainsFilter left1 = new ContainsFilter(ConnectorAttributeBuilder.Build("foo", "bar")); NotFilter v1 = new NotFilter(left1); NotFilter v2 = (NotFilter)CloneObject(v1); ContainsFilter left2 = (ContainsFilter)v2.Filter; Assert.AreEqual(left1.GetAttribute(), left2.GetAttribute()); }
protected void OnNotFilter(FileEventArgs arg) { if (arg == null) { throw new ArgumentNullException(nameof(arg)); } NotFilter?.Invoke(this, arg); }
public void ReturnFalseIfNoChildFilters() { var e = new SystemEvent(); var extendedProperties = new FakeExtendedProperties { { "property", "Level" }, { "value", "Warning" } }; var filter = new NotFilter(extendedProperties, Enumerable.Empty <ICreateFilterExpressions>()); Assert.False(Filter.Compile(filter).Invoke(e)); }
public void ExcludingCategoryDoesNotRunExplicitTestFixtures() { TestFilter filter = new NotFilter(new CategoryFilter("MockCategory")); TestAssemblyBuilder builder = new TestAssemblyBuilder(); TestSuite suite = builder.Build("mock-assembly.dll", true); TestResult result = suite.Run(NullListener.NULL, filter); ResultSummarizer summarizer = new ResultSummarizer(result); Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun - 2, summarizer.ResultCount); }
protected override void VisitNotFilter(NotFilter item) { var negatedFilter = item.Filter; var currentNegate = this.NegateOperator; this.NegateOperator = true; item.Filter.Accept(this); this.NegateOperator = currentNegate; return; }
public void ExcludingCategoryDoesNotRunExplicitTestCases() { NotFilter filter = new NotFilter(new CategoryFilter("MockCategory")); filter.TopLevel = true; TestResult result = mockTestFixture.Run(NullListener.NULL, filter); ResultSummarizer summarizer = new ResultSummarizer(result); Assert.AreEqual(MockTestFixture.TestsRun - MockTestFixture.MockCategoryTests, summarizer.TestsRun); }
private static QueryContainer CreateNotFilter(NotFilter notFilter, Properties <IProperties> availableFields) { QueryContainer result = null; if (notFilter?.ChildFilter != null) { result = !GetFilterQueryRecursive(notFilter.ChildFilter, availableFields); } return(result); }
public override void SkipCategories(IEnumerable <string> categories) { if (categories.Any()) { // build a category expression and trust the nunit lib var expression = categories.Aggregate( (current, next) => current + "," + next); var categoriesFilter = new NotFilter(new CategoryExpression(expression).Filter); AppendFilter(categoriesFilter); } }
public void NotFilter_Constructor_TopLevel() { var filter = new NotFilter(new CategoryFilter("Dummy")); filter.TopLevel = true; Assert.False(filter.IsEmpty); Assert.False(filter.Match(dummyFixture)); Assert.False(filter.Match(dummyFixture.Tests[0])); Assert.True(filter.Match(anotherFixture)); }
public void ExcludingCategoryDoesNotRunExplicitTestFixtures() { NotFilter filter = new NotFilter(new CategoryFilter("MockCategory")); filter.TopLevel = true; TestAssemblyBuilder builder = new TestAssemblyBuilder(); TestSuite suite = builder.Build(MockAssembly.AssemblyPath, true, false); TestResult result = suite.Run(NullListener.NULL, filter); ResultSummarizer summarizer = new ResultSummarizer(result); Assert.AreEqual(MockAssembly.TestsRun - 2, summarizer.TestsRun); }
public static TestFilter FromXml(string xmlText) { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlText); XmlNode topNode = doc.FirstChild; if (topNode.Name != "filter") throw new Exception("Expected filter element at top level"); // Initially, an empty filter TestFilter result = TestFilter.Empty; bool isEmptyResult = true; XmlNodeList testNodes = topNode.SelectNodes("tests/test"); XmlNodeList includeNodes = topNode.SelectNodes("include/category"); XmlNodeList excludeNodes = topNode.SelectNodes("exclude/category"); if (testNodes.Count > 0) { SimpleNameFilter nameFilter = new SimpleNameFilter(); foreach (XmlNode testNode in topNode.SelectNodes("tests/test")) nameFilter.Add(testNode.InnerText); result = nameFilter; isEmptyResult = false; } if (includeNodes.Count > 0) { //CategoryFilter includeFilter = new CategoryFilter(); //foreach (XmlNode includeNode in includeNodes) // includeFilter.AddCategory(includeNode.InnerText); // Temporarily just look at the first element XmlNode includeNode = includeNodes[0]; TestFilter includeFilter = new CategoryExpression(includeNode.InnerText).Filter; if (isEmptyResult) result = includeFilter; else result = new AndFilter(result, includeFilter); isEmptyResult = false; } if (excludeNodes.Count > 0) { CategoryFilter categoryFilter = new CategoryFilter(); foreach (XmlNode excludeNode in excludeNodes) categoryFilter.AddCategory(excludeNode.InnerText); TestFilter excludeFilter = new NotFilter(categoryFilter); if (isEmptyResult) result = excludeFilter; else result = new AndFilter(result, excludeFilter); isEmptyResult = false; } return result; }
public void IsMatchCombinations(bool expectedMatch, bool state) { Filter<object> filter = state ? (Filter<object>)new AnyFilter<object>() : new NoneFilter<object>(); NotFilter<object> combinator = new NotFilter<object>(filter); Assert.AreEqual(expectedMatch, combinator.IsMatch(null)); }