public void Dispose_ShouldDestroyFunction() { RfcErrorInfo errorInfo; _interopMock.Setup(x => x.GetFunctionDesc(It.IsAny <IntPtr>(), It.IsAny <string>(), out errorInfo)).Returns(FunctionDescriptionHandle); _interopMock.Setup(x => x.CreateFunction(It.IsAny <IntPtr>(), out errorInfo)).Returns(FunctionHandle); var rfcFunction = new RfcFunction(_interopMock.Object); IRfcFunction function = rfcFunction.CreateFunction(ConnectionMock.Object, "FunctonA"); function.Dispose(); _interopMock.Verify(x => x.DestroyFunction(FunctionHandle, out errorInfo), Times.Once); }