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