Beispiel #1
0
        public void GetComponentName_InvokeWithoutParent_ReturnsNull()
        {
            var descriptor = new SubCustomTypeDescriptor();

            Assert.Null(descriptor.GetComponentName());

            // Call again.
            Assert.Null(descriptor.GetComponentName());
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        public void GetPropertyOwner_InvokeWithoutParent_ReturnsNull(PropertyDescriptor pd)
        {
            var descriptor = new SubCustomTypeDescriptor();

            Assert.Null(descriptor.GetPropertyOwner(pd));

            // Call again.
            Assert.Null(descriptor.GetPropertyOwner(pd));
        }
Beispiel #4
0
        public void GetEvents_InvokeWithoutParent_ReturnsEmpty()
        {
            var descriptor = new SubCustomTypeDescriptor();

            Assert.Same(EventDescriptorCollection.Empty, descriptor.GetEvents());

            // Call again.
            Assert.Same(EventDescriptorCollection.Empty, descriptor.GetEvents());
        }
Beispiel #5
0
        public void GetEditor_InvokeWithoutParent_ReturnsNull(Type editorBaseType)
        {
            var descriptor = new SubCustomTypeDescriptor();

            Assert.Null(descriptor.GetEditor(editorBaseType));

            // Call again.
            Assert.Null(descriptor.GetEditor(editorBaseType));
        }
Beispiel #6
0
        public void GetDefaultProperty_InvokeWithoutParent_ReturnsNull()
        {
            var descriptor = new SubCustomTypeDescriptor();

            Assert.Null(descriptor.GetDefaultProperty());

            // Call again.
            Assert.Null(descriptor.GetDefaultProperty());
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        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));
        }
Beispiel #9
0
        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));
        }