Exemplo n.º 1
0
        protected override Task <int> Execute(ImportCommandArguments arguments)
        {
            Tracing.Info("import - import posts from external source");

            if (!Importers.Any(e => string.Equals(e, arguments.ImportType, StringComparison.InvariantCultureIgnoreCase)))
            {
                Tracing.Info("Requested import type not found: {0}", arguments.ImportType);

                return(Task.FromResult(1));
            }

            if (string.Equals("wordpress", arguments.ImportType, StringComparison.InvariantCultureIgnoreCase))
            {
                var wordpressImporter = new WordpressImport(FileSystem, arguments.Source, arguments.ImportFile);
                wordpressImporter.Import();
            }
            else if (string.Equals("blogger", arguments.ImportType, StringComparison.InvariantCultureIgnoreCase))
            {
                var bloggerImporter = new BloggerImport(FileSystem, arguments.Source, arguments.ImportFile);
                bloggerImporter.Import();
            }

            Tracing.Info("Import complete");

            return(Task.FromResult(0));
        }
Exemplo n.º 2
0
#pragma warning restore 649

        public void Execute(IEnumerable <string> arguments)
        {
            Tracing.Info("import - import posts from external source");

            parameters.Parse(arguments);

            if (!Importers.Any(e => String.Equals(e, parameters.ImportType, StringComparison.InvariantCultureIgnoreCase)))
            {
                Tracing.Info("Requested import type not found: {0}", parameters.ImportType);
                return;
            }

            if (string.Equals("wordpress", parameters.ImportType, StringComparison.InvariantCultureIgnoreCase))
            {
                var wordpressImporter = new WordpressImport(fileSystem, parameters.Path, parameters.ImportPath);
                wordpressImporter.Import();
            }
            else if (string.Equals("blogger", parameters.ImportType, StringComparison.InvariantCultureIgnoreCase))
            {
                var bloggerImporter = new BloggerImport(fileSystem, parameters.Path, parameters.ImportPath);
                bloggerImporter.Import();
            }

            Tracing.Info("Import complete");
        }
        public void Posts_Are_Imported()
        {
            wordpressImporter.Import();

            Assert.True(fileSystem.File.Exists(outputFileName));
        }