diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d19c12..7b7bf64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ jobs: 7.0.x 8.0.x 9.0.x + 10.0.x - name: Restore dependencies run: dotnet restore diff --git a/CHANGELOG.md b/CHANGELOG.md index 04b836e..162d10d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/Common.targets b/Common.targets index 5bd27e5..c84f041 100644 --- a/Common.targets +++ b/Common.targets @@ -1,6 +1,6 @@  - 5.6.3 + 5.7.0 preview Avanade Avanade diff --git a/src/UnitTestEx.Azure.Functions/UnitTestEx.Azure.Functions.csproj b/src/UnitTestEx.Azure.Functions/UnitTestEx.Azure.Functions.csproj index 7ec8186..edb620b 100644 --- a/src/UnitTestEx.Azure.Functions/UnitTestEx.Azure.Functions.csproj +++ b/src/UnitTestEx.Azure.Functions/UnitTestEx.Azure.Functions.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 UnitTestEx UnitTestEx UnitTestEx Azure Functions Test Extensions. diff --git a/src/UnitTestEx.Azure.ServiceBus/UnitTestEx.Azure.ServiceBus.csproj b/src/UnitTestEx.Azure.ServiceBus/UnitTestEx.Azure.ServiceBus.csproj index ef57da5..3893c71 100644 --- a/src/UnitTestEx.Azure.ServiceBus/UnitTestEx.Azure.ServiceBus.csproj +++ b/src/UnitTestEx.Azure.ServiceBus/UnitTestEx.Azure.ServiceBus.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 UnitTestEx UnitTestEx UnitTestEx Azure Functions Test Extensions. diff --git a/src/UnitTestEx.MSTest/UnitTestEx.MSTest.csproj b/src/UnitTestEx.MSTest/UnitTestEx.MSTest.csproj index 1dccf50..3f61882 100644 --- a/src/UnitTestEx.MSTest/UnitTestEx.MSTest.csproj +++ b/src/UnitTestEx.MSTest/UnitTestEx.MSTest.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 UnitTestEx.MSTest UnitTestEx MSTest UnitTestEx MSTest Test Extensions. diff --git a/src/UnitTestEx.NUnit/UnitTestEx.NUnit.csproj b/src/UnitTestEx.NUnit/UnitTestEx.NUnit.csproj index 3406a36..6957f22 100644 --- a/src/UnitTestEx.NUnit/UnitTestEx.NUnit.csproj +++ b/src/UnitTestEx.NUnit/UnitTestEx.NUnit.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 UnitTestEx.NUnit UnitTestEx NUnit UnitTestEx NUnit Test Extensions. diff --git a/src/UnitTestEx.Xunit/UnitTestEx.Xunit.csproj b/src/UnitTestEx.Xunit/UnitTestEx.Xunit.csproj index e8b0bb7..4a11daa 100644 --- a/src/UnitTestEx.Xunit/UnitTestEx.Xunit.csproj +++ b/src/UnitTestEx.Xunit/UnitTestEx.Xunit.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 UnitTestEx.Xunit UnitTestEx Xunit UnitTestEx Xunit Test Extensions. diff --git a/src/UnitTestEx/Assertors/HttpResponseMessageAssertorBaseT.cs b/src/UnitTestEx/Assertors/HttpResponseMessageAssertorBaseT.cs index e1842b4..593ec63 100644 --- a/src/UnitTestEx/Assertors/HttpResponseMessageAssertorBaseT.cs +++ b/src/UnitTestEx/Assertors/HttpResponseMessageAssertorBaseT.cs @@ -213,7 +213,7 @@ public TSelf AssertErrors(params ApiError[] errors) try { - val = GetValue>(null); + val = GetValue>(null); } catch (Exception) { @@ -295,5 +295,18 @@ public TSelf AssertNamedHeader(string name, params string[] values) return (TSelf)this; } + + /// + /// Asserts that a response header does not exist with the specified . + /// + /// The header name. + /// The instance to support fluent-style method-chaining. + 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; + } } } \ No newline at end of file diff --git a/src/UnitTestEx/UnitTestEx.csproj b/src/UnitTestEx/UnitTestEx.csproj index d6d7338..8a39f70 100644 --- a/src/UnitTestEx/UnitTestEx.csproj +++ b/src/UnitTestEx/UnitTestEx.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0;net9.0 + net6.0;net7.0;net8.0;net9.0;net10.0 UnitTestEx UnitTestEx UnitTestEx Test Extensions. @@ -39,6 +39,12 @@ + + + + + + diff --git a/tests/UnitTestEx.Api/UnitTestEx.Api.csproj b/tests/UnitTestEx.Api/UnitTestEx.Api.csproj index 907fc51..f8b3e15 100644 --- a/tests/UnitTestEx.Api/UnitTestEx.Api.csproj +++ b/tests/UnitTestEx.Api/UnitTestEx.Api.csproj @@ -1,7 +1,7 @@  - net8.0;net9.0 + net8.0;net9.0;net10.0 true latest @@ -18,4 +18,8 @@ + + + + diff --git a/tests/UnitTestEx.MSTest.Test/UnitTestEx.MSTest.Test.csproj b/tests/UnitTestEx.MSTest.Test/UnitTestEx.MSTest.Test.csproj index 19efd6d..365611a 100644 --- a/tests/UnitTestEx.MSTest.Test/UnitTestEx.MSTest.Test.csproj +++ b/tests/UnitTestEx.MSTest.Test/UnitTestEx.MSTest.Test.csproj @@ -1,7 +1,7 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 false true true diff --git a/tests/UnitTestEx.NUnit.Test/PersonControllerTest.cs b/tests/UnitTestEx.NUnit.Test/PersonControllerTest.cs index 00f7c7b..a1436c2 100644 --- a/tests/UnitTestEx.NUnit.Test/PersonControllerTest.cs +++ b/tests/UnitTestEx.NUnit.Test/PersonControllerTest.cs @@ -320,7 +320,8 @@ public void Type_IActionResult() new Assertors.ValueAssertor(test, iar, null) .ToHttpResponseMessageAssertor(hr) - .AssertNamedHeader("X-Test", "Test"); + .AssertNamedHeader("X-Test", "Test") + .AssertNoNamedHeader("X-Absent"); } } } \ No newline at end of file diff --git a/tests/UnitTestEx.NUnit.Test/UnitTestEx.NUnit.Test.csproj b/tests/UnitTestEx.NUnit.Test/UnitTestEx.NUnit.Test.csproj index a33b8cc..19722fb 100644 --- a/tests/UnitTestEx.NUnit.Test/UnitTestEx.NUnit.Test.csproj +++ b/tests/UnitTestEx.NUnit.Test/UnitTestEx.NUnit.Test.csproj @@ -1,7 +1,7 @@  - net8.0;net9.0 + net8.0;net9.0;net10.0 false preview diff --git a/tests/UnitTestEx.Xunit.Test/UnitTestEx.Xunit.Test.csproj b/tests/UnitTestEx.Xunit.Test/UnitTestEx.Xunit.Test.csproj index c7a8c47..02ab924 100644 --- a/tests/UnitTestEx.Xunit.Test/UnitTestEx.Xunit.Test.csproj +++ b/tests/UnitTestEx.Xunit.Test/UnitTestEx.Xunit.Test.csproj @@ -1,7 +1,7 @@  - net8.0;net9.0 + net8.0;net9.0;net10.0 false