From 0fa689a2c692a18aef325e298deac3f4542eab51 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 13 Nov 2024 00:10:27 +0000
Subject: [PATCH 1/9] Update dotnet monorepo to v9
---
src/HomeInventory/Directory.Packages.props | 34 +++++++++++-----------
src/HomeInventory/Dockerfile | 2 +-
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/HomeInventory/Directory.Packages.props b/src/HomeInventory/Directory.Packages.props
index a159166b..85b72c5b 100644
--- a/src/HomeInventory/Directory.Packages.props
+++ b/src/HomeInventory/Directory.Packages.props
@@ -55,19 +55,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -78,8 +78,8 @@
-
-
+
+
@@ -95,8 +95,8 @@
-
-
+
+
diff --git a/src/HomeInventory/Dockerfile b/src/HomeInventory/Dockerfile
index 7be5506d..75c1c886 100644
--- a/src/HomeInventory/Dockerfile
+++ b/src/HomeInventory/Dockerfile
@@ -6,7 +6,7 @@ WORKDIR /app
EXPOSE 80
EXPOSE 443
-FROM mcr.microsoft.com/dotnet/sdk:8.0.403 AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0.100 AS build
WORKDIR /src
COPY ["Directory.Packages.props", "."]
COPY ["Directory.Build.props", "."]
From 12721619fe18f7ae40e3651e8005a63029effa22 Mon Sep 17 00:00:00 2001
From: "Serhii A. Hrytsenko"
Date: Tue, 12 Nov 2024 19:41:25 -0500
Subject: [PATCH 2/9] Update to .NET 9
Signed-off-by: Serhii A. Hrytsenko
---
src/HomeInventory/Directory.Build.props | 2 +-
src/HomeInventory/global.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/HomeInventory/Directory.Build.props b/src/HomeInventory/Directory.Build.props
index 437392ff..4af6b2dc 100644
--- a/src/HomeInventory/Directory.Build.props
+++ b/src/HomeInventory/Directory.Build.props
@@ -1,7 +1,7 @@
- net8
+ net9
enable
enable
latest
diff --git a/src/HomeInventory/global.json b/src/HomeInventory/global.json
index a3cf554a..4eda5222 100644
--- a/src/HomeInventory/global.json
+++ b/src/HomeInventory/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.403",
+ "version": "9.0.100",
"rollForward": "latestMajor",
"allowPrerelease": false
}
From ce5ea582fc782838980a38911e9ffeedfec63cd0 Mon Sep 17 00:00:00 2001
From: "Serhii A. Hrytsenko"
Date: Tue, 12 Nov 2024 20:37:38 -0500
Subject: [PATCH 3/9] Update packages
Signed-off-by: Serhii A. Hrytsenko
---
src/HomeInventory/Directory.Packages.props | 3 +++
.../HomeInventory.Application.Framework.csproj | 1 +
...HomeInventory.Application.UserManagement.Interfaces.csproj | 3 +++
.../HomeInventory.Application.UserManagement.csproj | 3 +++
.../HomeInventory.Application.csproj | 1 +
.../HomeInventory.Tests.Acceptance.csproj | 2 ++
.../HomeInventory.Tests.Framework.csproj | 2 ++
.../HomeInventory.Tests.Integration.csproj | 4 +++-
.../HomeInventory.Tests/HomeInventory.Tests.csproj | 4 +++-
.../HomeInventory.Web.Framework.csproj | 1 +
.../HomeInventory.Web.UserManagement.csproj | 4 ++++
src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj | 1 +
12 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/HomeInventory/Directory.Packages.props b/src/HomeInventory/Directory.Packages.props
index 85b72c5b..1022c973 100644
--- a/src/HomeInventory/Directory.Packages.props
+++ b/src/HomeInventory/Directory.Packages.props
@@ -32,6 +32,7 @@
+
@@ -52,6 +53,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Application.Framework/HomeInventory.Application.Framework.csproj b/src/HomeInventory/HomeInventory.Application.Framework/HomeInventory.Application.Framework.csproj
index eaa46173..7a4d0e62 100644
--- a/src/HomeInventory/HomeInventory.Application.Framework/HomeInventory.Application.Framework.csproj
+++ b/src/HomeInventory/HomeInventory.Application.Framework/HomeInventory.Application.Framework.csproj
@@ -2,6 +2,7 @@
+
diff --git a/src/HomeInventory/HomeInventory.Application.UserManagement.Interfaces/HomeInventory.Application.UserManagement.Interfaces.csproj b/src/HomeInventory/HomeInventory.Application.UserManagement.Interfaces/HomeInventory.Application.UserManagement.Interfaces.csproj
index ab9fbce6..3bcfd545 100644
--- a/src/HomeInventory/HomeInventory.Application.UserManagement.Interfaces/HomeInventory.Application.UserManagement.Interfaces.csproj
+++ b/src/HomeInventory/HomeInventory.Application.UserManagement.Interfaces/HomeInventory.Application.UserManagement.Interfaces.csproj
@@ -1,4 +1,7 @@
+
+
+
diff --git a/src/HomeInventory/HomeInventory.Application.UserManagement/HomeInventory.Application.UserManagement.csproj b/src/HomeInventory/HomeInventory.Application.UserManagement/HomeInventory.Application.UserManagement.csproj
index 6a513b08..f2dce19a 100644
--- a/src/HomeInventory/HomeInventory.Application.UserManagement/HomeInventory.Application.UserManagement.csproj
+++ b/src/HomeInventory/HomeInventory.Application.UserManagement/HomeInventory.Application.UserManagement.csproj
@@ -1,4 +1,7 @@
+
+
+
diff --git a/src/HomeInventory/HomeInventory.Application/HomeInventory.Application.csproj b/src/HomeInventory/HomeInventory.Application/HomeInventory.Application.csproj
index 92b1a1f9..4993cdd1 100644
--- a/src/HomeInventory/HomeInventory.Application/HomeInventory.Application.csproj
+++ b/src/HomeInventory/HomeInventory.Application/HomeInventory.Application.csproj
@@ -2,6 +2,7 @@
+
diff --git a/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj b/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj
index 896bcce6..346e1cc4 100644
--- a/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj
@@ -7,6 +7,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj b/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
index 74c27667..c27d0f75 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
@@ -14,6 +14,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj b/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
index 5fa0a094..6955ed44 100644
--- a/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
@@ -1,4 +1,4 @@
-
+
CA1707
@@ -10,6 +10,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj b/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
index 78bdae54..b38a4a18 100644
--- a/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
+++ b/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
@@ -1,4 +1,4 @@
-
+
$(NoWarn);CA1707;AD0001
@@ -16,6 +16,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/HomeInventory.Web.Framework.csproj b/src/HomeInventory/HomeInventory.Web.Framework/HomeInventory.Web.Framework.csproj
index ee047402..dd1f530a 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/HomeInventory.Web.Framework.csproj
+++ b/src/HomeInventory/HomeInventory.Web.Framework/HomeInventory.Web.Framework.csproj
@@ -7,6 +7,7 @@
+
diff --git a/src/HomeInventory/HomeInventory.Web.UserManagement/HomeInventory.Web.UserManagement.csproj b/src/HomeInventory/HomeInventory.Web.UserManagement/HomeInventory.Web.UserManagement.csproj
index f99c2a57..3ad5919a 100644
--- a/src/HomeInventory/HomeInventory.Web.UserManagement/HomeInventory.Web.UserManagement.csproj
+++ b/src/HomeInventory/HomeInventory.Web.UserManagement/HomeInventory.Web.UserManagement.csproj
@@ -14,4 +14,8 @@
+
+
+
+
diff --git a/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj b/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj
index 1bd60ba4..a69242ba 100644
--- a/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj
+++ b/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj
@@ -13,6 +13,7 @@
+
From e464cc8b1126f5c585d8ee0eddf921420704adb3 Mon Sep 17 00:00:00 2001
From: "Serhii A. Hrytsenko"
Date: Wed, 13 Nov 2024 06:57:00 -0500
Subject: [PATCH 4/9] Update packages
Signed-off-by: Serhii A. Hrytsenko
---
.gitignore | 14 +++++++
src/HomeInventory/Directory.Packages.props | 38 +++++++++----------
.../HomeInventory.Infrastructure.csproj | 1 +
3 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/.gitignore b/.gitignore
index 3e895aa1..d0709c8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -350,3 +350,17 @@ MigrationBackup/
.ionide/
*.feature.cs
src/HomeInventory/coverage
+
+# Default ignored files for Idea
+/shelf/
+/workspace.xml
+# Rider ignored files
+/projectSettingsUpdater.xml
+/.idea.HomeInventory.iml
+/contentModel.xml
+/modules.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/src/HomeInventory/Directory.Packages.props b/src/HomeInventory/Directory.Packages.props
index 1022c973..3caea5f6 100644
--- a/src/HomeInventory/Directory.Packages.props
+++ b/src/HomeInventory/Directory.Packages.props
@@ -2,8 +2,7 @@
true
-
-
+
@@ -28,13 +27,9 @@
-
-
-
-
-
+
@@ -45,35 +40,37 @@
-
-
-
-
-
+
+
+
+
-
-
+
+
+
+
-
+
+
+
-
-
+
@@ -84,8 +81,8 @@
-
+
@@ -93,9 +90,7 @@
-
-
-
+
@@ -103,6 +98,7 @@
+
\ No newline at end of file
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/HomeInventory.Infrastructure.csproj b/src/HomeInventory/HomeInventory.Infrastructure/HomeInventory.Infrastructure.csproj
index 8e4e16c2..57838c8a 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/HomeInventory.Infrastructure.csproj
+++ b/src/HomeInventory/HomeInventory.Infrastructure/HomeInventory.Infrastructure.csproj
@@ -3,6 +3,7 @@
+
From f6190c97aed481fbe1d75e1801d8872fa3f38827 Mon Sep 17 00:00:00 2001
From: "Serhii A. Hrytsenko"
Date: Wed, 13 Nov 2024 07:00:21 -0500
Subject: [PATCH 5/9] Update packages
Signed-off-by: Serhii A. Hrytsenko
---
.../HomeInventory.Tests.Acceptance.csproj | 2 --
.../HomeInventory.Tests.Framework.csproj | 2 +-
.../HomeInventory.Tests.Integration.csproj | 2 --
.../HomeInventory.Tests/HomeInventory.Tests.csproj | 6 ++----
4 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj b/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj
index 346e1cc4..896bcce6 100644
--- a/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Acceptance/HomeInventory.Tests.Acceptance.csproj
@@ -7,8 +7,6 @@
-
-
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj b/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
index c27d0f75..07f0ec9c 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
@@ -13,9 +13,9 @@
-
+
diff --git a/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj b/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
index 6955ed44..d38ebfd9 100644
--- a/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
@@ -10,8 +10,6 @@
-
-
diff --git a/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj b/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
index b38a4a18..4357c9e4 100644
--- a/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
+++ b/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
@@ -9,15 +9,13 @@
-
+
+
-
-
-
From d15d0f344d75959d00cb45127bfeb89a4e21d329 Mon Sep 17 00:00:00 2001
From: "Serhii A. Hrytsenko"
Date: Wed, 13 Nov 2024 07:02:27 -0500
Subject: [PATCH 6/9] Add idea files
Signed-off-by: Serhii A. Hrytsenko
---
.idea/.gitignore | 13 ++++
.idea/indexLayout.xml | 8 +++
.idea/vcs.xml | 6 ++
.../.idea.HomeInventory/.idea/.gitignore | 13 ++++
.../.idea.HomeInventory/.idea/indexLayout.xml | 8 +++
.../.idea/.idea.HomeInventory/.idea/vcs.xml | 6 ++
.../.idea.HomeInventory/.idea/workspace.xml | 71 +++++++++++++++++++
7 files changed, 125 insertions(+)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/indexLayout.xml
create mode 100644 .idea/vcs.xml
create mode 100644 src/HomeInventory/.idea/.idea.HomeInventory/.idea/.gitignore
create mode 100644 src/HomeInventory/.idea/.idea.HomeInventory/.idea/indexLayout.xml
create mode 100644 src/HomeInventory/.idea/.idea.HomeInventory/.idea/vcs.xml
create mode 100644 src/HomeInventory/.idea/.idea.HomeInventory/.idea/workspace.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..8f5aaa3f
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/.idea.HomeInventory.iml
+/projectSettingsUpdater.xml
+/modules.xml
+/contentModel.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/indexLayout.xml b/.idea/indexLayout.xml
new file mode 100644
index 00000000..7b08163c
--- /dev/null
+++ b/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/HomeInventory/.idea/.idea.HomeInventory/.idea/.gitignore b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/.gitignore
new file mode 100644
index 00000000..50b72f87
--- /dev/null
+++ b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/projectSettingsUpdater.xml
+/.idea.HomeInventory.iml
+/contentModel.xml
+/modules.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/src/HomeInventory/.idea/.idea.HomeInventory/.idea/indexLayout.xml b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/indexLayout.xml
new file mode 100644
index 00000000..7b08163c
--- /dev/null
+++ b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/HomeInventory/.idea/.idea.HomeInventory/.idea/vcs.xml b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/vcs.xml
new file mode 100644
index 00000000..b2bdec2d
--- /dev/null
+++ b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/HomeInventory/.idea/.idea.HomeInventory/.idea/workspace.xml b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/workspace.xml
new file mode 100644
index 00000000..d0792d88
--- /dev/null
+++ b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/workspace.xml
@@ -0,0 +1,71 @@
+
+
+
+ HomeInventory.Api/HomeInventory.Api.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1731499300524
+
+
+ 1731499300524
+
+
+
+
+
+
+
+
\ No newline at end of file
From 2b96d85b9e0627282d79f4defc63a6b439c32390 Mon Sep 17 00:00:00 2001
From: "Serhii A. Hrytsenko"
Date: Wed, 13 Nov 2024 08:42:42 -0500
Subject: [PATCH 7/9] Fix and mute errors/warnings
Signed-off-by: Serhii A. Hrytsenko
---
src/HomeInventory/.editorconfig | 76 ++++++++++++++++---
src/HomeInventory/Directory.Build.props | 4 +-
src/HomeInventory/Directory.Packages.props | 2 +
.../HomeInventory.Api/AppBuilder.cs | 2 +-
.../HomeInventory.Api/AssemblyReference.cs | 1 +
.../HomeInventory.Api.csproj | 2 +
.../HomeInventory.Api/Program.cs | 1 +
.../FeatureManagerExtensions.cs | 2 +-
.../Messaging/CommandHandler.cs | 4 +-
.../Messaging/IQueryResult.cs | 3 +-
.../Cqrs/Behaviors/LoggingBehavior.cs | 1 -
.../PasswordCharacterSets.cs | 2 +-
.../RegisterRequestValidator.cs | 10 +--
.../LoginRequestValidator.cs | 6 +-
.../HomeInventory.Core/IParseable.cs | 4 +-
.../ISpannableCollection.cs | 8 +-
.../ScopeAccessorExtensions.cs | 2 +-
.../HomeInventory.Core/TypeExtensions.cs | 1 -
.../ValidationExtensions.cs | 4 +-
.../EnumerationItemsCollection.cs | 3 +-
.../IBuildableObject.cs | 2 +-
.../IRepository.cs | 5 +-
.../Ids/IIdBuildable.cs | 2 +-
.../DomainServiceCollectionExtensions.cs | 2 +-
.../ValueObjects/AmountFactory.cs | 2 +-
.../IDatabaseContext.cs | 2 +-
.../IEventsPersistenceService.cs | 2 +-
...ureFrameworkServiceCollectionExtensions.cs | 4 +-
.../Models/IPersistentModel.cs | 2 +-
.../Repository.cs | 29 +++----
.../Specifications/ByIdFilterSpecification.cs | 2 +-
...erManagementServiceCollectionExtensions.cs | 2 +-
.../Configurations/DomainEventJsonTypeInfo.cs | 2 +-
.../Configurations/UserModelConfiguration.cs | 8 +-
.../Models/UserModel.cs | 1 +
.../UserRepository.cs | 3 +-
.../HomeInventory.Infrastructure.csproj | 1 +
...frastructureServiceCollectionExtensions.cs | 7 +-
.../Persistence/DatabaseContext.cs | 7 +-
.../Persistence/Mapping/ModelMappings.cs | 4 +-
.../PolymorphicDomainEventTypeResolver.cs | 2 +-
.../PublishDomainEventsInterceptor.cs | 2 +-
.../Persistence/Models/OutboxMessage.cs | 1 +
.../Services/EventsPersistenceService.cs | 2 +-
.../Drivers/HomeInventoryAPIDriver.cs | 2 +-
.../Assertions/AssertionExtensions.cs | 3 +-
.../Assertions/ObjectExtensions.cs | 2 +-
.../Assertions/UlidAssertions.cs | 3 +-
.../Attributes/ArchitectureTestAttribute.cs | 2 +-
.../HomeInventory.Tests.Framework/BaseTest.cs | 6 +-
.../ApiBehaviorOptionsCustomization.cs | 4 +-
.../Customizations/FixtureExtensions.cs | 4 +-
.../GivenContext.cs | 2 +-
.../HomeInventory.Tests.Framework.csproj | 2 +
.../RandomExtensions.cs | 3 +-
.../VariableValues.cs | 5 +-
.../BaseIntegrationTest.cs | 4 +-
.../UserManagementApiTests.cs | 4 +-
.../FeatureFlagGivenTestContext.cs | 22 ++++++
.../Application/FeatureFlagTests.cs | 45 +++--------
.../Core/InternalTestSubject.cs | 7 +-
.../InfrastructureDependencyInjectionTests.cs | 1 +
.../DependencyInjection/TestAppBuilder.cs | 2 +-
.../HomeInventory.Tests/Domain/EntityTests.cs | 58 +++++++-------
.../Domain/EquatableComponentTests.cs | 28 +++----
.../Domain/ValueObjects/AmountTests.cs | 3 +-
.../Domain/ValueObjects/AmountUnitTests.cs | 4 +-
.../ValueObjects/MeasurementTypeTests.cs | 7 +-
.../ServiceDescriptorExtensionsTests.cs | 2 +
.../CorrelationIdMiddlewareTests.cs | 4 +-
.../Presentation/Web/SectionPathTests.cs | 10 +--
.../BCryptPasswordHasherTests.cs | 14 ++--
.../Authentication/JwtTokenGeneratorTests.cs | 4 +-
.../Handlers/RegisterCommandHandlerTests.cs | 4 +-
.../Systems/Mapping/BaseMappingsTests.cs | 4 +-
.../Systems/Mapping/UlidIdConverterTests.cs | 12 +--
.../Modules/AuthenticationModuleTests.cs | 10 +--
.../Modules/BaseApiModuleGivenTestContext.cs | 2 +-
.../Systems/Modules/ErrorMappingTests.cs | 6 +-
.../Modules/JsonOpenApiValueConverterTests.cs | 10 +--
.../Modules/UserManagementModuleTests.cs | 10 +--
.../AmountValueObjectConverterTests.cs | 8 +-
.../Persistence/BaseDatabaseContextTest.cs | 2 +-
.../Systems/Persistence/BaseRepositoryTest.cs | 4 +-
.../ByIdFilterSpecificationTests.cs | 4 +-
.../EventsPersistenceServiceTests.cs | 2 +-
.../OutboxMessageConfigurationTests.cs | 2 +-
.../Systems/Persistence/RepositoryTests.cs | 2 +-
.../UserHasEmailSpecificationTests.cs | 4 +-
.../UserModelConfigurationTests.cs | 2 +-
.../Persistence/UserRepositoryTests.cs | 6 +-
.../Validation/PasswordValidatorTests.cs | 5 +-
.../HomeInventoryProblemDetailsFactory.cs | 2 +-
.../ProblemDetailsExtensions.cs | 10 +--
.../ProblemDetailsFactoryExtensions.cs | 4 +-
.../ValidationContextFactory.cs | 2 +-
.../ValidationEndpointFilter.cs | 4 +-
...WebFrameworkServiceCollectionExtensions.cs | 6 +-
.../UserManagementContractsMappings.cs | 4 +-
...uthorizationServiceCollectionExtensions.cs | 6 +-
.../Validation/JwtOptionsValidator.cs | 10 +--
.../Modules/AuthenticationModule.cs | 2 +-
.../Modules/PermissionModule.cs | 2 +-
.../WebServiceCollectionExtensions.cs | 18 ++---
104 files changed, 360 insertions(+), 300 deletions(-)
create mode 100644 src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagGivenTestContext.cs
diff --git a/src/HomeInventory/.editorconfig b/src/HomeInventory/.editorconfig
index 3dd0c3bb..a8aa075c 100644
--- a/src/HomeInventory/.editorconfig
+++ b/src/HomeInventory/.editorconfig
@@ -4,7 +4,7 @@
dotnet_diagnostic.CA2016.severity = warning
# IDE0008: Use explicit type
-csharp_style_var_elsewhere = true
+csharp_style_var_elsewhere = true:suggestion
[*.cs]
#### Naming styles ####
@@ -30,21 +30,30 @@ dotnet_naming_style.begin_with__.capitalization = camel_case
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
-csharp_prefer_braces = true:silent
+csharp_prefer_braces = true:suggestion
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
-csharp_style_expression_bodied_methods = false:silent
-csharp_style_expression_bodied_constructors = false:silent
-csharp_style_expression_bodied_operators = false:silent
-csharp_style_expression_bodied_properties = true:silent
-csharp_style_expression_bodied_indexers = true:silent
-csharp_style_expression_bodied_accessors = true:silent
-csharp_style_expression_bodied_lambdas = true:silent
-csharp_style_expression_bodied_local_functions = false:silent
+csharp_style_expression_bodied_methods = true:suggestion
+csharp_style_expression_bodied_constructors = true:suggestion
+csharp_style_expression_bodied_operators = true:suggestion
+csharp_style_expression_bodied_properties = true:suggestion
+csharp_style_expression_bodied_indexers = true:suggestion
+csharp_style_expression_bodied_accessors = true:suggestion
+csharp_style_expression_bodied_lambdas = true:suggestion
+csharp_style_expression_bodied_local_functions = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
+# CS1591: Missing XML comment for publicly visible type or member
+dotnet_diagnostic.CS1591.severity = none
+
+# IDE0058: Expression value is never used
+dotnet_diagnostic.IDE0058.severity = suggestion
+
+# CA1515: Consider making public types internal
+dotnet_diagnostic.CA1515.severity = suggestion
+
[*.{cs,vb}]
#### Naming styles ####
@@ -121,3 +130,50 @@ spelling_exclusion_path = .\exclusion.dic
spelling_use_default_exclusion_dictionary = true
csharp_style_prefer_primary_constructors = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
+csharp_space_around_binary_operators = before_and_after
+csharp_prefer_system_threading_lock = true:suggestion
+csharp_prefer_simple_default_expression = true:suggestion
+csharp_style_prefer_local_over_anonymous_function = true:suggestion
+csharp_style_prefer_index_operator = true:suggestion
+csharp_style_prefer_range_operator = true:suggestion
+csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
+csharp_style_prefer_tuple_swap = true:suggestion
+csharp_style_prefer_utf8_string_literals = true:suggestion
+csharp_style_inlined_variable_declaration = true:suggestion
+csharp_style_deconstructed_variable_declaration = true:suggestion
+csharp_style_unused_value_assignment_preference = unused_local_variable:silent
+csharp_style_unused_value_expression_statement_preference = unused_local_variable:suggestion
+dotnet_style_readonly_field = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:silent
+dotnet_style_predefined_type_for_locals_parameters_members = true:silent
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
+csharp_prefer_static_anonymous_function = true:suggestion
+csharp_prefer_static_local_function = true:suggestion
+csharp_style_prefer_readonly_struct_member = true:suggestion
+csharp_style_prefer_readonly_struct = true:suggestion
+dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion
+dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion
+csharp_style_allow_embedded_statements_on_same_line_experimental = false:suggestion
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:suggestion
+csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:suggestion
+csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:suggestion
+csharp_style_conditional_delegate_call = true:suggestion
+dotnet_code_quality_unused_parameters = non_public:suggestion
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
+csharp_style_var_for_built_in_types = true:suggestion
+csharp_style_var_when_type_is_apparent = true:suggestion
+dotnet_style_qualification_for_event = false:silent
+dotnet_style_qualification_for_method = false:silent
+dotnet_style_qualification_for_property = false:silent
+dotnet_style_qualification_for_field = false:silent
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
+csharp_style_prefer_extended_property_pattern = true:suggestion
+csharp_style_prefer_not_pattern = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_prefer_pattern_matching = true:suggestion
+csharp_style_prefer_switch_expression = true:suggestion
+dotnet_diagnostic.xUnit2001.severity = suggestion
diff --git a/src/HomeInventory/Directory.Build.props b/src/HomeInventory/Directory.Build.props
index 4af6b2dc..69918492 100644
--- a/src/HomeInventory/Directory.Build.props
+++ b/src/HomeInventory/Directory.Build.props
@@ -12,13 +12,15 @@
True
9999
false
- CA1062;CA2007;CA1716;VISLIB0001
+ $(NoWarn);CA1062;CA2007;CA1716
+ True
+
diff --git a/src/HomeInventory/Directory.Packages.props b/src/HomeInventory/Directory.Packages.props
index 3caea5f6..aadbfabd 100644
--- a/src/HomeInventory/Directory.Packages.props
+++ b/src/HomeInventory/Directory.Packages.props
@@ -49,6 +49,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Api/AppBuilder.cs b/src/HomeInventory/HomeInventory.Api/AppBuilder.cs
index 0c5105f6..e0022575 100644
--- a/src/HomeInventory/HomeInventory.Api/AppBuilder.cs
+++ b/src/HomeInventory/HomeInventory.Api/AppBuilder.cs
@@ -20,7 +20,7 @@ public WebApplication Build()
.AddSerilog(builder.Configuration);
var app = builder.Build();
- app.UseSerilogRequestLogging(options => options.IncludeQueryInRequestPath = true);
+ app.UseSerilogRequestLogging(static options => options.IncludeQueryInRequestPath = true);
return app.UseWeb();
}
diff --git a/src/HomeInventory/HomeInventory.Api/AssemblyReference.cs b/src/HomeInventory/HomeInventory.Api/AssemblyReference.cs
index 972a990f..fe1716e1 100644
--- a/src/HomeInventory/HomeInventory.Api/AssemblyReference.cs
+++ b/src/HomeInventory/HomeInventory.Api/AssemblyReference.cs
@@ -2,6 +2,7 @@
namespace HomeInventory.Api;
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "By design")]
public static class AssemblyReference
{
public static readonly Assembly Assembly = typeof(AssemblyReference).Assembly;
diff --git a/src/HomeInventory/HomeInventory.Api/HomeInventory.Api.csproj b/src/HomeInventory/HomeInventory.Api/HomeInventory.Api.csproj
index 5de39493..4f9b5018 100644
--- a/src/HomeInventory/HomeInventory.Api/HomeInventory.Api.csproj
+++ b/src/HomeInventory/HomeInventory.Api/HomeInventory.Api.csproj
@@ -24,6 +24,8 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Api/Program.cs b/src/HomeInventory/HomeInventory.Api/Program.cs
index 6a40b5f1..128e7921 100644
--- a/src/HomeInventory/HomeInventory.Api/Program.cs
+++ b/src/HomeInventory/HomeInventory.Api/Program.cs
@@ -11,6 +11,7 @@ await Execute.AndCatchAsync(
},
(Exception ex) => log.Fatal(ex, "An unhandled exception occurred during bootstrapping"));
+[System.Diagnostics.CodeAnalysis.SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "For testing")]
public partial class Program
{
protected Program()
diff --git a/src/HomeInventory/HomeInventory.Application.Framework/FeatureManagerExtensions.cs b/src/HomeInventory/HomeInventory.Application.Framework/FeatureManagerExtensions.cs
index fc6784ee..3aa19ccc 100644
--- a/src/HomeInventory/HomeInventory.Application.Framework/FeatureManagerExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Application.Framework/FeatureManagerExtensions.cs
@@ -4,5 +4,5 @@ namespace HomeInventory.Application.Framework;
public static class FeatureManagerExtensions
{
- public static IAsyncEnumerable CreateFeaturesAsync(this IFeatureManager manager) => manager.GetFeatureNamesAsync().Select(name => FeatureFlag.Create(name));
+ public static IAsyncEnumerable CreateFeaturesAsync(this IFeatureManager manager) => manager.GetFeatureNamesAsync().Select(static name => FeatureFlag.Create(name));
}
diff --git a/src/HomeInventory/HomeInventory.Application.Framework/Messaging/CommandHandler.cs b/src/HomeInventory/HomeInventory.Application.Framework/Messaging/CommandHandler.cs
index 5b6e4a36..03c7d765 100644
--- a/src/HomeInventory/HomeInventory.Application.Framework/Messaging/CommandHandler.cs
+++ b/src/HomeInventory/HomeInventory.Application.Framework/Messaging/CommandHandler.cs
@@ -1,6 +1,4 @@
-using Unit = LanguageExt.Unit;
-
-namespace HomeInventory.Application.Interfaces.Messaging;
+namespace HomeInventory.Application.Interfaces.Messaging;
public abstract class CommandHandler : ICommandHandler
where TCommand : ICommand
diff --git a/src/HomeInventory/HomeInventory.Application.Framework/Messaging/IQueryResult.cs b/src/HomeInventory/HomeInventory.Application.Framework/Messaging/IQueryResult.cs
index de173772..42bfdce8 100644
--- a/src/HomeInventory/HomeInventory.Application.Framework/Messaging/IQueryResult.cs
+++ b/src/HomeInventory/HomeInventory.Application.Framework/Messaging/IQueryResult.cs
@@ -1,5 +1,4 @@
-using LanguageExt.Pretty;
-using Unit = LanguageExt.Unit;
+using Unit = LanguageExt.Unit;
namespace HomeInventory.Application.Interfaces.Messaging;
diff --git a/src/HomeInventory/HomeInventory.Application/Cqrs/Behaviors/LoggingBehavior.cs b/src/HomeInventory/HomeInventory.Application/Cqrs/Behaviors/LoggingBehavior.cs
index 535cea52..ea0c99e5 100644
--- a/src/HomeInventory/HomeInventory.Application/Cqrs/Behaviors/LoggingBehavior.cs
+++ b/src/HomeInventory/HomeInventory.Application/Cqrs/Behaviors/LoggingBehavior.cs
@@ -1,5 +1,4 @@
using HomeInventory.Application.Interfaces.Messaging;
-using LanguageExt;
using Unit = LanguageExt.Unit;
namespace HomeInventory.Application.Cqrs.Behaviors;
diff --git a/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/PasswordCharacterSets.cs b/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/PasswordCharacterSets.cs
index 333f9d15..1988b8d8 100644
--- a/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/PasswordCharacterSets.cs
+++ b/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/PasswordCharacterSets.cs
@@ -8,5 +8,5 @@ internal static class PasswordCharacterSets
public static IPasswordCharacterSet Lowercase { get; } = new PasswordCharacterSet(char.IsLower, "lowercase");
- public static IPasswordCharacterSet NonAlphanumeric { get; } = new PasswordCharacterSet(c => !char.IsLetterOrDigit(c), "non-alphanumeric");
+ public static IPasswordCharacterSet NonAlphanumeric { get; } = new PasswordCharacterSet(static c => !char.IsLetterOrDigit(c), "non-alphanumeric");
}
diff --git a/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/RegisterRequestValidator.cs b/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/RegisterRequestValidator.cs
index 54b7916f..c21fc4d1 100644
--- a/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/RegisterRequestValidator.cs
+++ b/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/RegisterRequestValidator.cs
@@ -6,11 +6,11 @@ public class RegisterRequestValidator : AbstractValidator
{
public RegisterRequestValidator()
{
- RuleFor(x => x.Email).NotEmpty();
- RuleFor(x => x.Email).EmailAddress();
+ RuleFor(static x => x.Email).NotEmpty();
+ RuleFor(static x => x.Email).EmailAddress();
- RuleFor(x => x.Password).NotEmpty();
- RuleFor(x => x.Password).MinimumLength(8);
- RuleFor(x => x.Password).Password();
+ RuleFor(static x => x.Password).NotEmpty();
+ RuleFor(static x => x.Password).MinimumLength(8);
+ RuleFor(static x => x.Password).Password();
}
}
diff --git a/src/HomeInventory/HomeInventory.Contracts.Validations/LoginRequestValidator.cs b/src/HomeInventory/HomeInventory.Contracts.Validations/LoginRequestValidator.cs
index 1c6f086d..e79c8499 100644
--- a/src/HomeInventory/HomeInventory.Contracts.Validations/LoginRequestValidator.cs
+++ b/src/HomeInventory/HomeInventory.Contracts.Validations/LoginRequestValidator.cs
@@ -6,9 +6,9 @@ internal sealed class LoginRequestValidator : AbstractValidator
{
public LoginRequestValidator()
{
- RuleFor(x => x.Email).NotEmpty();
- RuleFor(x => x.Email).EmailAddress();
+ RuleFor(static x => x.Email).NotEmpty();
+ RuleFor(static x => x.Email).EmailAddress();
- RuleFor(x => x.Password).NotEmpty();
+ RuleFor(static x => x.Password).NotEmpty();
}
}
diff --git a/src/HomeInventory/HomeInventory.Core/IParseable.cs b/src/HomeInventory/HomeInventory.Core/IParseable.cs
index a8e651f0..8a500665 100644
--- a/src/HomeInventory/HomeInventory.Core/IParseable.cs
+++ b/src/HomeInventory/HomeInventory.Core/IParseable.cs
@@ -4,8 +4,8 @@ public interface IParseable
where TSelf : notnull, IParseable
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "By design")]
- abstract static TSelf Parse(string text);
+ static abstract TSelf Parse(string text);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "By design")]
- abstract static Option TryParse(string text);
+ static abstract Option TryParse(string text);
}
diff --git a/src/HomeInventory/HomeInventory.Core/ISpannableCollection.cs b/src/HomeInventory/HomeInventory.Core/ISpannableCollection.cs
index b7742e84..7ec4713e 100644
--- a/src/HomeInventory/HomeInventory.Core/ISpannableCollection.cs
+++ b/src/HomeInventory/HomeInventory.Core/ISpannableCollection.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace HomeInventory.Core;
+namespace HomeInventory.Core;
public interface ISpannableCollection : IReadOnlyCollection
{
diff --git a/src/HomeInventory/HomeInventory.Core/ScopeAccessorExtensions.cs b/src/HomeInventory/HomeInventory.Core/ScopeAccessorExtensions.cs
index 7f84280f..8133b438 100644
--- a/src/HomeInventory/HomeInventory.Core/ScopeAccessorExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Core/ScopeAccessorExtensions.cs
@@ -7,5 +7,5 @@ public static TContext GetRequiredContext(this IScopeAccessor scopeAcc
scopeAccessor
.GetScope()
.Get()
- .ThrowIfNone(() => new InvalidOperationException($"Required context of type {typeof(TContext).FullName} not found"));
+ .ThrowIfNone(static () => new InvalidOperationException($"Required context of type {typeof(TContext).FullName} not found"));
}
diff --git a/src/HomeInventory/HomeInventory.Core/TypeExtensions.cs b/src/HomeInventory/HomeInventory.Core/TypeExtensions.cs
index af077e7f..ce0541bb 100644
--- a/src/HomeInventory/HomeInventory.Core/TypeExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Core/TypeExtensions.cs
@@ -30,7 +30,6 @@ public static string GetFormattedName(this Type type) =>
_ => type.Name,
};
-
private static string FormatGenericType(Type type)
{
var args = type.GenericTypeArguments;
diff --git a/src/HomeInventory/HomeInventory.Core/ValidationExtensions.cs b/src/HomeInventory/HomeInventory.Core/ValidationExtensions.cs
index 567e4af1..3c36231c 100644
--- a/src/HomeInventory/HomeInventory.Core/ValidationExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Core/ValidationExtensions.cs
@@ -1,6 +1,4 @@
-using LanguageExt.Pretty;
-
-namespace HomeInventory.Core;
+namespace HomeInventory.Core;
public static class ValidationExtensions
{
diff --git a/src/HomeInventory/HomeInventory.Domain.Primitives/EnumerationItemsCollection.cs b/src/HomeInventory/HomeInventory.Domain.Primitives/EnumerationItemsCollection.cs
index 0b0636d4..8bc1f243 100644
--- a/src/HomeInventory/HomeInventory.Domain.Primitives/EnumerationItemsCollection.cs
+++ b/src/HomeInventory/HomeInventory.Domain.Primitives/EnumerationItemsCollection.cs
@@ -1,5 +1,4 @@
-using HomeInventory.Core;
-using System.Collections;
+using System.Collections;
namespace HomeInventory.Domain.Primitives;
diff --git a/src/HomeInventory/HomeInventory.Domain.Primitives/IBuildableObject.cs b/src/HomeInventory/HomeInventory.Domain.Primitives/IBuildableObject.cs
index b44d013f..56ac2dcd 100644
--- a/src/HomeInventory/HomeInventory.Domain.Primitives/IBuildableObject.cs
+++ b/src/HomeInventory/HomeInventory.Domain.Primitives/IBuildableObject.cs
@@ -5,5 +5,5 @@ public interface IBuildableObject
where TBuilder : notnull, IObjectBuilder
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "As designed")]
- abstract static TBuilder CreateBuilder();
+ static abstract TBuilder CreateBuilder();
}
diff --git a/src/HomeInventory/HomeInventory.Domain.Primitives/IRepository.cs b/src/HomeInventory/HomeInventory.Domain.Primitives/IRepository.cs
index 7dfc4db0..98f7ba32 100644
--- a/src/HomeInventory/HomeInventory.Domain.Primitives/IRepository.cs
+++ b/src/HomeInventory/HomeInventory.Domain.Primitives/IRepository.cs
@@ -7,6 +7,7 @@ public interface IRepository : IReadOnlyRepository
/// The entity to add.
+ ///
///
/// A task that represents the asynchronous operation.
/// The task result contains the .
@@ -20,7 +21,6 @@ public interface IRepository : IReadOnlyRepository
///
/// A task that represents the asynchronous operation.
- /// The task result contains the .
///
Task AddRangeAsync(IEnumerable entities, CancellationToken cancellationToken = default);
@@ -28,6 +28,7 @@ public interface IRepository : IReadOnlyRepository
/// The entity to update.
+ ///
/// A task that represents the asynchronous operation.
Task UpdateAsync(TAggregateRoot entity, CancellationToken cancellationToken = default);
@@ -43,6 +44,7 @@ public interface IRepository : IReadOnlyRepository
/// The entity to delete.
+ ///
/// A task that represents the asynchronous operation.
Task DeleteAsync(TAggregateRoot entity, CancellationToken cancellationToken = default);
@@ -50,6 +52,7 @@ public interface IRepository : IReadOnlyRepository
/// The entities to remove.
+ ///
/// A task that represents the asynchronous operation.
Task DeleteRangeAsync(IEnumerable entities, CancellationToken cancellationToken = default);
}
diff --git a/src/HomeInventory/HomeInventory.Domain.Primitives/Ids/IIdBuildable.cs b/src/HomeInventory/HomeInventory.Domain.Primitives/Ids/IIdBuildable.cs
index 159aaab1..050b5ab9 100644
--- a/src/HomeInventory/HomeInventory.Domain.Primitives/Ids/IIdBuildable.cs
+++ b/src/HomeInventory/HomeInventory.Domain.Primitives/Ids/IIdBuildable.cs
@@ -6,5 +6,5 @@ public interface IIdBuildable
where TId : notnull
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "As designed")]
- abstract static TSelf CreateFrom(TId value);
+ static abstract TSelf CreateFrom(TId value);
}
diff --git a/src/HomeInventory/HomeInventory.Domain/DomainServiceCollectionExtensions.cs b/src/HomeInventory/HomeInventory.Domain/DomainServiceCollectionExtensions.cs
index 1f0294a4..1266ca6f 100644
--- a/src/HomeInventory/HomeInventory.Domain/DomainServiceCollectionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Domain/DomainServiceCollectionExtensions.cs
@@ -13,7 +13,7 @@ public static IServiceCollection AddDomain(this IServiceCollection services)
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
- services.AddTransient(_ => new FixedTimeProvider(TimeProvider.System));
+ services.AddTransient(static _ => new FixedTimeProvider(TimeProvider.System));
return services;
}
}
diff --git a/src/HomeInventory/HomeInventory.Domain/ValueObjects/AmountFactory.cs b/src/HomeInventory/HomeInventory.Domain/ValueObjects/AmountFactory.cs
index 784ba357..57ed7fb1 100644
--- a/src/HomeInventory/HomeInventory.Domain/ValueObjects/AmountFactory.cs
+++ b/src/HomeInventory/HomeInventory.Domain/ValueObjects/AmountFactory.cs
@@ -7,7 +7,7 @@ internal sealed class AmountFactory : IAmountFactory
public Validation Create(decimal value, AmountUnit unit) =>
new UnitValidator(unit)
.Validate(value)
- .Bind(t => new Amount(t.Value, t.Unit));
+ .Bind(static t => new Amount(t.Value, t.Unit));
private readonly ref struct UnitValidator(AmountUnit unit)
{
diff --git a/src/HomeInventory/HomeInventory.Infrastructure.Framework/IDatabaseContext.cs b/src/HomeInventory/HomeInventory.Infrastructure.Framework/IDatabaseContext.cs
index 5f9a46bc..6de01f1d 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure.Framework/IDatabaseContext.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure.Framework/IDatabaseContext.cs
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
-namespace HomeInventory.Infrastructure.Persistence;
+namespace HomeInventory.Infrastructure.Framework;
public interface IDatabaseContext
{
diff --git a/src/HomeInventory/HomeInventory.Infrastructure.Framework/IEventsPersistenceService.cs b/src/HomeInventory/HomeInventory.Infrastructure.Framework/IEventsPersistenceService.cs
index 0acf61a8..f19006dc 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure.Framework/IEventsPersistenceService.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure.Framework/IEventsPersistenceService.cs
@@ -1,6 +1,6 @@
using HomeInventory.Domain.Primitives;
-namespace HomeInventory.Infrastructure.Persistence;
+namespace HomeInventory.Infrastructure.Framework;
public interface IEventsPersistenceService
{
diff --git a/src/HomeInventory/HomeInventory.Infrastructure.Framework/InfrastructureFrameworkServiceCollectionExtensions.cs b/src/HomeInventory/HomeInventory.Infrastructure.Framework/InfrastructureFrameworkServiceCollectionExtensions.cs
index 1fac1357..50e39efe 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure.Framework/InfrastructureFrameworkServiceCollectionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure.Framework/InfrastructureFrameworkServiceCollectionExtensions.cs
@@ -10,6 +10,6 @@ public static IServiceCollection AddRepository
services
.AddScoped()
- .AddScoped>(sp => sp.GetRequiredService())
- .AddScoped>(sp => sp.GetRequiredService>());
+ .AddScoped>(static sp => sp.GetRequiredService())
+ .AddScoped>(static sp => sp.GetRequiredService>());
}
diff --git a/src/HomeInventory/HomeInventory.Infrastructure.Framework/Models/IPersistentModel.cs b/src/HomeInventory/HomeInventory.Infrastructure.Framework/Models/IPersistentModel.cs
index 3de803a7..235eef86 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure.Framework/Models/IPersistentModel.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure.Framework/Models/IPersistentModel.cs
@@ -1,4 +1,4 @@
-namespace HomeInventory.Infrastructure.Persistence.Models;
+namespace HomeInventory.Infrastructure.Framework.Models;
public interface IPersistentModel : IPersistentModel
{
diff --git a/src/HomeInventory/HomeInventory.Infrastructure.Framework/Repository.cs b/src/HomeInventory/HomeInventory.Infrastructure.Framework/Repository.cs
index 5f87d5c2..7bc69386 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure.Framework/Repository.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure.Framework/Repository.cs
@@ -3,11 +3,11 @@
using HomeInventory.Domain.Primitives;
using HomeInventory.Domain.Primitives.Ids;
using HomeInventory.Infrastructure.Framework.Mapping;
-using HomeInventory.Infrastructure.Persistence.Models;
+using HomeInventory.Infrastructure.Framework.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
-namespace HomeInventory.Infrastructure.Persistence;
+namespace HomeInventory.Infrastructure.Framework;
public abstract class Repository(IDatabaseContext context, IMapper mapper, ISpecificationEvaluator evaluator, IEventsPersistenceService eventsPersistenceService) : IRepository
where TModel : class, IPersistentModel
@@ -77,18 +77,16 @@ public async Task AnyAsync(CancellationToken cancellationToken = default)
await Set().AnyAsync(cancellationToken);
public IAsyncEnumerable GetAllAsync(CancellationToken cancellationToken = default) =>
- AsyncEnumerable.ToAsyncEnumerable(ToEntity(Set(), cancellationToken));
+ ToEntity(Set(), cancellationToken).ToAsyncEnumerable();
public async Task
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/InfrastructureServiceCollectionExtensions.cs b/src/HomeInventory/HomeInventory.Infrastructure/InfrastructureServiceCollectionExtensions.cs
index 02d38347..112ce7c4 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/InfrastructureServiceCollectionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/InfrastructureServiceCollectionExtensions.cs
@@ -2,6 +2,7 @@
using Ardalis.Specification.EntityFrameworkCore;
using HomeInventory.Application;
using HomeInventory.Domain.Primitives;
+using HomeInventory.Infrastructure.Framework;
using HomeInventory.Infrastructure.Persistence;
using HomeInventory.Infrastructure.Persistence.Mapping;
using HomeInventory.Infrastructure.Persistence.Models.Configurations;
@@ -35,13 +36,13 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi
private static IServiceCollection AddDatabase(this IServiceCollection services) =>
services
.AddScoped()
- .AddDbContext((sp, builder) =>
+ .AddDbContext(static (sp, builder) =>
{
var env = sp.GetRequiredService();
builder.UseInMemoryDatabase("HomeInventory");
builder.EnableDetailedErrors(!env.IsProduction());
builder.EnableSensitiveDataLogging(!env.IsProduction());
})
- .AddScoped(sp => sp.GetRequiredService())
- .AddScoped(sp => sp.GetRequiredService());
+ .AddScoped(static sp => sp.GetRequiredService())
+ .AddScoped(static sp => sp.GetRequiredService());
}
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/DatabaseContext.cs b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/DatabaseContext.cs
index 3b0278cb..863b8321 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/DatabaseContext.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/DatabaseContext.cs
@@ -1,5 +1,6 @@
using System.Linq.Expressions;
using HomeInventory.Domain.Primitives;
+using HomeInventory.Infrastructure.Framework;
using HomeInventory.Infrastructure.Persistence.Models.Interceptors;
using Microsoft.EntityFrameworkCore;
@@ -22,7 +23,7 @@ public Option FindTracked(Func condition)
where TEntity : class =>
ChangeTracker
.Entries()
- .Select(e => e.Entity)
+ .Select(static e => e.Entity)
.Where(condition)
.HeadOrNone();
@@ -47,8 +48,8 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
private void UpdateAuditableEntities(DateTimeOffset now)
{
- UpdateTimeAuditEntities(now, EntityState.Added, x => x.CreatedOn);
- UpdateTimeAuditEntities(now, EntityState.Modified, x => x.ModifiedOn);
+ UpdateTimeAuditEntities(now, EntityState.Added, static x => x.CreatedOn);
+ UpdateTimeAuditEntities(now, EntityState.Modified, static x => x.ModifiedOn);
}
private void UpdateTimeAuditEntities(DateTimeOffset now, EntityState state, Expression> propertyExpression)
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Mapping/ModelMappings.cs b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Mapping/ModelMappings.cs
index 58656a68..7de8dd30 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Mapping/ModelMappings.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Mapping/ModelMappings.cs
@@ -8,7 +8,7 @@ internal sealed class ModelMappings : BaseMappingsProfile
{
public ModelMappings()
{
- CreateMap().Using(x => x.Value, ProductId.Converter);
- CreateMap().Using(obj => new() { Value = obj.Value, UnitName = obj.Unit.Name });
+ CreateMap().Using(static x => x.Value, ProductId.Converter);
+ CreateMap().Using(static obj => new() { Value = obj.Value, UnitName = obj.Unit.Name });
}
}
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Configurations/PolymorphicDomainEventTypeResolver.cs b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Configurations/PolymorphicDomainEventTypeResolver.cs
index 374a1b73..c70359d1 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Configurations/PolymorphicDomainEventTypeResolver.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Configurations/PolymorphicDomainEventTypeResolver.cs
@@ -8,7 +8,7 @@ namespace HomeInventory.Infrastructure.Persistence.Models.Configurations;
internal sealed class PolymorphicDomainEventTypeResolver(IEnumerable eventTypeInfoProviders) : DefaultJsonTypeInfoResolver
{
- private readonly IReadOnlyCollection _derivedTypes = eventTypeInfoProviders.SelectMany(p => p.DerivedTypes).ToArray();
+ private readonly IReadOnlyCollection _derivedTypes = eventTypeInfoProviders.SelectMany(static p => p.DerivedTypes).ToArray();
public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options)
{
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Interceptors/PublishDomainEventsInterceptor.cs b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Interceptors/PublishDomainEventsInterceptor.cs
index 1d0d84d2..745335ef 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Interceptors/PublishDomainEventsInterceptor.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/Interceptors/PublishDomainEventsInterceptor.cs
@@ -23,7 +23,7 @@ private async ValueTask PublishEventsAsync(DbContext context, CancellationToken
{
var domainEvents = context.ChangeTracker
.Entries()
- .Select(e => e.Entity.Content);
+ .Select(static e => e.Entity.Content);
foreach (var domainEvent in domainEvents)
{
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/OutboxMessage.cs b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/OutboxMessage.cs
index f48997e4..8f3c571b 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/OutboxMessage.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/Persistence/Models/OutboxMessage.cs
@@ -1,4 +1,5 @@
using HomeInventory.Domain.Primitives;
+using HomeInventory.Infrastructure.Framework.Models;
namespace HomeInventory.Infrastructure.Persistence.Models;
diff --git a/src/HomeInventory/HomeInventory.Infrastructure/Services/EventsPersistenceService.cs b/src/HomeInventory/HomeInventory.Infrastructure/Services/EventsPersistenceService.cs
index 4e14f1b1..8024870c 100644
--- a/src/HomeInventory/HomeInventory.Infrastructure/Services/EventsPersistenceService.cs
+++ b/src/HomeInventory/HomeInventory.Infrastructure/Services/EventsPersistenceService.cs
@@ -1,5 +1,5 @@
using HomeInventory.Domain.Primitives;
-using HomeInventory.Infrastructure.Persistence;
+using HomeInventory.Infrastructure.Framework;
using HomeInventory.Infrastructure.Persistence.Models;
namespace HomeInventory.Infrastructure.Services;
diff --git a/src/HomeInventory/HomeInventory.Tests.Acceptance/Drivers/HomeInventoryAPIDriver.cs b/src/HomeInventory/HomeInventory.Tests.Acceptance/Drivers/HomeInventoryAPIDriver.cs
index 5152d119..ae9c402b 100644
--- a/src/HomeInventory/HomeInventory.Tests.Acceptance/Drivers/HomeInventoryAPIDriver.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Acceptance/Drivers/HomeInventoryAPIDriver.cs
@@ -6,7 +6,7 @@
namespace HomeInventory.Tests.Acceptance.Drivers;
-internal sealed class HomeInventoryApiDriver : WebApplicationFactory, IHomeInventoryApiDriver
+internal sealed class HomeInventoryApiDriver : WebApplicationFactory, IHomeInventoryApiDriver
{
private readonly ITestingConfiguration _configuration;
private readonly Lazy _lazyUserManagement;
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/AssertionExtensions.cs b/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/AssertionExtensions.cs
index bcade450..92702ede 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/AssertionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/AssertionExtensions.cs
@@ -1,5 +1,4 @@
-using System.Collections;
-using System.Text.Json;
+using System.Text.Json;
using FluentAssertions.LanguageExt;
using HomeInventory.Application.Interfaces.Messaging;
using Microsoft.AspNetCore.Http;
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/ObjectExtensions.cs b/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/ObjectExtensions.cs
index d8c822c5..5955f028 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/ObjectExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/ObjectExtensions.cs
@@ -8,7 +8,7 @@ internal static class ObjectExtensions
{
if (typeof(T) == typeof(object))
{
- return (actual, expected) =>
+ return static (actual, expected) =>
{
if (actual is null && expected is null)
{
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/UlidAssertions.cs b/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/UlidAssertions.cs
index 5d9e19ea..924c6935 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/UlidAssertions.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/Assertions/UlidAssertions.cs
@@ -1,5 +1,4 @@
-using FluentAssertions.Execution;
-using Execute = FluentAssertions.Execution.Execute;
+using Execute = FluentAssertions.Execution.Execute;
namespace HomeInventory.Tests.Framework.Assertions;
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/Attributes/ArchitectureTestAttribute.cs b/src/HomeInventory/HomeInventory.Tests.Framework/Attributes/ArchitectureTestAttribute.cs
index b2f56355..926aea95 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/Attributes/ArchitectureTestAttribute.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/Attributes/ArchitectureTestAttribute.cs
@@ -7,7 +7,7 @@
public sealed class ArchitectureTestAttribute : CategoryTraitAttribute
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public ArchitectureTestAttribute()
: base("Architecture")
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/BaseTest.cs b/src/HomeInventory/HomeInventory.Tests.Framework/BaseTest.cs
index 0c94883d..eeb0e98a 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/BaseTest.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/BaseTest.cs
@@ -8,9 +8,9 @@ namespace HomeInventory.Tests.Framework;
public abstract class BaseTest : IAsyncLifetime
{
private readonly List _asyncDisposables = [];
- private readonly Lazy _lazyCancellation = new(() => new CancellationImplementation());
- private readonly Lazy _lazyFixture = new(() => new Fixture());
- private readonly Lazy _lazyDateTime = new(() => new FixedTimeProvider(TimeProvider.System));
+ private readonly Lazy _lazyCancellation = new(static () => new CancellationImplementation());
+ private readonly Lazy _lazyFixture = new(static () => new Fixture());
+ private readonly Lazy _lazyDateTime = new(static () => new FixedTimeProvider(TimeProvider.System));
protected BaseTest()
{
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/ApiBehaviorOptionsCustomization.cs b/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/ApiBehaviorOptionsCustomization.cs
index 0b5e5560..1280bddb 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/ApiBehaviorOptionsCustomization.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/ApiBehaviorOptionsCustomization.cs
@@ -6,7 +6,7 @@ internal class ApiBehaviorOptionsCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
- fixture.Customize(c => c
- .Without(x => x.InvalidModelStateResponseFactory));
+ fixture.Customize(static c => c
+ .Without(static x => x.InvalidModelStateResponseFactory));
}
}
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/FixtureExtensions.cs b/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/FixtureExtensions.cs
index 96d720e3..4eab60e9 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/FixtureExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/Customizations/FixtureExtensions.cs
@@ -9,12 +9,12 @@ public static IFixture CustomizeId(this IFixture fixture)
where TId : class, IUlidBuildable, IUlidIdentifierObject, IValuableIdentifierObject =>
fixture
.CustomizeUlid()
- .CustomizeFromFactory>(s => (TId)TId.CreateBuilder().WithValue(s.Supply()).Build());
+ .CustomizeFromFactory>(static s => (TId)TId.CreateBuilder().WithValue(s.Supply()).Build());
public static IFixture CustomizeEmail(this IFixture fixture) =>
fixture
.CustomizeUlid()
- .CustomizeFromFactory>(s => new Email(s.Supply().ToString() + "@email.com"));
+ .CustomizeFromFactory>(static s => new Email(s.Supply().ToString() + "@email.com"));
public static IFixture CustomizeFromFactory(this IFixture fixture, Func createFunc)
{
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/GivenContext.cs b/src/HomeInventory/HomeInventory.Tests.Framework/GivenContext.cs
index 36300abe..46f43c87 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/GivenContext.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/GivenContext.cs
@@ -37,7 +37,7 @@ public TContext New(out IVariable variable, Func> createMan
}
public TContext EmptyHashCode(out IVariable emptyHash) =>
- New(out emptyHash, () => new HashCode());
+ New(out emptyHash, static () => new HashCode());
public TContext SubstituteFor(out IVariable variable, IVariable arg1, IVariable arg2, Action setup, [CallerArgumentExpression(nameof(variable))] string? name = null)
where T : class
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj b/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
index 07f0ec9c..80a9fbdd 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/HomeInventory.Tests.Framework.csproj
@@ -13,7 +13,9 @@
+
+
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/RandomExtensions.cs b/src/HomeInventory/HomeInventory.Tests.Framework/RandomExtensions.cs
index 446df34a..5ff0aefc 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/RandomExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/RandomExtensions.cs
@@ -1,5 +1,4 @@
-using HomeInventory.Domain.Primitives;
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace HomeInventory.Tests.Framework;
diff --git a/src/HomeInventory/HomeInventory.Tests.Framework/VariableValues.cs b/src/HomeInventory/HomeInventory.Tests.Framework/VariableValues.cs
index d6326f61..71928d2b 100644
--- a/src/HomeInventory/HomeInventory.Tests.Framework/VariableValues.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Framework/VariableValues.cs
@@ -26,7 +26,7 @@ public Option> TryGetOrAdd(int index, Func createValueFunc)
? OptionNone.Default
: GetOrAdd(index, createValueFunc);
- public IEnumerable GetAll() => _values.Select(x => x.Value);
+ public IEnumerable GetAll() => _values.Select(static x => x.Value);
private PropertyValue GetOrAdd(int index, Func createValueFunc) =>
index == _values.Count
@@ -51,8 +51,11 @@ public async ValueTask DisposeAsync()
case IDisposable disposable:
disposable.Dispose();
break;
+ default:
+ break;
}
}
+
_values.Clear();
}
}
diff --git a/src/HomeInventory/HomeInventory.Tests.Integration/BaseIntegrationTest.cs b/src/HomeInventory/HomeInventory.Tests.Integration/BaseIntegrationTest.cs
index eb0715b2..fc74b4a8 100644
--- a/src/HomeInventory/HomeInventory.Tests.Integration/BaseIntegrationTest.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Integration/BaseIntegrationTest.cs
@@ -10,7 +10,7 @@ namespace HomeInventory.Tests.Integration;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1001:Types that own disposable fields should be disposable", Justification = "See InitializeDisposables")]
public abstract class BaseIntegrationTest : BaseTest
{
- private readonly WebApplicationFactory _appFactory = new();
+ private readonly WebApplicationFactory _appFactory = new();
private readonly HttpClient _client;
private readonly ITestOutputHelper _testOutputHelper;
@@ -27,7 +27,7 @@ protected IEnumerable GetEndpoints() =>
_appFactory
.Services
.GetServices()
- .SelectMany(s => s.Endpoints)
+ .SelectMany(static s => s.Endpoints)
.OfType();
protected async Task PostAsync(string route, JsonContent content)
diff --git a/src/HomeInventory/HomeInventory.Tests.Integration/UserManagementApiTests.cs b/src/HomeInventory/HomeInventory.Tests.Integration/UserManagementApiTests.cs
index b56527fe..f03b2830 100644
--- a/src/HomeInventory/HomeInventory.Tests.Integration/UserManagementApiTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests.Integration/UserManagementApiTests.cs
@@ -33,7 +33,7 @@ public void VerifyEndpoints()
using var scope = new AssertionScope();
endpoints.Should().ContainEndpoint(_registerRoute, HttpMethods.Post)
- .Which.Metadata.Should().ContainSingle(x => x is AllowAnonymousAttribute);
+ .Which.Metadata.Should().ContainSingle(static x => x is AllowAnonymousAttribute);
}
[Fact]
@@ -74,7 +74,7 @@ public async Task RegisterSameTwice_ReturnsFailure()
#pragma warning disable CA1308 // Normalize strings to uppercase
body.Extensions.Should().ContainKey("errors")
.WhoseValue.Should().BeJsonElement()
- .Which.Should().BeArray(e => e.Should().HaveProperty(nameof(DuplicateEmailError.Message).ToLowerInvariant())
+ .Which.Should().BeArray(static e => e.Should().HaveProperty(nameof(DuplicateEmailError.Message).ToLowerInvariant())
.Which.Should().HaveValue(DuplicateEmailError.DefaultMessage));
#pragma warning restore CA1308 // Normalize strings to uppercase
}
diff --git a/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagGivenTestContext.cs b/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagGivenTestContext.cs
new file mode 100644
index 00000000..322d0e86
--- /dev/null
+++ b/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagGivenTestContext.cs
@@ -0,0 +1,22 @@
+using HomeInventory.Application.Framework;
+
+namespace HomeInventory.Tests.Application;
+
+public sealed class FeatureFlagGivenTestContext(BaseTest test) : GivenContext(test)
+{
+ private static readonly Variable _sut = new(nameof(_sut));
+ private static readonly Variable> _sutContext = new(nameof(_sutContext));
+
+ internal FeatureFlagGivenTestContext Sut(out IVariable sut, IVariable nameVariable) =>
+ New(out sut, () => Create(nameVariable));
+
+ internal FeatureFlagGivenTestContext Sut(out IVariable> sut, IVariable nameVariable, IVariable contextVariable) =>
+ New(out sut, () => Create(nameVariable, contextVariable));
+
+ private IFeatureFlag Create(IVariable nameVariable) =>
+ FeatureFlag.Create(GetValue(nameVariable));
+
+ private IFeatureFlag Create(IVariable nameVariable, IVariable contextVariable)
+ where TContext : notnull =>
+ FeatureFlag.Create(GetValue(nameVariable), GetValue(contextVariable));
+}
diff --git a/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagTests.cs b/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagTests.cs
index 140bc291..e3037641 100644
--- a/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Application/FeatureFlagTests.cs
@@ -4,7 +4,7 @@
namespace HomeInventory.Tests.Application;
[UnitTest]
-public sealed class FeatureFlagTests() : BaseTest(t => new(t))
+public sealed class FeatureFlagTests() : BaseTest(static t => new(t))
{
private static readonly Variable _manager = new(nameof(_manager));
@@ -16,10 +16,10 @@ public void ConstructorShouldPreserveName()
.Sut(out var sut, name);
var then = When
- .Invoked(sut, sut => sut.Name);
+ .Invoked(sut, static sut => sut.Name);
then
- .Result(name, (actual, expected) => actual.Should().Be(expected));
+ .Result(name, static (actual, expected) => actual.Should().Be(expected));
}
[Fact]
@@ -32,8 +32,8 @@ public void CreateShouldPreserveName()
.Invoked(name, FeatureFlag.Create);
then
- .Result(flag => flag.Should().NotBeNull())
- .Result(name, (actual, expected) => actual.Name.Should().Be(expected));
+ .Result(static flag => flag.Should().NotBeNull())
+ .Result(name, static (actual, expected) => actual.Name.Should().Be(expected));
}
[Fact]
@@ -47,9 +47,9 @@ public void CreateWithContextShouldPreserveName()
.Invoked(name, context, FeatureFlag.Create);
then
- .Result(flag => flag.Should().NotBeNull())
- .Result(name, (actual, expected) => actual.Name.Should().Be(expected))
- .Result(context, (actual, expected) => actual.Context.Should().Be(expected));
+ .Result(static flag => flag.Should().NotBeNull())
+ .Result(name, static (actual, expected) => actual.Name.Should().Be(expected))
+ .Result(context, static (actual, expected) => actual.Context.Should().Be(expected));
}
[Theory]
@@ -79,12 +79,12 @@ public void WithContextShouldReturn()
.Sut(out var sut, name);
var then = When
- .Invoked(sut, context, (sut, context) => sut.WithContext(context));
+ .Invoked(sut, context, static (sut, context) => sut.WithContext(context));
then
- .Result(flag => flag.Should().NotBeNull())
- .Result(name, (actual, expected) => actual.Name.Should().Be(expected))
- .Result(context, (actual, expected) => actual.Context.Should().Be(expected));
+ .Result(static flag => flag.Should().NotBeNull())
+ .Result(name, static (actual, expected) => actual.Name.Should().Be(expected))
+ .Result(context, static (actual, expected) => actual.Context.Should().Be(expected));
}
[Theory]
@@ -105,25 +105,4 @@ public async Task IsEnabledContextShouldReturnManagerValue(bool expectedValue)
then
.Result(flag => flag.Should().Be(expectedValue));
}
-
-#pragma warning disable CA1034 // Nested types should not be visible
- public sealed class GivenTestContext(BaseTest test) : GivenContext(test)
-#pragma warning restore CA1034 // Nested types should not be visible
- {
- private static readonly Variable _sut = new(nameof(_sut));
- private static readonly Variable> _sutContext = new(nameof(_sutContext));
-
- internal GivenTestContext Sut(out IVariable sut, IVariable nameVariable) =>
- New(out sut, () => Create(nameVariable));
-
- internal GivenTestContext Sut(out IVariable> sut, IVariable nameVariable, IVariable contextVariable) =>
- New(out sut, () => Create(nameVariable, contextVariable));
-
- private IFeatureFlag Create(IVariable nameVariable) =>
- FeatureFlag.Create(GetValue(nameVariable));
-
- private IFeatureFlag Create(IVariable nameVariable, IVariable contextVariable)
- where TContext : notnull =>
- FeatureFlag.Create(GetValue(nameVariable), GetValue(contextVariable));
- }
}
diff --git a/src/HomeInventory/HomeInventory.Tests/Core/InternalTestSubject.cs b/src/HomeInventory/HomeInventory.Tests/Core/InternalTestSubject.cs
index 81a35e7b..a188beec 100644
--- a/src/HomeInventory/HomeInventory.Tests/Core/InternalTestSubject.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Core/InternalTestSubject.cs
@@ -1,13 +1,10 @@
namespace HomeInventory.Tests.Core;
-public sealed class InternalTestSubject
+internal sealed class InternalTestSubject
{
internal InternalTestSubject()
{
}
- internal InternalTestSubject(object arg)
- {
- _ = arg;
- }
+ internal InternalTestSubject(object arg) => _ = arg;
}
diff --git a/src/HomeInventory/HomeInventory.Tests/DependencyInjection/InfrastructureDependencyInjectionTests.cs b/src/HomeInventory/HomeInventory.Tests/DependencyInjection/InfrastructureDependencyInjectionTests.cs
index ba483ef8..8ec03107 100644
--- a/src/HomeInventory/HomeInventory.Tests/DependencyInjection/InfrastructureDependencyInjectionTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/DependencyInjection/InfrastructureDependencyInjectionTests.cs
@@ -4,6 +4,7 @@
using HomeInventory.Application;
using HomeInventory.Domain.Primitives;
using HomeInventory.Domain.ValueObjects;
+using HomeInventory.Infrastructure.Framework;
using HomeInventory.Infrastructure.Persistence;
using HomeInventory.Infrastructure.Persistence.Mapping;
using HomeInventory.Infrastructure.Persistence.Models.Configurations;
diff --git a/src/HomeInventory/HomeInventory.Tests/DependencyInjection/TestAppBuilder.cs b/src/HomeInventory/HomeInventory.Tests/DependencyInjection/TestAppBuilder.cs
index 3df4dc5d..99909b89 100644
--- a/src/HomeInventory/HomeInventory.Tests/DependencyInjection/TestAppBuilder.cs
+++ b/src/HomeInventory/HomeInventory.Tests/DependencyInjection/TestAppBuilder.cs
@@ -22,7 +22,7 @@ public TestAppBuilder(IServiceCollection collection)
public IServiceProvider ServiceProvider { get; }
public ICollection DataSources { get; } = [];
- public RequestDelegate Build() => (HttpContext ctx) => Task.CompletedTask;
+ public RequestDelegate Build() => static (HttpContext ctx) => Task.CompletedTask;
public IApplicationBuilder CreateApplicationBuilder() => this;
diff --git a/src/HomeInventory/HomeInventory.Tests/Domain/EntityTests.cs b/src/HomeInventory/HomeInventory.Tests/Domain/EntityTests.cs
index ef6080cd..cf4481de 100644
--- a/src/HomeInventory/HomeInventory.Tests/Domain/EntityTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Domain/EntityTests.cs
@@ -4,7 +4,7 @@
namespace HomeInventory.Tests.Domain;
[UnitTest]
-public sealed class EntityTests() : BaseTest(t => new(t))
+public sealed class EntityTests() : BaseTest(static t => new(t))
{
[Fact]
public void EqualsTEntity_Should_ReturnTrueWhenSameReference()
@@ -14,8 +14,8 @@ public void EqualsTEntity_Should_ReturnTrueWhenSameReference()
.Sut(out var sut, id);
When
- .Invoked(sut, sut => sut.Equals(sut))
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut, static sut => sut.Equals(sut))
+ .Result(static actual => actual.Should().BeTrue());
}
[Fact]
@@ -27,8 +27,8 @@ public void EqualsTEntity_Should_ReturnTrueWhenOtherHasSameId()
.Sut(out var sut, id);
When
- .Invoked(sut, other, (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut, other, static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeTrue());
}
[Fact]
@@ -39,8 +39,8 @@ public void EqualsTEntity_Should_ReturnFalseWhenOtherIsNull()
.Sut(out var sut, id);
When
- .Invoked(sut, sut => sut.Equals(default))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, static sut => sut.Equals(default))
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -52,8 +52,8 @@ public void EqualsTEntity_Should_ReturnFalseWhenOtherHasDifferentId()
.Sut(out var sut, id[1]);
When
- .Invoked(sut, other, (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, other, static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -65,8 +65,8 @@ public void EqualsObject_Should_ReturnFalseWhenOtherHasDifferentType()
.Sut(out var sut, id);
When
- .Invoked(sut, other, (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, other, static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -77,8 +77,8 @@ public void EqualsObject_Should_ReturnTrueWhenSameReference()
.Sut(out var sut, id);
When
- .Invoked(sut, sut => sut.Equals((object)sut))
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut, static sut => sut.Equals((object)sut))
+ .Result(static actual => actual.Should().BeTrue());
}
[Fact]
@@ -90,8 +90,8 @@ public void EqualsObject_Should_ReturnTrueWhenOtherHasSameId()
.Sut(out var sut, id);
When
- .Invoked(sut, other, (sut, other) => sut.Equals((object)other))
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut, other, static (sut, other) => sut.Equals((object)other))
+ .Result(static actual => actual.Should().BeTrue());
}
[Fact]
@@ -102,8 +102,8 @@ public void EqualsObject_Should_ReturnFalseWhenOtherIsNull()
.Sut(out var sut, id);
When
- .Invoked(sut, sut => sut.Equals(default(object?)))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, static sut => sut.Equals(default(object?)))
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -115,8 +115,8 @@ public void EqualsObject_Should_ReturnFalseWhenOtherHasDifferentId()
.Sut(out var sut, id[1]);
When
- .Invoked(sut, other, (sut, other) => sut.Equals((object)other))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, other, static (sut, other) => sut.Equals((object)other))
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -128,8 +128,8 @@ public void GetHashCode_Should_ReturnGetHashCodeFromId()
.Sut(out var sut, id);
When
- .Invoked(sut, sut => sut.GetHashCode())
- .Result(hash, (actual, hash) => actual.Should().Be(hash.ToHashCode()));
+ .Invoked(sut, static sut => sut.GetHashCode())
+ .Result(hash, static (actual, hash) => actual.Should().Be(hash.ToHashCode()));
}
[Fact]
@@ -141,8 +141,8 @@ public void OpEquals_Should_ReturnTrueWhenOtherHasSameId()
.Sut(out var sut, id);
When
- .Invoked(sut, other, (sut, other) => sut == other)
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut, other, static (sut, other) => sut == other)
+ .Result(static actual => actual.Should().BeTrue());
}
[Fact]
@@ -154,8 +154,8 @@ public void OpEquals_Should_ReturnFalseWhenOtherHasDifferentId()
.Sut(out var sut, id[1]);
When
- .Invoked(sut, other, (sut, other) => sut == other)
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, other, static (sut, other) => sut == other)
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -167,8 +167,8 @@ public void OpNotEquals_Should_ReturnFalseWhenOtherHasSameId()
.Sut(out var sut, id);
When
- .Invoked(sut, other, (sut, other) => sut != other)
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut, other, static (sut, other) => sut != other)
+ .Result(static actual => actual.Should().BeFalse());
}
[Fact]
@@ -180,8 +180,8 @@ public void OpNotEquals_Should_ReturnTrueWhenOtherHasDifferentId()
.Sut(out var sut, id[1]);
When
- .Invoked(sut, other, (sut, other) => sut != other)
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut, other, static (sut, other) => sut != other)
+ .Result(static actual => actual.Should().BeTrue());
}
}
diff --git a/src/HomeInventory/HomeInventory.Tests/Domain/EquatableComponentTests.cs b/src/HomeInventory/HomeInventory.Tests/Domain/EquatableComponentTests.cs
index 318388e6..0509c0a1 100644
--- a/src/HomeInventory/HomeInventory.Tests/Domain/EquatableComponentTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Domain/EquatableComponentTests.cs
@@ -4,7 +4,7 @@
namespace HomeInventory.Tests.Domain;
[UnitTest]
-public class EquatableComponentTests() : BaseTest(t => new(t))
+public class EquatableComponentTests() : BaseTest(static t => new(t))
{
[Fact]
public void GetHashCode_ShoudReturnZero_WhenNoComponents()
@@ -14,8 +14,8 @@ public void GetHashCode_ShoudReturnZero_WhenNoComponents()
.EmptyHashCode(out var hash);
When
- .Invoked(sut, sut => sut.GetHashCode())
- .Result(hash, (actual, hash) => actual.Should().Be(hash.ToHashCode()));
+ .Invoked(sut, static sut => sut.GetHashCode())
+ .Result(hash, static (actual, hash) => actual.Should().Be(hash.ToHashCode()));
}
[Theory]
@@ -30,8 +30,8 @@ public void GetHashCode_ShoudReturnCombinedComponentsHash_WhenManyComponents(int
.Sut(out var sut, component);
When
- .Invoked(sut, sut => sut.GetHashCode())
- .Result(hash, (actual, hash) => actual.Should().Be(hash.ToHashCode()));
+ .Invoked(sut, static sut => sut.GetHashCode())
+ .Result(hash, static (actual, hash) => actual.Should().Be(hash.ToHashCode()));
}
[Fact]
@@ -41,8 +41,8 @@ public void Equals_ShoudBeEqualToEmpty_WhenNoComponents()
.Sut(out var sut, 2);
When
- .Invoked(sut[0], sut[1], (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut[0], sut[1], static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeTrue());
}
[Theory]
@@ -57,8 +57,8 @@ public void Equals_ShoudNotBeEqualToEmpty_WhenManyComponents(int count)
.Sut(out var sut2);
When
- .Invoked(sut1, sut2, (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut1, sut2, static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeFalse());
}
[Theory]
@@ -72,8 +72,8 @@ public void Equals_ShoudBeEqualToComponentWithSameItems_WhenManyComponents(int c
.Sut(out var sut, component, 2);
When
- .Invoked(sut[0], sut[1], (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeTrue());
+ .Invoked(sut[0], sut[1], static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeTrue());
}
[Theory]
@@ -87,8 +87,8 @@ public void Equals_ShoudNotBeEqualToComponentWithDifferentItems_WhenManyComponen
.Sut(out var sut, component, ..count, count..);
When
- .Invoked(sut[0], sut[1], (sut, other) => sut.Equals(other))
- .Result(actual => actual.Should().BeFalse());
+ .Invoked(sut[0], sut[1], static (sut, other) => sut.Equals(other))
+ .Result(static actual => actual.Should().BeFalse());
}
}
@@ -115,5 +115,5 @@ public EquatableComponentTestsGivenContext Sut(out IVariable> sut, IVariable variable, string name, params Range[] ranges) =>
New(out sut, i => CreateSut(variable, ranges[i]), ranges.Length, name);
- private EquatableComponent CreateSut(IVariable variable, Range range) => new(Array.ConvertAll(Variables.GetMany(variable, range).ToArray(), x => (object)x));
+ private EquatableComponent CreateSut(IVariable variable, Range range) => new(Array.ConvertAll(Variables.GetMany(variable, range).ToArray(), static x => (object)x));
}
diff --git a/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountTests.cs b/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountTests.cs
index dda90e18..6ddccf8e 100644
--- a/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountTests.cs
@@ -1,5 +1,4 @@
-using FluentAssertions.Execution;
-using HomeInventory.Domain.Primitives;
+using HomeInventory.Domain.Primitives;
using HomeInventory.Domain.ValueObjects;
namespace HomeInventory.Tests.Domain.ValueObjects;
diff --git a/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountUnitTests.cs b/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountUnitTests.cs
index 5c022d2f..1f1881a0 100644
--- a/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountUnitTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/AmountUnitTests.cs
@@ -57,14 +57,14 @@ public void FieldsShoulHaveMatchedName()
var fields = typeof(AmountUnit).GetFieldsOfType().ToArray();
fields.Should().NotBeEmpty()
- .And.AllSatisfy(t => t.Value!.Name.Should().Be(t.Field.Name));
+ .And.AllSatisfy(static t => t.Value!.Name.Should().Be(t.Field.Name));
}
[Fact]
public void CanBeUsedAsDictionaryKey()
{
- var dictionary = _items.ToDictionary(x => x, x => x.Name);
+ var dictionary = _items.ToDictionary(static x => x, static x => x.Name);
var values = typeof(AmountUnit).GetFieldValuesOfType().ToArray();
dictionary.Should().ContainKeys(values);
diff --git a/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/MeasurementTypeTests.cs b/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/MeasurementTypeTests.cs
index 174ce347..72c3b98a 100644
--- a/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/MeasurementTypeTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Domain/ValueObjects/MeasurementTypeTests.cs
@@ -1,5 +1,4 @@
-using FluentAssertions.Execution;
-using HomeInventory.Domain.Primitives;
+using HomeInventory.Domain.Primitives;
using HomeInventory.Domain.Primitives.Ids;
using HomeInventory.Domain.ValueObjects;
@@ -41,13 +40,13 @@ public void FieldsShoulHaveMatchedName()
var fields = typeof(MeasurementType).GetFieldsOfType().ToArray();
fields.Should().NotBeEmpty()
- .And.AllSatisfy(t => t.Value!.Name.Should().Be(t.Field.Name));
+ .And.AllSatisfy(static t => t.Value!.Name.Should().Be(t.Field.Name));
}
[Fact]
public void CanBeUsedAsDictionaryKey()
{
- var dictionary = _items.ToDictionary(x => x, x => x.Name);
+ var dictionary = _items.ToDictionary(static x => x, static x => x.Name);
var values = typeof(MeasurementType).GetFieldValuesOfType().ToArray();
dictionary.Should().ContainKeys(values);
diff --git a/src/HomeInventory/HomeInventory.Tests/Framework/Assertions/ServiceDescriptorExtensionsTests.cs b/src/HomeInventory/HomeInventory.Tests/Framework/Assertions/ServiceDescriptorExtensionsTests.cs
index 664817cd..a6dd5e42 100644
--- a/src/HomeInventory/HomeInventory.Tests/Framework/Assertions/ServiceDescriptorExtensionsTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Framework/Assertions/ServiceDescriptorExtensionsTests.cs
@@ -39,7 +39,9 @@ public void GetInstance_ShouldReturnFromImplementationFactory()
public void GetInstance_ShouldReturnFromImplementationType()
{
var expectedType = typeof(object);
+#pragma warning disable CA2263 // Prefer generic overload when type is known
var descriptor = ServiceDescriptor.Singleton(typeof(object), expectedType);
+#pragma warning restore CA2263 // Prefer generic overload when type is known
var actual = ServiceDescriptorExtensions.GetInstance(descriptor, _serviceProvider);
diff --git a/src/HomeInventory/HomeInventory.Tests/Middlewares/CorrelationIdMiddlewareTests.cs b/src/HomeInventory/HomeInventory.Tests/Middlewares/CorrelationIdMiddlewareTests.cs
index 3632ec6d..0c2093b5 100644
--- a/src/HomeInventory/HomeInventory.Tests/Middlewares/CorrelationIdMiddlewareTests.cs
+++ b/src/HomeInventory/HomeInventory.Tests/Middlewares/CorrelationIdMiddlewareTests.cs
@@ -96,8 +96,8 @@ public async Task InvokeAsync_Should_CreateCorrelationId_When_HeaderIsNotSet()
public async Task InvokeAsync_Should_AddCorrelationIdToResponse()
{
_httpResponseFeature
- .When(f => f.OnStarting(Arg.Any>(), Arg.Any