private static void AssertEquivalentTokenization(tokenization actual, tokenization expected)
 {
     Assert.That(actual, Is.Not.Null);
     Assert.That(actual.name, Is.EqualTo(expected.name));
     Assert.That(actual.product, Is.Null);
     Assert.That(actual.query, Is.Null);
 }
        public void WordStemsTokenization()
        {
            var tokenization = new tokenization {
                name = "Text (word stems)"
            };
            var options = _container.Resolve <ConfigurationOptions>();
            var actual  = options.Tokenization(Tokenization.WordStems);

            AssertEquivalentTokenization(actual, tokenization);
        }
        public void ModelDesignationTokenization()
        {
            var tokenization = new tokenization {
                name = "Model designation (e.g. MB12a)"
            };
            var options = _container.Resolve <ConfigurationOptions>();
            var actual  = options.Tokenization(Tokenization.ModelDesignation);

            AssertEquivalentTokenization(actual, tokenization);
        }
        public void CaseInsensitiveTokenization()
        {
            var tokenization = new tokenization {
                name = "Case insensitive"
            };
            var options = _container.Resolve <ConfigurationOptions>();
            var actual  = options.Tokenization(Tokenization.CaseInsensitive);

            AssertEquivalentTokenization(actual, tokenization);
        }
        public void NoTokenization()
        {
            var tokenization = new tokenization {
                name = "(no refinement)"
            };
            var options = _container.Resolve <ConfigurationOptions>();
            var actual  = options.Tokenization(Tokenization.None);

            AssertEquivalentTokenization(actual, tokenization);
        }
예제 #6
0
        private static Tokenization MapTokenization(tokenization tokenization)
        {
            switch (tokenization.name)
            {
            case "(no refinement)":
                return(Import.Configuration.Tokenization.None);

            case "Case insensitive":
                return(Import.Configuration.Tokenization.CaseInsensitive);

            case "Model designation (e.g. MB12a)":
                return(Import.Configuration.Tokenization.ModelDesignation);

            case "Text (words)":
                return(Import.Configuration.Tokenization.Words);

            case "Text (word stems)":
                return(Import.Configuration.Tokenization.WordStems);
            }
            throw new ArgumentOutOfRangeException("tokenization", tokenization.name, "Unexpected tokenization.");
        }