public void ISuggestionSource_SetWithoutNanme_CheckNameIsGuidToStringValue()
 {
     var name = "SomeName";
     this.sut = new SQLDatabaseSuggester(TestDBConnectionString, name);
     Assert.That(this.sut.Guid.ToString(), Is.Not.EqualTo(this.sut.Name));
     Assert.That(name, Is.EqualTo(this.sut.Name));
 }
        public void SqlSuggester_GetOneSynonyms_CheckThatThereAreNoLinksToTheSameWord()
        {
            this.sut = new SQLDatabaseSuggester(TestDBConnectionString);
            var woman_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            woman_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("girl");
            var many_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            many_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("park");
            var result = this.sut.GetSuggestions(woman_MoquedISemanticObject.Object, many_MoquedISemanticObject.Object);

            foreach (var nextItem in result)
            {
                Assert.That(nextItem.Value, Is.Not.EqualTo("girl"));
                Assert.That(nextItem.Value, Is.Not.EqualTo("park"));
            }
        }
        public void SqlSuggester_GetOneSynonyms_CheckValue()
        {
            // Test database is small and contains only synonyms for woman, many, people
            this.sut = new SQLDatabaseSuggester(TestDBConnectionString);
            var woman_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            woman_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("girl");
            var result = this.sut.GetSuggestions(woman_MoquedISemanticObject.Object);

            // Expected result, top 3 results
            // female  8427
            // beauty  6932
            // person  6060
            Assert.True(result.Length >= 5, "There should be at least 5 suggestions returned");
            Assert.That(result[0].Value.GetLiteralValue().ToLower(), Is.EqualTo("female"));
        }
 public void SqlSuggester_SetOutofScopeDBLimit_expectException()
 {
     this.sut = new SQLDatabaseSuggester(TestDBConnectionString);
     this.sut.SetDatasetLimit(0);
 }
 public void ISuggestionSource_SetNameAndGuid_CheckThatNameAndGuidEqual()
 {
     this.sut = new SQLDatabaseSuggester(TestDBConnectionString); // With no name passed
     Assert.That(this.sut.Guid.ToString(), Is.EqualTo(this.sut.Name));
 }
        public void SQLSuggester_inintialiseWithWRONGConnectionString_ExpectException()
        {
            this.sut = new SQLDatabaseSuggester(WRONGDBConnectionString);

            var woman_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            woman_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("woman");

            // do something
            this.sut.GetSuggestions(woman_MoquedISemanticObject.Object);
        }
 public void SQLSuggester_inintialiseWithEMPTYConnectionString_ExpectException()
 {
     this.sut = new SQLDatabaseSuggester(string.Empty);
 }
        public void SQLSuggester_inintialiseConnectionString_Pass()
        {
            this.sut = new SQLDatabaseSuggester(TestDBConnectionString);

            var woman_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            woman_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("woman");

            // do something
            var result = this.sut.GetSuggestions(woman_MoquedISemanticObject.Object);
        }
 public void SqlSuggester_GetSuggestions_checkThatSourceNameAndGuid()
 {
     this.sut = new SQLDatabaseSuggester(TestDBConnectionString);
     var woman_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
     woman_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("girl");
     var result = this.sut.GetSuggestions(woman_MoquedISemanticObject.Object);
     Assert.That(result[0].SourceGuid, Is.EqualTo(this.sut.Guid));
     Assert.That(result[0].SourceName, Is.EqualTo(this.sut.Name));
 }
        public void SqlSuggester_GetSeveralKeywordsSynonyms_CheckValue()
        {
            // Test database is small and contains only synonyms for woman, many, people
            this.sut = new SQLDatabaseSuggester(TestDBConnectionString);
            var woman_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            woman_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("girl");
            var many_MoquedISemanticObject = this.kernel.GetMock<ISemanticObject>();
            many_MoquedISemanticObject.Setup(s => s.GetLiteralValue()).Returns("park");
            var result = this.sut.GetSuggestions(woman_MoquedISemanticObject.Object, many_MoquedISemanticObject.Object);

            // Expected result, top 5 results
            // architecture	165
            // outdoor 84
            Assert.True(result.Length >= 5, "There should be at least 5 suggestions returned");
            Assert.That(result[0].Value.GetLiteralValue().ToLower(), Is.EqualTo("architecture"));
            Assert.That(result[1].Value.GetLiteralValue().ToLower(), Is.EqualTo("outdoor"));
        }