public BehaviourViewModel() { _settings = WordsSettings.WordsAsapSettings; WordDialogShowInterval = _settings.WordDialogShowInterval; WordsCollectionStorageFile = _settings.CollectionStorageFile; WordsCollectionStorageLocation = _settings.CollectionStorageFolder; MaxNumberOfWordsDisplays = _settings.MaxNumberOfWordDisplays; }
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); }
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); }
public ForbiddenWordsAction(WordsSettings wordsSettings) { this.wordsSettings = wordsSettings; }
public ForbiddenWordFilter(WordsSettings wordsSettings) { this.wordsSettings = wordsSettings; }
public LengthFilter(WordsSettings wordsSettings) { this.wordsSettings = wordsSettings; }