Exemple #1
0
        public void TestTemplateLifeCycleWithNoEventHandlers()
        {
            this.OnLoadCalled   = false;
            this.OnUnloadCalled = false;
            AimlBot.Request           r = new AimlBot.Request();
            AimlBot.Generate.Template t = new AimlBot.Generate.Template();

            // lets run through the whole life cycle
            t.Init("this is a template");
            t.Load(r);
            Assert.AreEqual(false, this.OnLoadCalled);
            Assert.AreEqual(string.Empty, t.Render());
            t.Unload();
            Assert.AreEqual(false, this.OnUnloadCalled);
        }
Exemple #2
0
        public void TestTemplateLifeCycleWithEventHandlers()
        {
            this.OnLoadCalled = false;
            this.OnUnloadCalled = false;
            AimlBot.Request r = new AimlBot.Request();
            AimlBot.Generate.Template t = new AimlBot.Generate.Template();
            t.OnLoad += new EventHandler<EventArgs>(t_OnLoad);
            t.OnUnload += new EventHandler<EventArgs>(t_OnUnload);

            // lets run through the whole life cycle
            t.Init("this is a template");
            t.Load(r);
            Assert.AreEqual(true, this.OnLoadCalled);
            Assert.AreEqual(string.Empty, t.Render());
            t.Unload();
            Assert.AreEqual(true, this.OnUnloadCalled);
        }