Пример #1
0
        public void MethodCallWithComplexParameters()
        {
            TestStructure first = new TestStructure { FieldA = "First", FieldB = 42, FieldC = true };
            TestStructure second = new TestStructure { FieldA = "Second", FieldB = 314, FieldC = false };
            TestStructure single = new TestStructure { FieldA = "Single", FieldB = 2, FieldC = true };

            ITestService service = new ServiceProxy<ITestService>(this._serverUrl, "TestService").Service;

            Assert.AreEqual(first.FieldA, service.MethodWithComplexTypes(new[] { first, second }, single, TestEnum.First).FieldA);
            Assert.AreEqual(second.FieldB, service.MethodWithComplexTypes(new[] { first, second }, single, TestEnum.Second).FieldB);
            Assert.AreEqual(single.FieldC, service.MethodWithComplexTypes(new[] { first, second }, single, TestEnum.Single).FieldC);
        }
Пример #2
0
        public TestStructure MethodWithComplexTypes(TestStructure[] data, TestStructure singleStructure, TestEnum expectedResult)
        {
            switch (expectedResult)
            {
                case TestEnum.First:
                    return data[0];
                case TestEnum.Second:
                    return data[1];
                case TestEnum.Single:
                    return singleStructure;

                default:
                    return null;
            }
        }
Пример #3
0
 public virtual TestStructure MethodWithComplexTypes(TestStructure[] data, TestStructure singleStructure, TestEnum expectedResult)
 {
     RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
     @__LocalMessage.InitializeRequestMessage(@__ClientChannel, "TestLibrary", @__GetActiveInterfaceName(), "MethodWithComplexTypes");
     @__LocalMessage.Write("data", data, typeof(TestStructure[]), RemObjects.SDK.StreamingFormat.Default);
     @__LocalMessage.Write("singleStructure", singleStructure, typeof(TestStructure), RemObjects.SDK.StreamingFormat.Default);
     @__LocalMessage.Write("expectedResult", expectedResult, typeof(TestEnum), RemObjects.SDK.StreamingFormat.Default);
     @__LocalMessage.FinalizeMessage();
     @__ClientChannel.Dispatch(@__LocalMessage);
     TestStructure _Result = ((TestStructure)(@__LocalMessage.Read("Result", typeof(TestStructure), RemObjects.SDK.StreamingFormat.Default)));
     @__LocalMessage.Clear();
     return _Result;
 }
Пример #4
0
 public virtual System.Threading.Tasks.Task<TestStructure> MethodWithComplexTypesAsync(TestStructure[] data, TestStructure singleStructure, TestEnum expectedResult)
 {
     return System.Threading.Tasks.Task<TestStructure>.Factory.FromAsync(this.BeginMethodWithComplexTypes(data, singleStructure, expectedResult, null, null), new System.Func<System.IAsyncResult, TestStructure>(this.EndMethodWithComplexTypes));
 }
Пример #5
0
 public virtual System.IAsyncResult BeginMethodWithComplexTypes(TestStructure[] data, TestStructure singleStructure, TestEnum expectedResult, System.AsyncCallback @__Callback, object @__UserData)
 {
     RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
     @__LocalMessage.InitializeRequestMessage(@__ClientChannel, "TestLibrary", @__GetActiveInterfaceName(), "MethodWithComplexTypes");
     @__LocalMessage.Write("data", data, typeof(TestStructure[]), RemObjects.SDK.StreamingFormat.Default);
     @__LocalMessage.Write("singleStructure", singleStructure, typeof(TestStructure), RemObjects.SDK.StreamingFormat.Default);
     @__LocalMessage.Write("expectedResult", expectedResult, typeof(TestEnum), RemObjects.SDK.StreamingFormat.Default);
     @__LocalMessage.FinalizeMessage();
     return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
 }