public void SetUp() { textReader = A.Fake <ITextReader>(); wordsFilter = A.Fake <IWordsFilter>(); wordsCounter = A.Fake <IWordsCounter>(); wordsToSizesConverter = A.Fake <IWordsToSizesConverter>(); ccl = A.Fake <ICloudLayouter>(); visualiser = A.Fake <IVisualiser>(); imageSaver = A.Fake <IFileSaver>(); }
private void OnSelectedAlgorithmChanged() { var strategyKey = SelectedAlgorithm == WordCounterAlgorithm.Dict ? TypesConsts.DictStrategy : TypesConsts.LinqStrategy; _wordsCounter = ServiceLocator.Current.GetInstance<IWordsCounter>(strategyKey); if (Result == null) { return; } CheckSentence.Execute(Sentence); }
public TagCloudGenerator( IWordsLayouter wordsLayouter, IWordsDrawer wordsDrawer, IWordsFileReader wordsFileReader, IEnumerable <IWordsProcessor> processors, IWordsCounter counter, IEnumerable <IImageSaver> savers) { this.wordsLayouter = wordsLayouter; this.wordsDrawer = wordsDrawer; this.wordsFileReader = wordsFileReader; this.processors = processors; this.counter = counter; this.savers = savers; }
public TagsCloudContainer(ITextReader textReader, IWordsFilter wordsFilter, IWordsCounter wordsCounter, IWordsToSizesConverter wordsToSizesConverter, ICloudLayouter ccl, IVisualiser visualiser, IFileSaver fileSaver, string output, string input ) { this.textReader = textReader; this.wordsFilter = wordsFilter; this.wordsCounter = wordsCounter; this.wordsToSizesConverter = wordsToSizesConverter; CCL = ccl; this.visualiser = visualiser; outputFile = output; inputFile = input; imageSaver = fileSaver; }
public TagsCloudController( IConfiguration configuration, IDataReader reader, IPreprocessor preprocessor, IWordsCounter wordsCounter, ITagsGenerator tagsGenerator, IVisualizer visualizer, IImageWriter imageWriter) { this.configuration = configuration; this.reader = reader; this.preprocessor = preprocessor; this.wordsCounter = wordsCounter; this.tagsGenerator = tagsGenerator; this.visualizer = visualizer; this.imageWriter = imageWriter; }
private void SentenceWithDifferentSeparatorsTest(IWordsCounter wordsCounter) { const string SampleString = "This,is;a/sentence\\it(is<simple."; wordsCounter.Count(SampleString); wordsCounter.CheckIfResultIsProvidedAndNotEmpty(); wordsCounter.CheckWordInResult("this", 1); wordsCounter.CheckWordInResult("is", 2); wordsCounter.CheckWordInResult("a", 1); wordsCounter.CheckWordInResult("sentence", 1); wordsCounter.CheckWordInResult("it", 1); wordsCounter.CheckWordInResult("simple", 1); wordsCounter.CheckWordInResult(",", 0); wordsCounter.CheckWordInResult(".", 0); wordsCounter.CheckResultCount(6); }
private void MoreThanOneSentenceTest2(IWordsCounter counter) { counter.Count("This is first sentence! This is second sentence."); }
public WordsCounterViewModel() { AvailableAlgorithms = new[] {WordCounterAlgorithm.Dict, WordCounterAlgorithm.Linq}; CheckSentence = new RelayCommand<string>(ExecuteCheckSentence, CanCheckSentence); _wordsCounter = ServiceLocator.Current.GetInstance<IWordsCounter>(TypesConsts.DictStrategy); }
private void SimpleSentenceWithoutDotTest(IWordsCounter wordsCounter) { const string SampleString = "This is a sentence, it is simple"; wordsCounter.Count(SampleString); wordsCounter.CheckIfResultIsProvidedAndNotEmpty(); wordsCounter.CheckWordInResult("this", 1); wordsCounter.CheckWordInResult("is", 2); wordsCounter.CheckWordInResult("a", 1); wordsCounter.CheckWordInResult("sentence", 1); wordsCounter.CheckWordInResult("it", 1); wordsCounter.CheckWordInResult("simple", 1); wordsCounter.CheckWordInResult(",", 0); wordsCounter.CheckWordInResult(".", 0); wordsCounter.CheckResultCount(6); }
public CloudMaker(IWordsCounter counter, IWeightScaler scaler, CloudDrawer drawer) { this.counter = counter; this.scaler = scaler; this.drawer = drawer; }
private void SentenceWithDifferentSpacingTest(IWordsCounter wordsCounter) { const string SampleString = "\t , It \nis a sentence, it \r \t is simple."; wordsCounter.Count(SampleString); wordsCounter.CheckIfResultIsProvidedAndNotEmpty(); wordsCounter.CheckWordInResult("it", 2); wordsCounter.CheckWordInResult("is", 2); wordsCounter.CheckWordInResult("a", 1); wordsCounter.CheckWordInResult("sentence", 1); wordsCounter.CheckWordInResult("simple", 1); wordsCounter.CheckWordInResult(",", 0); wordsCounter.CheckWordInResult(".", 0); wordsCounter.CheckResultCount(5); }
private void SentenceWithSeparatorsOnlyTest(IWordsCounter wordsCounter) { const string SampleString = ".; \t , ()\\~/;"; wordsCounter.Count(SampleString); wordsCounter.CheckIfResultIsEmpty(); }
private void SentenceWithDifferentBracketsTest(IWordsCounter wordsCounter) { const string SampleString = "This (is) <a> [sentence], it {is} simple."; wordsCounter.Count(SampleString); wordsCounter.CheckIfResultIsProvidedAndNotEmpty(); wordsCounter.CheckWordInResult("this", 1); wordsCounter.CheckWordInResult("is", 2); wordsCounter.CheckWordInResult("a", 1); wordsCounter.CheckWordInResult("sentence", 1); wordsCounter.CheckWordInResult("it", 1); wordsCounter.CheckWordInResult("simple", 1); wordsCounter.CheckWordInResult(",", 0); wordsCounter.CheckWordInResult(".", 0); wordsCounter.CheckResultCount(6); }
private void EmptySentenceTest(IWordsCounter counter) { counter.Count(string.Empty); }
private void SentenceDifferentCaseTest(IWordsCounter wordsCounter) { const string SampleString = "IT Is a sentence, it iS simple."; wordsCounter.Count(SampleString); wordsCounter.CheckIfResultIsProvidedAndNotEmpty(); wordsCounter.CheckWordInResult("it", 2); wordsCounter.CheckWordInResult("is", 2); wordsCounter.CheckWordInResult("a", 1); wordsCounter.CheckWordInResult("sentence", 1); wordsCounter.CheckWordInResult("simple", 1); wordsCounter.CheckWordInResult(",", 0); wordsCounter.CheckWordInResult(".", 0); wordsCounter.CheckResultCount(5); }
private void WhitespaceSentenceTest5(IWordsCounter counter) { counter.Count(" \t\t \r\n "); }
private void WhitespaceSentenceTest4(IWordsCounter counter) { counter.Count("\r"); }
private void NullSentenceTest(IWordsCounter counter) { counter.Count(null); }
private void MoreThanOneSentenceTest3(IWordsCounter counter) { counter.Count("This is first sentence. Is there a second sentence?"); }