public override void ApplyFilter(PropertyFilter filter) { base.ApplyFilter(filter); bool propertyMatchesFilter1 = this.BasicPropertyMatchesFilter; bool propertyMatchesFilter2 = this.AdvancedPropertyMatchesFilter; using (List <PropertyEntry> .Enumerator enumerator = this.attachedPropertyEntries.GetEnumerator()) { while (enumerator.MoveNext()) { PropertyEntry current = enumerator.Current; if (current.get_IsAdvanced()) { propertyMatchesFilter2 |= this.DoesPropertyMatchFilter(filter, current); } else { propertyMatchesFilter1 |= this.DoesPropertyMatchFilter(filter, current); } } } this.BasicPropertyMatchesFilter = propertyMatchesFilter1; this.AdvancedPropertyMatchesFilter = propertyMatchesFilter2; this.OnFilterApplied(filter); }
public void ShouldInitializeFilter() { PropertyFilter filter = new PropertyFilter("test"); PropertyFilterAppliedEventArgs args = new PropertyFilterAppliedEventArgs(filter); Assert.AreEqual <PropertyFilter>(filter, args.Filter); }
public void Test_IsMatch_And_True() { TestArticle article = new TestArticle(); article.ID = Guid.NewGuid(); article.Title = "Article1"; FilterGroup group = new FilterGroup(); PropertyFilter filter1 = new PropertyFilter(); filter1.AddType(typeof(TestArticle)); filter1.PropertyName = "Title"; filter1.PropertyValue = article.Title; Assert.IsTrue(filter1.IsMatch(article), "filter1 failed to match article when it should."); PropertyFilter filter2 = new PropertyFilter(); filter2.AddType(typeof(TestArticle)); filter2.PropertyName = "ID"; filter2.PropertyValue = article.ID; Assert.IsTrue(filter2.IsMatch(article), "filter2 failed to match article when it should."); group.Add(filter1); group.Add(filter2); Assert.IsTrue(group.IsMatch(article), "group failed to match when it should"); }
public void Test_IsMatch_Or_True_OneMatches() { TestArticle article = new TestArticle(); article.ID = Guid.NewGuid(); article.Title = "Article1"; FilterGroup group = new FilterGroup(); group.Operator = FilterGroupOperator.Or; PropertyFilter filter1 = new PropertyFilter(); filter1.AddType(typeof(TestArticle)); filter1.PropertyName = "Title"; filter1.PropertyValue = article.Title; Assert.IsTrue(filter1.IsMatch(article), "filter1 failed to match article when it should."); PropertyFilter filter2 = new PropertyFilter(); filter2.AddType(typeof(TestArticle)); filter2.PropertyName = "Title"; filter2.PropertyValue = "MISMATCH"; // This one should fail Assert.IsFalse(filter2.IsMatch(article), "filter2 matched when it should fail."); group.Add(filter1); group.Add(filter2); Assert.IsTrue(group.IsMatch(article), "group failed when it should match"); }
public void Test_GetEntitiesByPropertyValue_Exclusion() { using (LogGroup logGroup = LogGroup.Start("Testing exclusion with the GetEntities by property value function.", NLog.LogLevel.Debug)) { EntityOne e1 = new EntityOne(); e1.Name = "Test E1"; //FilterGroup filterGroup = new FilterGroup(); //filterGroup.Operator PropertyFilter filter = (PropertyFilter)DataAccess.Data.CreateFilter(typeof(PropertyFilter)); filter.Operator = FilterOperator.Equal; filter.PropertyName = "Name"; filter.PropertyValue = "Another Name"; DataAccess.Data.Saver.Save(e1); IEntity[] found = DataAccess.Data.Indexer.GetEntities <EntityOne>("Name", "Another Name"); Assert.IsNotNull(found, "Null array returned."); if (found != null) { Assert.AreEqual(0, found.Length, "Entities weren't properly excluded."); } } }
private void AddFilterValue(string parent, XElement prop, object parsedValue) { XElement filterMember = prop.Element("FilterMember"); if (parent == null || filterMember == null || filterMember.Value == null || !filterMember.Value.ToBoolean()) { return; } var key = prop.Element("Name").Value.ToString(); var item = PropertyFilter.FirstOrDefault(x => x.PropertyName == key); if (item != null) { var valList = item.Values; var valuePair = new PropertyFilterValue { Value = parsedValue, Parent = parent }; if (!valList.Contains(valuePair)) { valList.Add(valuePair); } } else { var valList = new List <PropertyFilterValue>(); valList.Add(new PropertyFilterValue { Value = parsedValue, Parent = parent }); PropertyFilter.Add(new PropertyFilter { PropertyName = key, Values = valList }); } }
private static Expression ConvertPropertyFilter(Type targetType, PropertyFilter filter) { // Product property expression var productExpression = Expression.Parameter(targetType); var propertyExpresssion = Expression.Property(productExpression, filter.Entry.Identifier); var property = targetType.GetProperty(filter.Entry.Identifier); var value = Convert.ChangeType(filter.Entry.Value.Current, property.PropertyType); var constantExpression = Expression.Constant(value); Expression expressionBody; switch (filter.Operator) { case PropertyFilterOperator.Equals: expressionBody = Expression.MakeBinary(ExpressionType.Equal, propertyExpresssion, constantExpression); break; case PropertyFilterOperator.GreaterThen: expressionBody = Expression.MakeBinary(ExpressionType.GreaterThan, propertyExpresssion, constantExpression); break; case PropertyFilterOperator.LessThen: expressionBody = Expression.MakeBinary(ExpressionType.LessThan, propertyExpresssion, constantExpression); break; default: throw new ArgumentOutOfRangeException(); } return(Expression.Lambda(expressionBody, productExpression)); }
/// <summary> /// Gets reviews for the given property /// </summary> /// <param name="filter">Filter object used to filter, sort and page the results</param> /// <returns>Reviwes</returns> public virtual async Task <IEnumerable <IReview> > GetByPropertyIdAsync(IPropertyFilter filter) { if (filter == null) { filter = new PropertyFilter() { Page = 1, PageSize = 10, OrderBy = "id" }; } if (String.IsNullOrWhiteSpace(filter.OrderBy)) { filter.OrderBy = "id"; } var reviews = Repository.GetWhere <Review>() .Where(r => r.propertyid == filter.PropertyId); if (!String.IsNullOrWhiteSpace(filter.SearchTerm)) { reviews = reviews.Where(w => w.Property.name.Contains(filter.SearchTerm) || w.Property.address.Contains(filter.SearchTerm)); } reviews = reviews.OrderByDyn(filter.OrderBy, filter.OrderAsc) .ThenByDyn("id", true) .Skip(filter.Skip) .Take(filter.PageSize); return(Mapper.Map <IEnumerable <IReview> >(await reviews.ToListAsync())); }
public void GetPage_Properties(PropertyFilter filter, int expectedCount) { // Arrange var helper = new TestHelper(); var user = PrincipalHelper.CreateForPermission(Permissions.PropertyView); using var init = helper.InitializeDatabase(user); init.CreateProperty(2); init.CreateProperty(3, pin: 111); init.CreateProperty(4, address: init.PimsAddresses.FirstOrDefault()); init.Add(new Entity.PimsProperty() { Location = new NetTopologySuite.Geometries.Point(-123.720810, 48.529338) }); init.CreateProperty(5, classification: init.PimsPropertyClassificationTypes.FirstOrDefault(c => c.PropertyClassificationTypeCode == "Core Operational")); init.CreateProperty(111111111); init.SaveChanges(); var service = helper.CreateRepository <PropertyRepository>(user); // Act var result = service.GetPage(filter); // Assert Assert.NotNull(result); Assert.IsAssignableFrom <IEnumerable <Entity.PimsProperty> >(result); Assert.Equal(expectedCount, result.Total); }
public virtual void ApplyFilter(PropertyFilter filter) { this.set_MatchesFilter(filter.Match((IPropertyFilterTarget)this)); bool flag1 = false; bool flag2 = false; using (IEnumerator <PropertyEntry> enumerator = this.BasicProperties.GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { PropertyEntry current = enumerator.Current; if (this.DoesPropertyMatchFilter(filter, current)) { flag1 = true; } } } using (IEnumerator <PropertyEntry> enumerator = this.AdvancedProperties.GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { PropertyEntry current = enumerator.Current; if (this.DoesPropertyMatchFilter(filter, current)) { flag2 = true; } } } this.BasicPropertyMatchesFilter = flag1; this.AdvancedPropertyMatchesFilter = flag2; this.OnFilterApplied(filter); }
private void cmbProps_SelectedIndexChanged(object sender, EventArgs e) { lsbValues.Items.Clear(); lsbValues.SelectedIndex = -1; btnAdd.Enabled = false; gbConnect.Enabled = false; if (cmbProps.SelectedIndex < 0 || cmbProps.SelectedItem == null || !(cmbProps.SelectedItem is PropertyFilter)) { return; } var selectedItem = PropertyFilter.FirstOrDefault(x => x.PropertyName == (cmbProps.SelectedValue as PropertyFilter).PropertyName); selectedItem.Values.Sort(CompareValues); foreach (var val in selectedItem.Values) { if (val.Value != null) { if (CurrentDevice == null && !lsbValues.Items.Contains(val.Value)) { lsbValues.Items.Add(val.Value); } else if (val.Parent == CurrentDevice && !lsbValues.Items.Contains(val.Value)) { lsbValues.Items.Add(val.Value); } } } gbConnect.Enabled = true; }
public void ShouldPerformMatch() { PropertyFilter filter = new PropertyFilter("test"); Assert.IsTrue(filter.Match(new PropertyFilterTargetTestCase("test"))); Assert.IsFalse(filter.Match(new PropertyFilterTargetTestCase("missing"))); }
public override void ApplyFilter(PropertyFilter filter) { this.MatchesFilter = filter.Match(this); // Now Match all the properties in this category bool newBasicPropertyMatchesFilter = false; bool newAdvancedPropertyMatchesFilter = false; foreach (PropertyEntry property in this.BasicProperties) { if (this.DoesPropertyMatchFilter(filter, property)) { newBasicPropertyMatchesFilter = true; } } foreach (PropertyEntry property in this.AdvancedProperties) { if (this.DoesPropertyMatchFilter(filter, property)) { newAdvancedPropertyMatchesFilter = true; } } this.BasicPropertyMatchesFilter = newBasicPropertyMatchesFilter; this.AdvancedPropertyMatchesFilter = newAdvancedPropertyMatchesFilter; this.OnFilterApplied(filter); }
public void IsMatchTest() { PropertyFilter target = new PropertyFilter(); SyslogMessage message = new SyslogMessage { Facility = SyslogFacility.Internally, Severity = SyslogSeverity.Error, Text = "FFDA WOW!" }; target.value = "Internally"; target.propertyName = Property.Facility; target.comparison = ComparisonOperator.eq; bool expected = true; bool actual; actual = target.IsMatch(message); Assert.AreEqual(expected, actual); target.value = "Alert"; target.propertyName = Property.Severity; target.comparison = ComparisonOperator.neq; expected = true; actual = target.IsMatch(message); Assert.AreEqual(expected, actual); }
public static PropertyDependencyFilter Create(PropertyFilter filter) { switch (filter) { case PropertyFilter.Default: return(Default); case PropertyFilter.IgnoreAll: return(IgnoreAll); case PropertyFilter.IgnoreBase: return(IgnoreBase); case PropertyFilter.RequireAll: return(RequireAll); case PropertyFilter.RequireBase: return(RequireBase); default: throw new ArgumentOutOfRangeException( string.Format( "The value {0} does not translate to a valid property filter. This is most likely a bug in the calling code.", filter)); } }
private static ReferenceFile GetSceneReference(string scenePath, PropertyFilter filter, bool containsEmpty = false) { var scene = UnityApi.MakeSureSceneOpened(scenePath); var referenceObjects = scene.GetRootGameObjects() .SelectMany(go => UnityApi.GetAllComponentsInChildren(go) .Select(t => t.component == null ? containsEmpty ? ReferenceObject.EmptyComponent( UnityApi.GetTransformPath(t.gameObject)) : null : GetReferenceObject(t.component, filter, true)) .Append(go == null ? containsEmpty ? ReferenceObject.EmptyGameObject : null : GetReferenceObject(go, filter, true)) ) .Where(refObj => refObj != null) .ToArray(); return(referenceObjects.Length > 0 ? new ReferenceFile { ReferenceFilePath = scenePath, ReferenceObjects = referenceObjects, } : null); }
/// <inheritdoc /> public override void Apply( PropertyInfo memberInfo, ConventionTypeConfiguration configuration, InversePropertyAttribute attribute) { Check.NotNull <PropertyInfo>(memberInfo, nameof(memberInfo)); Check.NotNull <ConventionTypeConfiguration>(configuration, nameof(configuration)); Check.NotNull <InversePropertyAttribute>(attribute, nameof(attribute)); if (!memberInfo.IsValidEdmNavigationProperty()) { return; } Type targetType = memberInfo.PropertyType.GetTargetType(); PropertyInfo inverseNavigationProperty = new PropertyFilter(DbModelBuilderVersion.Latest).GetProperties(targetType, false, (IEnumerable <PropertyInfo>)null, (IEnumerable <Type>)null, false).SingleOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(p => string.Equals(p.Name, attribute.Property, StringComparison.OrdinalIgnoreCase))); if (inverseNavigationProperty == (PropertyInfo)null) { throw Error.InversePropertyAttributeConvention_PropertyNotFound((object)attribute.Property, (object)targetType, (object)memberInfo.Name, (object)memberInfo.ReflectedType); } if (memberInfo == inverseNavigationProperty) { throw Error.InversePropertyAttributeConvention_SelfInverseDetected((object)memberInfo.Name, (object)memberInfo.ReflectedType); } configuration.NavigationProperty(memberInfo).HasInverseNavigationProperty((Func <PropertyInfo, PropertyInfo>)(p => inverseNavigationProperty)); }
public void Test_IsMatch() { using (LogGroup logGroup = LogGroup.Start("Testing the PropertyFilter.IsMatch function.", NLog.LogLevel.Debug)) { TestArticle article = new TestArticle(); article.ID = Guid.NewGuid(); article.Title = "Test Title 1"; TestArticle article2 = new TestArticle(); article2.ID = Guid.NewGuid(); article2.Title = "Test Title 2"; //DataAccess.Data.Saver.Save(article); //DataAccess.Data.Saver.Save(article2); PropertyFilter filter = (PropertyFilter)DataAccess.Data.CreateFilter(typeof(PropertyFilter)); filter.Operator = FilterOperator.Equal; filter.PropertyName = "Title"; filter.PropertyValue = article.Title; filter.AddType(typeof(TestArticle)); bool isMatch = filter.IsMatch(article); Assert.IsTrue(isMatch, "The IsMatch function returned false when it should have been true."); } }
public void AssertFailsWithPropertyFilterTest() { // Arrange var filter = new PropertyFilter().AddFilter <TestClass>(t => new { t.StringProp }); var expected = new TestClass { IntProp = 1, StringProp = "A", }; var actual = new TestClass { IntProp = 2, StringProp = "B" }; // Act, Assert var exception = Assert.Throws <AssertionException>(() => PropertyAssert.AreEqual(expected, actual, propertyFilter: filter)); var expectedExceptionMessage = AggregateLines( " Values differ at property 'StringProp'.", " String lengths are both 1. Strings differ at index 0.", " Expected: \"A\"", " But was: \"B\"", " -----------^", ""); Assert.AreEqual(expectedExceptionMessage, exception.Message); }
private CEUtil(string ceUri, string osName, string ceUser, string password, LogMsg logMsg) { #if (P8_451) // P8 4.5 authentication UsernameToken token = new UsernameToken(ceUser, password, PasswordOption.SendPlainText); UserContext.SetProcessSecurityToken(token); #else // P8 5.0 authentication UsernameCredentials cred = new UsernameCredentials(ceUser, password); ClientContext.SetProcessCredentials(cred); #endif conn = Factory.Connection.GetConnection(ceUri); isCredentialsEstablished = true; // Get domain name PropertyFilter pf = new PropertyFilter(); pf.AddIncludeProperty(0, null, null, "Name", null); pf.AddIncludeProperty(0, null, null, "Id", null); domain = Factory.Domain.FetchInstance(conn, null, null); objStore = Factory.ObjectStore.FetchInstance(domain, osName, null); // Successfully initialized CEUtil object: save singleton instance this.logMsg = logMsg; gCEUtil = this; }
public void FillLists(PropertyFilter psetFilter, bool readOnly = false) { //clear lists listViewEqTo.Items.Clear(); listViewStartWith.Items.Clear(); listViewContains.Items.Clear(); listViewPSetEqTo.Items.Clear(); //fill lists listViewEqTo.Items = psetFilter.EqualTo; listViewStartWith.Items = psetFilter.StartWith; listViewContains.Items = psetFilter.Contain; listViewPSetEqTo.Items = psetFilter.PropertySetsEqualTo; //set read only if (readOnly) { listViewEqTo.SetReadOnly(); listViewStartWith.SetReadOnly(); listViewContains.SetReadOnly(); listViewPSetEqTo.SetReadOnly(); } else { listViewEqTo.SetEnabled(); listViewStartWith.SetEnabled(); listViewContains.SetEnabled(); listViewPSetEqTo.SetEnabled(); } }
/// <summary> /// Called when filter was applied for the entry. /// </summary> /// <param name="filter">The filter.</param> protected virtual void OnFilterApplied(PropertyFilter filter) { var handler = FilterApplied; if (handler != null) { handler(this, new PropertyFilterAppliedEventArgs(filter)); } }
internal Log4NetTextFormatterOptions(IFormatProvider?formatProvider, CDataMode cDataMode, XmlQualifiedName?xmlNamespace, XmlWriterSettings xmlWriterSettings, PropertyFilter filterProperty, ExceptionFormatter formatException) { FormatProvider = formatProvider; CDataMode = cDataMode; XmlNamespace = xmlNamespace; XmlWriterSettings = xmlWriterSettings; FilterProperty = filterProperty; FormatException = formatException; }
public static ReferenceFile GetReference(string path, PropertyFilter filter, bool containsEmpty = false) { if (UnityApi.IsSceneFile(path)) { return(GetSceneReference(path, filter, containsEmpty)); } return(GetResourceReference(path, filter, containsEmpty)); }
public void Creates_Filter_On_Creation() { var filter = new PropertyFilter <MyFilteredItem>("MyString", PredicateOperator.IsEqual, "Value B"); Assert.IsNotNull(filter.Filter); Assert.IsNotNull(filter.Expression); Assert.AreEqual(CultureInfo.InvariantCulture, filter.Culture); Assert.AreEqual(false, filter.IsCaseSensitive); }
public void Ctor_NullQuery_DoesNotThrow() { // arrange // act var filter = new PropertyFilter <FakeClass>(null); // assert Assert.NotNull(filter); }
private void PropertyFilter_validates_spatial_types(PropertyFilter filter) { var properties = new List <PropertyInfo> { new MockPropertyInfo(typeof(DbGeography), "Geography"), new MockPropertyInfo(typeof(DbGeometry), "Geometry") }; filter.ValidatePropertiesForModelVersion(new MockType(), properties); }
public void Ctor_ValidQuery_Initializes() { // arrange // act var filter = new PropertyFilter <FakeClass>("foo"); // assert Assert.NotNull(filter); }
public void Ctor_EmptyQuery_DoesNotThrow() { // arrange // act var filter = new PropertyFilter <FakeClass>(string.Empty); // assert Assert.NotNull(filter); }
public string GetPropertyValue(PropertyFilter propertyClient, Condition condition) { ElsevierMaterials.Models.Property prop = condition.Properties.Where(m => m.SourcePropertyId == propertyClient.SourceTypeId && m.ValueId == propertyClient.RowId).FirstOrDefault(); if (prop != null) { return(prop.OrigValue); } return(null); }
public void Execute_WithPropertyFilter_Ran() { var embed = new Engine(); var filter = new PropertyFilter("propertyName", "propertyValue"); var result = embed.Execute(ConfigFilePath, filter); var builder = new FlatResultBuilder(); var agg = builder.Execute(result); Assert.That(agg.Count, Is.EqualTo(1)); }
public void AddSingleImmediatePropTest() { // Arrange var mapTypePropertyMap = new PropertyFilter() .AddFilter<ClassA>(t => t.IntProp); // Act var actualProps = mapTypePropertyMap.ToArray(); // Assert Assert.AreEqual(1, actualProps.Length); Assert.AreEqual(1, actualProps.Count(p => p.Name == "IntProp")); }
public void PropertyFilter_finds_declared_properties_on_derived_type() { var propertyNames = new[] { "PublicDerived" }; var properties = new PropertyFilter().GetProperties( typeof(PropertyFilterTests_Derived), true, Enumerable.Empty<PropertyInfo>()); Assert.Equal(propertyNames.Length, properties.Count()); Assert.True(properties.All(x => propertyNames.Contains(x.Name))); }
public void AddSingleNestedPropTest() { // Arrange var mapTypePropertyMap = new PropertyFilter() .AddFilter<ClassA>(t => t.BProp.CProp.FloatProp); // Act var actualProps = mapTypePropertyMap.ToArray(); // Assert Assert.AreEqual(3, actualProps.Length); Assert.AreEqual(1, actualProps.Count(p => p.Name == "BProp")); Assert.AreEqual(1, actualProps.Count(p => p.Name == "CProp")); Assert.AreEqual(1, actualProps.Count(p => p.Name == "FloatProp")); }
public void AddMultipleImmediatePropsTest() { // Arrange var mapTypePropertyMap = new PropertyFilter() .AddFilter<ClassA>(t => new { t.IntProp, t.DoubleProp }); // Act var actualProps = mapTypePropertyMap.ToArray(); // Assert Assert.AreEqual(2, actualProps.Length); Assert.AreEqual(1, actualProps.Count(p => p.Name == "IntProp")); Assert.AreEqual(1, actualProps.Count(p => p.Name == "DoubleProp")); }
public void PropertyFilter_finds_all_properties_on_derived_type() { var propertyNames = new[] { "PublicBase", "PublicBaseForNew", "PublicVirtualBase", "PublicVirtualBase2", "InterfaceImplicit", "PublicDerived" }; var properties = new PropertyFilter().GetProperties( typeof(PropertyFilterTests_Derived), false, Enumerable.Empty<PropertyInfo>()); Assert.Equal(propertyNames.Length, properties.Count()); Assert.True(properties.All(x => propertyNames.Contains(x.Name))); }
public static PropertyDependencyFilter Create(PropertyFilter filter) { switch (filter) { case PropertyFilter.Default: return Default; case PropertyFilter.IgnoreAll: return IgnoreAll; case PropertyFilter.IgnoreBase: return IgnoreBase; case PropertyFilter.RequireAll: return RequireAll; case PropertyFilter.RequireBase: return RequireBase; default: throw new ArgumentOutOfRangeException( string.Format( "The value {0} does not translate to a valid property filter. This is most likely a bug in the calling code.", filter)); } }
/// <summary> /// Initializes a new instance of the <see cref="PropertyFilterAppliedEventArgs"/> class. /// </summary> /// <param name="filter">The filter.</param> public PropertyFilterAppliedEventArgs(PropertyFilter filter) { Filter = filter; }
public void AssertPassesWithPropertyFilterTest() { // Arrange var filter = new PropertyFilter().AddFilter<TestClass>(t => new { t.StringProp }); var expected = new TestClass { IntProp = 1, StringProp = "A", }; var actual = new TestClass { IntProp = 2, // Value is different, but the property is not in the filter StringProp = "A" }; // Act, Assert Assert.DoesNotThrow(() => PropertyAssert.AreEqual(expected, actual, propertyFilter: filter)); }
public void AssertFailsWithPropertyFilterTest() { // Arrange var filter = new PropertyFilter().AddFilter<TestClass>(t => new { t.StringProp }); var expected = new TestClass { IntProp = 1, StringProp = "A", }; var actual = new TestClass { IntProp = 2, StringProp = "B" }; // Act, Assert var exception = Assert.Throws<AssertionException>(() => PropertyAssert.AreEqual(expected, actual, propertyFilter: filter)); var expectedExceptionMessage = AggregateLines( " Values differ at property 'StringProp'.", " String lengths are both 1. Strings differ at index 0.", " Expected: \"A\"", " But was: \"B\"", " -----------^", ""); Assert.AreEqual(expectedExceptionMessage, exception.Message); }
public static List<PropertyFilter> FiltersFromString(string filterstring) { List<PropertyFilter> list = new List<PropertyFilter>(); if (!string.IsNullOrEmpty(filterstring)) { string[] strArray = filterstring.Split("&".ToCharArray()); foreach (string str in strArray) { PropertyFilter item = new PropertyFilter(); string[] strArray2 = str.Split("@".ToCharArray()); item.Field = strArray2[0]; item.Values = strArray2[1].Split(",".ToCharArray()); list.Add(item); } } return list; }
public GridFilter() { AlphaFilter = new AlphabeticFilter(); PropertyFilter = new PropertyFilter(); }
public void PropertyFilter_excludes_enum_and_spatial_properties_if_V3_features_are_not_supported() { var mockType = new MockType(); mockType.Setup(m => m.IsEnum).Returns(true); var properties = new PropertyInfo[] { new MockPropertyInfo(typeof(DbGeography), "Geography"), new MockPropertyInfo(typeof(DbGeometry), "Geometry"), new MockPropertyInfo(mockType, "EnumProp") }; mockType.Setup(m => m.GetProperties(It.IsAny<BindingFlags>())).Returns(properties); var filteredProperties = new PropertyFilter(DataModelVersions.Version2).GetProperties(mockType, declaredOnly: false); Assert.Equal(0, filteredProperties.Count()); }
public void PropertyFilter_includes_enum_and_spatial_properties_if_V3_features_are_supported() { var mockType = new MockType(); mockType.Setup(m => m.IsEnum).Returns(true); var properties = new PropertyInfo[] { new MockPropertyInfo(typeof(DbGeography), "Geography"), new MockPropertyInfo(typeof(DbGeometry), "Geometry"), new MockPropertyInfo(mockType, "EnumProp") }; mockType.Setup(m => m.GetProperties(It.IsAny<BindingFlags>())).Returns(properties); var filteredProperties = new PropertyFilter().GetProperties(mockType, declaredOnly: false); properties.All(p => filteredProperties.Select(f => f.Name).Contains(p.Name)); }
private void PropertyFilter_validates_spatial_types(PropertyFilter filter) { var properties = new List<PropertyInfo> { new MockPropertyInfo(typeof(DbGeography), "Geography"), new MockPropertyInfo(typeof(DbGeometry), "Geometry") }; filter.ValidatePropertiesForModelVersion(new MockType(), properties); }
private void PropertyFilter_validates_enum_types(PropertyFilter filter) { var mockType = new MockType(); mockType.Setup(m => m.IsEnum).Returns(true); var properties = new List<PropertyInfo> { new MockPropertyInfo(mockType, "EnumProp") }; filter.ValidatePropertiesForModelVersion(mockType, properties); }