コード例 #1
0
        public static void ComplexMessage_OperationFormatUseLiteral()
        {
            System.ServiceModel.ChannelFactory <IEchoSoapService> factory = DispatcherHelper
                                                                            .CreateChannelFactory <EchoSoapService, IEchoSoapService>();
            factory.Open();
            IEchoSoapService channel = factory.CreateChannel();

            ((System.ServiceModel.Channels.IChannel)channel).Open();
            var expected = new ComplexMessage
            {
                Date          = System.DateTime.Now,
                InnerMessages = new InnerComplexMessage[]
                {
                    new InnerComplexMessage
                    {
                        Guid = System.Guid.NewGuid(),
                    },
                },
            };
            ComplexMessage actual = channel.GetComplexMessageLiteral(expected);

            Assert.Equal(expected, actual);
            ((System.ServiceModel.Channels.IChannel)channel).Close();
            factory.Close();
            TestHelper.CloseServiceModelObjects((System.ServiceModel.Channels.IChannel)channel, factory);
        }
コード例 #2
0
        public static void Echo_OperationFormatUseLiteral()
        {
            System.ServiceModel.ChannelFactory <IEchoSoapService> factory = DispatcherHelper
                                                                            .CreateChannelFactory <EchoSoapService, IEchoSoapService>();
            factory.Open();
            IEchoSoapService channel = factory.CreateChannel();

            ((System.ServiceModel.Channels.IChannel)channel).Open();
            string echo = channel.EchoLiteral("hello");

            Assert.Equal("hello", echo);
            ((System.ServiceModel.Channels.IChannel)channel).Close();
            factory.Close();
            TestHelper.CloseServiceModelObjects((System.ServiceModel.Channels.IChannel)channel, factory);
        }