예제 #1
0
        public int Run(BaseOptions options)
        {
            var opts = (FixtureOptions)options;

            if (!File.Exists(opts.Input))
            {
                Console.WriteLine("Error: Input file {0} not found.", opts.Input);
                return(1);
            }

            var parser = new InpxParser(opts.Input);

            parser.OnNewEntry += Parser_OnNewEntry;

            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine(@"using DotOPDS.Models;
using DotOPDS.Utils;
using System;
using System.Collections.Generic;

namespace DotOPDS.Tests
{
    class InpxDemoFixture
    {
        public static List<Book> Result = new List<Book>
        {");

            parser.Parse().Wait(); // perform in a sync way

            Console.WriteLine(@"        };
    }
}");

            return(0);
        }
예제 #2
0
        public async Task ParsingFileTest()
        {
            var parser = new InpxParser(Utils.GetPath(filename));

            parser.IsFb2.Should().BeTrue();
            parser.Name.Should().Be("Lib.rus.ec Local [FB2]");
            parser.FileName.Should().Be("librusec_local_fb2");
            parser.Description.Should().Be("Архивы библиотеки Lib.rus.ec (fb2)\nhttp://lib.rus.ec/");
            parser.Version.Should().Be("20160301");

            parser.OnNewEntry += Parser_OnNewEntry;
            parser.OnFinished += Parser_OnFinished;
            await parser.Parse();
        }