public void When_registering_two_commands_with_the_same_name() { //Arrange var console = new ClientConsole(); var command = new RootCommand(console); var cmd1 = new Mock<ICommand>(MockBehavior.Strict); cmd1.Setup(x => x.Name).Returns("A"); cmd1.Setup(x => x.Names).Returns(new string[]{}); cmd1.Setup(x => x.CommandRegistered(console)); var cmd2 = new Mock<ICommand>(MockBehavior.Strict); cmd2.Setup(x => x.Name).Returns("A"); cmd2.Setup(x => x.Names).Returns(new[] { "A" }); cmd2.Setup(x => x.CommandRegistered(console)); command.RegisterCommand(cmd1.Object); Exception exceptionThrown = null; //Act try { command.RegisterCommand(cmd2.Object); } catch (Exception exception) { exceptionThrown = exception; } //Assert Assert.That(exceptionThrown, Is.Not.Null); Assert.That(exceptionThrown.GetType(), Is.EqualTo(typeof(CommandAlreadyRegisteredException))); }
static void Main(string[] args) { var console = new ClientConsole(); var command = new RootCommand(console); command.RegisterCommand(new SetCsprojFrameworkCommand()); new CommandEngine(command).Run(args); }
public static void Main(string[] args) { //LoadedAssembly(); if (args.Length == 0) SwitchDomainForRazorEngine(); var console = new ClientConsole(); var command = new RootCommand(console); var razorcmd=new RazorCommand(); command.RegisterCommand(razorcmd); command.RegisterCommand(new TestCaseCommand(razorcmd)); var commandEngine = new CommandEngine(command); commandEngine.Run(args); }
public CompositeRoot() { ClientConsole = new ClientConsole(); InfluxDbAgentLoader = new InfluxDbAgentLoader(); FileLoaderAgent = new FileLoaderAgent(); ConfigBusiness = new ConfigBusiness(FileLoaderAgent); ConfigBusiness.InvalidConfigEvent += InvalidConfigEvent; CounterBusiness = new CounterBusiness(); SendBusiness = new SendBusiness(ConfigBusiness, InfluxDbAgentLoader); SendBusiness.SendBusinessEvent += SendBusinessEvent; TagLoader = new TagLoader(ConfigBusiness); }
static void Main(string[] args) { var console = new ClientConsole(); var command = new RootCommand(console); command.RegisterCommand(new ConnectCommand()); command.RegisterCommand(new CreateSubscriptionCommand()); command.RegisterCommand(new RemoveSubscriptionCommand()); new CommandEngine(command).Run(args); ConnectionHandler.Disconnect(); }
static void Main(string[] args) { var console = new ClientConsole(); //Note: Using the singleton version //var configuration = Singleton.Configuration.Instance; //var client = Singleton.Quilt4NetClient.Instance; //var sessionHandler = Singleton.Session.Instance; //var issueHandler = Singleton.Issue.Instance; //Note: Using the created instance version var configuration = new Configuration(); var client = new Quilt4NetClient(configuration); var sessionHandler = new SessionHandler(client); var issueHandler = new IssueHandler(sessionHandler); //Note: Config in code //configuration.Enabled = true; //Turn the entire quilt4Net feature on or off. //configuration.ProjectApiKey = "9XG02ZE0BR1OI75IVX446B59M13RKBR_"; //TODO: Replace with your own ProjectApiKey. //configuration.ApplicationName = "MyOverrideApplication"; //Overrides the name of the assembly //configuration.ApplicationVersion = "MyOverrideVersion"; //Overrides the version of the assembly //configuration.UseBuildTime = false; //If true, separate 'versions' for each build of the assembly will be logged, even though the version number have not changed. //configuration.Session.Environment = "Test"; //Use dev, test, production or any other verb you like to filter on. //configuration.Target.Location = "http://localhost:29660"; //Address to the target service. //configuration.Target.Timeout = new TimeSpan(0, 0, 60); console.WriteLine("Connecting to quilt4 server " + configuration.Target.Location, OutputLevel.Information); sessionHandler.SessionRegistrationStartedEvent += Session_SessionRegistrationStartedEvent; sessionHandler.SessionRegistrationCompletedEvent += SessionSessionRegistrationCompletedEvent; sessionHandler.SessionEndStartedEvent += Session_SessionEndStartedEvent; sessionHandler.SessionEndCompletedEvent += Session_SessionEndCompletedEvent; issueHandler.IssueRegistrationStartedEvent += Issue_IssueRegistrationStartedEvent; issueHandler.IssueRegistrationCompletedEvent += Issue_IssueRegistrationCompletedEvent; client.WebApiClient.AuthorizationChangedEvent += WebApiClient_AuthorizationChangedEvent; client.WebApiClient.WebApiRequestEvent += WebApiClientWebApiRequestEvent; client.WebApiClient.WebApiResponseEvent += WebApiClient_WebApiResponseEvent; _rootCommand = new RootCommand(console); _rootCommand.RegisterCommand(new UserCommands(client)); _rootCommand.RegisterCommand(new ProjectCommands(client)); _rootCommand.RegisterCommand(new InvitationCommands(client)); _rootCommand.RegisterCommand(new SessionCommands(sessionHandler)); _rootCommand.RegisterCommand(new IssueCommands(issueHandler)); _rootCommand.RegisterCommand(new SettingCommands(client)); _rootCommand.RegisterCommand(new ServiceCommands(client)); _rootCommand.RegisterCommand(new WebCommands(issueHandler, client.WebApiClient)); new CommandEngine(_rootCommand).Run(args); sessionHandler.Dispose(); }
private static void Main(string[] args) { var dataPath = @"G:\Program Files (x86)\SquareEnix\FINAL FANTASY XIV - A Realm Reborn"; if (args.Length > 0) { dataPath = args[0]; args = args.Skip(1).ToArray(); } if (string.IsNullOrWhiteSpace(dataPath)) { dataPath = SearchForDataPaths().FirstOrDefault(System.IO.Directory.Exists); } if (string.IsNullOrWhiteSpace(dataPath) || !System.IO.Directory.Exists(dataPath)) { Console.WriteLine($"Need data! The path '{dataPath}' doesn't exist."); return; } var realm = new ARealmReversed(dataPath, @"SaintCoinach.History.zip", Ex.Language.English, @"app_data.sqlite"); realm.Packs.GetPack(new IO.PackIdentifier("exd", IO.PackIdentifier.DefaultExpansion, 0)).KeepInMemory = true; Console.WriteLine("Game version: {0}", realm.GameVersion); Console.WriteLine("Definition version: {0}", realm.DefinitionVersion); if (!realm.IsCurrentVersion) { Console.Write("Update is available, perform update (Y/n)? "); var updateQuery = Console.ReadLine(); if (string.IsNullOrEmpty(updateQuery) || string.Equals("y", updateQuery, StringComparison.OrdinalIgnoreCase)) { var stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); realm.Update(true, new ConsoleProgressReporter()); stopWatch.Stop(); Console.WriteLine(stopWatch.Elapsed); } else { Console.WriteLine("Skipping update"); } } var cns = new Tharga.Toolkit.Console.Command.Base.ClientConsole(); var cmd = new RootCommand(cns); Setup(cmd, realm); (new CommandEngine(cmd)).Run(args); }
private static void Main(string[] args) { var console = new ClientConsole(); //var console = new VoiceConsole(); //var console = new ServerConsole(string.Empty); var command = new RootCommand(console); command.RegisterCommand(new SomeContainerCommand()); command.RegisterCommand(new EngineContainerCommand()); command.RegisterCommand(new MathContainerCommand()); command.RegisterCommand(new StatusCommand()); command.RegisterCommand(new ParametersCommand()); var commandEngine = new CommandEngine(command) { SplashScreen = _splashscreen }; commandEngine.Run(args); }
private static void Main(string[] args) { var console = new ClientConsole(); Effort.Provider.EffortProviderConfiguration.RegisterProvider(); var connection = DbConnectionFactory.CreateTransient(); using (var context = new SampleDb(connection, "geo")) { console.WriteLine("Welcome to EF Test Console, type help to check available commands", OutputLevel.Information, null); context.Products.AddRange(new[] { new Product {Name = "CocaCola"}, new Product {Name = "Pepsi"}, new Product {Name = "Starbucks"}, new Product {Name = "Donut"} }); context.SaveChanges(); var ct = new System.Threading.CancellationToken(); Task.Run(() => { SingletonSampleJob.Instance.RunBackgroundWork(ct); }, ct); var command = new RootCommand(console); command.RegisterCommand(new FillOrderCommand(context)); command.RegisterCommand(new EditOrder(context)); command.RegisterCommand(new QueryAuditTrail(context)); command.RegisterCommand(new QueryOrder(context)); command.RegisterCommand(new ToggleController(context)); command.RegisterCommand(new JobController(context)); var commandEngine = new CommandEngine(command); commandEngine.Run(args); } }