private InputModel build(params string[] tokens) { var queue = new Queue <string>(tokens); var graph = new UsageGraph("fubu", typeof(InputCommand)); return((InputModel)graph.BuildInput(queue)); }
public void derive_a_single_usage_for_any_command_that_has_no_specific_usages() { var graph = new UsageGraph(typeof(SimpleCommand)); var usage = graph.Usages.Single(); usage.Description.ShouldBe(typeof(SimpleCommand).GetAttribute <DescriptionAttribute>().Description); usage.Arguments.Select(x => x.MemberName).ShouldHaveTheSameElementsAs("Arg1", "Arg2"); }
public void RefreshUsages() { // TODO -- show progress var usageGraph = new UsageGraph(_context.Library, new ConsoleUsageGraphListener()); usageGraph.Rebuild(_suite.GetAllTests()); _view.ShowFixtureUsage(usageGraph.AllFixtures()); }
private CommandRun buildRun(Queue <string> queue, string commandName) { var usages = new UsageGraph(_commandTypes[commandName]); try { var input = usages.BuildInput(queue, _commandCreator); BeforeBuild?.Invoke(commandName, input); var command = Build(commandName); var run = new CommandRun { Command = command, Input = input }; ConfigureRun(run); return(run); } catch (InvalidUsageException e) { ConsoleWriter.Write(ConsoleColor.Red, "Invalid usage"); if (e.Message.IsNotEmpty()) { ConsoleWriter.Write(ConsoleColor.Yellow, e.Message); } Console.WriteLine(); } catch (Exception e) { ConsoleWriter.Write(ConsoleColor.Red, "Error parsing input"); ConsoleWriter.Write(ConsoleColor.Yellow, e.ToString()); Console.WriteLine(); } return(HelpRun(commandName)); }
public void all_commands_usage_graph_works() { var factory = new CommandFactory(); factory.RegisterCommands(typeof(IFubuCommand).Assembly); factory.AllCommandTypes().Each(t => { try { var usageGraph = new UsageGraph(t); usageGraph.WriteUsages("fubu"); usageGraph.Usages.Any().ShouldBeTrue(); } catch (Exception e) { throw new ApplicationException("Command type: " + t.FullName, e); } }); }
protected OaktonAsyncCommand() { Usages = new UsageGraph(GetType()); }
public void SetUp() { theUsageGraph = new UsageGraph("fubu", typeof(FakeLinkCommand)); }
public void SetUp() { theUsageGraph = new UsageGraph("derp", typeof(ComplexCommand)); }
public void SetUp() { theUsageGraph = new FakeLinkCommand().Usages; }
public void SetUp() { runner = new ProjectTestRunner(DataMother.THE_GRAMMAR_FILE); usages = new UsageGraph(runner.GetLibary(), new ConsoleUsageGraphListener()); usages.Rebuild(runner.Hierarchy); }