public static void XmlSerializerFormatEncodedAttributeTest() { BasicHttpBinding binding = null; EndpointAddress endpointAddress = null; ChannelFactory <ICalculatorRpcEnc> factory1 = null; ICalculatorRpcEnc serviceProxy1 = null; // *** SETUP *** \\ binding = new BasicHttpBinding(); endpointAddress = new EndpointAddress(Endpoints.BasicHttpRpcEncSingleNs_Address); factory1 = new ChannelFactory <ICalculatorRpcEnc>(binding, endpointAddress); factory1.Endpoint.EndpointBehaviors.Add(new InspectorBehavior()); serviceProxy1 = factory1.CreateChannel(); // *** EXECUTE Variation *** \\ try { Assert.Equal(3, serviceProxy1.Sum2(1, 2)); } catch (Exception ex) { Assert.True(false, ex.Message); } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy1); } }
public static void XmlSFAttributeRpcEncSingleNsTest() { BasicHttpBinding binding = null; EndpointAddress endpointAddress = null; ChannelFactory <ICalculatorRpcEnc> factory1 = null; ICalculatorRpcEnc serviceProxy1 = null; // *** SETUP *** \\ binding = new BasicHttpBinding(); endpointAddress = new EndpointAddress(Endpoints.BasicHttpRpcEncSingleNs_Address); factory1 = new ChannelFactory <ICalculatorRpcEnc>(binding, endpointAddress); serviceProxy1 = factory1.CreateChannel(); // *** EXECUTE Variation *** \\ try { var dateTime = DateTime.Now; var intParams = new IntParams() { P1 = 5, P2 = 10 }; var floatParams = new FloatParams() { P1 = 5.0f, P2 = 10.0f }; var byteParams = new ByteParams() { P1 = 5, P2 = 10 }; Assert.Equal(3, serviceProxy1.Sum2(1, 2)); Assert.Equal(intParams.P1 + intParams.P2, serviceProxy1.Sum(intParams)); Assert.Equal(string.Format("{0}{1}", intParams.P1, intParams.P2), serviceProxy1.Concatenate(intParams)); Assert.Equal((float)(floatParams.P1 / floatParams.P2), serviceProxy1.Divide(floatParams)); Assert.Equal((new byte[] { byteParams.P1, byteParams.P2 }), serviceProxy1.CreateSet(byteParams)); Assert.Equal(dateTime, serviceProxy1.ReturnInputDateTime(dateTime)); Guid guid = Guid.NewGuid(); serviceProxy1.AddIntParams(guid, intParams); IntParams outputIntParams = serviceProxy1.GetAndRemoveIntParams(guid); Assert.NotNull(outputIntParams); Assert.Equal(intParams.P1, outputIntParams.P1); Assert.Equal(intParams.P2, outputIntParams.P2); } catch (Exception ex) { Assert.True(false, ex.Message); } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy1); } }