public void PropertiesTab_GetProperties_InvokeObjectCustomAttributesNullContext_ReturnsExpected() { var tab = new PropertiesTab(); PropertyDescriptorCollection properties = tab.GetProperties(null, new ClassWithDefaultProperty(), new Attribute[] { new BrowsableAttribute(false) }); Assert.Equal(1, properties.Count); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.NotBrowsableProperty)]); }
public void PropertiesTab_GetProperties_InvokeObjectNullAttributes_ReturnsExpected() { var tab = new PropertiesTab(); PropertyDescriptorCollection properties = tab.GetProperties(new ClassWithDefaultProperty(), null); Assert.Equal(2, properties.Count); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.Value)]); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.BrowsableProperty)]); }
public void PropertiesTab_GetProperties_InvokeObjectEmptyAttributesNullContext_ReturnsExpected() { var tab = new PropertiesTab(); PropertyDescriptorCollection properties = tab.GetProperties(null, new ClassWithDefaultProperty(), Array.Empty <Attribute>()); Assert.Equal(3, properties.Count); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.Value)]); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.NotBrowsableProperty)]); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.BrowsableProperty)]); }
public void PropertiesTab_GetProperties_InvokeObjectNullAttributesCustomContextCustomTypeConverter_ReturnsExpected() { var tab = new PropertiesTab(); var mockTypeDescriptorContext = new Mock <ITypeDescriptorContext>(MockBehavior.Strict); mockTypeDescriptorContext .Setup(c => c.PropertyDescriptor) .Returns(TypeDescriptor.GetProperties(typeof(CustomTypeConverterParentClass))[0]) .Verifiable(); PropertyDescriptorCollection properties = tab.GetProperties(mockTypeDescriptorContext.Object, new ClassWithDefaultProperty(), null); Assert.Equal(1, properties.Count); Assert.NotNull(properties[nameof(ClassWithNameProperty.Name)]); mockTypeDescriptorContext.Verify(c => c.PropertyDescriptor, Times.Exactly(2)); }
public void PropertiesTab_GetProperties_InvokeObjectNullAttributesNullPropertyContextPropertiesSupported_ReturnsExpected() { var tab = new PropertiesTab(); var mockTypeDescriptorContext = new Mock <ITypeDescriptorContext>(MockBehavior.Strict); mockTypeDescriptorContext .Setup(c => c.PropertyDescriptor) .Returns((PropertyDescriptor)null) .Verifiable(); PropertyDescriptorCollection properties = tab.GetProperties(mockTypeDescriptorContext.Object, new ClassWithDefaultProperty(), null); Assert.Equal(2, properties.Count); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.Value)]); Assert.NotNull(properties[nameof(ClassWithDefaultProperty.BrowsableProperty)]); mockTypeDescriptorContext.Verify(c => c.PropertyDescriptor, Times.Once()); }
public void PropertiesTab_GetProperties_InvokeNullObject_ReturnsExpected() { var tab = new PropertiesTab(); Assert.Empty(tab.GetProperties(null)); }