Ejemplo n.º 1
0
        /// <summary>
        /// Method to run the strategy specified in the strategyType parameter against the string (or path)
        /// in the sentence parameter
        /// </summary>
        /// <param name="strategyType"> The strategy to be employed </param>
        /// <param name="sentence"> The string (or path) from which accumulated data will be retrieved </param>
        /// <returns> Dictionary of words and their respective counts </returns>
        public Dictionary<string, int> RunStrategy(StrategyType strategyType, string sentence)
        {
            IStrategy strategy;

            switch (strategyType)
            {
                case StrategyType.PrefixTree:
                    strategy = new PrefixTreeStrategy(this._fileService);
                    break;
                default:
                    strategy = new BasicStrategy();
                    break;
            }

            return strategy.Count(sentence);
        }
 public void Init()
 {
     this.mockFileService = new Mock<IFileService>();
     this._treeStrategy = new PrefixTreeStrategy(this.mockFileService.Object);
 }