public void TestSimpleUnion() { TestUnion arg = new TestUnion(); short case0Val = 11; arg.Setval0(case0Val); TestUnion result = m_testService.EchoTestUnion(arg); Assert.AreEqual(case0Val, result.Getval0()); Assert.AreEqual(0, result.Discriminator); TestUnion arg2 = new TestUnion(); int case1Val = 12; arg2.Setval1(case1Val, 2); TestUnion result2 = m_testService.EchoTestUnion(arg2); Assert.AreEqual(case1Val, result2.Getval1()); Assert.AreEqual(2, result2.Discriminator); TestUnion arg3 = new TestUnion(); bool case2Val = true; arg3.Setval2(case2Val, 7); TestUnion result3 = m_testService.EchoTestUnion(arg3); Assert.AreEqual(case2Val, result3.Getval2()); Assert.AreEqual(7, result3.Discriminator); }
public void TestPassingUnionsAsAny() { TestUnion arg = new TestUnion(); short case0Val = 11; arg.Setval0(case0Val); TestUnion result = (TestUnion)m_testService.EchoAny(arg); Assert.AreEqual(case0Val, result.Getval0()); Assert.AreEqual(0, result.Discriminator); TestUnionE arg2 = new TestUnionE(); TestEnumForU case1Val = TestEnumForU.A; arg2.SetvalE1(case1Val, TestEnumForU.B); TestUnionE result2 = (TestUnionE)m_testService.EchoAny(arg2); Assert.AreEqual(case1Val, result2.GetvalE1()); Assert.AreEqual(TestEnumForU.B, result2.Discriminator); }
public void TestSimpleUnion() { TestUnion arg = new TestUnion(); short case0Val = 11; arg.Setval0(case0Val); TestUnion result = m_testService.EchoTestUnion(arg); Assertion.AssertEquals(case0Val, result.Getval0()); Assertion.AssertEquals(0, result.Discriminator); TestUnion arg2 = new TestUnion(); int case1Val = 12; arg2.Setval1(case1Val, 2); TestUnion result2 = m_testService.EchoTestUnion(arg2); Assertion.AssertEquals(case1Val, result2.Getval1()); Assertion.AssertEquals(2, result2.Discriminator); TestUnion arg3 = new TestUnion(); bool case2Val = true; arg3.Setval2(case2Val, 7); TestUnion result3 = m_testService.EchoTestUnion(arg3); Assertion.AssertEquals(case2Val, result3.Getval2()); Assertion.AssertEquals(7, result3.Discriminator); }
public void TestPassingUnionsAsAny() { TestUnion arg = new TestUnion(); short case0Val = 11; arg.Setval0(case0Val); TestUnion result = (TestUnion)m_testService.EchoAny(arg); Assertion.AssertEquals(case0Val, result.Getval0()); Assertion.AssertEquals(0, result.Discriminator); TestUnionE arg2 = new TestUnionE(); TestEnumForU case1Val = TestEnumForU.A; arg2.SetvalE1(case1Val, TestEnumForU.B); TestUnionE result2 = (TestUnionE)m_testService.EchoAny(arg2); Assertion.AssertEquals(case1Val, result2.GetvalE1()); Assertion.AssertEquals(TestEnumForU.B, result2.Discriminator); }
public void TestUnionExceptions() { try { TestUnion arg = new TestUnion(); arg.Getval0(); Assert.Fail("exception not thrown for getting value from non-initalized union"); } catch (omg.org.CORBA.BAD_OPERATION) { } try { TestUnion arg = new TestUnion(); arg.Setval0(11); arg.Getval1(); Assert.Fail("exception not thrown for getting value from non-initalized union"); } catch (omg.org.CORBA.BAD_OPERATION) { } try { TestUnion arg1 = new TestUnion(); arg1.Setval1(11, 7); Assert.Fail("exception not thrown on wrong discriminator value."); } catch (omg.org.CORBA.BAD_PARAM) { } try { TestUnion arg2 = new TestUnion(); arg2.Setval2(false, 0); Assert.Fail("exception not thrown on wrong discriminator value."); } catch (omg.org.CORBA.BAD_PARAM) { } }
public void TestSimpleUnionNoExceptions() { TestUnion arg = new TestUnion(); short case0Val = 11; arg.Setval0(case0Val); TestUnion result = m_testService.EchoUnion(arg); Assert.AreEqual(case0Val, result.Getval0()); Assert.AreEqual(0, result.Discriminator); TestUnion arg2 = new TestUnion(); int case1Val = 12; arg2.Setval1(case1Val, 2); TestUnion result2 = m_testService.EchoUnion(arg2); Assert.AreEqual(case1Val, result2.Getval1()); Assert.AreEqual(2, result2.Discriminator); TestUnion arg3 = new TestUnion(); bool case2Val = true; arg3.Setval2(case2Val, 7); TestUnion result3 = m_testService.EchoUnion(arg3); Assert.AreEqual(case2Val, result3.Getval2()); Assert.AreEqual(7, result3.Discriminator); TestUnionULong arg4 = new TestUnionULong(); int case1Val2 = 13; arg4.Setval1(case1Val2); TestUnionULong result4 = m_testService.EchoUnionULong(arg4); Assert.AreEqual(case1Val2, result4.Getval1()); uint case1DiscrVal = 0x80000000; Assert.AreEqual((int)case1DiscrVal, result4.Discriminator); }