예제 #1
0
        public ApexTestContext(VisualStudioHost visualStudio, ProjectTemplate projectTemplate, ILogger logger, bool noAutoRestore = false, bool addNetStandardFeeds = false)
        {
            logger.LogInformation("Creating test context");
            _pathContext = new SimpleTestPathContext();

            if (noAutoRestore)
            {
                _pathContext.Settings.DisableAutoRestore();
            }

            if (addNetStandardFeeds)
            {
                _pathContext.Settings.AddNetStandardFeeds();
            }

            _visualStudio        = visualStudio;
            _logger              = logger;
            SolutionService      = _visualStudio.Get <SolutionService>();
            NuGetApexTestService = _visualStudio.Get <NuGetApexTestService>();

            VisualStudioHostExtension.ClearWindows(_visualStudio);

            Project = CommonUtility.CreateAndInitProject(projectTemplate, _pathContext, SolutionService, logger);

            NuGetApexTestService.WaitForAutoRestore();
        }
예제 #2
0
        public ApexTestContext(VisualStudioHost visualStudio, ProjectTemplate projectTemplate, ILogger logger, bool noAutoRestore = false)
        {
            logger.LogInformation("Creating test context");
            _pathContext = new SimpleTestPathContext();

            if (noAutoRestore)
            {
                _pathContext.Settings.DisableAutoRestore();
            }

            _visualStudio        = visualStudio;
            _logger              = logger;
            SolutionService      = _visualStudio.Get <SolutionService>();
            NuGetApexTestService = _visualStudio.Get <NuGetApexTestService>();

            Project = Utils.CreateAndInitProject(projectTemplate, _pathContext, SolutionService, logger);

            NuGetApexTestService.WaitForAutoRestore();
        }
        protected NuGetConsoleTestExtension GetConsole(ProjectTestExtension project)
        {
            XunitLogger.LogInformation("GetConsole");
            VisualStudio.ClearWindows();
            NuGetApexTestService nugetTestService = GetNuGetTestService();

            XunitLogger.LogInformation("EnsurePackageManagerConsoleIsOpen");
            nugetTestService.EnsurePackageManagerConsoleIsOpen().Should().BeTrue("Console was opened");

            XunitLogger.LogInformation("GetPackageManagerConsole");
            _console = nugetTestService.GetPackageManagerConsole(project.Name);

            // This is not a magic number.
            // It is intended to eliminate unexpected hard line breaks in PMC output which might foil validation,
            // but not so large as to create memory problems.
            _console.SetConsoleWidth(consoleWidth: 1024);

            nugetTestService.WaitForAutoRestore();

            XunitLogger.LogInformation("GetConsole complete");

            return(_console);
        }