<commit_before>﻿// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.xunit;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Xunit;

namespace Microsoft.AspNetCore.Hosting.FunctionalTests
{
    public class ShutdownTests
    {
        [ConditionalFact]
        //Disabled until https://github.com/aspnet/Hosting/issues/974 resolved.
        [OSSkipCondition(OperatingSystems.Linux)]
        [OSSkipCondition(OperatingSystems.Windows)]
        [OSSkipCondition(OperatingSystems.MacOSX)]
        public void ShutdownTest()
        {
            var logger = new LoggerFactory()
                .AddConsole()
                .CreateLogger(nameof(ShutdownTest));

            var applicationPath = Path.Combine(TestProjectHelpers.GetSolutionRoot(), "test",
                "Microsoft.AspNetCore.Hosting.TestSites");

            var deploymentParameters = new DeploymentParameters(
                applicationPath,
                ServerType.Kestrel,
                RuntimeFlavor.CoreClr,
                RuntimeArchitecture.x64)
            {
                EnvironmentName = "Shutdown",
                TargetFramework = "netcoreapp1.1",
                ApplicationType = ApplicationType.Portable,
                PublishApplicationBeforeDeployment = true
            };

            using (var deployer = new SelfHostDeployer(deploymentParameters, logger))
            {
                deployer.Deploy();

                // Wait for application to start
                System.Threading.Thread.Sleep(1000);

                string output = string.Empty;
                deployer.HostProcess.OutputDataReceived += (sender, args) => output += args.Data + '\n';

                SendSIGINT(deployer.HostProcess.Id);

                WaitForExitOrKill(deployer.HostProcess);

                output = output.Trim('\n');

                Assert.Equal(output, "Application is shutting down...\n" +
                                     "Stopping firing\n" +
                                     "Stopping end\n" +
                                     "Stopped firing\n" +
                                     "Stopped end");
            }
        }<commit_msg>Update tfm in shutdown test<commit_after>﻿// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.xunit;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Xunit;

namespace Microsoft.AspNetCore.Hosting.FunctionalTests
{
    public class ShutdownTests
    {
        [ConditionalFact]
        [OSSkipCondition(OperatingSystems.Windows)]
        [OSSkipCondition(OperatingSystems.MacOSX)]
        public void ShutdownTest()
        {
            var logger = new LoggerFactory()
                .AddConsole()
                .CreateLogger(nameof(ShutdownTest));

            var applicationPath = Path.Combine(TestProjectHelpers.GetSolutionRoot(), "test",
                "Microsoft.AspNetCore.Hosting.TestSites");

            var deploymentParameters = new DeploymentParameters(
                applicationPath,
                ServerType.Kestrel,
                RuntimeFlavor.CoreClr,
                RuntimeArchitecture.x64)
            {
                EnvironmentName = "Shutdown",
                TargetFramework = "netcoreapp2.0",
                ApplicationType = ApplicationType.Portable,
                PublishApplicationBeforeDeployment = true
            };

            using (var deployer = new SelfHostDeployer(deploymentParameters, logger))
            {
                deployer.Deploy();

                // Wait for application to start
                System.Threading.Thread.Sleep(1000);

                string output = string.Empty;
                deployer.HostProcess.OutputDataReceived += (sender, args) => output += args.Data + '\n';

                SendSIGINT(deployer.HostProcess.Id);

                WaitForExitOrKill(deployer.HostProcess);

                output = output.Trim('\n');

                Assert.Equal(output, "Application is shutting down...\n" +
                                     "Stopping firing\n" +
                                     "Stopping end\n" +
                                     "Stopped firing\n" +
                                     "Stopped end");
            }
        }
{'fraction_non_alphanumeric': 0.08548790658882402, 'fraction_numerical': 0.0047956630525437865, 'mean_word_length': 1.7970845481049562, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2404647', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1133, 'n_words': 239}