Exemple #1
0
        public void ToCNLStatementListTest(bool includeImplicit)
        {
            var cnlSentences = new List <string>()
            {
                "Every location-form is a form.",
                "Every data-location-form is a location-form.",
                "Data-Location-Form is a data-location-form.",
                "If a form is a data-location-form then the form is-a-form-of-type Special-Form."
            };

            var feClient = new CogniPySvr();

            feClient.LoadCnlFromString(string.Join("\r\n", cnlSentences.Union <string>(new List <string>()
            {
                "Comment: This comment should not be returned."
            })), true, true);



            var sentencesReturned = feClient.ToCNLStatementList(includeImplicit);

            Assert.AreEqual(sentencesReturned.Count, sentencesReturned.Distinct().ToList().Count, "There are duplicate senetences!");

            if (includeImplicit)
            {
                Assert.AreEqual(13, sentencesReturned.Count);
            }
            else
            {
                CollectionAssert.AreEquivalent(cnlSentences, sentencesReturned.Select(s => s.CnlStatement));
            }
        }
        public void ToCnlStatementList()
        {
            var cnlSentences = new List <string>()
            {
                "John is a man.",
                "Every man is a human-being."
            };
            var feClient = new CogniPySvr();

            feClient.LoadCnlFromString(string.Join("\r\n", cnlSentences), true, false);
            var cnlOut = feClient.ToCNLStatementList(true);

            Assert.AreEqual(cnlSentences.Count(), cnlOut.Count());
            for (int i = 0; i < cnlOut.Count(); i++)
            {
                Assert.AreEqual(cnlOut[i].CnlStatement, cnlSentences[i]);
                if (i == 0)
                {
                    CheckStatementCount(cnlOut[i], 1, 1, 0, 0);
                }
                else if (i == 1)
                {
                    CheckStatementCount(cnlOut[i], 2, 0, 0, 0);
                }
            }
        }