コード例 #1
0
        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);
        }
コード例 #2
0
        public void TestEnumBasedUnionNoExceptions()
        {
            TestUnionE arg      = new TestUnionE();
            short      case0Val = 11;

            arg.SetvalE0(case0Val);
            TestUnionE result = m_testService.EchoTestUnionE(arg);

            Assert.AreEqual(case0Val, result.GetvalE0());
            Assert.AreEqual(TestEnumForU.A, result.Discriminator);

            TestUnionE   arg2     = new TestUnionE();
            TestEnumForU case1Val = TestEnumForU.A;

            arg2.SetvalE1(case1Val, TestEnumForU.B);
            TestUnionE result2 = m_testService.EchoTestUnionE(arg2);

            Assert.AreEqual(case1Val, result2.GetvalE1());
            Assert.AreEqual(TestEnumForU.B, result2.Discriminator);
        }