示例#1
0
文件: MainTest.cs 项目: yst726/winsw
        public void FailOnUnsupportedCommand()
        {
            const string  commandName     = "nonExistentCommand";
            string        expectedMessage = "Unknown command: " + commandName;
            CLITestResult result          = CLITestHelper.CLIErrorTest(new[] { commandName });

            Assert.That(result.HasException, Is.True);
            Assert.That(result.Out, Does.Contain(expectedMessage));
            Assert.That(result.Exception.Message, Does.Contain(expectedMessage));
        }
示例#2
0
        public void FailOnUnsupportedCommand()
        {
            const string  commandName     = "nonExistentCommand";
            string        expectedMessage = "Unknown command: " + commandName.ToLower();
            CLITestResult res             = CLITestHelper.CLIErrorTest(new[] { commandName });

            Assert.True(res.HasException, "Expected an exception due to the wrong command");
            StringAssert.Contains(expectedMessage, res.Out, "Expected the message about unknown command");
            // ReSharper disable once PossibleNullReferenceException
            StringAssert.Contains(expectedMessage, res.Exception.Message, "Expected the message about unknown command");
        }