public void GetComponentName_InvokeWithoutParent_ReturnsNull() { var descriptor = new SubCustomTypeDescriptor(); Assert.Null(descriptor.GetComponentName()); // Call again. Assert.Null(descriptor.GetComponentName()); }
public void GetProperties_InvokeAttributesWithoutParent_ReturnsEmpty(Attribute[] attributes) { var descriptor = new SubCustomTypeDescriptor(); Assert.Same(PropertyDescriptorCollection.Empty, descriptor.GetProperties(attributes)); // Call again. Assert.Same(PropertyDescriptorCollection.Empty, descriptor.GetProperties(attributes)); }
public void GetPropertyOwner_InvokeWithoutParent_ReturnsNull(PropertyDescriptor pd) { var descriptor = new SubCustomTypeDescriptor(); Assert.Null(descriptor.GetPropertyOwner(pd)); // Call again. Assert.Null(descriptor.GetPropertyOwner(pd)); }
public void GetEvents_InvokeWithoutParent_ReturnsEmpty() { var descriptor = new SubCustomTypeDescriptor(); Assert.Same(EventDescriptorCollection.Empty, descriptor.GetEvents()); // Call again. Assert.Same(EventDescriptorCollection.Empty, descriptor.GetEvents()); }
public void GetEditor_InvokeWithoutParent_ReturnsNull(Type editorBaseType) { var descriptor = new SubCustomTypeDescriptor(); Assert.Null(descriptor.GetEditor(editorBaseType)); // Call again. Assert.Null(descriptor.GetEditor(editorBaseType)); }
public void GetDefaultProperty_InvokeWithoutParent_ReturnsNull() { var descriptor = new SubCustomTypeDescriptor(); Assert.Null(descriptor.GetDefaultProperty()); // Call again. Assert.Null(descriptor.GetDefaultProperty()); }
public void GetConverter_InvokeWithoutParent_ReturnsExpected() { var descriptor = new SubCustomTypeDescriptor(); TypeConverter result1 = Assert.IsType <TypeConverter>(descriptor.GetConverter()); Assert.NotNull(result1); // Call again. TypeConverter result2 = Assert.IsType <TypeConverter>(descriptor.GetConverter()); Assert.NotSame(result1, result2); }
public void GetComponentName_InvokeWithParent_ReturnsExpected(string result) { var mockParentDescriptor = new Mock <ICustomTypeDescriptor>(MockBehavior.Strict); mockParentDescriptor .Setup(d => d.GetComponentName()) .Returns(result) .Verifiable(); var descriptor = new SubCustomTypeDescriptor(mockParentDescriptor.Object); Assert.Same(result, descriptor.GetComponentName()); mockParentDescriptor.Verify(d => d.GetComponentName(), Times.Once()); // Call again. Assert.Same(result, descriptor.GetComponentName()); mockParentDescriptor.Verify(d => d.GetComponentName(), Times.Exactly(2)); }
public void GetProperties_InvokeAttributesWithParent_ReturnsExpected(Attribute[] attributes, PropertyDescriptorCollection result) { var mockParentDescriptor = new Mock <ICustomTypeDescriptor>(MockBehavior.Strict); mockParentDescriptor .Setup(d => d.GetProperties(attributes)) .Returns(result) .Verifiable(); var descriptor = new SubCustomTypeDescriptor(mockParentDescriptor.Object); Assert.Same(result, descriptor.GetProperties(attributes)); mockParentDescriptor.Verify(d => d.GetProperties(attributes), Times.Once()); // Call again. Assert.Same(result, descriptor.GetProperties(attributes)); mockParentDescriptor.Verify(d => d.GetProperties(attributes), Times.Exactly(2)); }