Exemple #1
0
        public TestActivateItems(UITests uiTests, MemoryDataExportRepository repo) : base(new RepositoryProvider(repo), new ToMemoryCheckNotifier())
        {
            _uiTests   = uiTests;
            Results    = new TestActivateItemsResults();
            RefreshBus = new RefreshBus();

            //don't load the comment store for every single test
            if (_commentStore == null)
            {
                _commentStore = new CommentStore();
                _commentStore.ReadComments(TestContext.CurrentContext.TestDirectory);
            }

            CommentStore = _commentStore;

            CoreChildProvider  = new DataExportChildProvider(RepositoryLocator, null, Results);
            CoreIconProvider   = new DataExportIconProvider(RepositoryLocator, null);
            FavouritesProvider = new FavouritesProvider(this, repo.CatalogueRepository);

            _problemProviders = new List <IProblemProvider>(new IProblemProvider[]
            {
                new CatalogueProblemProvider(),
                new DataExportProblemProvider()
            });

            PluginUserInterfaces = new List <IPluginUserInterface>();
        }
Exemple #2
0
        private void PopulateBasicCommandInfo(StringBuilder sb)
        {
            var help = new CommentStore();

            help.ReadComments(Environment.CurrentDirectory);

            // Basic info about command
            sb.AppendLine("Name: " + _commandType.Name);

            var helpText = help.GetTypeDocumentationIfExists(_commandType);

            if (helpText != null)
            {
                sb.AppendLine();
                sb.AppendLine("Description: " + helpText);
            }

            sb.AppendLine();
            sb.AppendLine("USAGE: ");

            sb.Append(EnvironmentInfo.IsLinux ? "./rdmp" : "./rdmp.exe");
            sb.Append(" cmd ");

            sb.Append(BasicCommandExecution.GetCommandName(_commandType.Name));
            sb.Append(" ");
        }
        public void Test_DocumentationReportDatabaseEntities_Normal()
        {
            var store = new CommentStore();

            store.ReadComments(TestContext.CurrentContext.TestDirectory);

            SetupMEF();

            var reporter = new DocumentationReportDatabaseEntities();

            Bitmap bmp = new Bitmap(19, 19);

            using (var g = Graphics.FromImage(bmp))
                g.DrawRectangle(new Pen(Color.DarkMagenta), 5, 5, 5, 5);

            var iconProvider = Mock.Of <IIconProvider>(m => m.GetImage(It.IsAny <object>(), It.IsAny <OverlayKind>()) == bmp);

            reporter.GenerateReport(store, new ThrowImmediatelyCheckNotifier(), iconProvider, MEF, false);
        }
        public TestActivateItems(UITests uiTests, MemoryDataExportRepository repo) : base(new RepositoryProvider(repo), new ToMemoryCheckNotifier())
        {
            _uiTests   = uiTests;
            Results    = new TestActivateItemsResults();
            RefreshBus = new RefreshBus();

            //don't load the comment store for every single test
            if (_commentStore == null)
            {
                _commentStore = new CommentStore();
                _commentStore.ReadComments(TestContext.CurrentContext.TestDirectory);
            }

            CommentStore = _commentStore;

            HistoryProvider = new HistoryProvider(RepositoryLocator);

            _problemProviders = new List <IProblemProvider>(new IProblemProvider[]
            {
                new CatalogueProblemProvider(),
                new DataExportProblemProvider()
            });
        }
Exemple #5
0
        public override void Execute()
        {
            base.Execute();

            var invoker = new CommandInvoker(BasicActivator);

            var commandCtor = invoker.GetConstructor(_commandType);

            var help = new CommentStore();

            help.ReadComments(Environment.CurrentDirectory);

            var sb = new StringBuilder();

            if (commandCtor == null || !invoker.IsSupported(commandCtor))
            {
                sb.AppendLine($"Command '{_commandType.Name}' is not supported by the current input type ({BasicActivator.GetType().Name})");
            }
            else
            {
                sb.AppendLine("COMMAND:" + _commandType.FullName);

                var helpText = help.GetTypeDocumentationIfExists(_commandType);

                if (helpText != null)
                {
                    sb.AppendLine(helpText);
                }

                sb.AppendLine("USAGE:");

                sb.Append(EnvironmentInfo.IsLinux ? "./rdmp" : "./rdmp.exe");
                sb.Append(" cmd ");

                sb.Append(BasicCommandExecution.GetCommandName(_commandType.Name));
                sb.Append(" ");

                var sbParameters = new StringBuilder();
                sbParameters.AppendLine("PARAMETERS:");

                foreach (ParameterInfo p in commandCtor.GetParameters())
                {
                    var req = new RequiredArgument(p);

                    //automatic delegates require no user input or CLI entry (e.g. IActivateItems)
                    if (invoker.GetDelegate(req).IsAuto)
                    {
                        continue;
                    }

                    sb.Append($"<{req.Name}> ");
                    sbParameters.AppendLine($"{req.Name}\t{req.Type.Name}\t{req.DemandIfAny?.Description}");
                }

                sb.AppendLine();
                sb.AppendLine(sbParameters.ToString());
            }


            BasicActivator.Show(sb.ToString());
        }