Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
7.0.x
8.0.x
9.0.x
10.0.x

- name: Restore dependencies
run: dotnet restore
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Represents the **NuGet** versions.

## v5.7.0
- *Enhancement:* Added `.NET10.0` support to all `UnitTestEx` packages.
- *Enhancement:* Added `AssertNoNamedHeader` to the `HttpResponseMessageAssertor` to enable asserting that a named header is not present in the response.

## v5.6.3
- *Fixed:* `TestSetUp` fixed to load _all_ assemblies on start up (versus selective) to ensure all `OneOffTestSetUpAttribute` implementations are executed prior to any test executions.
- *Fixed:* Added `IJsonSerializer.Clone()` and `JsonElementComparerOptions.Clone` to ensure cross test contamination does not occur.
Expand Down
2 changes: 1 addition & 1 deletion Common.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>5.6.3</Version>
<Version>5.7.0</Version>
<LangVersion>preview</LangVersion>
<Authors>Avanade</Authors>
<Company>Avanade</Company>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>UnitTestEx</RootNamespace>
<Product>UnitTestEx</Product>
<Title>UnitTestEx Azure Functions Test Extensions.</Title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>UnitTestEx</RootNamespace>
<Product>UnitTestEx</Product>
<Title>UnitTestEx Azure Functions Test Extensions.</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/UnitTestEx.MSTest/UnitTestEx.MSTest.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>UnitTestEx.MSTest</RootNamespace>
<Product>UnitTestEx MSTest</Product>
<Title>UnitTestEx MSTest Test Extensions.</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/UnitTestEx.NUnit/UnitTestEx.NUnit.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>UnitTestEx.NUnit</RootNamespace>
<Product>UnitTestEx NUnit</Product>
<Title>UnitTestEx NUnit Test Extensions.</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/UnitTestEx.Xunit/UnitTestEx.Xunit.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>UnitTestEx.Xunit</RootNamespace>
<Product>UnitTestEx Xunit</Product>
<Title>UnitTestEx Xunit Test Extensions.</Title>
Expand Down
15 changes: 14 additions & 1 deletion src/UnitTestEx/Assertors/HttpResponseMessageAssertorBaseT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public TSelf AssertErrors(params ApiError[] errors)

try
{
val = GetValue<IDictionary<string, string[]>>(null);
val = GetValue<IDictionary<string, string[]>>(null);
}
catch (Exception)
{
Expand Down Expand Up @@ -295,5 +295,18 @@ public TSelf AssertNamedHeader(string name, params string[] values)

return (TSelf)this;
}

/// <summary>
/// Asserts that a response header does not exist with the specified <paramref name="name"/>.
/// </summary>
/// <param name="name">The header name.</param>
/// <returns>The <see cref="HttpResponseMessageAssertorBase{TSelf}"/> instance to support fluent-style method-chaining.</returns>
public TSelf AssertNoNamedHeader(string name)
{
if (Response.Headers.TryGetValues(name ?? throw new ArgumentNullException(nameof(name)), out var _))
Implementor.AssertFail($"The '{name}' header was found when it was expected to be absent.");

return (TSelf)this;
}
}
}
8 changes: 7 additions & 1 deletion src/UnitTestEx/UnitTestEx.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>UnitTestEx</RootNamespace>
<Product>UnitTestEx</Product>
<Title>UnitTestEx Test Extensions.</Title>
Expand Down Expand Up @@ -39,6 +39,12 @@
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
<PackageReference Include="System.Memory.Data" Version="10.0.0" />
<PackageReference Include="System.Text.Json" Version="10.0.0" />
</ItemGroup>

<Import Project="..\..\Common.targets" />

</Project>
6 changes: 5 additions & 1 deletion tests/UnitTestEx.Api/UnitTestEx.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand All @@ -18,4 +18,8 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.7" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/UnitTestEx.MSTest.Test/UnitTestEx.MSTest.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<PreserveCompilationContext>true</PreserveCompilationContext>
<IsTestProject>true</IsTestProject>
Expand Down
3 changes: 2 additions & 1 deletion tests/UnitTestEx.NUnit.Test/PersonControllerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ public void Type_IActionResult()

new Assertors.ValueAssertor<IActionResult>(test, iar, null)
.ToHttpResponseMessageAssertor(hr)
.AssertNamedHeader("X-Test", "Test");
.AssertNamedHeader("X-Test", "Test")
.AssertNoNamedHeader("X-Absent");
}
}
}
2 changes: 1 addition & 1 deletion tests/UnitTestEx.NUnit.Test/UnitTestEx.NUnit.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>preview</LangVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/UnitTestEx.Xunit.Test/UnitTestEx.Xunit.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Loading