Example #1
0
 public BehaviourViewModel()
 {
     _settings = WordsSettings.WordsAsapSettings;
     WordDialogShowInterval         = _settings.WordDialogShowInterval;
     WordsCollectionStorageFile     = _settings.CollectionStorageFile;
     WordsCollectionStorageLocation = _settings.CollectionStorageFolder;
     MaxNumberOfWordsDisplays       = _settings.MaxNumberOfWordDisplays;
 }
Example #2
0
        public static WordsCollectionService CreateWordsCollectionService(WordsSettings settings)
        {
            if (_wordsCollectionService != null && string.Equals(_wordsCollectionService._databaseFile, Path.Combine(settings.CollectionStorageFolder, settings.CollectionStorageFile)))
            {
                return(_wordsCollectionService);
            }
            if (_wordsCollectionService != null)
            {
                _wordsCollectionService.Dispose();
                _wordsCollectionService = null;
            }

            _wordsCollectionService = new WordsCollectionService(settings.CollectionStorageFolder, settings.CollectionStorageFile);
            return(_wordsCollectionService);
        }
Example #3
0
        public void GetWordsFrequency_ExcludedFilteredWords_WhenExistsTwoFilters()
        {
            var expected = new List <Word> {
                new Word("beautiful", 1)
            };
            var wordSettings = new WordsSettings {
                ForbiddenWords = new[] { "some", "text" }, MinLength = 4
            };
            var textHandler2 = new FrequencyTextHandler(
                new IWordFilter[]
            {
                new ForbiddenWordFilter(wordSettings),
                new LengthFilter(wordSettings)
            },
                new FrequencyWordWeigher());

            var result = textHandler2.GetHandledWords("Some lin beautiful text");

            result.Should().BeEquivalentTo(expected);
        }
Example #4
0
 public ForbiddenWordsAction(WordsSettings wordsSettings)
 {
     this.wordsSettings = wordsSettings;
 }
Example #5
0
 public ForbiddenWordFilter(WordsSettings wordsSettings)
 {
     this.wordsSettings = wordsSettings;
 }
Example #6
0
 public LengthFilter(WordsSettings wordsSettings)
 {
     this.wordsSettings = wordsSettings;
 }