示例#1
0
        public StoryService(IConfigurationSettings settings, IDomainObjectFactory factory, ICategoryRepository categoryRepository, ITagRepository tagRepository, IStoryRepository storyRepository, IMarkAsSpamRepository markAsSpamRepository, IEventAggregator eventAggregator, ISpamProtection spamProtection, ISpamPostprocessor spamPostprocessor, IContentService contentService, IHtmlSanitizer htmlSanitizer, IThumbnail thumbnail, IStoryWeightCalculator[] storyWeightCalculators, IVoteRepository voteRepository)
        {
            Check.Argument.IsNotNull(settings, "settings");
            Check.Argument.IsNotNull(factory, "factory");
            Check.Argument.IsNotNull(categoryRepository, "categoryRepository");
            Check.Argument.IsNotNull(tagRepository, "tagRepository");
            Check.Argument.IsNotNull(storyRepository, "storyRepository");
            Check.Argument.IsNotNull(markAsSpamRepository, "markAsSpamRepository");
            Check.Argument.IsNotNull(eventAggregator, "eventAggregator");
            Check.Argument.IsNotNull(spamProtection, "spamProtection");
            Check.Argument.IsNotNull(spamPostprocessor, "spamPostprocessor");
            Check.Argument.IsNotNull(contentService, "contentService");
            Check.Argument.IsNotNull(htmlSanitizer, "htmlSanitizer");
            Check.Argument.IsNotNull(thumbnail, "thumbnail");
            Check.Argument.IsNotEmpty(storyWeightCalculators, "storyWeightCalculators");
            Check.Argument.IsNotNull(voteRepository, "voteRepository");

            _settings               = settings;
            _factory                = factory;
            _categoryRepository     = categoryRepository;
            _tagRepository          = tagRepository;
            _storyRepository        = storyRepository;
            _markAsSpamRepository   = markAsSpamRepository;
            _eventAggregator        = eventAggregator;
            _spamProtection         = spamProtection;
            _spamPostprocessor      = spamPostprocessor;
            _contentService         = contentService;
            _htmlSanitizer          = htmlSanitizer;
            _thumbnail              = thumbnail;
            _storyWeightCalculators = storyWeightCalculators;
            _voteRepository         = voteRepository;
        }
示例#2
0
        public DefaultSpamProtectionFixture()
        {
            _httpForm = new Mock <IHttpForm>();

            _calculator1 = new Mock <ISpamWeightCalculator>();
            _calculator2 = new Mock <ISpamWeightCalculator>();
            _calculator3 = new Mock <ISpamWeightCalculator>();

            _spamProtection = new DefaultSpamProtection(settings.Object, _httpForm.Object, StoryThreshold, new[] { _calculator1.Object, _calculator2.Object, _calculator3.Object }, new[] { _calculator1.Object, _calculator2.Object, _calculator3.Object }, CommentThreshold, new[] { _calculator1.Object, _calculator2.Object, _calculator3.Object });
        }
 public DefensioSpamProtectionFixture()
 {
     _httpForm       = new Mock <IHttpForm>();
     _spamProtection = new DefensioSpamProtection(ApiKey, Version, settings.Object, _httpForm.Object);
 }