// The test is for the case where a paramerter type contains a field
    // never used.The test is to make sure the reflection info of the type
    // of the unused field would be kept by Net Native toolchain.
    public static void XmlSerializerFormat_ComplexType_With_FieldType_Never_Used()
    {
        // *** SETUP *** \\
        BasicHttpBinding binding         = new BasicHttpBinding();
        EndpointAddress  endpointAddress = new EndpointAddress(s_basicEndpointAddress);
        ChannelFactory <IWcfServiceXmlGenerated> factory = new ChannelFactory <IWcfServiceXmlGenerated>(binding, endpointAddress);
        IWcfServiceXmlGenerated serviceProxy             = factory.CreateChannel();

        var complex = new XmlVeryComplexType();

        complex.Id = 1;

        try
        {
            // *** EXECUTE *** \\
            var response = serviceProxy.EchoXmlVeryComplexType(complex);

            // *** VALIDATE *** \\
            Assert.True(response != null);
            Assert.True(response.NonInstantiatedField == null);
            Assert.Equal(complex.Id, response.Id);

            // *** CLEANUP *** \\
            ((ICommunicationObject)serviceProxy).Close();
            factory.Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
        }
    }
Esempio n. 2
0
 public XmlVeryComplexType EchoXmlVeryComplexType(XmlVeryComplexType complex)
 {
     return(complex);
 }
Esempio n. 3
0
 public XmlVeryComplexType EchoXmlVeryComplexType(XmlVeryComplexType complex)
 {
     return complex;
 }
    // The test is for the case where a paramerter type contains a field 
    // never used.The test is to make sure the reflection info of the type 
    // of the unused field would be kept by Net Native toolchain.
    public static void XmlSerializerFormat_ComplexType_With_FieldType_Never_Used()
    {
        // *** SETUP *** \\
        BasicHttpBinding binding = new BasicHttpBinding();
        EndpointAddress endpointAddress = new EndpointAddress(s_basicEndpointAddress);
        ChannelFactory<IWcfServiceXmlGenerated> factory = new ChannelFactory<IWcfServiceXmlGenerated>(binding, endpointAddress);
        IWcfServiceXmlGenerated serviceProxy = factory.CreateChannel();

        var complex = new XmlVeryComplexType();
        complex.Id = 1;

        try
        {
            // *** EXECUTE *** \\
            var response = serviceProxy.EchoXmlVeryComplexType(complex);

            // *** VALIDATE *** \\
            Assert.True(response != null);
            Assert.True(response.NonInstantiatedField == null);
            Assert.Equal(complex.Id, response.Id);

            // *** CLEANUP *** \\
            ((ICommunicationObject)serviceProxy).Close();
            factory.Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
        }
    }