Пример #1
0
        public void testResultHandlers()
        {
            XmlNode testNode   = StaticHelpers.getNode("<input/>");
            Result  mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest);

            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("", this.mockBotTagHandler.Transform());
            this.mockRequest = new Request("Sentence 1. Sentence 2", this.mockUser, this.mockBot);
            mockResult.InputSentences.Add("Result 1");
            mockResult.InputSentences.Add("Result 2");
            this.mockUser.addResult(mockResult);
            Result mockResult2 = new Result(this.mockUser, this.mockBot, this.mockRequest);

            mockResult2.InputSentences.Add("Result 3");
            mockResult2.InputSentences.Add("Result 4");
            this.mockUser.addResult(mockResult2);

            Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"1\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"2,1\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 1", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"1,2\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 4", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"2,2\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 2", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"1,3\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"3\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("", this.mockBotTagHandler.Transform());
        }
Пример #2
0
        public void testResultHandlers()
        {
            XmlNode testNode = StaticHelpers.getNode("<input/>");
            Result mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest);
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("", this.mockBotTagHandler.Transform());
            this.mockRequest = new Request("Sentence 1. Sentence 2", this.mockUser, this.mockBot);
            mockResult.InputSentences.Add("Result 1");
            mockResult.InputSentences.Add("Result 2");
            this.mockUser.addResult(mockResult);
            Result mockResult2 = new Result(this.mockUser, this.mockBot, this.mockRequest);
            mockResult2.InputSentences.Add("Result 3");
            mockResult2.InputSentences.Add("Result 4");
            this.mockUser.addResult(mockResult2);

            Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"1\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"2,1\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 1", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"1,2\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 4", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"2,2\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("Result 2", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"1,3\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("", this.mockBotTagHandler.Transform());

            testNode = StaticHelpers.getNode("<input index=\"3\"/>");
            this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode);
            Assert.AreEqual("", this.mockBotTagHandler.Transform());
        }