コード例 #1
0
        public void FindMatchFromOptionsTest()
        {
            // nlpControler.matchStrings
            mockNLPCtrl.Setup(x => x.matchStrings(It.IsAny <string>(), It.IsAny <string>())).Returns((string x, string y) => (x.Contains(y) || y.Contains(x)) && x.Length > 0 && y.Length > 0 ? 100 : 0);
            convCtrl.NlpControler = mockNLPCtrl.Object;

            //good
            Assert.AreEqual(convCtrl.FindMatchFromOptions(new string[] { "1", "2", "3" }, "3 אופציה"), "3");
            //bad
            Assert.AreEqual(convCtrl.FindMatchFromOptions(new string[] { "1", "2", "3" }, "dsds אופציה"), null);
            //sad
            Assert.AreEqual(convCtrl.FindMatchFromOptions(new string[] { "1", "2", "3" }, ""), null);
        }