Skip to content

Commit

Permalink
Reproduction Sample for microsoft/testfx#3856
Browse files Browse the repository at this point in the history
  • Loading branch information
flensrocker committed Sep 23, 2024
0 parents commit 1da8f5c
Show file tree
Hide file tree
Showing 8 changed files with 607 additions and 0 deletions.
484 changes: 484 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageVersion Include="MSTest.TestFramework" Version="3.6.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net48'">
<PackageVersion Include="Microsoft.AspNetCore" Version="2.1.7" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication" Version="2.1.2" />
</ItemGroup>
</Project>
36 changes: 36 additions & 0 deletions Dummy.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dummy.AspNetCore", "src\Dummy.AspNetCore\Dummy.AspNetCore.csproj", "{FFA3B6C8-8371-4B82-811D-BE8F1EB6DD6A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dummy.UnitTests", "test\Dummy.UnitTests\Dummy.UnitTests.csproj", "{1EBE46F7-CB3C-46A9-84BE-6567AA7DA147}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projektmappenelemente", "Projektmappenelemente", "{9D0881D0-D78F-4156-85FB-90F60D00B877}"
ProjectSection(SolutionItems) = preProject
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FFA3B6C8-8371-4B82-811D-BE8F1EB6DD6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFA3B6C8-8371-4B82-811D-BE8F1EB6DD6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFA3B6C8-8371-4B82-811D-BE8F1EB6DD6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFA3B6C8-8371-4B82-811D-BE8F1EB6DD6A}.Release|Any CPU.Build.0 = Release|Any CPU
{1EBE46F7-CB3C-46A9-84BE-6567AA7DA147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EBE46F7-CB3C-46A9-84BE-6567AA7DA147}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EBE46F7-CB3C-46A9-84BE-6567AA7DA147}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EBE46F7-CB3C-46A9-84BE-6567AA7DA147}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5F49C05A-2D27-4AAE-BBD0-997102E9C6F3}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions src/Dummy.AspNetCore/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Dummy.AspNetCore;

public class Class1
{
public void DummyMethod(Microsoft.AspNetCore.Authentication.AuthenticationScheme authScheme)
{
if (string.IsNullOrEmpty(authScheme.Name))
throw new Exception("Dummy");
}
}
19 changes: 19 additions & 0 deletions src/Dummy.AspNetCore/Dummy.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions test/Dummy.UnitTests/Dummy.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="MSTest.TestAdapter">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="MSTest.TestFramework" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Dummy.AspNetCore\Dummy.AspNetCore.csproj" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions test/Dummy.UnitTests/MSTestSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

[assembly: Parallelize(Scope = ExecutionScope.ClassLevel)]
17 changes: 17 additions & 0 deletions test/Dummy.UnitTests/Test1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Dummy.AspNetCore;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Dummy.UnitTests;

[TestClass]
public sealed class Test1
{
[TestMethod]
public void TestMethod1()
{
var authScheme = new Microsoft.AspNetCore.Authentication.AuthenticationScheme("Name", "DisplayName", typeof(string));

var dummy = new Class1();
dummy.DummyMethod(authScheme);
}
}

0 comments on commit 1da8f5c

Please sign in to comment.