public void GetEvents_InvokeAttributesWithoutParent_ReturnsEmpty(Attribute[] attributes) { var descriptor = new SubCustomTypeDescriptor(); Assert.Same(EventDescriptorCollection.Empty, descriptor.GetEvents(attributes)); // Call again. Assert.Same(EventDescriptorCollection.Empty, descriptor.GetEvents(attributes)); }
public void GetEvents_InvokeAttributesWithParent_ReturnsExpected(Attribute[] attributes, EventDescriptorCollection result) { var mockParentDescriptor = new Mock <ICustomTypeDescriptor>(MockBehavior.Strict); mockParentDescriptor .Setup(d => d.GetEvents(attributes)) .Returns(result) .Verifiable(); var descriptor = new SubCustomTypeDescriptor(mockParentDescriptor.Object); Assert.Same(result, descriptor.GetEvents(attributes)); mockParentDescriptor.Verify(d => d.GetEvents(attributes), Times.Once()); // Call again. Assert.Same(result, descriptor.GetEvents(attributes)); mockParentDescriptor.Verify(d => d.GetEvents(attributes), Times.Exactly(2)); }