/// <summary> /// Asserts that the help text <paramref name="forCommand"/> matches your <paramref name="expectedHelp"/> text /// </summary> /// <param name="expectedHelp"></param> /// <param name="forCommand"></param> private void AssertHelpIs(string expectedHelp, Type forCommand) { var cmd = new ExecuteCommandDescribeCommand(GetMockActivator().Object, forCommand); Assert.IsFalse(cmd.IsImpossible, cmd.ReasonCommandImpossible); cmd.Execute(); StringAssert.Contains(expectedHelp, cmd.HelpShown); }
/// <summary> /// Asserts that the help text <paramref name="forCommand"/> matches your <paramref name="expectedHelp"/> text /// </summary> /// <param name="expectedHelp"></param> /// <param name="forCommand"></param> private void AssertHelpIs(string expectedHelp, Type forCommand) { var mock = GetMockActivator(); var cmd = new ExecuteCommandDescribeCommand(mock.Object, forCommand); Assert.IsFalse(cmd.IsImpossible, cmd.ReasonCommandImpossible); cmd.Execute(); string contents = Regex.Escape(expectedHelp); // Called once mock.Verify(m => m.Show(It.IsRegex(contents)), Times.Once()); }
public void Test_DescribeDeleteCommand() { var mock = new Mock <IBasicActivateItems>(); mock.Setup(m => m.RepositoryLocator).Returns(RepositoryLocator); mock.Setup(m => m.GetDelegates()).Returns(new List <CommandInvokerDelegate>()); mock.Setup(m => m.Show(It.IsAny <string>())); var cmd = new ExecuteCommandDescribeCommand(mock.Object, typeof(ExecuteCommandDelete)); Assert.IsFalse(cmd.IsImpossible, cmd.ReasonCommandImpossible); cmd.Execute(); string contents = Regex.Escape(@"cmd Delete <deletable> PARAMETERS: deletable IDeleteable The object you want to delete" ); // Called once mock.Verify(m => m.Show(It.IsRegex(contents)), Times.Once()); }