コード例 #1
0
 ArticleUpdaterService CreateService(
     IUpdateSourceValidator validator,
     IArticleProvider provider,
     IArticleStorageUpdater updater)
 {
     return(new ArticleUpdaterService(
                validator,
                provider,
                updater));
 }
コード例 #2
0
        ArticleUpdaterService CreateService(
            IUpdateSourceValidator validator,
            IArticleStorageUpdater updater)
        {
            var stubProvider = Substitute.For <IArticleProvider>();

            return(CreateService(
                       validator,
                       stubProvider,
                       updater));
        }
コード例 #3
0
        public void Constructor_NullUpdaterPassed_Throws()
        {
            var stubValidator = Substitute.For <IUpdateSourceValidator>();
            var stubProvider  = Substitute.For <IArticleProvider>();
            IArticleStorageUpdater nullUpdater = null;

            Assert.Catch <ArgumentNullException>(() =>
                                                 new ArticleUpdaterService(
                                                     stubValidator,
                                                     stubProvider,
                                                     nullUpdater));
        }
コード例 #4
0
        public ArticleUpdaterService(
            IUpdateSourceValidator validator,
            IArticleProvider provider,
            IArticleStorageUpdater updater)
        {
            if (validator == null)
            {
                throw new ArgumentNullException(nameof(validator));
            }
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }

            this.validator = validator;
            this.provider  = provider;
            this.updater   = updater;
        }