Beispiel #1
0
        public void ObjectSelectorEditor_Ctor_Bool(bool subObjectSelector)
        {
            var editor = new SubObjectSelectorEditor(subObjectSelector);

            Assert.False(editor.IsDropDownResizable);
            Assert.Equal(subObjectSelector, editor.SubObjectSelector);
        }
Beispiel #2
0
        public void ObjectSelectorEditor_Ctor_Default()
        {
            var editor = new SubObjectSelectorEditor();

            Assert.False(editor.IsDropDownResizable);
            Assert.False(editor.SubObjectSelector);
        }
Beispiel #3
0
        public void ObjectSelectorEditor_EqualsToValue_InvokeWithValue_ReturnsExpected()
        {
            var editor = new SubObjectSelectorEditor();

            editor.SetValue("value");
            Assert.True(editor.EqualsToValue("value"));
            Assert.False(editor.EqualsToValue("other value"));
            Assert.False(editor.EqualsToValue(null));
        }
Beispiel #4
0
        public void ObjectSelectorEditor_EditValue_ValidProvider_ReturnsValue(object value)
        {
            var editor              = new SubObjectSelectorEditor();
            var mockEditorService   = new Mock <IWindowsFormsEditorService>(MockBehavior.Strict);
            var mockServiceProvider = new Mock <IServiceProvider>(MockBehavior.Strict);

            mockServiceProvider
            .Setup(p => p.GetService(typeof(IWindowsFormsEditorService)))
            .Returns(mockEditorService.Object)
            .Verifiable();
            mockEditorService
            .Setup(e => e.DropDownControl(It.IsAny <Control>()))
            .Verifiable();
            Assert.Same(value, editor.EditValue(null, mockServiceProvider.Object, value));
            mockServiceProvider.Verify(p => p.GetService(typeof(IWindowsFormsEditorService)), Times.Once());
            mockEditorService.Verify(e => e.DropDownControl(It.IsAny <Control>()), Times.Once());

            // Edit again.
            Assert.Same(value, editor.EditValue(null, mockServiceProvider.Object, value));
            mockServiceProvider.Verify(p => p.GetService(typeof(IWindowsFormsEditorService)), Times.Exactly(2));
            mockServiceProvider.Verify(p => p.GetService(typeof(IWindowsFormsEditorService)), Times.Exactly(2));
        }
Beispiel #5
0
        public void ObjectSelectorEditor_GetPaintValueSupported_Invoke_ReturnsFalse(ITypeDescriptorContext context)
        {
            var editor = new SubObjectSelectorEditor();

            Assert.False(editor.GetPaintValueSupported(context));
        }
Beispiel #6
0
        public void ObjectSelectorEditor_GetEditStyle_Invoke_ReturnsDropDown(ITypeDescriptorContext context)
        {
            var editor = new SubObjectSelectorEditor();

            Assert.Equal(UITypeEditorEditStyle.DropDown, editor.GetEditStyle(context));
        }
Beispiel #7
0
        public void ObjectSelectorEditor_EditValue_InvalidProvider_ReturnsValue(IServiceProvider provider, object value)
        {
            var editor = new SubObjectSelectorEditor();

            Assert.Same(value, editor.EditValue(null, provider, value));
        }
Beispiel #8
0
        public void ObjectSelectorEditor_EqualsToValue_InvokeWithoutValue_ReturnsExpected(object value, bool expected)
        {
            var editor = new SubObjectSelectorEditor();

            Assert.Equal(expected, editor.EqualsToValue(value));
        }