public void Setup() { Syntax = new CommandSyntax(); Parser = new CommandParser(Syntax); Validator = new CommandValidator(Parser, new MockLocalizer()); MockMethods = new MockCommand(); Generator = new CandidatesGenerator(Syntax); Switch = new ArgumentRule("switch", MockMethods.Switch); Click = new ArgumentRule("click", MockMethods.Click); RightClick = new ArgumentRule("rightclick", MockMethods.RightClick); DoubleClick = new ArgumentRule("doubleclick", MockMethods.DoubleClick); ArgApplication = new ArgumentRule("application", MockMethods.Application, ArgsFactory(Switch)); ArgWindow = new ArgumentRule("window", MockMethods.Window, ArgsFactory(Click, RightClick, DoubleClick)); ArgTaskbar = new ArgumentRule("taskbar", MockMethods.Taskbar, ArgsFactory(Click, RightClick)); ArgDividedscreen = new ArgumentRule("windowdividedscreen", MockMethods.WindowDividedScreen, ArgsFactory(Click, DoubleClick)); ArgText = new ArgumentRule("Text", MockMethods.Text); ArgCommand = new ArgumentRule("Command", MockMethods.Command); ArgInItemsControl = new ArgumentRule("TextInItemsControl", MockMethods.TextInItemsControl); OptButton = new ArgumentRule("Button", MockMethods.Button); OptCheckBox = new ArgumentRule("CheckBox", MockMethods.CheckBox); OptGenerator = new ArgumentRule("-hintGenerator", MockMethods.HintGenerator); OptTarget = new ArgumentRule("-searchTarget", MockMethods.SearchTarget, null, ArgsFactory(OptButton, OptCheckBox)); Hah = new CommandRule("hah", MockMethods.HitaHint, ArgsFactory(ArgWindow, ArgApplication, ArgTaskbar, ArgDividedscreen), ArgsFactory(OptGenerator, OptTarget)); SearchByText = new CommandRule("/", MockMethods.SearchByText, ArgsFactory(ArgText, ArgCommand, ArgInItemsControl), ArgsFactory(OptTarget)); Hah2 = new CommandRule("hah2", MockMethods.HitaHint2, ArgsFactory(ArgWindow, ArgDividedscreen)); MouseEmulation = new CommandRule("me", MockMethods.MouseEmulation); Syntax.Add(Hah); Syntax.Add(SearchByText); Syntax.Add(Hah2); Syntax.Add(MouseEmulation); }
public static void Add(ICommandRule rule) { _syntax.Add(rule); }