public void testResultHandlers() { XmlNode testNode = getNode("<that/>"); var mockQuery = new AIMLbot.Utils.SubQuery("This is a test <that> * <topic> *"); mockQuery.InputStar.Insert(0, "first star"); mockQuery.InputStar.Insert(0, "second star"); var mockRequest = new Request("Sentence 1. Sentence 2", this.mockUser, this.mockBot); var mockResult = new Result(this.mockUser, this.mockBot, mockRequest); var mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("", mockBotTagHandler.Transform()); mockResult.OutputSentences.Add("Result 1"); mockResult.OutputSentences.Add("Result 2"); this.mockUser.addResult(mockResult); Result mockResult2 = new Result(this.mockUser, this.mockBot, mockRequest); mockResult2.OutputSentences.Add("Result 3"); mockResult2.OutputSentences.Add("Result 4"); this.mockUser.addResult(mockResult2); Assert.Equal("Result 3", mockBotTagHandler.Transform()); testNode = getNode("<that index=\"1\"/>"); mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("Result 3", mockBotTagHandler.Transform()); testNode = getNode("<that index=\"2,1\"/>"); mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("Result 1", mockBotTagHandler.Transform()); testNode = getNode("<that index=\"1,2\"/>"); mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("Result 4", mockBotTagHandler.Transform()); testNode = getNode("<that index=\"2,2\"/>"); mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("Result 2", mockBotTagHandler.Transform()); testNode = getNode("<that index=\"1,3\"/>"); mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("", mockBotTagHandler.Transform()); testNode = getNode("<that index=\"3\"/>"); mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, mockQuery, mockRequest, mockResult, testNode); Assert.Equal("", mockBotTagHandler.Transform()); }
public void testResultHandlers() { XmlNode testNode = StaticHelpers.getNode("<that/>"); Result mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(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.OutputSentences.Add("Result 1"); mockResult.OutputSentences.Add("Result 2"); this.mockUser.addResult(mockResult); Result mockResult2 = new Result(this.mockUser, this.mockBot, this.mockRequest); mockResult2.OutputSentences.Add("Result 3"); mockResult2.OutputSentences.Add("Result 4"); this.mockUser.addResult(mockResult2); Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"1\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"2,1\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 1", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"1,2\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 4", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"2,2\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 2", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"1,3\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"3\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); }
public void testResultHandlers() { XmlNode testNode = StaticHelpers.getNode("<that/>"); Result mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(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.OutputSentences.Add("Result 1"); mockResult.OutputSentences.Add("Result 2"); this.mockUser.addResult(mockResult); Result mockResult2 = new Result(this.mockUser, this.mockBot, this.mockRequest); mockResult2.OutputSentences.Add("Result 3"); mockResult2.OutputSentences.Add("Result 4"); this.mockUser.addResult(mockResult2); Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"1\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"2,1\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 1", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"1,2\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 4", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"2,2\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 2", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"1,3\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<that index=\"3\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.that(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); }