public void GetDelegate_TwiceForSameMethod_CallsGetDelegateOnlyOnce() { var method = typeof(IMethodWithNoParameters).GetMethods()[0]; var methodBuilderMock = new Mock <IMethodBuilder>(); var cachedMethodBuilder = new CachedMethodBuilder(methodBuilderMock.Object); cachedMethodBuilder.GetDelegate(method); cachedMethodBuilder.GetDelegate(method); methodBuilderMock.Verify(m => m.GetDelegate(method), Times.Once()); }
public void GetDelegate_TwiceForSameMethod_CallsGetDelegateOnlyOnce() { var method = typeof(IMethodWithNoParameters).GetMethods()[0]; var methodBuilderMock = new Mock<IMethodBuilder>(); var cachedMethodBuilder = new CachedMethodBuilder(methodBuilderMock.Object); cachedMethodBuilder.GetDelegate(method); cachedMethodBuilder.GetDelegate(method); methodBuilderMock.Verify(m => m.GetDelegate(method),Times.Once()); }