public void GetAttributes_InvokeWithoutParent_ReturnsEmpty() { var descriptor = new SubCustomTypeDescriptor(); Assert.Same(AttributeCollection.Empty, descriptor.GetAttributes()); // Call again. Assert.Same(AttributeCollection.Empty, descriptor.GetAttributes()); }
public void GetAttributes_InvokeWithParent_ReturnsExpected(AttributeCollection result) { var mockParentDescriptor = new Mock <ICustomTypeDescriptor>(MockBehavior.Strict); mockParentDescriptor .Setup(d => d.GetAttributes()) .Returns(result) .Verifiable(); var descriptor = new SubCustomTypeDescriptor(mockParentDescriptor.Object); Assert.Same(result, descriptor.GetAttributes()); mockParentDescriptor.Verify(d => d.GetAttributes(), Times.Once()); // Call again. Assert.Same(result, descriptor.GetAttributes()); mockParentDescriptor.Verify(d => d.GetAttributes(), Times.Exactly(2)); }