Deleting projects EmptyApp, FunctionalTests, MvcFrameworkFunctional, WebApiFunctional (#1829)

This commit is contained in:
Eddy Nakamura 2020-04-29 16:41:04 -03:00 коммит произвёл GitHub
Родитель 3efbcb012b
Коммит db10bdaf59
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
102 изменённых файлов: 0 добавлений и 4159 удалений

Просмотреть файл

@ -131,20 +131,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ApplicationInsigh
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ApplicationInsights.WorkerService.Tests", "NETCORE\test\Microsoft.ApplicationInsights.WorkerService.Tests\Microsoft.ApplicationInsights.WorkerService.Tests.csproj", "{B90EDEA5-3CC8-4282-80A0-7116905E2427}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyApp.FunctionalTests10", "NETCORE\test\EmptyApp.FunctionalTests\EmptyApp.FunctionalTests10.csproj", "{B55BED30-76D0-4E69-966B-344032B3F68D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyApp20.FunctionalTests20", "NETCORE\test\EmptyApp20.FunctionalTests\EmptyApp20.FunctionalTests20.csproj", "{8C764C9F-1078-47AF-87B8-AF62C7CD6447}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTestUtils", "NETCORE\test\FunctionalTestUtils\FunctionalTestUtils.csproj", "{28A848A7-AD54-46EA-9A37-10683591F963}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTestUtils20", "NETCORE\test\FunctionalTestUtils20\FunctionalTestUtils20.csproj", "{CF1818F5-CB8E-41A2-B3A8-344A80B79CEC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVCFramework.FunctionalTests10", "NETCORE\test\MVCFramework.FunctionalTests\MVCFramework.FunctionalTests10.csproj", "{B599F093-17ED-49A7-A3C0-1419CEE2480B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVCFramework20.FunctionalTests20", "NETCORE\test\MVCFramework20.FunctionalTests\MVCFramework20.FunctionalTests20.csproj", "{BCF933FA-3E6A-41C2-874A-E25195D6D0E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi.FunctionalTests10", "NETCORE\test\WebApi.FunctionalTests\WebApi.FunctionalTests10.csproj", "{12660582-2FB1-4849-85CB-1C42FA0E2C7C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi20.FunctionalTests20", "NETCORE\test\WebApi20.FunctionalTests\WebApi20.FunctionalTests20.csproj", "{4871B8AC-FB79-4D3D-940D-80E796110359}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationInsightsTypes", "NETCORE\test\ApplicationInsightsTypes\ApplicationInsightsTypes.csproj", "{3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7}"
@ -357,34 +349,18 @@ Global
{B90EDEA5-3CC8-4282-80A0-7116905E2427}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B90EDEA5-3CC8-4282-80A0-7116905E2427}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B90EDEA5-3CC8-4282-80A0-7116905E2427}.Release|Any CPU.Build.0 = Release|Any CPU
{B55BED30-76D0-4E69-966B-344032B3F68D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B55BED30-76D0-4E69-966B-344032B3F68D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B55BED30-76D0-4E69-966B-344032B3F68D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B55BED30-76D0-4E69-966B-344032B3F68D}.Release|Any CPU.Build.0 = Release|Any CPU
{8C764C9F-1078-47AF-87B8-AF62C7CD6447}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C764C9F-1078-47AF-87B8-AF62C7CD6447}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C764C9F-1078-47AF-87B8-AF62C7CD6447}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C764C9F-1078-47AF-87B8-AF62C7CD6447}.Release|Any CPU.Build.0 = Release|Any CPU
{28A848A7-AD54-46EA-9A37-10683591F963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28A848A7-AD54-46EA-9A37-10683591F963}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28A848A7-AD54-46EA-9A37-10683591F963}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28A848A7-AD54-46EA-9A37-10683591F963}.Release|Any CPU.Build.0 = Release|Any CPU
{CF1818F5-CB8E-41A2-B3A8-344A80B79CEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF1818F5-CB8E-41A2-B3A8-344A80B79CEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF1818F5-CB8E-41A2-B3A8-344A80B79CEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF1818F5-CB8E-41A2-B3A8-344A80B79CEC}.Release|Any CPU.Build.0 = Release|Any CPU
{B599F093-17ED-49A7-A3C0-1419CEE2480B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B599F093-17ED-49A7-A3C0-1419CEE2480B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B599F093-17ED-49A7-A3C0-1419CEE2480B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B599F093-17ED-49A7-A3C0-1419CEE2480B}.Release|Any CPU.Build.0 = Release|Any CPU
{BCF933FA-3E6A-41C2-874A-E25195D6D0E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCF933FA-3E6A-41C2-874A-E25195D6D0E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCF933FA-3E6A-41C2-874A-E25195D6D0E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCF933FA-3E6A-41C2-874A-E25195D6D0E8}.Release|Any CPU.Build.0 = Release|Any CPU
{12660582-2FB1-4849-85CB-1C42FA0E2C7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12660582-2FB1-4849-85CB-1C42FA0E2C7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12660582-2FB1-4849-85CB-1C42FA0E2C7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12660582-2FB1-4849-85CB-1C42FA0E2C7C}.Release|Any CPU.Build.0 = Release|Any CPU
{4871B8AC-FB79-4D3D-940D-80E796110359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4871B8AC-FB79-4D3D-940D-80E796110359}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4871B8AC-FB79-4D3D-940D-80E796110359}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -487,13 +463,9 @@ Global
{262792BF-31A8-4FCD-BBC7-341EB29FAE96} = {D2A0AA36-57F7-436C-A7AF-7322927F1734}
{058A0843-A95F-4B0D-91DB-33B9D3FD7324} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{B90EDEA5-3CC8-4282-80A0-7116905E2427} = {D8483C3E-C386-48AD-B935-700A54FDCF31}
{B55BED30-76D0-4E69-966B-344032B3F68D} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{8C764C9F-1078-47AF-87B8-AF62C7CD6447} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{28A848A7-AD54-46EA-9A37-10683591F963} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{CF1818F5-CB8E-41A2-B3A8-344A80B79CEC} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{B599F093-17ED-49A7-A3C0-1419CEE2480B} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{BCF933FA-3E6A-41C2-874A-E25195D6D0E8} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{12660582-2FB1-4849-85CB-1C42FA0E2C7C} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{4871B8AC-FB79-4D3D-940D-80E796110359} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{3D7258E3-5DDC-45A4-A457-9AA3BCC92DE7} = {E9AEB857-E8AA-4ED6-A020-DF4D8486CEB0}
{4BAA7AF2-3C5B-4C7C-9A9C-26F561218A86} = {632FB9CE-540D-4451-9FF2-12E89C1492BD}

Просмотреть файл

@ -28,20 +28,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ApplicationInsigh
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ApplicationInsights.AspNetCore.Tests", "test\Microsoft.ApplicationInsights.AspNetCore.Tests\Microsoft.ApplicationInsights.AspNetCore.Tests.csproj", "{2766D8AF-C20B-4F3A-8260-6C2D39B7A8A0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTestUtils", "test\FunctionalTestUtils\FunctionalTestUtils.csproj", "{B7217A00-66FA-49A8-8EF3-39C07E1F7E33}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyApp.FunctionalTests10", "test\EmptyApp.FunctionalTests\EmptyApp.FunctionalTests10.csproj", "{71CE2DB2-C7AA-4454-B5F2-774BC575E321}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmptyApp20.FunctionalTests20", "test\EmptyApp20.FunctionalTests\EmptyApp20.FunctionalTests20.csproj", "{C47AFD8A-3326-4391-8115-69349C04C3DA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTestUtils20", "test\FunctionalTestUtils20\FunctionalTestUtils20.csproj", "{937AF006-898E-43FD-80A6-B20D7E3A1944}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVCFramework.FunctionalTests10", "test\MVCFramework.FunctionalTests\MVCFramework.FunctionalTests10.csproj", "{1D5825CC-2EC9-43A1-BE32-778EFF5EAC80}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVCFramework20.FunctionalTests20", "test\MVCFramework20.FunctionalTests\MVCFramework20.FunctionalTests20.csproj", "{51198C41-CD4A-4006-84D4-DE20A0A44363}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi.FunctionalTests10", "test\WebApi.FunctionalTests\WebApi.FunctionalTests10.csproj", "{325C4ECE-BD4A-4CF2-BC80-FBD1024B5935}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi20.FunctionalTests20", "test\WebApi20.FunctionalTests\WebApi20.FunctionalTests20.csproj", "{C3B3F515-0305-4809-A9A8-37FD80428F74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationInsightsTypes", "test\ApplicationInsightsTypes\ApplicationInsightsTypes.csproj", "{9DA7024F-216F-4FA5-9B6D-CE4216C2DD72}"
@ -84,11 +76,9 @@ Global
..\WEB\Src\PerformanceCollector\Perf.Shared\Perf.Shared.projitems*{3c157fc2-2e52-45fc-87e8-76e4fced4260}*SharedItemsImports = 5
..\LOGGING\src\CommonShared\CommonShared.projitems*{4a9ec531-f8b2-4cd1-bd6b-745f33e52e7b}*SharedItemsImports = 5
..\WEB\Src\Common\Common.projitems*{8d13f3c8-d938-44fd-a0d8-b5d1712c95db}*SharedItemsImports = 5
..\WEB\Src\DependencyCollector\Shared\DependencyCollector.Shared.projitems*{8d13f3c8-d938-44fd-a0d8-b5d1712c95db}*SharedItemsImports = 5
src\Shared\Shared.projitems*{95ec3635-22e4-4c3a-a066-f5823a0648da}*SharedItemsImports = 5
src\Shared\Shared.projitems*{aecee8dd-09ae-4dea-8690-f76a37c0534b}*SharedItemsImports = 5
..\WEB\Src\Common\Common.projitems*{af9287b2-0d23-4d85-9a3e-200a2a603278}*SharedItemsImports = 5
..\WEB\Src\WindowsServer\WindowsServer.Shared\WindowsServer.Shared.projitems*{af9287b2-0d23-4d85-9a3e-200a2a603278}*SharedItemsImports = 5
src\Shared\Shared.projitems*{d56f2979-d6bc-4ef2-bb9b-4077b3290599}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -104,14 +94,6 @@ Global
{2766D8AF-C20B-4F3A-8260-6C2D39B7A8A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2766D8AF-C20B-4F3A-8260-6C2D39B7A8A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2766D8AF-C20B-4F3A-8260-6C2D39B7A8A0}.Release|Any CPU.Build.0 = Release|Any CPU
{B7217A00-66FA-49A8-8EF3-39C07E1F7E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7217A00-66FA-49A8-8EF3-39C07E1F7E33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7217A00-66FA-49A8-8EF3-39C07E1F7E33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7217A00-66FA-49A8-8EF3-39C07E1F7E33}.Release|Any CPU.Build.0 = Release|Any CPU
{71CE2DB2-C7AA-4454-B5F2-774BC575E321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71CE2DB2-C7AA-4454-B5F2-774BC575E321}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71CE2DB2-C7AA-4454-B5F2-774BC575E321}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71CE2DB2-C7AA-4454-B5F2-774BC575E321}.Release|Any CPU.Build.0 = Release|Any CPU
{C47AFD8A-3326-4391-8115-69349C04C3DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C47AFD8A-3326-4391-8115-69349C04C3DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C47AFD8A-3326-4391-8115-69349C04C3DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -120,18 +102,10 @@ Global
{937AF006-898E-43FD-80A6-B20D7E3A1944}.Debug|Any CPU.Build.0 = Debug|Any CPU
{937AF006-898E-43FD-80A6-B20D7E3A1944}.Release|Any CPU.ActiveCfg = Release|Any CPU
{937AF006-898E-43FD-80A6-B20D7E3A1944}.Release|Any CPU.Build.0 = Release|Any CPU
{1D5825CC-2EC9-43A1-BE32-778EFF5EAC80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D5825CC-2EC9-43A1-BE32-778EFF5EAC80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D5825CC-2EC9-43A1-BE32-778EFF5EAC80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D5825CC-2EC9-43A1-BE32-778EFF5EAC80}.Release|Any CPU.Build.0 = Release|Any CPU
{51198C41-CD4A-4006-84D4-DE20A0A44363}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51198C41-CD4A-4006-84D4-DE20A0A44363}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51198C41-CD4A-4006-84D4-DE20A0A44363}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51198C41-CD4A-4006-84D4-DE20A0A44363}.Release|Any CPU.Build.0 = Release|Any CPU
{325C4ECE-BD4A-4CF2-BC80-FBD1024B5935}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{325C4ECE-BD4A-4CF2-BC80-FBD1024B5935}.Debug|Any CPU.Build.0 = Debug|Any CPU
{325C4ECE-BD4A-4CF2-BC80-FBD1024B5935}.Release|Any CPU.ActiveCfg = Release|Any CPU
{325C4ECE-BD4A-4CF2-BC80-FBD1024B5935}.Release|Any CPU.Build.0 = Release|Any CPU
{C3B3F515-0305-4809-A9A8-37FD80428F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3B3F515-0305-4809-A9A8-37FD80428F74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3B3F515-0305-4809-A9A8-37FD80428F74}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -192,13 +166,9 @@ Global
{16B44D67-6214-4DDE-B419-93EF073E2E69} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{95EC3635-22E4-4C3A-A066-F5823A0648DA} = {2E6DDE9E-8C75-4F9C-8906-08EBDD6E73EF}
{2766D8AF-C20B-4F3A-8260-6C2D39B7A8A0} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{B7217A00-66FA-49A8-8EF3-39C07E1F7E33} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{71CE2DB2-C7AA-4454-B5F2-774BC575E321} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{C47AFD8A-3326-4391-8115-69349C04C3DA} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{937AF006-898E-43FD-80A6-B20D7E3A1944} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{1D5825CC-2EC9-43A1-BE32-778EFF5EAC80} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{51198C41-CD4A-4006-84D4-DE20A0A44363} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{325C4ECE-BD4A-4CF2-BC80-FBD1024B5935} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{C3B3F515-0305-4809-A9A8-37FD80428F74} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{9DA7024F-216F-4FA5-9B6D-CE4216C2DD72} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
{8E71FECF-E090-409E-8551-C597F9DFB91C} = {8B5230E5-8138-44D6-839F-DF9248F195EE}

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -1,46 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.0</TargetFrameworks>
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net46' ">win7-x86</RuntimeIdentifier>
<DelaySign Condition=" '$(OS)' == 'Windows_NT' ">true</DelaySign>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>EmptyApp.FunctionalTests.Tests</AssemblyName>
<PackageId>EmptyApp.FunctionalTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<!--<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.5</RuntimeFrameworkVersion>-->
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\FunctionalTestUtils\FunctionalTestUtils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Generator>SettingsSingleFileGenerator</Generator>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,51 +0,0 @@
using System.Diagnostics;
using Xunit;
using Xunit.Abstractions;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
namespace EmptyApp.FunctionalTests.FunctionalTest
{
using System;
using System.Reflection;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
public class ExceptionTelemetryEmptyAppTests : TelemetryTestsBase
{
private readonly string assemblyName;
public ExceptionTelemetryEmptyAppTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingRequestThatThrows()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/Exception";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET /Exception";
expectedRequestTelemetry.ResponseCode = "500";
expectedRequestTelemetry.Success = false;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, "/Exception", expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicExceptionPropertiesAfterRequestingRequestThatThrows()
{
using (var server = new InProcessServer(assemblyName))
{
var expectedExceptionTelemetry = new ExceptionTelemetry();
expectedExceptionTelemetry.Exception = new InvalidOperationException();
this.ValidateBasicException(server, "/Exception", expectedExceptionTelemetry);
}
}
}
}

Просмотреть файл

@ -1,79 +0,0 @@
namespace EmptyApp.FunctionalTests.FunctionalTest
{
using System.Linq;
using System.Net.Http;
using System.Reflection;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
using Xunit;
using Xunit.Abstractions;
public class RequestTelemetryEmptyAppTests : TelemetryTestsBase
{
private readonly string assemblyName;
public RequestTelemetryEmptyAppTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingBasicPage()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET /";
expectedRequestTelemetry.ResponseCode = "200";
expectedRequestTelemetry.Success = true;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingNotExistingPage()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/not/existing/controller";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET /not/existing/controller";
expectedRequestTelemetry.ResponseCode = "404";
expectedRequestTelemetry.Success = false;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestMixedTelemetryItemsReceived()
{
InProcessServer server;
using (server = new InProcessServer(assemblyName))
{
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/Mixed");
task.Wait(TestTimeoutMs);
}
}
var telemetries = server.BackChannel.Buffer;
Assert.Contains(telemetries.OfType<DependencyTelemetry>(), t => t.Name == "GET /Mixed");
Assert.True(telemetries.Count >= 4);
Assert.Contains(telemetries.OfType<RequestTelemetry>(), t => t.Name == "GET /Mixed");
Assert.Contains(telemetries.OfType<EventTelemetry>(), t => t.Name == "GetContact");
Assert.Contains(telemetries.OfType<MetricTelemetry>(),
t => t.Name == "ContactFile" && t.Value == 1);
Assert.Contains(telemetries.OfType<TraceTelemetry>(),
t => t.Message == "Fetched contact details." && t.SeverityLevel == SeverityLevel.Information);
}
}
}

Просмотреть файл

@ -1,32 +0,0 @@
namespace EmptyApp.FunctionalTests.FunctionalTest
{
using System.Reflection;
using FunctionalTestUtils;
using Xunit;
using Xunit.Abstractions;
public class TelemetryModuleWorkingEmptyAppTests : TelemetryTestsBase
{
private readonly string assemblyName;
public TelemetryModuleWorkingEmptyAppTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
// The NET451 conditional check is wrapped inside the test to make the tests visible in the test explorer. We can move them to the class level once if the issue is resolved.
[Fact]
public void TestBasicDependencyPropertiesAfterRequestingBasicPage()
{
this.ValidateBasicDependency(assemblyName, "/");
}
[Fact]
public void TestIfPerformanceCountersAreCollected()
{
#if NET451 || NET46
ValidatePerformanceCountersAreCollected(assemblyName);
#endif
}
}
}

Просмотреть файл

@ -1,25 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4828/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNET_ENVIRONMENT": "Development"
}
},
"web": {
"commandName": "web",
"environmentVariables": {
"ASPNET_ENVIRONMENT": "Development"
}
}
}
}

Просмотреть файл

@ -1,57 +0,0 @@
namespace EmptyApp.FunctionalTests
{
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.ApplicationInsights.Channel;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.DataContracts;
public class Startup
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<ITelemetryChannel>(new BackTelemetryChannel());
var builder = new ConfigurationBuilder();
builder.AddApplicationInsightsSettings(instrumentationKey: "Foo");
services.AddApplicationInsightsTelemetry(builder.Build());
}
public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
app.Use(next =>
{
return async context =>
{
if (context.Request.GetUri().ToString().Contains("Exception"))
{
throw new InvalidOperationException();
}
else if (context.Request.GetUri().PathAndQuery == "/")
{
await context.Response.WriteAsync("Hello!");
}
else if (context.Request.GetUri().ToString().Contains("Mixed"))
{
TelemetryClient telemetryClient = (TelemetryClient)context.RequestServices.GetService(typeof(TelemetryClient));
telemetryClient.TrackEvent("GetContact");
telemetryClient.TrackMetric("ContactFile", 1);
telemetryClient.TrackTrace("Fetched contact details.", SeverityLevel.Information);
await context.Response.WriteAsync("Hello!");
}
else
{
await next(context);
}
};
});
}
}
}

Просмотреть файл

@ -1,60 +0,0 @@
namespace FunctionalTestUtils
{
using System;
using System.Collections.Generic;
using Microsoft.ApplicationInsights.Channel;
public class BackTelemetryChannel : ITelemetryChannel
{
private IList<ITelemetry> buffer;
public BackTelemetryChannel()
{
this.buffer = new List<ITelemetry>();
}
public IList<ITelemetry> Buffer
{
get
{
return this.buffer;
}
}
public bool? DeveloperMode
{
get
{
return true;
}
set
{
}
}
public string EndpointAddress
{
get
{
return "https://dc.services.visualstudio.com/v2/track";
}
set
{
}
}
public void Dispose()
{
}
public void Flush()
{
}
public void Send(ITelemetry item)
{
this.buffer.Add(item);
}
}
}

Просмотреть файл

@ -1,31 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>1.0.2</VersionPrefix>
<TargetFrameworks>net46;netstandard1.6</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.6</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>FunctionalTestUtils</AssemblyName>
<PackageId>FunctionalTestUtils</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,79 +0,0 @@
namespace FunctionalTestUtils
{
using System;
using System.IO;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
// a variant of aspnet/Hosting/test/Microsoft.AspNetCore.Hosting.Tests/HostingEngineTests.cs
public class InProcessServer : IDisposable
{
private static Random random = new Random();
public static Func<IWebHostBuilder, IWebHostBuilder> UseApplicationInsights =
builder => builder.UseApplicationInsights();
private readonly Func<IWebHostBuilder, IWebHostBuilder> configureHost;
private IWebHost hostingEngine;
private string url;
private readonly BackTelemetryChannel backChannel;
public BackTelemetryChannel BackChannel
{
get
{
return this.backChannel;
}
}
public InProcessServer(string assemblyName, Func<IWebHostBuilder, IWebHostBuilder> configureHost = null)
{
this.configureHost = configureHost;
// localhost instead of machine name, as its not possible to get machine name when running non windows.
var machineName = "localhost";
this.url = "http://" + machineName + ":" + random.Next(5000, 14000).ToString();
this.backChannel = this.Start(assemblyName);
}
public string BaseHost
{
get
{
return this.url;
}
}
public IServiceProvider ApplicationServices { get; private set; }
private BackTelemetryChannel Start(string assemblyName)
{
var builder = new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseUrls(this.BaseHost)
.UseKestrel()
.UseStartup(assemblyName)
.UseEnvironment("Production");
if (configureHost != null)
{
builder = configureHost(builder);
}
this.hostingEngine = builder.Build();
this.hostingEngine.Start();
this.ApplicationServices = this.hostingEngine.Services;
return (BackTelemetryChannel)this.hostingEngine.Services.GetService<ITelemetryChannel>();
}
public void Dispose()
{
if (this.hostingEngine != null)
{
this.hostingEngine.Dispose();
}
}
}
}

Просмотреть файл

@ -1,19 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4824/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNET_ENVIRONMENT": "Development"
}
}
}
}

Просмотреть файл

@ -1,165 +0,0 @@
namespace FunctionalTestUtils
{
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
#if NET451 || NET46
using System.Net;
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector;
using Microsoft.ApplicationInsights.Extensibility;
#endif
public abstract class TelemetryTestsBase
{
protected const int TestTimeoutMs = 10000;
private object noParallelism = new object();
protected readonly ITestOutputHelper output;
public TelemetryTestsBase(ITestOutputHelper output)
{
this.output = output;
}
[MethodImpl(MethodImplOptions.NoOptimization)]
public void ValidateBasicRequest(InProcessServer server, string requestPath, RequestTelemetry expected)
{
lock (noParallelism)
{
// Subtract 50 milliseconds to hack around strange behavior on build server where the RequestTelemetry.Timestamp is somehow sometimes earlier than now by a few milliseconds.
expected.Timestamp = DateTimeOffset.Now.Subtract(TimeSpan.FromMilliseconds(50));
server.BackChannel.Buffer.Clear();
Stopwatch timer = Stopwatch.StartNew();
var httpClientHandler = new HttpClientHandler();
httpClientHandler.UseDefaultCredentials = true;
Task<HttpResponseMessage> task;
using (HttpClient httpClient = new HttpClient(httpClientHandler, true))
{
task = httpClient.GetAsync(server.BaseHost + requestPath);
task.Wait(TestTimeoutMs);
}
timer.Stop();
server.Dispose();
RequestTelemetry actual = server.BackChannel.Buffer.OfType<RequestTelemetry>().Where(t => t.Name == expected.Name).Single();
server.BackChannel.Buffer.Clear();
Assert.Equal(expected.ResponseCode, actual.ResponseCode);
Assert.Equal(expected.Name, actual.Name);
Assert.Equal(expected.Success, actual.Success);
Assert.Equal(expected.Url, actual.Url);
InRange(actual.Timestamp, expected.Timestamp, DateTimeOffset.Now);
Assert.True(actual.Duration < timer.Elapsed, $"actual.Duration '{actual.Duration}' is not less than timer.Elpased '{timer.Elapsed}'");
}
}
public void ValidateBasicException(InProcessServer server, string requestPath, ExceptionTelemetry expected)
{
var httpClientHandler = new HttpClientHandler();
httpClientHandler.UseDefaultCredentials = true;
Task<HttpResponseMessage> task;
using (var httpClient = new HttpClient(httpClientHandler, true))
{
task = httpClient.GetAsync(server.BaseHost + requestPath);
task.Wait(TestTimeoutMs);
}
var result = task.Result;
server.Dispose();
var actual = server.BackChannel.Buffer.OfType<ExceptionTelemetry>().Single();
Assert.Equal(expected.Exception.GetType(), actual.Exception.GetType());
Assert.NotEmpty(actual.Exception.StackTrace);
Assert.NotEmpty(actual.Context.Operation.Name);
Assert.NotEmpty(actual.Context.Operation.Id);
}
public void ValidateBasicDependency(string assemblyName, string requestPath, Func<IWebHostBuilder, IWebHostBuilder> configureHost = null)
{
DependencyTelemetry expected = new DependencyTelemetry();
expected.ResultCode = "200";
expected.Success = true;
expected.Name = "GET " + requestPath;
InProcessServer server;
using (server = new InProcessServer(assemblyName, configureHost))
{
expected.Data = server.BaseHost + requestPath;
var timer = Stopwatch.StartNew();
Task<HttpResponseMessage> task;
using (var httpClient = new HttpClient())
{
task = httpClient.GetAsync(server.BaseHost + requestPath);
task.Wait(TestTimeoutMs);
}
var result = task.Result;
timer.Stop();
}
IEnumerable<DependencyTelemetry> dependencies = server.BackChannel.Buffer.OfType<DependencyTelemetry>();
Assert.NotNull(dependencies);
Assert.NotEmpty(dependencies);
var dependencyTelemetry = dependencies.FirstOrDefault(d => d.Name == expected.Name
&& d.Data == expected.Data
&& d.Success == expected.Success
&& d.ResultCode == expected.ResultCode);
Assert.NotNull(dependencyTelemetry);
#if netcoreapp1_0
var requestTelemetry = server.BackChannel.Buffer.OfType<RequestTelemetry>().Single();
Assert.Equal(requestTelemetry.Context.Operation.ParentId, dependencyTelemetry.Id);
#endif
}
#if NET451 || NET46
public void ValidatePerformanceCountersAreCollected(string assemblyName, Func<IWebHostBuilder, IWebHostBuilder> configureHost = null)
{
using (var server = new InProcessServer(assemblyName, configureHost))
{
// Reconfigure the PerformanceCollectorModule timer.
Type perfModuleType = typeof(PerformanceCollectorModule);
PerformanceCollectorModule perfModule = (PerformanceCollectorModule)server.ApplicationServices.GetServices<ITelemetryModule>().FirstOrDefault(m => m.GetType() == perfModuleType);
FieldInfo timerField = perfModuleType.GetField("timer", BindingFlags.NonPublic | BindingFlags.Instance);
var timer = timerField.GetValue(perfModule);
timerField.FieldType.InvokeMember("ScheduleNextTick", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, timer, new object[] { TimeSpan.FromMilliseconds(10) });
DateTime timeout = DateTime.UtcNow.AddMilliseconds(TestTimeoutMs);
int numberOfCountersSent = 0;
do
{
Thread.Sleep(1000);
numberOfCountersSent += server.BackChannel.Buffer.OfType<MetricTelemetry>().Distinct().Count();
} while (numberOfCountersSent == 0 && DateTime.UtcNow < timeout);
Assert.True(numberOfCountersSent > 0);
}
}
#endif
/// <summary>
/// Tests if a DateTimeOffset is in a specified range and prints a more detailed error message if it is not.
/// </summary>
/// <param name="actual">The actual value to test.</param>
/// <param name="low">The minimum of the range.</param>
/// <param name="high">The maximum of the range.</param>
private void InRange(DateTimeOffset actual, DateTimeOffset low, DateTimeOffset high)
{
string dateFormat = "yyyy-MM-dd HH:mm:ss.ffffzzz";
Assert.True(low <= actual && actual <= high, $"Range: ({low.ToString(dateFormat)} - {high.ToString(dateFormat)})\nActual: {actual.ToString(dateFormat)}");
}
}
}

Просмотреть файл

@ -1,3 +0,0 @@
{
"directory": "wwwroot/lib"
}

Просмотреть файл

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -1,468 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using MVCFramework45.FunctionalTests.Models;
using MVCFramework45.FunctionalTests.Models.AccountViewModels;
using MVCFramework45.FunctionalTests.Services;
namespace MVCFramework45.FunctionalTests.Controllers
{
[Authorize]
public class AccountController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly IEmailSender _emailSender;
private readonly ISmsSender _smsSender;
private readonly ILogger _logger;
public AccountController(
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IEmailSender emailSender,
ISmsSender smsSender,
ILoggerFactory loggerFactory)
{
_userManager = userManager;
_signInManager = signInManager;
_emailSender = emailSender;
_smsSender = smsSender;
_logger = loggerFactory.CreateLogger<AccountController>();
}
//
// GET: /Account/Login
[HttpGet]
[AllowAnonymous]
public IActionResult Login(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}
//
// POST: /Account/Login
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Login(LoginViewModel model, string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
if (ModelState.IsValid)
{
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
if (result.Succeeded)
{
_logger.LogInformation(1, "User logged in.");
return RedirectToLocal(returnUrl);
}
if (result.RequiresTwoFactor)
{
return RedirectToAction(nameof(SendCode), new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
}
if (result.IsLockedOut)
{
_logger.LogWarning(2, "User account locked out.");
return View("Lockout");
}
else
{
ModelState.AddModelError(string.Empty, "Invalid login attempt.");
return View(model);
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// GET: /Account/Register
[HttpGet]
[AllowAnonymous]
public IActionResult Register(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}
//
// POST: /Account/Register
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Register(RegisterViewModel model, string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
if (ModelState.IsValid)
{
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
var result = await _userManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link
//var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
//var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
//await _emailSender.SendEmailAsync(model.Email, "Confirm your account",
// $"Please confirm your account by clicking this link: <a href='{callbackUrl}'>link</a>");
await _signInManager.SignInAsync(user, isPersistent: false);
_logger.LogInformation(3, "User created a new account with password.");
return RedirectToLocal(returnUrl);
}
AddErrors(result);
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// POST: /Account/LogOff
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> LogOff()
{
await _signInManager.SignOutAsync();
_logger.LogInformation(4, "User logged out.");
return RedirectToAction(nameof(HomeController.Index), "Home");
}
//
// POST: /Account/ExternalLogin
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
// Request a redirect to the external login provider.
var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl });
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return Challenge(properties, provider);
}
//
// GET: /Account/ExternalLoginCallback
[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)
{
if (remoteError != null)
{
ModelState.AddModelError(string.Empty, $"Error from external provider: {remoteError}");
return View(nameof(Login));
}
var info = await _signInManager.GetExternalLoginInfoAsync();
if (info == null)
{
return RedirectToAction(nameof(Login));
}
// Sign in the user with this external login provider if the user already has a login.
var result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
{
_logger.LogInformation(5, "User logged in with {Name} provider.", info.LoginProvider);
return RedirectToLocal(returnUrl);
}
if (result.RequiresTwoFactor)
{
return RedirectToAction(nameof(SendCode), new { ReturnUrl = returnUrl });
}
if (result.IsLockedOut)
{
return View("Lockout");
}
else
{
// If the user does not have an account, then ask the user to create an account.
ViewData["ReturnUrl"] = returnUrl;
ViewData["LoginProvider"] = info.LoginProvider;
var email = info.Principal.FindFirstValue(ClaimTypes.Email);
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
}
}
//
// POST: /Account/ExternalLoginConfirmation
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl = null)
{
if (ModelState.IsValid)
{
// Get the information about the user from the external login provider
var info = await _signInManager.GetExternalLoginInfoAsync();
if (info == null)
{
return View("ExternalLoginFailure");
}
var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
var result = await _userManager.CreateAsync(user);
if (result.Succeeded)
{
result = await _userManager.AddLoginAsync(user, info);
if (result.Succeeded)
{
await _signInManager.SignInAsync(user, isPersistent: false);
_logger.LogInformation(6, "User created an account using {Name} provider.", info.LoginProvider);
return RedirectToLocal(returnUrl);
}
}
AddErrors(result);
}
ViewData["ReturnUrl"] = returnUrl;
return View(model);
}
// GET: /Account/ConfirmEmail
[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> ConfirmEmail(string userId, string code)
{
if (userId == null || code == null)
{
return View("Error");
}
var user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
return View("Error");
}
var result = await _userManager.ConfirmEmailAsync(user, code);
return View(result.Succeeded ? "ConfirmEmail" : "Error");
}
//
// GET: /Account/ForgotPassword
[HttpGet]
[AllowAnonymous]
public IActionResult ForgotPassword()
{
return View();
}
//
// POST: /Account/ForgotPassword
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> ForgotPassword(ForgotPasswordViewModel model)
{
if (ModelState.IsValid)
{
var user = await _userManager.FindByNameAsync(model.Email);
if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
{
// Don't reveal that the user does not exist or is not confirmed
return View("ForgotPasswordConfirmation");
}
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link
//var code = await _userManager.GeneratePasswordResetTokenAsync(user);
//var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
//await _emailSender.SendEmailAsync(model.Email, "Reset Password",
// $"Please reset your password by clicking here: <a href='{callbackUrl}'>link</a>");
//return View("ForgotPasswordConfirmation");
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// GET: /Account/ForgotPasswordConfirmation
[HttpGet]
[AllowAnonymous]
public IActionResult ForgotPasswordConfirmation()
{
return View();
}
//
// GET: /Account/ResetPassword
[HttpGet]
[AllowAnonymous]
public IActionResult ResetPassword(string code = null)
{
return code == null ? View("Error") : View();
}
//
// POST: /Account/ResetPassword
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> ResetPassword(ResetPasswordViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await _userManager.FindByNameAsync(model.Email);
if (user == null)
{
// Don't reveal that the user does not exist
return RedirectToAction(nameof(AccountController.ResetPasswordConfirmation), "Account");
}
var result = await _userManager.ResetPasswordAsync(user, model.Code, model.Password);
if (result.Succeeded)
{
return RedirectToAction(nameof(AccountController.ResetPasswordConfirmation), "Account");
}
AddErrors(result);
return View();
}
//
// GET: /Account/ResetPasswordConfirmation
[HttpGet]
[AllowAnonymous]
public IActionResult ResetPasswordConfirmation()
{
return View();
}
//
// GET: /Account/SendCode
[HttpGet]
[AllowAnonymous]
public async Task<ActionResult> SendCode(string returnUrl = null, bool rememberMe = false)
{
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
if (user == null)
{
return View("Error");
}
var userFactors = await _userManager.GetValidTwoFactorProvidersAsync(user);
var factorOptions = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList();
return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
}
//
// POST: /Account/SendCode
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> SendCode(SendCodeViewModel model)
{
if (!ModelState.IsValid)
{
return View();
}
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
if (user == null)
{
return View("Error");
}
// Generate the token and send it
var code = await _userManager.GenerateTwoFactorTokenAsync(user, model.SelectedProvider);
if (string.IsNullOrWhiteSpace(code))
{
return View("Error");
}
var message = "Your security code is: " + code;
if (model.SelectedProvider == "Email")
{
await _emailSender.SendEmailAsync(await _userManager.GetEmailAsync(user), "Security Code", message);
}
else if (model.SelectedProvider == "Phone")
{
await _smsSender.SendSmsAsync(await _userManager.GetPhoneNumberAsync(user), message);
}
return RedirectToAction(nameof(VerifyCode), new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
}
//
// GET: /Account/VerifyCode
[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> VerifyCode(string provider, bool rememberMe, string returnUrl = null)
{
// Require that the user has already logged in via username/password or external login
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
if (user == null)
{
return View("Error");
}
return View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe });
}
//
// POST: /Account/VerifyCode
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<IActionResult> VerifyCode(VerifyCodeViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
// The following code protects for brute force attacks against the two factor codes.
// If a user enters incorrect codes for a specified amount of time then the user account
// will be locked out for a specified amount of time.
var result = await _signInManager.TwoFactorSignInAsync(model.Provider, model.Code, model.RememberMe, model.RememberBrowser);
if (result.Succeeded)
{
return RedirectToLocal(model.ReturnUrl);
}
if (result.IsLockedOut)
{
_logger.LogWarning(7, "User account locked out.");
return View("Lockout");
}
else
{
ModelState.AddModelError(string.Empty, "Invalid code.");
return View(model);
}
}
#region Helpers
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError(string.Empty, error.Description);
}
}
private Task<ApplicationUser> GetCurrentUserAsync()
{
return _userManager.GetUserAsync(HttpContext.User);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
#endregion
}
}

Просмотреть файл

@ -1,54 +0,0 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights;
namespace MVCFramework45.FunctionalTests.Controllers
{
public class HomeController : Controller
{
private TelemetryClient telemetryClient;
public HomeController(TelemetryClient telemetryClient)
{
this.telemetryClient = telemetryClient;
}
public IActionResult Index()
{
return View();
}
public IActionResult Exception()
{
throw new InvalidOperationException("Do not call the method called Exception");
}
public IActionResult About(int index)
{
ViewBag.Message = "Your application description page # " + index;
return View();
}
public IActionResult Contact()
{
this.telemetryClient.TrackEvent("GetContact");
this.telemetryClient.TrackMetric("ContactFile", 1);
this.telemetryClient.TrackTrace("Fetched contact details.", SeverityLevel.Information);
return View();
}
public IActionResult Dependency()
{
this.telemetryClient.TrackDependency("MyDependency", "MyCommand", DateTimeOffset.Now, TimeSpan.FromMilliseconds(1), success: true);
return View();
}
public IActionResult Error()
{
return View("~/Views/Shared/Error.cshtml");
}
}
}

Просмотреть файл

@ -1,347 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using MVCFramework45.FunctionalTests.Models;
using MVCFramework45.FunctionalTests.Models.ManageViewModels;
using MVCFramework45.FunctionalTests.Services;
namespace MVCFramework45.FunctionalTests.Controllers
{
[Authorize]
public class ManageController : Controller
{
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly IEmailSender _emailSender;
private readonly ISmsSender _smsSender;
private readonly ILogger _logger;
public ManageController(
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IEmailSender emailSender,
ISmsSender smsSender,
ILoggerFactory loggerFactory)
{
_userManager = userManager;
_signInManager = signInManager;
_emailSender = emailSender;
_smsSender = smsSender;
_logger = loggerFactory.CreateLogger<ManageController>();
}
//
// GET: /Manage/Index
[HttpGet]
public async Task<IActionResult> Index(ManageMessageId? message = null)
{
ViewData["StatusMessage"] =
message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
: message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
: message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
: message == ManageMessageId.Error ? "An error has occurred."
: message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
: message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
: "";
var user = await GetCurrentUserAsync();
var model = new IndexViewModel
{
HasPassword = await _userManager.HasPasswordAsync(user),
PhoneNumber = await _userManager.GetPhoneNumberAsync(user),
TwoFactor = await _userManager.GetTwoFactorEnabledAsync(user),
Logins = await _userManager.GetLoginsAsync(user),
BrowserRemembered = await _signInManager.IsTwoFactorClientRememberedAsync(user)
};
return View(model);
}
//
// POST: /Manage/RemoveLogin
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> RemoveLogin(RemoveLoginViewModel account)
{
ManageMessageId? message = ManageMessageId.Error;
var user = await GetCurrentUserAsync();
if (user != null)
{
var result = await _userManager.RemoveLoginAsync(user, account.LoginProvider, account.ProviderKey);
if (result.Succeeded)
{
await _signInManager.SignInAsync(user, isPersistent: false);
message = ManageMessageId.RemoveLoginSuccess;
}
}
return RedirectToAction(nameof(ManageLogins), new { Message = message });
}
//
// GET: /Manage/AddPhoneNumber
public IActionResult AddPhoneNumber()
{
return View();
}
//
// POST: /Manage/AddPhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
// Generate the token and send it
var user = await GetCurrentUserAsync();
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
await _smsSender.SendSmsAsync(model.PhoneNumber, "Your security code is: " + code);
return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber });
}
//
// POST: /Manage/EnableTwoFactorAuthentication
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> EnableTwoFactorAuthentication()
{
var user = await GetCurrentUserAsync();
if (user != null)
{
await _userManager.SetTwoFactorEnabledAsync(user, true);
await _signInManager.SignInAsync(user, isPersistent: false);
_logger.LogInformation(1, "User enabled two-factor authentication.");
}
return RedirectToAction(nameof(Index), "Manage");
}
//
// POST: /Manage/DisableTwoFactorAuthentication
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DisableTwoFactorAuthentication()
{
var user = await GetCurrentUserAsync();
if (user != null)
{
await _userManager.SetTwoFactorEnabledAsync(user, false);
await _signInManager.SignInAsync(user, isPersistent: false);
_logger.LogInformation(2, "User disabled two-factor authentication.");
}
return RedirectToAction(nameof(Index), "Manage");
}
//
// GET: /Manage/VerifyPhoneNumber
[HttpGet]
public async Task<IActionResult> VerifyPhoneNumber(string phoneNumber)
{
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(await GetCurrentUserAsync(), phoneNumber);
// Send an SMS to verify the phone number
return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
}
//
// POST: /Manage/VerifyPhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await GetCurrentUserAsync();
if (user != null)
{
var result = await _userManager.ChangePhoneNumberAsync(user, model.PhoneNumber, model.Code);
if (result.Succeeded)
{
await _signInManager.SignInAsync(user, isPersistent: false);
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.AddPhoneSuccess });
}
}
// If we got this far, something failed, redisplay the form
ModelState.AddModelError(string.Empty, "Failed to verify phone number");
return View(model);
}
//
// POST: /Manage/RemovePhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> RemovePhoneNumber()
{
var user = await GetCurrentUserAsync();
if (user != null)
{
var result = await _userManager.SetPhoneNumberAsync(user, null);
if (result.Succeeded)
{
await _signInManager.SignInAsync(user, isPersistent: false);
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.RemovePhoneSuccess });
}
}
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
}
//
// GET: /Manage/ChangePassword
[HttpGet]
public IActionResult ChangePassword()
{
return View();
}
//
// POST: /Manage/ChangePassword
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> ChangePassword(ChangePasswordViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await GetCurrentUserAsync();
if (user != null)
{
var result = await _userManager.ChangePasswordAsync(user, model.OldPassword, model.NewPassword);
if (result.Succeeded)
{
await _signInManager.SignInAsync(user, isPersistent: false);
_logger.LogInformation(3, "User changed their password successfully.");
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.ChangePasswordSuccess });
}
AddErrors(result);
return View(model);
}
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
}
//
// GET: /Manage/SetPassword
[HttpGet]
public IActionResult SetPassword()
{
return View();
}
//
// POST: /Manage/SetPassword
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> SetPassword(SetPasswordViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await GetCurrentUserAsync();
if (user != null)
{
var result = await _userManager.AddPasswordAsync(user, model.NewPassword);
if (result.Succeeded)
{
await _signInManager.SignInAsync(user, isPersistent: false);
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.SetPasswordSuccess });
}
AddErrors(result);
return View(model);
}
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
}
//GET: /Manage/ManageLogins
[HttpGet]
public async Task<IActionResult> ManageLogins(ManageMessageId? message = null)
{
ViewData["StatusMessage"] =
message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
: message == ManageMessageId.AddLoginSuccess ? "The external login was added."
: message == ManageMessageId.Error ? "An error has occurred."
: "";
var user = await GetCurrentUserAsync();
if (user == null)
{
return View("Error");
}
var userLogins = await _userManager.GetLoginsAsync(user);
var otherLogins = _signInManager.GetExternalAuthenticationSchemes().Where(auth => userLogins.All(ul => auth.AuthenticationScheme != ul.LoginProvider)).ToList();
ViewData["ShowRemoveButton"] = user.PasswordHash != null || userLogins.Count > 1;
return View(new ManageLoginsViewModel
{
CurrentLogins = userLogins,
OtherLogins = otherLogins
});
}
//
// POST: /Manage/LinkLogin
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult LinkLogin(string provider)
{
// Request a redirect to the external login provider to link a login for the current user
var redirectUrl = Url.Action("LinkLoginCallback", "Manage");
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, _userManager.GetUserId(User));
return Challenge(properties, provider);
}
//
// GET: /Manage/LinkLoginCallback
[HttpGet]
public async Task<ActionResult> LinkLoginCallback()
{
var user = await GetCurrentUserAsync();
if (user == null)
{
return View("Error");
}
var info = await _signInManager.GetExternalLoginInfoAsync(await _userManager.GetUserIdAsync(user));
if (info == null)
{
return RedirectToAction(nameof(ManageLogins), new { Message = ManageMessageId.Error });
}
var result = await _userManager.AddLoginAsync(user, info);
var message = result.Succeeded ? ManageMessageId.AddLoginSuccess : ManageMessageId.Error;
return RedirectToAction(nameof(ManageLogins), new { Message = message });
}
#region Helpers
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError(string.Empty, error.Description);
}
}
public enum ManageMessageId
{
AddPhoneSuccess,
AddLoginSuccess,
ChangePasswordSuccess,
SetTwoFactorSuccess,
SetPasswordSuccess,
RemoveLoginSuccess,
RemovePhoneSuccess,
Error
}
private Task<ApplicationUser> GetCurrentUserAsync()
{
return _userManager.GetUserAsync(HttpContext.User);
}
#endregion
}
}

Просмотреть файл

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using MVCFramework45.FunctionalTests.Models;
namespace MVCFramework45.FunctionalTests.Data
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
}
}
}

Просмотреть файл

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
namespace MVCFramework45.FunctionalTests.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
}
}
}

Просмотреть файл

@ -1,42 +0,0 @@
namespace MVCFramework.FunctionalTests.FunctionalTest
{
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
using System;
using System.Linq;
using System.Net.Http;
using Xunit;
using Xunit.Abstractions;
public class CorrelationMvcTests : TelemetryTestsBase
{
private const string assemblyName = "MVCFramework.FunctionalTests";
public CorrelationMvcTests(ITestOutputHelper output) : base(output)
{
}
[Fact]
public void CorrelationInfoIsPropagatedToDependendedService()
{
#if netcoreapp1_0 // Correlation works on .Net core.
InProcessServer server;
using (server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/");
task.Wait(TestTimeoutMs);
}
}
var telemetries = server.BackChannel.Buffer;
Assert.True(telemetries.Count >= 2);
var requestTelemetry = telemetries.OfType<RequestTelemetry>().Single();
var dependencyTelemetry = telemetries.OfType<DependencyTelemetry>().Single();
Assert.Equal(requestTelemetry.Context.Operation.Id, dependencyTelemetry.Context.Operation.Id);
Assert.Equal(requestTelemetry.Context.Operation.ParentId, dependencyTelemetry.Id);
#endif
}
}
}

Просмотреть файл

@ -1,143 +0,0 @@
using System.Diagnostics;
namespace MVCFramework.FunctionalTests.FunctionalTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Xunit;
using Xunit.Abstractions;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.DependencyCollector;
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
public class DependencyTelemetryMvcTests : TelemetryTestsBase
{
private readonly string assemblyName;
public DependencyTelemetryMvcTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void CorrelationInfoIsNotAddedToRequestHeaderIfUserAddDomainToExcludedList()
{
#if netcoreapp1_0 // Correlation is supported on .Net core.
InProcessServer server;
using (server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
var dependencyCollectorModule = server.ApplicationServices.GetServices<ITelemetryModule>().OfType<DependencyTrackingTelemetryModule>().Single();
dependencyCollectorModule.ExcludeComponentCorrelationHttpHeadersOnDomains.Add(server.BaseHost);
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/");
task.Wait(TestTimeoutMs);
}
}
var telemetries = server.BackChannel.Buffer;
try
{
Assert.True(telemetries.Count >= 2);
var requestTelemetry = telemetries.OfType<RequestTelemetry>().Single();
var dependencyTelemetry = telemetries.OfType<DependencyTelemetry>().Single();
Assert.NotEqual(requestTelemetry.Context.Operation.Id, dependencyTelemetry.Context.Operation.Id);
}
catch (Exception e)
{
string data = DebugTelemetryItems(telemetries);
throw new Exception(data, e);
}
#endif
}
[Fact]
public void OperationIdOfRequestIsPropagatedToChildDependency()
{
// https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/340
// Verify operation of OperationIdTelemetryInitializer
string path = "Home/Dependency";
InProcessServer server;
using (server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/" + path);
task.Wait(TestTimeoutMs);
}
}
var telemetries = server.BackChannel.Buffer;
try
{
Assert.True(telemetries.Count >= 2);
var requestTelemetry = telemetries.OfType<RequestTelemetry>().Single();
var dependencyTelemetry = telemetries.OfType<DependencyTelemetry>().First(t => t.Name == "MyDependency");
Assert.Equal(requestTelemetry.Context.Operation.Id, dependencyTelemetry.Context.Operation.Id);
}
catch (Exception e)
{
string data = DebugTelemetryItems(telemetries);
throw new Exception(data, e);
}
}
[Fact]
public void ParentIdOfChildDependencyIsIdOfRequest()
{
// https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/333
// Verify operation of OperationCorrelationTelemetryInitializer
string path = "Home/Dependency";
InProcessServer server;
using (server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/" + path);
task.Wait(TestTimeoutMs);
}
}
// Filter out any unexpected telemetry items.
IEnumerable<ITelemetry> telemetries = server.BackChannel.Buffer.Where((t) => t.Context?.Operation?.Name != null && t.Context.Operation.Name.Contains(path));
try
{
Assert.NotNull(telemetries);
var requestTelemetry = telemetries.OfType<RequestTelemetry>().Single();
var dependencyTelemetry = telemetries.First(t => t is DependencyTelemetry && (t as DependencyTelemetry).Name == "MyDependency");
Assert.Equal(requestTelemetry.Id, dependencyTelemetry.Context.Operation.ParentId);
}
catch (Exception e)
{
string data = DebugTelemetryItems(server.BackChannel.Buffer);
throw new Exception(data, e);
}
}
private string DebugTelemetryItems(IList<ITelemetry> telemetries)
{
StringBuilder builder = new StringBuilder();
foreach (ITelemetry telemetry in telemetries)
{
DependencyTelemetry dependency = telemetry as DependencyTelemetry;
if (dependency != null) {
builder.AppendLine($"{dependency.ToString()} - {dependency.Data} - {dependency.Duration} - {dependency.Id} - {dependency.Name} - {dependency.ResultCode} - {dependency.Sequence} - {dependency.Success} - {dependency.Target} - {dependency.Type}");
} else {
builder.AppendLine($"{telemetry.ToString()} - {telemetry.Context?.Operation?.Name}");
}
}
return builder.ToString();
}
}
}

Просмотреть файл

@ -1,50 +0,0 @@
using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
namespace MVCFramework.FunctionalTests.FunctionalTest
{
using System;
using System.Reflection;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
using Xunit;
using Xunit.Abstractions;
public class ExceptionTelemetryMvcTests : TelemetryTestsBase
{
private readonly string assemblyName;
public ExceptionTelemetryMvcTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingControllerThatThrows()
{
using (var server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
const string RequestPath = "/Home/Exception";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET Home/Exception";
expectedRequestTelemetry.ResponseCode = "500";
expectedRequestTelemetry.Success = false;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, "/Home/Exception", expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicExceptionPropertiesAfterRequestingControllerThatThrows()
{
using (var server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
var expectedExceptionTelemetry = new ExceptionTelemetry();
expectedExceptionTelemetry.Exception = new InvalidOperationException();
this.ValidateBasicException(server, "/Home/Exception", expectedExceptionTelemetry);
}
}
}
}

Просмотреть файл

@ -1,98 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
namespace MVCFramework.FunctionalTests.FunctionalTest
{
using System.Linq;
using System.Net.Http;
using System.Reflection;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
using Xunit;
using Xunit.Abstractions;
public class RequestTelemetryMvcTests : TelemetryTestsBase
{
private readonly string assemblyName;
public RequestTelemetryMvcTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingHomeController()
{
using (var server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
const string RequestPath = "/";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET Home/Index";
expectedRequestTelemetry.ResponseCode = "200";
expectedRequestTelemetry.Success = true;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingActionWithParameter()
{
using (var server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
const string RequestPath = "/Home/About/5";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET Home/About [id]";
expectedRequestTelemetry.ResponseCode = "200";
expectedRequestTelemetry.Success = true;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingNotExistingController()
{
using (var server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
const string RequestPath = "/not/existing/controller";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET /not/existing/controller";
expectedRequestTelemetry.ResponseCode = "404";
expectedRequestTelemetry.Success = false;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestMixedTelemetryItemsReceived()
{
InProcessServer server;
using (server = new InProcessServer(assemblyName, InProcessServer.UseApplicationInsights))
{
using (var httpClient = new HttpClient())
{
var task = httpClient.GetAsync(server.BaseHost + "/Home/Contact");
task.Wait(TestTimeoutMs);
}
}
var telemetries = server.BackChannel.Buffer;
Assert.Contains(telemetries.OfType<DependencyTelemetry>(), t => t.Name == "GET /Home/Contact");
Assert.True(telemetries.Count >= 4);
Assert.Contains(telemetries.OfType<RequestTelemetry>(), t => t.Name == "GET Home/Contact");
Assert.Contains(telemetries.OfType<EventTelemetry>(), t => t.Name == "GetContact");
Assert.Contains(telemetries.OfType<MetricTelemetry>(),
t => t.Name == "ContactFile" && t.Value == 1);
Assert.Contains(telemetries.OfType<TraceTelemetry>(),
t => t.Message == "Fetched contact details." && t.SeverityLevel == SeverityLevel.Information);
}
}
}

Просмотреть файл

@ -1,33 +0,0 @@
namespace MVCFramework.FunctionalTests.FunctionalTest
{
using System.Reflection;
using FunctionalTestUtils;
using Xunit;
using Xunit.Abstractions;
public class TelemetryModuleWorkingMvcTests : TelemetryTestsBase
{
private readonly string assemblyName;
public TelemetryModuleWorkingMvcTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
// The NET451 conditional check is wrapped inside the test to make the tests visible in the test explorer. We can move them to the class level once if the issue is resolved.
[Fact]
public void TestBasicDependencyPropertiesAfterRequestingBasicPage()
{
this.ValidateBasicDependency(assemblyName, "/Home/About/5", InProcessServer.UseApplicationInsights);
}
[Fact]
public void TestIfPerformanceCountersAreCollected()
{
#if NET451 || NET46
ValidatePerformanceCountersAreCollected(assemblyName, InProcessServer.UseApplicationInsights);
#endif
}
}
}

Просмотреть файл

@ -1,74 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.0</TargetFrameworks>
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net46' ">win7-x86</RuntimeIdentifier>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>MVCFramework.FunctionalTests.Tests</AssemblyName>
<PackageId>MVCFramework.FunctionalTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<UserSecretsId>aspnet-MVCFramework45.FunctionalTests-60cfc765-2dc9-454c-bb34-dc379ed92cd0</UserSecretsId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.5</RuntimeFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Generator>SettingsSingleFileGenerator</Generator>
</None>
<None Update="appsettings.json;web.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="wwwroot\**\*;Views\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FunctionalTestUtils\FunctionalTestUtils.csproj" />
<ProjectReference Include="..\..\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="1.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class ExternalLoginConfirmationViewModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
}
}

Просмотреть файл

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class ForgotPasswordViewModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
}
}

Просмотреть файл

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class LoginViewModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
}

Просмотреть файл

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class RegisterViewModel
{
[Required]
[EmailAddress]
[Display(Name = "Email")]
public string Email { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}

Просмотреть файл

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class ResetPasswordViewModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
public string Code { get; set; }
}
}

Просмотреть файл

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class SendCodeViewModel
{
public string SelectedProvider { get; set; }
public ICollection<SelectListItem> Providers { get; set; }
public string ReturnUrl { get; set; }
public bool RememberMe { get; set; }
}
}

Просмотреть файл

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.AccountViewModels
{
public class VerifyCodeViewModel
{
[Required]
public string Provider { get; set; }
[Required]
public string Code { get; set; }
public string ReturnUrl { get; set; }
[Display(Name = "Remember this browser?")]
public bool RememberBrowser { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
}

Просмотреть файл

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
namespace MVCFramework45.FunctionalTests.Models
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
}
}

Просмотреть файл

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class AddPhoneNumberViewModel
{
[Required]
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }
}
}

Просмотреть файл

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class ChangePasswordViewModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm new password")]
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}

Просмотреть файл

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class ConfigureTwoFactorViewModel
{
public string SelectedProvider { get; set; }
public ICollection<SelectListItem> Providers { get; set; }
}
}

Просмотреть файл

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class FactorViewModel
{
public string Purpose { get; set; }
}
}

Просмотреть файл

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class IndexViewModel
{
public bool HasPassword { get; set; }
public IList<UserLoginInfo> Logins { get; set; }
public string PhoneNumber { get; set; }
public bool TwoFactor { get; set; }
public bool BrowserRemembered { get; set; }
}
}

Просмотреть файл

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Identity;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class ManageLoginsViewModel
{
public IList<UserLoginInfo> CurrentLogins { get; set; }
public IList<AuthenticationDescription> OtherLogins { get; set; }
}
}

Просмотреть файл

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class RemoveLoginViewModel
{
public string LoginProvider { get; set; }
public string ProviderKey { get; set; }
}
}

Просмотреть файл

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class SetPasswordViewModel
{
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm new password")]
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}

Просмотреть файл

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Models.ManageViewModels
{
public class VerifyPhoneNumberViewModel
{
[Required]
public string Code { get; set; }
[Required]
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }
}
}

Просмотреть файл

@ -1,187 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to ASP.NET Core</title>
<style>
html {
background: #f1f1f1;
height: 100%;
}
body {
background: #fff;
color: #505050;
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
margin: 1%;
min-height: 95.5%;
border: 1px solid silver;
position: relative;
}
#header {
padding: 0;
}
#header h1 {
font-size: 44px;
font-weight: normal;
margin: 0;
padding: 10px 30px 10px 30px;
}
#header span {
margin: 0;
padding: 0 30px;
display: block;
}
#header p {
font-size: 20px;
color: #fff;
background: #007acc;
padding: 0 30px;
line-height: 50px;
margin-top: 25px;
}
#header p a {
color: #fff;
text-decoration: underline;
font-weight: bold;
padding-right: 35px;
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
}
#main {
padding: 5px 30px;
clear: both;
}
.section {
width: 21.7%;
float: left;
margin: 0 0 0 4%;
}
.section h2 {
font-size: 13px;
text-transform: uppercase;
margin: 0;
border-bottom: 1px solid silver;
padding-bottom: 12px;
margin-bottom: 8px;
}
.section.first {
margin-left: 0;
}
.section.first h2 {
font-size: 24px;
text-transform: none;
margin-bottom: 25px;
border: none;
}
.section.first li {
border-top: 1px solid silver;
padding: 8px 0;
}
.section.last {
margin-right: 0;
}
ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 20px;
}
li {
padding: 4px 0;
}
a {
color: #267cb2;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#footer {
clear: both;
padding-top: 50px;
}
#footer p {
position: absolute;
bottom: 10px;
}
</style>
</head>
<body>
<div id="header">
<h1>Welcome to ASP.NET Core</h1>
<span>
We've made some big updates in this release, so its <b>important</b> that you spend
a few minutes to learn whats new.
</span>
<p>You've created a new ASP.NET Core project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
</div>
<div id="main">
<div class="section first">
<h2>This application consists of:</h2>
<ul>
<li>Sample pages using ASP.NET Core MVC</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="section">
<h2>How to</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>
</div>
<div class="section">
<h2>Overview</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ul>
</div>
<div class="section last">
<h2>Run & Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>
<div id="footer">
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,18 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:29543/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

Просмотреть файл

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Services
{
public interface IEmailSender
{
Task SendEmailAsync(string email, string subject, string message);
}
}

Просмотреть файл

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Services
{
public interface ISmsSender
{
Task SendSmsAsync(string number, string message);
}
}

Просмотреть файл

@ -1,25 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MVCFramework45.FunctionalTests.Services
{
// This class is used by the application to send Email and SMS
// when you turn on two-factor authentication in ASP.NET Identity.
// For more details see this link http://go.microsoft.com/fwlink/?LinkID=532713
public class AuthMessageSender : IEmailSender, ISmsSender
{
public Task SendEmailAsync(string email, string subject, string message)
{
// Plug in your email service here to send an email.
return Task.FromResult(0);
}
public Task SendSmsAsync(string number, string message)
{
// Plug in your SMS service here to send a text message.
return Task.FromResult(0);
}
}
}

Просмотреть файл

@ -1,96 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using MVCFramework45.FunctionalTests.Data;
using MVCFramework45.FunctionalTests.Models;
using MVCFramework45.FunctionalTests.Services;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.Channel;
namespace MVCFramework45.FunctionalTests
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<ITelemetryChannel>(new BackTelemetryChannel());
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
// Add application services.
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859
try
{
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
.CreateScope())
{
serviceScope.ServiceProvider.GetService<ApplicationDbContext>()
.Database.Migrate();
}
}
catch { }
}
app.UseStaticFiles();
app.UseIdentity();
// To configure external authentication please see http://go.microsoft.com/fwlink/?LinkID=532715
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}

Просмотреть файл

@ -1,10 +0,0 @@
@{
ViewData["Title"] = "Confirm Email";
}
<h2>@ViewData["Title"].</h2>
<div>
<p>
Thank you for confirming your email. Please <a asp-controller="Account" asp-action="Login">Click here to Log in</a>.
</p>
</div>

Просмотреть файл

@ -1,35 +0,0 @@
@model ExternalLoginConfirmationViewModel
@{
ViewData["Title"] = "Register";
}
<h2>@ViewData["Title"].</h2>
<h3>Associate your @ViewData["LoginProvider"] account.</h3>
<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<h4>Association Form</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<p class="text-info">
You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>.
Please enter an email address for this site below and click the Register button to finish
logging in.
</p>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Register</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,8 +0,0 @@
@{
ViewData["Title"] = "Login Failure";
}
<header>
<h2>@ViewData["Title"].</h2>
<p class="text-danger">Unsuccessful login with service.</p>
</header>

Просмотреть файл

@ -1,31 +0,0 @@
@model ForgotPasswordViewModel
@{
ViewData["Title"] = "Forgot your password?";
}
<h2>@ViewData["Title"]</h2>
<p>
For more information on how to enable reset password please see this <a href="http://go.microsoft.com/fwlink/?LinkID=532713">article</a>.
</p>
@*<form asp-controller="Account" asp-action="ForgotPassword" method="post" class="form-horizontal">
<h4>Enter your email.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>*@
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,8 +0,0 @@
@{
ViewData["Title"] = "Forgot Password Confirmation";
}
<h2>@ViewData["Title"].</h2>
<p>
Please check your email to reset your password.
</p>

Просмотреть файл

@ -1,8 +0,0 @@
@{
ViewData["Title"] = "Locked out";
}
<header>
<h1 class="text-danger">Locked out.</h1>
<p class="text-danger">This account has been locked out, please try again later.</p>
</header>

Просмотреть файл

@ -1,92 +0,0 @@
@using System.Collections.Generic
@using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Authentication
@model LoginViewModel
@inject SignInManager<ApplicationUser> SignInManager
@{
ViewData["Title"] = "Log in";
}
<h2>@ViewData["Title"].</h2>
<div class="row">
<div class="col-md-8">
<section>
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<h4>Use a local account to log in.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Password" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<label asp-for="RememberMe">
<input asp-for="RememberMe" />
@Html.DisplayNameFor(m => m.RememberMe)
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Log in</button>
</div>
</div>
<p>
<a asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]">Register as a new user?</a>
</p>
<p>
<a asp-action="ForgotPassword">Forgot your password?</a>
</p>
</form>
</section>
</div>
<div class="col-md-4">
<section>
<h4>Use another service to log in.</h4>
<hr />
@{
var loginProviders = SignInManager.GetExternalAuthenticationSchemes().ToList();
if (loginProviders.Count == 0)
{
<div>
<p>
There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
for details on setting up this ASP.NET application to support logging in via external services.
</p>
</div>
}
else
{
<form asp-controller="Account" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in loginProviders)
{
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
}
</p>
</div>
</form>
}
}
</section>
</div>
</div>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,42 +0,0 @@
@model RegisterViewModel
@{
ViewData["Title"] = "Register";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Account" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<h4>Create a new account.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Password" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Register</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,43 +0,0 @@
@model ResetPasswordViewModel
@{
ViewData["Title"] = "Reset password";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Account" asp-action="ResetPassword" method="post" class="form-horizontal">
<h4>Reset your password.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<input asp-for="Code" type="hidden" />
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Password" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Reset</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,8 +0,0 @@
@{
ViewData["Title"] = "Reset password confirmation";
}
<h1>@ViewData["Title"].</h1>
<p>
Your password has been reset. Please <a asp-controller="Account" asp-action="Login">Click here to log in</a>.
</p>

Просмотреть файл

@ -1,21 +0,0 @@
@model SendCodeViewModel
@{
ViewData["Title"] = "Send Verification Code";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Account" asp-action="SendCode" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal">
<input asp-for="RememberMe" type="hidden" />
<div class="row">
<div class="col-md-8">
Select Two-Factor Authentication Provider:
<select asp-for="SelectedProvider" asp-items="Model.Providers"></select>
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,38 +0,0 @@
@model VerifyCodeViewModel
@{
ViewData["Title"] = "Verify";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Account" asp-action="VerifyCode" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<div asp-validation-summary="All" class="text-danger"></div>
<input asp-for="Provider" type="hidden" />
<input asp-for="RememberMe" type="hidden" />
<h4>@ViewData["Status"]</h4>
<hr />
<div class="form-group">
<label asp-for="Code" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Code" class="form-control" />
<span asp-validation-for="Code" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="RememberBrowser" />
<label asp-for="RememberBrowser"></label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,7 +0,0 @@
@{
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>

Просмотреть файл

@ -1,17 +0,0 @@
@{
ViewData["Title"] = "Contact";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>

Просмотреть файл

@ -1,2 +0,0 @@
@{
}

Просмотреть файл

@ -1,109 +0,0 @@
@{
ViewData["Title"] = "Home Page";
}
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Learn how to build ASP.NET apps that can run anywhere.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
There are powerful new features in Visual Studio for building modern web apps.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="~/images/banner3.svg" alt="Package Management" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
<div class="item">
<img src="~/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
<div class="carousel-caption" role="option">
<p>
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
Learn More
</a>
</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="row">
<div class="col-md-3">
<h2>Application uses</h2>
<ul>
<li>Sample pages using ASP.NET Core MVC</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>How to</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Overview</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Run & Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>
</div>

Просмотреть файл

@ -1,27 +0,0 @@
@model AddPhoneNumberViewModel
@{
ViewData["Title"] = "Add Phone Number";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Manage" asp-action="AddPhoneNumber" method="post" class="form-horizontal">
<h4>Add a phone number.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="PhoneNumber" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="PhoneNumber" class="form-control" />
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Send verification code</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,42 +0,0 @@
@model ChangePasswordViewModel
@{
ViewData["Title"] = "Change Password";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Manage" asp-action="ChangePassword" method="post" class="form-horizontal">
<h4>Change Password Form</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="OldPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="OldPassword" class="form-control" />
<span asp-validation-for="OldPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="NewPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="NewPassword" class="form-control" />
<span asp-validation-for="NewPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Change password</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,71 +0,0 @@
@model IndexViewModel
@{
ViewData["Title"] = "Manage your account";
}
<h2>@ViewData["Title"].</h2>
<p class="text-success">@ViewData["StatusMessage"]</p>
<div>
<h4>Change your account settings</h4>
<hr />
<dl class="dl-horizontal">
<dt>Password:</dt>
<dd>
@if (Model.HasPassword)
{
<a asp-controller="Manage" asp-action="ChangePassword" class="btn-bracketed">Change</a>
}
else
{
<a asp-controller="Manage" asp-action="SetPassword" class="btn-bracketed">Create</a>
}
</dd>
<dt>External Logins:</dt>
<dd>
@Model.Logins.Count <a asp-controller="Manage" asp-action="ManageLogins" class="btn-bracketed">Manage</a>
</dd>
<dt>Phone Number:</dt>
<dd>
<p>
Phone Numbers can used as a second factor of verification in two-factor authentication.
See <a href="http://go.microsoft.com/fwlink/?LinkID=532713">this article</a>
for details on setting up this ASP.NET application to support two-factor authentication using SMS.
</p>
@*@(Model.PhoneNumber ?? "None")
@if (Model.PhoneNumber != null)
{
<br />
<a asp-controller="Manage" asp-action="AddPhoneNumber" class="btn-bracketed">Change</a>
<form asp-controller="Manage" asp-action="RemovePhoneNumber" method="post">
[<button type="submit" class="btn-link">Remove</button>]
</form>
}
else
{
<text><a asp-controller="Manage" asp-action="AddPhoneNumber" class="btn-bracketed">Add</a>
}*@
</dd>
<dt>Two-Factor Authentication:</dt>
<dd>
<p>
There are no two-factor authentication providers configured. See <a href="http://go.microsoft.com/fwlink/?LinkID=532713">this article</a>
for setting up this application to support two-factor authentication.
</p>
@*@if (Model.TwoFactor)
{
<form asp-controller="Manage" asp-action="DisableTwoFactorAuthentication" method="post" class="form-horizontal">
Enabled <button type="submit" class="btn-link btn-bracketed">Disable</button>
</form>
}
else
{
<form asp-controller="Manage" asp-action="EnableTwoFactorAuthentication" method="post" class="form-horizontal">
<button type="submit" class="btn-link btn-bracketed">Enable</button> Disabled
</form>
}*@
</dd>
</dl>
</div>

Просмотреть файл

@ -1,54 +0,0 @@
@model ManageLoginsViewModel
@using Microsoft.AspNetCore.Http.Authentication
@{
ViewData["Title"] = "Manage your external logins";
}
<h2>@ViewData["Title"].</h2>
<p class="text-success">@ViewData["StatusMessage"]</p>
@if (Model.CurrentLogins.Count > 0)
{
<h4>Registered Logins</h4>
<table class="table">
<tbody>
@for (var index = 0; index < Model.CurrentLogins.Count; index++)
{
<tr>
<td>@Model.CurrentLogins[index].LoginProvider</td>
<td>
@if ((bool)ViewData["ShowRemoveButton"])
{
<form asp-controller="Manage" asp-action="RemoveLogin" method="post" class="form-horizontal">
<div>
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden" />
<input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden" />
<input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].LoginProvider login from your account" />
</div>
</form>
}
else
{
@: &nbsp;
}
</td>
</tr>
}
</tbody>
</table>
}
@if (Model.OtherLogins.Count > 0)
{
<h4>Add another service to log in.</h4>
<hr />
<form asp-controller="Manage" asp-action="LinkLogin" method="post" class="form-horizontal">
<div id="socialLoginList">
<p>
@foreach (var provider in Model.OtherLogins)
{
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
}
</p>
</div>
</form>
}

Просмотреть файл

@ -1,38 +0,0 @@
@model SetPasswordViewModel
@{
ViewData["Title"] = "Set Password";
}
<p class="text-info">
You do not have a local username/password for this site. Add a local
account so you can log in without an external login.
</p>
<form asp-controller="Manage" asp-action="SetPassword" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<h4>Set your password</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="NewPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="NewPassword" class="form-control" />
<span asp-validation-for="NewPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Set password</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,30 +0,0 @@
@model VerifyPhoneNumberViewModel
@{
ViewData["Title"] = "Verify Phone Number";
}
<h2>@ViewData["Title"].</h2>
<form asp-controller="Manage" asp-action="VerifyPhoneNumber" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
<input asp-for="PhoneNumber" type="hidden" />
<h4>Add a phone number.</h4>
<h5>@ViewData["Status"]</h5>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Code" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Code" class="form-control" />
<span asp-validation-for="Code" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}

Просмотреть файл

@ -1,14 +0,0 @@
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
</p>

Просмотреть файл

@ -1,68 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - MVCFramework45.FunctionalTests</title>
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-controller="Home" asp-action="Index" class="navbar-brand">MVCFramework45.FunctionalTests</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
</ul>
@await Html.PartialAsync("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>&copy; 2016 - MVCFramework45.FunctionalTests</p>
</footer>
</div>
<environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
<script src="~/js/site.min.js" asp-append-version="true"></script>
</environment>
@RenderSection("scripts", required: false)
</body>
</html>

Просмотреть файл

@ -1,26 +0,0 @@
@using Microsoft.AspNetCore.Identity
@using MVCFramework45.FunctionalTests.Models
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@if (SignInManager.IsSignedIn(User))
{
<form asp-controller="Account" asp-action="LogOff" method="post" id="logoutForm" class="navbar-right">
<ul class="nav navbar-nav navbar-right">
<li>
<a asp-controller="Manage" asp-action="Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
</li>
<li>
<button type="submit" class="btn btn-link navbar-btn navbar-link">Log off</button>
</li>
</ul>
</form>
}
else
{
<ul class="nav navbar-nav navbar-right">
<li><a asp-controller="Account" asp-action="Register">Register</a></li>
<li><a asp-controller="Account" asp-action="Login">Log in</a></li>
</ul>
}

Просмотреть файл

@ -1,14 +0,0 @@
<environment names="Development">
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive">
</script>
</environment>

Просмотреть файл

@ -1,5 +0,0 @@
@using MVCFramework45.FunctionalTests
@using MVCFramework45.FunctionalTests.Models
@using MVCFramework45.FunctionalTests.Models.AccountViewModels
@using MVCFramework45.FunctionalTests.Models.ManageViewModels
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

Просмотреть файл

@ -1,3 +0,0 @@
@{
Layout = "_Layout";
}

Просмотреть файл

@ -1,16 +0,0 @@
{
"ApplicationInsights": {
"InstrumentationKey": "11111111-2222-3333-4444-555555555555"
},
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-MVCFramework45.FunctionalTests-60cfc765-2dc9-454c-bb34-dc379ed92cd0;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

Просмотреть файл

@ -1,10 +0,0 @@
{
"name": "ASP.NET",
"private": true,
"dependencies": {
"bootstrap": "3.3.6",
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6"
}
}

Просмотреть файл

@ -1,45 +0,0 @@
/// <binding Clean='clean' />
"use strict";
var gulp = require("gulp"),
rimraf = require("rimraf"),
concat = require("gulp-concat"),
cssmin = require("gulp-cssmin"),
uglify = require("gulp-uglify");
var webroot = "./wwwroot/";
var paths = {
js: webroot + "js/**/*.js",
minJs: webroot + "js/**/*.min.js",
css: webroot + "css/**/*.css",
minCss: webroot + "css/**/*.min.css",
concatJsDest: webroot + "js/site.min.js",
concatCssDest: webroot + "css/site.min.css"
};
gulp.task("clean:js", function (cb) {
rimraf(paths.concatJsDest, cb);
});
gulp.task("clean:css", function (cb) {
rimraf(paths.concatCssDest, cb);
});
gulp.task("clean", ["clean:js", "clean:css"]);
gulp.task("min:js", function () {
return gulp.src([paths.js, "!" + paths.minJs], { base: "." })
.pipe(concat(paths.concatJsDest))
.pipe(uglify())
.pipe(gulp.dest("."));
});
gulp.task("min:css", function () {
return gulp.src([paths.css, "!" + paths.minCss])
.pipe(concat(paths.concatCssDest))
.pipe(cssmin())
.pipe(gulp.dest("."));
});
gulp.task("min", ["min:js", "min:css"]);

Просмотреть файл

@ -1,12 +0,0 @@
{
"name": "asp.net",
"version": "0.0.0",
"private": true,
"devDependencies": {
"gulp": "3.8.11",
"gulp-concat": "2.5.2",
"gulp-cssmin": "0.1.7",
"gulp-uglify": "1.2.0",
"rimraf": "2.2.8"
}
}

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
</system.web>
</configuration>

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>

Просмотреть файл

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>

Просмотреть файл

@ -1 +0,0 @@


Просмотреть файл

@ -1,44 +0,0 @@
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Wrapping element */
/* Set some basic padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
/* Set widths on the form inputs since otherwise they're 100% wide */
input,
select,
textarea {
max-width: 280px;
}
/* Carousel */
.carousel-caption p {
font-size: 20px;
line-height: 1.4;
}
/* buttons and links extension to use brackets: [ click me ] */
.btn-bracketed::before {
display:inline-block;
content: "[";
padding-right: 0.5em;
}
.btn-bracketed::after {
display:inline-block;
content: "]";
padding-left: 0.5em;
}
/* Hide/rearrange for smaller screens */
@media screen and (max-width: 767px) {
/* Hide captions */
.carousel-caption {
display: none
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 31 KiB

Просмотреть файл

@ -1 +0,0 @@
// Write your Javascript code.

Просмотреть файл

@ -1,3 +0,0 @@
{
"shadowCopy": false
}

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace SampleWebAPIIntegration.Controllers
{
[Route("api/[controller]")]
public class ExceptionController : Controller
{
// GET: api/exception
[HttpGet]
public IEnumerable<string> Get()
{
throw new InvalidOperationException();
}
}
}

Просмотреть файл

@ -1,44 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace SampleWebAPIIntegration.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET: api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

Просмотреть файл

@ -1,49 +0,0 @@
namespace WebApi.FunctionalTests.FunctionalTest
{
using System;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
using Xunit;
using Microsoft.ApplicationInsights.Extensibility;
using Xunit.Abstractions;
using System.Reflection;
public class ExceptionTelemetryWebApiTests : TelemetryTestsBase
{
private readonly string assemblyName;
public ExceptionTelemetryWebApiTests(ITestOutputHelper output) : base(output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingControllerThatThrows()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/api/exception";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET Exception/Get";
expectedRequestTelemetry.ResponseCode = "500";
expectedRequestTelemetry.Success = false;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicExceptionPropertiesAfterRequestingControllerThatThrows()
{
using (var server = new InProcessServer(assemblyName))
{
var expectedExceptionTelemetry = new ExceptionTelemetry();
expectedExceptionTelemetry.Exception = new InvalidOperationException();
this.ValidateBasicException(server, "/api/exception", expectedExceptionTelemetry);
}
}
}
}

Просмотреть файл

@ -1,70 +0,0 @@
namespace WebApi.FunctionalTests.FunctionalTest
{
using System.Reflection;
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.DataContracts;
using Xunit;
using Xunit.Abstractions;
public class RequestTelemetryWebApiTests : TelemetryTestsBase
{
private readonly string assemblyName;
public RequestTelemetryWebApiTests(ITestOutputHelper output) : base (output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingValuesController()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/api/values";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET Values/Get";
expectedRequestTelemetry.ResponseCode = "200";
expectedRequestTelemetry.Success = true;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingNotExistingController()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/api/notexistingcontroller";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET /api/notexistingcontroller";
expectedRequestTelemetry.ResponseCode = "404";
expectedRequestTelemetry.Success = false;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
[Fact]
public void TestBasicRequestPropertiesAfterRequestingWebApiShimRoute()
{
using (var server = new InProcessServer(assemblyName))
{
const string RequestPath = "/api/values/1";
var expectedRequestTelemetry = new RequestTelemetry();
expectedRequestTelemetry.Name = "GET Values/Get [id]";
expectedRequestTelemetry.ResponseCode = "200";
expectedRequestTelemetry.Success = true;
expectedRequestTelemetry.Url = new System.Uri(server.BaseHost + RequestPath);
this.ValidateBasicRequest(server, RequestPath, expectedRequestTelemetry);
}
}
}
}

Просмотреть файл

@ -1,34 +0,0 @@
using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
namespace WebApi.FunctionalTests.FunctionalTest
{
using System.Reflection;
using FunctionalTestUtils;
using Xunit.Abstractions;
public class TelemetryModuleWorkingWebApiTests : TelemetryTestsBase
{
private readonly string assemblyName;
public TelemetryModuleWorkingWebApiTests(ITestOutputHelper output) : base (output)
{
this.assemblyName = this.GetType().GetTypeInfo().Assembly.GetName().Name;
}
// The NET451 conditional check is wrapped inside the test to make the tests visible in the test explorer. We can move them to the class level once if the issue is resolved.
[Fact]
public void TestBasicDependencyPropertiesAfterRequestingBasicPage()
{
this.ValidateBasicDependency(assemblyName, "/api/values");
}
[Fact]
public void TestIfPerformanceCountersAreCollected()
{
#if NET451 || NET46
ValidatePerformanceCountersAreCollected(assemblyName);
#endif
}
}
}

Просмотреть файл

@ -1,26 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:41846/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNET_ENV": "Development"
}
},
"web": {
"commandName": "web",
"environmentVariables": {
"Hosting:Environment": "Development"
}
}
}
}

Просмотреть файл

@ -1,48 +0,0 @@
namespace SampleWebAPIIntegration
{
using FunctionalTestUtils;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Setup configuration sources.
Configuration = new ConfigurationBuilder()
.AddJsonFile("config.json")
.Build();
}
public IConfiguration Configuration { get; set; }
// This method gets called by a runtime.
// Use this method to add services to the container
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<ITelemetryChannel>(new BackTelemetryChannel());
services.AddApplicationInsightsTelemetry(Configuration);
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
services.AddMvc().AddWebApiConventions();
}
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Configure the HTTP request pipeline.
app.UseStaticFiles();
// Add MVC to the request pipeline.
app.UseMvc(routes =>
{
// Add the following route for porting Web API 2 controllers.
routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
});
}
}
}

Просмотреть файл

@ -1,54 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.0</TargetFrameworks>
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net46' ">win7-x86</RuntimeIdentifier>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>WebApi.FunctionalTests.Tests</AssemblyName>
<PackageId>WebApi.FunctionalTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.5</RuntimeFrameworkVersion>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<None Update="App.config">
<Generator>SettingsSingleFileGenerator</Generator>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="config.json;xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FunctionalTestUtils\FunctionalTestUtils.csproj" />
<ProjectReference Include="..\..\src\Microsoft.ApplicationInsights.AspNetCore\Microsoft.ApplicationInsights.AspNetCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="1.1.8" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,5 +0,0 @@
{
"ApplicationInsights": {
"InstrumentationKey": "11111111-2222-3333-4444-555555555555"
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше