diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ea10c0e..99b18820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ Represents the **NuGet** versions. +## v3.30.0 +- *Enhancement:* Integrated `UnitTestEx` version `5.0.0` to enable the latest capabilities and improvements. + - `CoreEx.UnitTesting.NUnit` given changes is no longer required and has been deprecated, the `UnitTestEx.NUnit` (or other) must be explicitly referenced as per testing framework being used. + - `CoreEx.UnitTesting` package updated to include only standard .NET core capabilities to follow new `UnitTestEx` pattern; new packages created to house specific as follows: + - `CoreEx.UnitTesting.Azure.Functions` created to house Azure Functions specific capabilities; + - `CoreEx.UnitTesting.Azure.ServiceBus` created to house Azure Service Bus specific capabilities. + - Existing usage will require references to the new packages as required. There should be limited need to update existing tests to use beyond the requirement for the root `UnitTestEx` namespace. The updated default within `UnitTestEx` is to expose the key capabilities from the root namespace. For example, `using UnitTestEx.NUnit`, should be replaced with `using UnitTestEx`. + ## v3.29.0 - *Enhancement:* Added `net9.0` support. - *Enhancement:* Deprecated `net7.0` support; no longer supported by [Microsoft](https://dotnet.microsoft.com/en-us/platform/support/policy). diff --git a/Common.targets b/Common.targets index b8ab6622..f3ea876f 100644 --- a/Common.targets +++ b/Common.targets @@ -1,6 +1,6 @@  - 3.29.0 + 3.30.0 preview Avanade Avanade diff --git a/CoreEx.sln b/CoreEx.sln index 01545939..6be1c777 100644 --- a/CoreEx.sln +++ b/CoreEx.sln @@ -82,8 +82,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTesting", "UnitTesting" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreEx.UnitTesting", "src\CoreEx.UnitTesting\CoreEx.UnitTesting.csproj", "{AC247FD3-5F9F-4DD2-B0CB-1C9CD1EB98D2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreEx.UnitTesting.NUnit", "src\CoreEx.UnitTesting.NUnit\CoreEx.UnitTesting.NUnit.csproj", "{91910971-4B1A-4791-9BB4-65FAB3ED3C76}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreEx.TestFunctionIso", "tests\CoreEx.TestFunctionIso\CoreEx.TestFunctionIso.csproj", "{6F7B4F1E-3C3A-4CD7-A9BF-973A5053C1C8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreEx.Test2", "tests\CoreEx.Test2\CoreEx.Test2.csproj", "{910B5894-46BC-4427-95D6-2804F06458E3}" @@ -92,6 +90,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreEx.Database.Postgres", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreEx.Data", "src\CoreEx.Data\CoreEx.Data.csproj", "{B927138A-1DCA-4BA6-A9E5-E5DA6446DABC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreEx.UnitTesting.Azure.Functions", "src\CoreEx.UnitTesting.Azure.Functions\CoreEx.UnitTesting.Azure.Functions.csproj", "{2BBB766A-D8A2-47B4-AD42-1FD96051604C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreEx.UnitTesting.Azure.ServiceBus", "src\CoreEx.UnitTesting.Azure.ServiceBus\CoreEx.UnitTesting.Azure.ServiceBus.csproj", "{CA21C777-2592-4E1A-970B-0888F21AB0D7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -202,10 +204,6 @@ Global {AC247FD3-5F9F-4DD2-B0CB-1C9CD1EB98D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC247FD3-5F9F-4DD2-B0CB-1C9CD1EB98D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC247FD3-5F9F-4DD2-B0CB-1C9CD1EB98D2}.Release|Any CPU.Build.0 = Release|Any CPU - {91910971-4B1A-4791-9BB4-65FAB3ED3C76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91910971-4B1A-4791-9BB4-65FAB3ED3C76}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91910971-4B1A-4791-9BB4-65FAB3ED3C76}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91910971-4B1A-4791-9BB4-65FAB3ED3C76}.Release|Any CPU.Build.0 = Release|Any CPU {6F7B4F1E-3C3A-4CD7-A9BF-973A5053C1C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6F7B4F1E-3C3A-4CD7-A9BF-973A5053C1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F7B4F1E-3C3A-4CD7-A9BF-973A5053C1C8}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -222,6 +220,14 @@ Global {B927138A-1DCA-4BA6-A9E5-E5DA6446DABC}.Debug|Any CPU.Build.0 = Debug|Any CPU {B927138A-1DCA-4BA6-A9E5-E5DA6446DABC}.Release|Any CPU.ActiveCfg = Release|Any CPU {B927138A-1DCA-4BA6-A9E5-E5DA6446DABC}.Release|Any CPU.Build.0 = Release|Any CPU + {2BBB766A-D8A2-47B4-AD42-1FD96051604C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BBB766A-D8A2-47B4-AD42-1FD96051604C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BBB766A-D8A2-47B4-AD42-1FD96051604C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BBB766A-D8A2-47B4-AD42-1FD96051604C}.Release|Any CPU.Build.0 = Release|Any CPU + {CA21C777-2592-4E1A-970B-0888F21AB0D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA21C777-2592-4E1A-970B-0888F21AB0D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA21C777-2592-4E1A-970B-0888F21AB0D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA21C777-2592-4E1A-970B-0888F21AB0D7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -255,11 +261,12 @@ Global {2A31E887-0340-47D2-AF80-D88D2866C80E} = {4B6BC31E-93B1-42B0-AE09-AD85AC4DB657} {D2C61D4A-2A6D-4284-BF9D-09F51BA735B8} = {4B6BC31E-93B1-42B0-AE09-AD85AC4DB657} {AC247FD3-5F9F-4DD2-B0CB-1C9CD1EB98D2} = {D2C61D4A-2A6D-4284-BF9D-09F51BA735B8} - {91910971-4B1A-4791-9BB4-65FAB3ED3C76} = {D2C61D4A-2A6D-4284-BF9D-09F51BA735B8} {6F7B4F1E-3C3A-4CD7-A9BF-973A5053C1C8} = {3145DCB9-98FB-4519-BCC0-75A22A252EDC} {910B5894-46BC-4427-95D6-2804F06458E3} = {3145DCB9-98FB-4519-BCC0-75A22A252EDC} {C042AC2A-415D-432E-83FA-B911FD9ED378} = {4B6BC31E-93B1-42B0-AE09-AD85AC4DB657} {B927138A-1DCA-4BA6-A9E5-E5DA6446DABC} = {4B6BC31E-93B1-42B0-AE09-AD85AC4DB657} + {2BBB766A-D8A2-47B4-AD42-1FD96051604C} = {D2C61D4A-2A6D-4284-BF9D-09F51BA735B8} + {CA21C777-2592-4E1A-970B-0888F21AB0D7} = {D2C61D4A-2A6D-4284-BF9D-09F51BA735B8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8B4566D2-9B22-4E27-9654-402BDBA6C744} diff --git a/nuget-publish.ps1 b/nuget-publish.ps1 index b10a2174..7a3fe4d7 100644 --- a/nuget-publish.ps1 +++ b/nuget-publish.ps1 @@ -65,7 +65,8 @@ param( "src\CoreEx.Newtonsoft", "src\CoreEx.Validation", "src\CoreEx.UnitTesting", - "src\CoreEx.UnitTesting.NUnit") + "src\CoreEx.UnitTesting.Azure.Functions", + "src\CoreEx.UnitTesting.Azure.ServiceBus") ) $ShouldPublishRemote = (![string]::IsNullOrEmpty($apiKey) -and ![string]::IsNullOrEmpty($NugetServer)) diff --git a/samples/My.Hr/My.Hr.Functions/My.Hr.Functions.csproj b/samples/My.Hr/My.Hr.Functions/My.Hr.Functions.csproj index d7c07fe5..7ab8d33f 100644 --- a/samples/My.Hr/My.Hr.Functions/My.Hr.Functions.csproj +++ b/samples/My.Hr/My.Hr.Functions/My.Hr.Functions.csproj @@ -7,7 +7,7 @@ - + diff --git a/samples/My.Hr/My.Hr.UnitTest/DatabaseTest.cs b/samples/My.Hr/My.Hr.UnitTest/DatabaseTest.cs index cd8402d9..d20dec24 100644 --- a/samples/My.Hr/My.Hr.UnitTest/DatabaseTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/DatabaseTest.cs @@ -7,7 +7,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; namespace My.Hr.UnitTest { diff --git a/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest.cs b/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest.cs index a13c35f3..2da97b50 100644 --- a/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest.cs @@ -12,7 +12,6 @@ using System.Threading.Tasks; using UnitTestEx; using UnitTestEx.Expectations; -using UnitTestEx.NUnit; using DbEx; using DbEx.Migration; using DbEx.SqlServer.Migration; @@ -77,7 +76,7 @@ public void A110_Get_Found() Assert.That(result.Messages, Has.Count.EqualTo(1)); Assert.Multiple(() => { - Assert.That(result.Messages[0].Type, Is.EqualTo(MessageType.Warning)); + Assert.That(result.Messages![0].Type, Is.EqualTo(MessageType.Warning)); Assert.That(result.Messages[0].Text, Is.EqualTo("Employee is considered old.")); }); } @@ -118,9 +117,12 @@ public void B100_GetAll_All() .AssertOK() .GetValue(); - Assert.That(v?.Items, Is.Not.Null); - Assert.That(v!.Items, Has.Count.EqualTo(4)); - Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Browne", "Jones", "Smith", "Smithers" })); + Assert.Multiple(() => + { + Assert.That(v?.Items, Is.Not.Null); + Assert.That(v!.Items, Has.Count.EqualTo(4)); + Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Browne", "Jones", "Smith", "Smithers" })); + }); } [Test] @@ -135,11 +137,14 @@ public void B110_GetAll_Paging() .AssertOK() .GetValue(); - Assert.That(v?.Items, Is.Not.Null); - Assert.That(v!.Items, Has.Count.EqualTo(2)); - Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Jones", "Smith" })); - Assert.That(v.Paging, Is.Not.Null); - Assert.That(v.Paging!.TotalCount, Is.EqualTo(4)); + Assert.Multiple(() => + { + Assert.That(v?.Items, Is.Not.Null); + Assert.That(v!.Items, Has.Count.EqualTo(2)); + Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Jones", "Smith" })); + Assert.That(v.Paging, Is.Not.Null); + }); + Assert.That(v!.Paging!.TotalCount, Is.EqualTo(4)); } [Test] @@ -166,9 +171,12 @@ public void B120_GetAll_Filter_LastName() .AssertOK() .GetValue(); - Assert.That(v?.Items, Is.Not.Null); - Assert.That(v!.Items, Has.Count.EqualTo(2)); - Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Smith", "Smithers" })); + Assert.Multiple(() => + { + Assert.That(v?.Items, Is.Not.Null); + Assert.That(v!.Items, Has.Count.EqualTo(2)); + Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Smith", "Smithers" })); + }); } [Test] @@ -181,9 +189,12 @@ public void B130_GetAll_Filter_StartDateAndGenders_OrderBy_FirstName() .AssertOK() .GetValue(); - Assert.That(v?.Items, Is.Not.Null); - Assert.That(v!.Items, Has.Count.EqualTo(2)); - Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Smith", "Browne" })); + Assert.Multiple(() => + { + Assert.That(v?.Items, Is.Not.Null); + Assert.That(v!.Items, Has.Count.EqualTo(2)); + Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Smith", "Browne" })); + }); } [Test] diff --git a/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest2.cs b/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest2.cs index 8f123e2a..f8741295 100644 --- a/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest2.cs +++ b/samples/My.Hr/My.Hr.UnitTest/EmployeeControllerTest2.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using UnitTestEx; using UnitTestEx.Expectations; -using UnitTestEx.NUnit; using My.Hr.Business.Services; namespace My.Hr.UnitTest @@ -115,7 +114,7 @@ public void B110_GetAll_Paging() Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Jones", "Smith" })); Assert.That(v.Paging, Is.Not.Null); }); - Assert.That(v.Paging!.TotalCount, Is.EqualTo(4)); + Assert.That(v!.Paging!.TotalCount, Is.EqualTo(4)); } [Test] diff --git a/samples/My.Hr/My.Hr.UnitTest/EmployeeFunctionTest.cs b/samples/My.Hr/My.Hr.UnitTest/EmployeeFunctionTest.cs index c9f4a0ae..d76af59e 100644 --- a/samples/My.Hr/My.Hr.UnitTest/EmployeeFunctionTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/EmployeeFunctionTest.cs @@ -14,7 +14,6 @@ using System.Net.Http; using System.Threading.Tasks; using UnitTestEx; -using UnitTestEx.NUnit; namespace My.Hr.UnitTest { @@ -101,9 +100,12 @@ public void B100_GetAll_All() .Run(f => f.GetAllAsync(test.CreateHttpRequest(HttpMethod.Get, "api/employees"))) .GetValue(); - Assert.That(v?.Items, Is.Not.Null); - Assert.That(v!.Items, Has.Count.EqualTo(4)); - Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Browne", "Jones", "Smith", "Smithers" })); + Assert.Multiple(() => + { + Assert.That(v?.Items, Is.Not.Null); + Assert.That(v!.Items, Has.Count.EqualTo(4)); + Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Browne", "Jones", "Smith", "Smithers" })); + }); } [Test] @@ -116,11 +118,14 @@ public void B110_GetAll_Paging() .AssertOK() .GetValue(); - Assert.That(v?.Items, Is.Not.Null); - Assert.That(v!.Items, Has.Count.EqualTo(2)); - Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Jones", "Smith" })); - Assert.That(v.Paging, Is.Not.Null); - Assert.That(v.Paging!.TotalCount, Is.EqualTo(4)); + Assert.Multiple(() => + { + Assert.That(v?.Items, Is.Not.Null); + Assert.That(v!.Items, Has.Count.EqualTo(2)); + Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Jones", "Smith" })); + Assert.That(v.Paging, Is.Not.Null); + }); + Assert.That(v!.Paging!.TotalCount, Is.EqualTo(4)); } [Test] diff --git a/samples/My.Hr/My.Hr.UnitTest/EmployeeResultControllerTest.cs b/samples/My.Hr/My.Hr.UnitTest/EmployeeResultControllerTest.cs index 1cf3452b..8a74c8f7 100644 --- a/samples/My.Hr/My.Hr.UnitTest/EmployeeResultControllerTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/EmployeeResultControllerTest.cs @@ -12,7 +12,6 @@ using System.Threading.Tasks; using UnitTestEx; using UnitTestEx.Expectations; -using UnitTestEx.NUnit; using DbEx; using DbEx.Migration; using DbEx.SqlServer.Migration; @@ -128,7 +127,7 @@ public void B110_GetAll_Paging() Assert.That(v.Items.Select(x => x.LastName).ToArray(), Is.EqualTo(new string[] { "Jones", "Smith" })); Assert.That(v.Paging, Is.Not.Null); }); - Assert.That(v.Paging!.TotalCount, Is.EqualTo(4)); + Assert.That(v!.Paging!.TotalCount, Is.EqualTo(4)); } [Test] diff --git a/samples/My.Hr/My.Hr.UnitTest/HttpTriggerQueueVerificationFunctionTest.cs b/samples/My.Hr/My.Hr.UnitTest/HttpTriggerQueueVerificationFunctionTest.cs index 0a7346a8..9d9afc21 100644 --- a/samples/My.Hr/My.Hr.UnitTest/HttpTriggerQueueVerificationFunctionTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/HttpTriggerQueueVerificationFunctionTest.cs @@ -3,7 +3,7 @@ using My.Hr.Functions; using NUnit.Framework; using System.Net.Http; -using UnitTestEx.NUnit; +using UnitTestEx; namespace My.Hr.UnitTest { diff --git a/samples/My.Hr/My.Hr.UnitTest/My.Hr.UnitTest.csproj b/samples/My.Hr/My.Hr.UnitTest/My.Hr.UnitTest.csproj index ef1f3d9f..f31defe7 100644 --- a/samples/My.Hr/My.Hr.UnitTest/My.Hr.UnitTest.csproj +++ b/samples/My.Hr/My.Hr.UnitTest/My.Hr.UnitTest.csproj @@ -20,9 +20,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -31,10 +31,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + - + + diff --git a/samples/My.Hr/My.Hr.UnitTest/ReferenceDataControllerTest.cs b/samples/My.Hr/My.Hr.UnitTest/ReferenceDataControllerTest.cs index f9cdde52..92a76751 100644 --- a/samples/My.Hr/My.Hr.UnitTest/ReferenceDataControllerTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/ReferenceDataControllerTest.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Threading.Tasks; using UnitTestEx; -using UnitTestEx.NUnit; namespace My.Hr.UnitTest { diff --git a/samples/My.Hr/My.Hr.UnitTest/ServiceBusExecuteVerificationFunctionTest.cs b/samples/My.Hr/My.Hr.UnitTest/ServiceBusExecuteVerificationFunctionTest.cs index 0225c159..86e01af3 100644 --- a/samples/My.Hr/My.Hr.UnitTest/ServiceBusExecuteVerificationFunctionTest.cs +++ b/samples/My.Hr/My.Hr.UnitTest/ServiceBusExecuteVerificationFunctionTest.cs @@ -6,7 +6,7 @@ using My.Hr.Business.External.Contracts; using My.Hr.Functions; using NUnit.Framework; -using UnitTestEx.NUnit; +using UnitTestEx; namespace My.Hr.UnitTest { diff --git a/src/CoreEx.Cosmos/CoreEx.Cosmos.csproj b/src/CoreEx.Cosmos/CoreEx.Cosmos.csproj index a8922b61..9f92eaed 100644 --- a/src/CoreEx.Cosmos/CoreEx.Cosmos.csproj +++ b/src/CoreEx.Cosmos/CoreEx.Cosmos.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/CoreEx.UnitTesting.NUnit/Abstractions/CoreExOneOffTestSetUp.cs b/src/CoreEx.UnitTesting.Azure.Functions/Abstractions/AzureFunctionsCoreExOneOffTestSetUp.cs similarity index 55% rename from src/CoreEx.UnitTesting.NUnit/Abstractions/CoreExOneOffTestSetUp.cs rename to src/CoreEx.UnitTesting.Azure.Functions/Abstractions/AzureFunctionsCoreExOneOffTestSetUp.cs index 388c1b47..742baab3 100644 --- a/src/CoreEx.UnitTesting.NUnit/Abstractions/CoreExOneOffTestSetUp.cs +++ b/src/CoreEx.UnitTesting.Azure.Functions/Abstractions/AzureFunctionsCoreExOneOffTestSetUp.cs @@ -3,14 +3,14 @@ using System.Reflection; using UnitTestEx.Abstractions; -[assembly: OneOffTestSetUp(typeof(UnitTestEx.NUnit.Abstractions.CoreExOneOffTestSetUp))] +[assembly: OneOffTestSetUp(typeof(AzureFunctionsCoreExOneOffTestSetUp))] -namespace UnitTestEx.NUnit.Abstractions +namespace UnitTestEx.Abstractions { /// /// Provides the one-off test set-up for the -related testing. /// /// Adds the to support the runtime extension inclusion. Also, changes the to the . - /// This inheits the achieving the same functionality, but is delared within this to ensure executed. - public class CoreExOneOffTestSetUp : UnitTestEx.Abstractions.CoreExOneOffTestSetUp { } + /// This inherits the achieving the same functionality, but is delared within this to ensure executed. + public class AzureFunctionsCoreExOneOffTestSetUp : CoreExOneOffTestSetUp { } } \ No newline at end of file diff --git a/src/CoreEx.UnitTesting.Azure.Functions/CoreEx.UnitTesting.Azure.Functions.csproj b/src/CoreEx.UnitTesting.Azure.Functions/CoreEx.UnitTesting.Azure.Functions.csproj new file mode 100644 index 00000000..8d232d75 --- /dev/null +++ b/src/CoreEx.UnitTesting.Azure.Functions/CoreEx.UnitTesting.Azure.Functions.csproj @@ -0,0 +1,24 @@ + + + + net6.0;net8.0;net9.0 + UnitTestEx + CoreEx + CoreEx Azure Functions UnitTesting extras. + CoreEx UnitTesting (UnitTestEx) extras. + coreex unittest unit-test test unittestex + + + + + + + + + + + + + + + diff --git a/src/CoreEx.UnitTesting.Azure.Functions/UnitTestExExtensions.cs b/src/CoreEx.UnitTesting.Azure.Functions/UnitTestExExtensions.cs new file mode 100644 index 00000000..870ac240 --- /dev/null +++ b/src/CoreEx.UnitTesting.Azure.Functions/UnitTestExExtensions.cs @@ -0,0 +1,127 @@ +// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx + +using CoreEx.AspNetCore.Http; +using CoreEx.Http; +using Microsoft.AspNetCore.Http; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net.Http; +using System.Net.Mime; +using UnitTestEx.Azure.Functions; +using Ceh = CoreEx.Http; + +namespace UnitTestEx +{ + /// + /// Provides extension methods to the core . + /// + public static class UnitTestExExtensions + { + #region FunctionTesterBase + + /// + /// Creates a new with no body. + /// + /// The tester. + /// The . + /// The requuest uri. + /// The optional . + /// The . +#if NET7_0_OR_GREATER + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Ceh.HttpRequestOptions? requestOptions = null) +#else + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, Ceh.HttpRequestOptions? requestOptions = null) +#endif + where TEntryPoint : class, new() where TSelf : FunctionTesterBase + => tester.CreateHttpRequest(httpMethod, requestUri).ApplyRequestOptions(requestOptions); + + /// + /// Creates a new with no body. + /// + /// The tester. + /// The . + /// The requuest uri. + /// The optional . + /// The optional modifier. + /// The . +#if NET7_0_OR_GREATER + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Ceh.HttpRequestOptions? requestOptions = null, Action? requestModifier = null) +#else + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, Ceh.HttpRequestOptions? requestOptions = null, Action? requestModifier = null) +#endif + where TEntryPoint : class, new() where TSelf : FunctionTesterBase + => tester.CreateHttpRequest(httpMethod, requestUri, requestModifier).ApplyRequestOptions(requestOptions); + + /// + /// Creates a new with (defaults to ). + /// + /// The tester. + /// The . + /// The requuest uri. + /// The optional body content. + /// The optional . + /// The . +#if NET7_0_OR_GREATER + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, string? body, Ceh.HttpRequestOptions? requestOptions = null) +#else + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, string? body, Ceh.HttpRequestOptions? requestOptions = null) +#endif + where TEntryPoint : class, new() where TSelf : FunctionTesterBase + => tester.CreateHttpRequest(httpMethod, requestUri, body, null, null).ApplyRequestOptions(requestOptions); + + /// + /// Creates a new with and . + /// + /// The tester. + /// The . + /// The requuest uri. + /// The optional body content. + /// The content type. Defaults to . + /// The optional . + /// The . +#if NET7_0_OR_GREATER + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, string? body, string? contentType, Ceh.HttpRequestOptions? requestOptions = null) +#else + public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, string? body, string? contentType, Ceh.HttpRequestOptions? requestOptions = null) +#endif + where TEntryPoint : class, new() where TSelf : FunctionTesterBase + => tester.CreateHttpRequest(httpMethod, requestUri, body, contentType, null).ApplyRequestOptions(requestOptions); + + /// + /// Creates a new with the JSON serialized as of . + /// + /// The tester. + /// The . + /// The requuest uri. + /// The value to JSON serialize. + /// The optional modifier. + /// The . +#if NET7_0_OR_GREATER + public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions) +#else + public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions) +#endif + where TEntryPoint : class, new() where TSelf : FunctionTesterBase + => tester.CreateJsonHttpRequest(httpMethod, requestUri, value).ApplyRequestOptions(requestOptions); + + /// + /// Creates a new with the JSON serialized as of . + /// + /// The tester. + /// The . + /// The requuest uri. + /// The value to JSON serialize. + /// The optional modifier. + /// The optional modifier. + /// The . +#if NET7_0_OR_GREATER + public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions, Action? requestModifier = null) +#else + public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions, Action? requestModifier = null) +#endif + where TEntryPoint : class, new() where TSelf : FunctionTesterBase + => tester.CreateJsonHttpRequest(httpMethod, requestUri, value, requestModifier).ApplyRequestOptions(requestOptions); + + #endregion + } +} \ No newline at end of file diff --git a/src/CoreEx.UnitTesting.NUnit/strong-name-key.snk b/src/CoreEx.UnitTesting.Azure.Functions/strong-name-key.snk similarity index 100% rename from src/CoreEx.UnitTesting.NUnit/strong-name-key.snk rename to src/CoreEx.UnitTesting.Azure.Functions/strong-name-key.snk diff --git a/src/CoreEx.UnitTesting.Azure.ServiceBus/Abstractions/AzureServiceBusCoreExOneOffTestSetUp.cs b/src/CoreEx.UnitTesting.Azure.ServiceBus/Abstractions/AzureServiceBusCoreExOneOffTestSetUp.cs new file mode 100644 index 00000000..4be6c738 --- /dev/null +++ b/src/CoreEx.UnitTesting.Azure.ServiceBus/Abstractions/AzureServiceBusCoreExOneOffTestSetUp.cs @@ -0,0 +1,16 @@ +// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx + +using System.Reflection; +using UnitTestEx.Abstractions; + +[assembly: OneOffTestSetUp(typeof(AzureServiceBusCoreExOneOffTestSetUp))] + +namespace UnitTestEx.Abstractions +{ + /// + /// Provides the one-off test set-up for the -related testing. + /// + /// Adds the to support the runtime extension inclusion. Also, changes the to the . + /// This inheits the achieving the same functionality, but is delared within this to ensure executed. + public class AzureServiceBusCoreExOneOffTestSetUp : CoreExOneOffTestSetUp { } +} \ No newline at end of file diff --git a/src/CoreEx.UnitTesting.Azure.ServiceBus/CoreEx.UnitTesting.Azure.ServiceBus.csproj b/src/CoreEx.UnitTesting.Azure.ServiceBus/CoreEx.UnitTesting.Azure.ServiceBus.csproj new file mode 100644 index 00000000..de87f408 --- /dev/null +++ b/src/CoreEx.UnitTesting.Azure.ServiceBus/CoreEx.UnitTesting.Azure.ServiceBus.csproj @@ -0,0 +1,23 @@ + + + + net6.0;net8.0;net9.0 + UnitTestEx + CoreEx + CoreEx Azure ServiceBus UnitTesting extras. + CoreEx UnitTesting (UnitTestEx) extras. + coreex unittest unit-test test unittestex + + + + + + + + + + + + + + diff --git a/src/CoreEx.UnitTesting.Azure.ServiceBus/UnitTestExExtensions.cs b/src/CoreEx.UnitTesting.Azure.ServiceBus/UnitTestExExtensions.cs new file mode 100644 index 00000000..b09fbb70 --- /dev/null +++ b/src/CoreEx.UnitTesting.Azure.ServiceBus/UnitTestExExtensions.cs @@ -0,0 +1,49 @@ +// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/CoreEx + +using Azure.Core.Amqp; +using Azure.Messaging.ServiceBus; +using CoreEx; +using CoreEx.Azure.ServiceBus; +using CoreEx.Events; +using CoreEx.Mapping.Converters; +using Microsoft.Extensions.DependencyInjection; +using System; +using UnitTestEx.Abstractions; + +namespace UnitTestEx +{ + /// + /// Provides extension methods to the core . + /// + public static class UnitTestExExtensions + { + /// + /// Creates a from the leveraging the registered to perform the underlying conversion. + /// + /// The tester. + /// The or value. + /// The . + /// This will result in the from the underlying host being instantiated. If a Services-related error occurs then consider performing a after creation to reset. + public static ServiceBusReceivedMessage CreateServiceBusMessage(this TesterBase tester, EventData @event) + { + @event.ThrowIfNull(nameof(@event)); + var message = (tester.Services.GetService() ?? new EventDataToServiceBusConverter(tester.Services.GetService(), tester.Services.GetService>())).Convert(@event).GetRawAmqpMessage(); + return tester.CreateServiceBusMessage(message); + } + + /// + /// Creates a from the leveraging the registered to perform the underlying conversion. + /// + /// The tester. + /// The or value. + /// Optional modifier than enables the message to be further configured. + /// The . + /// This will result in the from the underlying host being instantiated. If a Services-related error occurs then consider performing a after creation to reset. + public static ServiceBusReceivedMessage CreateServiceBusMessage(this TesterBase tester, EventData @event, Action? messageModify) + { + @event.ThrowIfNull(nameof(@event)); + var message = (tester.Services.GetService() ?? new EventDataToServiceBusConverter(tester.Services.GetService(), tester.Services.GetService>())).Convert(@event).GetRawAmqpMessage(); + return tester.CreateServiceBusMessage(message, messageModify); + } + } +} \ No newline at end of file diff --git a/src/CoreEx.UnitTesting.Azure.ServiceBus/strong-name-key.snk b/src/CoreEx.UnitTesting.Azure.ServiceBus/strong-name-key.snk new file mode 100644 index 00000000..5bced390 Binary files /dev/null and b/src/CoreEx.UnitTesting.Azure.ServiceBus/strong-name-key.snk differ diff --git a/src/CoreEx.UnitTesting.NUnit/CoreEx.UnitTesting.NUnit.csproj b/src/CoreEx.UnitTesting.NUnit/CoreEx.UnitTesting.NUnit.csproj deleted file mode 100644 index 1ee65143..00000000 --- a/src/CoreEx.UnitTesting.NUnit/CoreEx.UnitTesting.NUnit.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net6.0;net8.0;net9.0 - UnitTestEx.NUnit - CoreEx - CoreEx NUnit UnitTesting extras. - CoreEx NUnit UnitTesting (UnitTestEx) extras. - coreex unittest unit-test test unittestex nunit - - - - - - - - - - - - - diff --git a/src/CoreEx.UnitTesting/CoreEx.UnitTesting.csproj b/src/CoreEx.UnitTesting/CoreEx.UnitTesting.csproj index d7fa2771..8d44ddcd 100644 --- a/src/CoreEx.UnitTesting/CoreEx.UnitTesting.csproj +++ b/src/CoreEx.UnitTesting/CoreEx.UnitTesting.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/CoreEx.UnitTesting/README.md b/src/CoreEx.UnitTesting/README.md index c128be8a..aff4d024 100644 --- a/src/CoreEx.UnitTesting/README.md +++ b/src/CoreEx.UnitTesting/README.md @@ -6,7 +6,7 @@ The `CoreEx.UnitTesting` namespace extends [_UnitTestEx_](https://github.com/Ava ## Motivation -To improce and simplify the unit testing of _CoreEx_ related code. +To improve and simplify the unit testing of _CoreEx_ related code.
@@ -28,4 +28,4 @@ GenericTester.Create() "Name is required.", "Price must be between 0 and 100.") .Validation().With(new Product { Price = 450.95m }) -``` +``` \ No newline at end of file diff --git a/src/CoreEx.UnitTesting/UnitTestExExtensions.cs b/src/CoreEx.UnitTesting/UnitTestExExtensions.cs index 8f10a23d..6fc2567b 100644 --- a/src/CoreEx.UnitTesting/UnitTestExExtensions.cs +++ b/src/CoreEx.UnitTesting/UnitTestExExtensions.cs @@ -10,7 +10,6 @@ using CoreEx.Http; using CoreEx.Mapping.Converters; using CoreEx.Validation; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; @@ -24,7 +23,6 @@ using UnitTestEx.Abstractions; using UnitTestEx.AspNetCore; using UnitTestEx.Assertors; -using UnitTestEx.Functions; using UnitTestEx.Generic; using UnitTestEx.Json; using Ceh = CoreEx.Http; @@ -93,113 +91,6 @@ public static IServiceScope CreateClientScope(this HttpTesterBase tester #endregion - #region FunctionTesterBase - - /// - /// Creates a new with no body. - /// - /// The tester. - /// The . - /// The requuest uri. - /// The optional . - /// The . -#if NET7_0_OR_GREATER - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Ceh.HttpRequestOptions? requestOptions = null) -#else - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, Ceh.HttpRequestOptions? requestOptions = null) -#endif - where TEntryPoint : class, new() where TSelf : FunctionTesterBase - => tester.CreateHttpRequest(httpMethod, requestUri).ApplyRequestOptions(requestOptions); - - /// - /// Creates a new with no body. - /// - /// The tester. - /// The . - /// The requuest uri. - /// The optional . - /// The optional modifier. - /// The . -#if NET7_0_OR_GREATER - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Ceh.HttpRequestOptions? requestOptions = null, Action? requestModifier = null) -#else - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, Ceh.HttpRequestOptions? requestOptions = null, Action? requestModifier = null) -#endif - where TEntryPoint : class, new() where TSelf : FunctionTesterBase - => tester.CreateHttpRequest(httpMethod, requestUri, requestModifier).ApplyRequestOptions(requestOptions); - - /// - /// Creates a new with (defaults to ). - /// - /// The tester. - /// The . - /// The requuest uri. - /// The optional body content. - /// The optional . - /// The . -#if NET7_0_OR_GREATER - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, string? body, Ceh.HttpRequestOptions? requestOptions = null) -#else - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, string? body, Ceh.HttpRequestOptions? requestOptions = null) -#endif - where TEntryPoint : class, new() where TSelf : FunctionTesterBase - => tester.CreateHttpRequest(httpMethod, requestUri, body, null, null).ApplyRequestOptions(requestOptions); - - /// - /// Creates a new with and . - /// - /// The tester. - /// The . - /// The requuest uri. - /// The optional body content. - /// The content type. Defaults to . - /// The optional . - /// The . -#if NET7_0_OR_GREATER - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, string? body, string? contentType, Ceh.HttpRequestOptions? requestOptions = null) -#else - public static HttpRequest CreateHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, string? body, string? contentType, Ceh.HttpRequestOptions? requestOptions = null) -#endif - where TEntryPoint : class, new() where TSelf : FunctionTesterBase - => tester.CreateHttpRequest(httpMethod, requestUri, body, contentType, null).ApplyRequestOptions(requestOptions); - - /// - /// Creates a new with the JSON serialized as of . - /// - /// The tester. - /// The . - /// The requuest uri. - /// The value to JSON serialize. - /// The optional modifier. - /// The . -#if NET7_0_OR_GREATER - public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions) -#else - public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions) -#endif - where TEntryPoint : class, new() where TSelf : FunctionTesterBase - => tester.CreateJsonHttpRequest(httpMethod, requestUri, value).ApplyRequestOptions(requestOptions); - - /// - /// Creates a new with the JSON serialized as of . - /// - /// The tester. - /// The . - /// The requuest uri. - /// The value to JSON serialize. - /// The optional modifier. - /// The optional modifier. - /// The . -#if NET7_0_OR_GREATER - public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions, Action? requestModifier = null) -#else - public static HttpRequest CreateJsonHttpRequest(this FunctionTesterBase tester, HttpMethod httpMethod, string? requestUri, object? value, Ceh.HttpRequestOptions? requestOptions, Action? requestModifier = null) -#endif - where TEntryPoint : class, new() where TSelf : FunctionTesterBase - => tester.CreateJsonHttpRequest(httpMethod, requestUri, value, requestModifier).ApplyRequestOptions(requestOptions); - - #endregion - #region ActionResultAssertor /// @@ -545,40 +436,5 @@ void rm(HttpRequestMessage hr) } #endregion - - #region TesterBase - - /// - /// Creates a from the leveraging the registered to perform the underlying conversion. - /// - /// The . - /// The tester. - /// The or value. - /// The . - /// This will result in the from the underlying host being instantiated. If a Services-related error occurs then consider performing a after creation to reset. - public static ServiceBusReceivedMessage CreateServiceBusMessage(this TesterBase tester, EventData @event) where TSelf : TesterBase - { - @event.ThrowIfNull(nameof(@event)); - var message = (tester.Services.GetService() ?? new EventDataToServiceBusConverter(tester.Services.GetService(), tester.Services.GetService>())).Convert(@event).GetRawAmqpMessage(); - return tester.CreateServiceBusMessage(message); - } - - /// - /// Creates a from the leveraging the registered to perform the underlying conversion. - /// - /// The . - /// The tester. - /// The or value. - /// Optional modifier than enables the message to be further configured. - /// The . - /// This will result in the from the underlying host being instantiated. If a Services-related error occurs then consider performing a after creation to reset. - public static ServiceBusReceivedMessage CreateServiceBusMessage(this TesterBase tester, EventData @event, Action? messageModify) where TSelf : TesterBase - { - @event.ThrowIfNull(nameof(@event)); - var message = (tester.Services.GetService() ?? new EventDataToServiceBusConverter(tester.Services.GetService(), tester.Services.GetService>())).Convert(@event).GetRawAmqpMessage(); - return tester.CreateServiceBusMessage(message, messageModify); - } - - #endregion } } \ No newline at end of file diff --git a/src/CoreEx.UnitTesting.NUnit/UsingApiTester.cs b/src/CoreEx.UnitTesting/UsingApiTester.cs similarity index 93% rename from src/CoreEx.UnitTesting.NUnit/UsingApiTester.cs rename to src/CoreEx.UnitTesting/UsingApiTester.cs index fb91abae..24191932 100644 --- a/src/CoreEx.UnitTesting.NUnit/UsingApiTester.cs +++ b/src/CoreEx.UnitTesting/UsingApiTester.cs @@ -6,14 +6,14 @@ using System.Net.Http; using UnitTestEx.AspNetCore; -namespace UnitTestEx.NUnit +namespace UnitTestEx { /// /// Provides a shared class to enable usage of the same underlying instance across multiple tests. /// /// The API startup . /// Implements so should be automatically disposed off by the test framework host. - public abstract class UsingApiTester : Internal.ApiTester where TEntryPoint : class + public abstract class UsingApiTester : ApiTester where TEntryPoint : class { /// /// Gets the ; i.e. itself. diff --git a/tests/CoreEx.Cosmos.Test/CoreEx.Cosmos.Test.csproj b/tests/CoreEx.Cosmos.Test/CoreEx.Cosmos.Test.csproj index bc790c99..75c92137 100644 --- a/tests/CoreEx.Cosmos.Test/CoreEx.Cosmos.Test.csproj +++ b/tests/CoreEx.Cosmos.Test/CoreEx.Cosmos.Test.csproj @@ -18,11 +18,11 @@ - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -34,7 +34,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/tests/CoreEx.Solace.Test/CoreEx.Solace.Test.csproj b/tests/CoreEx.Solace.Test/CoreEx.Solace.Test.csproj index 7461ef4e..5b23f8fa 100644 --- a/tests/CoreEx.Solace.Test/CoreEx.Solace.Test.csproj +++ b/tests/CoreEx.Solace.Test/CoreEx.Solace.Test.csproj @@ -13,10 +13,10 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/CoreEx.Test/CoreEx.Test.csproj b/tests/CoreEx.Test/CoreEx.Test.csproj index 7e607c3d..1a5bb763 100644 --- a/tests/CoreEx.Test/CoreEx.Test.csproj +++ b/tests/CoreEx.Test/CoreEx.Test.csproj @@ -8,9 +8,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -23,7 +23,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + @@ -34,7 +34,8 @@ - + + diff --git a/tests/CoreEx.Test/Framework/Caching/RequestCacheTest.cs b/tests/CoreEx.Test/Framework/Caching/RequestCacheTest.cs index 143065df..6333735b 100644 --- a/tests/CoreEx.Test/Framework/Caching/RequestCacheTest.cs +++ b/tests/CoreEx.Test/Framework/Caching/RequestCacheTest.cs @@ -15,8 +15,11 @@ public void CacheKeyEntityKeyPrecedence() var rc = new RequestCache(); rc.SetValue(e); - Assert.That(rc.TryGetValue(new CompositeKey(1), out Entity? value), Is.False); - Assert.That(rc.TryGetValue(new CompositeKey(2), out value), Is.True); + Assert.Multiple(() => + { + Assert.That(rc.TryGetValue(new CompositeKey(1), out Entity? value), Is.False); + Assert.That(rc.TryGetValue(new CompositeKey(2), out value), Is.True); + }); } } diff --git a/tests/CoreEx.Test/Framework/Data/QueryArgsConfigTest.cs b/tests/CoreEx.Test/Framework/Data/QueryArgsConfigTest.cs index 57abe1e8..318cf78d 100644 --- a/tests/CoreEx.Test/Framework/Data/QueryArgsConfigTest.cs +++ b/tests/CoreEx.Test/Framework/Data/QueryArgsConfigTest.cs @@ -45,8 +45,11 @@ private static void AssertFilter(QueryArgsConfig config, string? filter, string private static void AssertException(QueryArgsConfig config, string? filter, string expected) { var result = config.FilterParser.Parse(filter); - Assert.That(result.IsFailure, Is.True); - Assert.That(result.Error, Is.TypeOf()); + Assert.Multiple(() => + { + Assert.That(result.IsFailure, Is.True); + Assert.That(result.Error, Is.TypeOf()); + }); var ex = (QueryFilterParserException)result.Error; diff --git a/tests/CoreEx.Test/Framework/Entities/CompositeKeyTest.cs b/tests/CoreEx.Test/Framework/Entities/CompositeKeyTest.cs index 90105ec0..4c1720c8 100644 --- a/tests/CoreEx.Test/Framework/Entities/CompositeKeyTest.cs +++ b/tests/CoreEx.Test/Framework/Entities/CompositeKeyTest.cs @@ -80,40 +80,58 @@ public void KeyCopy() public void KeyToString_And_CreateFromString() { var ck = new CompositeKey(); - Assert.That(ck.ToString(), Is.Null); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(1)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.Null); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(1)); + }); Assert.That(ck.Args[0], Is.Null); int? iv = null; ck = new CompositeKey(iv); - Assert.That(ck.ToString(), Is.Null); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(1)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.Null); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(1)); + }); Assert.That(ck.Args[0], Is.Null); ck = new CompositeKey(88); - Assert.That(ck.ToString(), Is.EqualTo("88")); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(1)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.EqualTo("88")); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(1)); + }); Assert.That(ck.Args[0], Is.EqualTo(88)); ck = new CompositeKey("abc"); - Assert.That(ck.ToString(), Is.EqualTo("abc")); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(1)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.EqualTo("abc")); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(1)); + }); Assert.That(ck.Args[0], Is.EqualTo("abc")); ck = new CompositeKey(""); - Assert.That(ck.ToString(), Is.EqualTo(string.Empty)); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(1)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.EqualTo(string.Empty)); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(1)); + }); Assert.That(ck.Args[0], Is.Null); ck = new CompositeKey(null, null); - Assert.That(ck.ToString(), Is.EqualTo(",")); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(2)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.EqualTo(",")); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(2)); + }); Assert.Multiple(() => { Assert.That(ck.Args[0], Is.Null); @@ -124,9 +142,12 @@ public void KeyToString_And_CreateFromString() new DateTime(1970, 01, 22, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2000, 01, 22, 20, 59, 43, DateTimeKind.Utc), new DateTimeOffset(2000, 01, 22, 20, 59, 43, TimeSpan.FromHours(-8))); Console.WriteLine(ck.ToString()); - Assert.That(ck.ToString(), Is.EqualTo("text,x,-32768,-2147483648,-9223372036854775808,65535,4294967295,18446744073709551615,8bd5f616-ed6b-4fc5-9cb8-4472cc8955fc,1970-01-22T00:00:00.0000000,2000-01-22T20:59:43.0000000Z,2000-01-22T20:59:43.0000000-08:00")); - Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), new Type[] { typeof(string), typeof(char), typeof(short), typeof(int), typeof(long), typeof(ushort), typeof(uint), typeof(ulong), typeof(Guid), typeof(DateTime), typeof(DateTime), typeof(DateTimeOffset) }, out ck), Is.True); - Assert.That(ck.Args, Has.Length.EqualTo(12)); + Assert.Multiple(() => + { + Assert.That(ck.ToString(), Is.EqualTo("text,x,-32768,-2147483648,-9223372036854775808,65535,4294967295,18446744073709551615,8bd5f616-ed6b-4fc5-9cb8-4472cc8955fc,1970-01-22T00:00:00.0000000,2000-01-22T20:59:43.0000000Z,2000-01-22T20:59:43.0000000-08:00")); + Assert.That(CompositeKey.TryCreateFromString(ck.ToString(), new Type[] { typeof(string), typeof(char), typeof(short), typeof(int), typeof(long), typeof(ushort), typeof(uint), typeof(ulong), typeof(Guid), typeof(DateTime), typeof(DateTime), typeof(DateTimeOffset) }, out ck), Is.True); + Assert.That(ck.Args, Has.Length.EqualTo(12)); + }); Assert.Multiple(() => { Assert.That(ck.Args[0], Is.EqualTo("text")); diff --git a/tests/CoreEx.Test/Framework/Events/CloudEventSerializerTest.cs b/tests/CoreEx.Test/Framework/Events/CloudEventSerializerTest.cs index 545ad541..4cefd38e 100644 --- a/tests/CoreEx.Test/Framework/Events/CloudEventSerializerTest.cs +++ b/tests/CoreEx.Test/Framework/Events/CloudEventSerializerTest.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.Events { diff --git a/tests/CoreEx.Test/Framework/Events/EventDataFormatterTest.cs b/tests/CoreEx.Test/Framework/Events/EventDataFormatterTest.cs index 5d0a7768..c1b14642 100644 --- a/tests/CoreEx.Test/Framework/Events/EventDataFormatterTest.cs +++ b/tests/CoreEx.Test/Framework/Events/EventDataFormatterTest.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using System; using System.Text.Json.Serialization; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.Events { diff --git a/tests/CoreEx.Test/Framework/Events/EventDataSerializerTest.cs b/tests/CoreEx.Test/Framework/Events/EventDataSerializerTest.cs index bd1d77fc..6ab9a951 100644 --- a/tests/CoreEx.Test/Framework/Events/EventDataSerializerTest.cs +++ b/tests/CoreEx.Test/Framework/Events/EventDataSerializerTest.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using System; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; using Nsj = Newtonsoft.Json; namespace CoreEx.Test.Framework.Events diff --git a/tests/CoreEx.Test/Framework/FluentValidation/HttpRequestTest.cs b/tests/CoreEx.Test/Framework/FluentValidation/HttpRequestTest.cs index d9569c7d..84f989b3 100644 --- a/tests/CoreEx.Test/Framework/FluentValidation/HttpRequestTest.cs +++ b/tests/CoreEx.Test/Framework/FluentValidation/HttpRequestTest.cs @@ -6,7 +6,7 @@ using NUnit.Framework; using System.Net.Http; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.FluentValidation { diff --git a/tests/CoreEx.Test/Framework/FluentValidation/ServiceBusTriggerExecutorTest.cs b/tests/CoreEx.Test/Framework/FluentValidation/ServiceBusTriggerExecutorTest.cs index bdd8c068..c26b95b0 100644 --- a/tests/CoreEx.Test/Framework/FluentValidation/ServiceBusTriggerExecutorTest.cs +++ b/tests/CoreEx.Test/Framework/FluentValidation/ServiceBusTriggerExecutorTest.cs @@ -6,7 +6,7 @@ using Moq; using NUnit.Framework; using System.Collections.Generic; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.FluentValidation { diff --git a/tests/CoreEx.Test/Framework/Hosting/Work/WorkStateOrchestratorTest.cs b/tests/CoreEx.Test/Framework/Hosting/Work/WorkStateOrchestratorTest.cs index f7957a14..63fac744 100644 --- a/tests/CoreEx.Test/Framework/Hosting/Work/WorkStateOrchestratorTest.cs +++ b/tests/CoreEx.Test/Framework/Hosting/Work/WorkStateOrchestratorTest.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.Hosting.Work diff --git a/tests/CoreEx.Test/Framework/Http/HttpResultTest.cs b/tests/CoreEx.Test/Framework/Http/HttpResultTest.cs index 91f807f7..eacdff25 100644 --- a/tests/CoreEx.Test/Framework/Http/HttpResultTest.cs +++ b/tests/CoreEx.Test/Framework/Http/HttpResultTest.cs @@ -38,8 +38,11 @@ public async Task Messages() var hr = await HttpResult.CreateAsync(r); Assert.That(hr, Is.Not.Null); Assert.That(hr.Messages, Has.Count.EqualTo(1)); - Assert.That(hr.Messages[0].Type, Is.EqualTo(CoreEx.Entities.MessageType.Warning)); - Assert.That(hr.Messages[0].Text, Is.EqualTo("Please renew licence.")); + Assert.Multiple(() => + { + Assert.That(hr.Messages[0].Type, Is.EqualTo(CoreEx.Entities.MessageType.Warning)); + Assert.That(hr.Messages[0].Text, Is.EqualTo("Please renew licence.")); + }); } } } \ No newline at end of file diff --git a/tests/CoreEx.Test/Framework/Http/TypedHttpClientCoreTest.cs b/tests/CoreEx.Test/Framework/Http/TypedHttpClientCoreTest.cs index a2408bd2..d78381be 100644 --- a/tests/CoreEx.Test/Framework/Http/TypedHttpClientCoreTest.cs +++ b/tests/CoreEx.Test/Framework/Http/TypedHttpClientCoreTest.cs @@ -10,7 +10,7 @@ using CoreEx.TestFunction; using CoreEx.TestFunction.Models; using NUnit.Framework; -using UnitTestEx.NUnit; +using UnitTestEx; using HttpRequestOptions = CoreEx.Http.HttpRequestOptions; namespace CoreEx.Test.Framework.Http diff --git a/tests/CoreEx.Test/Framework/Http/TypedMapperHttpClientBaseTest.cs b/tests/CoreEx.Test/Framework/Http/TypedMapperHttpClientBaseTest.cs index 8e3d3fb3..dd702bb0 100644 --- a/tests/CoreEx.Test/Framework/Http/TypedMapperHttpClientBaseTest.cs +++ b/tests/CoreEx.Test/Framework/Http/TypedMapperHttpClientBaseTest.cs @@ -7,7 +7,7 @@ using System.Net.Http; using System.Threading.Tasks; using System.Web.Http; -using UnitTestEx.Mocking; +using UnitTestEx; namespace CoreEx.Test.Framework.Http { @@ -21,7 +21,7 @@ public async Task MapSuccess() m.Register(new CustomerMapper()); m.Register(new BackendMapper()); - var mcf = UnitTestEx.NUnit.MockHttpClientFactory.Create(); + var mcf = MockHttpClientFactory.Create(); mcf.CreateDefaultClient().Request(HttpMethod.Post, "test").WithJsonBody(new Backend { First = "John", Last = "Doe" }).Respond.WithJson(new Backend { First = "John", Last = "Doe" }); var mc = new TypedMappedHttpClient(mcf.GetHttpClient()!, m); @@ -49,7 +49,7 @@ public async Task MapServerError() m.Register(new CustomerMapper()); m.Register(new BackendMapper()); - var mcf = UnitTestEx.NUnit.MockHttpClientFactory.Create(); + var mcf = MockHttpClientFactory.Create(); mcf.CreateDefaultClient().Request(HttpMethod.Post, "test").WithJsonBody(new Backend { First = "John", Last = "Doe" }).Respond.With(HttpStatusCode.InternalServerError); var mc = new TypedMappedHttpClient(mcf.GetHttpClient()!, m); @@ -76,7 +76,7 @@ public async Task MapJsonError() m.Register(new CustomerMapper()); m.Register(new BackendMapper()); - var mcf = UnitTestEx.NUnit.MockHttpClientFactory.Create(); + var mcf = MockHttpClientFactory.Create(); mcf.CreateDefaultClient().Request(HttpMethod.Post, "test").WithJsonBody(new Backend { First = "John", Last = "Doe" }).Respond.WithJson("{\"first\":\"Dave\",\"age\":\"ten\"}"); var mc = new TypedMappedHttpClient(mcf.GetHttpClient()!, m); diff --git a/tests/CoreEx.Test/Framework/Messaging/Azure/ServiceBus/ServiceBusSubscriberTest.cs b/tests/CoreEx.Test/Framework/Messaging/Azure/ServiceBus/ServiceBusSubscriberTest.cs index 95c988a3..9e32d82f 100644 --- a/tests/CoreEx.Test/Framework/Messaging/Azure/ServiceBus/ServiceBusSubscriberTest.cs +++ b/tests/CoreEx.Test/Framework/Messaging/Azure/ServiceBus/ServiceBusSubscriberTest.cs @@ -9,7 +9,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.Messaging.Azure.ServiceBus { diff --git a/tests/CoreEx.Test/Framework/RefData/ReferenceDataTest.cs b/tests/CoreEx.Test/Framework/RefData/ReferenceDataTest.cs index c877a1c8..0539c222 100644 --- a/tests/CoreEx.Test/Framework/RefData/ReferenceDataTest.cs +++ b/tests/CoreEx.Test/Framework/RefData/ReferenceDataTest.cs @@ -18,7 +18,7 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; using Nsj = Newtonsoft.Json; using Stj = System.Text.Json; using CoreEx.AspNetCore.Http; diff --git a/tests/CoreEx.Test/Framework/Results/ResultGoTest.cs b/tests/CoreEx.Test/Framework/Results/ResultGoTest.cs index d9b71615..9153dc8c 100644 --- a/tests/CoreEx.Test/Framework/Results/ResultGoTest.cs +++ b/tests/CoreEx.Test/Framework/Results/ResultGoTest.cs @@ -5,7 +5,6 @@ using System.Net.Http; using System.Threading.Tasks; using UnitTestEx; -using UnitTestEx.NUnit; namespace CoreEx.Test.Framework.Results { diff --git a/tests/CoreEx.Test/Framework/UnitTesting/AgentTest.cs b/tests/CoreEx.Test/Framework/UnitTesting/AgentTest.cs index 49c2e0be..d859c0c1 100644 --- a/tests/CoreEx.Test/Framework/UnitTesting/AgentTest.cs +++ b/tests/CoreEx.Test/Framework/UnitTesting/AgentTest.cs @@ -1,6 +1,5 @@ using CoreEx.TestApi; using NUnit.Framework; -using UnitTestEx.NUnit; using UnitTestEx; using Microsoft.Extensions.Logging; using System.Net.Http; diff --git a/tests/CoreEx.Test/Framework/UnitTesting/ExpectationsTest.cs b/tests/CoreEx.Test/Framework/UnitTesting/ExpectationsTest.cs index 147be650..94ed1893 100644 --- a/tests/CoreEx.Test/Framework/UnitTesting/ExpectationsTest.cs +++ b/tests/CoreEx.Test/Framework/UnitTesting/ExpectationsTest.cs @@ -5,7 +5,7 @@ using System.Net.Http; using System.Threading.Tasks; using UnitTestEx.Expectations; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.Framework.UnitTesting { diff --git a/tests/CoreEx.Test/Framework/UnitTesting/ValidationTest.cs b/tests/CoreEx.Test/Framework/UnitTesting/ValidationTest.cs index 893e83be..f394a597 100644 --- a/tests/CoreEx.Test/Framework/UnitTesting/ValidationTest.cs +++ b/tests/CoreEx.Test/Framework/UnitTesting/ValidationTest.cs @@ -1,5 +1,4 @@ using NUnit.Framework; -using UnitTestEx.NUnit; using UnitTestEx; using UnitTestEx.Expectations; using CoreEx; diff --git a/tests/CoreEx.Test/Framework/WebApis/WebApiPublisherTest.cs b/tests/CoreEx.Test/Framework/WebApis/WebApiPublisherTest.cs index 6c62a09e..635af5f1 100644 --- a/tests/CoreEx.Test/Framework/WebApis/WebApiPublisherTest.cs +++ b/tests/CoreEx.Test/Framework/WebApis/WebApiPublisherTest.cs @@ -6,14 +6,13 @@ using NUnit.Framework; using System.Net.Http; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; using CoreEx.Mapping; using Microsoft.Extensions.DependencyInjection; using CoreEx.Hosting.Work; using System; using Microsoft.AspNetCore.Mvc; using System.Net; -using UnitTestEx; namespace CoreEx.Test.Framework.WebApis { @@ -331,7 +330,7 @@ public void Publish_With_Work_State() var ws2 = wso.GetAsync(ed[0].Id!).Result; Assert.That(ws2, Is.Not.Null); - Assert.That(ws2.Status, Is.EqualTo(WorkStatus.Created)); + Assert.That(ws2!.Status, Is.EqualTo(WorkStatus.Created)); ObjectComparer.Assert(ws, ws2); } @@ -545,7 +544,7 @@ public void CancelWorkStatus_Success() Assert.That(ws, Is.Not.Null); Assert.Multiple(() => { - Assert.That(ws.Status, Is.EqualTo(WorkStatus.Cancelled)); + Assert.That(ws!.Status, Is.EqualTo(WorkStatus.Cancelled)); Assert.That(ws.Reason, Is.EqualTo("No reason was specified.")); }); } diff --git a/tests/CoreEx.Test/Framework/WebApis/WebApiRequestOptionsTest.cs b/tests/CoreEx.Test/Framework/WebApis/WebApiRequestOptionsTest.cs index 371ba8e5..107edc7f 100644 --- a/tests/CoreEx.Test/Framework/WebApis/WebApiRequestOptionsTest.cs +++ b/tests/CoreEx.Test/Framework/WebApis/WebApiRequestOptionsTest.cs @@ -4,7 +4,7 @@ using CoreEx.TestFunction; using NUnit.Framework; using System.Net.Http; -using UnitTestEx.NUnit; +using UnitTestEx; using HttpRequestOptions = CoreEx.Http.HttpRequestOptions; namespace CoreEx.Test.Framework.WebApis diff --git a/tests/CoreEx.Test/Framework/WebApis/WebApiTest.cs b/tests/CoreEx.Test/Framework/WebApis/WebApiTest.cs index a47bc690..16ebcf95 100644 --- a/tests/CoreEx.Test/Framework/WebApis/WebApiTest.cs +++ b/tests/CoreEx.Test/Framework/WebApis/WebApiTest.cs @@ -15,10 +15,7 @@ using System.Threading; using System.Threading.Tasks; using UnitTestEx; -using UnitTestEx.NUnit; using HttpRequestOptions = CoreEx.Http.HttpRequestOptions; -using UnitTestEx.Functions; -using UnitTestEx.Hosting; using CoreEx.AspNetCore.Http; namespace CoreEx.Test.Framework.WebApis @@ -233,7 +230,7 @@ public void GetAsync_WithGenETagValue() var p = test.JsonSerializer.Deserialize(vcr.Content!); Assert.That(p, Is.Not.Null); - Assert.That(p.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); + Assert.That(p!.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); } [Test] @@ -251,7 +248,7 @@ public void GetAsync_WithGenETagValue_QueryString() var p = test.JsonSerializer.Deserialize(vcr.Content!); Assert.That(p, Is.Not.Null); - Assert.That(p.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); + Assert.That(p!.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); } [Test] @@ -408,10 +405,16 @@ public void GetAsync_WithMessages_SuccessStatusCode() .Result as ValueContentResult; Assert.That(result, Is.Not.Null); - Assert.That(result.Messages, Is.Not.Null); - Assert.That(result.Messages, Has.Count.EqualTo(1)); - Assert.That(result.Messages[0].Type, Is.EqualTo(MessageType.Warning)); - Assert.That(result.Messages[0].Text, Is.EqualTo("Please renew licence.")); + Assert.Multiple(() => + { + Assert.That(result!.Messages, Is.Not.Null); + Assert.That(result.Messages, Has.Count.EqualTo(1)); + }); + Assert.Multiple(() => + { + Assert.That(result!.Messages![0].Type, Is.EqualTo(MessageType.Warning)); + Assert.That(result.Messages[0].Text, Is.EqualTo("Please renew licence.")); + }); } [Test] @@ -713,7 +716,7 @@ public void PatchAsync_AutoConcurrency_Matched() .AssertValue(new Person { Id = 13, Name = "Gazza", ETag = "tEEokPXk+4Q5MoiGqyAs1+6A00e2ww59Zm57LJgvBcg=" }); } - private static HttpRequest CreatePatchRequest(UnitTestEx.NUnit.Internal.FunctionTester test, string? json, string? etag = null) + private static HttpRequest CreatePatchRequest(UnitTestEx.Azure.Functions.FunctionTester test, string? json, string? etag = null) => test.CreateHttpRequest(HttpMethod.Patch, "https://unittest", json, HttpConsts.MergePatchMediaTypeName, hr => hr.ApplyRequestOptions(new HttpRequestOptions { ETag = etag })); private class Person : IIdentifier, IETag diff --git a/tests/CoreEx.Test/Framework/WebApis/WebApiWithResultTest.cs b/tests/CoreEx.Test/Framework/WebApis/WebApiWithResultTest.cs index 50dcab2b..0547e0b7 100644 --- a/tests/CoreEx.Test/Framework/WebApis/WebApiWithResultTest.cs +++ b/tests/CoreEx.Test/Framework/WebApis/WebApiWithResultTest.cs @@ -15,7 +15,6 @@ using System.Net.Http; using System.Threading.Tasks; using UnitTestEx; -using UnitTestEx.NUnit; using HttpRequestOptions = CoreEx.Http.HttpRequestOptions; namespace CoreEx.Test.Framework.WebApis @@ -86,7 +85,7 @@ public void GetWithResultAsync_WithGenETagValue() var p = test.JsonSerializer.Deserialize(vcr.Content!); Assert.That(p, Is.Not.Null); - Assert.That(p.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); + Assert.That(p!.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); } [Test] @@ -104,7 +103,7 @@ public void GetWithResultAsync_WithGenETagValue_QueryString() var p = test.JsonSerializer.Deserialize(vcr.Content!); Assert.That(p, Is.Not.Null); - Assert.That(p.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); + Assert.That(p!.ETag, Is.EqualTo("iVsGVb/ELj5dvXpe3ImuOy/vxLIJnUtU2b8nIfpX5PM=")); } [Test] @@ -602,7 +601,7 @@ public void RunAsync_ValidationException_NoCatchAndHandleExceptions() .AssertException(); } - private static HttpRequest CreatePatchRequest(UnitTestEx.NUnit.Internal.FunctionTester test, string? json, string? etag = null) + private static HttpRequest CreatePatchRequest(UnitTestEx.Azure.Functions.FunctionTester test, string? json, string? etag = null) => test.CreateHttpRequest(HttpMethod.Patch, "https://unittest", json, HttpConsts.MergePatchMediaTypeName, hr => hr.ApplyRequestOptions(new HttpRequestOptions { ETag = etag })); private class Person : IIdentifier, IETag diff --git a/tests/CoreEx.Test/HealthChecks/TypedHttpClientCoreHealthCheckTests.cs b/tests/CoreEx.Test/HealthChecks/TypedHttpClientCoreHealthCheckTests.cs index c906fc61..4400becf 100644 --- a/tests/CoreEx.Test/HealthChecks/TypedHttpClientCoreHealthCheckTests.cs +++ b/tests/CoreEx.Test/HealthChecks/TypedHttpClientCoreHealthCheckTests.cs @@ -10,7 +10,6 @@ using Moq; using NUnit.Framework; using UnitTestEx; -using UnitTestEx.NUnit; namespace CoreEx.Test.HealthChecks { diff --git a/tests/CoreEx.Test/HealthChecks/TypedHttpClientHealthCheckTest.cs b/tests/CoreEx.Test/HealthChecks/TypedHttpClientHealthCheckTest.cs index bba69416..832e6c56 100644 --- a/tests/CoreEx.Test/HealthChecks/TypedHttpClientHealthCheckTest.cs +++ b/tests/CoreEx.Test/HealthChecks/TypedHttpClientHealthCheckTest.cs @@ -13,7 +13,6 @@ using System.Threading; using System.Threading.Tasks; using UnitTestEx; -using UnitTestEx.NUnit; namespace CoreEx.Test.HealthChecks { diff --git a/tests/CoreEx.Test/TestFunction/HttpTriggerFunctionTest.cs b/tests/CoreEx.Test/TestFunction/HttpTriggerFunctionTest.cs index 398af576..30c3589e 100644 --- a/tests/CoreEx.Test/TestFunction/HttpTriggerFunctionTest.cs +++ b/tests/CoreEx.Test/TestFunction/HttpTriggerFunctionTest.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using System.Net.Http; using UnitTestEx; -using UnitTestEx.NUnit; namespace CoreEx.Test.TestFunction { diff --git a/tests/CoreEx.Test/TestFunction/HttpTriggerPublishFunctionTest.cs b/tests/CoreEx.Test/TestFunction/HttpTriggerPublishFunctionTest.cs index cc3e1969..5d51604d 100644 --- a/tests/CoreEx.Test/TestFunction/HttpTriggerPublishFunctionTest.cs +++ b/tests/CoreEx.Test/TestFunction/HttpTriggerPublishFunctionTest.cs @@ -7,7 +7,6 @@ using CoreEx.TestFunction.Models; using NUnit.Framework; using UnitTestEx; -using UnitTestEx.NUnit; namespace CoreEx.Test.TestFunction { diff --git a/tests/CoreEx.Test/TestFunction/ServiceBusOrchestratedTriggerFunctionTest.cs b/tests/CoreEx.Test/TestFunction/ServiceBusOrchestratedTriggerFunctionTest.cs index 976f18d0..24ed6494 100644 --- a/tests/CoreEx.Test/TestFunction/ServiceBusOrchestratedTriggerFunctionTest.cs +++ b/tests/CoreEx.Test/TestFunction/ServiceBusOrchestratedTriggerFunctionTest.cs @@ -14,7 +14,7 @@ using System; using System.Collections.Generic; using UnitTestEx.Abstractions; -using UnitTestEx.NUnit; +using UnitTestEx; using Az = Azure.Messaging.ServiceBus; namespace CoreEx.Test.TestFunction diff --git a/tests/CoreEx.Test/TestFunction/ServiceBusSubsciberTest.cs b/tests/CoreEx.Test/TestFunction/ServiceBusSubsciberTest.cs index fc80dd44..051cc3f7 100644 --- a/tests/CoreEx.Test/TestFunction/ServiceBusSubsciberTest.cs +++ b/tests/CoreEx.Test/TestFunction/ServiceBusSubsciberTest.cs @@ -7,7 +7,7 @@ using System; using System.Diagnostics; using System.Threading.Tasks; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.TestFunction { diff --git a/tests/CoreEx.Test/TestFunction/ServiceBusTriggerTest.cs b/tests/CoreEx.Test/TestFunction/ServiceBusTriggerTest.cs index 67361477..83908ee9 100644 --- a/tests/CoreEx.Test/TestFunction/ServiceBusTriggerTest.cs +++ b/tests/CoreEx.Test/TestFunction/ServiceBusTriggerTest.cs @@ -11,7 +11,7 @@ using System.Collections.Generic; using System.Net; using System.Net.Http; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test.TestFunction { diff --git a/tests/CoreEx.Test2/CoreEx.Test2.csproj b/tests/CoreEx.Test2/CoreEx.Test2.csproj index fe6f7c4a..680df577 100644 --- a/tests/CoreEx.Test2/CoreEx.Test2.csproj +++ b/tests/CoreEx.Test2/CoreEx.Test2.csproj @@ -10,9 +10,9 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -20,12 +20,14 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + - + + diff --git a/tests/CoreEx.Test2/Framework/Validation/ValidationExtensionsTest.cs b/tests/CoreEx.Test2/Framework/Validation/ValidationExtensionsTest.cs index 558fd743..4598c9bf 100644 --- a/tests/CoreEx.Test2/Framework/Validation/ValidationExtensionsTest.cs +++ b/tests/CoreEx.Test2/Framework/Validation/ValidationExtensionsTest.cs @@ -22,7 +22,7 @@ public async Task Validation_Success_Other_String2() Assert.That(r.IsSuccess, Is.True); } - private async Task> ValidateAsync(string? email2) + private static async Task> ValidateAsync(string? email2) { return await Result.Go().ValidatesAsync(email2, v => { diff --git a/tests/CoreEx.Test2/TestFunctionIso/HttpFunctionTest.cs b/tests/CoreEx.Test2/TestFunctionIso/HttpFunctionTest.cs index fbf48b78..80b143b6 100644 --- a/tests/CoreEx.Test2/TestFunctionIso/HttpFunctionTest.cs +++ b/tests/CoreEx.Test2/TestFunctionIso/HttpFunctionTest.cs @@ -1,5 +1,5 @@ using CoreEx.TestFunctionIso; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test2.TestFunctionIso { diff --git a/tests/CoreEx.Test2/TestFunctionIso/ServiceBusTest.cs b/tests/CoreEx.Test2/TestFunctionIso/ServiceBusTest.cs index a0412c73..62253173 100644 --- a/tests/CoreEx.Test2/TestFunctionIso/ServiceBusTest.cs +++ b/tests/CoreEx.Test2/TestFunctionIso/ServiceBusTest.cs @@ -2,7 +2,7 @@ using CoreEx.TestFunctionIso; using Microsoft.Extensions.DependencyInjection; using UnitTestEx.Expectations; -using UnitTestEx.NUnit; +using UnitTestEx; namespace CoreEx.Test2.TestFunctionIso { @@ -27,7 +27,7 @@ public async Task InvalidMessage() var ws = await wo.GetAsync(message.MessageId); Assert.That(ws, Is.Not.Null); - Assert.That(ws.Status, Is.EqualTo(WorkStatus.Failed)); + Assert.That(ws!.Status, Is.EqualTo(WorkStatus.Failed)); } [Test] @@ -50,7 +50,7 @@ public async Task Complete_WorkStatus_Cancelled() var ws = await wo.GetAsync(message.MessageId); Assert.That(ws, Is.Not.Null); - Assert.That(ws.Status, Is.EqualTo(WorkStatus.Cancelled)); + Assert.That(ws!.Status, Is.EqualTo(WorkStatus.Cancelled)); } [Test] @@ -72,7 +72,7 @@ public async Task Success() var ws = await wo.GetAsync(message.MessageId); Assert.That(ws, Is.Not.Null); - Assert.That(ws.Status, Is.EqualTo(WorkStatus.Completed)); + Assert.That(ws!.Status, Is.EqualTo(WorkStatus.Completed)); } } } \ No newline at end of file diff --git a/tests/CoreEx.TestFunction/CoreEx.TestFunction.csproj b/tests/CoreEx.TestFunction/CoreEx.TestFunction.csproj index f678482d..50472ff7 100644 --- a/tests/CoreEx.TestFunction/CoreEx.TestFunction.csproj +++ b/tests/CoreEx.TestFunction/CoreEx.TestFunction.csproj @@ -7,7 +7,7 @@ - + diff --git a/tests/CoreEx.TestFunctionIso/CoreEx.TestFunctionIso.csproj b/tests/CoreEx.TestFunctionIso/CoreEx.TestFunctionIso.csproj index dd8790e8..a7217415 100644 --- a/tests/CoreEx.TestFunctionIso/CoreEx.TestFunctionIso.csproj +++ b/tests/CoreEx.TestFunctionIso/CoreEx.TestFunctionIso.csproj @@ -16,7 +16,7 @@ - +