示例#1
0
 public void ExceptionTest()
 {
     using (SapRfcConnection conn = this.GetConnection())
     {
         SharpRfcCallException ex = Assert.Throws <SharpRfcCallException>(() =>
         {
             var result = conn.ExecuteFunction("Z_SSRT_DIVIDE",
                                               new RfcParameter("i_num1", 5),
                                               new RfcParameter("i_num2", 0)
                                               );
         });
         Assert.Equal("DIVIDE_BY_ZERO", ex.Message);
     }
 }
        public void ExceptionToStringShouldReturnRequestBodyTest()
        {
            using (SapRfcConnection conn = this.GetConnection())
            {
                SharpRfcCallException ex = Assert.Throws <SharpRfcCallException>(() =>
                {
                    var result = conn.ExecuteFunction("Z_SSRT_DIVIDE", new
                    {
                        i_num1 = 2,
                        i_num2 = 0
                    });
                });

                Assert.Contains(this.GetExpectedRequestBody(), ex.ToString());
            }
        }