diff --git a/.editorconfig b/.editorconfig index 134e578..57b2d5a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,8 +1,5 @@ -; EditorConfig to support per-solution formatting. -; Use the EditorConfig VS add-in to make this work. -; http://editorconfig.org/ - -; This is the default for the codeline. +# EditorConfig to support per-solution formatting. +# http://editorconfig.org/ root = true [*] @@ -10,13 +7,187 @@ indent_style = space trim_trailing_whitespace = true insert_final_newline = true -; .NET Code - almost, but not exactly, the same suggestions as corefx -; https://github.com/dotnet/corefx/blob/master/.editorconfig +# .NET Code [*.cs] indent_size = 4 charset = utf-8-bom -; New line preferences +# .NET project files and MSBuild - match defaults for VS +[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}] +indent_size = 2 + +# .NET solution files - match defaults for VS +[*.sln] +end_of_line = crlf +indent_style = tab + +# .NET XML solution files - match dotnet new sln defaults +[*.slnx] +indent_size = 2 + + +# Config - match XML and default nuget.config template +[*.config] +indent_size = 2 + +# Resources - match defaults for VS +[*.resx] +indent_size = 2 + +# Static analysis rulesets - match defaults for VS +[*.ruleset] +indent_size = 2 + +# HTML, XML - match defaults for VS +[*.{cshtml,html,xml}] +indent_size = 4 + +# JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates +[*.{js,json,mjs,ts,vue}] +indent_size = 2 + +# Markdown - match markdownlint settings +[*.{md,markdown}] +indent_size = 2 + +# PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter +[*.{ps1,psd1,psm1}] +indent_size = 4 +charset = utf-8-bom + +# YAML - match standard YAML like Kubernetes and GitHub Actions +[*.{yaml,yml}] +indent_size = 2 + +# ReStructuredText - standard indentation format from examples +[*.rst] +indent_size = 2 + +# +# dotnet code style +# +[*.cs] + +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false + +# Avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning + +# Suggest more modern language features when available +dotnet_style_object_initializer = true:warning +dotnet_style_collection_initializer = true:warning +dotnet_style_coalesce_expression = true:warning +dotnet_style_null_propagation = true:warning +dotnet_style_explicit_tuple_names = true:warning + +# Whitespace options +dotnet_style_allow_multiple_blank_lines_experimental = false + +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +# Non-private readonly fields are PascalCase +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style + +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly + +dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case + +# Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = warning +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style + +dotnet_naming_symbols.constants.applicable_kinds = field, local +dotnet_naming_symbols.constants.required_modifiers = const + +dotnet_naming_style.constant_style.capitalization = pascal_case + +# Static fields should be _camelCase +dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields +dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_field_style.capitalization = camel_case + +# Instance fields are camelCase and start with _ +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = warning +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style + +dotnet_naming_symbols.instance_fields.applicable_kinds = field + +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ + +# Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = warning +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local + +dotnet_naming_style.camel_case_style.capitalization = camel_case + +# Local functions are PascalCase +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +dotnet_naming_style.local_function_style.capitalization = pascal_case + +# By default, name items with PascalCase +dotnet_naming_rule.members_should_be_pascal_case.severity = warning +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.all_members.applicable_kinds = * + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# IDE0035: Remove unreachable code +dotnet_diagnostic.IDE0035.severity = warning + +# IDE0036: Order modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0043: Format string contains invalid placeholder +dotnet_diagnostic.IDE0043.severity = warning + +# IDE0044: Make field readonly +dotnet_diagnostic.IDE0044.severity = warning + +# IDE0055: Fix formatting +dotnet_diagnostic.IDE0055.severity = warning + +# C# code style +# +# Newline settings csharp_new_line_before_open_brace = all csharp_new_line_before_else = true csharp_new_line_before_catch = true @@ -25,90 +196,34 @@ csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true csharp_new_line_between_query_expression_clauses = true -; Indentation preferences +# Indentation preferences csharp_indent_block_contents = true csharp_indent_braces = false csharp_indent_case_contents = true csharp_indent_case_contents_when_block = true csharp_indent_switch_labels = true -csharp_indent_labels = one_less_than_current +csharp_indent_labels = flush_left -; Modifier preferences -csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning - -; Avoid this. unless absolutely necessary -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion +# Whitespace options +# Each of the *_experimental rules has a corresponding IDE* setting. +csharp_style_allow_embedded_statements_on_same_line_experimental = false +dotnet_diagnostic.IDE2001.severity = warning +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false +dotnet_diagnostic.IDE2002.severity = warning +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false +dotnet_diagnostic.IDE2004.severity = warning +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false +dotnet_diagnostic.IDE2005.severity = warning +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false +dotnet_diagnostic.IDE2006.severity = warning -; Types: use keywords instead of BCL types, using var is fine. -csharp_style_var_when_type_is_apparent = false:none -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion - -; Name all constant fields using PascalCase -dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning -dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields -dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style -dotnet_naming_symbols.constant_fields.applicable_kinds = field -dotnet_naming_symbols.constant_fields.required_modifiers = const -dotnet_naming_style.pascal_case_style.capitalization = pascal_case +# Prefer "var" everywhere +dotnet_diagnostic.IDE0007.severity = warning +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_elsewhere = true:warning -; Static fields should be _camelCase -dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning -dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields -dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style -dotnet_naming_symbols.static_fields.applicable_kinds = field -dotnet_naming_symbols.static_fields.required_modifiers = static -dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected - -; Static readonly fields should be PascalCase -dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning -dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields -dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style -dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field -dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly -dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = private, internal, private_protected - -; Internal and private fields should be _camelCase -dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning -dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields -dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style -dotnet_naming_symbols.private_internal_fields.applicable_kinds = field -dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal -dotnet_naming_style.camel_case_underscore_style.required_prefix = _ -dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case - -; Code style defaults -csharp_using_directive_placement = outside_namespace:suggestion -dotnet_sort_system_directives_first = true -csharp_prefer_braces = true:refactoring -csharp_preserve_single_line_blocks = true:none -csharp_preserve_single_line_statements = false:none -csharp_prefer_static_local_function = true:suggestion -csharp_prefer_simple_using_statement = false:none -csharp_style_prefer_switch_expression = true:suggestion - -; Code quality -dotnet_style_readonly_field = true:suggestion -dotnet_code_quality_unused_parameters = non_public:suggestion - -; Expression-level preferences -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_explicit_tuple_names = true:suggestion -dotnet_style_coalesce_expression = true:suggestion -dotnet_style_null_propagation = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion -dotnet_style_prefer_inferred_tuple_names = true:suggestion -dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -dotnet_style_prefer_auto_properties = true:suggestion -dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring -dotnet_style_prefer_conditional_expression_over_return = true:refactoring -csharp_prefer_simple_default_expression = true:suggestion - -# Expression-bodied members +# Prefer method-like constructs to have a block body csharp_style_expression_bodied_methods = true:refactoring csharp_style_expression_bodied_constructors = true:refactoring csharp_style_expression_bodied_operators = true:refactoring @@ -118,20 +233,15 @@ csharp_style_expression_bodied_accessors = true:refactoring csharp_style_expression_bodied_lambdas = true:refactoring csharp_style_expression_bodied_local_functions = true:refactoring -# Pattern matching -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion - -# Null checking preferences -csharp_style_throw_expression = true:suggestion -csharp_style_conditional_delegate_call = true:suggestion - -# Other features -csharp_style_namespace_declarations = file_scoped:suggestion -csharp_style_prefer_index_operator = false:none -csharp_style_prefer_range_operator = false:none -csharp_style_pattern_local_over_anonymous_function = false:none +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_inlined_variable_declaration = true:warning +csharp_style_throw_expression = true:warning +csharp_style_conditional_delegate_call = true:warning +csharp_style_prefer_extended_property_pattern = true:warning +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_parameter_null_checking = false # Space preferences csharp_space_after_cast = false @@ -157,48 +267,30 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_space_between_square_brackets = false -; .NET project files and MSBuild - match defaults for VS -[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}] -indent_size = 2 +# Blocks required +csharp_prefer_braces = true:warning +csharp_preserve_single_line_blocks = false +csharp_preserve_single_line_statements = false -; .NET solution files - match defaults for VS -[*.sln] -end_of_line = crlf -indent_style = tab +# IDE0011: Add braces +csharp_prefer_braces = when_multiline:warning +# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201 +dotnet_diagnostic.IDE0011.severity = warning -; Config - match XML and default nuget.config template -[*.config] -indent_size = 2 +# IDE0040: Add accessibility modifiers +dotnet_diagnostic.IDE0040.severity = warning -; Resources - match defaults for VS -[*.resx] -indent_size = 2 +# IDE0052: Remove unread private member +dotnet_diagnostic.IDE0052.severity = warning -; Static analysis rulesets - match defaults for VS -[*.ruleset] -indent_size = 2 +# IDE0059: Unnecessary assignment to a value +dotnet_diagnostic.IDE0059.severity = warning -; HTML, XML - match defaults for VS -[*.{cshtml,html,xml}] -indent_size = 4 - -; JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates -[*.{js,json,ts,vue}] -indent_size = 2 +# IDE0060: Remove unused parameter +dotnet_diagnostic.IDE0060.severity = warning -; Markdown - match markdownlint settings -[*.{md,markdown}] -indent_size = 2 +# CA1012: Abstract types should not have public constructors +dotnet_diagnostic.CA1012.severity = warning -; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter -[*.{ps1,psd1,psm1}] -indent_size = 4 -charset = utf-8-bom - -; ReStructuredText - standard indentation format from examples -[*.rst] -indent_size = 2 - -# YAML - match standard YAML like Kubernetes and GitHub Actions -[*.{yaml,yml}] -indent_size = 2 +# CA1822: Make member static +dotnet_diagnostic.CA1822.severity = warning diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e756d44..8066618 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 + rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0 hooks: - id: check-json - id: check-yaml @@ -8,13 +8,13 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/igorshubovych/markdownlint-cli - rev: e72a3ca1632f0b11a07d171449fe447a7ff6795e # frozen: v0.48.0 + rev: "e72a3ca1632f0b11a07d171449fe447a7ff6795e" # frozen: v0.48.0 hooks: - id: markdownlint args: - --fix - repo: https://github.com/tillig/json-sort-cli - rev: 2b7e147e0933bd30b58133b6f287e5c695ff4f0e # frozen: v3.0.1 + rev: "2b7e147e0933bd30b58133b6f287e5c695ff4f0e" # frozen: v3.0.1 hooks: - id: json-sort args: diff --git a/build/Source.ruleset b/build/Source.ruleset index 4d46839..459e4e0 100644 --- a/build/Source.ruleset +++ b/build/Source.ruleset @@ -4,49 +4,39 @@ + + + + + + + + + + + + + + - + + + - + + + - + - + - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - diff --git a/build/Test.ruleset b/build/Test.ruleset index c8ea69a..3c26c01 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -2,65 +2,86 @@ + + + + - - - + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + + + + + - + - + - + - - - + - + - - - + - - - - - + - - - + - + + + - + + + - + - + - + - - - - - diff --git a/build/stylecop.json b/build/stylecop.json index 8f5c703..20da2f6 100644 --- a/build/stylecop.json +++ b/build/stylecop.json @@ -9,6 +9,9 @@ "licenseName": "MIT" }, "xmlHeader": false + }, + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace" } } } diff --git a/default.proj b/default.proj index 516b154..e711a74 100644 --- a/default.proj +++ b/default.proj @@ -1,41 +1,67 @@ - + - Release - 7.1.0 - $(MSBuildThisFileDirectory)Autofac.Extras.DynamicProxy.sln - $(MSBuildThisFileDirectory)artifacts - $(ArtifactsPath)/packages - $(ArtifactsPath)/logs + + 7.1.0 + Autofac.Extras.DynamicProxy + Release + $([System.IO.Path]::Combine($(MSBuildProjectDirectory),"artifacts")) + $([System.IO.Path]::Combine($(ArtifactDirectory),"packages")) + $([System.IO.Path]::Combine($(ArtifactDirectory),"logs")) + $([System.IO.Path]::Combine($(MSBuildProjectDirectory),'build/Coverage.runsettings')) + $([System.DateTimeOffset]::UtcNow.ToString('yyyyMMddTHHmmssZ')) - - + + + + $(Version)-local + + + + + $(Version) + + + + + $(Version)-beta$(BuildDateTime) + + + + + $(Version)-alpha$(BuildDateTime) + + + - + + + + - + + + + + + + + - - + + + + + + + - - - - - + + + - - - - - - - - 0 - - + + + - - - diff --git a/src/Autofac.Extras.DynamicProxy/InterceptAttribute.cs b/src/Autofac.Extras.DynamicProxy/InterceptAttribute.cs index e2ae1e9..2251e2b 100644 --- a/src/Autofac.Extras.DynamicProxy/InterceptAttribute.cs +++ b/src/Autofac.Extras.DynamicProxy/InterceptAttribute.cs @@ -10,16 +10,11 @@ namespace Autofac.Extras.DynamicProxy; /// Indicates that a type should be intercepted. /// [ExcludeFromCodeCoverage] -[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")] -[SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")] +[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "Attribute is unsealed to allow derived types to provide additional interception metadata.")] +[SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments", Justification = "Constructor arguments are transformed into Service instances and exposed through InterceptorService property.")] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] public class InterceptAttribute : Attribute { - /// - /// Gets the interceptor service. - /// - public Service InterceptorService { get; private set; } - /// /// Initializes a new instance of the class. /// @@ -49,4 +44,12 @@ public InterceptAttribute(Type interceptorServiceType) : this(new TypedService(interceptorServiceType)) { } + + /// + /// Gets the interceptor service. + /// + public Service InterceptorService + { + get; private set; + } } diff --git a/src/Autofac.Extras.DynamicProxy/RegistrationExtensions.cs b/src/Autofac.Extras.DynamicProxy/RegistrationExtensions.cs index c37f9f5..6f9e388 100644 --- a/src/Autofac.Extras.DynamicProxy/RegistrationExtensions.cs +++ b/src/Autofac.Extras.DynamicProxy/RegistrationExtensions.cs @@ -20,9 +20,9 @@ public static class RegistrationExtensions private const string AttributeInterceptorsPropertyName = "Autofac.Extras.DynamicProxy.RegistrationExtensions.AttributeInterceptorsPropertyName"; - private static readonly IEnumerable EmptyServices = Enumerable.Empty(); + private static readonly IEnumerable _emptyServices = Enumerable.Empty(); - private static readonly ProxyGenerator ProxyGenerator = new(); + private static readonly ProxyGenerator _proxyGenerator = new(); /// /// Enable class interception on the target type. Interceptors will be determined @@ -105,7 +105,7 @@ public static IRegistrationBuilder { var proxyParameters = new List(); - int index = 0; + var index = 0; if (options.HasMixins) { @@ -187,8 +187,8 @@ public static IRegistrationBuilder interceptorServices, string metadataKey) { - if (builder.RegistrationData.Metadata.TryGetValue(metadataKey, out object? existing) && existing is IEnumerable existingServices) + if (builder.RegistrationData.Metadata.TryGetValue(metadataKey, out var existing) && existing is IEnumerable existingServices) { builder.RegistrationData.Metadata[metadataKey] = existingServices.Concat(interceptorServices).Distinct(); @@ -300,9 +300,9 @@ private static void AddInterceptorServicesToMetadata GetInterceptorServices(IComponentRegistration registration, Type implType) { - var result = EmptyServices; + var result = _emptyServices; - if (registration.Metadata.TryGetValue(InterceptorsPropertyName, out object? services) && services is IEnumerable existingPropertyServices) + if (registration.Metadata.TryGetValue(InterceptorsPropertyName, out var services) && services is IEnumerable existingPropertyServices) { result = result.Concat(existingPropertyServices); } diff --git a/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionFixture.cs index 56f08c8..92705f4 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionFixture.cs @@ -59,7 +59,10 @@ public Service() Value = 10; } - public int Value { get; private set; } + public int Value + { + get; private set; + } public int GetValueByMethod() { diff --git a/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionWithOptionsFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionWithOptionsFixture.cs index 90ac844..66bc867 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionWithOptionsFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/AttributedInterfaceInterceptionWithOptionsFixture.cs @@ -79,9 +79,15 @@ public Service() FirstValue = SecondValue = 10; } - public int FirstValue { get; private set; } + public int FirstValue + { + get; private set; + } - public int SecondValue { get; private set; } + public int SecondValue + { + get; private set; + } public int GetFirstValueByMethod() { diff --git a/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsFixture.cs index a3a5111..bf03592 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsFixture.cs @@ -83,13 +83,13 @@ public void ResolveFactoryWithInterceptors() var container = builder.Build(); - const int i = 123; + const int I = 123; using (var scope = container.BeginLifetimeScope()) { var mgr = scope.Resolve(); - var byFunc = mgr.CreateByFunc(i); - var byDelegate = mgr.CreateByDelegate(i); + var byFunc = mgr.CreateByFunc(I); + var byDelegate = mgr.CreateByDelegate(I); Assert.Equal(byFunc.I, byDelegate.I); } @@ -129,7 +129,10 @@ public C(int i) Value = i; } - public int Value { get; set; } + public int Value + { + get; set; + } public virtual int GetValueByMethod() { @@ -144,7 +147,10 @@ public D(int i) Value = i; } - public int Value { get; set; } + public int Value + { + get; set; + } public virtual int GetValueByMethod() { @@ -157,7 +163,10 @@ public class ClassWithDelegate { public delegate ClassWithDelegate Factory(int i); - public int I { get; set; } + public int I + { + get; set; + } public ClassWithDelegate(int i) { @@ -167,9 +176,15 @@ public ClassWithDelegate(int i) public class ClassWithDelegateFactory { - public Func ObjectFuncFactory { get; set; } + public Func ObjectFuncFactory + { + get; set; + } - public ClassWithDelegate.Factory ObjectDelegateFactory { get; set; } + public ClassWithDelegate.Factory ObjectDelegateFactory + { + get; set; + } public virtual ClassWithDelegate CreateByFunc(int i) { diff --git a/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsWithOptionsFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsWithOptionsFixture.cs index 83218c7..2c1a8c3 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsWithOptionsFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/ClassInterceptorsWithOptionsFixture.cs @@ -10,7 +10,10 @@ public class ClassInterceptorsWithOptionsFixture { public interface ILazyLoadMixin { - bool IsLoaded { get; } + bool IsLoaded + { + get; + } } [Fact] @@ -24,7 +27,7 @@ public void CanCreateMixinWithClassInterceptors() builder.RegisterType(); builder.RegisterType(); var container = builder.Build(); - int i = 10; + var i = 10; var cpt = container.Resolve(TypedParameter.From(i)); var loaded = cpt as ILazyLoadMixin; @@ -42,7 +45,7 @@ public void CanInterceptMethodsWithSpecificInterceptors() builder.RegisterType(); builder.RegisterType(); var container = builder.Build(); - int i = 10; + var i = 10; var cpt = container.Resolve(TypedParameter.From(i)); Assert.Equal(i + 1, cpt.GetFirstValueByMethod()); @@ -59,7 +62,7 @@ public void CanInterceptOnlySpecificMethods() builder.RegisterType(); builder.RegisterType(); var container = builder.Build(); - int i = 10; + var i = 10; var cpt = container.Resolve(TypedParameter.From(i)); Assert.Equal(i, cpt.GetFirstValueByMethod()); @@ -99,9 +102,15 @@ public HasAttributeInterceptors(int i) FirstValue = SecondValue = i; } - public int FirstValue { get; set; } + public int FirstValue + { + get; set; + } - public int SecondValue { get; set; } + public int SecondValue + { + get; set; + } public virtual int GetFirstValueByMethod() { @@ -121,9 +130,15 @@ public ServiceWithTwoValues(int i) FirstValue = SecondValue = i; } - public int FirstValue { get; set; } + public int FirstValue + { + get; set; + } - public int SecondValue { get; set; } + public int SecondValue + { + get; set; + } public virtual int GetFirstValueByMethod() { diff --git a/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataFixture.cs index d37a8f7..8efae71 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataFixture.cs @@ -33,7 +33,10 @@ public CustomerService() VisitCount = 10; } - private int VisitCount { get; set; } + private int VisitCount + { + get; set; + } public int GetVisitCount() { diff --git a/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataWithOptionsFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataWithOptionsFixture.cs index 602216c..e2502f5 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataWithOptionsFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/InterceptorsChosenByMetadataWithOptionsFixture.cs @@ -85,9 +85,15 @@ public CustomerService() UniqueVisitorCount = 6; } - private int UniqueVisitorCount { get; set; } + private int UniqueVisitorCount + { + get; set; + } - private int VisitCount { get; set; } + private int VisitCount + { + get; set; + } public int GetUniqueVisitorCount() { diff --git a/test/Autofac.Extras.DynamicProxy.Test/InterfaceInterceptionWithPropertyInjectionFixture.cs b/test/Autofac.Extras.DynamicProxy.Test/InterfaceInterceptionWithPropertyInjectionFixture.cs index 4490afe..5467d37 100644 --- a/test/Autofac.Extras.DynamicProxy.Test/InterfaceInterceptionWithPropertyInjectionFixture.cs +++ b/test/Autofac.Extras.DynamicProxy.Test/InterfaceInterceptionWithPropertyInjectionFixture.cs @@ -62,7 +62,10 @@ public interface IPublicInterface public class InterceptableWithProperty : IPublicInterface { - public OtherService Service { get; set; } + public OtherService Service + { + get; set; + } public OtherService GetServiceProperty() => Service;