summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/dictMapping/Twoways.cs
blob: 043f55e8a503ad919f4782e4692eddb5e5d0dfc6 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

using System.Collections.Generic;

namespace Ice
{
    namespace dictMapping
    {
        class Twoways
        {
            private static void test(bool b)
            {
                if(!b)
                {
                    throw new System.Exception();
                }
            }

            internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p)
            {
                {
                    Dictionary<int, int> i = new Dictionary<int, int>();
                    i[0] = 1;
                    i[1] = 0;

                    Dictionary<int, int> o;
                    Dictionary<int, int> r;
                    r = p.opNV(i, out o);

                    test(Ice.CollectionComparer.Equals(i, o));
                    test(Ice.CollectionComparer.Equals(i, r));
                }

                {
                    Dictionary<string, string> i = new Dictionary<string, string>();
                    i["a"] = "b";
                    i["b"] = "a";

                    Dictionary<string, string> o;
                    Dictionary<string, string> r;
                    r = p.opNR(i, out o);

                    test(Ice.CollectionComparer.Equals(i, o));
                    test(Ice.CollectionComparer.Equals(i, r));
                }

                {
                    Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>();
                    Dictionary<int, int> id = new Dictionary<int, int>();
                    id[0] = 1;
                    id[1] = 0;
                    i["a"] = id;
                    i["b"] = id;

                    Dictionary<string, Dictionary<int, int>> o;
                    Dictionary<string, Dictionary<int, int>> r;
                    r = p.opNDV(i, out o);

                    foreach(string key in i.Keys)
                    {
                        test(Ice.CollectionComparer.Equals(i[key], o[key]));
                        test(Ice.CollectionComparer.Equals(i[key], r[key]));
                    }
                }

                {
                    Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>();
                    Dictionary<string, string> id = new Dictionary<string, string>();
                    id["a"] = "b";
                    id["b"] = "a";
                    i["a"] = id;
                    i["b"] = id;

                    Dictionary<string, Dictionary<string, string>> o;
                    Dictionary<string, Dictionary<string, string>> r;
                    r = p.opNDR(i, out o);

                    foreach(string key in i.Keys)
                    {
                        test(Ice.CollectionComparer.Equals(i[key], o[key]));
                        test(Ice.CollectionComparer.Equals(i[key], r[key]));
                    }
                }

                {
                    int[] ii = new int[] { 1, 2 };
                    Dictionary<string, int[]> i = new Dictionary<string, int[]>();
                    i["a"] = ii;
                    i["b"] = ii;

                    Dictionary<string, int[]> o;
                    Dictionary<string, int[]> r;
                    r = p.opNDAIS(i, out o);

                    foreach(string key in i.Keys)
                    {
                        test(Ice.CollectionComparer.Equals(i[key], o[key]));
                        test(Ice.CollectionComparer.Equals(i[key], r[key]));
                    }
                }

                {
                    List<int> ii = new List<int>();
                    ii.Add(1);
                    ii.Add(2);
                    Dictionary<string, List<int>> i = new Dictionary<string, List<int>>();
                    i["a"] = ii;
                    i["b"] = ii;

                    Dictionary<string, List<int>> o;
                    Dictionary<string, List<int>> r;
                    r = p.opNDGIS(i, out o);

                    foreach(string key in i.Keys)
                    {
                        test(Ice.CollectionComparer.Equals(i[key], o[key]));
                        test(Ice.CollectionComparer.Equals(i[key], r[key]));
                    }
                }

                {
                    string[] ii = new string[] { "a", "b" };
                    Dictionary<string, string[]> i = new Dictionary<string, string[]>();
                    i["a"] = ii;
                    i["b"] = ii;

                    Dictionary<string, string[]> o;
                    Dictionary<string, string[]> r;
                    r = p.opNDASS(i, out o);

                    foreach(string key in i.Keys)
                    {
                        test(Ice.CollectionComparer.Equals(i[key], o[key]));
                        test(Ice.CollectionComparer.Equals(i[key], r[key]));
                    }
                }

                {
                    List<string> ii = new List<string>();
                    ii.Add("a");
                    ii.Add("b");
                    Dictionary<string, List<string>> i = new Dictionary<string, List<string>>();
                    i["a"] = ii;
                    i["b"] = ii;

                    Dictionary<string, List<string>> o;
                    Dictionary<string, List<string>> r;
                    r = p.opNDGSS(i, out o);

                    foreach(string key in i.Keys)
                    {
                        test(Ice.CollectionComparer.Equals(i[key], o[key]));
                        test(Ice.CollectionComparer.Equals(i[key], r[key]));
                    }
                }
            }
        }
    }
}