Example #1
0
        public void Test_RestService_GetCountries()
        {
            using (var testPipeline = new Pipeline())
            {
                var httpClient = new HttpClient()
                {
                    Url       = @"http://services.groupkt.com/country/get/all",
                    Formatter = new JsonToDataTableFormatter()
                    {
                        RowXPath = "/RestResponse/result"
                    }
                };

                testPipeline.Commands.Add(httpClient);

                var writer = new FlatFileWriter()
                {
                    File = this.resultPath + @"allcountries.txt", DeleteBefore = true
                };
                writer.Formatter = new DataTableToCsvFormatter()
                {
                    Separator = ";"
                };
                httpClient.AddChild(writer);

                testPipeline.ExecutePipeline();
            }

            // check
            var targetlineCount = File.ReadLines(this.resultPath + @"allcountries.txt").Count();

            Assert.AreEqual(250, targetlineCount);
        }