public void FormattedOutput_ShouldAddOutputOption() { // arrange StringWriter sw = new StringWriter(); DummyApiCommandWithFormattedOutputSupport command = new DummyApiCommandWithFormattedOutputSupport(ClientFactory, RepositoryFactory, FileSystem, CommandOutputProvider); // act command.GetHelp(sw, new [] { "command" }); // assert sw.ToString().Should().ContainEquivalentOf("--output"); }
public async Task FormattedOutput_FormatSetToJson() { // arrange DummyApiCommandWithFormattedOutputSupport command = new DummyApiCommandWithFormattedOutputSupport(ClientFactory, RepositoryFactory, FileSystem, CommandOutputProvider); CommandLineArgs.Add("--outputFormat=json"); // act await command.Execute(CommandLineArgs.ToArray()); // assert command.PrintJsonOutputCalled.ShouldBeEquivalentTo(true); }
public async Task FormattedOutputHelp_ShouldBeWellFormed() { // arrange DummyApiCommandWithFormattedOutputSupport command = new DummyApiCommandWithFormattedOutputSupport(ClientFactory, RepositoryFactory, FileSystem, CommandOutputProvider); CommandLineArgs.Add("--helpOutputFormat=json"); CommandLineArgs.Add("--help"); // act await command.Execute(CommandLineArgs.ToArray()); // assert var logoutput = LogOutput.ToString(); Console.WriteLine(logoutput); JsonConvert.DeserializeObject(logoutput); logoutput.Should().Contain("--helpOutputFormat=VALUE"); logoutput.Should().Contain("--help"); }