示例#1
0
        public void ConstructorReadOnlyTests()
        {
            var descriptors = new PropertyDescriptor[]
            {
                new MockPropertyDescriptor("descriptor1")
            };

            var collection = new PropertyDescriptorCollection(descriptors, true);

            Assert.Equal(descriptors.Cast <PropertyDescriptor>(), collection.Cast <PropertyDescriptor>());

            // These methods are implemented as explicit properties so we need to ensure they are what we expect
            Assert.True(((IDictionary)collection).IsReadOnly);
            Assert.True(((IDictionary)collection).IsFixedSize);
            Assert.True(((IList)collection).IsReadOnly);
            Assert.True(((IList)collection).IsFixedSize);
        }
        public void ConstructorReadOnlyTests()
        {
            var descriptors = new PropertyDescriptor[]
            {
                new MockPropertyDescriptor("descriptor1")
            };

            var collection = new PropertyDescriptorCollection(descriptors, true);

            Assert.Equal(descriptors.Cast<PropertyDescriptor>(), collection.Cast<PropertyDescriptor>());

            // These methods are implemented as explicit properties so we need to ensure they are what we expect
            Assert.True(((IDictionary)collection).IsReadOnly);
            Assert.True(((IDictionary)collection).IsFixedSize);
            Assert.True(((IList)collection).IsReadOnly);
            Assert.True(((IList)collection).IsFixedSize);
        }