コード例 #1
0
        public void ShouldReturnParentValue()
        {
            PropertyItemValue value    = new PropertyItemValue(new PropertyItemMock());
            PropertyItem      property = new PropertyItemMock(value);

            Assert.AreEqual(value, property.ParentValue);
        }
コード例 #2
0
        public void ShouldFailAddingDuplicateProperty()
        {
            PropertyItemMock property = new PropertyItemMock("property");
            CategoryItem     category = new CategoryItem(new PropertyGrid(), new CategoryAttribute());

            category.AddProperty(property);
            category.AddProperty(property);
        }
コード例 #3
0
        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]);
        }
コード例 #4
0
        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"]);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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]);
        }
コード例 #7
0
        public void ShouldFailMatchingPredicateForMissingDisplayNameAndPropertyType()
        {
            PropertyItemMock property = new PropertyItemMock();

            Assert.IsFalse(property.MatchesPredicate(new PropertyFilterPredicate("test")));
        }
コード例 #8
0
ファイル: PropertyItemTest.cs プロジェクト: GonzRu/WPG
        public void ShouldReturnParentValue()
        {
            PropertyItemValue value = new PropertyItemValue(new PropertyItemMock());
              PropertyItem property = new PropertyItemMock(value);

              Assert.AreEqual(value, property.ParentValue);
        }
コード例 #9
0
ファイル: PropertyItemTest.cs プロジェクト: GonzRu/WPG
 public void ShouldFailMatchingPredicateForMissingDisplayNameAndPropertyType()
 {
     PropertyItemMock property = new PropertyItemMock();
       Assert.IsFalse(property.MatchesPredicate(new PropertyFilterPredicate("test")));
 }