예제 #1
0
        public void ProcessCommand_ScriptcsFileNotFound_ReturnsCouldntFindScriptcsFile()
        {
            // Arrange
            Mock<ITransport> transportMock = new Mock<ITransport>();
            transportMock.SetupGet(transport => transport.Trigger).Returns("@bot");
            Bot bot = new Bot(transportMock.Object, _log);
            bot.Initialize(typeof(ScriptBot.Plugins.ScriptCs.ScriptBotScriptCsCommand));

            // Act
            string results = bot.HandleCommand(@"scriptcs random.csx");

            // Assert
            Assert.IsTrue(results.Equals("Sorry couldn't find the scriptcs file random.csx.\r\n", StringComparison.OrdinalIgnoreCase));
        }
예제 #2
0
        public void ProcessCommand_Scriptcs_OutputIsReturnAsString()
        {
            // Arrange
            Mock<ITransport> transportMock = new Mock<ITransport>();
            transportMock.SetupGet(transport => transport.Trigger).Returns("@bot");
            Bot bot = new Bot(transportMock.Object, _log);
            bot.Initialize(typeof(ScriptBot.Plugins.ScriptCs.ScriptBotScriptCsCommand));

            // Act
            string results = bot.HandleCommand(@"scriptcs helloworld.csx");

            // Assert
            Assert.IsFalse(string.IsNullOrWhiteSpace(results));
        }
예제 #3
0
        public void ProcessCommand_EmptyString_ReturnsCouldntFindAnyRelatedCommands()
        {
            // Arrange

            Mock<ITransport> transportMock = new Mock<ITransport>();
            transportMock.SetupGet(transport => transport.Trigger).Returns("@bot");
            Bot bot = new Bot(transportMock.Object, _log);

            // Act
            string results = bot.HandleCommand(string.Empty);

            // Assert
            Assert.IsTrue(results.Equals("couldn't find any related commands!\r\n", StringComparison.OrdinalIgnoreCase));
        }