Example #1
0
        public void SetUp()
        {
            cloudOptions = DefaultCloudOptions;

            randomWords = Enumerable.Range(0, 50)
                          .Select(wordNumber => TestsHelper.GetRandomString((wordNumber / 10 + 1) * 2,
                                                                            TestContext.CurrentContext.Random))
                          .ToArray();
            excludedWords = randomWords.Where(word => word.Length <= 2);

            vocabularyParser = A.Fake <ICloudVocabularyParser>();

            A.CallTo(() => vocabularyParser.GetCloudVocabulary(DefaultCloudOptions.CloudVocabularyFilename))
            .Returns(randomWords.AsEnumerable().AsResult());
            A.CallTo(() => vocabularyParser.GetCloudVocabulary(
                         DefaultCloudOptions.ExcludedWordsVocabularyFilename))
            .Returns(excludedWords.AsEnumerable().AsResult());

            contextGenerator = new CloudContextGenerator(cloudOptions, vocabularyParser);
            cloudGenerator   = new CloudGenerator(contextGenerator, PreprocessorConstructor);
        }
Example #2
0
 private Result <IEnumerable <string> > ParseCloudVocabulary(string cloudVocabularyFilename) =>
 cloudVocabularyFilename is null
         ? Enumerable.Empty <string>().AsResult()
         : vocabularyParser.GetCloudVocabulary(cloudVocabularyFilename);