Example #1
0
        public static async Task RunAsync(TestHelper helper)
        {
            Communicator communicator = helper.Communicator;

            TextWriter output = helper.Output;

            var initial = IInitialPrx.Parse(helper.GetTestProxy("initial", 0), communicator);

            TestHelper.Assert(initial != null);
            output.Write("getting B1... ");
            output.Flush();
            B?b1 = initial.GetB1();

            TestHelper.Assert(b1 != null);
            output.WriteLine("ok");

            output.Write("getting B2... ");
            output.Flush();
            B?b2 = initial.GetB2();

            TestHelper.Assert(b2 != null);
            output.WriteLine("ok");

            output.Write("getting C... ");
            output.Flush();
            C?c = initial.GetC();

            TestHelper.Assert(c != null);
            output.WriteLine("ok");

            output.Write("getting D... ");
            output.Flush();
            D?d = initial.GetD();

            TestHelper.Assert(d != null);
            output.WriteLine("ok");

            output.Write("checking consistency... ");
            output.Flush();
            TestHelper.Assert(b1 != b2);
            TestHelper.Assert(b1.TheB == b1);
            TestHelper.Assert(b1.TheC == null);
            TestHelper.Assert(b1.TheA is B);
            TestHelper.Assert(((B)b1.TheA).TheA == b1.TheA);
            TestHelper.Assert(((B)b1.TheA).TheB == b1);
            TestHelper.Assert(((B)b1.TheA).TheC !.TheB == b1.TheA);

            // More tests possible for b2 and d, but I think this is already
            // sufficient.
            TestHelper.Assert(b2.TheA == b2);
            TestHelper.Assert(d.TheC == null);
            output.WriteLine("ok");

            output.Write("getting B1, B2, C, and D all at once... ");
            output.Flush();
            (B? b1out, B? b2out, C? cout, D? dout) = initial.GetAll();
            TestHelper.Assert(b1out != null);
            TestHelper.Assert(b2out != null);
            TestHelper.Assert(cout != null);
            TestHelper.Assert(dout != null);
            output.WriteLine("ok");

            output.Write("checking consistency... ");
            output.Flush();
            TestHelper.Assert(b1out != b2out);
            TestHelper.Assert(b1out.TheA == b2out);
            TestHelper.Assert(b1out.TheB == b1out);
            TestHelper.Assert(b1out.TheC == null);
            TestHelper.Assert(b2out.TheA == b2out);
            TestHelper.Assert(b2out.TheB == b1out);
            TestHelper.Assert(b2out.TheC == cout);
            TestHelper.Assert(cout.TheB == b2out);
            TestHelper.Assert(dout.TheA == b1out);
            TestHelper.Assert(dout.TheB == b2out);
            TestHelper.Assert(dout.TheC == null);

            output.WriteLine("ok");

            output.Write("getting K... ");
            {
                output.Flush();
                K?  k = initial.GetK();
                var l = k !.Value as L;
                TestHelper.Assert(l != null);
                TestHelper.Assert(l.Data.Equals("l"));
            }
            output.WriteLine("ok");

            output.Write("testing AnyClass as parameter... ");
            output.Flush();
            {
                AnyClass v1 = new L("l");
                (AnyClass? v3, AnyClass? v2) = initial.OpClass(v1);
                TestHelper.Assert(((L)v2 !).Data.Equals("l"));
                TestHelper.Assert(((L)v3 !).Data.Equals("l"));
            }
            {
                var l  = new L("l");
                var v1 = new AnyClass[] { l };
                (AnyClass?[] v3, AnyClass?[] v2) = initial.OpClassSeq(v1);
                TestHelper.Assert(((L)v2[0] !).Data.Equals("l"));
                TestHelper.Assert(((L)v3[0] !).Data.Equals("l"));
            }
            {
                var l  = new L("l");
                var v1 = new Dictionary <string, AnyClass?> {
                    { "l", l }
                };
                (Dictionary <string, AnyClass?> v3, Dictionary <string, AnyClass?> v2) = initial.OpClassMap(v1);
                TestHelper.Assert(((L)v2["l"] !).Data.Equals("l"));
                TestHelper.Assert(((L)v3["l"] !).Data.Equals("l"));
            }
            output.WriteLine("ok");

            output.Write("getting D1... ");
            output.Flush();
            D1?d1 = initial.GetD1(new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4")));

            TestHelper.Assert(d1 !.A1 !.Name.Equals("a1"));
            TestHelper.Assert(d1 !.A2 !.Name.Equals("a2"));
            TestHelper.Assert(d1 !.A3 !.Name.Equals("a3"));
            TestHelper.Assert(d1 !.A4 !.Name.Equals("a4"));
            output.WriteLine("ok");

            output.Write("throw EDerived... ");
            output.Flush();
            try
            {
                initial.ThrowEDerived();
                TestHelper.Assert(false);
            }
            catch (EDerived ederived)
            {
                TestHelper.Assert(ederived.A1 !.Name.Equals("a1"));
                TestHelper.Assert(ederived.A2 !.Name.Equals("a2"));
                TestHelper.Assert(ederived.A3 !.Name.Equals("a3"));
                TestHelper.Assert(ederived.A4 !.Name.Equals("a4"));
            }
            output.WriteLine("ok");

            output.Write("setting G... ");
            output.Flush();
            try
            {
                initial.SetG(new G(new S("hello"), "g"));
            }
            catch (OperationNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing sequences...");
            output.Flush();
            try
            {
                Base[] inS = Array.Empty <Base>();
                (Base?[] retS, Base?[] outS) = initial.OpBaseSeq(inS);

                inS          = new Base[1];
                inS[0]       = new Base(new S(""), "");
                (retS, outS) = initial.OpBaseSeq(inS);
                TestHelper.Assert(retS.Length == 1 && outS.Length == 1);
            }
            catch (OperationNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing recursive type... ");
            output.Flush();
            var       top   = new Recursive();
            Recursive p     = top;
            int       depth = 0;

            try
            {
                for (; depth <= 1000; ++depth)
                {
                    p.V = new Recursive();
                    p   = p.V;
                    if ((depth < 10 && (depth % 10) == 0) ||
                        (depth < 1000 && (depth % 100) == 0) ||
                        (depth < 10000 && (depth % 1000) == 0) ||
                        (depth % 10000) == 0)
                    {
                        initial.SetRecursive(top);
                    }
                }
                TestHelper.Assert(!initial.SupportsClassGraphMaxDepth());
            }
            catch (UnhandledException)
            {
                // Expected marshal exception from the server (max class graph depth reached)
                // Expected stack overflow from the server(Java only)
            }
            initial.SetRecursive(new Recursive());
            output.WriteLine("ok");

            output.Write("testing compact ID...");
            output.Flush();
            try
            {
                TestHelper.Assert(initial.GetCompact() != null);
            }
            catch (OperationNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing marshaled results...");
            output.Flush();
            b1 = initial.GetMB();
            TestHelper.Assert(b1 != null && b1.TheB == b1);
            b1 = initial.GetAMDMBAsync().Result;
            TestHelper.Assert(b1 != null && b1.TheB == b1);
            output.WriteLine("ok");

            output.Write("testing UnexpectedObjectException...");
            output.Flush();
            var uoet = IUnexpectedObjectExceptionTestPrx.Parse(helper.GetTestProxy("uoet", 0), communicator);

            try
            {
                uoet.Op();
                TestHelper.Assert(false);
            }
            catch (InvalidDataException ex)
            {
                TestHelper.Assert(ex.Message.Contains("ZeroC.Ice.Test.Objects.AlsoEmpty"));
                TestHelper.Assert(ex.Message.Contains("ZeroC.Ice.Test.Objects.Empty"));
            }
            catch (System.Exception ex)
            {
                output.WriteLine(ex.ToString());
                TestHelper.Assert(false);
            }
            output.WriteLine("ok");

            output.Write("testing partial Initialize...");
            output.Flush();
            var ib1 = new IBase();

            TestHelper.Assert(ib1.Id.Equals("My id"));
            var id1 = new IDerived();

            TestHelper.Assert(id1.Id.Equals("My id"));
            TestHelper.Assert(id1.Name.Equals("My name"));

            var id2 = new IDerived2();

            TestHelper.Assert(id2.Id.Equals("My id"));
            var i2 = new I2();

            TestHelper.Assert(i2.Called);

            var s1 = new S1();

            // The struct default constructor do not call ice_initialize
            TestHelper.Assert(s1.Id == 0);
            s1 = new S1(2);
            // The id should have the value set by ice_initialize and not 2
            TestHelper.Assert(s1.Id == 1);

            output.WriteLine("ok");

            output.Write("testing class containing complex dictionary... ");
            output.Flush();
            {
                var m  = new M(new Dictionary <StructKey, L?>());
                var k1 = new StructKey(1, "1");
                m.V[k1] = new L("one");
                var k2 = new StructKey(2, "2");
                m.V[k2]        = new L("two");
                (M? m2, M? m1) = initial.OpM(m);
                TestHelper.Assert(m1 != null && m2 != null);
                TestHelper.Assert(m1.V.Count == 2);
                TestHelper.Assert(m2.V.Count == 2);

                TestHelper.Assert(m1.V[k1] !.Data.Equals("one"));
                TestHelper.Assert(m2.V[k1] !.Data.Equals("one"));

                TestHelper.Assert(m1.V[k2] !.Data.Equals("two"));
                TestHelper.Assert(m2.V[k2] !.Data.Equals("two"));
            }
            output.WriteLine("ok");

            output.Write("testing forward declared types... ");
            output.Flush();
            {
                (F1? f11, F1? f12) = initial.OpF1(new F1("F11"));
                TestHelper.Assert(f11 !.Name.Equals("F11"));
                TestHelper.Assert(f12 !.Name.Equals("F12"));

                (IF2Prx? f21, IF2Prx? f22) =
                    initial.OpF2(IF2Prx.Parse(helper.GetTestProxy("F21"), communicator));
                TestHelper.Assert(f21 !.Identity.Name.Equals("F21"));
                f21.Op();
                TestHelper.Assert(f22 !.Identity.Name.Equals("F22"));

                if (initial.HasF3())
                {
                    (F3? f31, F3? f32) = initial.OpF3(new F3(new F1("F11"), IF2Prx.Parse("F21", communicator)));

                    TestHelper.Assert(f31 !.F1 !.Name.Equals("F11"));
                    TestHelper.Assert(f31 !.F2 !.Identity.Name.Equals("F21"));

                    TestHelper.Assert(f32 !.F1 !.Name.Equals("F12"));
                    TestHelper.Assert(f32 !.F2 !.Identity.Name.Equals("F22"));
                }
            }
            output.WriteLine("ok");

            await initial.ShutdownAsync();
        }
Example #2
0
    public static InitialPrx allTests(TestCommon.Application app)
    {
        Ice.Communicator communicator = app.communicator();
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::B");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::C");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::D");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::E");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::F");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::I");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::J");
        communicator.getValueFactoryManager().add(MyValueFactory, "::Test::H");

// Disable Obsolete warning/error
#pragma warning disable 612, 618
        communicator.addObjectFactory(new MyObjectFactory(), "TestOF");
#pragma warning restore 612, 618

        Write("testing stringToProxy... ");
        Flush();
        String        @ref  = "initial:" + app.getTestEndpoint(0);
        Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
        test(@base != null);
        WriteLine("ok");

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

        Write("getting B1... ");
        Flush();
        B b1 = initial.getB1();
        test(b1 != null);
        WriteLine("ok");

        Write("getting B2... ");
        Flush();
        B b2 = initial.getB2();
        test(b2 != null);
        WriteLine("ok");

        Write("getting C... ");
        Flush();
        C c = initial.getC();
        test(c != null);
        WriteLine("ok");

        Write("getting D... ");
        Flush();
        D d = initial.getD();
        test(d != null);
        WriteLine("ok");

        Write("checking consistency... ");
        Flush();
        test(b1 != b2);
        //test(b1 != c);
        //test(b1 != d);
        //test(b2 != c);
        //test(b2 != d);
        //test(c != d);
        test(b1.theB == b1);
        test(b1.theC == null);
        test(b1.theA is B);
        test(((B)b1.theA).theA == b1.theA);
        test(((B)b1.theA).theB == b1);
        //test(((B)b1.theA).theC is C); // Redundant -- theC is always of type C
        test(((C)(((B)b1.theA).theC)).theB == b1.theA);
        test(b1.preMarshalInvoked);
        test(b1.postUnmarshalInvoked);
        test(b1.theA.preMarshalInvoked);
        test(b1.theA.postUnmarshalInvoked);
        test(((B)b1.theA).theC.preMarshalInvoked);
        test(((B)b1.theA).theC.postUnmarshalInvoked);

        // More tests possible for b2 and d, but I think this is already
        // sufficient.
        test(b2.theA == b2);
        test(d.theC == null);
        WriteLine("ok");

        Write("getting B1, B2, C, and D all at once... ");
        Flush();
        B b1out;
        B b2out;
        C cout;
        D dout;
        initial.getAll(out b1out, out b2out, out cout, out dout);
        test(b1out != null);
        test(b2out != null);
        test(cout != null);
        test(dout != null);
        WriteLine("ok");

        Write("checking consistency... ");
        Flush();
        test(b1out != b2out);
        test(b1out.theA == b2out);
        test(b1out.theB == b1out);
        test(b1out.theC == null);
        test(b2out.theA == b2out);
        test(b2out.theB == b1out);
        test(b2out.theC == cout);
        test(cout.theB == b2out);
        test(dout.theA == b1out);
        test(dout.theB == b2out);
        test(dout.theC == null);
        test(dout.preMarshalInvoked);
        test(dout.postUnmarshalInvoked);
        test(dout.theA.preMarshalInvoked);
        test(dout.theA.postUnmarshalInvoked);
        test(dout.theB.preMarshalInvoked);
        test(dout.theB.postUnmarshalInvoked);
        test(dout.theB.theC.preMarshalInvoked);
        test(dout.theB.theC.postUnmarshalInvoked);

        WriteLine("ok");

        Write("testing protected members... ");
        Flush();
        EI e = (EI)initial.getE();
        test(e != null && e.checkValues());
        System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.NonPublic |
                                               System.Reflection.BindingFlags.Public |
                                               System.Reflection.BindingFlags.Instance;
        test(!typeof(E).GetField("i", flags).IsPublic&& !typeof(E).GetField("i", flags).IsPrivate);
        test(!typeof(E).GetField("s", flags).IsPublic&& !typeof(E).GetField("s", flags).IsPrivate);
        FI f = (FI)initial.getF();
        test(f.checkValues());
        test(((EI)f.e2).checkValues());
        test(!typeof(F).GetField("e1", flags).IsPublic&& !typeof(F).GetField("e1", flags).IsPrivate);
        test(typeof(F).GetField("e2", flags).IsPublic&& !typeof(F).GetField("e2", flags).IsPrivate);
        WriteLine("ok");

        Write("getting I, J and H... ");
        Flush();
        var i = initial.getI();
        test(i != null);
        var j = initial.getJ();
        test(j != null);
        var h = initial.getH();
        test(h != null);
        WriteLine("ok");

        Write("getting D1... ");
        Flush();
        D1 d1 = new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4"));
        d1 = initial.getD1(d1);
        test(d1.a1.name.Equals("a1"));
        test(d1.a2.name.Equals("a2"));
        test(d1.a3.name.Equals("a3"));
        test(d1.a4.name.Equals("a4"));
        WriteLine("ok");

        Write("throw EDerived... ");
        Flush();
        try
        {
            initial.throwEDerived();
            test(false);
        }
        catch (EDerived ederived)
        {
            test(ederived.a1.name.Equals("a1"));
            test(ederived.a2.name.Equals("a2"));
            test(ederived.a3.name.Equals("a3"));
            test(ederived.a4.name.Equals("a4"));
        }
        WriteLine("ok");

        Write("setting G... ");
        Flush();
        try
        {
            initial.setG(new G(new S("hello"), "g"));
        }
        catch (Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("setting I... ");
        Flush();
        initial.setI(i);
        initial.setI(j);
        initial.setI(h);
        WriteLine("ok");

        Write("testing sequences...");
        Flush();
        try
        {
            Base[] inS = new Base[0];
            Base[] outS;
            Base[] retS;
            retS = initial.opBaseSeq(inS, out outS);

            inS    = new Base[1];
            inS[0] = new Base(new S(), "");
            retS   = initial.opBaseSeq(inS, out outS);
            test(retS.Length == 1 && outS.Length == 1);
        }
        catch (Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("testing recursive type... ");
        Flush();
        Recursive top   = new Recursive();
        Recursive p     = top;
        int       depth = 0;
        try
        {
            for (; depth <= 1000; ++depth)
            {
                p.v = new Recursive();
                p   = p.v;
                if ((depth < 10 && (depth % 10) == 0) ||
                    (depth < 1000 && (depth % 100) == 0) ||
                    (depth < 10000 && (depth % 1000) == 0) ||
                    (depth % 10000) == 0)
                {
                    initial.setRecursive(top);
                }
            }
            test(!initial.supportsClassGraphDepthMax());
        }
        catch (Ice.UnknownLocalException)
        {
            // Expected marshal exception from the server (max class graph depth reached)
        }
        catch (Ice.UnknownException)
        {
            // Expected stack overflow from the server (Java only)
        }
        initial.setRecursive(new Recursive());
        WriteLine("ok");

        Write("testing compact ID...");
        Flush();
        try
        {
            test(initial.getCompact() != null);
        }
        catch (Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("testing marshaled results...");
        Flush();
        b1 = initial.getMB();
        test(b1 != null && b1.theB == b1);
        b1 = initial.getAMDMBAsync().Result;
        test(b1 != null && b1.theB == b1);
        WriteLine("ok");

        Write("testing UnexpectedObjectException...");
        Flush();
        @ref  = "uoet:" + app.getTestEndpoint(0);
        @base = communicator.stringToProxy(@ref);
        test(@base != null);
        UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base);
        test(uoet != null);
        try
        {
            uoet.op();
            test(false);
        }
        catch (Ice.UnexpectedObjectException ex)
        {
            test(ex.type.Equals("::Test::AlsoEmpty"));
            test(ex.expectedType.Equals("::Test::Empty"));
        }
        catch (System.Exception ex)
        {
            WriteLine(ex.ToString());
            test(false);
        }
        WriteLine("ok");

// Disable Obsolete warning/error
#pragma warning disable 612, 618
        Write("testing getting ObjectFactory...");
        Flush();
        test(communicator.findObjectFactory("TestOF") != null);
        WriteLine("ok");
        Write("testing getting ObjectFactory as ValueFactory...");
        Flush();
        test(communicator.getValueFactoryManager().find("TestOF") != null);
        WriteLine("ok");
#pragma warning restore 612, 618

        Write("testing partial ice_initialize...");
        Flush();
        var ib1 = new IBase();
        test(ib1.id.Equals("My id"));
        var id1 = new IDerived();
        test(id1.id.Equals("My id"));
        test(id1.name.Equals("My name"));

        var id2 = new IDerived2();
        test(id2.id.Equals("My id"));
        var i2 = new I2();
        test(i2.called);

        var s1 = new S1();
        // The struct default constructor do not call ice_initialize
        test(s1.id == 0);
        s1 = new S1(2);
        // The id should have the value set by ice_initialize and not 2
        test(s1.id == 1);

        var sc1 = new SC1();
        test(sc1.id.Equals("My id"));
        WriteLine("ok");
        return(initial);
    }
Example #3
0
        public static IInitialPrx allTests(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            var output = helper.GetWriter();

            var initial = IInitialPrx.Parse($"initial:{helper.GetTestEndpoint(0)}", communicator);

            TestHelper.Assert(initial != null);
            output.Write("getting B1... ");
            output.Flush();
            B?b1 = initial.getB1();

            TestHelper.Assert(b1 != null);
            output.WriteLine("ok");

            output.Write("getting B2... ");
            output.Flush();
            B?b2 = initial.getB2();

            TestHelper.Assert(b2 != null);
            output.WriteLine("ok");

            output.Write("getting C... ");
            output.Flush();
            C?c = initial.getC();

            TestHelper.Assert(c != null);
            output.WriteLine("ok");

            output.Write("getting D... ");
            output.Flush();
            D?d = initial.getD();

            TestHelper.Assert(d != null);
            output.WriteLine("ok");

            output.Write("checking consistency... ");
            output.Flush();
            TestHelper.Assert(b1 != b2);
            //TestHelper.Assert(b1 != c);
            //TestHelper.Assert(b1 != d);
            //TestHelper.Assert(b2 != c);
            //TestHelper.Assert(b2 != d);
            //TestHelper.Assert(c != d);
            TestHelper.Assert(b1.theB == b1);
            TestHelper.Assert(b1.theC == null);
            TestHelper.Assert(b1.theA is B);
            TestHelper.Assert(((B)b1.theA).theA == b1.theA);
            TestHelper.Assert(((B)b1.theA).theB == b1);
            //TestHelper.Assert(((B)b1.theA).theC is C); // Redundant -- theC is always of type C
            TestHelper.Assert(((B)b1.theA).theC !.theB == b1.theA);

            // More tests possible for b2 and d, but I think this is already
            // sufficient.
            TestHelper.Assert(b2.theA == b2);
            TestHelper.Assert(d.theC == null);
            output.WriteLine("ok");

            output.Write("getting B1, B2, C, and D all at once... ");
            output.Flush();
            var(b1out, b2out, cout, dout) = initial.getAll();
            TestHelper.Assert(b1out != null);
            TestHelper.Assert(b2out != null);
            TestHelper.Assert(cout != null);
            TestHelper.Assert(dout != null);
            output.WriteLine("ok");

            output.Write("checking consistency... ");
            output.Flush();
            TestHelper.Assert(b1out != b2out);
            TestHelper.Assert(b1out.theA == b2out);
            TestHelper.Assert(b1out.theB == b1out);
            TestHelper.Assert(b1out.theC == null);
            TestHelper.Assert(b2out.theA == b2out);
            TestHelper.Assert(b2out.theB == b1out);
            TestHelper.Assert(b2out.theC == cout);
            TestHelper.Assert(cout.theB == b2out);
            TestHelper.Assert(dout.theA == b1out);
            TestHelper.Assert(dout.theB == b2out);
            TestHelper.Assert(dout.theC == null);

            output.WriteLine("ok");

            output.Write("getting K... ");
            {
                output.Flush();
                K?  k = initial.getK();
                var l = k !.value as L;
                TestHelper.Assert(l != null);
                TestHelper.Assert(l.data.Equals("l"));
            }
            output.WriteLine("ok");

            output.Write("testing AnyClass as parameter... ");
            output.Flush();
            {
                AnyClass v1 = new L("l");
                (AnyClass? v3, AnyClass? v2) = initial.opClass(v1);
                TestHelper.Assert(((L)v2 !).data.Equals("l"));
                TestHelper.Assert(((L)v3 !).data.Equals("l"));
            }
            {
                L          l  = new L("l");
                AnyClass[] v1 = new AnyClass[] { l };
                (AnyClass?[] v3, AnyClass?[] v2) = initial.opClassSeq(v1);
                TestHelper.Assert(((L)v2[0] !).data.Equals("l"));
                TestHelper.Assert(((L)v3[0] !).data.Equals("l"));
            }
            {
                var l  = new L("l");
                var v1 = new Dictionary <string, AnyClass?> {
                    { "l", l }
                };
                (Dictionary <string, AnyClass?> v3, Dictionary <string, AnyClass?> v2) = initial.opClassMap(v1);
                TestHelper.Assert(((L)v2["l"] !).data.Equals("l"));
                TestHelper.Assert(((L)v3["l"] !).data.Equals("l"));
            }
            output.WriteLine("ok");

            output.Write("getting D1... ");
            output.Flush();
            D1?d1 = initial.getD1(new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4")));

            TestHelper.Assert(d1 !.a1 !.name.Equals("a1"));
            TestHelper.Assert(d1 !.a2 !.name.Equals("a2"));
            TestHelper.Assert(d1 !.a3 !.name.Equals("a3"));
            TestHelper.Assert(d1 !.a4 !.name.Equals("a4"));
            output.WriteLine("ok");

            output.Write("throw EDerived... ");
            output.Flush();
            try
            {
                initial.throwEDerived();
                TestHelper.Assert(false);
            }
            catch (EDerived ederived)
            {
                TestHelper.Assert(ederived.a1 !.name.Equals("a1"));
                TestHelper.Assert(ederived.a2 !.name.Equals("a2"));
                TestHelper.Assert(ederived.a3 !.name.Equals("a3"));
                TestHelper.Assert(ederived.a4 !.name.Equals("a4"));
            }
            output.WriteLine("ok");

            output.Write("setting G... ");
            output.Flush();
            try
            {
                initial.setG(new G(new S("hello"), "g"));
            }
            catch (OperationNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing sequences...");
            output.Flush();
            try
            {
                Base[] inS = new Base[0];
                var(retS, outS) = initial.opBaseSeq(inS);

                inS          = new Base[1];
                inS[0]       = new Base(new S(""), "");
                (retS, outS) = initial.opBaseSeq(inS);
                TestHelper.Assert(retS.Length == 1 && outS.Length == 1);
            }
            catch (OperationNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing recursive type... ");
            output.Flush();
            var top   = new Test.Recursive();
            var p     = top;
            int depth = 0;

            try
            {
                for (; depth <= 1000; ++depth)
                {
                    p.v = new Recursive();
                    p   = p.v;
                    if ((depth < 10 && (depth % 10) == 0) ||
                        (depth < 1000 && (depth % 100) == 0) ||
                        (depth < 10000 && (depth % 1000) == 0) ||
                        (depth % 10000) == 0)
                    {
                        initial.setRecursive(top);
                    }
                }
                TestHelper.Assert(!initial.supportsClassGraphDepthMax());
            }
            catch (UnhandledException)
            {
                // Expected marshal exception from the server (max class graph depth reached)
                // Expected stack overflow from the server(Java only)
            }
            initial.setRecursive(new Recursive());
            output.WriteLine("ok");

            output.Write("testing compact ID...");
            output.Flush();
            try
            {
                TestHelper.Assert(initial.getCompact() != null);
            }
            catch (OperationNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing marshaled results...");
            output.Flush();
            b1 = initial.getMB();
            TestHelper.Assert(b1 != null && b1.theB == b1);
            b1 = initial.getAMDMBAsync().Result;
            TestHelper.Assert(b1 != null && b1.theB == b1);
            output.WriteLine("ok");

            output.Write("testing UnexpectedObjectException...");
            output.Flush();
            var uoet = IUnexpectedObjectExceptionTestPrx.Parse($"uoet:{helper.GetTestEndpoint(0)}", communicator);

            try
            {
                uoet.op();
                TestHelper.Assert(false);
            }
            catch (InvalidDataException ex)
            {
                TestHelper.Assert(ex.Message.Contains("Test.AlsoEmpty"));
                TestHelper.Assert(ex.Message.Contains("Test.Empty"));
            }
            catch (System.Exception ex)
            {
                output.WriteLine(ex.ToString());
                TestHelper.Assert(false);
            }
            output.WriteLine("ok");

            output.Write("testing partial Initialize...");
            output.Flush();
            var ib1 = new IBase();

            TestHelper.Assert(ib1.id.Equals("My id"));
            var id1 = new IDerived();

            TestHelper.Assert(id1.id.Equals("My id"));
            TestHelper.Assert(id1.name.Equals("My name"));

            var id2 = new IDerived2();

            TestHelper.Assert(id2.id.Equals("My id"));
            var i2 = new I2();

            TestHelper.Assert(i2.Called);

            var s1 = new S1();

            // The struct default constructor do not call ice_initialize
            TestHelper.Assert(s1.id == 0);
            s1 = new S1(2);
            // The id should have the value set by ice_initialize and not 2
            TestHelper.Assert(s1.id == 1);

            output.WriteLine("ok");

            output.Write("testing class containing complex dictionary... ");
            output.Flush();
            {
                var m  = new M(new Dictionary <StructKey, L?>());
                var k1 = new StructKey(1, "1");
                m.v[k1] = new L("one");
                var k2 = new StructKey(2, "2");
                m.v[k2]        = new L("two");
                (M? m2, M? m1) = initial.opM(m);
                TestHelper.Assert(m1 != null && m2 != null);
                TestHelper.Assert(m1.v.Count == 2);
                TestHelper.Assert(m2.v.Count == 2);

                TestHelper.Assert(m1.v[k1] !.data.Equals("one"));
                TestHelper.Assert(m2.v[k1] !.data.Equals("one"));

                TestHelper.Assert(m1.v[k2] !.data.Equals("two"));
                TestHelper.Assert(m2.v[k2] !.data.Equals("two"));
            }
            output.WriteLine("ok");

            output.Write("testing forward declared types... ");
            output.Flush();
            {
                (F1? f11, F1? f12) = initial.opF1(new F1("F11"));
                TestHelper.Assert(f11 !.name.Equals("F11"));
                TestHelper.Assert(f12 !.name.Equals("F12"));

                (IF2Prx? f21, IF2Prx? f22) =
                    initial.opF2(IF2Prx.Parse($"F21:{helper.GetTestEndpoint()}", communicator));
                TestHelper.Assert(f21 !.Identity.Name.Equals("F21"));
                f21.op();
                TestHelper.Assert(f22 !.Identity.Name.Equals("F22"));

                if (initial.hasF3())
                {
                    (F3? f31, F3? f32) = initial.opF3(new F3(new F1("F11"), IF2Prx.Parse("F21", communicator)));

                    TestHelper.Assert(f31 !.f1 !.name.Equals("F11"));
                    TestHelper.Assert(f31 !.f2 !.Identity.Name.Equals("F21"));

                    TestHelper.Assert(f32 !.f1 !.name.Equals("F12"));
                    TestHelper.Assert(f32 !.f2 !.Identity.Name.Equals("F22"));
                }
            }
            output.WriteLine("ok");

            return(initial);
        }