summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/namespacemd/AllTests.cs
blob: 3e78506304a953bc4187e7f7e6c036d1acf96041 (plain)
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
99
100
101
102
103
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

using Test;

namespace Ice
{
    namespace namespacemd
    {
        public class AllTests : global::Test.AllTests
        {
            public static Test.InitialPrx allTests(TestHelper helper)
            {
                var communicator = helper.communicator();
                var output = helper.getWriter();
                output.Write("testing stringToProxy... ");
                output.Flush();
                var @base = communicator.stringToProxy("initial:" + helper.getTestEndpoint(0));
                test(@base != null);
                output.WriteLine("ok");

                output.Write("testing checked cast... ");
                output.Flush();
                var initial = Test.InitialPrxHelper.checkedCast(@base);
                test(initial != null);
                test(initial.Equals(@base));
                output.WriteLine("ok");

                {
                    output.Write("testing types without package... ");
                    output.Flush();
                    NoNamespace.C1 c1 = initial.getNoNamespaceC2AsC1();
                    test(c1 != null);
                    test(c1 is NoNamespace.C2);
                    NoNamespace.C2 c2 = initial.getNoNamespaceC2AsC2();
                    test(c2 != null);
                    try
                    {
                        initial.throwNoNamespaceE2AsE1();
                        test(false);
                    }
                    catch(NoNamespace.E1 ex)
                    {
                        test(ex is NoNamespace.E2);
                    }
                    try
                    {
                        initial.throwNoNamespaceE2AsE2();
                        test(false);
                    }
                    catch(NoNamespace.E2)
                    {
                        // Expected
                    }
                    try
                    {
                        initial.throwNoNamespaceNotify();
                        test(false);
                    }
                    catch(NoNamespace.@notify)
                    {
                        // Expected
                    }
                    output.WriteLine("ok");
                }

                {
                    output.Write("testing types with package... ");
                    output.Flush();

                    {
                        WithNamespace.C1 c1 = initial.getWithNamespaceC2AsC1();
                        test(c1 != null);
                        test(c1 is WithNamespace.C2);
                        WithNamespace.C2 c2 = initial.getWithNamespaceC2AsC2();
                        test(c2 != null);
                        try
                        {
                            initial.throwWithNamespaceE2AsE1();
                            test(false);
                        }
                        catch(WithNamespace.E1 ex)
                        {
                            test(ex is WithNamespace.E2);
                        }
                        try
                        {
                            initial.throwWithNamespaceE2AsE2();
                            test(false);
                        }
                        catch(WithNamespace.E2)
                        {
                            // Expected
                        }
                        output.WriteLine("ok");
                    }
                }
                return initial;
            }
        }
    }
}