public void ShouldReturnParentValue() { PropertyItemValue value = new PropertyItemValue(new PropertyItemMock()); PropertyItem property = new PropertyItemMock(value); Assert.AreEqual(value, property.ParentValue); }
public void ShouldFailAddingDuplicateProperty() { PropertyItemMock property = new PropertyItemMock("property"); CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(property); category.AddProperty(property); }
public void ShouldOrderPropertiesUponAdding() { PropertyItem property1 = new PropertyItemMock("property1"); PropertyItem property2 = new PropertyItemMock("property2"); CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(property2); category.AddProperty(property1); Assert.AreEqual <PropertyItem>(property1, category.Properties[0]); Assert.AreEqual <PropertyItem>(property2, category.Properties[1]); }
public void ShouldRetreivePropertyByName() { PropertyItemMock property1 = new PropertyItemMock("property1"); PropertyItemMock property2 = new PropertyItemMock("property2"); CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(property1); category.AddProperty(property2); Assert.AreEqual <PropertyItem>(property1, category["property1"]); Assert.AreEqual <PropertyItem>(property2, category["property2"]); }
public void ShouldListenToPropertyVisibilityChanges() { CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); PropertyItemMock property = new PropertyItemMock("property"); category.AddProperty(property); Assert.IsFalse(category.HasVisibleProperties); property.IsBrowsable = true; Assert.IsTrue(category.HasVisibleProperties); property.IsBrowsable = false; Assert.IsFalse(category.HasVisibleProperties); }
public void ShouldSortUponSettingNewComparer() { PropertyItem property1 = new PropertyItemMock("property1"); PropertyItem property2 = new PropertyItemMock("property2"); CategoryItem category = new CategoryItem(new PropertyGrid(), new CategoryAttribute()); category.AddProperty(property2); category.AddProperty(property1); Assert.AreEqual <PropertyItem>(property1, category.Properties[0]); Assert.AreEqual <PropertyItem>(property2, category.Properties[1]); category.Comparer = new PropertyItemComparerMock(); Assert.AreEqual <PropertyItem>(property2, category.Properties[0]); Assert.AreEqual <PropertyItem>(property1, category.Properties[1]); }
public void ShouldFailMatchingPredicateForMissingDisplayNameAndPropertyType() { PropertyItemMock property = new PropertyItemMock(); Assert.IsFalse(property.MatchesPredicate(new PropertyFilterPredicate("test"))); }