From ec1c6438ceb3f3338c7364e35e7303f014e3fc39 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Mon, 28 Sep 2020 13:25:46 -0700 Subject: [PATCH] Final v6 release update, includes fixes for build. --- .editorconfig | 226 +++++++++++++++--- .gitignore | 8 + .vscode/extensions.json | 8 + .vscode/settings.json | 4 +- .vscode/tasks.json | 6 +- appveyor.yml | 8 +- build.ps1 | 67 +++--- build/Analyzers.ruleset | 30 +-- build/Autofac.Build.psd1 | 30 +-- build/Autofac.Build.psm1 | 101 ++++---- build/CodeAnalysisDictionary.xml | 47 ---- build/stylecop.json | 14 ++ .../Autofac.Configuration.csproj | 12 +- .../ConfigurationModule.cs | 11 +- .../Core/ComponentRegistrar.cs | 48 ++-- .../Core/ConfigurationExtensions.cs | 15 +- .../Core/ConfigurationRegistrar.cs | 34 +-- .../Core/ModuleRegistrar.cs | 26 +- .../GlobalSuppressions.cs | Bin 1324 -> 0 bytes .../IComponentRegistrar.cs | 5 +- .../IConfigurationRegistrar.cs | 26 +- src/Autofac.Configuration/IModuleRegistrar.cs | 5 +- .../Properties/AssemblyInfo.cs | 7 +- .../Util/ConfiguredDictionaryParameter.cs | 14 +- .../Util/ConfiguredListParameter.cs | 11 +- .../Util/ReflectionExtensions.cs | 26 +- .../Util/StringExtensions.cs | 11 +- .../Util/TypeManipulation.cs | 32 +-- .../AssertionHelpers.cs | 5 +- .../Autofac.Configuration.Test.csproj | 20 +- .../Core/ComponentRegistrarFixture.cs | 5 +- .../Core/ConfigurationExtensionsFixture.cs | 13 +- ...nExtensions_DictionaryParametersFixture.cs | 7 +- ...nExtensions_EnumerableParametersFixture.cs | 15 +- .../Core/ConfigurationRegistrarFixture.cs | 5 +- .../ModuleConfiguration_ComplexTypeFixture.cs | 5 +- .../Core/ModuleRegistrarFixture.cs | 11 +- .../EmbeddedConfiguration.cs | 5 +- .../EmbeddedConfigurationProvider.cs | 18 +- .../Properties/AssemblyInfo.cs | 3 - .../Autofac.Configuration.Test/TestCulture.cs | 6 +- .../Util/ReflectionExtensionsFixture.cs | 7 +- .../Util/TypeManipulationFixture.cs | 18 +- 43 files changed, 551 insertions(+), 424 deletions(-) create mode 100644 .vscode/extensions.json delete mode 100644 build/CodeAnalysisDictionary.xml create mode 100644 build/stylecop.json delete mode 100644 src/Autofac.Configuration/GlobalSuppressions.cs delete mode 100644 test/Autofac.Configuration.Test/Properties/AssemblyInfo.cs diff --git a/.editorconfig b/.editorconfig index 1d82f31..2920f1f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,28 +1,198 @@ -; 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. -root = true - -[*] -end_of_line = CRLF - -[*.{config,cs,xml}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true - -[*.{proj,props,sln,targets}] -indent_style = tab -trim_trailing_whitespace = true - -[*.{kproj,csproj,json,ps1,psd1,psm1,resx,rst}] -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true - -[NuGet.Config] -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true +; 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. +root = true + +[*] +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 +[*.cs] +indent_size = 4 +charset = utf-8-bom + +; New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +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 +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 + +; Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion + +; 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 + +; 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 = suggestion +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 + +; Static fields should be _camelCase +dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion +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 = suggestion +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 = suggestion +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 +csharp_style_expression_bodied_methods = true:refactoring +csharp_style_expression_bodied_constructors = true:refactoring +csharp_style_expression_bodied_operators = true:refactoring +csharp_style_expression_bodied_properties = true:refactoring +csharp_style_expression_bodied_indexers = true:refactoring +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_prefer_index_operator = false:none +csharp_style_prefer_range_operator = false:none +csharp_style_pattern_local_over_anonymous_function = false:none + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +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 + +; .NET solution files - match defaults for VS +[*.sln] +indent_style = tab + +; 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,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 + +; ReStructuredText - standard indentation format from examples +[*.rst] +indent_size = 2 diff --git a/.gitignore b/.gitignore index 6150397..cfaad24 100644 --- a/.gitignore +++ b/.gitignore @@ -83,6 +83,11 @@ _TeamCity* # DotCover is a Code Coverage Tool *.dotCover +# Coverage +coverage.* +codecov.sh +coverage/ + # NCrunch *.ncrunch* .*crunch*.local.xml @@ -164,3 +169,6 @@ $RECYCLE.BIN/ # Mac crap .DS_Store + +# JetBrains Rider +.idea diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..767b23a --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "formulahendry.dotnet-test-explorer", + "ms-dotnettools.csharp", + "editorconfig.editorconfig", + "davidanson.vscode-markdownlint" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 804f965..1d784b4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,6 @@ { "dotnet-test-explorer.runInParallel": true, - "dotnet-test-explorer.testProjectPath": "test/**/*.Test.csproj" + "dotnet-test-explorer.testProjectPath": "test/**/*.Test.csproj", + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableRoslynAnalyzers": true } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e5112e9..e68d1a7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,7 +3,6 @@ { "args": [ "build", - "${workspaceFolder}/Autofac.Configuration.sln", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], @@ -13,8 +12,11 @@ "kind": "build" }, "label": "build", + "presentation": { + "reveal": "silent" + }, "problemMatcher": "$msCompile", - "type": "process" + "type": "shell" } ], "version": "2.0.0" diff --git a/appveyor.yml b/appveyor.yml index 8283633..f0e95bd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,6 @@ -version: 6.0.0.{build} +image: Ubuntu + +version: '6.0.0.{build}' dotnet_csproj: version_prefix: '6.0.0' @@ -7,8 +9,6 @@ dotnet_csproj: configuration: Release -image: Visual Studio 2019 - environment: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true NUGET_XMLDOC_MODE: skip @@ -23,7 +23,7 @@ clone_depth: 1 test: off build_script: -- ps: .\build.ps1 + - pwsh: .\build.ps1 artifacts: - path: artifacts\packages\**\*.nupkg diff --git a/build.ps1 b/build.ps1 index 1d154bd..dd1a7ca 100644 --- a/build.ps1 +++ b/build.ps1 @@ -3,44 +3,49 @@ ######################## Push-Location $PSScriptRoot -Import-Module $PSScriptRoot\Build\Autofac.Build.psd1 -Force +try { + Import-Module $PSScriptRoot/build/Autofac.Build.psd1 -Force -$artifactsPath = "$PSScriptRoot\artifacts" -$packagesPath = "$artifactsPath\packages" -$sdkVersion = (Get-Content "$PSScriptRoot\global.json" | ConvertFrom-Json).sdk.version + $artifactsPath = "$PSScriptRoot/artifacts" + $packagesPath = "$artifactsPath/packages" + $sdkVersion = (Get-Content "$PSScriptRoot/global.json" | ConvertFrom-Json).sdk.version -# Clean up artifacts folder -if (Test-Path $artifactsPath) { - Write-Message "Cleaning $artifactsPath folder" - Remove-Item $artifactsPath -Force -Recurse -} + # Clean up artifacts folder + if (Test-Path $artifactsPath) { + Write-Message "Cleaning $artifactsPath folder" + Remove-Item $artifactsPath -Force -Recurse + } + + # Install dotnet CLI + Write-Message "Installing .NET Core SDK version $sdkVersion" + Install-DotNetCli -Version $sdkVersion -# Install dotnet CLI -Write-Message "Installing .NET Core SDK version $sdkVersion" -Install-DotNetCli -Version $sdkVersion + # Write out dotnet information + & dotnet --info -# Write out dotnet information -& dotnet --info + # Set version suffix + $branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH]; + $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER]; + $versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)).Replace('/', '-'))-$revision" }[$branch -eq "master" -and $revision -ne "local"] -# Set version suffix -$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; -$versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] + Write-Message "Package version suffix is '$versionSuffix'" -Write-Message "Package version suffix is '$versionSuffix'" + # Package restore + Write-Message "Restoring packages" + Get-DotNetProjectDirectory -RootPath $PSScriptRoot | Restore-DependencyPackages -# Package restore -Write-Message "Restoring packages" -Get-DotNetProjectDirectory -RootPath $PSScriptRoot | Restore-DependencyPackages + # Build/package + Write-Message "Building projects and packages" + Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix $versionSuffix -# Build/package -Write-Message "Building projects and packages" -Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix $versionSuffix + # Test + Write-Message "Executing unit tests" + Get-DotNetProjectDirectory -RootPath $PSScriptRoot\test | Invoke-Test -# Test -Write-Message "Executing unit tests" -Get-DotNetProjectDirectory -RootPath $PSScriptRoot\test | Invoke-Test -# Finished -Write-Message "Build finished" -Pop-Location + # Finished + Write-Message "Build finished" +} +finally { + Pop-Location +} diff --git a/build/Analyzers.ruleset b/build/Analyzers.ruleset index 8e76993..a3b6101 100644 --- a/build/Analyzers.ruleset +++ b/build/Analyzers.ruleset @@ -2,11 +2,19 @@ + + + + + + + + + + - - @@ -23,27 +31,11 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/build/Autofac.Build.psd1 b/build/Autofac.Build.psd1 index e8b04e3..6e7a322 100644 --- a/build/Autofac.Build.psd1 +++ b/build/Autofac.Build.psd1 @@ -1,15 +1,15 @@ -@{ - RootModule = '.\Autofac.Build.psm1' - ModuleVersion = '0.2.0' - GUID = '55d3f738-f48f-4497-9b2c-ecd90ec1f978' - Author = 'Autofac Contributors' - CompanyName = 'Autofac' - Description = 'Build support for Autofac projects.' - FunctionsToExport = '*' - CmdletsToExport = '*' - VariablesToExport = '*' - AliasesToExport = '*' - ModuleList = @() - FileList = @() - PrivateData = '' -} +@{ + RootModule = '.\Autofac.Build.psm1' + ModuleVersion = '0.3.0' + GUID = '55d3f738-f48f-4497-9b2c-ecd90ec1f978' + Author = 'Autofac Contributors' + CompanyName = 'Autofac' + Description = 'Build support for Autofac projects.' + FunctionsToExport = '*' + CmdletsToExport = '*' + VariablesToExport = '*' + AliasesToExport = '*' + ModuleList = @() + FileList = @() + PrivateData = '' +} \ No newline at end of file diff --git a/build/Autofac.Build.psm1 b/build/Autofac.Build.psm1 index a0144c0..f7670df 100644 --- a/build/Autofac.Build.psm1 +++ b/build/Autofac.Build.psm1 @@ -45,46 +45,47 @@ function Get-DotNetProjectDirectory } <# - .SYNOPSIS - Runs the dotnet CLI install script from GitHub to install a project-local - copy of the CLI. +.SYNOPSIS + Runs the dotnet CLI install script from GitHub to install a project-local + copy of the CLI. #> -function Install-DotNetCli -{ - [CmdletBinding()] - Param( - [string] - $Version = "Latest" - ) +function Install-DotNetCli { + [CmdletBinding()] + Param( + [string] + $Version = "Latest" + ) - if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue)) - { - $installedVersion = dotnet --version - if ($installedVersion -eq $Version) - { - Write-Message ".NET Core SDK version $Version is already installed" - return; + if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue)) { + $installedVersion = dotnet --version + if ($installedVersion -eq $Version) { + Write-Message ".NET Core SDK version $Version is already installed" + return; + } } - } - $callerPath = Split-Path $MyInvocation.PSCommandPath - $installDir = Join-Path -Path $callerPath -ChildPath ".dotnet\cli" - if (!(Test-Path $installDir)) - { - New-Item -ItemType Directory -Path "$installDir" | Out-Null - } + $callerPath = Split-Path $MyInvocation.PSCommandPath + $installDir = Join-Path -Path $callerPath -ChildPath ".dotnet/cli" + if (!(Test-Path $installDir)) { + New-Item -ItemType Directory -Path "$installDir" | Out-Null + } - # Download the dotnet CLI install script - if (!(Test-Path .\dotnet\install.ps1)) - { - Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile ".\.dotnet\dotnet-install.ps1" - } + # Download the dotnet CLI install script + if ($IsWindows) { + if (!(Test-Path ./.dotnet/dotnet-install.ps1)) { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./.dotnet/dotnet-install.ps1" + } - # Run the dotnet CLI install - & .\.dotnet\dotnet-install.ps1 -InstallDir "$installDir" -Version $Version + & ./.dotnet/dotnet-install.ps1 -InstallDir "$installDir" -Version $Version + $env:PATH = "$installDir;$env:PATH" + } else { + if (!(Test-Path ./.dotnet/dotnet-install.sh)) { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./.dotnet/dotnet-install.sh" + } - # Add the dotnet folder path to the process. - $env:PATH = "$installDir;$env:PATH" + & bash ./.dotnet/dotnet-install.sh --install-dir "$installDir" --version $Version + $env:PATH = "$installDir`:$env:PATH" + } } <# @@ -147,7 +148,7 @@ function Invoke-DotNetPack [Parameter(Mandatory=$True, ValueFromPipeline=$False)] [AllowEmptyString()] [string] - $VersionSuffix + $VersionSuffix = "" ) Begin { @@ -204,19 +205,29 @@ function Invoke-Test ) Process { - foreach($Project in $ProjectDirectory) - { - Push-Location $Project - - & dotnet test --configuration Release --logger:trx - if ($LASTEXITCODE -ne 0) + foreach($Project in $ProjectDirectory) { - Pop-Location - exit 3 - } + Push-Location $Project - Pop-Location - } + & dotnet test ` + --configuration Release ` + --logger:trx ` + /p:CollectCoverage=true ` + /p:CoverletOutput="..\..\" ` + /p:MergeWith="..\..\coverage.json" ` + /p:CoverletOutputFormat="json%2clcov" ` + /p:ExcludeByAttribute=CompilerGeneratedAttribute ` + /p:ExcludeByAttribute=GeneratedCodeAttribute + + + if ($LASTEXITCODE -ne 0) + { + Pop-Location + exit 3 + } + + Pop-Location + } } } diff --git a/build/CodeAnalysisDictionary.xml b/build/CodeAnalysisDictionary.xml deleted file mode 100644 index 0f1b469..0000000 --- a/build/CodeAnalysisDictionary.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - Api - Autofac - autowired - autowiring - composable - configurator - Ioc - Mef - Moq - multitenancy - Mvc - Mvx - Mvvm - startable - Owin - - - - - diff --git a/build/stylecop.json b/build/stylecop.json new file mode 100644 index 0000000..8f5c703 --- /dev/null +++ b/build/stylecop.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "companyName": "Autofac Project", + "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} License. See {licenseFile} in the project root for license information.", + "variables": { + "licenseFile": "LICENSE", + "licenseName": "MIT" + }, + "xmlHeader": false + } + } +} diff --git a/src/Autofac.Configuration/Autofac.Configuration.csproj b/src/Autofac.Configuration/Autofac.Configuration.csproj index 364a726..145a3d6 100644 --- a/src/Autofac.Configuration/Autofac.Configuration.csproj +++ b/src/Autofac.Configuration/Autofac.Configuration.csproj @@ -2,15 +2,15 @@ Configuration support for Autofac. - + 0.0.1 netstandard2.0;netstandard2.1 + latest true true Autofac.Configuration ../../Autofac.snk true - true Autofac.Configuration autofac;di;ioc;dependencyinjection Release notes are at https://github.com/autofac/Autofac.Configuration/releases @@ -21,6 +21,7 @@ https://github.com/autofac/Autofac.Configuration Autofac.Configuration en-US + Copyright © 2015 Autofac Contributors ../../build/Analyzers.ruleset true true @@ -35,6 +36,10 @@ + + + + @@ -52,7 +57,4 @@ All - - - diff --git a/src/Autofac.Configuration/ConfigurationModule.cs b/src/Autofac.Configuration/ConfigurationModule.cs index 5c74223..b0bc232 100644 --- a/src/Autofac.Configuration/ConfigurationModule.cs +++ b/src/Autofac.Configuration/ConfigurationModule.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using Autofac.Configuration.Core; using Microsoft.Extensions.Configuration; @@ -21,7 +24,7 @@ public class ConfigurationModule : Module /// public ConfigurationModule(IConfiguration configuration) { - this.Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); + Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); } /// @@ -71,8 +74,8 @@ protected override void Load(ContainerBuilder builder) throw new ArgumentNullException(nameof(builder)); } - var registrar = this.ConfigurationRegistrar ?? new ConfigurationRegistrar(); - registrar.RegisterConfiguration(builder, this.Configuration); + var registrar = ConfigurationRegistrar ?? new ConfigurationRegistrar(); + registrar.RegisterConfiguration(builder, Configuration); } } } diff --git a/src/Autofac.Configuration/Core/ComponentRegistrar.cs b/src/Autofac.Configuration/Core/ComponentRegistrar.cs index 8d774a9..0a29311 100644 --- a/src/Autofac.Configuration/Core/ComponentRegistrar.cs +++ b/src/Autofac.Configuration/Core/ComponentRegistrar.cs @@ -1,15 +1,5 @@ -// This software is part of the Autofac IoC container -// Copyright (c) 2013 Autofac Contributors -// https://autofac.org -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Collections.Generic; @@ -72,14 +62,14 @@ public virtual void RegisterConfiguredComponents(ContainerBuilder builder, IConf foreach (var component in configuration.GetOrderedSubsections("components")) { var registrar = builder.RegisterType(component.GetType("type", defaultAssembly)); - this.RegisterComponentServices(component, registrar, defaultAssembly); - this.RegisterComponentParameters(component, registrar); - this.RegisterComponentProperties(component, registrar); - this.RegisterComponentMetadata(component, registrar, defaultAssembly); - this.SetLifetimeScope(component, registrar); - this.SetComponentOwnership(component, registrar); - this.SetInjectProperties(component, registrar); - this.SetAutoActivate(component, registrar); + RegisterComponentServices(component, registrar, defaultAssembly); + RegisterComponentParameters(component, registrar); + RegisterComponentProperties(component, registrar); + RegisterComponentMetadata(component, registrar, defaultAssembly); + SetLifetimeScope(component, registrar); + SetComponentOwnership(component, registrar); + SetInjectProperties(component, registrar); + SetAutoActivate(component, registrar); } } @@ -132,6 +122,8 @@ protected virtual IEnumerable EnumerateComponentServices(IConfiguration /// Reads configuration data for a component's metadata /// and updates the component registration as needed. /// + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The metadata /// content will be read from this configuration object and used @@ -171,6 +163,8 @@ protected virtual void RegisterComponentMetadata + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The parameters /// content will be read from this configuration object and used @@ -206,6 +200,8 @@ protected virtual void RegisterComponentParameters + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The properties /// content will be read from this configuration object and used @@ -241,6 +237,8 @@ protected virtual void RegisterComponentProperties + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The services /// content will be read from this configuration object and used @@ -270,7 +268,7 @@ protected virtual void RegisterComponentServices /// Sets the auto activation mode for the component. /// + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The autoActivate /// content will be read from this configuration object and used @@ -329,6 +329,8 @@ protected virtual void SetAutoActivate /// Sets the ownership model for the component. /// + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The ownership /// content will be read from this configuration object and used @@ -417,6 +419,8 @@ protected virtual void SetComponentOwnership /// Sets the property injection mode for the component. /// + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The injectProperties /// content will be read from this configuration object and used @@ -467,6 +471,8 @@ protected virtual void SetInjectProperties /// Sets the lifetime scope for the component. /// + /// Activator data type. + /// Registration style. /// /// The configuration data containing the component. The instanceScope /// content will be read from this configuration object and used diff --git a/src/Autofac.Configuration/Core/ConfigurationExtensions.cs b/src/Autofac.Configuration/Core/ConfigurationExtensions.cs index 6c6a2e0..378428b 100644 --- a/src/Autofac.Configuration/Core/ConfigurationExtensions.cs +++ b/src/Autofac.Configuration/Core/ConfigurationExtensions.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -42,7 +45,7 @@ public static Assembly DefaultAssembly(this IConfiguration configuration) /// should be read. /// /// - /// The key in configuration where the assembly name + /// The key in configuration where the assembly name /// is specified. /// /// @@ -90,7 +93,7 @@ public static Assembly GetAssembly(this IConfiguration configuration, string key /// with defined parameters. /// /// - /// The key indicating the sub-element with the + /// The key indicating the sub-element with the /// parameters. Usually this is parameters. /// /// @@ -133,7 +136,7 @@ public static IEnumerable GetParameters(this IConfiguration configura /// with defined properties. /// /// - /// The key indicating the sub-element with the + /// The key indicating the sub-element with the /// propeties. Usually this is properties. /// /// @@ -250,7 +253,7 @@ internal static IEnumerable GetOrderedSubsections(this IC var configurationSection = configuration.GetSection(key); foreach (var section in configurationSection.GetChildren()) { - if (Int32.TryParse(section.Key, out var _)) + if (int.TryParse(section.Key, out var _)) { yield return section; } @@ -347,4 +350,4 @@ private static string GetKeyName(string fullKey) return fullKey.Substring(index + 1); } } -} \ No newline at end of file +} diff --git a/src/Autofac.Configuration/Core/ConfigurationRegistrar.cs b/src/Autofac.Configuration/Core/ConfigurationRegistrar.cs index 518b8d4..9bac082 100644 --- a/src/Autofac.Configuration/Core/ConfigurationRegistrar.cs +++ b/src/Autofac.Configuration/Core/ConfigurationRegistrar.cs @@ -1,27 +1,5 @@ -// This software is part of the Autofac IoC container -// Copyright (c) 2013 Autofac Contributors -// https://autofac.org -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. using System; using Microsoft.Extensions.Configuration; @@ -66,8 +44,8 @@ public ConfigurationRegistrar() /// public ConfigurationRegistrar(IComponentRegistrar componentRegistrar, IModuleRegistrar moduleRegistrar) { - this.ComponentRegistrar = componentRegistrar ?? throw new ArgumentNullException(nameof(componentRegistrar)); - this.ModuleRegistrar = moduleRegistrar ?? throw new ArgumentNullException(nameof(moduleRegistrar)); + ComponentRegistrar = componentRegistrar ?? throw new ArgumentNullException(nameof(componentRegistrar)); + ModuleRegistrar = moduleRegistrar ?? throw new ArgumentNullException(nameof(moduleRegistrar)); } /// @@ -119,8 +97,8 @@ public virtual void RegisterConfiguration(ContainerBuilder builder, IConfigurati throw new ArgumentNullException(nameof(configuration)); } - this.ModuleRegistrar.RegisterConfiguredModules(builder, configuration); - this.ComponentRegistrar.RegisterConfiguredComponents(builder, configuration); + ModuleRegistrar.RegisterConfiguredModules(builder, configuration); + ComponentRegistrar.RegisterConfiguredComponents(builder, configuration); } } } diff --git a/src/Autofac.Configuration/Core/ModuleRegistrar.cs b/src/Autofac.Configuration/Core/ModuleRegistrar.cs index 8bed1ad..b384e8e 100644 --- a/src/Autofac.Configuration/Core/ModuleRegistrar.cs +++ b/src/Autofac.Configuration/Core/ModuleRegistrar.cs @@ -1,27 +1,5 @@ -// This software is part of the Autofac IoC container -// Copyright (c) 2013 Autofac Contributors -// https://autofac.org -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Globalization; diff --git a/src/Autofac.Configuration/GlobalSuppressions.cs b/src/Autofac.Configuration/GlobalSuppressions.cs deleted file mode 100644 index de6da66628e8057a0a2b790e4182792288bcf4c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1324 zcmaKs&5IL35XI{(_&+prQrHjmxZokIEO=NE5)cs&V|F$>noO4T%u4=w_4leW&SZiT zlK!aIRj*&a%I{y7c4^5L_F%PTX7`M1tC+>QW4E$9*57Q;@3n1NDL%8tO0atnfo+K; z+pt>`YY$_xxpnr)XUDnB=k_p`wqo|&p20yZO3t*PYHD@NgieeP9#LEwG%DK~Tri8e z!UYdi+S+%bOHN;mDttVOocm3mz^%!eCoF4nG|r$Rud-L1PR>SW5>ee(_uTnST2@=f z^h{Tr6t)?0C_!cTi(Tz{FHf?RoRH=j%+|45#XWUi%5TV^JSCXQ&OE+%tmcYt&{3SV zt~k9MX)&n2@LQDBQ;lGE{9d6%Uw_cK_lolC)mCWJ+BtRfHcR`#e&`l_^!D-Qa#!;= zI&k@)yTUykxm)t6<|E9*X+5{%#A|8dw!%;L`VLG74u!pUZd2FxD%?<09a4b1=Go~)`PSIP?w2)$B4jhVf+SN4YQ74s+1 zHA;Pe(XorOeIg>y+>qxd|4ZTMe8@G2b@W5Bx1Rg76Qb&Z+(TCecIN*oVyd2ryEoo} VD + /// Configuration settings that provide a dictionary parameter to a registration. + /// [TypeConverter(typeof(DictionaryTypeConverter))] internal class ConfiguredDictionaryParameter { + /// + /// Gets or sets the dictionary of raw values. + /// public Dictionary Dictionary { get; set; } private class DictionaryTypeConverter : TypeConverter @@ -25,7 +33,7 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul foreach (var item in castValue.Dictionary) { - if (String.IsNullOrEmpty(item.Key)) + if (string.IsNullOrEmpty(item.Key)) { throw new FormatException(ConfigurationResources.DictionaryKeyMayNotBeNullOrEmpty); } diff --git a/src/Autofac.Configuration/Util/ConfiguredListParameter.cs b/src/Autofac.Configuration/Util/ConfiguredListParameter.cs index db63d23..4f80975 100644 --- a/src/Autofac.Configuration/Util/ConfiguredListParameter.cs +++ b/src/Autofac.Configuration/Util/ConfiguredListParameter.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; @@ -6,9 +9,15 @@ namespace Autofac.Configuration.Util { + /// + /// Configuration settings that provide a list parameter to a registration. + /// [TypeConverter(typeof(ListTypeConverter))] internal class ConfiguredListParameter { + /// + /// Gets or sets the list of raw values. + /// public string[] List { get; set; } private class ListTypeConverter : TypeConverter diff --git a/src/Autofac.Configuration/Util/ReflectionExtensions.cs b/src/Autofac.Configuration/Util/ReflectionExtensions.cs index 933c27e..21069f4 100644 --- a/src/Autofac.Configuration/Util/ReflectionExtensions.cs +++ b/src/Autofac.Configuration/Util/ReflectionExtensions.cs @@ -1,27 +1,5 @@ -// This software is part of the Autofac IoC container -// Copyright © 2011 Autofac Contributors -// https://autofac.org -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. using System.Reflection; diff --git a/src/Autofac.Configuration/Util/StringExtensions.cs b/src/Autofac.Configuration/Util/StringExtensions.cs index 053a40a..48eab89 100644 --- a/src/Autofac.Configuration/Util/StringExtensions.cs +++ b/src/Autofac.Configuration/Util/StringExtensions.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Globalization; namespace Autofac.Configuration.Util @@ -10,17 +13,17 @@ public static class StringExtensions { /// /// Uses a flexible parsing routine to convert a text value into - /// a . + /// a . /// /// - /// The value to parse into a . + /// The value to parse into a . /// /// /// or based on the /// content of the . /// /// - /// Thrown if can't be parsed into a . + /// Thrown if can't be parsed into a . /// public static bool ToFlexibleBoolean(this string value) { diff --git a/src/Autofac.Configuration/Util/TypeManipulation.cs b/src/Autofac.Configuration/Util/TypeManipulation.cs index 11459c6..0108160 100644 --- a/src/Autofac.Configuration/Util/TypeManipulation.cs +++ b/src/Autofac.Configuration/Util/TypeManipulation.cs @@ -1,27 +1,5 @@ -// This software is part of the Autofac IoC container -// Copyright © 2011 Autofac Contributors -// https://autofac.org -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.ComponentModel; @@ -43,7 +21,7 @@ internal class TypeManipulation /// The destination to which should be converted. /// The parameter for which the is being converted. /// - /// An of type , converted using + /// An of type , converted using /// type converters specified on if available. If /// is then the output will be for reference /// types and the default value for value types. @@ -69,7 +47,7 @@ public static object ChangeToCompatibleType(object value, Type destinationType, /// The destination to which should be converted. /// The parameter for which the is being converted. /// - /// An of type , converted using + /// An of type , converted using /// type converters specified on if available. If /// is then the output will be for reference /// types and the default value for value types. @@ -95,7 +73,7 @@ public static object ChangeToCompatibleType(object value, Type destinationType, /// The destination to which should be converted. /// A , if available, specifying the type of converter to use. is being converted. /// - /// An of type , converted using + /// An of type , converted using /// any type converters specified in if available. If /// is then the output will be for reference /// types and the default value for value types. diff --git a/test/Autofac.Configuration.Test/AssertionHelpers.cs b/test/Autofac.Configuration.Test/AssertionHelpers.cs index 6566b61..918b67d 100644 --- a/test/Autofac.Configuration.Test/AssertionHelpers.cs +++ b/test/Autofac.Configuration.Test/AssertionHelpers.cs @@ -1,4 +1,7 @@ -using Xunit; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using Xunit; namespace Autofac.Configuration.Test { diff --git a/test/Autofac.Configuration.Test/Autofac.Configuration.Test.csproj b/test/Autofac.Configuration.Test/Autofac.Configuration.Test.csproj index c93c843..a881473 100644 --- a/test/Autofac.Configuration.Test/Autofac.Configuration.Test.csproj +++ b/test/Autofac.Configuration.Test/Autofac.Configuration.Test.csproj @@ -1,19 +1,21 @@  - netcoreapp3.0 - $(NoWarn);CS1591;SA1602;SA1611 + netcoreapp3.1 + $(NoWarn);CS1591;SA1600;SA1602;SA1611 true - Autofac.Configuration.Test ../../Autofac.snk true - true - Autofac.Configuration.Test true - false ../../build/Analyzers.ruleset + false + latest + + + + @@ -44,7 +46,7 @@ - + @@ -58,10 +60,6 @@ - - - - diff --git a/test/Autofac.Configuration.Test/Core/ComponentRegistrarFixture.cs b/test/Autofac.Configuration.Test/Core/ComponentRegistrarFixture.cs index a800584..c45a04b 100644 --- a/test/Autofac.Configuration.Test/Core/ComponentRegistrarFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ComponentRegistrarFixture.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections.Generic; using System.Linq; using Autofac.Core; diff --git a/test/Autofac.Configuration.Test/Core/ConfigurationExtensionsFixture.cs b/test/Autofac.Configuration.Test/Core/ConfigurationExtensionsFixture.cs index 78a1b6a..c857e72 100644 --- a/test/Autofac.Configuration.Test/Core/ConfigurationExtensionsFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ConfigurationExtensionsFixture.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; @@ -350,7 +353,7 @@ public class HasConvertibleParametersAndProperties { public HasConvertibleParametersAndProperties([TypeConverter(typeof(ConvertibleConverter))] Convertible parameter) { - this.Parameter = parameter; + Parameter = parameter; } public Convertible Parameter { get; set; } @@ -373,7 +376,7 @@ public class HasEnumerableParameter { public HasEnumerableParameter(IList list) { - this.List = list; + List = list; } public IList List { get; private set; } @@ -393,8 +396,8 @@ public class HasSimpleParametersAndProperties : BaseSimpleParametersAndPropertie { public HasSimpleParametersAndProperties(double number, IPAddress ip) { - this.Number = number; - this.IP = ip; + Number = number; + IP = ip; } public IPAddress IP { get; private set; } diff --git a/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_DictionaryParametersFixture.cs b/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_DictionaryParametersFixture.cs index 93db139..f323bd0 100644 --- a/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_DictionaryParametersFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_DictionaryParametersFixture.cs @@ -1,4 +1,7 @@ -using System.Collections; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System.Collections; using System.Collections.Generic; using Xunit; @@ -146,4 +149,4 @@ public void NumericKeysZeroBasedNonSequential() Assert.Equal("Val2", poco.Dictionary[10]); } } -} \ No newline at end of file +} diff --git a/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_EnumerableParametersFixture.cs b/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_EnumerableParametersFixture.cs index 34ac98f..85310f7 100644 --- a/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_EnumerableParametersFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ConfigurationExtensions_EnumerableParametersFixture.cs @@ -1,4 +1,7 @@ -using System.Collections; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -176,7 +179,7 @@ public class J { public J(IList list) { - this.List = list; + List = list; } public IList List { get; private set; } @@ -198,7 +201,7 @@ public class K { public K(IList list = null) { - this.List = list; + List = list; } public IList List { get; private set; } @@ -220,12 +223,12 @@ public class L { public L() { - this.List = new List(); + List = new List(); } public L(IList list = null) { - this.List = list; + List = list; } public IList List { get; private set; } @@ -245,7 +248,7 @@ public void ParameterStringListInjectionMultipleConstructors() public class M { - public M(IList list) => this.List = list; + public M(IList list) => List = list; public IList List { get; } } diff --git a/test/Autofac.Configuration.Test/Core/ConfigurationRegistrarFixture.cs b/test/Autofac.Configuration.Test/Core/ConfigurationRegistrarFixture.cs index 523470f..eb02764 100644 --- a/test/Autofac.Configuration.Test/Core/ConfigurationRegistrarFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ConfigurationRegistrarFixture.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using Autofac.Configuration.Core; using Microsoft.Extensions.Configuration; using Moq; diff --git a/test/Autofac.Configuration.Test/Core/ModuleConfiguration_ComplexTypeFixture.cs b/test/Autofac.Configuration.Test/Core/ModuleConfiguration_ComplexTypeFixture.cs index ca90934..5665d51 100644 --- a/test/Autofac.Configuration.Test/Core/ModuleConfiguration_ComplexTypeFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ModuleConfiguration_ComplexTypeFixture.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections.Generic; using System.Linq; using Xunit; diff --git a/test/Autofac.Configuration.Test/Core/ModuleRegistrarFixture.cs b/test/Autofac.Configuration.Test/Core/ModuleRegistrarFixture.cs index e17113a..63bd31a 100644 --- a/test/Autofac.Configuration.Test/Core/ModuleRegistrarFixture.cs +++ b/test/Autofac.Configuration.Test/Core/ModuleRegistrarFixture.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections.Generic; using System.Linq; using Autofac.Core.Activators.Reflection; @@ -41,14 +44,14 @@ private class ParameterizedModule : Module { public ParameterizedModule(string message) { - this.Message = message; + Message = message; } public string Message { get; private set; } protected override void Load(ContainerBuilder builder) { - builder.RegisterType().WithProperty("Message", this.Message); + builder.RegisterType().WithProperty("Message", Message); } } @@ -56,7 +59,7 @@ private class ProtectedModule : Module { protected ProtectedModule(string message) { - this.Message = message; + Message = message; } public string Message { get; private set; } diff --git a/test/Autofac.Configuration.Test/EmbeddedConfiguration.cs b/test/Autofac.Configuration.Test/EmbeddedConfiguration.cs index f16e6fa..ea2e6ac 100644 --- a/test/Autofac.Configuration.Test/EmbeddedConfiguration.cs +++ b/test/Autofac.Configuration.Test/EmbeddedConfiguration.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System.Collections.Generic; using System.IO; using System.Reflection; using Microsoft.Extensions.Configuration; diff --git a/test/Autofac.Configuration.Test/EmbeddedConfigurationProvider.cs b/test/Autofac.Configuration.Test/EmbeddedConfigurationProvider.cs index 24f561b..5fcb069 100644 --- a/test/Autofac.Configuration.Test/EmbeddedConfigurationProvider.cs +++ b/test/Autofac.Configuration.Test/EmbeddedConfigurationProvider.cs @@ -1,8 +1,8 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Primitives; @@ -23,18 +23,18 @@ public class EmbeddedConfigurationProvider : IConfigurationProvider public EmbeddedConfigurationProvider(Stream fileStream) { var source = new TSource(); - this._provider = source.Build(new ConfigurationBuilder()) as FileConfigurationProvider; - this._provider.Load(fileStream); + _provider = source.Build(new ConfigurationBuilder()) as FileConfigurationProvider; + _provider.Load(fileStream); } public IEnumerable GetChildKeys(IEnumerable earlierKeys, string parentPath) { - return this._provider.GetChildKeys(earlierKeys, parentPath); + return _provider.GetChildKeys(earlierKeys, parentPath); } public IChangeToken GetReloadToken() { - return this._provider.GetReloadToken(); + return _provider.GetReloadToken(); } public void Load() @@ -44,12 +44,12 @@ public void Load() public void Set(string key, string value) { - this._provider.Set(key, value); + _provider.Set(key, value); } public bool TryGet(string key, out string value) { - return this._provider.TryGet(key, out value); + return _provider.TryGet(key, out value); } } } diff --git a/test/Autofac.Configuration.Test/Properties/AssemblyInfo.cs b/test/Autofac.Configuration.Test/Properties/AssemblyInfo.cs deleted file mode 100644 index 81e4015..0000000 --- a/test/Autofac.Configuration.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("Autofac.Configuration.Test")] diff --git a/test/Autofac.Configuration.Test/TestCulture.cs b/test/Autofac.Configuration.Test/TestCulture.cs index 48d5f29..8b68de5 100644 --- a/test/Autofac.Configuration.Test/TestCulture.cs +++ b/test/Autofac.Configuration.Test/TestCulture.cs @@ -1,7 +1,9 @@ +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + using System; using System.Globalization; using System.Threading; -using Xunit; namespace Autofac.Configuration.Test { @@ -28,4 +30,4 @@ public static void With(CultureInfo culture, Action test) } } } -} \ No newline at end of file +} diff --git a/test/Autofac.Configuration.Test/Util/ReflectionExtensionsFixture.cs b/test/Autofac.Configuration.Test/Util/ReflectionExtensionsFixture.cs index f97bf23..d43262f 100644 --- a/test/Autofac.Configuration.Test/Util/ReflectionExtensionsFixture.cs +++ b/test/Autofac.Configuration.Test/Util/ReflectionExtensionsFixture.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System.Reflection; using Autofac.Configuration.Util; using Xunit; @@ -34,4 +37,4 @@ public string NotSetter(string value) public string Property { get; set; } } } -} \ No newline at end of file +} diff --git a/test/Autofac.Configuration.Test/Util/TypeManipulationFixture.cs b/test/Autofac.Configuration.Test/Util/TypeManipulationFixture.cs index b9ec0dd..feb41ea 100644 --- a/test/Autofac.Configuration.Test/Util/TypeManipulationFixture.cs +++ b/test/Autofac.Configuration.Test/Util/TypeManipulationFixture.cs @@ -1,10 +1,12 @@ -using System; +// Copyright (c) Autofac Project. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Linq; using System.Net; -using System.Reflection; using Autofac.Configuration.Util; using Xunit; @@ -42,21 +44,21 @@ public void ChangeToCompatibleType_UsesTypeConverterOnProperty() [Fact] public void ChangeToCompatibleType_NullReferenceType() { - var actual = TypeManipulation.ChangeToCompatibleType(null, typeof(String)); + var actual = TypeManipulation.ChangeToCompatibleType(null, typeof(string)); Assert.Null(actual); } [Fact] public void ChangeToCompatibleType_NullValueType() { - var actual = TypeManipulation.ChangeToCompatibleType(null, typeof(Int32)); + var actual = TypeManipulation.ChangeToCompatibleType(null, typeof(int)); Assert.Equal(0, actual); } [Fact] public void ChangeToCompatibleType_NoConversionNeeded() { - var actual = TypeManipulation.ChangeToCompatibleType(15, typeof(Int32)); + var actual = TypeManipulation.ChangeToCompatibleType(15, typeof(int)); Assert.Equal(15, actual); } @@ -100,7 +102,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c return null; } - if (!(value is String str)) + if (!(value is string str)) { return base.ConvertFrom(context, culture, value); } @@ -114,11 +116,11 @@ public class HasTypeConverterAttributes { public HasTypeConverterAttributes([TypeConverter(typeof(ConvertibleConverter))] Convertible parameter) { - this.Property = parameter; + Property = parameter; } [TypeConverter(typeof(ConvertibleConverter))] public Convertible Property { get; set; } } } -} \ No newline at end of file +}