Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
651326a
If the method is abstract and virtual is a correct method (#72)
Sergio1192 Aug 2, 2022
f65be9c
Fix enumerable parameter (#74)
Sergio1192 Sep 13, 2022
f817b67
Add RemoveQueryParameter extension method (#75)
Sergio1192 Sep 15, 2022
c2f870d
CancellationTOken always is a query paramater (#76)
Sergio1192 Sep 21, 2022
706ab47
Version 3.4.0 (#77)
Sergio1192 Sep 21, 2022
387b500
Action convection name (#79)
Sergio1192 Oct 4, 2022
d169c53
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 Feb 22, 2023
994cb8f
Create get request when it has an object with some list
Sergio1192 Feb 22, 2023
29ab302
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 Feb 22, 2023
99f0c8a
DateTime as a primitive type but using custom formatter (#81)
Sergio1192 Mar 1, 2023
060a58c
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 Mar 1, 2023
ed138ab
Fixing codeQL alerts (#82)
Sergio1192 Mar 12, 2023
a85bb25
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 Mar 12, 2023
de91f82
feature: Get url (#83)
Sergio1192 Mar 19, 2023
35fa8de
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 Mar 20, 2023
15ea0b2
In IncludeContentAsFormUrlEncoded and PrimitiveParameterActionTokeniz…
Sergio1192 May 20, 2023
2563705
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 20, 2023
e204431
Add new CreateHttpApiRequest with TActionResponse (#85)
Sergio1192 May 20, 2023
026d100
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 20, 2023
92af8db
Add net7.0 Target Version (#86)
Sergio1192 May 20, 2023
ec294cc
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 20, 2023
85a2b9c
ReadContentAsAsync allows string type (#87)
Sergio1192 May 21, 2023
e6d41cc
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 21, 2023
e18e22f
Allow send a IFormFile (#88)
Sergio1192 May 22, 2023
d035170
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 22, 2023
d5aa032
Update version to 3.5.0 (#89)
Sergio1192 May 22, 2023
5b4e075
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 22, 2023
2018abc
Add DateTimeOffset to IsDateTime function (#91)
Sergio1192 May 22, 2023
fb8e0f3
Merge branch 'develop' of https://github.com/Xabaril/Acheve.TestHost …
Sergio1192 May 22, 2023
0f613c2
Allow dispatch workflows manually
Sergio1192 May 25, 2023
316d22c
Update to Net8 (#92)
Sergio1192 May 3, 2024
afb09ea
Different froms in object (#93)
Sergio1192 May 13, 2024
97f4d69
Version 4.0.0 (#94)
Sergio1192 May 13, 2024
a4fc44a
Merge with master
Sergio1192 May 14, 2024
d2fef41
Fix IsDateTime (#96)
Sergio1192 May 14, 2024
df4b701
Send ContentType and ContentDisposition (#98)
Sergio1192 Jun 11, 2024
adf9320
Merge with master
Sergio1192 Jun 11, 2024
1ac0440
Enum in FromQuery and FromRoute (#99)
Sergio1192 Aug 13, 2024
7f4ab58
Version 4.1.0 (#100)
Sergio1192 Nov 4, 2025
57e9d81
Merge with develop
Sergio1192 Dec 18, 2025
8e0954b
Net 10 and version 5.0.0 (#102)
Sergio1192 Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.421
7.0.408
8.0.415
9.0.306
10.0.101

- name: Build
run: dotnet build -c $BUILD_CONFIG
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.421
7.0.408
8.0.415
9.0.306
10.0.101

- name: Build
run: dotnet build -c $BUILD_CONFIG
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<PropertyGroup Label="SDK Versions">
<NetCoreTargetVersion>net6.0;net7.0;net8.0;net9.0</NetCoreTargetVersion>
<NetCoreTargetVersion>net8.0;net9.0;net10.0</NetCoreTargetVersion>
<LangVersion>latest</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<PropertyGroup Label="Package information">
<Version>4.1.0</Version>
<Version>5.0.0</Version>

<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>http://github.com/xabaril/Acheve.TestHost</PackageProjectUrl>
Expand Down
25 changes: 7 additions & 18 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<Project>
<PropertyGroup Label=".Net version" Condition=" '$(TargetFramework)' == 'net6.0' ">
<NetCoreVersion>6.0.36</NetCoreVersion>
<MicrosoftNETTestSdkVersion>17.9.0</MicrosoftNETTestSdkVersion>
<XUnitRunnerVisualStudioVersion>2.8.2</XUnitRunnerVisualStudioVersion>
</PropertyGroup>
<PropertyGroup Label=".Net version" Condition=" '$(TargetFramework)' == 'net7.0' ">
<NetCoreVersion>7.0.20</NetCoreVersion>
<MicrosoftNETTestSdkVersion>17.9.0</MicrosoftNETTestSdkVersion>
<XUnitRunnerVisualStudioVersion>2.8.2</XUnitRunnerVisualStudioVersion>
</PropertyGroup>
<PropertyGroup Label=".Net version" Condition=" '$(TargetFramework)' == 'net8.0' ">
<NetCoreVersion>8.0.21</NetCoreVersion>
<MicrosoftNETTestSdkVersion>18.0.0</MicrosoftNETTestSdkVersion>
<XUnitRunnerVisualStudioVersion>3.1.5</XUnitRunnerVisualStudioVersion>
<NetCoreVersion>8.0.22</NetCoreVersion>
</PropertyGroup>
<PropertyGroup Label=".Net version" Condition=" '$(TargetFramework)' == 'net9.0' ">
<NetCoreVersion>9.0.10</NetCoreVersion>
<MicrosoftNETTestSdkVersion>18.0.0</MicrosoftNETTestSdkVersion>
<XUnitRunnerVisualStudioVersion>3.1.5</XUnitRunnerVisualStudioVersion>
<NetCoreVersion>9.0.11</NetCoreVersion>
</PropertyGroup>
<PropertyGroup Label=".Net version" Condition=" '$(TargetFramework)' == 'net10.0' ">
<NetCoreVersion>10.0.1</NetCoreVersion>
</PropertyGroup>
<ItemGroup Label="General Dependencies">
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="$(NetCoreVersion)" />
Expand All @@ -27,10 +16,10 @@
</ItemGroup>
<ItemGroup Label="Testing Dependencies">
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(NetCoreVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="FluentAssertions" Version="[7.2.0]" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
</ItemGroup>
<ItemGroup Label="Github Dependencies">
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"projects": ["src", "test", "samples"],
"sdk": {
"version": "9.0.0",
"version": "10.0.0",
"rollForward": "latestMajor"
}
}
16 changes: 10 additions & 6 deletions samples/Sample.IntegrationTests/Infrastructure/TestHostFixture.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading.Tasks;
using Xunit;

namespace Sample.IntegrationTests.Infrastructure
{
public class TestHostFixture : IDisposable, IAsyncLifetime
public sealed class TestHostFixture : IDisposable, IAsyncLifetime
{
private IWebHost _host;
private IHost _host;

public TestServer Server => _host.GetTestServer();

Expand All @@ -21,10 +22,13 @@ public void Dispose()
/// <inheritdoc />
public async Task InitializeAsync()
{
_host = new WebHostBuilder()
.UseTestServer()
.UseStartup<TestStartup>()
.Build();
_host = Host.CreateDefaultBuilder()
.ConfigureWebHost(webHostBuilder =>
{
webHostBuilder
.UseStartup<TestStartup>()
.UseTestServer();
}).Build();

await _host.StartAsync();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Hosting;

namespace Sample.IntegrationTests.Infrastructure
{
public class WebApplicationFactoryFixture : WebApplicationFactory<TestStartup>
{
protected override IWebHostBuilder CreateWebHostBuilder()
protected override IHostBuilder CreateHostBuilder()
{
return WebHost.CreateDefaultBuilder();
return Host.CreateDefaultBuilder();
}

protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.UseStartup<TestStartup>()
builder
.UseStartup<TestStartup>()
.UseSolutionRelativeContentRoot("samples")
.UseTestServer();
}
Expand Down
4 changes: 0 additions & 4 deletions src/Acheve.TestHost/Routing/TestServerAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ private void AddArgumentValues(int order, object value, string argumentName,
bool canBeObjectWithMultipleFroms = false;
if (hasNoAttributes && !isPrimitive)
{
#if NET8_0_OR_GREATER
canBeObjectWithMultipleFroms = MethodInfo.GetParameters().Length == 1;
#else
canBeObjectWithMultipleFroms = false;
#endif

if (activeBodyApiController)
{
Expand Down
10 changes: 0 additions & 10 deletions src/Acheve.TestHost/Security/TestServerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,12 @@ namespace Acheve.TestHost
{
public class TestServerHandler : AuthenticationHandler<TestServerOptions>
{
#if NET8_0_OR_GREATER
public TestServerHandler(
IOptionsMonitor<TestServerOptions> options,
ILoggerFactory logger,
UrlEncoder encoder)
: base(options, logger, encoder)
{ }
#else
public TestServerHandler(
IOptionsMonitor<TestServerOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{ }
#endif

protected new TestServerEvents Events
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
using System.Reflection;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Reflection;

namespace UnitTests.Acheve.TestHost.Builders
{
public class TestServerBuilder
{
private readonly WebHostBuilder _webHostBuilder;
private readonly HostBuilder _hostBuilder;

public TestServerBuilder()
{
_webHostBuilder = new WebHostBuilder();

_hostBuilder = new HostBuilder();
}

public TestServerBuilder UseDefaultStartup()
{
_webHostBuilder.UseStartup<DefaultStartup>();
_hostBuilder.ConfigureWebHost(webHostBuilder =>
{
webHostBuilder
.UseTestServer()
.UseStartup<DefaultStartup>();
});

return this;
}


public TestServer Build()
{
return new TestServer(_webHostBuilder);
var host = _hostBuilder
.Build();

host.Start();

return host.GetTestServer();
}

class DefaultStartup
Expand Down

This file was deleted.

Loading