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); } }
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); } }
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); } }