Exemplo n.º 1
0
        public void CreateFromDescriptionHandle_ShouldCreateFunction()
        {
            // Act
            ISapFunction function = SapFunction.CreateFromDescriptionHandle(_interopMock.Object, RfcConnectionHandle, FunctionDescriptionHandle);

            // Assert
            function.Should().NotBeNull();
            RfcErrorInfo errorInfo;

            _interopMock.Verify(x => x.CreateFunction(FunctionDescriptionHandle, out errorInfo), Times.Once);
        }
Exemplo n.º 2
0
        public void CreateFunction_ShouldCreateFunction()
        {
            // Arrange
            var          connection = new SapConnection(_interopMock.Object, new SapConnectionParameters());
            RfcErrorInfo errorInfo;

            _interopMock
            .Setup(x => x.OpenConnection(It.IsAny <RfcConnectionParameter[]>(), It.IsAny <uint>(), out errorInfo))
            .Returns(RfcConnectionHandle);
            _interopMock
            .Setup(x => x.GetFunctionDesc(RfcConnectionHandle, "FunctionA", out errorInfo))
            .Returns(FunctionDescriptionHandle);

            connection.Connect();

            // Act
            ISapFunction function = connection.CreateFunction("FunctionA");

            // Assert
            function.Should().NotBeNull();
            _interopMock.Verify(x => x.CreateFunction(FunctionDescriptionHandle, out errorInfo), Times.Once);
        }