public void CloneTest() { WelcomeBotConfig uut1 = new WelcomeBotConfig(); WelcomeBotConfig clone = uut1.Clone(); TestHelpers.CloneTest(uut1, clone); }
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 EqualsTest() { WelcomeBotConfig uut1 = new WelcomeBotConfig(); WelcomeBotConfig uut2 = new WelcomeBotConfig(); TestHelpers.EqualsTest(uut1, uut2); Assert.IsFalse(uut1.Equals(1)); // Start changing things. uut1.EnableJoinMessages = (uut2.EnableJoinMessages == false); TestHelpers.NotEqualsTest(uut1, uut2); uut1 = new WelcomeBotConfig(); uut1.EnableKickMessages = (uut2.EnableKickMessages == false); TestHelpers.NotEqualsTest(uut1, uut2); uut1 = new WelcomeBotConfig(); uut1.EnablePartMessages = (uut2.EnablePartMessages == false); TestHelpers.NotEqualsTest(uut1, uut2); uut1 = new WelcomeBotConfig(); uut1.KarmaBotIntegration = (uut2.KarmaBotIntegration == false); TestHelpers.NotEqualsTest(uut1, uut2); uut1 = new WelcomeBotConfig(); }
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 BadRootTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig(); string xmlFile = Path.Combine(this.testFileDir, "BadRoot.xml"); Assert.Throws <XmlException>(() => XmlLoader.LoadConfig(xmlFile)); }
public void EmptyXmlTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig(); string xmlFile = Path.Combine(this.testFileDir, "EmptyConfig.xml"); WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile); Assert.AreEqual(expectedConfig, actualConfig); }
public void DefaultConfigTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig(); string xmlFile = Path.Combine(this.sampleConfigDir, "SampleWelcomeBotConfig.xml"); WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile); Assert.AreEqual(expectedConfig, actualConfig); }
public void DefaultSettingsTest() { WelcomeBotConfig uut = new WelcomeBotConfig(); Assert.IsTrue(uut.EnableJoinMessages); Assert.IsTrue(uut.EnableKickMessages); Assert.IsTrue(uut.EnablePartMessages); // Anything that depends on other plugins is disabled by default. Assert.IsFalse(uut.KarmaBotIntegration); }
public void GoodConfigTest() { WelcomeBotConfig expectedConfig = new WelcomeBotConfig { EnableJoinMessages = false, EnableKickMessages = false, EnablePartMessages = false, KarmaBotIntegration = true }; string xmlFile = Path.Combine(this.testFileDir, "GoodConfig.xml"); WelcomeBotConfig actualConfig = XmlLoader.LoadConfig(xmlFile); Assert.AreEqual(expectedConfig, actualConfig); }
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); } }