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