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 GetEditor_InvokeWithParent_ReturnsExpected(Type editorBaseType, Type result) { var mockParentDescriptor = new Mock <ICustomTypeDescriptor>(MockBehavior.Strict); mockParentDescriptor .Setup(d => d.GetEditor(editorBaseType)) .Returns(result) .Verifiable(); var descriptor = new SubCustomTypeDescriptor(mockParentDescriptor.Object); Assert.Same(result, descriptor.GetEditor(editorBaseType)); mockParentDescriptor.Verify(d => d.GetEditor(editorBaseType), Times.Once()); // Call again. Assert.Same(result, descriptor.GetEditor(editorBaseType)); mockParentDescriptor.Verify(d => d.GetEditor(editorBaseType), Times.Exactly(2)); }