Exemple #1
0
        public void GetEditor_NoOverride_ReturnsDescriptorValue()
        {
            var baseEditor = new MockUITypeEditor();

            var mockDescriptor = new MockPropertyDescriptor();

            mockDescriptor.GetEditorResult = baseEditor;

            var dynamicDescriptor = new DynamicPropertyDescriptor(mockDescriptor);

            dynamicDescriptor.GetEditor(typeof(MockUITypeEditor)).Should().Be(baseEditor);
        }
Exemple #2
0
        public void GetEditor_MultipleOverrides_ReturnsMostRecentOverrideValue()
        {
            var baseEditor      = new MockUITypeEditor();
            var overrideEditor1 = new MockUITypeEditor();
            var overrideEditor2 = new MockUITypeEditor();

            var mockDescriptor = new MockPropertyDescriptor();

            mockDescriptor.GetEditorResult = baseEditor;

            var dynamicDescriptor = new DynamicPropertyDescriptor(mockDescriptor);

            dynamicDescriptor.SetEditor(typeof(MockUITypeEditor), overrideEditor1);
            dynamicDescriptor.SetEditor(typeof(MockUITypeEditor), overrideEditor2);

            dynamicDescriptor.GetEditor(typeof(MockUITypeEditor)).Should().Be(overrideEditor2);
        }
        public void GetEditor_Override_ReturnsOverrideValue()
        {
            MockUITypeEditor baseEditor = new MockUITypeEditor();
            MockUITypeEditor overrideEditor = new MockUITypeEditor();

            MockPropertyDescriptor mockDescriptor = new MockPropertyDescriptor();
            mockDescriptor.GetEditorResult = baseEditor;

            DynamicPropertyDescriptor dynamicDescriptor = new DynamicPropertyDescriptor(mockDescriptor);
            dynamicDescriptor.SetEditor(typeof(MockUITypeEditor), overrideEditor);

            Assert.That(dynamicDescriptor.GetEditor(typeof(MockUITypeEditor)), Is.EqualTo(overrideEditor));
        }