-
Notifications
You must be signed in to change notification settings - Fork 27
/
FunctionObjectTestCase.cs
63 lines (57 loc) · 1.74 KB
/
FunctionObjectTestCase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using SharpSapRfc.Plain;
using SharpSapRfc.Soap;
using SharpSapRfc.Test.FunctionObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
namespace SharpSapRfc.Test.TestCases
{
public class Soap_FunctionObjectTestCase : FunctionObjectTestCase
{
protected override SapRfcConnection GetConnection()
{
return new SoapSapRfcConnection("TST-SOAP");
}
}
public class Plain_FunctionObjectTestCase : FunctionObjectTestCase
{
protected override SapRfcConnection GetConnection()
{
return new PlainSapRfcConnection("TST");
}
}
public abstract class FunctionObjectTestCase
{
protected abstract SapRfcConnection GetConnection();
[Fact]
public void ObjectFunctionTest()
{
using (SapRfcConnection conn = GetConnection())
{
var result = conn.ExecuteFunction(new DivideTwoNumbersFunction(9, 2));
Assert.Equal(4.5m, result.Quotient);
Assert.Equal(1, result.Remainder);
}
}
[Fact]
public void ObjectFunctionWithSingleReturnValueTest()
{
using (SapRfcConnection conn = GetConnection())
{
int value = conn.ExecuteFunction(new SumOfTwoNumbersFunction(2, 8));
Assert.Equal(10, value);
}
}
[Fact]
public void ObjectFunctionWithTableReturnValueTest()
{
using (SapRfcConnection conn = GetConnection())
{
var customers = conn.ExecuteFunction(new GetAllCustomersFunction());
Assert.Equal(2, customers.Count());
}
}
}
}