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)));
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            var ws = new WindowsService();            

            var command = new RootCommand(ws.Console);
            var engine = new CommandEngine(command);
            ws.Start(args);
            engine.Run(args);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var console = new ClientConsole();

            var command = new RootCommand(console);

            command.RegisterCommand(new SetCsprojFrameworkCommand());

            new CommandEngine(command).Run(args);
        }
        public void When_providing_the_exit_command_the_command_engine_should_exit()
        {
            //Arrange
            var command = new RootCommand(new ClientConsole());
            
            //Act
            new CommandEngine(command).Run(new[] { "exit" });

            //Assert
            Assert.True(true);
        }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        private static void Main(string[] args)
        {
            System.Console.Title = Constants.ServiceName + " Management Console";
            var compositeRoot = new CompositeRoot();

            var command = new RootCommand(compositeRoot.ClientConsole);

            command.RegisterCommand(new ConfigCommands(compositeRoot));
            command.RegisterCommand(new ServiceCommands(compositeRoot));
            command.RegisterCommand(new CounterCommands(compositeRoot));

           new CommandEngine(command).Run(args);
        }
Ejemplo n.º 8
0
        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();
        }
Ejemplo n.º 9
0
        private static void Main(string[] args)
        {
            System.Console.Title = Constants.ServiceName + " Management Console";

            CounterBusiness.ChangedCurrentCultureEvent += CounterBusiness_ChangedCurrentCultureEvent;
            _compositeRoot = new CompositeRoot();

            var clientConsole = _compositeRoot.ClientConsole;
            clientConsole.KeyReadEvent += ClientConsole_KeyReadEvent;
            var command = new RootCommand(clientConsole);

            command.RegisterCommand(new ConfigCommands(_compositeRoot));
            command.RegisterCommand(new ServiceCommands(_compositeRoot));
            command.RegisterCommand(new CounterCommands(_compositeRoot));
            command.RegisterCommand(new PublishCommands(_compositeRoot));
            command.RegisterCommand(new SenderCommands(_compositeRoot));

            new CommandEngine(command).Run(args);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
            }
        }