public void Test_Soap_ReadMedicareSupplier() { using (var testPipeline = new Pipeline()) { var reader = new SoapClient() { Wsdl = "http://www.webservicex.net/medicareSupplier.asmx?WSDL", MethodName = "GetSupplierByCity", Formatter = new XPathToDataTableFormatter() { RowXPath = "/GetSupplierByCityResponse/SupplierDataLists/SupplierDatas/SupplierData" } }; reader.DataMappings.Add(new DataMapping() { Name = "City", Value = "Fort Worth" }); testPipeline.Commands.Add(reader); var writer = new FlatFileWriter() { File = this.resultPath + @"MedicareSupplier.csv", Formatter = new DataTableToCsvFormatter() }; reader.AddChild(writer); //testPipeline.OnExecuteCommand += (cmd) => //{ //}; testPipeline.ExecutePipeline(); } // check var targetlineCount = File.ReadLines(this.resultPath + @"MedicareSupplier.csv").Count(); Assert.AreNotSame(0, targetlineCount); var resultContent = File.ReadAllText(this.resultPath + @"MedicareSupplier.csv"); if (resultContent.Length <= 4) { throw new AssertFailedException("No content in MedicareSupplier.csv"); } }
public void Test_Soap_ReadCustomerService() { using (var testPipeline = new Pipeline()) { var reader = new SoapClient() { Wsdl = "http://www.predic8.com:8080/crm/CustomerService?wsdl", MethodName = "getAll", Formatter = new XPathToDataTableFormatter() { RowXPath = "/getAllResponse/customer" } }; testPipeline.Commands.Add(reader); var writer = new FlatFileWriter() { File = this.resultPath + @"CustomerService.csv", Formatter = new DataTableToCsvFormatter() }; reader.AddChild(writer); testPipeline.ExecutePipeline(); } // check var targetlineCount = File.ReadLines(this.resultPath + @"CustomerService.csv").Count(); Assert.AreNotSame(0, targetlineCount); var resultContent = File.ReadAllText(this.resultPath + @"CustomerService.csv"); if (resultContent.Length <= 4) { throw new AssertFailedException("No content in CustomerService.csv"); } }