Skip to content

Commit 4560a45

Browse files
committed
Added a new plugin - MyTested.AspNetCore.Mvc.Versioning for web projects using the official Versioning package (#358)
1 parent 8a3fa28 commit 4560a45

File tree

7 files changed

+69
-9
lines changed

7 files changed

+69
-9
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.NewtonsoftJson")]
5+
[assembly: ComVisible(false)]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Description>My Tested ASP.NET Core MVC versioning components.</Description>
5+
<Copyright>2015-2019 Ivaylo Kenov</Copyright>
6+
<AssemblyTitle>MyTested.AspNetCore.Mvc.Versioning</AssemblyTitle>
7+
<VersionPrefix>3.1.0</VersionPrefix>
8+
<Authors>Ivaylo Kenov</Authors>
9+
<TargetFramework>netcoreapp3.1</TargetFramework>
10+
<NoWarn>$(NoWarn);CS1591</NoWarn>
11+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
12+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13+
<AssemblyName>MyTested.AspNetCore.Mvc.Versioning</AssemblyName>
14+
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
15+
<SignAssembly>true</SignAssembly>
16+
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
17+
<PackageId>MyTested.AspNetCore.Mvc.Versioning</PackageId>
18+
<PackageTags>aspnetcore;aspnetcoremvc;testing;unit;tests;fluent;testing;framework;asp;net;core;mvc;test;mymvc;mytested</PackageTags>
19+
<PackageIcon>nuget-logo.png</PackageIcon>
20+
<PackageProjectUrl>https://mytestedasp.net/</PackageProjectUrl>
21+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
22+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
23+
<RepositoryType>git</RepositoryType>
24+
<RepositoryUrl>https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc</RepositoryUrl>
25+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
26+
<RootNamespace>MyTested.AspNetCore.Mvc</RootNamespace>
27+
<IncludeSymbols>true</IncludeSymbols>
28+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
29+
</PropertyGroup>
30+
31+
<ItemGroup>
32+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
33+
</ItemGroup>
34+
35+
<ItemGroup>
36+
<None Include="../../LICENSE" Pack="true" PackagePath="" />
37+
<None Include="../../tools/nuget-logo.png" Pack="true" PackagePath="" />
38+
</ItemGroup>
39+
40+
<ItemGroup>
41+
<ProjectReference Include="..\..\src\MyTested.AspNetCore.Mvc.Abstractions\MyTested.AspNetCore.Mvc.Abstractions.csproj" />
42+
</ItemGroup>
43+
44+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace MyTested.AspNetCore.Mvc.Plugins
2+
{
3+
using System;
4+
using Microsoft.AspNetCore.Http;
5+
using Microsoft.AspNetCore.Mvc.Versioning;
6+
7+
public class VersioningTestPlugin : IHttpFeatureRegistrationPlugin
8+
{
9+
public Action<HttpContext> HttpFeatureRegistrationDelegate
10+
=> httpContext => httpContext.Features.Set(new ApiVersioningFeature(httpContext));
11+
}
12+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Versioning")]
5+
[assembly: ComVisible(false)]

src/MyTested.AspNetCore.Mvc.Abstractions/Internal/Application/ApplicationBuilderMock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware
9595
public IApplicationBuilder New() => new ApplicationBuilderMock(this.ApplicationServices);
9696

9797
/// <summary>
98-
/// Builds the application delegate, which will process the incoming HTTP requests. Prepares the HTTP context used in the tests.
98+
/// Builds the application delegate, which will process the incoming HTTP requests. Not used in the actual testing.
9999
/// </summary>
100100
/// <returns>Result of <see cref="RequestDelegate"/> type.</returns>
101101
public RequestDelegate Build()

test/MyTested.AspNetCore.Mvc.Test.Setups/Http/CustomHttpFeature.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/MyTested.AspNetCore.Mvc.Test.Setups/StartupFilters/CustomStartupFilter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace MyTested.AspNetCore.Mvc.Test.Setups.StartupFilters
22
{
33
using System;
4-
using Http;
54
using Microsoft.AspNetCore.Builder;
65
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.AspNetCore.Http;
77

88
public class CustomStartupFilter : IStartupFilter
99
{
@@ -16,7 +16,7 @@ public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
1616

1717
app.Use(async (context, nextMiddleware) =>
1818
{
19-
context.Features.Set(new CustomHttpFeature());
19+
await context.Response.WriteAsync("Test Response");
2020

2121
await nextMiddleware();
2222
});

0 commit comments

Comments
 (0)