-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from kalintsenkov/version-6.0
Version 6.0
- Loading branch information
Showing
170 changed files
with
2,398 additions
and
1,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
plugins/MyTested.AspNetCore.Mvc.Razor.RuntimeCompilation/Internal/Razor/ChangeTokenMock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace MyTested.AspNetCore.Mvc.Internal.Razor | ||
{ | ||
using Microsoft.Extensions.Primitives; | ||
using System; | ||
|
||
public class ChangeTokenMock : IChangeToken | ||
{ | ||
public static ChangeTokenMock Instance => new ChangeTokenMock(); | ||
|
||
public bool ActiveChangeCallbacks => false; | ||
|
||
public bool HasChanged => false; | ||
|
||
public IDisposable RegisterChangeCallback(Action<object> callback, object state) => DisposableMock.Instance; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...NetCore.Mvc.Razor.RuntimeCompilation/Internal/Razor/TestActionDescriptorChangeProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace MyTested.AspNetCore.Mvc.Internal.Razor | ||
{ | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using Microsoft.Extensions.Primitives; | ||
|
||
public class TestActionDescriptorChangeProvider : IActionDescriptorChangeProvider | ||
{ | ||
public IChangeToken GetChangeToken() => ChangeTokenMock.Instance; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...Core.Mvc.Razor.RuntimeCompilation/MyTested.AspNetCore.Mvc.Razor.RuntimeCompilation.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Description>My Tested ASP.NET Core MVC razor runtime compilation components.</Description> | ||
<Copyright>2015-2022 Ivaylo Kenov</Copyright> | ||
<AssemblyTitle>MyTested.AspNetCore.Mvc.Razor.RuntimeCompilation</AssemblyTitle> | ||
<VersionPrefix>6.0.0</VersionPrefix> | ||
<Authors>Ivaylo Kenov</Authors> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<NoWarn>$(NoWarn);CS1591</NoWarn> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<AssemblyName>MyTested.AspNetCore.Mvc.Razor.RuntimeCompilation</AssemblyName> | ||
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile> | ||
<SignAssembly>true</SignAssembly> | ||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> | ||
<PackageId>MyTested.AspNetCore.Mvc.Razor.RuntimeCompilation</PackageId> | ||
<PackageTags>aspnetcore;aspnetcoremvc;testing;unit;tests;fluent;testing;framework;asp;net;core;mvc;test;mymvc;mytested</PackageTags> | ||
<PackageIcon>nuget-logo.png</PackageIcon> | ||
<PackageProjectUrl>https://mytestedasp.net/</PackageProjectUrl> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc</RepositoryUrl> | ||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | ||
<RootNamespace>MyTested.AspNetCore.Mvc</RootNamespace> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="../../LICENSE" Pack="true" PackagePath="" /> | ||
<None Include="../../tools/nuget-logo.png" Pack="true" PackagePath="" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\MyTested.AspNetCore.Mvc.ViewFeatures\MyTested.AspNetCore.Mvc.ViewFeatures.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
17 changes: 17 additions & 0 deletions
17
...sted.AspNetCore.Mvc.Razor.RuntimeCompilation/Plugins/RazorRuntimeCompilationTestPlugin.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace MyTested.AspNetCore.Mvc.Plugins | ||
{ | ||
using System; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
public class RazorRuntimeCompilationTestPlugin : IServiceRegistrationPlugin | ||
{ | ||
private readonly Type defaultActionDescriptorChangeProviderServiceType = typeof(IActionDescriptorChangeProvider); | ||
|
||
public Func<ServiceDescriptor, bool> ServiceSelectorPredicate | ||
=> serviceDescriptor => serviceDescriptor.ServiceType == this.defaultActionDescriptorChangeProviderServiceType; | ||
|
||
public Action<IServiceCollection> ServiceRegistrationDelegate | ||
=> serviceCollection => serviceCollection.ReplaceRazorRuntimeCompilation(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...etCore.Mvc.Razor.RuntimeCompilation/ServiceCollectionRazorRuntimeCompilationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace MyTested.AspNetCore.Mvc | ||
{ | ||
using Microsoft.AspNetCore.Mvc.Abstractions; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using MyTested.AspNetCore.Mvc.Internal.Razor; | ||
|
||
/// <summary> | ||
/// Contains Razor runtime compilation extension methods for <see cref="IServiceCollection"/>. | ||
/// </summary> | ||
public static class ServiceCollectionRazorRuntimeCompilationExtensions | ||
{ | ||
/// <summary> | ||
/// Replaces the default <see cref="IActionDescriptorChangeProvider"/> with a mocked implementation.. | ||
/// </summary> | ||
/// <param name="serviceCollection">Instance of <see cref="IServiceCollection"/> type.</param> | ||
/// <returns>The same <see cref="IServiceCollection"/>.</returns> | ||
public static IServiceCollection ReplaceRazorRuntimeCompilation(this IServiceCollection serviceCollection) | ||
=> serviceCollection | ||
.Remove<IActionDescriptorProvider, PageActionDescriptorProvider>() | ||
.ReplaceSingleton<IActionDescriptorChangeProvider, TestActionDescriptorChangeProvider>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
samples/ApplicationParts/ApplicationParts.Services/ApplicationParts.Services.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 29 additions & 26 deletions
55
samples/ApplicationParts/ApplicationParts.Web/ApplicationParts.Web.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<AssemblyName>ApplicationParts.Web</AssemblyName> | ||
<UserSecretsId>aspnet-ApplicationParts.Web-c273a372-79ef-490d-b0e1-a7fb8f2dacc7</UserSecretsId> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<AssemblyName>ApplicationParts.Web</AssemblyName> | ||
<UserSecretsId>aspnet-ApplicationParts.Web-c273a372-79ef-490d-b0e1-a7fb8f2dacc7</UserSecretsId> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Update="wwwroot\**\*;Views\**\*"> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Update="wwwroot\**\*;Views\**\*"> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ApplicationParts.Controllers\ApplicationParts.Controllers.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\ApplicationParts.Controllers\ApplicationParts.Controllers.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.3" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.3" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.3" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.3"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.