Esempio n. 1
0
        public void KarmaBotIntegrationAndJoinEnabledTest()
        {
            WelcomeBotConfig config = new WelcomeBotConfig
            {
                EnableJoinMessages  = true,
                EnableKickMessages  = false,
                EnablePartMessages  = false,
                KarmaBotIntegration = true
            };

            this.mockEventCreator.Setup(
                m => m.CreatePluginEventHandler("karmabot", It.IsAny <Action <ChaskisEventHandlerLineActionArgs> >())
                ).Returns(
                delegate(string pluginName, Action <ChaskisEventHandlerLineActionArgs> action)
            {
                return(new ChaskisEventHandler(ChaskisEventProtocol.IRC, pluginName, action));
            }
                );

            using (Chaskis.Plugins.WelcomeBot.WelcomeBot uut = new Chaskis.Plugins.WelcomeBot.WelcomeBot())
            {
                uut.Init(this.initor, config);

                Assert.AreEqual(2, uut.GetHandlers().Count);

                // In reality, we don't care about order, but this is easier to test.
                Assert.IsTrue(uut.GetHandlers()[0] is JoinHandler);
                Assert.IsTrue(uut.GetHandlers()[1] is ChaskisEventHandler);
            }
        }
Esempio n. 2
0
        public void AllEnabledTest()
        {
            WelcomeBotConfig config = new WelcomeBotConfig
            {
                EnableJoinMessages  = true,
                EnableKickMessages  = true,
                EnablePartMessages  = true,
                KarmaBotIntegration = true
            };

            this.mockEventCreator.Setup(
                m => m.CreatePluginEventHandler("karmabot", It.IsAny <Action <ChaskisEventHandlerLineActionArgs> >())
                ).Returns(
                delegate(string pluginName, Action <ChaskisEventHandlerLineActionArgs> action)
            {
                return(new ChaskisEventHandler(ChaskisEventProtocol.IRC, pluginName, action));
            }
                );

            using (Chaskis.Plugins.WelcomeBot.WelcomeBot uut = new Chaskis.Plugins.WelcomeBot.WelcomeBot())
            {
                uut.Init(this.initor, config);

                Assert.AreEqual(4, uut.GetHandlers().Count);
            }
        }
Esempio n. 3
0
        public void JustKarmaBotIntegrationEnabledTest()
        {
            WelcomeBotConfig config = new WelcomeBotConfig
            {
                EnableJoinMessages  = false,
                EnableKickMessages  = false,
                EnablePartMessages  = false,
                KarmaBotIntegration = true
            };

            using (Chaskis.Plugins.WelcomeBot.WelcomeBot uut = new Chaskis.Plugins.WelcomeBot.WelcomeBot())
            {
                uut.Init(this.initor, config);

                Assert.AreEqual(0, uut.GetHandlers().Count);
            }
        }