public override async Task RunAsync(string[] args) { Dictionary <string, string>?properties = CreateTestProperties(ref args); properties["Ice.Warn.Dispatch"] = "0"; await using Communicator communicator = Initialize(properties); IInitialPrx initial = AllTests.Run(this); await initial.ShutdownAsync(); }
public static Test.IInitialPrx allTests(global::Test.TestHelper helper) { Ice.Communicator communicator = helper.communicator(); var output = helper.getWriter(); var initial = IInitialPrx.Parse($"initial:{helper.getTestEndpoint(0)}", communicator); output.Write("getting B1... "); output.Flush(); B b1 = initial.getB1(); test(b1 != null); output.WriteLine("ok"); output.Write("getting B2... "); output.Flush(); B b2 = initial.getB2(); test(b2 != null); output.WriteLine("ok"); output.Write("getting C... "); output.Flush(); C c = initial.getC(); test(c != null); output.WriteLine("ok"); output.Write("getting D... "); output.Flush(); D d = initial.getD(); test(d != null); output.WriteLine("ok"); output.Write("checking consistency... "); output.Flush(); test(b1 != b2); //test(b1 != c); //test(b1 != d); //test(b2 != c); //test(b2 != d); //test(c != d); test(b1.theB == b1); test(b1.theC == null); test(b1.theA is B); test(((B)b1.theA).theA == b1.theA); test(((B)b1.theA).theB == b1); //test(((B)b1.theA).theC is C); // Redundant -- theC is always of type C test(((C)(((B)b1.theA).theC)).theB == b1.theA); // More tests possible for b2 and d, but I think this is already // sufficient. test(b2.theA == b2); test(d.theC == null); output.WriteLine("ok"); output.Write("getting B1, B2, C, and D all at once... "); output.Flush(); var(b1out, b2out, cout, dout) = initial.getAll(); test(b1out != null); test(b2out != null); test(cout != null); test(dout != null); output.WriteLine("ok"); output.Write("checking consistency... "); output.Flush(); test(b1out != b2out); test(b1out.theA == b2out); test(b1out.theB == b1out); test(b1out.theC == null); test(b2out.theA == b2out); test(b2out.theB == b1out); test(b2out.theC == cout); test(cout.theB == b2out); test(dout.theA == b1out); test(dout.theB == b2out); test(dout.theC == null); output.WriteLine("ok"); output.Write("getting K... "); { output.Flush(); var k = initial.getK(); var l = k.value as L; test(l != null); test(l.data.Equals("l")); } output.WriteLine("ok"); output.Write("testing AnyClass as parameter... "); output.Flush(); { AnyClass v1 = new L("l"); var(v3, v2) = initial.opClass(v1); test(((L)v2).data.Equals("l")); test(((L)v3).data.Equals("l")); } { L l = new L("l"); AnyClass[] v1 = new AnyClass[] { l }; var(v3, v2) = initial.opClassSeq(v1); test(((L)v2[0]).data.Equals("l")); test(((L)v3[0]).data.Equals("l")); } { L l = new L("l"); Dictionary <string, AnyClass> v1 = new Dictionary <string, AnyClass> { { "l", l } }; var(v3, v2) = initial.opClassMap(v1); test(((L)v2["l"]).data.Equals("l")); test(((L)v3["l"]).data.Equals("l")); } output.WriteLine("ok"); output.Write("getting D1... "); output.Flush(); D1 d1 = new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4")); d1 = initial.getD1(d1); test(d1.a1.name.Equals("a1")); test(d1.a2.name.Equals("a2")); test(d1.a3.name.Equals("a3")); test(d1.a4.name.Equals("a4")); output.WriteLine("ok"); output.Write("throw EDerived... "); output.Flush(); try { initial.throwEDerived(); test(false); } catch (EDerived ederived) { test(ederived.a1.name.Equals("a1")); test(ederived.a2.name.Equals("a2")); test(ederived.a3.name.Equals("a3")); test(ederived.a4.name.Equals("a4")); } output.WriteLine("ok"); output.Write("setting G... "); output.Flush(); try { initial.setG(new G(new S("hello"), "g")); } catch (Ice.OperationNotExistException) { } output.WriteLine("ok"); output.Write("testing sequences..."); output.Flush(); try { Base[] inS = new Base[0]; var(retS, outS) = initial.opBaseSeq(inS); inS = new Base[1]; inS[0] = new Base(new S(""), ""); (retS, outS) = initial.opBaseSeq(inS); test(retS.Length == 1 && outS.Length == 1); } catch (Ice.OperationNotExistException) { } output.WriteLine("ok"); output.Write("testing recursive type... "); output.Flush(); var top = new Test.Recursive(); var p = top; int depth = 0; try { for (; depth <= 1000; ++depth) { p.v = new Test.Recursive(); p = p.v; if ((depth < 10 && (depth % 10) == 0) || (depth < 1000 && (depth % 100) == 0) || (depth < 10000 && (depth % 1000) == 0) || (depth % 10000) == 0) { initial.setRecursive(top); } } test(!initial.supportsClassGraphDepthMax()); } catch (Ice.UnknownLocalException) { // Expected marshal exception from the server(max class graph depth reached) } catch (Ice.UnknownException) { // Expected stack overflow from the server(Java only) } initial.setRecursive(new Test.Recursive()); output.WriteLine("ok"); output.Write("testing compact ID..."); output.Flush(); try { test(initial.getCompact() != null); } catch (Ice.OperationNotExistException) { } output.WriteLine("ok"); output.Write("testing marshaled results..."); output.Flush(); b1 = initial.getMB(); test(b1 != null && b1.theB == b1); b1 = initial.getAMDMBAsync().Result; test(b1 != null && b1.theB == b1); output.WriteLine("ok"); output.Write("testing UnexpectedObjectException..."); output.Flush(); var uoet = IUnexpectedObjectExceptionTestPrx.Parse($"uoet:{helper.getTestEndpoint(0)}", communicator); try { uoet.op(); test(false); } catch (UnexpectedObjectException ex) { test(ex.Type.Equals("::Test::AlsoEmpty")); test(ex.ExpectedType.Equals("::Test::Empty")); } catch (System.Exception ex) { output.WriteLine(ex.ToString()); test(false); } output.WriteLine("ok"); output.Write("testing partial ice_initialize..."); output.Flush(); var ib1 = new IBase(); test(ib1.id.Equals("My id")); var id1 = new IDerived(); test(id1.id.Equals("My id")); test(id1.name.Equals("My name")); var id2 = new Test.IDerived2(); test(id2.id.Equals("My id")); var i2 = new I2(); test(i2.called); var s1 = new S1(); // The struct default constructor do not call ice_initialize test(s1.id == 0); s1 = new S1(2); // The id should have the value set by ice_initialize and not 2 test(s1.id == 1); output.WriteLine("ok"); output.Write("testing class containing complex dictionary... "); output.Flush(); { var m = new Test.M(); m.v = new Dictionary <StructKey, L>(); var k1 = new StructKey(1, "1"); m.v[k1] = new L("one"); var k2 = new StructKey(2, "2"); m.v[k2] = new L("two"); var(m2, m1) = initial.opM(m); test(m1.v.Count == 2); test(m2.v.Count == 2); test(m1.v[k1].data.Equals("one")); test(m2.v[k1].data.Equals("one")); test(m1.v[k2].data.Equals("two")); test(m2.v[k2].data.Equals("two")); } output.WriteLine("ok"); output.Write("testing forward declared types... "); output.Flush(); { var(f11, f12) = initial.opF1(new F1("F11")); test(f11.name.Equals("F11")); test(f12.name.Equals("F12")); var(f21, f22) = initial.opF2(IF2Prx.Parse($"F21:{helper.getTestEndpoint()}", communicator)); test(f21.Identity.Name.Equals("F21")); f21.op(); test(f22.Identity.Name.Equals("F22")); if (initial.hasF3()) { var(f31, f32) = initial.opF3(new F3(new F1("F11"), IF2Prx.Parse("F21", communicator))); test(f31.f1.name.Equals("F11")); test(f31.f2.Identity.Name.Equals("F21")); test(f32.f1.name.Equals("F12")); test(f32.f2.Identity.Name.Equals("F22")); } } output.WriteLine("ok"); return(initial); }
public static async Task RunAsync(TestHelper helper) { Communicator communicator = helper.Communicator; TextWriter output = helper.Output; var initial = IInitialPrx.Parse(helper.GetTestProxy("initial", 0), communicator); TestHelper.Assert(initial != null); output.Write("getting B1... "); output.Flush(); B?b1 = initial.GetB1(); TestHelper.Assert(b1 != null); output.WriteLine("ok"); output.Write("getting B2... "); output.Flush(); B?b2 = initial.GetB2(); TestHelper.Assert(b2 != null); output.WriteLine("ok"); output.Write("getting C... "); output.Flush(); C?c = initial.GetC(); TestHelper.Assert(c != null); output.WriteLine("ok"); output.Write("getting D... "); output.Flush(); D?d = initial.GetD(); TestHelper.Assert(d != null); output.WriteLine("ok"); output.Write("checking consistency... "); output.Flush(); TestHelper.Assert(b1 != b2); TestHelper.Assert(b1.TheB == b1); TestHelper.Assert(b1.TheC == null); TestHelper.Assert(b1.TheA is B); TestHelper.Assert(((B)b1.TheA).TheA == b1.TheA); TestHelper.Assert(((B)b1.TheA).TheB == b1); TestHelper.Assert(((B)b1.TheA).TheC !.TheB == b1.TheA); // More tests possible for b2 and d, but I think this is already // sufficient. TestHelper.Assert(b2.TheA == b2); TestHelper.Assert(d.TheC == null); output.WriteLine("ok"); output.Write("getting B1, B2, C, and D all at once... "); output.Flush(); (B? b1out, B? b2out, C? cout, D? dout) = initial.GetAll(); TestHelper.Assert(b1out != null); TestHelper.Assert(b2out != null); TestHelper.Assert(cout != null); TestHelper.Assert(dout != null); output.WriteLine("ok"); output.Write("checking consistency... "); output.Flush(); TestHelper.Assert(b1out != b2out); TestHelper.Assert(b1out.TheA == b2out); TestHelper.Assert(b1out.TheB == b1out); TestHelper.Assert(b1out.TheC == null); TestHelper.Assert(b2out.TheA == b2out); TestHelper.Assert(b2out.TheB == b1out); TestHelper.Assert(b2out.TheC == cout); TestHelper.Assert(cout.TheB == b2out); TestHelper.Assert(dout.TheA == b1out); TestHelper.Assert(dout.TheB == b2out); TestHelper.Assert(dout.TheC == null); output.WriteLine("ok"); output.Write("getting K... "); { output.Flush(); K? k = initial.GetK(); var l = k !.Value as L; TestHelper.Assert(l != null); TestHelper.Assert(l.Data.Equals("l")); } output.WriteLine("ok"); output.Write("testing AnyClass as parameter... "); output.Flush(); { AnyClass v1 = new L("l"); (AnyClass? v3, AnyClass? v2) = initial.OpClass(v1); TestHelper.Assert(((L)v2 !).Data.Equals("l")); TestHelper.Assert(((L)v3 !).Data.Equals("l")); } { var l = new L("l"); var v1 = new AnyClass[] { l }; (AnyClass?[] v3, AnyClass?[] v2) = initial.OpClassSeq(v1); TestHelper.Assert(((L)v2[0] !).Data.Equals("l")); TestHelper.Assert(((L)v3[0] !).Data.Equals("l")); } { var l = new L("l"); var v1 = new Dictionary <string, AnyClass?> { { "l", l } }; (Dictionary <string, AnyClass?> v3, Dictionary <string, AnyClass?> v2) = initial.OpClassMap(v1); TestHelper.Assert(((L)v2["l"] !).Data.Equals("l")); TestHelper.Assert(((L)v3["l"] !).Data.Equals("l")); } output.WriteLine("ok"); output.Write("getting D1... "); output.Flush(); D1?d1 = initial.GetD1(new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4"))); TestHelper.Assert(d1 !.A1 !.Name.Equals("a1")); TestHelper.Assert(d1 !.A2 !.Name.Equals("a2")); TestHelper.Assert(d1 !.A3 !.Name.Equals("a3")); TestHelper.Assert(d1 !.A4 !.Name.Equals("a4")); output.WriteLine("ok"); output.Write("throw EDerived... "); output.Flush(); try { initial.ThrowEDerived(); TestHelper.Assert(false); } catch (EDerived ederived) { TestHelper.Assert(ederived.A1 !.Name.Equals("a1")); TestHelper.Assert(ederived.A2 !.Name.Equals("a2")); TestHelper.Assert(ederived.A3 !.Name.Equals("a3")); TestHelper.Assert(ederived.A4 !.Name.Equals("a4")); } output.WriteLine("ok"); output.Write("setting G... "); output.Flush(); try { initial.SetG(new G(new S("hello"), "g")); } catch (OperationNotExistException) { } output.WriteLine("ok"); output.Write("testing sequences..."); output.Flush(); try { Base[] inS = Array.Empty <Base>(); (Base?[] retS, Base?[] outS) = initial.OpBaseSeq(inS); inS = new Base[1]; inS[0] = new Base(new S(""), ""); (retS, outS) = initial.OpBaseSeq(inS); TestHelper.Assert(retS.Length == 1 && outS.Length == 1); } catch (OperationNotExistException) { } output.WriteLine("ok"); output.Write("testing recursive type... "); output.Flush(); var top = new Recursive(); Recursive p = top; int depth = 0; try { for (; depth <= 1000; ++depth) { p.V = new Recursive(); p = p.V; if ((depth < 10 && (depth % 10) == 0) || (depth < 1000 && (depth % 100) == 0) || (depth < 10000 && (depth % 1000) == 0) || (depth % 10000) == 0) { initial.SetRecursive(top); } } TestHelper.Assert(!initial.SupportsClassGraphMaxDepth()); } catch (UnhandledException) { // Expected marshal exception from the server (max class graph depth reached) // Expected stack overflow from the server(Java only) } initial.SetRecursive(new Recursive()); output.WriteLine("ok"); output.Write("testing compact ID..."); output.Flush(); try { TestHelper.Assert(initial.GetCompact() != null); } catch (OperationNotExistException) { } output.WriteLine("ok"); output.Write("testing marshaled results..."); output.Flush(); b1 = initial.GetMB(); TestHelper.Assert(b1 != null && b1.TheB == b1); b1 = initial.GetAMDMBAsync().Result; TestHelper.Assert(b1 != null && b1.TheB == b1); output.WriteLine("ok"); output.Write("testing UnexpectedObjectException..."); output.Flush(); var uoet = IUnexpectedObjectExceptionTestPrx.Parse(helper.GetTestProxy("uoet", 0), communicator); try { uoet.Op(); TestHelper.Assert(false); } catch (InvalidDataException ex) { TestHelper.Assert(ex.Message.Contains("ZeroC.Ice.Test.Objects.AlsoEmpty")); TestHelper.Assert(ex.Message.Contains("ZeroC.Ice.Test.Objects.Empty")); } catch (System.Exception ex) { output.WriteLine(ex.ToString()); TestHelper.Assert(false); } output.WriteLine("ok"); output.Write("testing partial Initialize..."); output.Flush(); var ib1 = new IBase(); TestHelper.Assert(ib1.Id.Equals("My id")); var id1 = new IDerived(); TestHelper.Assert(id1.Id.Equals("My id")); TestHelper.Assert(id1.Name.Equals("My name")); var id2 = new IDerived2(); TestHelper.Assert(id2.Id.Equals("My id")); var i2 = new I2(); TestHelper.Assert(i2.Called); var s1 = new S1(); // The struct default constructor do not call ice_initialize TestHelper.Assert(s1.Id == 0); s1 = new S1(2); // The id should have the value set by ice_initialize and not 2 TestHelper.Assert(s1.Id == 1); output.WriteLine("ok"); output.Write("testing class containing complex dictionary... "); output.Flush(); { var m = new M(new Dictionary <StructKey, L?>()); var k1 = new StructKey(1, "1"); m.V[k1] = new L("one"); var k2 = new StructKey(2, "2"); m.V[k2] = new L("two"); (M? m2, M? m1) = initial.OpM(m); TestHelper.Assert(m1 != null && m2 != null); TestHelper.Assert(m1.V.Count == 2); TestHelper.Assert(m2.V.Count == 2); TestHelper.Assert(m1.V[k1] !.Data.Equals("one")); TestHelper.Assert(m2.V[k1] !.Data.Equals("one")); TestHelper.Assert(m1.V[k2] !.Data.Equals("two")); TestHelper.Assert(m2.V[k2] !.Data.Equals("two")); } output.WriteLine("ok"); output.Write("testing forward declared types... "); output.Flush(); { (F1? f11, F1? f12) = initial.OpF1(new F1("F11")); TestHelper.Assert(f11 !.Name.Equals("F11")); TestHelper.Assert(f12 !.Name.Equals("F12")); (IF2Prx? f21, IF2Prx? f22) = initial.OpF2(IF2Prx.Parse(helper.GetTestProxy("F21"), communicator)); TestHelper.Assert(f21 !.Identity.Name.Equals("F21")); f21.Op(); TestHelper.Assert(f22 !.Identity.Name.Equals("F22")); if (initial.HasF3()) { (F3? f31, F3? f32) = initial.OpF3(new F3(new F1("F11"), IF2Prx.Parse("F21", communicator))); TestHelper.Assert(f31 !.F1 !.Name.Equals("F11")); TestHelper.Assert(f31 !.F2 !.Identity.Name.Equals("F21")); TestHelper.Assert(f32 !.F1 !.Name.Equals("F12")); TestHelper.Assert(f32 !.F2 !.Identity.Name.Equals("F22")); } } output.WriteLine("ok"); await initial.ShutdownAsync(); }
public static IInitialPrx Run(TestHelper helper) { Communicator?communicator = helper.Communicator; TestHelper.Assert(communicator != null); System.IO.TextWriter output = helper.Output; output.Write("testing stringToProxy... "); output.Flush(); var initial = IInitialPrx.Parse(helper.GetTestProxy("initial", 0), communicator); output.WriteLine("ok"); { output.Write("testing types without package... "); output.Flush(); NoNamespace.C1?c1 = initial.GetNoNamespaceC2AsC1(); TestHelper.Assert(c1 != null); TestHelper.Assert(c1 is NoNamespace.C2); NoNamespace.C2?c2 = initial.GetNoNamespaceC2AsC2(); TestHelper.Assert(c2 != null); try { initial.ThrowNoNamespaceE2AsE1(); TestHelper.Assert(false); } catch (NoNamespace.E1 ex) { TestHelper.Assert(ex is NoNamespace.E2); } try { initial.ThrowNoNamespaceE2AsE2(); TestHelper.Assert(false); } catch (NoNamespace.E2) { // Expected } try { initial.ThrowNoNamespaceNotify(); TestHelper.Assert(false); } catch (NoNamespace.@notify) { // Expected } output.WriteLine("ok"); } { output.Write("testing types with package... "); output.Flush(); { WithNamespace.C1?c1 = initial.GetWithNamespaceC2AsC1(); TestHelper.Assert(c1 != null); TestHelper.Assert(c1 is WithNamespace.C2); WithNamespace.C2?c2 = initial.GetWithNamespaceC2AsC2(); TestHelper.Assert(c2 != null); try { initial.ThrowWithNamespaceE2AsE1(); TestHelper.Assert(false); } catch (WithNamespace.E1 ex) { TestHelper.Assert(ex is WithNamespace.E2); } try { initial.ThrowWithNamespaceE2AsE2(); TestHelper.Assert(false); } catch (WithNamespace.E2) { // Expected } output.WriteLine("ok"); } } return(initial); }
public static IInitialPrx Run(TestHelper helper) { Communicator?communicator = helper.Communicator; TestHelper.Assert(communicator != null); System.IO.TextWriter output = helper.Output; var initial = IInitialPrx.Parse(helper.GetTestProxy("initial", 0), communicator); output.Write("getting proxies for interface hierarchy... "); output.Flush(); MA.IAPrx? ia = initial.Iaop(); MB.IB1Prx?ib1 = initial.Ib1op(); MB.IB2Prx?ib2 = initial.Ib2op(); MA.ICPrx? ic = initial.Icop(); TestHelper.Assert(ia != null); TestHelper.Assert(ib1 != null); TestHelper.Assert(ib2 != null); TestHelper.Assert(ic != null); TestHelper.Assert(ia != ib1); TestHelper.Assert(ia != ib2); TestHelper.Assert(ia != ic); TestHelper.Assert(ib1 != ic); TestHelper.Assert(ib2 != ic); output.WriteLine("ok"); output.Write("invoking proxy operations on interface hierarchy... "); output.Flush(); MA.IAPrx? iao; MB.IB1Prx?ib1o; MB.IB2Prx?ib2o; MA.ICPrx? ico; iao = ia.Iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ia.Iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ia.Iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ia.Iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ib1.Iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ib1.Iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ib1.Iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ib1.Iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ib2.Iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ib2.Iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ib2.Iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ib2.Iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ic.Iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ic.Iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ic.Iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ic.Iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ib1.Ib1op(ib1); TestHelper.Assert(iao !.Equals(ib1)); ib1o = ib1.Ib1op(ib1); TestHelper.Assert(ib1o !.Equals(ib1)); iao = ib1.Ib1op(ic); TestHelper.Assert(iao !.Equals(ic)); ib1o = ib1.Ib1op(ic); TestHelper.Assert(ib1o !.Equals(ic)); iao = ic.Ib1op(ib1); TestHelper.Assert(iao !.Equals(ib1)); ib1o = ic.Ib1op(ib1); TestHelper.Assert(ib1o !.Equals(ib1)); iao = ic.Ib1op(ic); TestHelper.Assert(iao !.Equals(ic)); ib1o = ic.Ib1op(ic); TestHelper.Assert(ib1o !.Equals(ic)); iao = ib2.Ib2op(ib2); TestHelper.Assert(iao !.Equals(ib2)); ib2o = ib2.Ib2op(ib2); TestHelper.Assert(ib2o !.Equals(ib2)); iao = ib2.Ib2op(ic); TestHelper.Assert(iao !.Equals(ic)); ib2o = ib2.Ib2op(ic); TestHelper.Assert(ib2o !.Equals(ic)); iao = ic.Ib2op(ib2); TestHelper.Assert(iao !.Equals(ib2)); ib2o = ic.Ib2op(ib2); TestHelper.Assert(ib2o !.Equals(ib2)); iao = ic.Ib2op(ic); TestHelper.Assert(iao !.Equals(ic)); ib2o = ic.Ib2op(ic); TestHelper.Assert(ib2o !.Equals(ic)); iao = ic.Icop(ic); TestHelper.Assert(iao !.Equals(ic)); ib1o = ic.Icop(ic); TestHelper.Assert(ib1o !.Equals(ic)); ib2o = ic.Icop(ic); TestHelper.Assert(ib2o !.Equals(ic)); ico = ic.Icop(ic); TestHelper.Assert(ico !.Equals(ic)); output.WriteLine("ok"); return(initial); }
public static IInitialPrx allTests(TestHelper helper) { Communicator?communicator = helper.Communicator(); TestHelper.Assert(communicator != null); System.IO.TextWriter output = helper.GetWriter(); var initial = IInitialPrx.Parse($"initial:{helper.GetTestEndpoint(0)}", communicator); output.Write("getting proxies for interface hierarchy... "); output.Flush(); MA.IIAPrx? ia = initial.iaop(); MB.IIB1Prx?ib1 = initial.ib1op(); MB.IIB2Prx?ib2 = initial.ib2op(); MA.IICPrx? ic = initial.icop(); TestHelper.Assert(ia != null); TestHelper.Assert(ib1 != null); TestHelper.Assert(ib2 != null); TestHelper.Assert(ic != null); TestHelper.Assert(ia != ib1); TestHelper.Assert(ia != ib2); TestHelper.Assert(ia != ic); TestHelper.Assert(ib1 != ic); TestHelper.Assert(ib2 != ic); output.WriteLine("ok"); output.Write("invoking proxy operations on interface hierarchy... "); output.Flush(); MA.IIAPrx? iao; MB.IIB1Prx?ib1o; MB.IIB2Prx?ib2o; MA.IICPrx? ico; iao = ia.iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ia.iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ia.iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ia.iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ib1.iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ib1.iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ib1.iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ib1.iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ib2.iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ib2.iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ib2.iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ib2.iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ic.iaop(ia); TestHelper.Assert(iao !.Equals(ia)); iao = ic.iaop(ib1); TestHelper.Assert(iao !.Equals(ib1)); iao = ic.iaop(ib2); TestHelper.Assert(iao !.Equals(ib2)); iao = ic.iaop(ic); TestHelper.Assert(iao !.Equals(ic)); iao = ib1.ib1op(ib1); TestHelper.Assert(iao !.Equals(ib1)); ib1o = ib1.ib1op(ib1); TestHelper.Assert(ib1o !.Equals(ib1)); iao = ib1.ib1op(ic); TestHelper.Assert(iao !.Equals(ic)); ib1o = ib1.ib1op(ic); TestHelper.Assert(ib1o !.Equals(ic)); iao = ic.ib1op(ib1); TestHelper.Assert(iao !.Equals(ib1)); ib1o = ic.ib1op(ib1); TestHelper.Assert(ib1o !.Equals(ib1)); iao = ic.ib1op(ic); TestHelper.Assert(iao !.Equals(ic)); ib1o = ic.ib1op(ic); TestHelper.Assert(ib1o !.Equals(ic)); iao = ib2.ib2op(ib2); TestHelper.Assert(iao !.Equals(ib2)); ib2o = ib2.ib2op(ib2); TestHelper.Assert(ib2o !.Equals(ib2)); iao = ib2.ib2op(ic); TestHelper.Assert(iao !.Equals(ic)); ib2o = ib2.ib2op(ic); TestHelper.Assert(ib2o !.Equals(ic)); iao = ic.ib2op(ib2); TestHelper.Assert(iao !.Equals(ib2)); ib2o = ic.ib2op(ib2); TestHelper.Assert(ib2o !.Equals(ib2)); iao = ic.ib2op(ic); TestHelper.Assert(iao !.Equals(ic)); ib2o = ic.ib2op(ic); TestHelper.Assert(ib2o !.Equals(ic)); iao = ic.icop(ic); TestHelper.Assert(iao !.Equals(ic)); ib1o = ic.icop(ic); TestHelper.Assert(ib1o !.Equals(ic)); ib2o = ic.icop(ic); TestHelper.Assert(ib2o !.Equals(ic)); ico = ic.icop(ic); TestHelper.Assert(ico !.Equals(ic)); output.WriteLine("ok"); return(initial); }
public static IInitialPrx allTests(TestHelper helper) { Communicator?communicator = helper.Communicator(); TestHelper.Assert(communicator != null); System.IO.TextWriter output = helper.GetWriter(); output.Write("testing stringToProxy... "); output.Flush(); var @base = IObjectPrx.Parse($"initial:{helper.GetTestEndpoint(0)}", communicator); output.WriteLine("ok"); output.Write("testing checked cast... "); output.Flush(); var initial = IInitialPrx.CheckedCast(@base); TestHelper.Assert(initial != null); TestHelper.Assert(initial.Equals(@base)); output.WriteLine("ok"); { output.Write("testing types without package... "); output.Flush(); NoNamespace.C1?c1 = initial.getNoNamespaceC2AsC1(); TestHelper.Assert(c1 != null); TestHelper.Assert(c1 is NoNamespace.C2); NoNamespace.C2?c2 = initial.getNoNamespaceC2AsC2(); TestHelper.Assert(c2 != null); try { initial.throwNoNamespaceE2AsE1(); TestHelper.Assert(false); } catch (NoNamespace.E1 ex) { TestHelper.Assert(ex is NoNamespace.E2); } try { initial.throwNoNamespaceE2AsE2(); TestHelper.Assert(false); } catch (NoNamespace.E2) { // Expected } try { initial.throwNoNamespaceNotify(); TestHelper.Assert(false); } catch (NoNamespace.@notify) { // Expected } output.WriteLine("ok"); } { output.Write("testing types with package... "); output.Flush(); { WithNamespace.C1?c1 = initial.getWithNamespaceC2AsC1(); TestHelper.Assert(c1 != null); TestHelper.Assert(c1 is WithNamespace.C2); WithNamespace.C2?c2 = initial.getWithNamespaceC2AsC2(); TestHelper.Assert(c2 != null); try { initial.throwWithNamespaceE2AsE1(); TestHelper.Assert(false); } catch (WithNamespace.E1 ex) { TestHelper.Assert(ex is WithNamespace.E2); } try { initial.throwWithNamespaceE2AsE2(); TestHelper.Assert(false); } catch (WithNamespace.E2) { // Expected } output.WriteLine("ok"); } } return(initial); }