private static BlogSyncConfiguration GetTestBlogSyncConfiguration(
     IBlogSource blogSource = null,
     IDataStorage dataStorage = null)
 {
     var config = new BlogSyncConfiguration(blogSource, dataStorage, null, null, null, null);
     return config;
 }
        public BlogSyncConfiguration(
            IBlogSource blogSource,
            IDataStorage dataStorage,
            IBlogPostBlavenIdProvider blavenIdProvider = null,
            IBlogPostUrlSlugProvider slugProvider = null,
            BlogTransformersProvider transformersProvider = null,
            IEnumerable<BlogSetting> blogSettings = null)
        {
            if (blogSource == null)
            {
                throw new ArgumentNullException(nameof(blogSource));
            }
            if (dataStorage == null)
            {
                throw new ArgumentNullException(nameof(dataStorage));
            }

            this.BlogSource = blogSource;
            this.DataStorage = dataStorage;

            this.BlavenIdProvider = blavenIdProvider ?? BlogSyncConfigurationDefaults.BlavenIdProvider;
            this.SlugProvider = slugProvider ?? BlogSyncConfigurationDefaults.SlugProvider;
            this.TransformersProvider = transformersProvider ?? BlogSyncConfigurationDefaults.TransformersProvider;
            this.BlogSettings = (blogSettings ?? new BlogSetting[0]).Where(x => x.BlogKey != null).ToList();
        }
        public static BlogSyncService Create(
            IBlogSource blogSource = null,
            IDataStorage dataStorage = null,
            IEnumerable<BlogSetting> blogSettings = null)
        {
            blogSource = blogSource ?? new FakeBlogSource();
            dataStorage = dataStorage ?? new FakeDataStorage();
            blogSettings = blogSettings ?? BlogSettingTestData.CreateCollection();

            var service = new BlogSyncService(blogSource, dataStorage, blogSettings.ToArray());
            return service;
        }
        internal static BlogSyncConfiguration Create(
            IBlogSource blogSource,
            IDataStorage dataStorage,
            IEnumerable<BlogSetting> blogSettings)
        {
            if (blogSource == null)
            {
                throw new ArgumentNullException(nameof(blogSource));
            }
            if (dataStorage == null)
            {
                throw new ArgumentNullException(nameof(dataStorage));
            }

            var config = new BlogSyncConfiguration(
                             blogSource,
                             dataStorage,
                             slugProvider: null,
                             blavenIdProvider: null,
                             transformersProvider: null,
                             blogSettings: blogSettings);
            return config;
        }
Exemple #5
0
 public BlogSyncService(IBlogSource blogSource, IDataStorage dataStorage, params BlogSetting[] blogSettings)
     : this(blogSource, dataStorage, blogSettings?.AsEnumerable())
 {
 }
Exemple #6
0
 public BlogSyncService(IBlogSource blogSource, IDataStorage dataStorage, IEnumerable<BlogSetting> blogSettings)
     : this(BlogSyncConfiguration.Create(blogSource, dataStorage, blogSettings))
 {
 }