コード例 #1
0
        public async Task ListPoolFromFakeHandlerReturnTheGoodUuid()
        {
            FakeHTTP.ReturnMessage = HttpPoolObject.PoolsListBodiesWithPaging;

            var commandLauncher = new CommandGeneric <QPool, CommandValues.PoolCommandValue>(
                new QPoolsRetriever(),
                new GenericCollectionCommand <QPool, CommandValues.PoolCommandValue>(new PoolModelMapper()),
                FormatTable,
                FakeApi);

            string returnString = await commandLauncher.RunAndPrintCommandAsync(
                new DefaultRunConfiguration(ConfigType.Pool, CommandApi.List) { Tags = new List <string>()
                                                                                {
                                                                                    "hello", "world"
                                                                                } },
                FalsePrinter);

            string expected1 = "796a5321-0001-4a5c-2f42-54cce169dff8";
            string expected2 = "Pool Name Test List1";
            string expected3 = "Pool Name Test List3";

            StringAssert.Contains(expected1, returnString);
            StringAssert.Contains(expected2, returnString);
            StringAssert.Contains(expected3, returnString);
        }
コード例 #2
0
        public async Task AbortTaskFromFakeHandlerReturnTheGoodUuid()
        {
            FakeHTTP.ReturnMessage = HttpTaskObject.ActiveTasksListBodies;

            var commandLauncher = new CommandGeneric <QTask, CommandValues.GenericInfoCommandValue>(
                new QTasksRetriever(),
                new AbortTaskCommand(),
                FormatTable,
                FakeApi);

            string returnString = await commandLauncher.RunAndPrintCommandAsync(
                new DefaultRunConfiguration(ConfigType.Task, CommandApi.Abort),
                FalsePrinter);

            string expected1 = "f78fdff8-7081-46e1-bb2f-d9cd4e185ece";
            string expected2 = "Task abort";

            StringAssert.Contains(expected1, returnString);
            StringAssert.Contains(expected2, returnString);
        }
コード例 #3
0
ファイル: TestCommandJob.cs プロジェクト: qarnot/qarnot-cli
        public async Task ListJobFromFakeHandlerReturnTheGoodUuid()
        {
            FakeHTTP.ReturnMessage = HttpJobObject.ActiveJobsListBodies;

            var commandLauncher = new CommandGeneric <QJob, CommandValues.JobCommandValue>(
                new QJobsRetriever(),
                new GenericCollectionCommand <QJob, CommandValues.JobCommandValue>(new JobModelMapper()),
                FormatTable,
                FakeApi);

            string returnString = await commandLauncher.RunAndPrintCommandAsync(
                new DefaultRunConfiguration(ConfigType.Job, CommandApi.List) { Name = "name" },
                FalsePrinter);

            string expected1 = "f78fdff8-7081-46e1-bb2f-d9cd4e185ece";
            string expected2 = "job_name";

            StringAssert.Contains(expected1, returnString);
            StringAssert.Contains(expected2, returnString);
        }
コード例 #4
0
        public async Task UpdatePoolConstantFromFakeHandlerReturnTheGoodUuid()
        {
            FakeHTTP.ReturnMessage = HttpPoolObject.PoolsListBodiesWithPaging;
            ConfigType type    = ConfigType.Pool;
            CommandApi command = CommandApi.UpdateConstant;

            var commandLauncher = new CommandGeneric <QPool, CommandValues.GenericInfoCommandValue>(
                new QPoolsRetriever(),
                new UpdatePoolConstantCommand(),
                FormatTable,
                FakeApi
                );

            string returnString = await commandLauncher.RunAndPrintCommandAsync(
                new ConstantUpdateConfiguration(type, command) { ConstantName = "SOME_CONSTANT", ConstantValue = "some-new-value" },
                FalsePrinter);

            string expected1 = "796a5321-0001-4a5c-2f42-54cce169dff8";

            StringAssert.Contains(expected1, returnString);
        }
コード例 #5
0
ファイル: TestCommandTask.cs プロジェクト: qarnot/qarnot-cli
        public async Task UpdateTaskConstantFromFakeHandlerReturnTheGoodUuid()
        {
            FakeHTTP.ReturnMessage = HttpTaskObject.TasksListBodiesWithPaging;
            ConfigType type    = ConfigType.Task;
            CommandApi command = CommandApi.UpdateConstant;

            var commandLauncher = new CommandGeneric <QTask, CommandValues.GenericInfoCommandValue>(
                new QTasksRetriever(),
                new UpdateTaskConstantCommand(),
                FormatTable,
                FakeApi
                );

            string returnString = await commandLauncher.RunAndPrintCommandAsync(
                new ConstantUpdateConfiguration(type, command) { ConstantName = "SOME_CONSTANT", ConstantValue = "some-new-value" },
                FalsePrinter);

            string expected1 = "f78fdff8-7081-46e1-bb2f-d9cd4e185ece";

            StringAssert.Contains(expected1, returnString);
        }
コード例 #6
0
        public async Task ListTaskFromFakeHandlerReturnTheGoodUuid()
        {
            FakeHTTP.ReturnMessage = HttpTaskObject.TasksListBodiesWithPaging;

            var commandLauncher = new CommandGeneric <QTask, CommandValues.TaskCommandValue>(
                new QTasksRetriever(),
                new GenericCollectionCommand <QTask, CommandValues.TaskCommandValue>(new TaskModelMapper()),
                FormatTable,
                FakeApi);

            string returnString = await commandLauncher.RunAndPrintCommandAsync(
                new DefaultRunConfiguration(ConfigType.Task, CommandApi.List),
                FalsePrinter);

            string expected1 = "f78fdff8-7081-46e1-bb2f-d9cd4e185ece";
            string expected2 = "task_name1";
            string expected3 = "task_name2";

            StringAssert.Contains(expected1, returnString);
            StringAssert.Contains(expected2, returnString);
            StringAssert.Contains(expected3, returnString);
        }
コード例 #7
0
        public void Can_create_command_generic()
        {
            var context = Substitute.For <ITransactionContext <xts_entity> >();

            var reference = new xts_entity {
                Id = Guid.NewGuid()
            };
            var txReference = new TransactionContextEntity <xts_entity>(reference);

            context.Current.Returns(txReference);
            Assert.Same(reference, context.Current.Entity);

            var input = new xts_entity {
                Id = reference.Id
            };
            var txInput = new TransactionContextEntity <xts_entity>(input);

            context.Target.Returns(txInput);

            var command = new CommandGeneric(context);

            Assert.NotNull(command.PublicWrapper);
            Assert.Same(reference, command.PublicWrapper.Entity);
        }
コード例 #8
0
 public EntitiesSelectionControl()
 {
     InitializeComponent();
     SelectEntitiesCommand   = new CommandGeneric <ObservableCollection <EntityModel> >(SelectEntities);
     UnselectEntitiesCommand = new CommandGeneric <ObservableCollection <EntityModel> >(UnselectEntities);
 }