diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bde2d00c7..892b87a20 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -293,7 +293,7 @@ jobs:
- name: Install Living Documentation Tool
run: dotnet tool install --global SpecFlow.Plus.LivingDoc.CLI
- name: Generate Living Documentation Specification
- run: livingdoc test-assembly "HomeInventory.Tests.Acceptance/bin/Release/net8/HomeInventory.Tests.Acceptance.dll" -t "HomeInventory.Tests.Acceptance/bin/Release/net8/TestExecution.json" -o "./Acceptance/AcceptanceTestResults.html"
+ run: livingdoc test-assembly "HomeInventory.Tests.Acceptance/bin/Release/net9/HomeInventory.Tests.Acceptance.dll" -t "HomeInventory.Tests.Acceptance/bin/Release/net9/TestExecution.json" -o "./Acceptance/AcceptanceTestResults.html"
working-directory: ./src/HomeInventory
- name: Publish Specflow Test Results
if: success() || failure()
diff --git a/.gitignore b/.gitignore
index 3e895aa13..d0709c8d6 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/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 000000000..8f5aaa3f6
--- /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 000000000..7b08163ce
--- /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 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/HomeInventory/.editorconfig b/src/HomeInventory/.editorconfig
index 3dd0c3bb6..a8aa075ca 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/.idea/.idea.HomeInventory/.idea/.gitignore b/src/HomeInventory/.idea/.idea.HomeInventory/.idea/.gitignore
new file mode 100644
index 000000000..50b72f879
--- /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 000000000..7b08163ce
--- /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 000000000..b2bdec2d7
--- /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 000000000..d0792d880
--- /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
diff --git a/src/HomeInventory/Directory.Build.props b/src/HomeInventory/Directory.Build.props
index 437392fff..699184928 100644
--- a/src/HomeInventory/Directory.Build.props
+++ b/src/HomeInventory/Directory.Build.props
@@ -1,7 +1,7 @@
- net8
+ net9
enable
enable
latest
@@ -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 a159166b9..aadbfabd5 100644
--- a/src/HomeInventory/Directory.Packages.props
+++ b/src/HomeInventory/Directory.Packages.props
@@ -2,8 +2,7 @@
true
-
-
+
@@ -28,12 +27,9 @@
-
-
-
-
+
@@ -44,33 +40,39 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
@@ -78,11 +80,11 @@
-
-
+
+
-
+
@@ -90,16 +92,15 @@
-
-
-
+
-
-
+
+
+
\ No newline at end of file
diff --git a/src/HomeInventory/Dockerfile b/src/HomeInventory/Dockerfile
index 7be5506d0..75c1c8865 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", "."]
diff --git a/src/HomeInventory/HomeInventory.Api/AppBuilder.cs b/src/HomeInventory/HomeInventory.Api/AppBuilder.cs
index 0c5105f66..e0022575e 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 972a990fe..fe1716e1e 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 5de394939..4f9b50184 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 6a40b5f1d..128e7921f 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 fc6784eee..3aa19cccf 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/HomeInventory.Application.Framework.csproj b/src/HomeInventory/HomeInventory.Application.Framework/HomeInventory.Application.Framework.csproj
index eaa461737..7a4d0e621 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.Framework/Messaging/CommandHandler.cs b/src/HomeInventory/HomeInventory.Application.Framework/Messaging/CommandHandler.cs
index 5b6e4a365..03c7d7656 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 de173772c..42bfdce8d 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.UserManagement.Interfaces/HomeInventory.Application.UserManagement.Interfaces.csproj b/src/HomeInventory/HomeInventory.Application.UserManagement.Interfaces/HomeInventory.Application.UserManagement.Interfaces.csproj
index ab9fbce6a..3bcfd5459 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 6a513b08f..f2dce19ad 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/Cqrs/Behaviors/LoggingBehavior.cs b/src/HomeInventory/HomeInventory.Application/Cqrs/Behaviors/LoggingBehavior.cs
index 535cea524..ea0c99e58 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.Application/HomeInventory.Application.csproj b/src/HomeInventory/HomeInventory.Application/HomeInventory.Application.csproj
index 92b1a1f92..4993cdd19 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.Contracts.UserManagement.Validators/PasswordCharacterSets.cs b/src/HomeInventory/HomeInventory.Contracts.UserManagement.Validators/PasswordCharacterSets.cs
index 333f9d15e..1988b8d89 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 54b7916f4..c21fc4d12 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 1c6f086dc..e79c84996 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 a8e651f03..8a500665e 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 b7742e84b..7ec4713e6 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/PowerExtensions.cs b/src/HomeInventory/HomeInventory.Core/PowerExtensions.cs
deleted file mode 100644
index 894d87461..000000000
--- a/src/HomeInventory/HomeInventory.Core/PowerExtensions.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using LanguageExt.SomeHelp;
-using System.Numerics;
-
-namespace HomeInventory.Core;
-
-public static class PowerExtensions
-{
- public static TBase AsPowerWithBase(this TPower power, TBase @base)
- where TPower : IAdditiveIdentity, IComparisonOperators, IIncrementOperators
- where TBase : IMultiplyOperators
- {
- var result = @base;
- for (var i = TPower.AdditiveIdentity; i < power; i++)
- {
- result *= @base;
- }
-
- return result;
- }
-
- public static bool IsPow10(this decimal d) => d.IsPowOf(power: 10);
-
- public static bool IsPowOf(this decimal d, int power) => decimal.Abs(d).GetBase().DividesBy(power);
-
- private static Int128 GetBase(this decimal abs)
- {
- Span bits = stackalloc int[4];
- _ = decimal.GetBits(abs, bits);
- return (Int128)bits[0] + ((Int128)bits[1] << 32) + ((Int128)bits[2] << 64);
- }
-
- private static bool DividesBy(this Int128 value, Int128 power)
- {
- while (value > 0)
- {
- (value, var divides) = value.DividesByCore(power);
- if (divides)
- {
- return (bool)divides;
- }
- }
-
- return false;
- }
-
- private static (Int128 Quotient, Option Divides) DividesByCore(this Int128 value, Int128 power)
- {
- var (quotient, reminder) = Int128.DivRem(value, power);
-
- if (reminder == 0)
- {
- return (quotient, quotient == 1 ? true.ToSome() : OptionNone.Default);
- }
-
- return (quotient, false);
- }
-}
diff --git a/src/HomeInventory/HomeInventory.Core/ScopeAccessorExtensions.cs b/src/HomeInventory/HomeInventory.Core/ScopeAccessorExtensions.cs
index 7f84280f9..8133b4383 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 af077e7f9..ce0541bb2 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 567e4af1a..3c36231c7 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 0b0636d4c..8bc1f2434 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 b44d013f8..56ac2dcd8 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 7dfc4db05..98f7ba32f 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 159aaab16..050b5ab91 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 1f0294a46..1266ca6ff 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 784ba3577..57ed7fb1b 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 5f9a46bc1..6de01f1d5 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 0acf61a84..f19006dce 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 1fac1357f..50e39efe1 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 3de803a7e..235eef861 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 5f87d5c29..7bc69386b 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.Tests.Framework/RandomExtensions.cs b/src/HomeInventory/HomeInventory.Tests.Framework/RandomExtensions.cs
index 446df34a8..5ff0aefce 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 d6326f617..71928d2b7 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 eb0715b26..fc74b4a8e 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/HomeInventory.Tests.Integration.csproj b/src/HomeInventory/HomeInventory.Tests.Integration/HomeInventory.Tests.Integration.csproj
index 5fa0a094e..d38ebfd9e 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
diff --git a/src/HomeInventory/HomeInventory.Tests.Integration/UserManagementApiTests.cs b/src/HomeInventory/HomeInventory.Tests.Integration/UserManagementApiTests.cs
index b56527fec..f03b2830a 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 000000000..322d0e861
--- /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 140bc2915..e30376417 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 81a35e7b6..a188beec0 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 ba483ef8e..8ec03107c 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 3df4dc5de..99909b894 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 ef6080cd1..cf4481deb 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 318388e69..0509c0a15 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 dda90e186..6ddccf8eb 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 5c022d2f5..1f1881a07 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 174ce3473..72c3b98ae 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 664817cd1..a6dd5e42a 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/HomeInventory.Tests.csproj b/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
index 78bdae542..4357c9e41 100644
--- a/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
+++ b/src/HomeInventory/HomeInventory.Tests/HomeInventory.Tests.csproj
@@ -1,4 +1,4 @@
-
+
$(NoWarn);CA1707;AD0001
@@ -9,13 +9,13 @@
-
+
+
-
diff --git a/src/HomeInventory/HomeInventory.Tests/Middlewares/CorrelationIdMiddlewareTests.cs b/src/HomeInventory/HomeInventory.Tests/Middlewares/CorrelationIdMiddlewareTests.cs
index 3632ec6df..0c2093b59 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
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/HomeInventoryProblemDetailsFactory.cs b/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/HomeInventoryProblemDetailsFactory.cs
index 3f170e17a..c096a873b 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/HomeInventoryProblemDetailsFactory.cs
+++ b/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/HomeInventoryProblemDetailsFactory.cs
@@ -63,7 +63,7 @@ private ProblemDetails InternalConvertToProblem(IEnumerable errors)
return problems.FirstOrDefault() ?? throw new InvalidOperationException("Has to be at least one error provided");
}
- var statuses = problems.Select(x => x.Status).ToHashSet();
+ var statuses = problems.Select(static x => x.Status).ToHashSet();
var status = (statuses.Count == 1 ? statuses.First() : default) ?? _defaultStatusCode;
return CreateProblem(
status,
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsExtensions.cs b/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsExtensions.cs
index d3de81c82..445728da4 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsExtensions.cs
@@ -39,7 +39,7 @@ public static TProblem AddProblemDetailsExtensions(this TProblem probl
public static TProblem AddProblemDetailsExtensions(this TProblem problemDetails, Seq errors)
where TProblem : ProblemDetails
{
- problemDetails.Extensions["errorCodes"] = errors.Select(e => e.GetType().Name).ToArray();
+ problemDetails.Extensions["errorCodes"] = errors.Select(static e => e.GetType().Name).ToArray();
problemDetails.Extensions["errors"] = errors.ToArray();
return problemDetails;
}
@@ -53,15 +53,15 @@ public static TProblem AddProblemsAndStatuses(this TProblem problemDet
private static Dictionary ToErrorDictionary(this ModelStateDictionary modelState) =>
modelState
- .Select(p => (p.Key, Messages: p.Value?.Errors.GetErrorMessages() ?? []))
- .Where(x => x.Messages.Length > 0)
- .ToDictionary(x => x.Key, x => x.Messages);
+ .Select(static p => (p.Key, Messages: p.Value?.Errors.GetErrorMessages() ?? []))
+ .Where(static x => x.Messages.Length > 0)
+ .ToDictionary(static x => x.Key, static x => x.Messages);
private static string[] GetErrorMessages(this ModelErrorCollection collection) =>
collection switch
{
{ Count: 1 } errors => [errors[0].GetErrorMessage()],
- { } errors => errors.Select(e => e.GetErrorMessage()).ToArray(),
+ { } errors => errors.Select(static e => e.GetErrorMessage()).ToArray(),
_ => [],
};
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsFactoryExtensions.cs b/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsFactoryExtensions.cs
index 7f28853f0..d3c5775a3 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsFactoryExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Web.Framework/Infrastructure/ProblemDetailsFactoryExtensions.cs
@@ -13,7 +13,7 @@ public static ProblemDetails ConvertToProblem(this IProblemDetailsFactory factor
factory.ConvertToProblem(result.Errors, traceIdentifier);
public static ProblemDetails ConvertToProblem(this IProblemDetailsFactory factory, IEnumerable results, string? traceIdentifier = null) =>
- factory.ConvertToProblem(results.SelectMany(r => r.Errors), traceIdentifier);
+ factory.ConvertToProblem(results.SelectMany(static r => r.Errors), traceIdentifier);
public static Results, ProblemHttpResult> MatchToOk(this IProblemDetailsFactory factory, IQueryResult errorOrResult, Func onValue, string? traceIdentifier = null)
where T : notnull =>
@@ -29,5 +29,5 @@ public static Results, ProblemHttpResult> MatchToOk(
});
private static ProblemDetails ConvertToProblem(this IProblemDetailsFactory factory, IEnumerable failures, string? traceIdentifier = null) =>
- factory.ConvertToProblem(failures.Select(x => new ValidationError(x.ErrorMessage, x.AttemptedValue)).Cast().ToSeq(), traceIdentifier);
+ factory.ConvertToProblem(failures.Select(static x => new ValidationError(x.ErrorMessage, x.AttemptedValue)).Cast().ToSeq(), traceIdentifier);
}
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/ValidationContextFactory.cs b/src/HomeInventory/HomeInventory.Web.Framework/ValidationContextFactory.cs
index b7b772f93..a64c524b8 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/ValidationContextFactory.cs
+++ b/src/HomeInventory/HomeInventory.Web.Framework/ValidationContextFactory.cs
@@ -5,7 +5,7 @@ namespace HomeInventory.Web.Framework;
internal sealed class ValidationContextFactory(Action>? validationOptions = null) : IValidationContextFactory
{
- private readonly Action> _validationOptions = validationOptions ?? (_ => { });
+ private readonly Action> _validationOptions = validationOptions ?? (static _ => { });
public IValidationContext CreateContext(TOptions options) =>
ValidationContext.CreateWithOptions(options, _validationOptions);
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/ValidationEndpointFilter.cs b/src/HomeInventory/HomeInventory.Web.Framework/ValidationEndpointFilter.cs
index 6fe13b656..b12178f2c 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/ValidationEndpointFilter.cs
+++ b/src/HomeInventory/HomeInventory.Web.Framework/ValidationEndpointFilter.cs
@@ -19,12 +19,12 @@ internal sealed class ValidationEndpointFilter(IValidationContextFactory v
var validator = httpContext.RequestServices.GetValidator();
var results = await ValidateArgumentAsync(validator, arguments, httpContext.RequestAborted).ToArrayAsync(httpContext.RequestAborted);
- if (results.Length == 0 || Array.TrueForAll(results, r => r.IsValid))
+ if (results.Length == 0 || Array.TrueForAll(results, static r => r.IsValid))
{
return await next(context);
}
- var problem = _problemDetailsFactory.ConvertToProblem(results.Where(r => !r.IsValid), httpContext.TraceIdentifier);
+ var problem = _problemDetailsFactory.ConvertToProblem(results.Where(static r => !r.IsValid), httpContext.TraceIdentifier);
return TypedResults.Problem(problem);
}
diff --git a/src/HomeInventory/HomeInventory.Web.Framework/WebFrameworkServiceCollectionExtensions.cs b/src/HomeInventory/HomeInventory.Web.Framework/WebFrameworkServiceCollectionExtensions.cs
index cf5318f38..fab12b29d 100644
--- a/src/HomeInventory/HomeInventory.Web.Framework/WebFrameworkServiceCollectionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Web.Framework/WebFrameworkServiceCollectionExtensions.cs
@@ -12,10 +12,10 @@ public static class WebFrameworkServiceCollectionExtensions
public static IServiceCollection AddWebFramework(this IServiceCollection services)
{
services.AddSingleton(ErrorMappingBuilder.CreateDefault());
- services.AddSingleton(sp => sp.GetRequiredService().Build());
+ services.AddSingleton(static sp => sp.GetRequiredService().Build());
services.AddTransient();
- services.AddTransient(sp => sp.GetRequiredService());
- services.AddTransient(sp => sp.GetRequiredService());
+ services.AddTransient(static sp => sp.GetRequiredService());
+ services.AddTransient(static sp => sp.GetRequiredService());
return services;
}
diff --git a/src/HomeInventory/HomeInventory.Web.UserManagement/HomeInventory.Web.UserManagement.csproj b/src/HomeInventory/HomeInventory.Web.UserManagement/HomeInventory.Web.UserManagement.csproj
index f99c2a577..3ad5919af 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.UserManagement/UserManagementContractsMappings.cs b/src/HomeInventory/HomeInventory.Web.UserManagement/UserManagementContractsMappings.cs
index eb11ffa6a..52664e7ba 100644
--- a/src/HomeInventory/HomeInventory.Web.UserManagement/UserManagementContractsMappings.cs
+++ b/src/HomeInventory/HomeInventory.Web.UserManagement/UserManagementContractsMappings.cs
@@ -12,8 +12,8 @@ internal sealed class UserManagementContractsMappings : BaseMappingsProfile
{
public UserManagementContractsMappings()
{
- CreateMap().Using(x => x.Value, UserId.Converter);
- CreateMap().Using(x => x.Value, x => new Email(x));
+ CreateMap().Using(static x => x.Value, UserId.Converter);
+ CreateMap().Using(static x => x.Value, static x => new Email(x));
CreateMap().Using(CreateRegisterCommand);
diff --git a/src/HomeInventory/HomeInventory.Web/Authorization/Dynamic/DynamicAuthorizationServiceCollectionExtensions.cs b/src/HomeInventory/HomeInventory.Web/Authorization/Dynamic/DynamicAuthorizationServiceCollectionExtensions.cs
index 6ec7aca1f..3d83b838d 100644
--- a/src/HomeInventory/HomeInventory.Web/Authorization/Dynamic/DynamicAuthorizationServiceCollectionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Web/Authorization/Dynamic/DynamicAuthorizationServiceCollectionExtensions.cs
@@ -15,10 +15,10 @@ public static IServiceCollection AddDynamicAuthorization(this IServiceCollection
services.AddTransient();
services.AddAuthorizationBuilder()
- .AddPolicy(AuthorizationPolicyNames.Dynamic, pb => pb
+ .AddPolicy(AuthorizationPolicyNames.Dynamic, static pb => pb
.RequireAuthenticatedUser()
.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
- .AddRequirements(new DynamicPermissionRequirement(ep => ep.GetPermissions())));
+ .AddRequirements(new DynamicPermissionRequirement(static ep => ep.GetPermissions())));
return services;
}
@@ -48,7 +48,7 @@ public static TBuilder RequireDynamicAuthorization(this TBuilder build
builder.RequireAuthorization(AuthorizationPolicyNames.Dynamic).WithMetadata(new PermissionMetadata(permissions));
private static IEnumerable GetPermissions(this Endpoint endpoint) =>
- endpoint.Metadata.GetOrderedMetadata().SelectMany(a => a.Permissions);
+ endpoint.Metadata.GetOrderedMetadata().SelectMany(static a => a.Permissions);
private static class AuthorizationPolicyNames
{
diff --git a/src/HomeInventory/HomeInventory.Web/Configuration/Validation/JwtOptionsValidator.cs b/src/HomeInventory/HomeInventory.Web/Configuration/Validation/JwtOptionsValidator.cs
index b3e511e2a..8bcd91237 100644
--- a/src/HomeInventory/HomeInventory.Web/Configuration/Validation/JwtOptionsValidator.cs
+++ b/src/HomeInventory/HomeInventory.Web/Configuration/Validation/JwtOptionsValidator.cs
@@ -6,10 +6,10 @@ internal sealed class JwtOptionsValidator : AbstractValidator, IOpti
{
public JwtOptionsValidator()
{
- RuleFor(x => x.Secret).NotEmpty();
- RuleFor(x => x.Issuer).NotEmpty();
- RuleFor(x => x.Audience).NotEmpty();
- RuleFor(x => x.Algorithm).NotEmpty();
- RuleFor(x => x.Expiry).GreaterThan(TimeSpan.FromSeconds(1));
+ RuleFor(static x => x.Secret).NotEmpty();
+ RuleFor(static x => x.Issuer).NotEmpty();
+ RuleFor(static x => x.Audience).NotEmpty();
+ RuleFor(static x => x.Algorithm).NotEmpty();
+ RuleFor(static x => x.Expiry).GreaterThan(TimeSpan.FromSeconds(1));
}
}
diff --git a/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj b/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj
index 1bd60ba45..a69242ba3 100644
--- a/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj
+++ b/src/HomeInventory/HomeInventory.Web/HomeInventory.Web.csproj
@@ -13,6 +13,7 @@
+
diff --git a/src/HomeInventory/HomeInventory.Web/Modules/AuthenticationModule.cs b/src/HomeInventory/HomeInventory.Web/Modules/AuthenticationModule.cs
index 8d9476612..8a9f3ebbb 100644
--- a/src/HomeInventory/HomeInventory.Web/Modules/AuthenticationModule.cs
+++ b/src/HomeInventory/HomeInventory.Web/Modules/AuthenticationModule.cs
@@ -22,7 +22,7 @@ protected override void AddRoutes(RouteGroupBuilder group)
{
group.MapPost("login", LoginAsync)
.AllowAnonymous()
- .WithValidationOf(s => s.IncludeAllRuleSets());
+ .WithValidationOf(static s => s.IncludeAllRuleSets());
}
public async Task, ProblemHttpResult>> LoginAsync([FromBody] LoginRequest body, HttpContext context, CancellationToken cancellationToken = default)
diff --git a/src/HomeInventory/HomeInventory.Web/Modules/PermissionModule.cs b/src/HomeInventory/HomeInventory.Web/Modules/PermissionModule.cs
index cd5f70739..e71f59b6e 100644
--- a/src/HomeInventory/HomeInventory.Web/Modules/PermissionModule.cs
+++ b/src/HomeInventory/HomeInventory.Web/Modules/PermissionModule.cs
@@ -22,5 +22,5 @@ protected override void AddRoutes(RouteGroupBuilder group)
}
public static Task>> GetPermissionsAsync([FromServices] PermissionList list, CancellationToken cancellationToken = default)
- => Task.FromResult(TypedResults.Ok(list.Select(p => p.ToString())));
+ => Task.FromResult(TypedResults.Ok(list.Select(static p => p.ToString())));
}
diff --git a/src/HomeInventory/HomeInventory.Web/WebServiceCollectionExtensions.cs b/src/HomeInventory/HomeInventory.Web/WebServiceCollectionExtensions.cs
index 64251392e..2bf0f770d 100644
--- a/src/HomeInventory/HomeInventory.Web/WebServiceCollectionExtensions.cs
+++ b/src/HomeInventory/HomeInventory.Web/WebServiceCollectionExtensions.cs
@@ -39,9 +39,9 @@ public static IServiceCollection AddWeb(this IServiceCollection services, params
services.AddScoped();
services.AddMappingAssemblySource(moduleAssemblies);
- services.AddAutoMapper((sp, configExpression) =>
+ services.AddAutoMapper(static (sp, configExpression) =>
{
- configExpression.AddMaps(sp.GetServices().SelectMany(s => s.GetAssemblies()));
+ configExpression.AddMaps(sp.GetServices().SelectMany(static s => s.GetAssemblies()));
configExpression.ConstructServicesUsing(sp.GetService);
}, Type.EmptyTypes);
@@ -76,13 +76,13 @@ private static void AddOpenApiDocs(this IServiceCollection services)
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
- services.AddSwaggerGen(options => options.OperationFilter());
- services.AddApiVersioning(options =>
+ services.AddSwaggerGen(static options => options.OperationFilter());
+ services.AddApiVersioning(static options =>
{
options.DefaultApiVersion = new ApiVersion(1);
options.AssumeDefaultVersionWhenUnspecified = true;
options.ApiVersionReader = new QueryStringApiVersionReader();
- }).AddApiExplorer(options => options.GroupNameFormat = "'v'VVV");
+ }).AddApiExplorer(static options => options.GroupNameFormat = "'v'VVV");
}
public static TApp UseWeb(this TApp app)
@@ -95,7 +95,7 @@ public static TApp UseWeb(this TApp app)
app.UseHealthChecksUI();
app.UseExceptionHandler(new ExceptionHandlerOptions { ExceptionHandlingPath = "/error", });
- app.Map("/error", (HttpContext context) => Results.Problem(detail: context.GetFeature()?.Error?.Message));
+ app.Map("/error", static (HttpContext context) => Results.Problem(detail: context.GetFeature()?.Error?.Message));
app.UseMiddleware();
app.UseMiddleware();
@@ -133,17 +133,17 @@ private static void MapHealthChecks(this IEndpointRouteBuilder app)
{
app.MapHealthChecks("/health", new HealthCheckOptions
{
- Predicate = _ => true,
+ Predicate = static _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{
- Predicate = x => x.Tags.Contains(HealthCheckTags.Ready),
+ Predicate = static x => x.Tags.Contains(HealthCheckTags.Ready),
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.MapHealthChecks("/health/live", new HealthCheckOptions
{
- Predicate = _ => false,
+ Predicate = static _ => false,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse,
});
}
diff --git a/src/HomeInventory/global.json b/src/HomeInventory/global.json
index a3cf554a1..4eda52220 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
}