Пример #1
0
        public override async Task RunAsync(string[] args)
        {
            await using Communicator communicator = Initialize(ref args);
            IMyClassPrx myClass = AllTests.allTests(this);

            myClass.shutdown();
        }
Пример #2
0
        public static IMyClassPrx Run(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator;

            TestHelper.Assert(communicator != null);
            bool        ice1   = helper.Protocol == Protocol.Ice1;
            var         cl     = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);
            IMyClassPrx oneway = cl.Clone(oneway: true);

            System.IO.TextWriter output = helper.Output;
            output.Write("testing InvokeAsync... ");
            output.Flush();

            {
                var request = OutgoingRequestFrame.WithEmptyArgs(oneway, "opOneway", idempotent: false);
                IncomingResponseFrame response;
                try
                {
                    response = oneway.InvokeAsync(request, oneway: true).Result;
                }
                catch
                {
                    TestHelper.Assert(false);
                }

                request = OutgoingRequestFrame.WithArgs(cl,
                                                        "opString",
                                                        idempotent: false,
                                                        compress: false,
                                                        format: default,
Пример #3
0
        public static async Task RunAsync(TestHelper helper, bool collocated)
        {
            Communicator communicator = helper.Communicator;

            TextWriter output = helper.Output;

            var cl = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);

            output.Write("testing twoway operations... ");
            output.Flush();
            await Twoways.RunAsync(cl);

            output.WriteLine("ok");

            if (!collocated)
            {
                output.Write("testing twoway operations with AMI... ");
                output.Flush();
                await TwowaysAMI.RunAsync(cl);

                output.WriteLine("ok");
            }

            output.Write("shutting down server... ");
            output.Flush();
            await cl.ShutdownAsync();

            output.WriteLine("ok");
        }
Пример #4
0
        public override async Task RunAsync(string[] args)
        {
            await using Communicator? communicator = Initialize(ref args);
            IMyClassPrx prx = await AllTests.RunAsync(this);

            await prx.ShutdownAsync();
        }
Пример #5
0
        public static IMyClassPrx allTests(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            System.IO.TextWriter output = helper.GetWriter();

            var cl           = IMyClassPrx.Parse($"test:{helper.GetTestEndpoint(0)}", communicator);
            var derivedProxy = IMyDerivedClassPrx.Parse($"test:{helper.GetTestEndpoint(0)}", communicator);

            output.Write("testing twoway operations... ");
            output.Flush();
            Twoways.twoways(helper, cl);
            Twoways.twoways(helper, derivedProxy);
            derivedProxy.opDerived();
            output.WriteLine("ok");

            output.Write("testing oneway operations... ");
            output.Flush();
            Oneways.oneways(cl);
            output.WriteLine("ok");

            output.Write("testing twoway operations with AMI... ");
            output.Flush();
            TwowaysAMI.twowaysAMI(helper, cl);
            TwowaysAMI.twowaysAMI(helper, derivedProxy);
            output.WriteLine("ok");

            output.Write("testing oneway operations with AMI... ");
            output.Flush();
            OnewaysAMI.onewaysAMI(helper, cl);
            output.WriteLine("ok");

            return(cl);
        }
Пример #6
0
        public override void Run(string[] args)
        {
            using Communicator communicator = Initialize(ref args);
            IMyClassPrx myClass = AllTests.allTests(this);

            myClass.shutdown();
        }
Пример #7
0
        public static IMyClassPrx Run(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator;

            TestHelper.Assert(communicator != null);
            System.IO.TextWriter output = helper.Output;

            var cl           = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);
            var derivedProxy = IMyDerivedClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);

            output.Write("testing twoway operations... ");
            output.Flush();
            Twoways.Run(helper, cl);
            Twoways.Run(helper, derivedProxy);
            derivedProxy.OpDerived();
            output.WriteLine("ok");

            output.Write("testing oneway operations... ");
            output.Flush();
            Oneways.Run(cl);
            output.WriteLine("ok");

            output.Write("testing twoway operations with AMI... ");
            output.Flush();
            TwowaysAMI.Run(helper, cl);
            TwowaysAMI.Run(helper, derivedProxy);
            output.WriteLine("ok");

            output.Write("testing oneway operations with AMI... ");
            output.Flush();
            OnewaysAMI.Run(helper, cl);
            output.WriteLine("ok");

            return(cl);
        }
Пример #8
0
        public static async Task RunAsync(TestHelper helper)
        {
            Communicator communicator = helper.Communicator;

            System.IO.TextWriter output = helper.Output;

            var cl           = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);
            var derivedProxy = IMyDerivedClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);

            output.Write("testing twoway operations... ");
            output.Flush();
            Twoways.Run(helper, cl);
            Twoways.Run(helper, derivedProxy);
            derivedProxy.OpDerived();
            output.WriteLine("ok");

            output.Write("testing oneway operations... ");
            output.Flush();
            Oneways.Run(cl);
            output.WriteLine("ok");

            output.Write("testing twoway operations with AMI... ");
            output.Flush();
            TwowaysAMI.Run(helper, cl);
            TwowaysAMI.Run(helper, derivedProxy);
            output.WriteLine("ok");

            output.Write("testing oneway operations with AMI... ");
            output.Flush();
            OnewaysAMI.Run(helper, cl);
            output.WriteLine("ok");

            await cl.ShutdownAsync();
        }
Пример #9
0
 internal static void oneways(IMyClassPrx p)
 {
     p = p.Clone(oneway: true);
     p.IcePing();
     p.opVoid();
     p.opIdempotent();
     p.opOneway();
     p.opOnewayMetadata();
     p.opByte(0xff, 0x0f);
 }
Пример #10
0
        public override void Run(string[] args)
        {
            using Communicator communicator = Initialize(ref args);
            System.IO.TextWriter output  = GetWriter();
            IMyClassPrx          myClass = AllTests.allTests(this, false);

            output.Write("shutting down server... ");
            output.Flush();
            myClass.shutdown();
            output.WriteLine("ok");
        }
Пример #11
0
        public override async Task RunAsync(string[] args)
        {
            await using Communicator? communicator = Initialize(ref args);
            IMyClassPrx myClass = AllTests.Run(this, false);

            Console.Out.Write("shutting down server... ");
            Console.Out.Flush();
            await myClass.ShutdownAsync();

            Console.Out.WriteLine("ok");
        }
Пример #12
0
        public override async Task RunAsync(string[] args)
        {
            await using Communicator communicator = Initialize(ref args);
            System.IO.TextWriter output  = GetWriter();
            IMyClassPrx          myClass = AllTests.Run(this, false);

            output.Write("shutting down server... ");
            output.Flush();
            await myClass.ShutdownAsync();

            output.WriteLine("ok");
        }
Пример #13
0
        public static IMyClassPrx Run(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator;

            TestHelper.Assert(communicator != null);
            bool        ice1   = helper.Protocol == Protocol.Ice1;
            var         cl     = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);
            IMyClassPrx oneway = cl.Clone(oneway: true);

            System.IO.TextWriter output = helper.Output;
            output.Write("testing Invoke... ");
            output.Flush();

            {
                var request = OutgoingRequestFrame.WithEmptyArgs(oneway, "opOneway", idempotent: false);

                // Whether the proxy is oneway or not does not matter for Invoke's oneway parameter.

                IncomingResponseFrame response = cl.Invoke(request, oneway: true);
                if (ice1)
                {
                    TestHelper.Assert(response.ResultType == ResultType.Success);
                }

                request  = OutgoingRequestFrame.WithEmptyArgs(oneway, "opOneway", idempotent: false);
                response = cl.Invoke(request, oneway: false);
                if (ice1)
                {
                    TestHelper.Assert(response.ResultType == ResultType.Failure);
                }

                request  = OutgoingRequestFrame.WithEmptyArgs(oneway, "opOneway", idempotent: false);
                response = oneway.Invoke(request, oneway: true);
                if (ice1)
                {
                    TestHelper.Assert(response.ResultType == ResultType.Success);
                }

                request  = OutgoingRequestFrame.WithEmptyArgs(oneway, "opOneway", idempotent: false);
                response = oneway.Invoke(request, oneway: false);
                if (ice1)
                {
                    TestHelper.Assert(response.ResultType == ResultType.Failure);
                }

                request = OutgoingRequestFrame.WithArgs(cl,
                                                        "opString",
                                                        idempotent: false,
                                                        compress: false,
                                                        format: default,
Пример #14
0
        internal static void Run(TestHelper helper, IMyClassPrx proxy)
        {
            Communicator?communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            IMyClassPrx p = proxy.Clone(oneway: true);

            {
                var cb = new Callback();
                p.IcePingAsync(progress: new Progress <bool>(sentSynchronously => cb.Sent()));
                cb.Check();
            }

            bool   b  = p.IceIsAAsync("::ZeroC::Ice::Test::Operations::MyClass").Result;
            string id = p.IceIdAsync().Result;

            string[] ids = p.IceIdsAsync().Result;

            {
                var cb = new Callback();
                p.opVoidAsync(progress: new Progress <bool>(sentSynchronously => cb.Sent()));
                cb.Check();
            }

            {
                var cb = new Callback();
                p.opIdempotentAsync(progress: new Progress <bool>(sentSynchronously => cb.Sent()));
                cb.Check();
            }

            {
                var cb = new Callback();
                p.opOnewayAsync(progress: new Progress <bool>(sentSynchronously => cb.Sent()));
                cb.Check();
            }

            {
                var cb = new Callback();
                p.opOnewayMetadataAsync(progress: new Progress <bool>(sentSynchronously => cb.Sent()));
                cb.Check();
            }

            (byte ReturnValue, byte p3) = p.opByteAsync(0xff, 0x0f).Result;
        }
Пример #15
0
        public static IMyClassPrx Run(TestHelper helper, bool collocated)
        {
            Communicator?communicator = helper.Communicator;

            TestHelper.Assert(communicator != null);
            TextWriter output = helper.Output;
            var        cl     = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);

            output.Write("testing twoway operations... ");
            output.Flush();
            Twoways.Run(communicator, cl);
            output.WriteLine("ok");

            if (!collocated)
            {
                output.Write("testing twoway operations with AMI... ");
                output.Flush();
                TwowaysAMI.Run(communicator, cl);
                output.WriteLine("ok");
            }
            return(cl);
        }
Пример #16
0
        public static IMyClassPrx allTests(TestHelper helper, bool collocated)
        {
            var communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            var output = helper.GetWriter();
            var cl     = IMyClassPrx.Parse($"test:{helper.GetTestEndpoint(0)}", communicator);

            output.Write("testing twoway operations... ");
            output.Flush();
            Twoways.twoways(communicator, cl);
            output.WriteLine("ok");

            if (!collocated)
            {
                output.Write("testing twoway operations with AMI... ");
                output.Flush();
                TwowaysAMI.twowaysAMI(communicator, cl);
                output.WriteLine("ok");
            }
            return(cl);
        }
Пример #17
0
        public static IMyClassPrx allTests(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            System.IO.TextWriter output = helper.GetWriter();
            output.Write("testing stringToProxy... ");
            output.Flush();
            string rf        = "test:" + helper.GetTestEndpoint(0);
            var    baseProxy = IObjectPrx.Parse(rf, communicator);

            TestHelper.Assert(baseProxy != null);

            IObjectPrx?b1;

            b1 = IObjectPrx.Parse("test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Length == 0 && b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse("test ", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse(" test ", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse(" test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse("'test -f facet'", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test -f facet") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            try
            {
                b1 = IObjectPrx.Parse("\"test -f facet'", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("\"test -f facet\"", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test -f facet") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse("\"test -f facet@test\"", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test -f facet@test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse("\"test -f facet@test @test\"", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test -f facet@test @test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            try
            {
                b1 = IObjectPrx.Parse("test test", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("test\\040test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test test") && b1.Identity.Category.Length == 0);
            try
            {
                b1 = IObjectPrx.Parse("test\\777", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("test\\40test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test test"));

            // Test some octal and hex corner cases.
            b1 = IObjectPrx.Parse("test\\4test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test\u0004test"));
            b1 = IObjectPrx.Parse("test\\04test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test\u0004test"));
            b1 = IObjectPrx.Parse("test\\004test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test\u0004test"));
            b1 = IObjectPrx.Parse("test\\1114test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test\u00494test"));

            b1 = IObjectPrx.Parse("test\\b\\f\\n\\r\\t\\'\\\"\\\\test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test\b\f\n\r\t\'\"\\test") && b1.Identity.Category.Length == 0);

            b1 = IObjectPrx.Parse("category/test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category") &&
                              b1.AdapterId.Length == 0);

            b1 = IObjectPrx.Parse("test:tcp --sourceAddress \"::1\"", communicator);
            TestHelper.Assert(b1.Equals(IObjectPrx.Parse(b1.ToString() !, communicator)));

            b1 = IObjectPrx.Parse("test:udp --sourceAddress \"::1\" --interface \"0:0:0:0:0:0:0:1%lo\"", communicator);
            TestHelper.Assert(b1.Equals(IObjectPrx.Parse(b1.ToString() !, communicator)));

            try
            {
                b1 = IObjectPrx.Parse("", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                b1 = IObjectPrx.Parse("\"\"", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                b1 = IObjectPrx.Parse("\"\" test", communicator); // Invalid trailing characters.
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                b1 = IObjectPrx.Parse("test:", communicator); // Missing endpoint.
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            b1 = IObjectPrx.Parse("test@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Equals("adapter"));
            try
            {
                b1 = IObjectPrx.Parse("id@adapter test", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("category/test@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category") &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("category/test@adapter:tcp", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category") &&
                              b1.AdapterId.Equals("adapter:tcp"));
            b1 = IObjectPrx.Parse("'category 1/test'@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category 1") &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("'category/test 1'@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test 1") && b1.Identity.Category.Equals("category") &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("'category/test'@'adapter 1'", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category") &&
                              b1.AdapterId.Equals("adapter 1"));
            b1 = IObjectPrx.Parse("\"category \\/test@foo/test\"@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category /test@foo") &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("\"category \\/test@foo/test\"@\"adapter:tcp\"", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Equals("category /test@foo") &&
                              b1.AdapterId.Equals("adapter:tcp"));

            b1 = IObjectPrx.Parse("id -f facet", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("id") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet"));
            b1 = IObjectPrx.Parse("id -f 'facet x'", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("id") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet x"));
            b1 = IObjectPrx.Parse("id -f \"facet x\"", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("id") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet x"));
            try
            {
                b1 = IObjectPrx.Parse("id -f \"facet x", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            try
            {
                b1 = IObjectPrx.Parse("id -f \'facet x", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("test -f facet:tcp", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet") && b1.AdapterId.Length == 0);
            b1 = IObjectPrx.Parse("test -f \"facet:tcp\"", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet:tcp") && b1.AdapterId.Length == 0);
            b1 = IObjectPrx.Parse("test -f facet@test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet") && b1.AdapterId.Equals("test"));
            b1 = IObjectPrx.Parse("test -f 'facet@test'", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet@test") && b1.AdapterId.Length == 0);
            b1 = IObjectPrx.Parse("test -f 'facet@test'@test", communicator);
            TestHelper.Assert(b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Equals("facet@test") && b1.AdapterId.Equals("test"));
            try
            {
                b1 = IObjectPrx.Parse("test -f facet@test @test", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("test", communicator);
            TestHelper.Assert(!b1.IsOneway);
            b1 = IObjectPrx.Parse("test -t", communicator);
            TestHelper.Assert(!b1.IsOneway);
            b1 = IObjectPrx.Parse("test -o", communicator);
            TestHelper.Assert(b1.IsOneway);
            b1 = IObjectPrx.Parse("test -O", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.BatchOneway);
            b1 = IObjectPrx.Parse("test -d", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.Datagram);
            b1 = IObjectPrx.Parse("test -D", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.BatchDatagram);
            b1 = IObjectPrx.Parse("test", communicator);

            TestHelper.Assert(b1.Encoding.Equals(communicator.DefaultEncoding));

            b1 = IObjectPrx.Parse("test -e 1.0", communicator);
            TestHelper.Assert(b1.Encoding.Major == 1 && b1.Encoding.Minor == 0);

            b1 = IObjectPrx.Parse("test -e 6.5", communicator);
            TestHelper.Assert(b1.Encoding.Major == 6 && b1.Encoding.Minor == 5);

            b1 = IObjectPrx.Parse("test -p ice1 -e 1.0", communicator);
            TestHelper.Assert(b1.ToString() !.Equals("test -t -p ice1 -e 1.0"));

            b1 = IObjectPrx.Parse("test -p 1.0 -e 1.0", communicator);
            TestHelper.Assert(b1.ToString() !.Equals("test -t -p ice1 -e 1.0"));

            b1 = IObjectPrx.Parse("test -p ice2 -e 1.0", communicator);
            TestHelper.Assert(b1.ToString() !.Equals("test -t -p ice2 -e 1.0"));

            b1 = IObjectPrx.Parse("test -p 2.0 -e 1.0", communicator);
            TestHelper.Assert(b1.ToString() !.Equals("test -t -p ice2 -e 1.0"));

            b1 = IObjectPrx.Parse("test -p 6 -e 1.0", communicator);
            TestHelper.Assert(b1.ToString() !.Equals("test -t -p 6 -e 1.0"));

            b1 = IObjectPrx.Parse("test -p 6.0 -e 1.0", communicator);
            TestHelper.Assert(b1.ToString() !.Equals("test -t -p 6 -e 1.0"));

            try
            {
                IObjectPrx.Parse("test:tcp@adapterId", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            // This is an unknown endpoint warning, not a parse exception.
            //
            //try
            //{
            //   b1 = communicator.stringToProxy("test -f the:facet:tcp");
            //   TestHelper.Assert(false);
            //}
            //catch(EndpointParseException)
            //{
            //}
            try
            {
                IObjectPrx.Parse("test: :tcp", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            //
            // Test invalid endpoint syntax
            //
            try
            {
                communicator.CreateObjectAdapterWithEndpoints("BadAdapter", " : ");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                communicator.CreateObjectAdapterWithEndpoints("BadAdapter", "tcp: ");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                communicator.CreateObjectAdapterWithEndpoints("BadAdapter", ":tcp");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            //
            // Test for bug ICE-5543: escaped escapes in stringToIdentity
            //
            var id  = new Identity("test", ",X2QNUAzSBcJ_e$AV;E\\");
            var id2 = Identity.Parse(id.ToString(communicator.ToStringMode));

            TestHelper.Assert(id.Equals(id2));

            id  = new Identity("test", ",X2QNUAz\\SB\\/cJ_e$AV;E\\\\");
            id2 = Identity.Parse(id.ToString(communicator.ToStringMode));
            TestHelper.Assert(id.Equals(id2));

            id = new Identity("/test", "cat/");
            string idStr = id.ToString(communicator.ToStringMode);

            TestHelper.Assert(idStr == "cat\\//\\/test");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id.Equals(id2));

            // Input string with various pitfalls
            id = Identity.Parse("\\342\\x82\\254\\60\\x9\\60\\");
            TestHelper.Assert(id.Name == "€0\t0\\" && id.Category == "");

            try
            {
                // Illegal character < 32
                id = Identity.Parse("xx\01FooBar");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Illegal surrogate
                id = Identity.Parse("xx\\ud911");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            // Testing bytes 127(\x7F, \177) and €
            id = new Identity("test", "\x7f€");

            idStr = id.ToString(ToStringMode.Unicode);
            TestHelper.Assert(idStr == "\\u007f€/test");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id.Equals(id2));
            TestHelper.Assert(id.ToString() == idStr);

            idStr = id.ToString(ToStringMode.ASCII);
            TestHelper.Assert(idStr == "\\u007f\\u20ac/test");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id.Equals(id2));

            idStr = id.ToString(ToStringMode.Compat);
            TestHelper.Assert(idStr == "\\177\\342\\202\\254/test");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id.Equals(id2));

            id2 = Identity.Parse(id.ToString(communicator.ToStringMode));
            TestHelper.Assert(id.Equals(id2));

            // More unicode character
            id = new Identity("banana \x0E-\ud83c\udf4c\u20ac\u00a2\u0024", "greek \ud800\udd6a");

            idStr = id.ToString(ToStringMode.Unicode);
            TestHelper.Assert(idStr == "greek \ud800\udd6a/banana \\u000e-\ud83c\udf4c\u20ac\u00a2$");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id.Equals(id2));

            idStr = id.ToString(ToStringMode.ASCII);
            TestHelper.Assert(idStr == "greek \\U0001016a/banana \\u000e-\\U0001f34c\\u20ac\\u00a2$");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id.Equals(id2));

            idStr = id.ToString(ToStringMode.Compat);
            id2   = Identity.Parse(idStr);
            TestHelper.Assert(idStr == "greek \\360\\220\\205\\252/banana \\016-\\360\\237\\215\\214\\342\\202\\254\\302\\242$");
            TestHelper.Assert(id.Equals(id2));

            output.WriteLine("ok");

            output.Write("testing proxyToString... ");
            output.Flush();
            b1 = IObjectPrx.Parse(rf, communicator);
            var b2 = IObjectPrx.Parse(b1.ToString() !, communicator);

            TestHelper.Assert(b1.Equals(b2));

            if (b1.GetConnection() is Connection connection) // not colloc-optimized target
            {
                b2 = connection.CreateProxy(Identity.Parse("fixed"), IObjectPrx.Factory);
                TestHelper.Assert(b2.ToString() == b2.ToString());
            }
            output.WriteLine("ok");

            output.Write("testing propertyToProxy... ");
            output.Flush();

            string propertyPrefix = "Foo.Proxy";

            communicator.SetProperty(propertyPrefix, "test:" + helper.GetTestEndpoint(0));
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null &&
                              b1.Identity.Name.Equals("test") && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Length == 0 && b1.Facet.Length == 0);

            string property;

            property = propertyPrefix + ".Locator";
            TestHelper.Assert(b1.Locator == null);
            communicator.SetProperty(property, "locator:default -p 10000");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.Locator != null && b1.Locator.Identity.Name.Equals("locator"));
            communicator.SetProperty(property, "");
            property = propertyPrefix + ".LocatorCacheTimeout";
            TestHelper.Assert(b1.LocatorCacheTimeout == Timeout.InfiniteTimeSpan);
            communicator.SetProperty(property, "1s");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.LocatorCacheTimeout == TimeSpan.FromSeconds(1));
            communicator.SetProperty(property, "");

            // Now retest with an indirect proxy.
            communicator.SetProperty(propertyPrefix, "test");
            property = propertyPrefix + ".Locator";
            communicator.SetProperty(property, "locator:default -p 10000");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.Locator != null && b1.Locator.Identity.Name.Equals("locator"));
            communicator.SetProperty(property, "");

            property = propertyPrefix + ".LocatorCacheTimeout";
            TestHelper.Assert(b1.LocatorCacheTimeout == Timeout.InfiniteTimeSpan);
            communicator.SetProperty(property, "1s");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.LocatorCacheTimeout == TimeSpan.FromSeconds(1));
            communicator.SetProperty(property, "");

            // This cannot be tested so easily because the property is cached
            // on communicator initialization.
            //
            //communicator.SetProperty("Default.LocatorCacheTimeout", "60");
            //b1 = communicator.propertyToProxy(propertyPrefix);
            //TestHelper.Assert(b1.LocatorCacheTimeout == 60);
            //communicator.SetProperty("Default.LocatorCacheTimeout", "");

            communicator.SetProperty(propertyPrefix, "test:" + helper.GetTestEndpoint(0));

            property = propertyPrefix + ".Router";
            TestHelper.Assert(b1.Router == null);
            communicator.SetProperty(property, "router:default -p 10000");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.Router != null && b1.Router.Identity.Name.Equals("router"));
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".PreferNonSecure";
            TestHelper.Assert(b1.PreferNonSecure);
            communicator.SetProperty(property, "0");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && !b1.PreferNonSecure);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".ConnectionCached";
            TestHelper.Assert(b1.IsConnectionCached);
            communicator.SetProperty(property, "0");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && !b1.IsConnectionCached);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".InvocationTimeout";
            TestHelper.Assert(b1.InvocationTimeout == -1);
            communicator.SetProperty(property, "1000");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.InvocationTimeout == 1000);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".EndpointSelection";
            TestHelper.Assert(b1.EndpointSelection == EndpointSelectionType.Random);
            communicator.SetProperty(property, "Random");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.EndpointSelection == EndpointSelectionType.Random);
            communicator.SetProperty(property, "Ordered");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.EndpointSelection == EndpointSelectionType.Ordered);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".CollocationOptimized";
            TestHelper.Assert(b1.IsCollocationOptimized);
            communicator.SetProperty(property, "0");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && !b1.IsCollocationOptimized);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".Context.c1";
            TestHelper.Assert(!b1.Context.ContainsKey("c1"));
            communicator.SetProperty(property, "TEST");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.Context["c1"].Equals("TEST"));

            property = propertyPrefix + ".Context.c2";
            TestHelper.Assert(!b1.Context.ContainsKey("c2"));
            communicator.SetProperty(property, "TEST");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory);
            TestHelper.Assert(b1 != null && b1.Context["c2"].Equals("TEST"));

            communicator.SetProperty(propertyPrefix + ".Context.c1", "");
            communicator.SetProperty(propertyPrefix + ".Context.c2", "");

            output.WriteLine("ok");

            output.Write("testing proxyToProperty... ");
            output.Flush();

            var router = IRouterPrx.Parse("router", communicator).Clone(
                collocationOptimized: false,
                cacheConnection: true,
                preferNonSecure: true,
                endpointSelection: EndpointSelectionType.Random,
                locatorCacheTimeout: TimeSpan.FromSeconds(200),
                invocationTimeout: 1500);

            var locator = ILocatorPrx.Parse("locator", communicator).Clone(
                collocationOptimized: true,
                cacheConnection: false,
                preferNonSecure: true,
                endpointSelection: EndpointSelectionType.Random,
                locatorCacheTimeout: TimeSpan.FromSeconds(300),
                invocationTimeout: 1500,
                router: router);

            b1 = IObjectPrx.Parse("test", communicator).Clone(
                collocationOptimized: true,
                cacheConnection: true,
                preferNonSecure: false,
                endpointSelection: EndpointSelectionType.Ordered,
                locatorCacheTimeout: TimeSpan.FromSeconds(100),
                invocationTimeout: 1234,
                encoding: Encoding.V2_0,
                locator: locator);

            Dictionary <string, string> proxyProps = b1.ToProperty("Test");

            TestHelper.Assert(proxyProps.Count == 21);

            string defaultProtocolName = communicator.DefaultProtocol.GetName();

            TestHelper.Assert(proxyProps["Test"] == $"test -t -p {defaultProtocolName} -e 2.0");
            TestHelper.Assert(proxyProps["Test.CollocationOptimized"] == "1");
            TestHelper.Assert(proxyProps["Test.ConnectionCached"] == "1");
            TestHelper.Assert(proxyProps["Test.PreferNonSecure"] == "0");
            TestHelper.Assert(proxyProps["Test.EndpointSelection"] == "Ordered");
            TestHelper.Assert(proxyProps["Test.LocatorCacheTimeout"] == "100s");
            TestHelper.Assert(proxyProps["Test.InvocationTimeout"] == "1234");

            TestHelper.Assert(proxyProps["Test.Locator"] == $"locator -t -p {defaultProtocolName} -e {Encoding.V2_0}");
            // Locator collocation optimization is always disabled.
            //TestHelper.Assert(proxyProps["Test.Locator.CollocationOptimized"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.ConnectionCached"] == "0");
            TestHelper.Assert(proxyProps["Test.Locator.PreferNonSecure"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.EndpointSelection"] == "Random");
            TestHelper.Assert(proxyProps["Test.Locator.LocatorCacheTimeout"] == "5m");
            TestHelper.Assert(proxyProps["Test.Locator.InvocationTimeout"] == "1500");

            TestHelper.Assert(proxyProps["Test.Locator.Router"] ==
                              $"router -t -p {defaultProtocolName} -e {communicator.DefaultEncoding}");
            TestHelper.Assert(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0");
            TestHelper.Assert(proxyProps["Test.Locator.Router.ConnectionCached"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.Router.PreferNonSecure"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random");
            TestHelper.Assert(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200s");
            TestHelper.Assert(proxyProps["Test.Locator.Router.InvocationTimeout"] == "1500");

            output.WriteLine("ok");

            output.Write("testing ice_getCommunicator... ");
            output.Flush();
            TestHelper.Assert(baseProxy.Communicator == communicator);
            output.WriteLine("ok");

            output.Write("testing proxy methods... ");

            TestHelper.Assert(baseProxy.Clone(facet: "facet", IObjectPrx.Factory).Facet.Equals("facet"));
            TestHelper.Assert(baseProxy.Clone(adapterId: "id").AdapterId.Equals("id"));
            TestHelper.Assert(!baseProxy.Clone(invocationMode: InvocationMode.Twoway).IsOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.Oneway).IsOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.Datagram).IsOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.BatchOneway).InvocationMode ==
                              InvocationMode.BatchOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.Datagram).InvocationMode ==
                              InvocationMode.Datagram);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.BatchDatagram).InvocationMode ==
                              InvocationMode.BatchDatagram);
            TestHelper.Assert(baseProxy.Clone(collocationOptimized: true).IsCollocationOptimized);
            TestHelper.Assert(!baseProxy.Clone(collocationOptimized: false).IsCollocationOptimized);
            TestHelper.Assert(baseProxy.Clone(preferNonSecure: true).PreferNonSecure);
            TestHelper.Assert(!baseProxy.Clone(preferNonSecure: false).PreferNonSecure);

            try
            {
                baseProxy.Clone(connectionTimeout: 0);
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            try
            {
                baseProxy.Clone(connectionTimeout: -1);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(connectionTimeout: -2);
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            try
            {
                baseProxy.Clone(invocationTimeout: 0);
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            try
            {
                baseProxy.Clone(invocationTimeout: -1);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(invocationTimeout: -2);
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            try
            {
                baseProxy.Clone(locatorCacheTimeout: TimeSpan.Zero);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(locatorCacheTimeout: Timeout.InfiniteTimeSpan);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(-2));
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            output.WriteLine("ok");

            output.Write("testing proxy comparison... ");
            output.Flush();

            TestHelper.Assert(Equals(IObjectPrx.Parse("foo", communicator), IObjectPrx.Parse("foo", communicator)));
            TestHelper.Assert(!IObjectPrx.Parse("foo", communicator).Equals(IObjectPrx.Parse("foo2", communicator)));

            var compObj = IObjectPrx.Parse("foo", communicator);

            TestHelper.Assert(compObj.Clone(facet: "facet", IObjectPrx.Factory).Equals(
                                  compObj.Clone(facet: "facet", IObjectPrx.Factory)));
            TestHelper.Assert(!compObj.Clone(facet: "facet", IObjectPrx.Factory).Equals(
                                  compObj.Clone(facet: "facet1", IObjectPrx.Factory)));

            TestHelper.Assert(compObj.Clone(invocationMode: InvocationMode.Oneway).Equals(
                                  compObj.Clone(invocationMode: InvocationMode.Oneway)));
            TestHelper.Assert(!compObj.Clone(invocationMode: InvocationMode.Oneway).Equals(
                                  compObj.Clone(invocationMode: InvocationMode.Twoway)));

            TestHelper.Assert(compObj.Clone(collocationOptimized: true).Equals(compObj.Clone(collocationOptimized: true)));
            TestHelper.Assert(!compObj.Clone(collocationOptimized: false).Equals(compObj.Clone(collocationOptimized: true)));

            TestHelper.Assert(compObj.Clone(cacheConnection: true).Equals(compObj.Clone(cacheConnection: true)));
            TestHelper.Assert(!compObj.Clone(cacheConnection: false).Equals(compObj.Clone(cacheConnection: true)));

            TestHelper.Assert(compObj.Clone(endpointSelection: EndpointSelectionType.Random).Equals(
                                  compObj.Clone(endpointSelection: EndpointSelectionType.Random)));
            TestHelper.Assert(!compObj.Clone(endpointSelection: EndpointSelectionType.Random).Equals(
                                  compObj.Clone(endpointSelection: EndpointSelectionType.Ordered)));

            TestHelper.Assert(compObj.Clone(connectionId: "id2").Equals(compObj.Clone(connectionId: "id2")));
            TestHelper.Assert(!compObj.Clone(connectionId: "id1").Equals(compObj.Clone(connectionId: "id2")));
            TestHelper.Assert(compObj.Clone(connectionId: "id1").ConnectionId.Equals("id1"));
            TestHelper.Assert(compObj.Clone(connectionId: "id2").ConnectionId.Equals("id2"));

            TestHelper.Assert(compObj.Clone(compress: true).Equals(compObj.Clone(compress: true)));
            TestHelper.Assert(!compObj.Clone(compress: false).Equals(compObj.Clone(compress: true)));

            TestHelper.Assert(!compObj.Compress.HasValue);
            TestHelper.Assert(compObj.Clone(compress: true).Compress !.Value == true);
            TestHelper.Assert(compObj.Clone(compress: false).Compress !.Value == false);

            TestHelper.Assert(compObj.Clone(connectionTimeout: 20).Equals(compObj.Clone(connectionTimeout: 20)));
            TestHelper.Assert(!compObj.Clone(connectionTimeout: 10).Equals(compObj.Clone(connectionTimeout: 20)));

            TestHelper.Assert(!compObj.ConnectionTimeout.HasValue);
            TestHelper.Assert(compObj.Clone(connectionTimeout: 10).ConnectionTimeout !.Value == 10);
            TestHelper.Assert(compObj.Clone(connectionTimeout: 20).ConnectionTimeout !.Value == 20);

            var loc1 = ILocatorPrx.Parse("loc1:default -p 10000", communicator);
            var loc2 = ILocatorPrx.Parse("loc2:default -p 10000", communicator);

            TestHelper.Assert(compObj.Clone(clearLocator: true).Equals(compObj.Clone(clearLocator: true)));
            TestHelper.Assert(compObj.Clone(locator: loc1).Equals(compObj.Clone(locator: loc1)));
            TestHelper.Assert(!compObj.Clone(locator: loc1).Equals(compObj.Clone(clearLocator: true)));
            TestHelper.Assert(!compObj.Clone(clearLocator: true).Equals(compObj.Clone(locator: loc2)));
            TestHelper.Assert(!compObj.Clone(locator: loc1).Equals(compObj.Clone(locator: loc2)));

            var rtr1 = IRouterPrx.Parse("rtr1:default -p 10000", communicator);
            var rtr2 = IRouterPrx.Parse("rtr2:default -p 10000", communicator);

            TestHelper.Assert(compObj.Clone(clearRouter: true).Equals(compObj.Clone(clearRouter: true)));
            TestHelper.Assert(compObj.Clone(router: rtr1).Equals(compObj.Clone(router: rtr1)));
            TestHelper.Assert(!compObj.Clone(router: rtr1).Equals(compObj.Clone(clearRouter: true)));
            TestHelper.Assert(!compObj.Clone(clearRouter: true).Equals(compObj.Clone(router: rtr2)));
            TestHelper.Assert(!compObj.Clone(router: rtr1).Equals(compObj.Clone(router: rtr2)));

            Dictionary <string, string> ctx1 = new Dictionary <string, string>();

            ctx1["ctx1"] = "v1";
            Dictionary <string, string> ctx2 = new Dictionary <string, string>();

            ctx2["ctx2"] = "v2";
            TestHelper.Assert(compObj.Clone(context: new Dictionary <string, string>()).Equals(
                                  compObj.Clone(context: new Dictionary <string, string>())));
            TestHelper.Assert(compObj.Clone(context: ctx1).Equals(compObj.Clone(context: ctx1)));
            TestHelper.Assert(!compObj.Clone(context: ctx1).Equals(
                                  compObj.Clone(context: new Dictionary <string, string>())));
            TestHelper.Assert(!compObj.Clone(context: new Dictionary <string, string>()).Equals(
                                  compObj.Clone(context: ctx2)));
            TestHelper.Assert(!compObj.Clone(context: ctx1).Equals(compObj.Clone(context: ctx2)));

            TestHelper.Assert(compObj.Clone(preferNonSecure: true).Equals(compObj.Clone(preferNonSecure: true)));
            TestHelper.Assert(!compObj.Clone(preferNonSecure: true).Equals(compObj.Clone(preferNonSecure: false)));

            var compObj1 = IObjectPrx.Parse("foo:tcp -h 127.0.0.1 -p 10000", communicator);
            var compObj2 = IObjectPrx.Parse("foo:tcp -h 127.0.0.1 -p 10001", communicator);

            TestHelper.Assert(!compObj1.Equals(compObj2));

            compObj1 = IObjectPrx.Parse("foo@MyAdapter1", communicator);
            compObj2 = IObjectPrx.Parse("foo@MyAdapter2", communicator);
            TestHelper.Assert(!compObj1.Equals(compObj2));

            TestHelper.Assert(compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(20))
                              .Equals(compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(20))));
            TestHelper.Assert(!compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(10))
                              .Equals(compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(20))));

            TestHelper.Assert(compObj1.Clone(invocationTimeout: 20).Equals(compObj1.Clone(invocationTimeout: 20)));
            TestHelper.Assert(!compObj1.Clone(invocationTimeout: 10).Equals(compObj1.Clone(invocationTimeout: 20)));

            compObj1 = IObjectPrx.Parse("foo:tcp -h 127.0.0.1 -p 1000", communicator);
            compObj2 = IObjectPrx.Parse("foo@MyAdapter1", communicator);
            TestHelper.Assert(!compObj1.Equals(compObj2));

            var endpts1 = IObjectPrx.Parse("foo:tcp -h 127.0.0.1 -p 10000", communicator).Endpoints;
            var endpts2 = IObjectPrx.Parse("foo:tcp -h 127.0.0.1 -p 10001", communicator).Endpoints;

            TestHelper.Assert(!endpts1[0].Equals(endpts2[0]));
            TestHelper.Assert(endpts1[0].Equals(IObjectPrx.Parse("foo:tcp -h 127.0.0.1 -p 10000", communicator).Endpoints[0]));

            if (baseProxy.GetConnection() is Connection baseConnection)
            {
                Connection baseConnection2 = baseProxy.Clone(connectionId: "base2").GetConnection() !;
                compObj1 = compObj1.Clone(fixedConnection: baseConnection);
                compObj2 = compObj2.Clone(fixedConnection: baseConnection2);
                TestHelper.Assert(!compObj1.Equals(compObj2));
            }
            output.WriteLine("ok");

            output.Write("testing checked cast... ");
            output.Flush();
            var cl = IMyClassPrx.CheckedCast(baseProxy);

            TestHelper.Assert(cl != null);
            var derived = IMyDerivedClassPrx.CheckedCast(cl);

            TestHelper.Assert(derived != null);
            TestHelper.Assert(cl.Equals(baseProxy));
            TestHelper.Assert(derived.Equals(baseProxy));
            TestHelper.Assert(cl.Equals(derived));
            try
            {
                IMyDerivedClassPrx.CheckedCast(cl.Clone(facet: "facet", IObjectPrx.Factory));
                TestHelper.Assert(false);
            }
            catch (ObjectNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing checked cast with context... ");
            output.Flush();

            Dictionary <string, string> c = cl.getContext();

            TestHelper.Assert(c == null || c.Count == 0);

            c        = new Dictionary <string, string>();
            c["one"] = "hello";
            c["two"] = "world";
            cl       = IMyClassPrx.CheckedCast(baseProxy, c);
            Dictionary <string, string> c2 = cl !.getContext();

            TestHelper.Assert(c.DictionaryEqual(c2));
            output.WriteLine("ok");

            output.Write("testing ice_fixed... ");
            output.Flush();
            {
                if (cl.GetConnection() is Connection connection2)
                {
                    TestHelper.Assert(!cl.IsFixed);
                    IMyClassPrx prx = cl.Clone(fixedConnection: connection2);
                    TestHelper.Assert(prx.IsFixed);
                    prx.IcePing();
                    TestHelper.Assert(cl.Clone("facet", IObjectPrx.Factory, fixedConnection: connection2).Facet.Equals("facet"));
                    TestHelper.Assert(cl.Clone(invocationMode: InvocationMode.Oneway, fixedConnection: connection2).IsOneway);
                    Dictionary <string, string> ctx = new Dictionary <string, string>();
                    ctx["one"] = "hello";
                    ctx["two"] = "world";
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).Context.Count == 0);
                    TestHelper.Assert(cl.Clone(context: ctx, fixedConnection: connection2).Context.Count == 2);
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).InvocationTimeout == -1);
                    TestHelper.Assert(cl.Clone(invocationTimeout: 10, fixedConnection: connection2).InvocationTimeout == 10);
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).GetConnection() == connection2);
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).Clone(fixedConnection: connection2).GetConnection() == connection2);
                    TestHelper.Assert(!cl.Clone(fixedConnection: connection2).ConnectionTimeout.HasValue);
                    TestHelper.Assert(cl.Clone(compress: true, fixedConnection: connection2).Compress !.Value);
                    Connection?fixedConnection = cl.Clone(connectionId: "ice_fixed").GetConnection();
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).Clone(fixedConnection: fixedConnection).GetConnection() == fixedConnection);
                    try
                    {
                        cl.Clone(invocationMode: InvocationMode.Datagram, fixedConnection: connection2);
                        TestHelper.Assert(false);
                    }
                    catch (ArgumentException)
                    {
                    }
                }
            }
            output.WriteLine("ok");

            output.Write("testing encoding versioning... ");
            string ref13 = "test -e 1.3:" + helper.GetTestEndpoint(0);
            var    cl13  = IMyClassPrx.Parse(ref13, communicator);

            try
            {
                cl13.IcePing();
                TestHelper.Assert(false);
            }
            catch (NotSupportedException)
            {
                // expected
            }
            output.WriteLine("ok");

            output.Write("testing protocol versioning... ");
            output.Flush();
            string ref3 = "test -p 3:" + helper.GetTestEndpoint(0);
            var    cl3  = IMyClassPrx.Parse(ref3, communicator);

            try
            {
                cl3.IcePing();
                TestHelper.Assert(false);
            }
            catch (NotSupportedException)
            {
                // expected
            }
            output.WriteLine("ok");

            output.Write("testing opaque endpoints... ");
            output.Flush();

            try
            {
                // Invalid -x option
                IObjectPrx.Parse("id:opaque -t 99 -v abcd -x abc", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Missing -t and -v
                IObjectPrx.Parse("id:opaque", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Repeated -t
                IObjectPrx.Parse("id:opaque -t 1 -t 1 -v abcd", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Repeated -v
                IObjectPrx.Parse("id:opaque -t 1 -v abcd -v abcd", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Missing -t
                IObjectPrx.Parse("id:opaque -v abcd", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Missing -v
                IObjectPrx.Parse("id:opaque -t 1", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Missing arg for -t
                IObjectPrx.Parse("id:opaque -t -v abcd", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Missing arg for -v
                IObjectPrx.Parse("id:opaque -t 1 -v", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Not a number for -t
                IObjectPrx.Parse("id:opaque -t x -v abcd", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // < 0 for -t
                IObjectPrx.Parse("id:opaque -t -1 -v abcd", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Invalid char for -v
                IObjectPrx.Parse("id:opaque -t 99 -v x?c", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Invalid lenght for base64 input
                IObjectPrx.Parse("id:opaque -t 99 -v xc", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            // Legal TCP endpoint expressed as opaque endpoint
            // Opaque endpoint encoded with 1.1 encoding.
            var p1 = IObjectPrx.Parse("test -e 1.1 -p ice2:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==",
                                      communicator);

            TestHelper.Assert(p1.ToString() !.Equals("test -t -p ice2 -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));

            if (!(communicator.GetPropertyAsBool("Ice.IPv6") ?? false))
            {
                // Two legal TCP endpoints expressed as opaque endpoints
                p1 = IObjectPrx.Parse("test -e 1.1 -p ice2:" + "" +
                                      "opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:" +
                                      "opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==", communicator);
                TestHelper.Assert(p1.ToString() ==
                                  "test -t -p ice2 -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000");

                // Test that an SSL endpoint and a nonsense endpoint get written back out as an opaque endpoint.
                p1 = IObjectPrx.Parse("test -e 1.1 -p ice2:opaque -e 1.1 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.1 -t 99 -v abch",
                                      communicator);
                TestHelper.Assert(p1.ToString() ==
                                  "test -t -p ice2 -e 1.1:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.1 -v abch");
            }

            output.WriteLine("ok");

            output.Write("testing communicator shutdown/destroy... ");
            output.Flush();
            {
                Communicator com = new Communicator();
                com.Shutdown();
                TestHelper.Assert(com.IsShutdown());
                com.WaitForShutdown();
                com.Destroy();
                com.Shutdown();
                TestHelper.Assert(com.IsShutdown());
                com.WaitForShutdown();
                com.Destroy();
            }
            output.WriteLine("ok");

            return(cl);
        }
Пример #18
0
        internal static void Run(Communicator communicator, IMyClassPrx p)
        {
            {
                byte[] i = Enumerable.Range(0, Length).Select(x => (byte)x).ToArray();
                (byte[] ReturnValue, byte[] o) = p.OpAByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (byte)x).ToList();
                (List <byte> ReturnValue, List <byte> o) = p.OpLByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (LinkedList <byte> ReturnValue, LinkedList <byte> o) = p.OpKByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (Queue <byte> ReturnValue, Queue <byte> o) = p.OpQByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (Stack <byte> ReturnValue, Stack <byte> o) = p.OpSByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (Custom <byte> ReturnValue, Custom <byte> o) = p.OpCByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                bool[] i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray();
                (bool[] ReturnValue, bool[] o) = p.OpABoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToList();
                (List <bool> ReturnValue, List <bool> o) = p.OpLBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (LinkedList <bool> ReturnValue, LinkedList <bool> o) = p.OpKBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (Queue <bool> ReturnValue, Queue <bool> o) = p.OpQBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (Stack <bool> ReturnValue, Stack <bool> o) = p.OpSBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (Custom <bool> ReturnValue, Custom <bool> o) = p.OpCBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                short[]? i = Enumerable.Range(0, Length).Select(x => (short)x).ToArray();
                (short[] ReturnValue, short[] o) = p.OpAShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToList();
                (List <short> ReturnValue, List <short> o) = p.OpLShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (LinkedList <short> ReturnValue, LinkedList <short> o) = p.OpKShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (Queue <short> ReturnValue, Queue <short> o) = p.OpQShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (Stack <short> ReturnValue, Stack <short> o) = p.OpSShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (Custom <short> ReturnValue, Custom <short> o) = p.OpCShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                int[] i = Enumerable.Range(0, Length).ToArray();
                (int[] ReturnValue, int[] o) = p.OpAIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToList();
                (List <int> ReturnValue, List <int> o) = p.OpLIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <int>(Enumerable.Range(0, Length).ToArray());
                (LinkedList <int> ReturnValue, LinkedList <int> o) = p.OpKIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <int>(Enumerable.Range(0, Length).ToArray());
                (Queue <int> ReturnValue, Queue <int> o) = p.OpQIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <int>(Enumerable.Range(0, Length).ToArray());
                (Stack <int> ReturnValue, Stack <int> o) = p.OpSIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToArray());
                (Custom <int> ReturnValue, Custom <int> o) = p.OpCIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                long[]? i = Enumerable.Range(0, Length).Select(x => (long)x).ToArray();
                (long[] ReturnValue, long[] o) = p.OpALongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToList();
                (List <long> ReturnValue, List <long> o) = p.OpLLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (LinkedList <long> ReturnValue, LinkedList <long> o) = p.OpKLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (Queue <long> ReturnValue, Queue <long> o) = p.OpQLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (Stack <long> ReturnValue, Stack <long> o) = p.OpSLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (Custom <long> ReturnValue, Custom <long> o) = p.OpCLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                float[] i = Enumerable.Range(0, Length).Select(x => (float)x).ToArray();
                (float[] ReturnValue, float[] o) = p.OpAFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToList();
                (List <float> ReturnValue, List <float> o) = p.OpLFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (LinkedList <float> ReturnValue, LinkedList <float> o) = p.OpKFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (Queue <float> ReturnValue, Queue <float> o) = p.OpQFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (Stack <float> ReturnValue, Stack <float> o) = p.OpSFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (Custom <float> ReturnValue, Custom <float> o) = p.OpCFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                double[] i = Enumerable.Range(0, Length).Select(x => (double)x).ToArray();
                (double[] ReturnValue, double[] o) = p.OpADoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToList();
                (List <double> ReturnValue, List <double> o) = p.OpLDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (LinkedList <double> ReturnValue, LinkedList <double> o) = p.OpKDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (Queue <double> ReturnValue, Queue <double> o) = p.OpQDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (Stack <double> ReturnValue, Stack <double> o) = p.OpSDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (Custom <double> ReturnValue, Custom <double> o) = p.OpCDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                string[] i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray();
                (string[] ReturnValue, string[] o) = p.OpAStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToList();
                (List <string> ReturnValue, List <string> o) = p.OpLStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (LinkedList <string> ReturnValue, LinkedList <string> o) = p.OpKStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (Queue <string> ReturnValue, Queue <string> o) = p.OpQStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (Stack <string> ReturnValue, Stack <string> o) = p.OpSStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (Custom <string> ReturnValue, Custom <string> o) = p.OpCStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                AnyClass[] i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToArray();
                (AnyClass?[] ReturnValue, AnyClass?[] o) = p.OpAObjectSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToList <AnyClass?>();
                (List <AnyClass?> ReturnValue, List <AnyClass?> o) = p.OpLObjectSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <AnyClass>(Enumerable.Range(0, Length).Select(
                                                  x => new CV(x) as AnyClass).ToArray());
                (Custom <AnyClass?> ReturnValue, Custom <AnyClass?> o) = p.OpCObjectSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                IObjectPrx[]? i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray();
                (IObjectPrx?[] ReturnValue, IObjectPrx?[] o) = p.OpAObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToList <IObjectPrx?>();
                (List <IObjectPrx?> ReturnValue, List <IObjectPrx?> o) = p.OpLObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                         x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (LinkedList <IObjectPrx?> ReturnValue, LinkedList <IObjectPrx?> o) = p.OpKObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (Queue <IObjectPrx?> ReturnValue, Queue <IObjectPrx?> o) = p.OpQObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (Stack <IObjectPrx?> ReturnValue, Stack <IObjectPrx?> o) = p.OpSObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                     x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (Custom <IObjectPrx?> ReturnValue, Custom <IObjectPrx?> o) = p.OpCObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                S[]? i = Enumerable.Range(0, Length).Select(x => new S(x)).ToArray();
                (S[] ReturnValue, S[] o) = p.OpAStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToList();
                (List <S> ReturnValue, List <S> o) = p.OpLStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (LinkedList <S> ReturnValue, LinkedList <S> o) = p.OpKStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (Queue <S> ReturnValue, Queue <S> o) = p.OpQStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (Stack <S> ReturnValue, Stack <S> o) = p.OpSStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (Custom <S> ReturnValue, Custom <S> o) = p.OpCStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                CV[] i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToArray();
                (CV?[] ReturnValue, CV?[] o) = p.OpACVSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>();
                (List <CV?> ReturnValue, List <CV?> o) = p.OpLCVSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                IIPrx[] i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray();
                (IIPrx?[] ReturnValue, IIPrx?[] o) = p.OpAIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToList <IIPrx?>();
                (List <IIPrx?> ReturnValue, List <IIPrx?> o) = p.OpLIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (LinkedList <IIPrx?> ReturnValue, LinkedList <IIPrx?> o) = p.OpKIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (Queue <IIPrx?> ReturnValue, Queue <IIPrx?> o) = p.OpQIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (Stack <IIPrx?> ReturnValue, Stack <IIPrx?> o) = p.OpSIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (Custom <IIPrx?> ReturnValue, Custom <IIPrx?> o) = p.OpCIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                CR[]? i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToArray();
                (CR?[] ReturnValue, CR?[] o) = p.OpACRSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToList <CR?>();
                (List <CR?> ReturnValue, List <CR?> o) = p.OpLCRSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = new Custom <CR>(Enumerable.Range(0, Length).Select(
                                            x => new CR(new CV(x))).ToArray());
                (List <CR?> ReturnValue, List <CR?> o) = p.OpLCRSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                En[] i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray();
                (En[] ReturnValue, En[] o) = p.OpAEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList();
                (List <En> ReturnValue, List <En> o) = p.OpLEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <En>(Enumerable.Range(0, Length).Select(
                                                x => (En)(x % 3)).ToArray());
                (LinkedList <En> ReturnValue, LinkedList <En> o) = p.OpKEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                (Queue <En> ReturnValue, Queue <En> o) = p.OpQEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                (Stack <En> ReturnValue, Stack <En> o) = p.OpSEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                (Custom <En> ReturnValue, Custom <En> o) = p.OpCEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToList());
                (Custom <int> ReturnValue, Custom <int> o) = p.OpCustomIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <CV?>(
                    Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>());
                (Custom <CV?> ReturnValue, Custom <CV?> o) = p.OpCustomCVSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <Custom <int> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <int>(Enumerable.Range(0, Length).ToList()));
                }
                (Custom <Custom <int> > ReturnValue, Custom <Custom <int> > o) = p.OpCustomIntSSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <Custom <CV?> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <CV?>(Enumerable.Range(0, Length).Select(
                                               x => new CV(x)).ToList <CV?>()));
                }
                (Custom <Custom <CV?> > ReturnValue, Custom <Custom <CV?> > o) = p.OpCustomCVSSAsync(i).Result;
                for (int c = 0; c < Length; ++c)
                {
                    TestHelper.Assert(o[c].SequenceEqual(i[c], new CVComparer()));
                    TestHelper.Assert(ReturnValue[c].SequenceEqual(i[c], new CVComparer()));
                }
            }

            {
                var i = new Serialize.Small();
                i.i = 99;

                (Serialize.Small ReturnValue, Serialize.Small o) = p.OpSerialSmallCSharpAsync(i).Result;
                TestHelper.Assert(o.i == 99);
                TestHelper.Assert(ReturnValue.i == 99);
            }

            {
                var i = new Serialize.Large();
                i.d1    = 1.0;
                i.d2    = 2.0;
                i.d3    = 3.0;
                i.d4    = 4.0;
                i.d5    = 5.0;
                i.d6    = 6.0;
                i.d7    = 7.0;
                i.d8    = 8.0;
                i.d9    = 9.0;
                i.d10   = 10.0;
                i.d11   = 11.0;
                i.proxy = p;
                i.s1    = Serialize.Large.LargeString;

                (Serialize.Large ReturnValue, Serialize.Large o) = p.OpSerialLargeCSharpAsync(i).Result;
                TestHelper.Assert(o.d1 == 1.0);
                TestHelper.Assert(o.d2 == 2.0);
                TestHelper.Assert(o.d3 == 3.0);
                TestHelper.Assert(o.d4 == 4.0);
                TestHelper.Assert(o.d5 == 5.0);
                TestHelper.Assert(o.d6 == 6.0);
                TestHelper.Assert(o.d7 == 7.0);
                TestHelper.Assert(o.d8 == 8.0);
                TestHelper.Assert(o.d9 == 9.0);
                TestHelper.Assert(o.d10 == 10.0);
                TestHelper.Assert(o.d11 == 11.0);
                TestHelper.Assert(o.proxy !.Equals(p));
                TestHelper.Assert(o.s1 == Serialize.Large.LargeString);

                TestHelper.Assert(ReturnValue.d1 == 1.0);
                TestHelper.Assert(ReturnValue.d2 == 2.0);
                TestHelper.Assert(ReturnValue.d3 == 3.0);
                TestHelper.Assert(ReturnValue.d4 == 4.0);
                TestHelper.Assert(ReturnValue.d5 == 5.0);
                TestHelper.Assert(ReturnValue.d6 == 6.0);
                TestHelper.Assert(ReturnValue.d7 == 7.0);
                TestHelper.Assert(ReturnValue.d8 == 8.0);
                TestHelper.Assert(ReturnValue.d9 == 9.0);
                TestHelper.Assert(ReturnValue.d10 == 10.0);
                TestHelper.Assert(ReturnValue.d11 == 11.0);
                TestHelper.Assert(ReturnValue.proxy !.Equals(p));
                TestHelper.Assert(ReturnValue.s1 == Serialize.Large.LargeString);
            }

            {
                var i = new Serialize.Struct();
                i.o  = null;
                i.o2 = i;
                i.s  = null;
                i.s2 = "Hello";

                (Serialize.Struct ReturnValue, Serialize.Struct o) = p.OpSerialStructCSharpAsync(i).Result;
                TestHelper.Assert(o.o == null);
                TestHelper.Assert(o.o2 == o);
                TestHelper.Assert(o.s == null);
                TestHelper.Assert(o.s2 == "Hello");

                TestHelper.Assert(ReturnValue.o == null);
                TestHelper.Assert(ReturnValue.o2 == ReturnValue);
                TestHelper.Assert(ReturnValue.s == null);
                TestHelper.Assert(ReturnValue.s2 == "Hello");
            }
        }
Пример #19
0
        internal static void Run(Communicator communicator, IMyClassPrx p)
        {
            {
                byte[] i = Enumerable.Range(0, Length).Select(x => (byte)x).ToArray();
                (byte[] ReturnValue, byte[] o) = p.OpAByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (byte)x).ToList();
                (List <byte> ReturnValue, List <byte> o) = p.OpLByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (LinkedList <byte> ReturnValue, LinkedList <byte> o) = p.OpKByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (Queue <byte> ReturnValue, Queue <byte> o) = p.OpQByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (Stack <byte> ReturnValue, Stack <byte> o) = p.OpSByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                (Custom <byte> ReturnValue, Custom <byte> o) = p.OpCByteSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                bool[] i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray();
                (bool[] ReturnValue, bool[] o) = p.OpABoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToList();
                (List <bool> ReturnValue, List <bool> o) = p.OpLBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (LinkedList <bool> ReturnValue, LinkedList <bool> o) = p.OpKBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (Queue <bool> ReturnValue, Queue <bool> o) = p.OpQBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (Stack <bool> ReturnValue, Stack <bool> o) = p.OpSBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                (Custom <bool> ReturnValue, Custom <bool> o) = p.OpCBoolSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                short[]? i = Enumerable.Range(0, Length).Select(x => (short)x).ToArray();
                (short[] ReturnValue, short[] o) = p.OpAShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToList();
                (List <short> ReturnValue, List <short> o) = p.OpLShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (LinkedList <short> ReturnValue, LinkedList <short> o) = p.OpKShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (Queue <short> ReturnValue, Queue <short> o) = p.OpQShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (Stack <short> ReturnValue, Stack <short> o) = p.OpSShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                (Custom <short> ReturnValue, Custom <short> o) = p.OpCShortSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                int[] i = Enumerable.Range(0, Length).ToArray();
                (int[] ReturnValue, int[] o) = p.OpAIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToList();
                (List <int> ReturnValue, List <int> o) = p.OpLIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <int>(Enumerable.Range(0, Length).ToArray());
                (LinkedList <int> ReturnValue, LinkedList <int> o) = p.OpKIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <int>(Enumerable.Range(0, Length).ToArray());
                (Queue <int> ReturnValue, Queue <int> o) = p.OpQIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <int>(Enumerable.Range(0, Length).ToArray());
                (Stack <int> ReturnValue, Stack <int> o) = p.OpSIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToArray());
                (Custom <int> ReturnValue, Custom <int> o) = p.OpCIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                long[]? i = Enumerable.Range(0, Length).Select(x => (long)x).ToArray();
                (long[] ReturnValue, long[] o) = p.OpALongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToList();
                (List <long> ReturnValue, List <long> o) = p.OpLLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (LinkedList <long> ReturnValue, LinkedList <long> o) = p.OpKLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (Queue <long> ReturnValue, Queue <long> o) = p.OpQLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (Stack <long> ReturnValue, Stack <long> o) = p.OpSLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                (Custom <long> ReturnValue, Custom <long> o) = p.OpCLongSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                float[] i = Enumerable.Range(0, Length).Select(x => (float)x).ToArray();
                (float[] ReturnValue, float[] o) = p.OpAFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToList();
                (List <float> ReturnValue, List <float> o) = p.OpLFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (LinkedList <float> ReturnValue, LinkedList <float> o) = p.OpKFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (Queue <float> ReturnValue, Queue <float> o) = p.OpQFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (Stack <float> ReturnValue, Stack <float> o) = p.OpSFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                (Custom <float> ReturnValue, Custom <float> o) = p.OpCFloatSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                double[] i = Enumerable.Range(0, Length).Select(x => (double)x).ToArray();
                (double[] ReturnValue, double[] o) = p.OpADoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToList();
                (List <double> ReturnValue, List <double> o) = p.OpLDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (LinkedList <double> ReturnValue, LinkedList <double> o) = p.OpKDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (Queue <double> ReturnValue, Queue <double> o) = p.OpQDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (Stack <double> ReturnValue, Stack <double> o) = p.OpSDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                (Custom <double> ReturnValue, Custom <double> o) = p.OpCDoubleSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                string[] i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray();
                (string[] ReturnValue, string[] o) = p.OpAStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToList();
                (List <string> ReturnValue, List <string> o) = p.OpLStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (LinkedList <string> ReturnValue, LinkedList <string> o) = p.OpKStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (Queue <string> ReturnValue, Queue <string> o) = p.OpQStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (Stack <string> ReturnValue, Stack <string> o) = p.OpSStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                (Custom <string> ReturnValue, Custom <string> o) = p.OpCStringSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                AnyClass[] i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToArray();
                (AnyClass?[] ReturnValue, AnyClass?[] o) = p.OpAObjectSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToList <AnyClass?>();
                (List <AnyClass?> ReturnValue, List <AnyClass?> o) = p.OpLObjectSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <AnyClass>(Enumerable.Range(0, Length).Select(
                                                  x => new CV(x) as AnyClass).ToArray());
                (Custom <AnyClass?> ReturnValue, Custom <AnyClass?> o) = p.OpCObjectSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                IObjectPrx[]? i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray();
                (IObjectPrx?[] ReturnValue, IObjectPrx?[] o) = p.OpAObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToList <IObjectPrx?>();
                (List <IObjectPrx?> ReturnValue, List <IObjectPrx?> o) = p.OpLObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                         x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (LinkedList <IObjectPrx?> ReturnValue, LinkedList <IObjectPrx?> o) = p.OpKObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (Queue <IObjectPrx?> ReturnValue, Queue <IObjectPrx?> o) = p.OpQObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (Stack <IObjectPrx?> ReturnValue, Stack <IObjectPrx?> o) = p.OpSObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                     x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                (Custom <IObjectPrx?> ReturnValue, Custom <IObjectPrx?> o) = p.OpCObjectPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                S[]? i = Enumerable.Range(0, Length).Select(x => new S(x)).ToArray();
                (S[] ReturnValue, S[] o) = p.OpAStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToList();
                (List <S> ReturnValue, List <S> o) = p.OpLStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (LinkedList <S> ReturnValue, LinkedList <S> o) = p.OpKStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (Queue <S> ReturnValue, Queue <S> o) = p.OpQStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (Stack <S> ReturnValue, Stack <S> o) = p.OpSStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                (Custom <S> ReturnValue, Custom <S> o) = p.OpCStructSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                CV[] i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToArray();
                (CV?[] ReturnValue, CV?[] o) = p.OpACVSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>();
                (List <CV?> ReturnValue, List <CV?> o) = p.OpLCVSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                IIPrx[] i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray();
                (IIPrx?[] ReturnValue, IIPrx?[] o) = p.OpAIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToList <IIPrx?>();
                (List <IIPrx?> ReturnValue, List <IIPrx?> o) = p.OpLIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (LinkedList <IIPrx?> ReturnValue, LinkedList <IIPrx?> o) = p.OpKIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (Queue <IIPrx?> ReturnValue, Queue <IIPrx?> o) = p.OpQIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (Stack <IIPrx?> ReturnValue, Stack <IIPrx?> o) = p.OpSIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                (Custom <IIPrx?> ReturnValue, Custom <IIPrx?> o) = p.OpCIPrxSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                CR[]? i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToArray();
                (CR?[] ReturnValue, CR?[] o) = p.OpACRSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToList <CR?>();
                (List <CR?> ReturnValue, List <CR?> o) = p.OpLCRSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = new Custom <CR>(Enumerable.Range(0, Length).Select(
                                            x => new CR(new CV(x))).ToArray());
                (List <CR?> ReturnValue, List <CR?> o) = p.OpLCRSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                En[] i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray();
                (En[] ReturnValue, En[] o) = p.OpAEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList();
                (List <En> ReturnValue, List <En> o) = p.OpLEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <En>(Enumerable.Range(0, Length).Select(
                                                x => (En)(x % 3)).ToArray());
                (LinkedList <En> ReturnValue, LinkedList <En> o) = p.OpKEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                (Queue <En> ReturnValue, Queue <En> o) = p.OpQEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                (Stack <En> ReturnValue, Stack <En> o) = p.OpSEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                (Custom <En> ReturnValue, Custom <En> o) = p.OpCEnSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToList());
                (Custom <int> ReturnValue, Custom <int> o) = p.OpCustomIntSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <CV?>(
                    Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>());
                (Custom <CV?> ReturnValue, Custom <CV?> o) = p.OpCustomCVSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <Custom <int> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <int>(Enumerable.Range(0, Length).ToList()));
                }
                (Custom <Custom <int> > ReturnValue, Custom <Custom <int> > o) = p.OpCustomIntSSAsync(i).Result;
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <Custom <CV?> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <CV?>(Enumerable.Range(0, Length).Select(
                                               x => new CV(x)).ToList <CV?>()));
                }
                (Custom <Custom <CV?> > ReturnValue, Custom <Custom <CV?> > o) = p.OpCustomCVSSAsync(i).Result;
                for (int c = 0; c < Length; ++c)
                {
                    TestHelper.Assert(o[c].SequenceEqual(i[c], new CVComparer()));
                    TestHelper.Assert(ReturnValue[c].SequenceEqual(i[c], new CVComparer()));
                }
            }
        }
Пример #20
0
        internal static Task RunAsync(IMyClassPrx p)
        {
            {
                var i = new Dictionary <int, int>
                {
                    [0] = 1,
                    [1] = 0
                };

                (Dictionary <int, int> ReturnValue, Dictionary <int, int> o) = p.OpNVAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i));
            }

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

                (Dictionary <string, string> ReturnValue, Dictionary <string, string> o) = p.OpNRAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i));
            }

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

                (Dictionary <string, Dictionary <int, int> > ReturnValue,
                 Dictionary <string, Dictionary <int, int> > o) = p.OpNDVAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i, DictionaryComparer <int, int> .AllEntries));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i, DictionaryComparer <int, int> .AllEntries));
            }

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

                (Dictionary <string, Dictionary <string, string> > ReturnValue,
                 Dictionary <string, Dictionary <string, string> > o) = p.OpNDRAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i, DictionaryComparer <string, string> .AllEntries));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i, DictionaryComparer <string, string> .AllEntries));
            }

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

                (Dictionary <string, int[]> ReturnValue, Dictionary <string, int[]> o) = p.OpNDAISAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <int> .AllElements));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i, SequenceComparer <int> .AllElements));
            }

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

                (Dictionary <string, List <int> > ReturnValue,
                 Dictionary <string, List <int> > o) = p.OpNDGISAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <int> .AllElements));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i, SequenceComparer <int> .AllElements));
            }

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

                (Dictionary <string, string[]> ReturnValue,
                 Dictionary <string, string[]> o) = p.OpNDASSAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <string> .AllElements));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i, SequenceComparer <string> .AllElements));
            }

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

                (Dictionary <string, List <string> > ReturnValue,
                 Dictionary <string, List <string> > o) = p.OpNDGSSAsync(i).Result;
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <string> .AllElements));
                TestHelper.Assert(ReturnValue.DictionaryEqual(i, SequenceComparer <string> .AllElements));
            }
            return(Task.CompletedTask);
        }
Пример #21
0
        internal static void twowaysAMI(Communicator communicator, IMyClassPrx p)
        {
            {
                var i = Enumerable.Range(0, Length).Select(x => (byte)x).ToArray();
                var r = p.opAByteSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (byte)x).ToList();
                var r = p.opLByteSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var r = p.opKByteSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var r = p.opQByteSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var r = p.opSByteSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var r = p.opCByteSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray();
                var r = p.opABoolSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToList();
                var r = p.opLBoolSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var r = p.opKBoolSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var r = p.opQBoolSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var r = p.opSBoolSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var r = p.opCBoolSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToArray();
                var r = p.opAShortSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToList();
                var r = p.opLShortSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var r = p.opKShortSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var r = p.opQShortSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var r = p.opSShortSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var r = p.opCShortSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToArray();
                var r = p.opAIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToList();
                var r = p.opLIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <int>(Enumerable.Range(0, Length).ToArray());
                var r = p.opKIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <int>(Enumerable.Range(0, Length).ToArray());
                var r = p.opQIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <int>(Enumerable.Range(0, Length).ToArray());
                var r = p.opSIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToArray());
                var r = p.opCIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToArray();
                var r = p.opALongSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToList();
                var r = p.opLLongSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var r = p.opKLongSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var r = p.opQLongSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var r = p.opSLongSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var r = p.opCLongSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToArray();
                var r = p.opAFloatSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToList();
                var r = p.opLFloatSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var r = p.opKFloatSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var r = p.opQFloatSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var r = p.opSFloatSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var r = p.opCFloatSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToArray();
                var r = p.opADoubleSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToList();
                var r = p.opLDoubleSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var r = p.opKDoubleSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var r = p.opQDoubleSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var r = p.opSDoubleSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var r = p.opCDoubleSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray();
                var r = p.opAStringSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToList();
                var r = p.opLStringSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var r = p.opKStringSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var r = p.opQStringSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var r = p.opSStringSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var r = p.opCStringSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToArray();
                var r = p.opAObjectSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToList <AnyClass?>();
                var r = p.opLObjectSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <AnyClass>(Enumerable.Range(0, Length).Select(
                                                  x => new CV(x) as AnyClass).ToArray());
                var r = p.opCObjectSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray();
                var r = p.opAObjectPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToList <IObjectPrx?>();
                var r = p.opLObjectPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                         x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opKObjectPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opQObjectPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opSObjectPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                     x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opCObjectPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToArray();
                var r = p.opAStructSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToList();
                var r = p.opLStructSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var r = p.opKStructSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var r = p.opQStructSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var r = p.opSStructSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var r = p.opCStructSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToArray();
                var r = p.opACVSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>();
                var r = p.opLCVSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray();
                var r = p.opAIPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToList <IIPrx?>();
                var r = p.opLIPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opKIPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opQIPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opSIPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                var r = p.opCIPrxSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToArray();
                var r = p.opACRSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToList <CR?>();
                var r = p.opLCRSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = new Custom <CR>(Enumerable.Range(0, Length).Select(
                                            x => new CR(new CV(x))).ToArray());
                var r = p.opLCRSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray();
                var r = p.opAEnSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList();
                var r = p.opLEnSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new LinkedList <En>(Enumerable.Range(0, Length).Select(
                                                x => (En)(x % 3)).ToArray());
                var r = p.opKEnSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Queue <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                var r = p.opQEnSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Stack <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                var r = p.opSEnSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray());
                var r = p.opCEnSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToList());
                var r = p.opCustomIntSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <CV?>(
                    Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>());
                var r = p.opCustomCVSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <Custom <int> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <int>(Enumerable.Range(0, Length).ToList()));
                }
                var r = p.opCustomIntSSAsync(i).Result;
                TestHelper.Assert(r.o.SequenceEqual(i));
                TestHelper.Assert(r.ReturnValue.SequenceEqual(i));
            }

            {
                var i = new Custom <Custom <CV?> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <CV?>(Enumerable.Range(0, Length).Select(
                                               x => new CV(x)).ToList <CV?>()));
                }
                var r = p.opCustomCVSSAsync(i).Result;
                for (int c = 0; c < Length; ++c)
                {
                    TestHelper.Assert(r.o[c].SequenceEqual(i[c], new CVComparer()));
                    TestHelper.Assert(r.ReturnValue[c].SequenceEqual(i[c], new CVComparer()));
                }
            }

            {
                var i = new Serialize.Small();
                i.i = 99;

                (Serialize.Small ReturnValue, Serialize.Small o) = p.opSerialSmallCSharpAsync(i).Result;
                TestHelper.Assert(o.i == 99);
                TestHelper.Assert(ReturnValue.i == 99);
            }

            {
                var i = new Serialize.Large();
                i.d1  = 1.0;
                i.d2  = 2.0;
                i.d3  = 3.0;
                i.d4  = 4.0;
                i.d5  = 5.0;
                i.d6  = 6.0;
                i.d7  = 7.0;
                i.d8  = 8.0;
                i.d9  = 9.0;
                i.d10 = 10.0;
                i.d11 = 11.0;
                i.s1  = Serialize.Large.LargeString;

                (Serialize.Large ReturnValue, Serialize.Large o) = p.opSerialLargeCSharpAsync(i).Result;
                TestHelper.Assert(o.d1 == 1.0);
                TestHelper.Assert(o.d2 == 2.0);
                TestHelper.Assert(o.d3 == 3.0);
                TestHelper.Assert(o.d4 == 4.0);
                TestHelper.Assert(o.d5 == 5.0);
                TestHelper.Assert(o.d6 == 6.0);
                TestHelper.Assert(o.d7 == 7.0);
                TestHelper.Assert(o.d8 == 8.0);
                TestHelper.Assert(o.d9 == 9.0);
                TestHelper.Assert(o.d10 == 10.0);
                TestHelper.Assert(o.d11 == 11.0);
                TestHelper.Assert(o.s1 == Serialize.Large.LargeString);

                TestHelper.Assert(ReturnValue.d1 == 1.0);
                TestHelper.Assert(ReturnValue.d2 == 2.0);
                TestHelper.Assert(ReturnValue.d3 == 3.0);
                TestHelper.Assert(ReturnValue.d4 == 4.0);
                TestHelper.Assert(ReturnValue.d5 == 5.0);
                TestHelper.Assert(ReturnValue.d6 == 6.0);
                TestHelper.Assert(ReturnValue.d7 == 7.0);
                TestHelper.Assert(ReturnValue.d8 == 8.0);
                TestHelper.Assert(ReturnValue.d9 == 9.0);
                TestHelper.Assert(ReturnValue.d10 == 10.0);
                TestHelper.Assert(ReturnValue.d11 == 11.0);
                TestHelper.Assert(ReturnValue.s1 == Serialize.Large.LargeString);
            }

            {
                var i = new Serialize.Struct();
                i.o  = null;
                i.o2 = i;
                i.s  = null;
                i.s2 = "Hello";

                (Serialize.Struct ReturnValue, Serialize.Struct o) = p.opSerialStructCSharpAsync(i).Result;
                TestHelper.Assert(o.o == null);
                TestHelper.Assert(o.o2 == o);
                TestHelper.Assert(o.s == null);
                TestHelper.Assert(o.s2 == "Hello");

                TestHelper.Assert(ReturnValue.o == null);
                TestHelper.Assert(ReturnValue.o2 == ReturnValue);
                TestHelper.Assert(ReturnValue.s == null);
                TestHelper.Assert(ReturnValue.s2 == "Hello");
            }
        }
Пример #22
0
        internal static void twoways(Communicator communicator, IMyClassPrx p)
        {
            {
                var i = Enumerable.Range(0, Length).Select(x => (byte)x).ToArray();
                var(r, o) = p.opAByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (byte)x).ToList();
                var(r, o) = p.opLByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var(r, o) = p.opKByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var(r, o) = p.opQByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <byte>(Enumerable.Range(0, Length).Select(x => (byte)x).ToArray());
                var(r, o) = p.opSByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 1 == 1).ToArray();
                var(r, o) = p.opABoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 1 == 1).ToList();
                var(r, o) = p.opLBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <bool>(Enumerable.Range(0, Length).Select(x => x % 1 == 1).ToArray());
                var(r, o) = p.opKBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <bool>(Enumerable.Range(0, Length).Select(x => x % 1 == 1).ToArray());
                var(r, o) = p.opQBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <bool>(Enumerable.Range(0, Length).Select(x => x % 1 == 1).ToArray());
                var(r, o) = p.opSBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToArray();
                var(r, o) = p.opAShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToList();
                var(r, o) = p.opLShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.opKShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.opQShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.opSShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToArray();
                var(r, o) = p.opAIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToList();
                var(r, o) = p.opLIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.opKIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.opQIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.opSIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToArray();
                var(r, o) = p.opALongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToList();
                var(r, o) = p.opLLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.opKLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.opQLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.opSLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToArray();
                var(r, o) = p.opAFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToList();
                var(r, o) = p.opLFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.opKFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.opQFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.opSFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToArray();
                var(r, o) = p.opADoubleS(i);
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(r.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToList();
                var(r, o) = p.opLDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.opKDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.opQDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.opSDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray();
                var(r, o) = p.opAStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToList();
                var(r, o) = p.opLStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.opKStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.opQStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.opSStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToArray();
                var(r, o) = p.opAObjectS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToList <AnyClass?>();
                var(r, o) = p.opLObjectS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray();
                var(r, o) = p.opAObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToList <IObjectPrx?>();
                var(r, o) = p.opLObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                         x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.opKObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.opQObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.opSObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToArray();
                var(r, o) = p.opAStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToList();
                var(r, o) = p.opLStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.opKStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.opQStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.opSStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new SD(x)).ToArray();
                var(r, o) = p.opAStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new SD(x)).ToList();
                var(r, o) = p.opLStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.opKStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.opQStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.opSStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToArray();
                var(r, o) = p.opACVS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>();
                var(r, o) = p.opLCVS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToArray();
                var(r, o) = p.opACRS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToList <CR?>();
                var(r, o) = p.opLCRS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray();
                var(r, o) = p.opAEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList();
                var(r, o) = p.opLEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.opKEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.opQEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.opSEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray();
                var(r, o) = p.opAIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToList <IIPrx?>();
                var(r, o) = p.opLIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IIPrx.Parse(x.ToString(), communicator)).ToList());
                var(r, o) = p.opKIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToList());
                var(r, o) = p.opQIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToList());
                var(r, o) = p.opSIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToList());
                var(r, o) = p.opCustomIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <CV?>(
                    Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>());
                var(r, o) = p.opCustomCVS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <Custom <int> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <int>(Enumerable.Range(0, Length).ToList()));
                }
                var(r, o) = p.opCustomIntSS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <Custom <CV?> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <CV?>(Enumerable.Range(0, Length).Select(
                                               x => new CV(x)).ToList <CV?>()));
                }
                var(r, o) = p.opCustomCVSS(i);
                for (int c = 0; c < Length; ++c)
                {
                    TestHelper.Assert(r[c].SequenceEqual(i[c], new CVComparer()));
                    TestHelper.Assert(o[c].SequenceEqual(i[c], new CVComparer()));
                }
            }

            {
                Serialize.Small i = new Serialize.Small();
                i.i = 99;
                Serialize.Small o;
                Serialize.Small r;

                try
                {
                    (r, o) = p.opSerialSmallCSharp(i);

                    TestHelper.Assert(o.i == 99);
                    TestHelper.Assert(r.i == 99);
                }
                catch (OperationNotExistException)
                {
                    // OK, talking to non-C# server.
                }
            }

            {
                Serialize.Large i = new Serialize.Large();
                i.d1  = 1.0;
                i.d2  = 2.0;
                i.d3  = 3.0;
                i.d4  = 4.0;
                i.d5  = 5.0;
                i.d6  = 6.0;
                i.d7  = 7.0;
                i.d8  = 8.0;
                i.d9  = 9.0;
                i.d10 = 10.0;
                i.d11 = 11.0;
                i.s1  = Serialize.Large.LargeString;
                Serialize.Large o;
                Serialize.Large r;

                try
                {
                    (r, o) = p.opSerialLargeCSharp(i);
                    TestHelper.Assert(o.d1 == 1.0);
                    TestHelper.Assert(o.d2 == 2.0);
                    TestHelper.Assert(o.d3 == 3.0);
                    TestHelper.Assert(o.d4 == 4.0);
                    TestHelper.Assert(o.d5 == 5.0);
                    TestHelper.Assert(o.d6 == 6.0);
                    TestHelper.Assert(o.d7 == 7.0);
                    TestHelper.Assert(o.d8 == 8.0);
                    TestHelper.Assert(o.d9 == 9.0);
                    TestHelper.Assert(o.d10 == 10.0);
                    TestHelper.Assert(o.d11 == 11.0);
                    TestHelper.Assert(o.s1 == Serialize.Large.LargeString);
                    TestHelper.Assert(r.d1 == 1.0);
                    TestHelper.Assert(r.d2 == 2.0);
                    TestHelper.Assert(r.d3 == 3.0);
                    TestHelper.Assert(r.d4 == 4.0);
                    TestHelper.Assert(r.d5 == 5.0);
                    TestHelper.Assert(r.d6 == 6.0);
                    TestHelper.Assert(r.d7 == 7.0);
                    TestHelper.Assert(r.d8 == 8.0);
                    TestHelper.Assert(r.d9 == 9.0);
                    TestHelper.Assert(r.d10 == 10.0);
                    TestHelper.Assert(r.d11 == 11.0);
                    TestHelper.Assert(r.s1 == Serialize.Large.LargeString);
                }
                catch (OperationNotExistException)
                {
                    // OK, talking to non-C# server.
                }
            }

            {
                Serialize.Struct i = new Serialize.Struct();
                i.o  = null;
                i.o2 = i;
                i.s  = null;
                i.s2 = "Hello";
                Serialize.Struct o;
                Serialize.Struct r;

                try
                {
                    (r, o) = p.opSerialStructCSharp(i);
                    TestHelper.Assert(o.o == null);
                    TestHelper.Assert(o.o2 != null);
                    TestHelper.Assert(((Serialize.Struct)(o.o2)).o == null);
                    TestHelper.Assert(((Serialize.Struct)(o.o2)).o2 == o.o2);
                    TestHelper.Assert(o.s == null);
                    TestHelper.Assert(o.s2 !.Equals("Hello"));
                    TestHelper.Assert(r.o == null);
                    TestHelper.Assert(r.o2 != null);
                    TestHelper.Assert(((Serialize.Struct)(r.o2)).o == null);
                    TestHelper.Assert(((Serialize.Struct)(r.o2)).o2 == r.o2);
                    TestHelper.Assert(r.s == null);
                    TestHelper.Assert(r.s2 !.Equals("Hello"));
                }
                catch (OperationNotExistException)
                {
                    // OK, talking to non-C# server.
                }
            }
        }
Пример #23
0
        internal static void Run(Communicator communicator, IMyClassPrx p)
        {
            {
                byte[]? i            = Enumerable.Range(0, Length).Select(x => (byte)x).ToArray();
                (byte[] r, byte[] o) = p.OpAByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new List <byte>(Enumerable.Range(0, Length).Select(x => (byte)x));
                (List <byte> r, List <byte> o) = p.OpLByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <byte>(Enumerable.Range(0, Length).Select(x => (byte)x));
                (LinkedList <byte> r, LinkedList <byte> o) = p.OpKByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <byte>(Enumerable.Range(0, Length).Select(x => (byte)x));
                (Queue <byte> r, Queue <byte> o) = p.OpQByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <byte>(Enumerable.Range(0, Length).Select(x => (byte)x));
                (Stack <byte> r, Stack <byte> o) = p.OpSByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <byte>(Enumerable.Range(0, Length).Select(x => (byte)x));
                (Custom <byte> r, Custom <byte> o) = p.OpCByteS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                bool[]? i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray();
                var(r, o) = p.OpABoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToList();
                var(r, o) = p.OpLBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var(r, o) = p.OpKBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var(r, o) = p.OpQBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var(r, o) = p.OpSBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <bool>(Enumerable.Range(0, Length).Select(x => x % 2 == 1).ToArray());
                var(r, o) = p.OpCBoolS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToArray();
                var(r, o) = p.OpAShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (short)x).ToList();
                var(r, o) = p.OpLShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.OpKShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.OpQShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.OpSShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <short>(Enumerable.Range(0, Length).Select(x => (short)x).ToArray());
                var(r, o) = p.OpCShortS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToArray();
                var(r, o) = p.OpAIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).ToList();
                var(r, o) = p.OpLIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.OpKIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.OpQIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.OpSIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToArray());
                var(r, o) = p.OpCIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToArray();
                var(r, o) = p.OpALongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (long)x).ToList();
                var(r, o) = p.OpLLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.OpKLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.OpQLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.OpSLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <long>(Enumerable.Range(0, Length).Select(x => (long)x).ToArray());
                var(r, o) = p.OpCLongS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToArray();
                var(r, o) = p.OpAFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (float)x).ToList();
                var(r, o) = p.OpLFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.OpKFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.OpQFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.OpSFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <float>(Enumerable.Range(0, Length).Select(x => (float)x).ToArray());
                var(r, o) = p.OpCFloatS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToArray();
                var(r, o) = p.OpADoubleS(i);
                TestHelper.Assert(o.SequenceEqual(i));
                TestHelper.Assert(r.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (double)x).ToList();
                var(r, o) = p.OpLDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.OpKDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.OpQDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.OpSDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <double>(Enumerable.Range(0, Length).Select(x => (double)x).ToArray());
                var(r, o) = p.OpCDoubleS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray();
                var(r, o) = p.OpAStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => x.ToString()).ToList();
                var(r, o) = p.OpLStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.OpKStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.OpQStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.OpSStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <string>(Enumerable.Range(0, Length).Select(x => x.ToString()).ToArray());
                var(r, o) = p.OpCStringS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToArray();
                var(r, o) = p.OpAObjectS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x) as AnyClass).ToList <AnyClass?>();
                var(r, o) = p.OpLObjectS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <AnyClass>(Enumerable.Range(0, Length).Select(
                                                  x => new CV(x) as AnyClass).ToArray());
                var(r, o) = p.OpCObjectS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray();
                var(r, o) = p.OpAObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToList <IObjectPrx?>();
                var(r, o) = p.OpLObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                         x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.OpKObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.OpQObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.OpSObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <IObjectPrx?>(Enumerable.Range(0, Length).Select(
                                                     x => IObjectPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.OpCObjectPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToArray();
                var(r, o) = p.OpAStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new S(x)).ToList();
                var(r, o) = p.OpLStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.OpKStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.OpQStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.OpSStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <S>(Enumerable.Range(0, Length).Select(x => new S(x)).ToArray());
                var(r, o) = p.OpCStructS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new SD(x)).ToArray();
                var(r, o) = p.OpAStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new SD(x)).ToList();
                var(r, o) = p.OpLStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.OpKStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.OpQStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.OpSStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <SD>(Enumerable.Range(0, Length).Select(x => new SD(x)).ToList());
                var(r, o) = p.OpCStructSD(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToArray();
                var(r, o) = p.OpACVS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>();
                var(r, o) = p.OpLCVS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToArray();
                var(r, o) = p.OpAIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(
                    x => IIPrx.Parse(x.ToString(), communicator)).ToList <IIPrx?>();
                var(r, o) = p.OpLIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                    x => IIPrx.Parse(x.ToString(), communicator)).ToList());
                var(r, o) = p.OpKIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToList());
                var(r, o) = p.OpQIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <IIPrx?>(Enumerable.Range(0, Length).Select(
                                               x => IIPrx.Parse(x.ToString(), communicator)).ToList());
                var(r, o) = p.OpSIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <IIPrx?>(Enumerable.Range(0, Length).Select(
                                                x => IIPrx.Parse(x.ToString(), communicator)).ToArray());
                var(r, o) = p.OpCIPrxS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToArray();
                var(r, o) = p.OpACRS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToList <CR?>();
                var(r, o) = p.OpLCRS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = new Custom <CR>(Enumerable.Range(0, Length).Select(x => new CR(new CV(x))).ToArray());
                var(r, o) = p.OpCCRS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CRComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CRComparer()));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToArray();
                var(r, o) = p.OpAEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList();
                var(r, o) = p.OpLEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new LinkedList <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.OpKEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Queue <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.OpQEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Stack <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.OpSEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <En>(Enumerable.Range(0, Length).Select(x => (En)(x % 3)).ToList());
                var(r, o) = p.OpCEnS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <int>(Enumerable.Range(0, Length).ToList());
                var(r, o) = p.OpCustomIntS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <CV?>(
                    Enumerable.Range(0, Length).Select(x => new CV(x)).ToList <CV?>());
                var(r, o) = p.OpCustomCVS(i);
                TestHelper.Assert(r.SequenceEqual(i, new CVComparer()));
                TestHelper.Assert(o.SequenceEqual(i, new CVComparer()));
            }

            {
                var i = new Custom <Custom <int> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <int>(Enumerable.Range(0, Length).ToList()));
                }
                var(r, o) = p.OpCustomIntSS(i);
                TestHelper.Assert(r.SequenceEqual(i));
                TestHelper.Assert(o.SequenceEqual(i));
            }

            {
                var i = new Custom <Custom <CV?> >();
                for (int c = 0; c < Length; ++c)
                {
                    i.Add(new Custom <CV?>(Enumerable.Range(0, Length).Select(
                                               x => new CV(x)).ToList <CV?>()));
                }
                var(r, o) = p.OpCustomCVSS(i);
                for (int c = 0; c < Length; ++c)
                {
                    TestHelper.Assert(r[c].SequenceEqual(i[c], new CVComparer()));
                    TestHelper.Assert(o[c].SequenceEqual(i[c], new CVComparer()));
                }
            }
        }
Пример #24
0
        public static async Task RunAsync(TestHelper helper)
        {
            Communicator communicator = helper.Communicator;

            bool        ice1   = helper.Protocol == Protocol.Ice1;
            var         cl     = IMyClassPrx.Parse(helper.GetTestProxy("test", 0), communicator);
            IMyClassPrx oneway = cl.Clone(oneway: true);

            System.IO.TextWriter output = helper.Output;
            output.Write("testing InvokeAsync... ");
            output.Flush();

            {
                using var request = OutgoingRequestFrame.WithEmptyArgs(oneway, "opOneway", idempotent: false);

                try
                {
                    using IncomingResponseFrame response = oneway.InvokeAsync(request, oneway: true).Result;
                }
                catch
                {
                    TestHelper.Assert(false);
                }
            }

            {
                using var request = OutgoingRequestFrame.WithArgs(cl,
                                                                  "opString",
                                                                  idempotent: false,
                                                                  compress: false,
                                                                  format: default,
                                                                  context: null,
                                                                  TestString,
                                                                  OutputStream.IceWriterFromString);

                using IncomingResponseFrame response = cl.InvokeAsync(request).Result;
                (string s1, string s2) = response.ReadReturnValue(cl, istr =>
                {
                    string s1 = istr.ReadString();
                    string s2 = istr.ReadString();
                    return(s1, s2);
                });
                TestHelper.Assert(s1.Equals(TestString));
                TestHelper.Assert(s2.Equals(TestString));
            }

            {
                using var request = OutgoingRequestFrame.WithEmptyArgs(cl, "opException", idempotent: false);
                using IncomingResponseFrame response = cl.InvokeAsync(request).Result;

                try
                {
                    response.ReadVoidReturnValue(cl);
                    TestHelper.Assert(false);
                }
                catch (MyException)
                {
                }
                catch
                {
                    TestHelper.Assert(false);
                }
            }

            output.WriteLine("ok");
            await cl.ShutdownAsync();
        }
Пример #25
0
        internal static void Run(IMyClassPrx p)
        {
            {
                var i = new Dictionary <int, int>
                {
                    [0] = 1,
                    [1] = 0
                };

                (Dictionary <int, int> ReturnValue, Dictionary <int, int> o) = p.OpNVAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i));
            }

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

                (Dictionary <string, string> ReturnValue, Dictionary <string, string> o) = p.OpNRAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i));
            }

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

                (Dictionary <string, Dictionary <int, int> > ReturnValue,
                 Dictionary <string, Dictionary <int, int> > o) = p.OpNDVAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i, (lhs, rhs) => lhs.DictionaryEquals(rhs)));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i, (lhs, rhs) => lhs.DictionaryEquals(rhs)));
            }

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

                (Dictionary <string, Dictionary <string, string> > ReturnValue,
                 Dictionary <string, Dictionary <string, string> > o) = p.OpNDRAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i, (lhs, rhs) => lhs.DictionaryEquals(rhs)));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i, (lhs, rhs) => lhs.DictionaryEquals(rhs)));
            }

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

                (Dictionary <string, int[]> ReturnValue, Dictionary <string, int[]> o) = p.OpNDAISAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
            }

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

                (Dictionary <string, List <int> > ReturnValue,
                 Dictionary <string, List <int> > o) = p.OpNDGISAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
            }

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

                (Dictionary <string, string[]> ReturnValue,
                 Dictionary <string, string[]> o) = p.OpNDASSAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
            }

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

                (Dictionary <string, List <string> > ReturnValue,
                 Dictionary <string, List <string> > o) = p.OpNDGSSAsync(i).Result;
                TestHelper.Assert(o.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
                TestHelper.Assert(ReturnValue.DictionaryEquals(i, (lhs, rhs) => lhs.SequenceEqual(rhs)));
            }
        }
Пример #26
0
        public static IMyClassPrx Run(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            System.IO.TextWriter output = helper.GetWriter();
            output.Write("testing proxy parsing... ");
            output.Flush();

            // ice1 proxies
            string[] ice1ProxyArray =
            {
                "ice -t:tcp -p 10000",
                "ice+tcp:ssl -p 10000",
            };

            // ice2 proxies
            string[] ice2ProxyArray =
            {
                "ice+tcp://host.zeroc.com/identity#facet",
                "ice+tcp://host.zeroc.com:1000/category/name",
                "ice+tcp://host.zeroc.com/category/name%20with%20space",
                "ice+ws://host.zeroc.com//identity",
                "ice+ws://host.zeroc.com//identity?alt-endpoint=host2.zeroc.com",
                "ice+ws://host.zeroc.com//identity?alt-endpoint=host2.zeroc.com:10000",
                "ice+tcp://[::1]:10000/identity?alt-endpoint=host1:10000,host2,host3,host4",
                "ice+ssl://[::1]:10000/identity?alt-endpoint=host1:10000&alt-endpoint=host2,host3&alt-endpoint=[::2]",
                "ice:location//identity#facet",
                "ice+tcp://host.zeroc.com//identity",
                "ice+tcp://host.zeroc.com:/identity", // another syntax for empty port
                "ice+universal://com.zeroc.ice/identity?transport=iaps&option=a,b%2Cb,c&option=d",
                "ice+universal://host.zeroc.com/identity?transport=100",
                "ice+universal://[::ab:cd:ef:00]/identity?transport=bt", // leading :: to make the address IPv6-like
                "ice+ws://host.zeroc.com/identity?resource=/foo%2Fbar?/xyz",
                "ice+universal://host.zeroc.com:10000/identity?transport=tcp",
                "ice+universal://host.zeroc.com/identity?transport=ws&option=/foo%2520/bar",
                "ice:tcp -p 10000", // a valid URI
            };

            // ice3 proxies
            string[] ice3ProxyArray =
            {
                "ice+universal://host.zeroc.com/identity?transport=ws&option=/foo%2520/bar&protocol=3"
            };

            foreach (string str in ice1ProxyArray)
            {
                var prx = IObjectPrx.Parse(str, communicator);
                TestHelper.Assert(prx.Protocol == Protocol.Ice1);
                // output.WriteLine($"{str} = {prx}");
                var prx2 = IObjectPrx.Parse(prx.ToString() !, communicator);
                TestHelper.Assert(prx.Equals(prx2)); // round-trip works
            }

            foreach (string str in ice2ProxyArray)
            {
                var prx = IObjectPrx.Parse(str, communicator);
                TestHelper.Assert(prx.Protocol == Protocol.Ice2);
                // output.WriteLine($"{str} = {prx}");
                var prx2 = IObjectPrx.Parse(prx.ToString() !, communicator);
                TestHelper.Assert(prx.Equals(prx2)); // round-trip works
            }

            foreach (string str in ice3ProxyArray)
            {
                var prx = IObjectPrx.Parse(str, communicator);
                TestHelper.Assert(prx.Protocol == (Protocol)3);
                // output.WriteLine($"{str} = {prx}");
                var prx2 = IObjectPrx.Parse(prx.ToString() !, communicator);
                TestHelper.Assert(prx.Equals(prx2)); // round-trip works
            }

            string[] badProxyArray =
            {
                "ice+tcp://host.zeroc.com:foo",                                       // missing host
                "ice+tcp:identity?protocol=invalid",                                  // invalid protocol
                "ice+universal://host.zeroc.com",                                     // missing transport
                "ice+universal://host.zeroc.com?transport=100&protocol=ice1",         // invalid protocol
                "ice://*****:*****@adapter test",
                "id -f \"facet x",
                "id -f \'facet x",
                "test -f facet@test @test",
                "test -p 2.0",
                "test:tcp@adapterId",
                "test: :tcp",
                "id:opaque -t 99 -v abcd -x abc", // invalid x option
                "id:opaque",                      // missing -t and -v
                "id:opaque -t 1 -t 1 -v abcd",    // repeated -t
                "id:opaque -t 1 -v abcd -v abcd",
                "id:opaque -v abcd",
                "id:opaque -t 1",
                "id:opaque -t -v abcd",
                "id:opaque -t 1 -v",
                "id:opaque -t x -v abcd",
                "id:opaque -t -1 -v abcd", // -t must be >= 0
                "id:opaque -t 99 -v x?c",  // invalid char in v
                "id:opaque -t 99 -v xc",   // invalid length for base64 input
            };

            foreach (string str in badProxyArray)
            {
                try
                {
                    _ = IObjectPrx.Parse(str, communicator);
                    TestHelper.Assert(false);
                }
                catch (FormatException)
                {
                    // expected
                }
            }

            string rf        = helper.GetTestProxy("test");
            var    baseProxy = IObjectPrx.Parse(rf, communicator);

            TestHelper.Assert(baseProxy != null);

            var b1 = IObjectPrx.Parse("ice:test", communicator);

            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Length == 0 && b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse("ice:test ", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse(" ice:test ", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse(" ice:test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse("test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Length == 0 && b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse("test ", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse(" test ", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);

            b1 = IObjectPrx.Parse(" test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);

            // The following tests are only relevant to the ice1 format
            b1 = IObjectPrx.Parse("'test -f facet'", communicator);
            TestHelper.Assert(b1.Identity.Name == "test -f facet" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            try
            {
                b1 = IObjectPrx.Parse("\"test -f facet'", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("\"test -f facet\"", communicator);
            TestHelper.Assert(b1.Identity.Name == "test -f facet" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse("\"test -f facet@test\"", communicator);
            TestHelper.Assert(b1.Identity.Name == "test -f facet@test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            b1 = IObjectPrx.Parse("\"test -f facet@test @test\"", communicator);
            TestHelper.Assert(b1.Identity.Name == "test -f facet@test @test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet.Length == 0);
            try
            {
                b1 = IObjectPrx.Parse("test test", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("test\\040test", communicator);

            TestHelper.Assert(b1.Identity.Name == "test test" && b1.Identity.Category.Length == 0);
            try
            {
                b1 = IObjectPrx.Parse("test\\777", communicator);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }
            b1 = IObjectPrx.Parse("test\\40test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test test");

            // Test some octal and hex corner cases.
            b1 = IObjectPrx.Parse("test\\4test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test\u0004test");
            b1 = IObjectPrx.Parse("test\\04test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test\u0004test");
            b1 = IObjectPrx.Parse("test\\004test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test\u0004test");
            b1 = IObjectPrx.Parse("test\\1114test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test\u00494test");

            b1 = IObjectPrx.Parse("test\\b\\f\\n\\r\\t\\'\\\"\\\\test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test\b\f\n\r\t\'\"\\test" && b1.Identity.Category.Length == 0);

            // End of ice1 format-only tests

            b1 = IObjectPrx.Parse("ice:category/test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Length == 0);

            b1 = IObjectPrx.Parse("ice+tcp://host:10000/test?source-address=::1", communicator);
            TestHelper.Assert(b1.Equals(IObjectPrx.Parse(b1.ToString() !, communicator)));

            b1 = IObjectPrx.Parse("ice:adapter//test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Equals("adapter"));

            b1 = IObjectPrx.Parse("ice:adapter/category/test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Equals("adapter"));

            b1 = IObjectPrx.Parse("ice:adapter:tcp/category/test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Equals("adapter:tcp"));
            // preferred syntax with escape:
            TestHelper.Assert(b1.Equals(IObjectPrx.Parse("ice:adapter%3Atcp/category/test", communicator)));

            b1 = IObjectPrx.Parse("category/test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Length == 0);

            b1 = IObjectPrx.Parse("test:tcp -h host -p 10000 --sourceAddress \"::1\"", communicator);
            TestHelper.Assert(b1.Equals(IObjectPrx.Parse(b1.ToString() !, communicator)));

            b1 = IObjectPrx.Parse(
                "test:udp -h host -p 10000 --sourceAddress \"::1\" --interface \"0:0:0:0:0:0:0:1%lo\"",
                communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.AdapterId.Length == 0);

            b1 = IObjectPrx.Parse("test@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.AdapterId.Equals("adapter"));

            b1 = IObjectPrx.Parse("category/test@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Equals("adapter"));

            b1 = IObjectPrx.Parse("category/test@adapter:tcp", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Equals("adapter:tcp"));

            // The following tests are only for the ice1 format:
            b1 = IObjectPrx.Parse("'category 1/test'@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category 1" &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("'category/test 1'@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name == "test 1" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("'category/test'@'adapter 1'", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category" &&
                              b1.AdapterId.Equals("adapter 1"));
            b1 = IObjectPrx.Parse("\"category \\/test@foo/test\"@adapter", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category /test@foo" &&
                              b1.AdapterId.Equals("adapter"));
            b1 = IObjectPrx.Parse("\"category \\/test@foo/test\"@\"adapter:tcp\"", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category == "category /test@foo" &&
                              b1.AdapterId.Equals("adapter:tcp"));
            // End of ice1 format-only tests.

            b1 = IObjectPrx.Parse("ice:id#facet", communicator);
            TestHelper.Assert(b1.Identity.Name == "id" && b1.Identity.Category.Length == 0 && b1.Facet == "facet");

            b1 = IObjectPrx.Parse("ice:id#facet%20x", communicator);
            TestHelper.Assert(b1.Identity.Name == "id" && b1.Identity.Category.Length == 0 && b1.Facet == "facet x");

            b1 = IObjectPrx.Parse("id -f facet", communicator);
            TestHelper.Assert(b1.Identity.Name == "id" && b1.Identity.Category.Length == 0 && b1.Facet == "facet");

            b1 = IObjectPrx.Parse("id -f 'facet x'", communicator);
            TestHelper.Assert(b1.Identity.Name == "id" && b1.Identity.Category.Length == 0 && b1.Facet == "facet x");

            // The following tests are only for the ice1 format:
            b1 = IObjectPrx.Parse("id -f \"facet x\"", communicator);
            TestHelper.Assert(b1.Identity.Name == "id" && b1.Identity.Category.Length == 0 && b1.Facet == "facet x");
            b1 = IObjectPrx.Parse("test -f facet:tcp", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet == "facet" && b1.AdapterId.Length == 0);
            b1 = IObjectPrx.Parse("test -f \"facet:tcp\"", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet == "facet:tcp" && b1.AdapterId.Length == 0);
            b1 = IObjectPrx.Parse("test -f facet@test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet == "facet" && b1.AdapterId.Equals("test"));
            b1 = IObjectPrx.Parse("test -f 'facet@test'", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet == "facet@test" && b1.AdapterId.Length == 0);
            b1 = IObjectPrx.Parse("test -f 'facet@test'@test", communicator);
            TestHelper.Assert(b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                              b1.Facet == "facet@test" && b1.AdapterId.Equals("test"));
            // End of ice1 format-only tests.

            b1 = IObjectPrx.Parse("ice:test", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.Twoway);
            TestHelper.Assert(!b1.IsOneway);

            b1 = IObjectPrx.Parse("test", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.Twoway);
            TestHelper.Assert(!b1.IsOneway);

            b1 = IObjectPrx.Parse("test -t", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.Twoway);

            b1 = IObjectPrx.Parse("test -o", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.Oneway);

            b1 = IObjectPrx.Parse("test -O", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.BatchOneway);

            b1 = IObjectPrx.Parse("test -d", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.Datagram);

            b1 = IObjectPrx.Parse("test -D", communicator);
            TestHelper.Assert(b1.InvocationMode == InvocationMode.BatchDatagram);

            b1 = IObjectPrx.Parse("ice:test", communicator);
            TestHelper.Assert(b1.Protocol == Protocol.Ice2 && b1.Encoding == Encoding.V2_0);
            b1 = IObjectPrx.Parse("test", communicator);
            TestHelper.Assert(b1.Protocol == Protocol.Ice1 && b1.Encoding == Encoding.V1_1);

            b1 = IObjectPrx.Parse("ice:test?encoding=6.5", communicator);
            TestHelper.Assert(b1.Encoding.Major == 6 && b1.Encoding.Minor == 5);
            b1 = IObjectPrx.Parse("test -e 6.5", communicator);
            TestHelper.Assert(b1.Encoding.Major == 6 && b1.Encoding.Minor == 5);

            b1 = IObjectPrx.Parse("ice:test?encoding=2.1&protocol=6", communicator);
            TestHelper.Assert(b1.Protocol == (Protocol)6 && b1.Encoding.Major == 2 && b1.Encoding.Minor == 1);

            // Test invalid endpoint syntax
            // TODO: why are we testing this here?
            try
            {
                communicator.CreateObjectAdapterWithEndpoints("BadAdapter", " : ");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                communicator.CreateObjectAdapterWithEndpoints("BadAdapter", "tcp: ");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                communicator.CreateObjectAdapterWithEndpoints("BadAdapter", ":tcp");
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            // Test for bug ICE-5543: escaped escapes in Identity.Parse
            var id  = new Identity("test", ",X2QNUAzSBcJ_e$AV;E\\");
            var id2 = Identity.Parse(id.ToString(communicator.ToStringMode), uriFormat: false);
            var id3 = Identity.Parse(id.ToString()); // new URI style

            TestHelper.Assert(id == id2);
            TestHelper.Assert(id == id3);

            id  = new Identity("test", ",X2QNUAz\\SB\\/cJ_e$AV;E\\\\");
            id2 = Identity.Parse(id.ToString(communicator.ToStringMode), uriFormat: false);
            id3 = Identity.Parse(id.ToString());
            TestHelper.Assert(id == id2);
            TestHelper.Assert(id == id3);

            id = new Identity("/test", "cat/");
            string idStr = id.ToString(communicator.ToStringMode);

            TestHelper.Assert(idStr == "cat\\//\\/test");
            id2 = Identity.Parse(idStr, uriFormat: false);
            id3 = Identity.Parse(id.ToString());
            TestHelper.Assert(id == id2);
            TestHelper.Assert(id == id3);

            // Input string in ice1 format with various pitfalls
            idStr = "\\342\\x82\\254\\60\\x9\\60\\";
            id    = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(id.Name == "€0\t0\\" && id.Category.Length == 0);

            try
            {
                // Illegal character < 32
                _ = Identity.Parse("xx\01FooBar", uriFormat: false);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            try
            {
                // Illegal surrogate
                _ = Identity.Parse("xx\\ud911", uriFormat: false);
                TestHelper.Assert(false);
            }
            catch (FormatException)
            {
            }

            // Testing bytes 127(\x7F, \177) and €
            // € is encoded as 0x20AC (UTF-16) and 0xE2 0x82 0xAC (UTF-8)
            id = new Identity("test", "\x7f€");

            idStr = id.ToString();
            TestHelper.Assert(idStr == "%7F%E2%82%AC/test");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id == id2);

            idStr = id.ToString(ToStringMode.Unicode);
            TestHelper.Assert(idStr == "\\u007f€/test");
            id2 = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(id == id2);

            idStr = id.ToString(ToStringMode.ASCII);
            TestHelper.Assert(idStr == "\\u007f\\u20ac/test");
            id2 = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(id == id2);

            idStr = id.ToString(ToStringMode.Compat);
            TestHelper.Assert(idStr == "\\177\\342\\202\\254/test");
            id2 = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(id == id2);

            // More unicode character
            id    = new Identity("banana \x0E-\ud83c\udf4c\u20ac\u00a2\u0024", "greek \ud800\udd6a");
            idStr = id.ToString();
            TestHelper.Assert(idStr == "greek%20%F0%90%85%AA/banana%20%0E-%F0%9F%8D%8C%E2%82%AC%C2%A2%24");
            id2 = Identity.Parse(idStr);
            TestHelper.Assert(id == id2);

            idStr = id.ToString(ToStringMode.Unicode);
            TestHelper.Assert(idStr == "greek \ud800\udd6a/banana \\u000e-\ud83c\udf4c\u20ac\u00a2$");
            id2 = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(id == id2);

            idStr = id.ToString(ToStringMode.ASCII);
            TestHelper.Assert(idStr == "greek \\U0001016a/banana \\u000e-\\U0001f34c\\u20ac\\u00a2$");
            id2 = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(id == id2);

            idStr = id.ToString(ToStringMode.Compat);
            id2   = Identity.Parse(idStr, uriFormat: false);
            TestHelper.Assert(idStr == "greek \\360\\220\\205\\252/banana \\016-\\360\\237\\215\\214\\342\\202\\254\\302\\242$");
            TestHelper.Assert(id == id2);

            output.WriteLine("ok");

            output.Write("testing proxyToString... ");
            output.Flush();
            b1 = IObjectPrx.Parse(rf, communicator);

            if (b1.GetConnection() is Connection connection) // not coloc-optimized target
            {
                IObjectPrx b2 = connection.CreateProxy(Identity.Parse("fixed"), IObjectPrx.Factory);
                if (connection.Endpoint.Protocol == Protocol.Ice1)
                {
                    TestHelper.Assert(b2.ToString() == "fixed -t -e 1.1");
                }
                else
                {
                    TestHelper.Assert(b2.ToString() == "ice:fixed");
                }
            }
            output.WriteLine("ok");

            output.Write("testing propertyToProxy... ");
            output.Flush();

            string propertyPrefix = "Foo.Proxy";

            communicator.SetProperty(propertyPrefix, helper.GetTestProxy("test", 0));
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(
                b1.Identity.Name == "test" && b1.Identity.Category.Length == 0 &&
                b1.AdapterId.Length == 0 && b1.Facet.Length == 0);

            string property;

            property = propertyPrefix + ".Locator";
            TestHelper.Assert(b1.Locator == null);
            communicator.SetProperty(property, "ice+tcp://host:10000/locator");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.Locator != null && b1.Locator.Identity.Name == "locator");
            communicator.SetProperty(property, "");
            property = propertyPrefix + ".LocatorCacheTimeout";
            TestHelper.Assert(b1.LocatorCacheTimeout == Timeout.InfiniteTimeSpan);
            communicator.SetProperty(property, "1s");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.LocatorCacheTimeout == TimeSpan.FromSeconds(1));
            communicator.SetProperty(property, "");

            // Now retest with an indirect proxy.
            communicator.SetProperty(propertyPrefix, "test");
            property = propertyPrefix + ".Locator";
            communicator.SetProperty(property, "ice+tcp://host:10000/locator");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.Locator != null && b1.Locator.Identity.Name == "locator");
            communicator.SetProperty(property, "");

            property = propertyPrefix + ".LocatorCacheTimeout";
            TestHelper.Assert(b1.LocatorCacheTimeout == Timeout.InfiniteTimeSpan);
            communicator.SetProperty(property, "1s");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.LocatorCacheTimeout == TimeSpan.FromSeconds(1));
            communicator.SetProperty(property, "");

            // This cannot be tested so easily because the property is cached
            // on communicator initialization.
            //
            //communicator.SetProperty("Default.LocatorCacheTimeout", "60");
            //b1 = communicator.propertyToProxy(propertyPrefix);
            //TestHelper.Assert(b1.LocatorCacheTimeout == 60);
            //communicator.SetProperty("Default.LocatorCacheTimeout", "");

            communicator.SetProperty(propertyPrefix, helper.GetTestProxy("test", 0));

            property = propertyPrefix + ".Router";
            TestHelper.Assert(b1.Router == null);
            communicator.SetProperty(property, "ice+tcp://host:10000/router");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.Router != null && b1.Router.Identity.Name == "router");
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".PreferNonSecure";
            TestHelper.Assert(b1.PreferNonSecure);
            communicator.SetProperty(property, "0");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(!b1.PreferNonSecure);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".ConnectionCached";
            TestHelper.Assert(b1.IsConnectionCached);
            communicator.SetProperty(property, "0");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(!b1.IsConnectionCached);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".InvocationTimeout";
            TestHelper.Assert(b1.InvocationTimeout == -1);
            communicator.SetProperty(property, "1000");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.InvocationTimeout == 1000);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".EndpointSelection";
            TestHelper.Assert(b1.EndpointSelection == EndpointSelectionType.Random);
            communicator.SetProperty(property, "Random");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.EndpointSelection == EndpointSelectionType.Random);
            communicator.SetProperty(property, "Ordered");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.EndpointSelection == EndpointSelectionType.Ordered);
            communicator.RemoveProperty(property);

            property = propertyPrefix + ".Context.c1";
            TestHelper.Assert(!b1.Context.ContainsKey("c1"));
            communicator.SetProperty(property, "TEST");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.Context["c1"].Equals("TEST"));

            property = propertyPrefix + ".Context.c2";
            TestHelper.Assert(!b1.Context.ContainsKey("c2"));
            communicator.SetProperty(property, "TEST");
            b1 = communicator.GetPropertyAsProxy(propertyPrefix, IObjectPrx.Factory) !;
            TestHelper.Assert(b1.Context["c2"].Equals("TEST"));

            communicator.SetProperty(propertyPrefix + ".Context.c1", "");
            communicator.SetProperty(propertyPrefix + ".Context.c2", "");

            output.WriteLine("ok");

            output.Write("testing IObjectPrx.ToProperty... ");
            output.Flush();

            IRouterPrx router = IRouterPrx.Parse("ice:router?encoding=1.1", communicator).Clone(
                cacheConnection: true,
                preferNonSecure: true,
                endpointSelection: EndpointSelectionType.Random,
                locatorCacheTimeout: TimeSpan.FromSeconds(200),
                invocationTimeout: 1500);

            ILocatorPrx?locator = ILocatorPrx.Parse("ice:locator", communicator).Clone(
                cacheConnection: false,
                preferNonSecure: true,
                endpointSelection: EndpointSelectionType.Random,
                locatorCacheTimeout: TimeSpan.FromSeconds(300),
                invocationTimeout: 1500,
                router: router);

            b1 = IObjectPrx.Parse("ice:test", communicator).Clone(
                cacheConnection: true,
                preferNonSecure: false,
                endpointSelection: EndpointSelectionType.Ordered,
                locatorCacheTimeout: TimeSpan.FromSeconds(100),
                invocationTimeout: 1234,
                locator: locator);

            Dictionary <string, string> proxyProps = b1.ToProperty("Test");

            TestHelper.Assert(proxyProps.Count == 18);

            TestHelper.Assert(proxyProps["Test"] == "ice:test");
            TestHelper.Assert(proxyProps["Test.ConnectionCached"] == "1");
            TestHelper.Assert(proxyProps["Test.PreferNonSecure"] == "0");
            TestHelper.Assert(proxyProps["Test.EndpointSelection"] == "Ordered");
            TestHelper.Assert(proxyProps["Test.LocatorCacheTimeout"] == "100s");
            TestHelper.Assert(proxyProps["Test.InvocationTimeout"] == "1234");

            TestHelper.Assert(proxyProps["Test.Locator"] == "ice:locator"); // strange test with an indirect locator!
            TestHelper.Assert(proxyProps["Test.Locator.ConnectionCached"] == "0");
            TestHelper.Assert(proxyProps["Test.Locator.PreferNonSecure"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.EndpointSelection"] == "Random");
            TestHelper.Assert(proxyProps["Test.Locator.LocatorCacheTimeout"] == "5m");
            TestHelper.Assert(proxyProps["Test.Locator.InvocationTimeout"] == "1500");

            TestHelper.Assert(proxyProps["Test.Locator.Router"] == "ice:router?encoding=1.1"); // also very strange
            TestHelper.Assert(proxyProps["Test.Locator.Router.ConnectionCached"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.Router.PreferNonSecure"] == "1");
            TestHelper.Assert(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random");
            TestHelper.Assert(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200s");
            TestHelper.Assert(proxyProps["Test.Locator.Router.InvocationTimeout"] == "1500");

            output.WriteLine("ok");

            output.Write("testing IObjectPrx.Communicator... ");
            output.Flush();
            TestHelper.Assert(baseProxy.Communicator == communicator);
            output.WriteLine("ok");

            output.Write("testing proxy Clone... ");

            TestHelper.Assert(baseProxy.Clone(facet: "facet", IObjectPrx.Factory).Facet == "facet");
            TestHelper.Assert(baseProxy.Clone(adapterId: "id").AdapterId.Equals("id"));
            TestHelper.Assert(!baseProxy.Clone(invocationMode: InvocationMode.Twoway).IsOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.Oneway).IsOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.Datagram).IsOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.BatchOneway).InvocationMode ==
                              InvocationMode.BatchOneway);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.Datagram).InvocationMode ==
                              InvocationMode.Datagram);
            TestHelper.Assert(baseProxy.Clone(invocationMode: InvocationMode.BatchDatagram).InvocationMode ==
                              InvocationMode.BatchDatagram);
            TestHelper.Assert(baseProxy.Clone(preferNonSecure: true).PreferNonSecure);
            TestHelper.Assert(!baseProxy.Clone(preferNonSecure: false).PreferNonSecure);

            try
            {
                baseProxy.Clone(invocationTimeout: 0);
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            try
            {
                baseProxy.Clone(invocationTimeout: -1);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(invocationTimeout: -2);
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            try
            {
                baseProxy.Clone(locatorCacheTimeout: TimeSpan.Zero);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(locatorCacheTimeout: Timeout.InfiniteTimeSpan);
            }
            catch (ArgumentException)
            {
                TestHelper.Assert(false);
            }

            try
            {
                baseProxy.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(-2));
                TestHelper.Assert(false);
            }
            catch (ArgumentException)
            {
            }

            output.WriteLine("ok");

            output.Write("testing proxy comparison... ");
            output.Flush();

            TestHelper.Assert(IObjectPrx.Parse("ice:foo", communicator).Equals(IObjectPrx.Parse("ice:foo", communicator)));
            TestHelper.Assert(!IObjectPrx.Parse("ice:foo", communicator).Equals(IObjectPrx.Parse("ice:foo2", communicator)));

            var compObj = IObjectPrx.Parse("ice:foo", communicator);

            TestHelper.Assert(compObj.Clone(facet: "facet", IObjectPrx.Factory).Equals(
                                  compObj.Clone(facet: "facet", IObjectPrx.Factory)));
            TestHelper.Assert(!compObj.Clone(facet: "facet", IObjectPrx.Factory).Equals(
                                  compObj.Clone(facet: "facet1", IObjectPrx.Factory)));

            TestHelper.Assert(compObj.Clone(invocationMode: InvocationMode.Oneway).Equals(
                                  compObj.Clone(invocationMode: InvocationMode.Oneway)));
            TestHelper.Assert(!compObj.Clone(invocationMode: InvocationMode.Oneway).Equals(
                                  compObj.Clone(invocationMode: InvocationMode.Twoway)));

            TestHelper.Assert(compObj.Clone(cacheConnection: true).Equals(compObj.Clone(cacheConnection: true)));
            TestHelper.Assert(!compObj.Clone(cacheConnection: false).Equals(compObj.Clone(cacheConnection: true)));

            TestHelper.Assert(compObj.Clone(endpointSelection: EndpointSelectionType.Random).Equals(
                                  compObj.Clone(endpointSelection: EndpointSelectionType.Random)));
            TestHelper.Assert(!compObj.Clone(endpointSelection: EndpointSelectionType.Random).Equals(
                                  compObj.Clone(endpointSelection: EndpointSelectionType.Ordered)));

            TestHelper.Assert(compObj.Clone(connectionId: "id2").Equals(compObj.Clone(connectionId: "id2")));
            TestHelper.Assert(!compObj.Clone(connectionId: "id1").Equals(compObj.Clone(connectionId: "id2")));
            TestHelper.Assert(compObj.Clone(connectionId: "id1").ConnectionId.Equals("id1"));
            TestHelper.Assert(compObj.Clone(connectionId: "id2").ConnectionId.Equals("id2"));

            var loc1 = ILocatorPrx.Parse("ice+tcp://host:10000/loc1", communicator);
            var loc2 = ILocatorPrx.Parse("ice+tcp://host:10000/loc2", communicator);

            TestHelper.Assert(compObj.Clone(clearLocator: true).Equals(compObj.Clone(clearLocator: true)));
            TestHelper.Assert(compObj.Clone(locator: loc1).Equals(compObj.Clone(locator: loc1)));
            TestHelper.Assert(!compObj.Clone(locator: loc1).Equals(compObj.Clone(clearLocator: true)));
            TestHelper.Assert(!compObj.Clone(clearLocator: true).Equals(compObj.Clone(locator: loc2)));
            TestHelper.Assert(!compObj.Clone(locator: loc1).Equals(compObj.Clone(locator: loc2)));

            var rtr1 = IRouterPrx.Parse("ice+tcp://host:10000/rtr1", communicator);
            var rtr2 = IRouterPrx.Parse("ice+tcp://host:10000/rtr2", communicator);

            TestHelper.Assert(compObj.Clone(clearRouter: true).Equals(compObj.Clone(clearRouter: true)));
            TestHelper.Assert(compObj.Clone(router: rtr1).Equals(compObj.Clone(router: rtr1)));
            TestHelper.Assert(!compObj.Clone(router: rtr1).Equals(compObj.Clone(clearRouter: true)));
            TestHelper.Assert(!compObj.Clone(clearRouter: true).Equals(compObj.Clone(router: rtr2)));
            TestHelper.Assert(!compObj.Clone(router: rtr1).Equals(compObj.Clone(router: rtr2)));

            var ctx1 = new Dictionary <string, string>
            {
                ["ctx1"] = "v1"
            };
            var ctx2 = new Dictionary <string, string>
            {
                ["ctx2"] = "v2"
            };

            TestHelper.Assert(compObj.Clone(context: new Dictionary <string, string>()).Equals(
                                  compObj.Clone(context: new Dictionary <string, string>())));
            TestHelper.Assert(compObj.Clone(context: ctx1).Equals(compObj.Clone(context: ctx1)));
            TestHelper.Assert(!compObj.Clone(context: ctx1).Equals(
                                  compObj.Clone(context: new Dictionary <string, string>())));
            TestHelper.Assert(!compObj.Clone(context: new Dictionary <string, string>()).Equals(
                                  compObj.Clone(context: ctx2)));
            TestHelper.Assert(!compObj.Clone(context: ctx1).Equals(compObj.Clone(context: ctx2)));

            TestHelper.Assert(compObj.Clone(preferNonSecure: true).Equals(compObj.Clone(preferNonSecure: true)));
            TestHelper.Assert(!compObj.Clone(preferNonSecure: true).Equals(compObj.Clone(preferNonSecure: false)));

            var compObj1 = IObjectPrx.Parse("ice+tcp://127.0.0.1:10000/foo", communicator);
            var compObj2 = IObjectPrx.Parse("ice+tcp://127.0.0.1:10001/foo", communicator);

            TestHelper.Assert(!compObj1.Equals(compObj2));

            compObj1 = IObjectPrx.Parse("ice:MyAdapter1//foo", communicator);
            compObj2 = IObjectPrx.Parse("ice:MyAdapter2//foo", communicator);
            TestHelper.Assert(!compObj1.Equals(compObj2));

            TestHelper.Assert(compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(20))
                              .Equals(compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(20))));
            TestHelper.Assert(!compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(10))
                              .Equals(compObj1.Clone(locatorCacheTimeout: TimeSpan.FromSeconds(20))));

            TestHelper.Assert(compObj1.Clone(invocationTimeout: 20).Equals(compObj1.Clone(invocationTimeout: 20)));
            TestHelper.Assert(!compObj1.Clone(invocationTimeout: 10).Equals(compObj1.Clone(invocationTimeout: 20)));

            compObj1 = IObjectPrx.Parse("ice+tcp://127.0.0.1:10000/foo", communicator);
            compObj2 = IObjectPrx.Parse("ice:MyAdapter1//foo", communicator);
            TestHelper.Assert(!compObj1.Equals(compObj2));

            IReadOnlyList <Endpoint> endpts1 =
                IObjectPrx.Parse("ice+tcp://127.0.0.1:10000/foo", communicator).Endpoints;
            IReadOnlyList <Endpoint> endpts2 =
                IObjectPrx.Parse("ice+tcp://127.0.0.1:10001/foo", communicator).Endpoints;

            TestHelper.Assert(!endpts1[0].Equals(endpts2[0]));
            TestHelper.Assert(endpts1[0].Equals(
                                  IObjectPrx.Parse("ice+tcp://127.0.0.1:10000/foo", communicator).Endpoints[0]));

            if (baseProxy.GetConnection() is Connection baseConnection)
            {
                Connection baseConnection2 = baseProxy.Clone(connectionId: "base2").GetConnection() !;
                compObj1 = compObj1.Clone(fixedConnection: baseConnection);
                compObj2 = compObj2.Clone(fixedConnection: baseConnection2);
                TestHelper.Assert(!compObj1.Equals(compObj2));
            }
            output.WriteLine("ok");

            output.Write("testing checked cast... ");
            output.Flush();
            var cl = IMyClassPrx.CheckedCast(baseProxy);

            TestHelper.Assert(cl != null);
            var derived = IMyDerivedClassPrx.CheckedCast(cl);

            TestHelper.Assert(derived != null);
            TestHelper.Assert(cl.Equals(baseProxy));
            TestHelper.Assert(derived.Equals(baseProxy));
            TestHelper.Assert(cl.Equals(derived));
            try
            {
                IMyDerivedClassPrx.CheckedCast(cl.Clone(facet: "facet", IObjectPrx.Factory));
                TestHelper.Assert(false);
            }
            catch (ObjectNotExistException)
            {
            }
            output.WriteLine("ok");

            output.Write("testing checked cast with context... ");
            output.Flush();

            Dictionary <string, string> c = cl.GetContext();

            TestHelper.Assert(c == null || c.Count == 0);

            c = new Dictionary <string, string>
            {
                ["one"] = "hello",
                ["two"] = "world"
            };
            cl = IMyClassPrx.CheckedCast(baseProxy, c);
            Dictionary <string, string> c2 = cl !.GetContext();

            TestHelper.Assert(c.DictionaryEquals(c2));
            output.WriteLine("ok");

            output.Write("testing ice_fixed... ");
            output.Flush();
            {
                if (cl.GetConnection() is Connection connection2)
                {
                    TestHelper.Assert(!cl.IsFixed);
                    IMyClassPrx prx = cl.Clone(fixedConnection: connection2);
                    TestHelper.Assert(prx.IsFixed);
                    prx.IcePing();
                    TestHelper.Assert(cl.Clone("facet", IObjectPrx.Factory, fixedConnection: connection2).Facet == "facet");
                    TestHelper.Assert(cl.Clone(invocationMode: InvocationMode.Oneway, fixedConnection: connection2).IsOneway);
                    var ctx = new Dictionary <string, string>
                    {
                        ["one"] = "hello",
                        ["two"] = "world"
                    };
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).Context.Count == 0);
                    TestHelper.Assert(cl.Clone(context: ctx, fixedConnection: connection2).Context.Count == 2);
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).InvocationTimeout == -1);
                    TestHelper.Assert(cl.Clone(invocationTimeout: 10, fixedConnection: connection2).InvocationTimeout == 10);
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).GetConnection() == connection2);
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).Clone(fixedConnection: connection2).GetConnection() == connection2);
                    Connection?fixedConnection = cl.Clone(connectionId: "ice_fixed").GetConnection();
                    TestHelper.Assert(cl.Clone(fixedConnection: connection2).Clone(fixedConnection: fixedConnection).GetConnection() == fixedConnection);
                    try
                    {
                        cl.Clone(invocationMode: InvocationMode.Datagram, fixedConnection: connection2);
                        TestHelper.Assert(false);
                    }
                    catch (ArgumentException)
                    {
                    }
                }
            }
            output.WriteLine("ok");

            output.Write("testing encoding versioning... ");
            string      ref13 = helper.GetTestProxy("test", 0);
            IMyClassPrx cl13  = IMyClassPrx.Parse(ref13, communicator).Clone(encoding: new Encoding(1, 3));

            try
            {
                cl13.IcePing();
                TestHelper.Assert(false);
            }
            catch (NotSupportedException)
            {
                // expected
            }
            output.WriteLine("ok");

            if (communicator.DefaultProtocol == Protocol.Ice2)
            {
                output.Write("testing protocol versioning... ");
                output.Flush();
                string ref3 = helper.GetTestProxy("test", 0);
                ref3 += "?protocol=3";

                string transport = helper.GetTestTransport();
                ref3  = ref3.Replace($"ice+{transport}", "ice+universal");
                ref3 += $"&transport={transport}";
                var cl3 = IMyClassPrx.Parse(ref3, communicator);
                try
                {
                    cl3.IcePing();
                    TestHelper.Assert(false);
                }
                catch (NotSupportedException)
                {
                    // expected
                }
                output.WriteLine("ok");
            }

            output.Write("testing ice2 universal endpoints... ");
            output.Flush();

            var p1 = IObjectPrx.Parse("ice+universal://127.0.0.1:4062/test?transport=tcp", communicator);

            TestHelper.Assert(p1.ToString() == "ice+tcp://127.0.0.1/test"); // uses default port

            p1 = IObjectPrx.Parse(
                "ice+universal://127.0.0.1:4062/test?transport=tcp&alt-endpoint=host2:10000?transport=tcp",
                communicator);
            TestHelper.Assert(p1.ToString() == "ice+tcp://127.0.0.1/test?alt-endpoint=host2:10000");

            p1 = IObjectPrx.Parse(
                "ice+universal://127.0.0.1:4062/test?transport=tcp&alt-endpoint=host2:10000?transport=99$option=a",
                communicator);

            TestHelper.Assert(p1.ToString() ==
                              "ice+tcp://127.0.0.1/test?alt-endpoint=ice+universal://host2:10000?transport=99$option=a");

            output.WriteLine("ok");

            output.Write("testing ice1 opaque endpoints... ");
            output.Flush();

            // Legal TCP endpoint expressed as opaque endpoint
            p1 = IObjectPrx.Parse("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==",
                                  communicator);
            TestHelper.Assert(p1.ToString() == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000");

            // Two legal TCP endpoints expressed as opaque endpoints
            p1 = IObjectPrx.Parse(@"test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:
                opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==", communicator);
            TestHelper.Assert(p1.ToString() ==
                              "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000");

            // Test that an SSL endpoint and an unknown-transport endpoint get written back out as an opaque
            // endpoint.
            p1 = IObjectPrx.Parse(
                "test:opaque -e 1.1 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -e 1.1 -t 99 -v abch",
                communicator);
            TestHelper.Assert(p1.ToString() ==
                              "test -t -e 1.1:ssl -h 127.0.0.1 -p 10001 -t -1:opaque -t 99 -e 1.1 -v abch");

            output.WriteLine("ok");

            output.Write("testing communicator shutdown/destroy... ");
            output.Flush();
            {
                var com = new Communicator();
                com.ShutdownAsync();
                com.WaitForShutdownAsync();
                com.Dispose();
                com.ShutdownAsync();
                com.WaitForShutdownAsync();
                com.Dispose();
            }
            output.WriteLine("ok");

            return(cl);
        }
Пример #27
0
        internal static void Run(IMyClassPrx p)
        {
            {
                var i = new Dictionary <int, int>
                {
                    [0] = 1,
                    [1] = 0
                };

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

                TestHelper.Assert(i.DictionaryEquals(o));
                TestHelper.Assert(i.DictionaryEquals(r));
            }

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

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

                TestHelper.Assert(i.DictionaryEquals(o));
                TestHelper.Assert(i.DictionaryEquals(r));
            }

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

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

                foreach (string key in i.Keys)
                {
                    TestHelper.Assert(i[key].DictionaryEquals(o[key]));
                    TestHelper.Assert(i[key].DictionaryEquals(r[key]));
                }
            }

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

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

                foreach (string key in i.Keys)
                {
                    TestHelper.Assert(i[key].DictionaryEquals(o[key]));
                    TestHelper.Assert(i[key].DictionaryEquals(r[key]));
                }
            }

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

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

                foreach (string key in i.Keys)
                {
                    TestHelper.Assert(i[key].SequenceEqual(o[key]));
                    TestHelper.Assert(i[key].SequenceEqual(r[key]));
                }
            }

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

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

                foreach (string key in i.Keys)
                {
                    TestHelper.Assert(i[key].SequenceEqual(o[key]));
                    TestHelper.Assert(i[key].SequenceEqual(r[key]));
                }
            }

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

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

                foreach (string key in i.Keys)
                {
                    TestHelper.Assert(i[key].SequenceEqual(o[key]));
                    TestHelper.Assert(i[key].SequenceEqual(r[key]));
                }
            }

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

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

                foreach (string key in i.Keys)
                {
                    TestHelper.Assert(i[key].SequenceEqual(o[key]));
                    TestHelper.Assert(i[key].SequenceEqual(r[key]));
                }
            }
        }
Пример #28
0
        public static IMyClassPrx allTests(TestHelper helper)
        {
            Communicator?communicator = helper.Communicator();

            TestHelper.Assert(communicator != null);
            var         cl     = IMyClassPrx.Parse($"test:{helper.GetTestEndpoint(0)}", communicator);
            IMyClassPrx oneway = cl.Clone(oneway: true);

            System.IO.TextWriter output = helper.GetWriter();
            output.Write("testing Invoke... ");
            output.Flush();

            {
                var request = OutgoingRequestFrame.WithEmptyParamList(oneway, "opOneway", idempotent: false);

                // Whether the proxy is oneway or not does not matter for Invoke's oneway parameter.

                IncomingResponseFrame response = cl.Invoke(request, oneway: true);
                TestHelper.Assert(response.ReplyStatus == ReplyStatus.OK);

                response = cl.Invoke(request, oneway: false);
                TestHelper.Assert(response.ReplyStatus == ReplyStatus.UserException);

                response = oneway.Invoke(request, oneway: true);
                TestHelper.Assert(response.ReplyStatus == ReplyStatus.OK);

                response = oneway.Invoke(request, oneway: false);
                TestHelper.Assert(response.ReplyStatus == ReplyStatus.UserException);

                request = OutgoingRequestFrame.WithParamList(cl, "opString", idempotent: false,
                                                             format: null, context: null, _testString, OutputStream.IceWriterFromString);
                response = cl.Invoke(request);
                (string s1, string s2) = response.ReadReturnValue(communicator, istr =>
                {
                    string s1 = istr.ReadString();
                    string s2 = istr.ReadString();
                    return(s1, s2);
                });
                TestHelper.Assert(s1.Equals(_testString) && s2.Equals(_testString));
            }

            for (int i = 0; i < 2; ++i)
            {
                Dictionary <string, string>?ctx = null;
                if (i == 1)
                {
                    ctx = new Dictionary <string, string>
                    {
                        ["raise"] = ""
                    };
                }

                var request = OutgoingRequestFrame.WithEmptyParamList(cl, "opException", idempotent: false, context: ctx);
                IncomingResponseFrame response = cl.Invoke(request);
                try
                {
                    response.ReadVoidReturnValue(communicator);
                }
                catch (MyException)
                {
                    // expected
                }
                catch (System.Exception)
                {
                    TestHelper.Assert(false);
                }
            }

            output.WriteLine("ok");

            output.Write("testing InvokeAsync... ");
            output.Flush();

            {
                var request = OutgoingRequestFrame.WithEmptyParamList(oneway, "opOneway", idempotent: false);
                IncomingResponseFrame response;
                try
                {
                    response = oneway.InvokeAsync(request, oneway: true).AsTask().Result;
                }
                catch (System.Exception)
                {
                    TestHelper.Assert(false);
                }

                request = OutgoingRequestFrame.WithParamList(cl, "opString", idempotent: false,
                                                             format: null, context: null, _testString, OutputStream.IceWriterFromString);

                response = cl.InvokeAsync(request).AsTask().Result;
                (string s1, string s2) = response.ReadReturnValue(communicator, istr =>
                {
                    string s1 = istr.ReadString();
                    string s2 = istr.ReadString();
                    return(s1, s2);
                });
                TestHelper.Assert(s1.Equals(_testString));
                TestHelper.Assert(s2.Equals(_testString));
            }

            {
                var request = OutgoingRequestFrame.WithEmptyParamList(cl, "opException", idempotent: false);
                IncomingResponseFrame response = cl.InvokeAsync(request).AsTask().Result;

                try
                {
                    response.ReadVoidReturnValue(communicator);
                    TestHelper.Assert(false);
                }
                catch (MyException)
                {
                }
                catch (System.Exception)
                {
                    TestHelper.Assert(false);
                }
            }

            output.WriteLine("ok");
            return(cl);
        }
Пример #29
0
        internal static void Run(IMyClassPrx p)
        {
            {
                var i = new Dictionary <int, int>
                {
                    [0] = 1,
                    [1] = 0
                };

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

                TestHelper.Assert(i.DictionaryEqual(o));
                TestHelper.Assert(i.DictionaryEqual(r));
            }

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

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

                TestHelper.Assert(i.DictionaryEqual(o));
                TestHelper.Assert(i.DictionaryEqual(r));
            }

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

                (Dictionary <string, Dictionary <int, int> > r, Dictionary <string, Dictionary <int, int> > o) = p.OpNDV(i);
                TestHelper.Assert(o.DictionaryEqual(i, DictionaryComparer <int, int> .AllEntries));
                TestHelper.Assert(r.DictionaryEqual(i, DictionaryComparer <int, int> .AllEntries));
            }

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

                (Dictionary <string, Dictionary <string, string> > r,
                 Dictionary <string, Dictionary <string, string> > o) = p.OpNDR(i);
                TestHelper.Assert(o.DictionaryEqual(i, DictionaryComparer <string, string> .AllEntries));
                TestHelper.Assert(r.DictionaryEqual(i, DictionaryComparer <string, string> .AllEntries));
            }

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

                (Dictionary <string, int[]> r, Dictionary <string, int[]> o) = p.OpNDAIS(i);
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <int> .AllElements));
                TestHelper.Assert(r.DictionaryEqual(i, SequenceComparer <int> .AllElements));
            }

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

                (Dictionary <string, List <int> > r, Dictionary <string, List <int> > o) = p.OpNDGIS(i);
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <int> .AllElements));
                TestHelper.Assert(r.DictionaryEqual(i, SequenceComparer <int> .AllElements));
            }

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

                (Dictionary <string, string[]> r, Dictionary <string, string[]> o) = p.OpNDASS(i);
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <string> .AllElements));
                TestHelper.Assert(r.DictionaryEqual(i, SequenceComparer <string> .AllElements));
            }

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

                (Dictionary <string, List <string> > r, Dictionary <string, List <string> > o) = p.OpNDGSS(i);
                TestHelper.Assert(o.DictionaryEqual(i, SequenceComparer <string> .AllElements));
                TestHelper.Assert(r.DictionaryEqual(i, SequenceComparer <string> .AllElements));
            }
        }