File: ServiceTestClient3.cs

package info (click to toggle)
robotraconteur 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,380 kB
  • sloc: cpp: 1,149,268; cs: 87,653; java: 58,127; python: 26,897; ansic: 356; sh: 152; makefile: 90; xml: 51
file content (98 lines) | stat: -rw-r--r-- 1,896 bytes parent folder | download
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.robotraconteur.testing.TestService5;
using RobotRaconteur;
using System.Threading;
using System.IO;
using System.Threading.Tasks;

namespace RobotRaconteurNETTest
{
public class ServiceTestClient3
{

    public void ConnectService(string url)
    {
        r = (asynctestroot)RobotRaconteurNode.s.ConnectService(url);
    }

    public void DisconnectService()
    {
        RobotRaconteurNode.s.DisconnectService(r);
    }

    asynctestroot r;

    public void RunFullTest(string url)
    {
        ConnectService(url);

        TestProperties();

        // TestFunctions();

        DisconnectService();
    }

    public void TestProperties()
    {
        RRAssert.AreEqual(r.d1, 8.5515);

        r.d1 = 3.0819;

        bool thrown1 = false;
        try
        {
            var res = r.err;
        }
        catch (ArgumentException err)
        {
            thrown1 = true;
            RRAssert.AreEqual(err.Message, "Test message 1");
        }
        RRAssert.IsTrue(thrown1);

        bool thrown2 = false;
        try
        {
            r.err = 10;
        }
        catch (InvalidOperationException err)
        {
            thrown2 = true;
            RRAssert.AreEqual(err.Message, "");
        }
        RRAssert.IsTrue(thrown2);
    }

    public void TestFunctions()
    {
        r.f1();
        r.f2(247);

        bool thrown1 = false;
        try
        {
            r.err_func();
        }
        catch (InvalidOperationException)
        {
            thrown1 = true;
        }
        RRAssert.IsTrue(thrown1);

        bool thrown2 = false;
        try
        {
            r.err_func2();
        }
        catch (com.robotraconteur.testing.TestService5.asynctestexp)
        {
            thrown2 = true;
        }
        RRAssert.IsTrue(thrown2);
    }
}
}