public void ShouldApplyFilterToPropertiesContained() { CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(new PropertyItemMock("property1") { IsBrowsable = true }); category.AddProperty(new PropertyItemMock("property2") { IsBrowsable = true }); category.ApplyFilter(new PropertyFilter("missing")); Assert.IsFalse(category.MatchesFilter); Assert.IsFalse(category.HasVisibleProperties); category.ApplyFilter(new PropertyFilter("property")); Assert.IsTrue(category.MatchesFilter); Assert.IsTrue(category.HasVisibleProperties); }
public void ShouldExpandOnAppliedFilterMatch() { CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(new PropertyItemMock("property1") { IsBrowsable = true }); category.AddProperty(new PropertyItemMock("property2") { IsBrowsable = true }); category.IsExpanded = false; category.ApplyFilter(new PropertyFilter("property")); Assert.IsTrue(category.MatchesFilter); Assert.IsTrue(category.IsExpanded); }
public void ShouldNotifyFilterApplied() { CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(new PropertyItemMock("property1") { IsBrowsable = true }); category.AddProperty(new PropertyItemMock("property2") { IsBrowsable = true }); bool filterApplied = false; category.FilterApplied += delegate { filterApplied = true; }; category.ApplyFilter(new PropertyFilter("property")); Assert.IsTrue(filterApplied); }