Exemplo n.º 1
0
        public void RdmpScript_NewObject_CatalogueItem(string cataCommand, string cataItemCommand, string expectedCataItemName)
        {
            foreach (var c in RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>())
            {
                c.DeleteInDatabase();
            }

            var runner = new ExecuteCommandRunner(new ExecuteCommandOptions()
            {
                Script = new RdmpScript()
                {
                    Commands = new[]
                    {
                        cataCommand,
                        cataItemCommand
                    }
                }
            });

            SetupMEF();

            var exitCode = runner.Run(RepositoryLocator, new ThrowImmediatelyDataLoadEventListener(), new ThrowImmediatelyCheckNotifier(), new GracefulCancellationToken());

            Assert.AreEqual(0, exitCode);
            Assert.AreEqual(1, RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>().Length);
            var ci = RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>().Single().CatalogueItems.Single();

            Assert.AreEqual(expectedCataItemName, ci.Name);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Runs the provided string which should start after the cmd e.g. the bit after rdmp cmd
        /// </summary>
        /// <param name="command">1 string per piece following rdmp cmd.  Element 0 should be the Type of command to run</param>
        /// <returns></returns>
        protected int Run(params string[] command)
        {
            var opts = new ExecuteCommandOptions();

            opts.CommandName = command[0];
            opts.CommandArgs = command.Skip(1).ToArray();

            var runner = new ExecuteCommandRunner(opts);

            return(runner.Run(RepositoryLocator, new ThrowImmediatelyDataLoadEventListener(),
                              new ThrowImmediatelyCheckNotifier(), new GracefulCancellationToken()));
        }