Exemplo n.º 1
0
        public void GetSimilarNgramsFromTable_NullListWithNames()
        {
            var provider = new SqlQueryProviderAlpha(_names);

            Exception ex = Assert.Throws <ArgumentException>(() => provider.GetSimilarNgramsFromTable(NgramType.Bigram, null));

            Assert.Equal("List<string> 'wordList' has wrong size", ex.Message);
        }
Exemplo n.º 2
0
        public void GetSimilarNgramsFromTable_Fourgrams()
        {
            var provider = new SqlQueryProviderAlpha(_names);
            var result   = provider.GetSimilarNgramsFromTable(NgramType.Quadrigram, _wordList);

            const string str = @"SELECT * FROM four[a] WHERE Word1='a\\' AND Word2='b' AND Word3='\'c';";

            Assert.Equal(str, result);
        }
Exemplo n.º 3
0
        public void GetSimilarNgramsFromTable_Digrams()
        {
            var provider = new SqlQueryProviderAlpha(_names);
            var result   = provider.GetSimilarNgramsFromTable(NgramType.Bigram, _wordList);

            const string str = @"SELECT * FROM di[a] WHERE Word1='a\\';";

            Assert.Equal(str, result);
        }
Exemplo n.º 4
0
        public void GetSimilarNgramsFromTable_GoodListSize()
        {
            var list = new List <string>
            {
                "a",
                "b",
                "c"
            };

            var provider = new SqlQueryProviderAlpha(_names);
            var ex       = Record.Exception(() => provider.GetSimilarNgramsFromTable(NgramType.Quadrigram, list));

            Assert.IsNotType <ArgumentException>(ex);
        }
Exemplo n.º 5
0
        public void GetSimilarNgramsFromTable_WrongListSize()
        {
            var list = new List <string>
            {
                "a",
                "b"
            };

            var provider = new SqlQueryProviderAlpha(_names);

            Exception ex = Assert.Throws <ArgumentException>(() => provider.GetSimilarNgramsFromTable(NgramType.Quadrigram, list));

            Assert.Equal("List<string> 'wordList' has wrong size", ex.Message);
        }