Пример #1
0
        static async Task Bookmarks()
        {
            var v = new Verifier();

            var dt   = new ReceiverHtmlSelector(@"C:\Users\Surface1\Desktop\bookmarks_11_17_17.html", Encoding.UTF8, "//dt/a");
            var data = await dt.TransformData(null);

            data = await v.TransformData(data);

            //data = await new TransformerHTMLAttribute("item_html", "href").TransformData(data);
            //data = await v.TransformData(data);
            data = await new TransformerAddColumnExpressionByColumn("item_html", "'<li>' + item_html +'</li>'", "li").TransformData(data);
            data = await v.TransformData(data);

            data = await new FilterRemoveColumn("item_html").TransformData(data);
            data = await v.TransformData(data);

            data = await new FilterRemoveColumn("item").TransformData(data);
            data = await v.TransformData(data);

            data = await new TransformerOneColumnToMultiTablesByNumber(data.Metadata.Tables.First().Name, 20).TransformData(data);
            data = await v.TransformData(data);

            var excel = new SenderExcel(@"text.xslx");

            data = await excel.TransformData(data);

            data = await v.TransformData(data);
        }
Пример #2
0
        public void TestSimple(string fileName, int numberColsBefore, int numberColsAfter)
        {
            //data = await new TransformerHTMLAttribute("item_html", "href").TransformData(data);
            IReceive receiver = null;
            var      nl       = Environment.NewLine;


            IDataToSent data = null;

            $"Given the file {fileName} ".w(() => { File.Exists(fileName).Should().BeTrue(); });
            $"When I create the ReceiverHtmlSelector  for the {fileName}".w(() =>
                                                                            receiver = new ReceiverHtmlSelector(fileName, Encoding.UTF8, "//dt/a"));
            $"And I read the data".w(async() => data = await receiver.TransformData(null));
            $"Then should be a data".w(() => data.Should().NotBeNull());
            $"With a table".w(() =>
            {
                data.DataToBeSentFurther.Should().NotBeNull();
                data.DataToBeSentFurther.Count.Should().Be(1);
            });
            $"The number of cols should be {numberColsBefore}".w(() => data.DataToBeSentFurther[0].Columns.Count.Should().Be(numberColsBefore));
            $"and I transform data with TransformerHtmlAttribute".w(async() =>
                                                                    data = await new TransformerHTMLAttribute("item_html", "href").TransformData(data));
            $"The number of cols should be {numberColsBefore}".w(() => data.DataToBeSentFurther[0].Columns.Count.Should().Be(numberColsAfter));
        }