public void ShouldInitializeFilter()
        {
            PropertyFilter filter = new PropertyFilter("test");
              PropertyFilterAppliedEventArgs args = new PropertyFilterAppliedEventArgs(filter);

              Assert.AreEqual<PropertyFilter>(filter, args.Filter);
        }
Beispiel #2
0
        /// <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));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Applies the filter for the entry.
        /// </summary>
        /// <param name="filter">The filter.</param>
        public override void ApplyFilter(PropertyFilter filter)
        {
            bool propertiesMatch = false;

            foreach (var entry in Properties)
            {
                if (PropertyMatchesFilter(filter, entry))
                {
                    propertiesMatch = true;
                }
            }

            HasVisibleProperties = _properties.Any(IsVisibleProperty);
            MatchesFilter        = propertiesMatch;

            if (propertiesMatch && !IsExpanded)
            {
                IsExpanded = true;
            }

            OnFilterApplied(filter);
        }
Beispiel #4
0
 /// <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));
 }
Beispiel #5
0
 /// <summary>
 /// Applies the filter for the entry.
 /// </summary>
 /// <param name="filter">The filter.</param>
 public abstract void ApplyFilter(PropertyFilter filter);
Beispiel #6
0
 /// <summary>
 /// Applies the filter for the entry.
 /// </summary>
 /// <param name="filter">The filter.</param>
 public override void ApplyFilter(PropertyFilter filter)
 {
     this.MatchesFilter = (filter == null) || filter.Match(this);
     this.OnFilterApplied(filter);
 }
Beispiel #7
0
 private static bool PropertyMatchesFilter(PropertyFilter filter, PropertyItem entry)
 {
     entry.ApplyFilter(filter);
       return entry.MatchesFilter;
 }
Beispiel #8
0
        /// <summary>
        /// Applies the filter for the entry.
        /// </summary>
        /// <param name="filter">The filter.</param>
        public override void ApplyFilter(PropertyFilter filter)
        {
            bool propertiesMatch = false;
              foreach (var entry in Properties)
              {
            if (PropertyMatchesFilter(filter, entry))
              propertiesMatch = true;
              }

              HasVisibleProperties = _properties.Any(IsVisibleProperty);
              MatchesFilter = propertiesMatch;

              if (propertiesMatch && !IsExpanded)
            IsExpanded = true;

              OnFilterApplied(filter);
        }
Beispiel #9
0
 public void ShouldInitiaizeWithPredicatesCollection()
 {
     PropertyFilter filter = new PropertyFilter(new PropertyFilterPredicate[] { new PropertyFilterPredicate("test"), new PropertyFilterPredicate("me") });
       Assert.IsFalse(filter.IsEmpty);
 }
Beispiel #10
0
 /// <summary>
 /// Applies the filter for the entry.
 /// </summary>
 /// <param name="filter">The filter.</param>
 public abstract void ApplyFilter(PropertyFilter filter);
Beispiel #11
0
 public void ApplyFilter(PropertyFilter filter)
 {
     this.MatchesFilter = (filter == null) || filter.Match(this);
 }
Beispiel #12
0
 public void ShouldReturnPositiveMatchWhenEmpty()
 {
     PropertyFilter filter = new PropertyFilter((string)null);
       Assert.IsTrue(filter.Match(new PropertyFilterTargetTestCase("test")));
 }
Beispiel #13
0
 public void ShouldPerformMatch()
 {
     PropertyFilter filter = new PropertyFilter("test");
       Assert.IsTrue(filter.Match(new PropertyFilterTargetTestCase("test")));
       Assert.IsFalse(filter.Match(new PropertyFilterTargetTestCase("missing")));
 }
Beispiel #14
0
 public void ShouldInitializeWithNullValue()
 {
     PropertyFilter filter = new PropertyFilter((IEnumerable<PropertyFilterPredicate>)null);
       Assert.IsTrue(filter.IsEmpty);
 }
Beispiel #15
0
 public override void ApplyFilter(PropertyFilter filter)
 {
 }
Beispiel #16
0
 private static bool PropertyMatchesFilter(PropertyFilter filter, PropertyItem entry)
 {
     entry.ApplyFilter(filter);
     return(entry.MatchesFilter);
 }
Beispiel #17
0
 public void ShouldFailMatchingToNullValue()
 {
     PropertyFilter filter = new PropertyFilter("test");
       filter.Match(null);
 }