public void GetDefaultEvent_InvokeWithoutParent_ReturnsNull() { var descriptor = new SubCustomTypeDescriptor(); Assert.Null(descriptor.GetDefaultEvent()); // Call again. Assert.Null(descriptor.GetDefaultEvent()); }
public void GetDefaultEvent_InvokeWithParent_ReturnsExpected(EventDescriptor result) { var mockParentDescriptor = new Mock <ICustomTypeDescriptor>(MockBehavior.Strict); mockParentDescriptor .Setup(d => d.GetDefaultEvent()) .Returns(result) .Verifiable(); var descriptor = new SubCustomTypeDescriptor(mockParentDescriptor.Object); Assert.Same(result, descriptor.GetDefaultEvent()); mockParentDescriptor.Verify(d => d.GetDefaultEvent(), Times.Once()); // Call again. Assert.Same(result, descriptor.GetDefaultEvent()); mockParentDescriptor.Verify(d => d.GetDefaultEvent(), Times.Exactly(2)); }