Esempio n. 1
0
        public void SelfhostWeb_Designtime(string sampleName, string framework, string command, int port)
        {
            var logger = _loggerFactory.CreateLogger(this.GetType(), sampleName, command, nameof(SelfhostWeb_Designtime), framework);

            using (logger.BeginScope("Root"))
            {
                var samplePath = PathHelper.GetTestAppFolder(sampleName);

                Assert.NotNull(samplePath);

                var restoreResult = DnuHelper.RestorePackage(samplePath, framework, quiet: true);
                Assert.True(restoreResult, "Failed to restore packages");

                var prepare = EnvironmentHelper.Prepare();
                Assert.True(prepare, "Failed to prepare the environment");

                var testAppStartInfo = DnxHelper.BuildStartInfo(samplePath, framework: framework, command: command);
                var runner           = new WebApplicationFirstRequest(
                    new StartupRunnerOptions {
                    ProcessStartInfo = testAppStartInfo, Logger = logger, IterationCount = _iterationCount
                },
                    port: port, path: "/", timeout: TimeSpan.FromSeconds(60));

                var errors = new List <string>();
                var result = runner.Run();

                Assert.True(result, "Fail:\t" + string.Join("\n\t", errors));
            }
        }
Esempio n. 2
0
        public void Console_DesignTime(string sampleName, string framework)
        {
            var logger = _loggerFactory.CreateLogger(GetType(), "run", sampleName, nameof(Console_DesignTime), framework);

            using (logger.BeginScope("Root"))
            {
                var samplePath = PathHelper.GetTestAppFolder(sampleName);

                logger.LogInformation("Probe application under " + samplePath);
                Assert.NotNull(samplePath);

                var restoreResult = DnuHelper.RestorePackage(samplePath, framework, quiet: true);
                Assert.True(restoreResult, "Failed to restore packages");

                var prepare = EnvironmentHelper.Prepare();
                Assert.True(prepare, "Failed to prepare the environment");

                var options = new StartupRunnerOptions
                {
                    ProcessStartInfo = DnxHelper.BuildStartInfo(samplePath, framework: framework),
                    Logger           = logger,
                    IterationCount   = _iterationCount
                };
                var runner = new ConsoleAppStartup(options);

                var errors = new List <string>();
                var result = runner.Run();

                Assert.True(result, "Fail:\t" + string.Join("\n\t", errors));
            }
        }