public void HasHelpText() { Assert.DoesNotThrow(() => { var x = new HelpEvaluator("", Substitute.For <IMessageManager>()).Help; }); }
public void FewerThanOneParameterFails() { var messages = Substitute.For <IMessageManager>(); var helpEvaluator = new HelpEvaluator("", messages); Assert.Throws <Exception>(() => helpEvaluator.Execute()); }
public void WritesHelpMessage() { var messages = Substitute.For <IMessageManager>(); var helpEvaluator = new HelpEvaluator("", messages); var evaluatorWithHelpMessage = Substitute.For <IEvaluator>(); evaluatorWithHelpMessage.Help.Returns(new HelpText("", "")); evaluatorWithHelpMessage.Body.Returns(a => null); evaluatorWithHelpMessage.Next.Returns(a => null); helpEvaluator.Body = evaluatorWithHelpMessage; helpEvaluator.Execute(); messages.Received(1).AddMessage(MessageType.Information, Arg.Any <string>()); }
public void MoreThanOneParameterFails() { var messages = Substitute.For <IMessageManager>(); var helpEvaluator = new HelpEvaluator("", messages); var firstParameter = Substitute.For <IEvaluator>(); var secondParameter = Substitute.For <IEvaluator>(); firstParameter.Body.Returns(a => null); firstParameter.Next.Returns(a => secondParameter); secondParameter.Body.Returns(a => null); secondParameter.Next.Returns(a => null); helpEvaluator.Body = firstParameter; Assert.Throws <Exception>(() => helpEvaluator.Execute()); }