diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..fd4c96d8f9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +; Top-most http://editorconfig.org/ file +root = true + +[*] +end_of_line = LF +indent_style = space +indent_size = 4 + +[*.xml] +indent_size = 2 + +[*.csproj] +indent_size = 2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 84fd327ca5..0944268a01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build/ release/ scripts/ +artifacts/ .dotnet TestResults/ *.suo @@ -26,4 +27,7 @@ project.lock.json # JetBrains Rider .idea/ -*.sln.iml \ No newline at end of file +*.sln.iml + +# Read the Docs +docs/_build diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..af59f269aa --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1 @@ +requirements_file: docs/requirements.txt diff --git a/AutoMapper.nuspec b/AutoMapper.nuspec deleted file mode 100644 index 8a57accd54..0000000000 --- a/AutoMapper.nuspec +++ /dev/null @@ -1,84 +0,0 @@ - - - - AutoMapper - 4.1.1 - Jimmy Bogard - Jimmy Bogard - https://github.com/AutoMapper/AutoMapper/blob/master/LICENSE.txt - http://automapper.org - https://s3.amazonaws.com/automapper/icon.png - false - A convention-based object-object mapper - A convention-based object-object mapper. AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AutoMapper.sln b/AutoMapper.sln new file mode 100644 index 0000000000..8050190642 --- /dev/null +++ b/AutoMapper.sln @@ -0,0 +1,100 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.10 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0691ABF2-B3C7-43BF-9862-2D8D1299CE58}" + ProjectSection(SolutionItems) = preProject + appveyor.yml = appveyor.yml + CONTRIBUTING.md = CONTRIBUTING.md + default.ps1 = default.ps1 + Directory.Build.props = Directory.Build.props + ISSUE_TEMPLATE.md = ISSUE_TEMPLATE.md + README.md = README.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "src\Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper", "src\AutoMapper\AutoMapper.csproj", "{35888286-1428-4BF3-BB0C-D8BC092D0A5D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.UnitTests", "src\UnitTests\AutoMapper.UnitTests.csproj", "{4F96C184-FF4B-4256-B8BC-C51D1167C489}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.IntegrationTests", "src\IntegrationTests\AutoMapper.IntegrationTests.csproj", "{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|x64.ActiveCfg = Debug|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|x86.ActiveCfg = Debug|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Release|Any CPU.Build.0 = Release|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Release|ARM.ActiveCfg = Release|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Release|x64.ActiveCfg = Release|Any CPU + {B8051389-CB47-46FB-B234-9D49506704AA}.Release|x86.ActiveCfg = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|ARM.ActiveCfg = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|ARM.Build.0 = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x64.ActiveCfg = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x64.Build.0 = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x86.ActiveCfg = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x86.Build.0 = Debug|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|Any CPU.Build.0 = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|ARM.ActiveCfg = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|ARM.Build.0 = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x64.ActiveCfg = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x64.Build.0 = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x86.ActiveCfg = Release|Any CPU + {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x86.Build.0 = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|ARM.ActiveCfg = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|ARM.Build.0 = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|x64.ActiveCfg = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|x64.Build.0 = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|x86.ActiveCfg = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|x86.Build.0 = Debug|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|Any CPU.Build.0 = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|ARM.ActiveCfg = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|ARM.Build.0 = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|x64.ActiveCfg = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|x64.Build.0 = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|x86.ActiveCfg = Release|Any CPU + {4F96C184-FF4B-4256-B8BC-C51D1167C489}.Release|x86.Build.0 = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|ARM.Build.0 = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|x64.ActiveCfg = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|x64.Build.0 = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|x86.ActiveCfg = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Debug|x86.Build.0 = Debug|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|Any CPU.Build.0 = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|ARM.ActiveCfg = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|ARM.Build.0 = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x64.ActiveCfg = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x64.Build.0 = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x86.ActiveCfg = Release|Any CPU + {24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4D8272EE-D8E3-4B7E-A063-B334CBF8C42F} + EndGlobalSection +EndGlobal diff --git a/src/AutoMapper.snk b/AutoMapper.snk similarity index 100% rename from src/AutoMapper.snk rename to AutoMapper.snk diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..6264fec06a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,72 @@ +# How to contribute + +The easiest way to contribute is to open an issue and start a discussion. +Then we can decide if and how a feature or a change could be implemented and if you should submit a pull requests with code changes. + +Also read this first: [Being a good open source citizen](https://hackernoon.com/being-a-good-open-source-citizen-9060d0ab9732#.x3hocgw85) + +## General feedback and discussions +Please start a discussion on the [core repo issue tracker](https://github.com/AutoMapper/AutoMapper/issues). + +## Platform +AutoMapper is built using the RTM tooling that ships with Visual Studio 2017. This is the only configuration accepted. + +## Building + +Run `psake.cmd` from the command line. This builds and runs tests. + +## Bugs and feature requests? +Please log a new issue in the appropriate GitHub repo: + +* [Core](https://github.com/AutoMapper/AutoMapper) +* [EF6 Extensions](https://github.com/AutoMapper/AutoMapper.EF6) +* [IDataReader/Record Extensions](https://github.com/AutoMapper/AutoMapper.Data) +* [Collection Extensions](https://github.com/AutoMapper/AutoMapper.Collection) +* [Microsoft DI Extensions](https://github.com/AutoMapper/AutoMapper.Extensions.Microsoft.DependencyInjection) + +## Other discussions +https://gitter.im/AutoMapper/AutoMapper + +## Filing issues +The best way to get your bug fixed is to be as detailed as you can be about the problem. +Providing a minimal project with steps to reproduce the problem is ideal. +Here are questions you can answer before you file a bug to make sure you're not missing any important information. + +1. Did you read the [documentation](https://automapper.readthedocs.io/en/latest/)? +2. Did you include the snippet of broken code in the issue? +3. What are the *EXACT* steps to reproduce this problem (including source/destination types, mapping configuration and execution)? + +GitHub supports [markdown](https://github.github.com/github-flavored-markdown/), so when filing bugs make sure you check the formatting before clicking submit. + +## Contributing code and content +You will need to sign a [Contributor License Agreement](https://cla.dotnetfoundation.org/) before submitting your pull request. + +Make sure you can build the code. Familiarize yourself with the project workflow and our coding conventions. If you don't know what a pull request is read this article: https://help.github.com/articles/using-pull-requests. + +**We only accept PRs to the master branch.** + +Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. Here's a list of blog posts that are worth reading before doing a pull request: + +* [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza +* [Don't "Push" Your Pull Requests](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik. +* [10 tips for better Pull Requests](http://blog.ploeh.dk/2015/01/15/10-tips-for-better-pull-requests/) by Mark Seemann +* [How to write the perfect pull request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request) by GitHub + +Here's a few things you should always do when making changes to the code base: + +**Commit/Pull Request Format** + +``` +Summary of the changes (Less than 80 chars) + - Detail 1 + - Detail 2 + +#bugnumber (in this specific format) +``` + +**Tests** + +- Tests need to be provided for every bug/feature that is completed. +- Tests only need to be present for issues that need to be verified by QA (e.g. not tasks). +- If there is a scenario that is far too hard to test there does not need to be a test for it. + - "Too hard" is determined by the team as a whole. diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000000..ca71a5fe41 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,12 @@ + + + + 8.1.0 + Jimmy Bogard + latest + true + $(NoWarn);1701;1702;1591 + true + + + diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..f9ff3d2df7 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,38 @@ + + + +### Source/destination types + +```csharp +// Put your source/destination types here +``` + +### Mapping configuration + +```csharp +// Mapper.Initialize or just the CreateMap snippet +``` + +### Version: x.y.z + + +### Expected behavior + + + +### Actual behavior + + + +### Steps to reproduce + +```csharp +// Your calls to Mapper.Map or ProjectTo here, with source/destination objects constructed +``` diff --git a/LICENSE.txt b/LICENSE.txt index 0e750de961..ed254c2438 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,9 @@ +The MIT License (MIT) + Copyright (c) 2010 Jimmy Bogard 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. \ No newline at end of file +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. diff --git a/README.md b/README.md index acc7c2da8a..162265b182 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,63 @@ -AutoMapper -================================ +AutoMapper -[![Build status](https://ci.appveyor.com/api/projects/status/q261l3sbokafmx1o/branch/develop?svg=true)](https://ci.appveyor.com/project/jbogard/automapper/branch/develop) -[![NuGet](https://img.shields.io/nuget/dt/AutoMapper.svg)](https://www.nuget.org/packages/AutoMapper/) +[![Build status](https://ci.appveyor.com/api/projects/status/q261l3sbokafmx1o/branch/master?svg=true)](https://ci.appveyor.com/project/jbogard/automapper/branch/master) [![NuGet](http://img.shields.io/nuget/v/AutoMapper.svg)](https://www.nuget.org/packages/AutoMapper/) -[![MyGet CI](https://img.shields.io/myget/automapperdev/v/AutoMapper.svg)](http://myget.org/gallery/automapperdev) +[![MyGet (dev)](https://img.shields.io/myget/automapperdev/v/AutoMapper.svg)](http://myget.org/gallery/automapperdev) + +### What is AutoMapper? -What is AutoMapper? --------------------------------- AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another. This type of code is rather dreary and boring to write, so why not invent a tool to do it for us? -How do I get started? --------------------------------- -Check out the [getting started guide](https://github.com/AutoMapper/AutoMapper/wiki/Getting-started). When you're done there, the [wiki](https://github.com/AutoMapper/AutoMapper/wiki) goes in to the nitty-gritty details. Finally, check out the [dnrTV episode](http://www.dnrtv.com/default.aspx?showNum=155) for a full walkthrough. If you have questions, you can post them to the [Mailing List](http://groups.google.com/group/automapper-users). +This is the main repository for AutoMapper, but there's more: + +* [EF6 Extensions](https://github.com/AutoMapper/AutoMapper.EF6) +* [IDataReader/Record Extensions](https://github.com/AutoMapper/AutoMapper.Data) +* [Collection Extensions](https://github.com/AutoMapper/AutoMapper.Collection) +* [Microsoft DI Extensions](https://github.com/AutoMapper/AutoMapper.Extensions.Microsoft.DependencyInjection) +* [Expression Mapping](https://github.com/AutoMapper/AutoMapper.Extensions.ExpressionMapping) + +### How do I get started? + +First, configure AutoMapper to know what types you want to map, in the startup of your application: + +```csharp +Mapper.Initialize(cfg => { + cfg.CreateMap(); + cfg.CreateMap(); +}); +``` +Then in your application code, execute the mappings: + +```csharp +var fooDto = Mapper.Map(foo); +var barDto = Mapper.Map(bar); +``` + +Check out the [getting started guide](https://automapper.readthedocs.io/en/latest/Getting-started.html). When you're done there, the [wiki](https://automapper.readthedocs.io/en/latest/) goes in to the nitty-gritty details. If you have questions, you can post them to [Stack Overflow](https://stackoverflow.com/questions/tagged/automapper) or in our [Gitter](https://gitter.im/AutoMapper/AutoMapper). + +### Where can I get it? -Where can I get it? --------------------------------- First, [install NuGet](http://docs.nuget.org/docs/start-here/installing-nuget). Then, install [AutoMapper](https://www.nuget.org/packages/AutoMapper/) from the package manager console: - PM> Install-Package AutoMapper +``` +PM> Install-Package AutoMapper +``` + +### Do you have an issue? + +First check if it's already fixed by trying the [MyGet build](https://automapper.readthedocs.io/en/latest/The-MyGet-build.html). + +You might want to know exactly what [your mapping does](https://automapper.readthedocs.io/en/latest/Understanding-your-mapping.html) at runtime. + +If you're still running into problems, file an issue above. + +### License, etc. + +This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. +For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). + +AutoMapper is Copyright © 2009 [Jimmy Bogard](https://jimmybogard.com) and other contributors under the [MIT license](LICENSE.txt). + +### .NET Foundation -AutoMapper is Copyright © 2008-2012 [Jimmy Bogard](http://jimmybogard.lostechies.com) and other contributors under the [MIT license](LICENSE.txt). +This project is supported by the [.NET Foundation](https://dotnetfoundation.org). diff --git a/RefGen.exe b/RefGen.exe deleted file mode 100644 index d1721c246e..0000000000 Binary files a/RefGen.exe and /dev/null differ diff --git a/appveyor.yml b/appveyor.yml index 08a47295ca..257f2fa2a1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,11 +4,11 @@ pull_requests: branches: only: - master -services: mssql2014 +image: Visual Studio 2017 nuget: disable_publish_on_pr: true build_script: -- cmd: .\psake.bat ci +- cmd: .\psake.cmd ci test: off artifacts: - path: src\AutoMapper\bin\release\*.nupkg @@ -27,4 +27,4 @@ deploy: secure: t3blEIQiDIYjjWhOSTTtrcAnzJkmSi+0zYPxC1v4RDzm6oI/gIpD6ZtrOGsYu2jE on: branch: master - appveyor_repo_tag: true \ No newline at end of file + appveyor_repo_tag: true diff --git a/default.ps1 b/default.ps1 index ca1a5200f2..bb53962b04 100644 --- a/default.ps1 +++ b/default.ps1 @@ -1,94 +1,64 @@ -Framework '4.5.1x86' - properties { $base_dir = resolve-path . $build_dir = "$base_dir\build" $source_dir = "$base_dir\src" $result_dir = "$build_dir\results" $global:config = "debug" + $tag = $(git tag -l --points-at HEAD) + $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; + $suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"] + $commitHash = $(git rev-parse --short HEAD) + $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] + $versionSuffix = @{ $true = "--version-suffix=$($suffix)"; $false = ""}[$suffix -ne ""] } task default -depends local -task local -depends init, compile, test -task ci -depends clean, release, local, benchmark +task local -depends compile, test +task ci -depends clean, release, local, pack, benchmark task clean { rd "$source_dir\artifacts" -recurse -force -ErrorAction SilentlyContinue | out-null rd "$base_dir\build" -recurse -force -ErrorAction SilentlyContinue | out-null } -task init { - # Make sure per-user dotnet is installed - Install-Dotnet -} - task release { $global:config = "release" } task compile -depends clean { - $version = if ($env:APPVEYOR_BUILD_NUMBER -ne $NULL) { $env:APPVEYOR_BUILD_NUMBER } else { '0' } - $version = "{0:D5}" -f [convert]::ToInt32($version, 10) + echo "build: Tag is $tag" + echo "build: Package version suffix is $suffix" + echo "build: Build version suffix is $buildSuffix" - exec { & $source_dir\.nuget\Nuget.exe restore $source_dir\AutoMapper.sln } + exec { dotnet --version } + exec { dotnet --info } - exec { msbuild /t:Clean /t:Build /p:Configuration=$config /v:q /p:NoWarn=1591 /nologo $source_dir\AutoMapper.sln } + exec { dotnet build -c $config --version-suffix=$buildSuffix } +} - exec { dotnet pack $source_dir\AutoMapper -c $config --version-suffix $version} +task pack -depends compile { + exec { dotnet pack $source_dir\AutoMapper\AutoMapper.csproj -c $config --no-build $versionSuffix } } task benchmark { - exec { & $source_dir\Benchmark\bin\$config\Benchmark.exe } + exec { & $source_dir\Benchmark\bin\$config\net461\Benchmark.exe } } task test { - $testRunners = @(gci $source_dir\packages -rec -filter Fixie.Console.exe) + Push-Location -Path $source_dir\UnitTests - if ($testRunners.Length -ne 1) - { - throw "Expected to find 1 Fixie.Console.exe, but found $($testRunners.Length)." + try { + exec { & dotnet test -c $config --no-build --no-restore } + } finally { + Pop-Location } - $testRunner = $testRunners[0].FullName - - exec { & $testRunner $source_dir/UnitTests/bin/$config/AutoMapper.UnitTests.Net4.dll } - exec { & $testRunner $source_dir/UnitTests.Portable/bin/$config/AutoMapper.UnitTests.Portable.dll } - exec { & $testRunner $source_dir/IntegrationTests.Net4/bin/$config/AutoMapper.IntegrationTests.Net4.dll } -} - -function Install-Dotnet -{ - $dotnetcli = where-is('dotnet') - - if($dotnetcli -eq $null) - { - $dotnetPath = "$pwd\.dotnet" - $dotnetCliVersion = if ($env:DOTNET_CLI_VERSION -eq $null) { 'Latest' } else { $env:DOTNET_CLI_VERSION } - $dotnetInstallScriptUrl = 'https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1' - $dotnetInstallScriptPath = '.\scripts\obtain\install.ps1' + Push-Location -Path $source_dir\IntegrationTests - md -Force ".\scripts\obtain\" | Out-Null - curl $dotnetInstallScriptUrl -OutFile $dotnetInstallScriptPath - & .\scripts\obtain\install.ps1 -Channel "preview" -version $dotnetCliVersion -InstallDir $dotnetPath -NoPath - $env:Path = "$dotnetPath;$env:Path" - } + try { + exec { & dotnet test -c $config --no-build --no-restore } + } finally { + Pop-Location + } } - -function where-is($command) { - (ls env:\path).Value.split(';') | ` - where { $_ } | ` - %{ [System.Environment]::ExpandEnvironmentVariables($_) } | ` - where { test-path $_ } |` - %{ ls "$_\*" -include *.bat,*.exe,*cmd } | ` - %{ $file = $_.Name; ` - if($file -and ($file -eq $command -or ` - $file -eq ($command + '.exe') -or ` - $file -eq ($command + '.bat') -or ` - $file -eq ($command + '.cmd'))) ` - { ` - $_.FullName ` - } ` - } | ` - select -unique -} \ No newline at end of file diff --git a/docs/5.0-Upgrade-Guide.md b/docs/5.0-Upgrade-Guide.md new file mode 100644 index 0000000000..ad63fe41b6 --- /dev/null +++ b/docs/5.0-Upgrade-Guide.md @@ -0,0 +1,96 @@ +# 5.0 Upgrade Guide + +## Initialization + +You now must use either `Mapper.Initialize` or `new MapperConfiguration()` to initialize AutoMapper. If you prefer to keep the static usage, use `Mapper.Initialize`. + +If you have a lot of `Mapper.CreateMap` calls everywhere, move those to a Profile, or into `Mapper.Initialize`, called once at startup. + +For examples see [here](Static-and-Instance-API.html). + +## Profiles + +Instead of overriding a Configure method, you configure directly via the constructor: + +```c# +public class MappingProfile : Profile { + public MappingProfile() { + CreateMap(); + RecognizePrefix("m_"); + } +} +``` + +## IgnoreAllNonExisting extension + +A popular Stack Overflow post introduced the idea of ignoring all non-existing members on the destination type. It used things that don't exist anymore in the configuration API. This functionality is really only intended for configuration validation. + +In 5.0, you can use ReverseMap or CreateMap passing in the MemberList enum to validate against the source members (or no members). Any place you have this IgnoreAllNonExisting extension, use the CreateMap overload that validates against the source or no members: + +```c# +cfg.CreateMap(MemberList.None); +``` + +## Resolution Context things + +ResolutionContext used to capture a lot of information, source and destination values, along with a hierarchical parent model. For source/destination values, all of the interfaces (value resolvers and type converters) along with config options now include the source/destination values, and if applicable, source/destination members. + +If you're trying to access some parent object in your model, you will need to add those relationships to your models and access them through those relationships, and not through AutoMapper's hierarchy. The ResolutionContext was pared down for both performance and sanity reasons. + +## Value resolvers + +The signature of a value resolver has changed to allow access to the source/destination models. Additionally, the base class is gone in favor of interfaces. For value resolvers that do not have a member redirection, the interface is now: + +```c# +public interface IValueResolver +{ + TDestMember Resolve(TSource source, TDestination destination, TDestMember destMember, ResolutionContext context); +} +``` + +You have access now to the source model, destination model, and destination member this resolver is configured against. + +If you are using a ResolveUsing and passing in the `FromMember` configuration, this is now a new resolver interface: + +```c# +public interface IMemberValueResolver +{ + TDestMember Resolve(TSource source, TDestination destination, TSourceMember sourceMember, TDestMember destMember, ResolutionContext context); +} +``` + +This is now configured directly as `ForMember(dest => dest.Foo, opt => opt.ResolveUsing(src => src.Bar)` + +## Type converters + +The base class for a type converter is now gone in favor of a single interface that accepts the source and destination objects and returns the destination object: + +```c# +public interface ITypeConverter +{ + TDestination Convert(TSource source, TDestination destination, ResolutionContext context); +} +``` + +## Circular references + +Previously, AutoMapper could handle circular references by keeping track of what was mapped, and on every mapping, check a local hashtable of source/destination objects to see if the item was already mapped. It turns out this tracking is very expensive, and you need to opt-in using PreserveReferences for circular maps to work. Alternatively, you can configure MaxDepth: + +```c# +// Self-referential mapping +cfg.CreateMap().MaxDepth(3); + +// Circular references between users and groups +cfg.CreateMap().PreserveReferences(); +``` + +Starting from 6.1.0 PreserveReferences is set automatically at config time whenever the recursion can be detected statically. If that doesn't happen in your case, open an issue with a full repro and we'll look into it. + +## UseDestinationValue + +UseDestinationValue tells AutoMapper not to create a new object for some member, but to use the existing property of the destination object. It used to be true by default. Consider whether this applies to your case. Check [recent issues](https://github.com/AutoMapper/AutoMapper/search?o=desc&q=UseDestinationValue&s=created&type=Issues&utf8=%E2%9C%93). + +```c# +cfg.CreateMap() + .ForMember(d => d.Child, opt => opt.UseDestinationValue()); +``` diff --git a/docs/8.0-Upgrade-Guide.md b/docs/8.0-Upgrade-Guide.md new file mode 100644 index 0000000000..7447d706a5 --- /dev/null +++ b/docs/8.0-Upgrade-Guide.md @@ -0,0 +1,172 @@ +# 8.0 Upgrade Guide + +## ProjectUsing + +The `ProjectUsing` method consolidated with `ConvertUsing`: + +```c# +// IMappingExpression + +// Old +void ConvertUsing(Func mappingFunction); +void ProjectUsing(Expression> mappingExpression); + +// New +void ConvertUsing(Expression> mappingExpression); +``` + +To migrate, replace all usages of `ProjectUsing` with `ConvertUsing`. + +The `ConvertUsing` expression-based method will be used for both in-memory mapping and LINQ projections. You cannot have separate configuration for in-memory vs. LINQ projections. + +### Existing `ConvertUsing` usages + +The change from `Func` to `Expression` may break some existing usages. Namely: + +- `ConvertUsing` using lambda statements, method groups, or delegates +- Dual configuration of `ProjectUsing` and `ConvertUsing` + +For the first case, you may either: + +- Convert to a lambda expression +- Move to the `Func`-based overloads + +The `Func`-based overloads accept more parameters, so you may have to add the parameters to your delegates. + +### Motivation + +Simplify overloads, and to make it clear that you cannot have separate configuration for LINQ projections vs. in-memory mapping. + +## ConstructProjectionUsing + +The `ConstructProjectionUsing` method consolidated with `ConstructUsing`: + +```c# +// IMappingExpression + +// Old +IMappingExpression ConstructUsing(Func ctor); +IMappingExpression ConstructUsing(Func ctor); +IMappingExpression ConstructProjectionUsing(Expression> ctorExpression); + +// New +IMappingExpression ConstructUsing(Expression> ctor); +IMappingExpression ConstructUsing(Func ctor); + +// IMappingExpression + +// Old +IMappingExpression ConstructUsing(Func ctor); +IMappingExpression ConstructUsing(Func ctor); +IMappingExpression ConstructProjectionUsing(LambdaExpression ctorExpression); + +// New +IMappingExpression ConstructUsing(Expression> ctor); +IMappingExpression ConstructUsing(Func ctor); +``` + +To migrate, replace all usages of `ConstructProjectionUsing` with `ConstructUsing`. + +The `ConstructUsing` expression-based method will be used for both in-memory mapping and LINQ projections. You cannot have separate configuration for in-memory vs. LINQ projections. + +### Existing `ConstructUsing` usages + +The change from `Func` to `Expression` may break some existing usages. Namely: + +- `ConstructUsing` using lambda statements, method groups, or delegates +- Dual configuration of `ConstructProjectionUsing` and `ConstructUsing` + +For the first case, you may either: + +- Convert to a lambda expression +- Move to the `Func`-based overload + +The `Func`-based overload accepts more parameters, so you may have to add the parameters to your delegates. + +### Motivation + +Simplify overloads, and to make it clear that you cannot have separate configuration for LINQ projections vs. in-memory mapping. + +## ResolveUsing + +The `ResolveUsing` method consolidated with `MapFrom`: + +```c# +// IMappingExpression + +// Old +void ResolveUsing(Func mappingFunction); +void ResolveUsing(Func mappingFunction); +void ResolveUsing(Func mappingFunction); +// Many, many overloads +void MapFrom(Expression> mapExpression); + +// New +void MapFrom(Expression> mappingExpression); +void MapFrom(Func mappingFunction); +void MapFrom(Func mappingFunction); +``` + +To migrate, replace all usages of `ResolveUsing` with `MapFrom`. + +The `MapFrom` expression-based method will be used for both in-memory mapping and LINQ projections. You cannot have separate configuration for in-memory vs. LINQ projections. + +### Existing `ResolveUsing` usages + +The change from `Func` to `Expression` may break some existing usages. Namely: + +- `ResolveUsing` using lambda statements, method groups, or delegates +- Dual configuration of `ResolveUsing` and `MapFrom` + +For the first case, you may either: + +- Convert to a lambda expression +- Move to the `Func`-based overloads + +The `Func`-based overloads accept more parameters, so you may have to add the parameters to your delegates. + +### Motivation + +Simplify overloads, and to make it clear that you cannot have separate configuration for LINQ projections vs. in-memory mapping. + +## UseValue + +Underneath the covers, `UseValue` called `MapFrom`. `UseValue` consolidated with `MapFrom`. + +To migrate, replace all usages of `UseValue` with `MapFrom`: + +```c# + +// Old +cfg.CreateMap() + .ForMember(dest => dest.Date, opt => opt.UseValue(DateTime.Now)); + +// New +cfg.CreateMap() + .ForMember(dest => dest.Date, opt => opt.MapFrom(src => DateTime.Now)); +``` + +This can be simplified to a global find and replace of `UseValue(` with `MapFrom(src => `. + +### Motivation + +To make the underlying configuration more explicit. Historically, `MapFrom` only allowed mapping from an individual source member. This restriction went away with 5.0, so there is no longer a need for additional redundant configuration options originally meant to work around this restriction. + +## ForSourceMember Ignore + +`ISourceMemberConfigurationExpression.Ignore` was renamed to `DoNotValidate` to avoid confusion. It only applies when validating source members, with `MemberList.Source`. It does not affect the mapping itself or validation for the default case, `MemberList.Destination`. +To migrate, replace all usages of `Ignore` with `DoNotValidate`: + +```c# + +// Old +cfg.CreateMap() + .ForSourceMember(source => source.Date, opt => opt.Ignore()); + +// New +cfg.CreateMap() + .ForSourceMember(source => source.Date, opt => opt.DoNotValidate()); +``` +## Generic maps validation + +Generic maps are now validated. The generic map itself is validated at configuration time for the non generic members, so AssertConfigurationIsValid should catch errors for those. And the closed generic map will be validated when it's used, possibly at runtime. If you don't care about those errors, you need to [override them](Configuration-validation.html#overriding-configuration-errors). diff --git a/docs/Before-and-after-map-actions.md b/docs/Before-and-after-map-actions.md new file mode 100644 index 0000000000..9a88b8f6e8 --- /dev/null +++ b/docs/Before-and-after-map-actions.md @@ -0,0 +1,89 @@ +# Before and After Map Action + +Occasionally, you might need to perform custom logic before or after a map occurs. These should be a rarity, as it's more obvious to do this work outside of AutoMapper. You can create global before/after map actions: + +```c# +Mapper.Initialize(cfg => { + cfg.CreateMap() + .BeforeMap((src, dest) => src.Value = src.Value + 10) + .AfterMap((src, dest) => dest.Name = "John"); +}); +``` + +Or you can create before/after map callbacks during mapping: + +```c# +int i = 10; +Mapper.Map(src, opt => { + opt.BeforeMap((src, dest) => src.Value = src.Value + i); + opt.AfterMap((src, dest) => dest.Name = HttpContext.Current.Identity.Name); +}); +``` + +The latter configuration is helpful when you need contextual information fed into before/after map actions. + +## Using `IMappingAction` +You can encapsulate Before and After Map Actions into small reusable classes. Those classes need to implement the `IMappingAction` interface. + +Using the previous example, here is an encapsulation of naming some objects "John": + +``` csharp +public class NameMeJohnAction : IMappingAction +{ + public void Process(SomePersonObject source, SomeOtherPersonObject destination) + { + destination.Name = "John"; + } +} + +Mapper.Initialize(cfg => { + cfg.CreateMap() + .AfterMap(); +}); +``` + +### Asp.Net Core and `AutoMapper.Extensions.Microsoft.DependencyInjection` +If you are using Asp.Net Core and the `AutoMapper.Extensions.Microsoft.DependencyInjection` package, this is also a good way of using Dependency Injection. You can't inject dependencies into `Profile` classes, but you can do it in `IMappingAction` implementations. + +The following example shows how to connect an `IMappingAction` accessing the current `HttpContext` to a `Profile` after map action, leveraging Dependency Injection: + +``` csharp +public class SetTraceIdentifierAction : IMappingAction +{ + private readonly IHttpContextAccessor _httpContextAccessor; + + public SetTraceIdentifierAction(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); + } + + public void Process(SomeModel source, SomeOtherModel destination) + { + destination.TraceIdentifier = _httpContextAccessor.HttpContext.TraceIdentifier; + } +} + +public class SomeProfile : Profile +{ + public SomeProfile() + { + CreateMap() + .AfterMap(); + } +} +``` + +Everything is connected together by: + +``` csharp +public class Startup +{ + public void ConfigureServices(IServiceCollection services) + { + services.AddAutoMapper(typeof(Startup).Assembly); + } + //.. +} +``` + +*See `AutoMapper.Extensions.Microsoft.DependencyInjection` for more info.* diff --git a/docs/Conditional-mapping.md b/docs/Conditional-mapping.md new file mode 100644 index 0000000000..d4ebb1d954 --- /dev/null +++ b/docs/Conditional-mapping.md @@ -0,0 +1,31 @@ +# Conditional Mapping + +AutoMapper allows you to add conditions to properties that must be met before that property will be mapped. + +This can be used in situations like the following where we are trying to map from an int to an unsigned int. +```c# +class Foo{ + public int baz; +} + +class Bar { + public uint baz; +} +``` + +In the following mapping the property baz will only be mapped if it is greater than or equal to 0 in the source object. + +```c# +Mapper.Initialize(cfg => { + cfg.CreateMap() + .ForMember(dest => dest.baz, opt => opt.Condition(src => (src.baz >= 0))); +}); +``` + +## Preconditions + +Similarly, there is a PreCondition method. The difference is that it runs sooner in the mapping process, before the source value is resolved (think MapFrom). So the precondition is called, then we decide which will be the source of the mapping (resolving), then the condition is called and finally the destination value is assigned. + +You can [see the steps](Understanding-your-mapping.html) yourself. + +See [here](Custom-value-resolvers.html#resolvers-and-conditions) for a concrete example. diff --git a/docs/Configuration-validation.md b/docs/Configuration-validation.md new file mode 100644 index 0000000000..9f768c7d10 --- /dev/null +++ b/docs/Configuration-validation.md @@ -0,0 +1,58 @@ +# Configuration Validation + +Hand-rolled mapping code, though tedious, has the advantage of being testable. One of the inspirations behind AutoMapper was to eliminate not just the custom mapping code, but eliminate the need for manual testing. Because the mapping from source to destination is convention-based, you will still need to test your configuration. + +AutoMapper provides configuration testing in the form of the AssertConfigurationIsValid method. Suppose we have slightly misconfigured our source and destination types: +```c# +public class Source +{ + public int SomeValue { get; set; } +} + +public class Destination +{ + public int SomeValuefff { get; set; } +} +``` +In the Destination type, we probably fat-fingered the destination property. Other typical issues are source member renames. To test our configuration, we simply create a unit test that sets up the configuration and executes the AssertConfigurationIsValid method: +```c# +Mapper.Initialize(cfg => + cfg.CreateMap()); + +Mapper.Configuration.AssertConfigurationIsValid(); +``` +Executing this code produces an AutoMapperConfigurationException, with a descriptive message. AutoMapper checks to make sure that *every single* Destination type member has a corresponding type member on the source type. + +## Overriding configuration errors + +To fix a configuration error (besides renaming the source/destination members), you have three choices for providing an alternate configuration: + +* [Custom Value Resolvers](Custom-value-resolvers.html) +* [Projection](Projection.html) +* Use the Ignore() option + +With the third option, we have a member on the destination type that we will fill with alternative means, and not through the Map operation. +```c# +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForMember(dest => dest.SomeValuefff, opt => opt.Ignore()) +); +``` + +## Selecting members to validate + +By default, AutoMapper uses the destination type to validate members. It assumes that all destination members need to be mapped. To modify this behavior, use the `CreateMap` overload to specify which member list to validate against: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap(MemberList.Source); + cfg.CreateMap(MemberList.None); +); +``` + +To skip validation altogether for this map, use `MemberList.None`. + + +## Custom validations + +You can add custom validations through an extension point. See [here](https://github.com/AutoMapper/AutoMapper/blob/7a00700de61cd3234b6a6eb4bf0f6bbe402369b1/src/UnitTests/ConfigurationValidation.cs#L30). diff --git a/docs/Configuration.md b/docs/Configuration.md new file mode 100644 index 0000000000..64e87de3e6 --- /dev/null +++ b/docs/Configuration.md @@ -0,0 +1,231 @@ +# Configuration + +Create a `MapperConfiguration` instance and initialize configuration via the constructor: + +```c# +var config = new MapperConfiguration(cfg => { + cfg.CreateMap(); + cfg.AddProfile(); +}); +``` + +The `MapperConfiguration` instance can be stored statically, in a static field or in a dependency injection container. Once created it cannot be changed/modified. + +Alternatively, you can use the static Mapper instance to initialize AutoMapper: + +```c# +Mapper.Initialize(cfg => { + cfg.CreateMap(); + cfg.AddProfile(); +}); +``` + +## Profile Instances + +A good way to organize your mapping configurations is with profiles. +Create classes that inherit from `Profile` and put the configuration in the constructor: +```c# +// This is the approach starting with version 5 +public class OrganizationProfile : Profile +{ + public OrganizationProfile() + { + CreateMap(); + // Use CreateMap... Etc.. here (Profile methods are the same as configuration methods) + } +} + +// How it was done in 4.x - as of 5.0 this is obsolete: +// public class OrganizationProfile : Profile +// { +// protected override void Configure() +// { +// CreateMap(); +// } +// } +``` + +In earlier versions the `Configure` method was used instead of a constructor. +As of version 5, `Configure()` is obsolete. It will be removed in 6.0. + +Configuration inside a profile only applies to maps inside the profile. Configuration applied to the root configuration applies to *all* maps created. + +### Assembly Scanning for auto configuration + +Profiles can be added to the main mapper configuration in a number of ways, either directly: + +``` +cfg.AddProfile(); +cfg.AddProfile(new OrganizationProfile()); +``` + +or by automatically scanning for profiles: + +```c# +// Scan for all profiles in an assembly +// ... using instance approach: +var config = new MapperConfiguration(cfg => { + cfg.AddProfiles(myAssembly); +}); +// ... or static approach: +Mapper.Initialize(cfg => cfg.AddProfiles(myAssembly)); + +// Can also use assembly names: +Mapper.Initialize(cfg => + cfg.AddProfiles(new [] { + "Foo.UI", + "Foo.Core" + }); +); + +// Or marker types for assemblies: +Mapper.Initialize(cfg => + cfg.AddProfiles(new [] { + typeof(HomeController), + typeof(Entity) + }); +); +``` + +AutoMapper will scan the designated assemblies for classes inheriting from Profile and add them to the configuration. + +## Naming Conventions + +You can set the source and destination naming conventions + +```c# +Mapper.Initialize(cfg => { + cfg.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention(); + cfg.DestinationMemberNamingConvention = new PascalCaseNamingConvention(); +}); +``` + +This will map the following properties to each other: +` property_name -> PropertyName ` + +You can also set this at a per profile level + +```c# +public class OrganizationProfile : Profile +{ + public OrganizationProfile() + { + SourceMemberNamingConvention = new LowerUnderscoreNamingConvention(); + DestinationMemberNamingConvention = new PascalCaseNamingConvention(); + //Put your CreateMap... Etc.. here + } +} +``` + +## Replacing characters + +You can also replace individual characters or entire words in source members during member name matching: + +```c# +public class Source +{ + public int Value { get; set; } + public int Ävíator { get; set; } + public int SubAirlinaFlight { get; set; } +} +public class Destination +{ + public int Value { get; set; } + public int Aviator { get; set; } + public int SubAirlineFlight { get; set; } +} +``` + +We want to replace the individual characters, and perhaps translate a word: + +```c# +Mapper.Initialize(c => +{ + c.ReplaceMemberName("Ä", "A"); + c.ReplaceMemberName("í", "i"); + c.ReplaceMemberName("Airlina", "Airline"); +}); +``` + +## Recognizing pre/postfixes + +Sometimes your source/destination properties will have common pre/postfixes that cause you to have to do a bunch of custom member mappings because the names don't match up. To address this, you can recognize pre/postfixes: + +```c# +public class Source { + public int frmValue { get; set; } + public int frmValue2 { get; set; } +} +public class Dest { + public int Value { get; set; } + public int Value2 { get; set; } +} +Mapper.Initialize(cfg => { + cfg.RecognizePrefixes("frm"); + cfg.CreateMap(); +}); +Mapper.AssertConfigurationIsValid(); +``` + +By default AutoMapper recognizes the prefix "Get", if you need to clear the prefix: + +```c# +Mapper.Initialize(cfg => { + cfg.ClearPrefixes(); + cfg.RecognizePrefixes("tmp"); +}); +``` + +## Global property/field filtering + +By default, AutoMapper tries to map every public property/field. You can filter out properties/fields with the property/field filters: + +```c# +Mapper.Initialize(cfg => +{ + // don't map any fields + cfg.ShouldMapField = fi => false; + + // map properties with a public or private getter + cfg.ShouldMapProperty = pi => + pi.GetMethod != null && (pi.GetMethod.IsPublic || pi.GetMethod.IsPrivate); +}); +``` + +## Configuring visibility + +By default, AutoMapper only recognizes public members. It can map to private setters, but will skip internal/private methods and properties if the entire property is private/internal. To instruct AutoMapper to recognize members with other visibilities, override the default filters ShouldMapField and/or ShouldMapProperty : + +```c# +Mapper.Initialize(cfg => +{ + // map properties with public or internal getters + cfg.ShouldMapProperty = p => p.GetMethod.IsPublic || p.GetMethod.IsAssembly; + cfg.CreateMap(); +}); +``` + +Map configurations will now recognize internal/private members. + +## Configuration compilation + +Because expression compilation can be a bit resource intensive, AutoMapper lazily compiles the type map plans on first map. However, this behavior is not always desirable, so you can tell AutoMapper to compile its mappings directly: + +```c# +Mapper.Initialize(cfg => {}); +Mapper.Configuration.CompileMappings(); +``` + +For a few hundred mappings, this may take a couple of seconds. + +## Resetting static mapping configuration + +The static `Mapper.Initialize` is intended to be called only once. To reset the static mapping configuration (for example, at the start of tests): + +```c# +Mapper.Reset(); + +Mapper.Initialize(cfg => { /* configure again */ }); +``` + +`Reset` should not be used in production code. It is intended to support testing scenarios only. \ No newline at end of file diff --git a/docs/Construction.md b/docs/Construction.md new file mode 100644 index 0000000000..77510c2793 --- /dev/null +++ b/docs/Construction.md @@ -0,0 +1,55 @@ +# Construction + +AutoMapper can map to destination constructors based on source members: + +```c# +public class Source { + public int Value { get; set; } +} +public class SourceDto { + public SourceDto(int value) { + _value = value; + } + private int _value; + public int Value { + get { return _value; } + } +} +Mapper.Initialize(cfg => cfg.CreateMap()); +``` + +If the destination constructor parameter names don't match, you can modify them at config time: + +```c# +public class Source { + public int Value { get; set; } +} +public class SourceDto { + public SourceDto(int valueParamSomeOtherName) { + _value = valueParamSomeOtherName; + } + private int _value; + public int Value { + get { return _value; } + } +} +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForCtorParam("valueParamSomeOtherName", opt => opt.MapFrom(src => src.Value)) +); +``` + +This works for both LINQ projections and in-memory mapping. + +You can also disable constructor mapping: + +```c# +Mapper.Initialize(cfg => cfg.DisableConstructorMapping()); +``` + +You can configure which constructors are considered for the destination object: + +```c# +// don't map private constructors +Mapper.Initialize(cfg => cfg.ShouldUseConstructor = ci => !ci.IsPrivate); +``` diff --git a/docs/Conventions.md b/docs/Conventions.md new file mode 100644 index 0000000000..a762b237ce --- /dev/null +++ b/docs/Conventions.md @@ -0,0 +1,118 @@ +# Conventions + +## Conditional Object Mapper + +Conditional Object Mappers make new type maps based on conditional between the source and the destination type. + +```c# +var config = new MapperConfiguration(cfg => { + cfg.AddConditionalObjectMapper().Where((s, d) => s.Name == d.Name + "Dto"); +}); +``` + +## Member Configuration + +Member Configuration is like [Configuration](Configuration.html) but you can have complete control on what is and isn't used. + +```c# +var config = new MapperConfiguration(cfg => { cfg.AddMemberConfiguration(); }); +``` + +AddMemberConfiguration() starts off with a blank slate. Everything that applies in Configuration by default is gone to start with. + +### Naming Conventions + +`AddMemberConfiguration().AddMember()` gets you default naming convention functionality. + +Can overwrite the source and destination member naming conventions by passing a lambda through the parameter. +SourceExtentionMethods can also be set here. + +If you don't set anything AutoMapper will use DefaultMember, which will only check using the Name of the property. + +**PS: If you don't set this Flattening of objects will be disabled.** + +### Replacing characters + +`AddMemberConfiguration().AddName(_ => _.AddReplace("Ä", "A").AddReplace("í", "i"));` + +### Recognizing pre/postfixes + +``` +AddMemberConfiguration() + .AddName(_ => _.AddStrings(p => p.Prefixes, "Get", "get") + .AddStrings(p => p.DestinationPostfixes, "Set")); +``` + +### Attribute Support + +`AddMemberConfiguration().AddName();` * Currently is always on + +Looks for instances of SourceToDestinationMapperAttribute for Properties/Fields and calls user defined isMatch function to find member matches. + +MapToAttribute is one of them which will match the property based on name provided. + +```c# +public class Foo +{ + [MapTo("SourceOfBar")] + public int Bar { get; set; } +} +``` + +### Getting AutoMapper Defaults + +``` +AddMemberConfiguration() + .AddMember() + .AddName(_ => _.AddStrings(p => p.Prefixes, "Get")) +``` + +Is the default values set by [Configuration](Configuration.html) if you don't use AddMemberConfiguration(). + +## Expand-ability + +Each of the AddName and AddMember types are based on an interface ISourceToDestinationNameMapper and IChildMemberConfiguration. You can make your own classes off the interface and configure their properties through the lambda statement argument, so you can have fine tune control over how AutoMapper resolves property maps. + +## Multiple Configurations + +Each configuration is its own set of rules that all must pass in order to say a property is mapped. If you make multiple configurations they are completely separate from one another. + +## Profiles + +These can be added to Profile as well as the ConfigurationStore. + +Each Profiles rules are separate from one another, and won't share any conditions. +If a map is generated from AddConditionalObjectMapper of one profile, the AddMemberConfigurations of only that profile can be used to resolve the property maps. + +#### Example + +Shown below is two profiles for making conventions for transferring to and from a Data Transfer Object. +Each one is isolated to one way of the mappings, and the rules are explicitly stated for each side. + +```c# +// Flattens with NameSplitMember +// Only applies to types that have same name with destination ending with Dto +// Only applies Dto post fixes to the source properties +public class ToDTO : Profile +{ + protected override void Configure() + { + AddMemberConfiguration().AddMember().AddName( + _ => _.AddStrings(p => p.Postfixes, "Dto")); + AddConditionalObjectMapper().Where((s, d) => s.Name == d.Name + "Dto"); + } +} + +// Doesn't Flatten Objects +// Only applies to types that have same name with source ending with Dto +// Only applies Dto post fixes to the destination properties +public class FromDTO : Profile +{ + protected override void Configure() + { + AddMemberConfiguration().AddName( + _ => _.AddStrings(p => p.DestinationPostfixes, "Dto")); + AddConditionalObjectMapper().Where((s, d) => d.Name == s.Name + "Dto"); + } +} +``` diff --git a/docs/Custom-type-converters.md b/docs/Custom-type-converters.md new file mode 100644 index 0000000000..ae33669e59 --- /dev/null +++ b/docs/Custom-type-converters.md @@ -0,0 +1,92 @@ +# Custom Type Converters + +Sometimes, you need to take complete control over the conversion of one type to another. This is typically when one type looks nothing like the other, a conversion function already exists, and you would like to go from a "looser" type to a stronger type, such as a source type of string to a destination type of Int32. + +For example, suppose we have a source type of: + +```c# +public class Source +{ + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } +} +``` + +But you would like to map it to: + +```c# +public class Destination +{ + public int Value1 { get; set; } + public DateTime Value2 { get; set; } + public Type Value3 { get; set; } +} +``` + +If we were to try and map these two types as-is, AutoMapper would throw an exception (at map time and configuration-checking time), as AutoMapper does not know about any mapping from string to int, DateTime or Type. To create maps for these types, we must supply a custom type converter, and we have three ways of doing so: + +```c# +void ConvertUsing(Func mappingFunction); +void ConvertUsing(ITypeConverter converter); +void ConvertUsing() where TTypeConverter : ITypeConverter; +``` + +The first option is simply any function that takes a source and returns a destination (there are several overloads too). This works for simple cases, but becomes unwieldy for larger ones. In more difficult cases, we can create a custom ITypeConverter\: + +```c# +public interface ITypeConverter +{ + TDestination Convert(TSource source, TDestination destination, ResolutionContext context); +} +``` + +And supply AutoMapper with either an instance of a custom type converter, or simply the type, which AutoMapper will instantiate at run time. The mapping configuration for our above source/destination types then becomes: + +```c# +[Test] +public void Example() +{ + Mapper.Initialize(cfg => { + cfg.CreateMap().ConvertUsing(s => Convert.ToInt32(s)); + cfg.CreateMap().ConvertUsing(new DateTimeTypeConverter()); + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap(); + }); + Mapper.AssertConfigurationIsValid(); + + var source = new Source + { + Value1 = "5", + Value2 = "01/01/2000", + Value3 = "AutoMapperSamples.GlobalTypeConverters.GlobalTypeConverters+Destination" + }; + + Destination result = Mapper.Map(source); + result.Value3.ShouldEqual(typeof(Destination)); +} + +public class DateTimeTypeConverter : ITypeConverter +{ + public DateTime Convert(string source, DateTime destination, ResolutionContext context) + { + return System.Convert.ToDateTime(source); + } +} + +public class TypeTypeConverter : ITypeConverter +{ + public Type Convert(string source, Type destination, ResolutionContext context) + { + return Assembly.GetExecutingAssembly().GetType(source); + } +} +``` + +In the first mapping, from string to Int32, we simply use the built-in Convert.ToInt32 function (supplied as a method group). The next two use custom ITypeConverter implementations. + +The real power of custom type converters is that they are used any time AutoMapper finds the source/destination pairs on any mapped types. We can build a set of custom type converters, on top of which other mapping configurations use, without needing any extra configuration. In the above example, we never have to specify the string/int conversion again. Where as [Custom Value Resolvers](Custom-value-resolvers.html) have to be configured at a type member level, custom type converters are global in scope. + +## System Type Converters + +The .NET Framework also supports the concepts of type converters, through the [TypeConverter](http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx) class. AutoMapper supports these types of type converters, in configuration checking and mapping, without the need for any manual configuration. AutoMapper uses the [TypeDescriptor.GetConverter](http://msdn.microsoft.com/en-us/library/system.componentmodel.typedescriptor.getconverter.aspx) method for determining if the source/destination type pair can be mapped. diff --git a/docs/Custom-value-resolvers.md b/docs/Custom-value-resolvers.md new file mode 100644 index 0000000000..c2b22936c6 --- /dev/null +++ b/docs/Custom-value-resolvers.md @@ -0,0 +1,201 @@ +# Custom Value Resolvers + +Although AutoMapper covers quite a few destination member mapping scenarios, there are the 1 to 5% of destination values that need a little help in resolving. Many times, this custom value resolution logic is domain logic that can go straight on our domain. However, if this logic pertains only to the mapping operation, it would clutter our source types with unnecessary behavior. In these cases, AutoMapper allows for configuring custom value resolvers for destination members. For example, we might want to have a calculated value just during mapping: + +```c# +public class Source +{ + public int Value1 { get; set; } + public int Value2 { get; set; } +} + +public class Destination +{ + public int Total { get; set; } +} +``` + +For whatever reason, we want Total to be the sum of the source Value properties. For some other reason, we can't or shouldn't put this logic on our Source type. To supply a custom value resolver, we'll need to first create a type that implements IValueResolver: + +```c# +public interface IValueResolver +{ + TDestMember Resolve(TSource source, TDestination destination, TDestMember destMember, ResolutionContext context); +} +``` + +The ResolutionContext contains all of the contextual information for the current resolution operation, such as source type, destination type, source value and so on. An example implementation: + +```c# +public class CustomResolver : IValueResolver +{ + public int Resolve(Source source, Destination destination, int member, ResolutionContext context) + { + return source.Value1 + source.Value2; + } +} +``` + +Once we have our IValueResolver implementation, we'll need to tell AutoMapper to use this custom value resolver when resolving a specific destination member. We have several options in telling AutoMapper a custom value resolver to use, including: + +* MapFrom\ +* MapFrom(typeof(CustomValueResolver)) +* MapFrom(aValueResolverInstance) + +In the below example, we'll use the first option, telling AutoMapper the custom resolver type through generics: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForMember(dest => dest.Total, opt => opt.MapFrom())); +Mapper.AssertConfigurationIsValid(); + +var source = new Source + { + Value1 = 5, + Value2 = 7 + }; + +var result = Mapper.Map(source); + +result.Total.ShouldEqual(12); +``` + +Although the destination member (Total) did not have any matching source member, specifying a custom resolver made the configuration valid, as the resolver is now responsible for supplying a value for the destination member. + +If we don't care about the source/destination types in our value resolver, or want to reuse them across maps, we can just use "object" as the source/destination types: + +```c# +public class MultBy2Resolver : IValueResolver { + public int Resolve(object source, object dest, int destMember, ResolutionContext context) { + return destMember * 2; + } +} +``` + +### Custom constructor methods + +Because we only supplied the type of the custom resolver to AutoMapper, the mapping engine will use reflection to create an instance of the value resolver. + +If we don't want AutoMapper to use reflection to create the instance, we can supply it directly: + +```c# +Mapper.Initialize(cfg => cfg.CreateMap() + .ForMember(dest => dest.Total, + opt => opt.MapFrom(new CustomResolver()) + )); +``` + +AutoMapper will use that specific object, helpful in scenarios where the resolver might have constructor arguments or need to be constructed by an IoC container. + +### Customizing the source value supplied to the resolver + +By default, AutoMapper passes the source object to the resolver. This limits the reusability of resolvers, since the resolver is coupled to the source type. If, however, we supply a common resolver across multiple types, we configure AutoMapper to redirect the source value supplied to the resolver, and also use a different resolver interface so that our resolver can get use of the source/destination members: + +```c# +Mapper.Initialize(cfg => { +cfg.CreateMap() + .ForMember(dest => dest.Total, + opt => opt.MapFrom(src => src.SubTotal)); +cfg.CreateMap() + .ForMember(dest => dest.OtherTotal, + opt => opt.MapFrom(src => src.OtherSubTotal)); +}); + +public class CustomResolver : IMemberValueResolver { + public decimal Resolve(object source, object destination, decimal sourceMember, decimal destinationMember, ResolutionContext context) { +// logic here + } +} +``` + +### Passing in key-value to Mapper + +When calling map you can pass in extra objects by using key-value and using a custom resolver to get the object from context. + +```c# +Mapper.Map(src, opt => opt.Items["Foo"] = "Bar"); +``` + +This is how to setup the mapping for this custom resolver + +```c# +cfg.CreateMap() + .ForMember(dest => dest.Foo, opt => opt.MapFrom((src, dest, destMember, context) => context.Items["Foo"])); +``` + +### ForPath + +Similar to ForMember, from 6.1.0 there is ForPath. Check out [the tests](https://github.com/AutoMapper/AutoMapper/search?utf8=%E2%9C%93&q=ForPath&type=) for examples. + +### Resolvers and conditions + +For each property mapping, AutoMapper attempts to resolve the destination value **before** evaluating the condition. So it needs to be able to do that without throwing an exception even if the condition will prevent the resulting value from being used. + +As an example, here's sample output from [BuildExecutionPlan](Understanding-your-mapping.html) (displayed using [ReadableExpressions](https://marketplace.visualstudio.com/items?itemName=vs-publisher-1232914.ReadableExpressionsVisualizers)) for a single property: + +```c# +try +{ + var resolvedValue = + { + try + { + return // ... tries to resolve the destination value here + } + catch (NullReferenceException) + { + return null; + } + catch (ArgumentNullException) + { + return null; + } + }; + + if (condition.Invoke(src, typeMapDestination, resolvedValue)) + { + typeMapDestination.WorkStatus = resolvedValue; + } +} +catch (Exception ex) +{ + throw new AutoMapperMappingException( + "Error mapping types.", + ex, + AutoMapper.TypePair, + AutoMapper.TypeMap, + AutoMapper.PropertyMap); +}; +``` +The default generated code for resolving a property, if you haven't customized the mapping for that member, generally doesn't have any problems. But if you're using custom code to map the property that will crash if the condition isn't met, the mapping will fail despite the condition. + +This example code would fail: + +```c# +public class SourceClass +{ + public string Value { get; set; } +} + +public class TargetClass +{ + public int ValueLength { get; set; } +} + +// ... + +var source = new SourceClass { Value = null }; +var target = new TargetClass; + +CreateMap() + .ForMember(d => d.ValueLength, o => o.MapFrom(s => s.Value.Length)) + .ForAllMembers(o => o.Condition((src, dest, value) => value != null)); +``` +The condition prevents the Value property from being mapped onto the target, but the custom member mapping would fail before that point because it calls Value.Length, and Value is null. + +Prevent this by using a [PreCondition](Conditional-mapping.html#preconditions) instead or by ensuring the custom member mapping code can complete safely regardless of conditions: + +```c# + .ForMember(d => d.ValueLength, o => o.MapFrom(s => s != null ? s.Value.Length : 0)) +``` diff --git a/docs/Dependency-injection.md b/docs/Dependency-injection.md new file mode 100644 index 0000000000..c7d4de8cf3 --- /dev/null +++ b/docs/Dependency-injection.md @@ -0,0 +1,196 @@ +# Dependency Injection + +AutoMapper supports the ability to construct [Custom Value Resolvers](Custom-value-resolvers.html), [Custom Type Converters](Custom-type-converters.html), and [Value Converters](Value-converters.html) using static service location: + +```c# +Mapper.Initialize(cfg => +{ + cfg.ConstructServicesUsing(ObjectFactory.GetInstance); + + cfg.CreateMap(); +}); +``` + +Or dynamic service location, to be used in the case of instance-based containers (including child/nested containers): + +```c# +var mapper = new Mapper(Mapper.Configuration, childContainer.GetInstance); + +var dest = mapper.Map(new Source { Value = 15 }); +``` + +### Queryable Extensions + +Starting with 8.0 you can use IMapper.ProjectTo. For older versions you need to pass the configuration to the extension method ``` IQueryable.ProjectTo(IConfigurationProvider) ```. + +Note that IQueryable.ProjectTo is [more limited](Queryable-Extensions.html#supported-mapping-options) than IMapper.Map, as only what is allowed by the underlying LINQ provider is supported. That means you cannot use DI with value resolvers and converters as you can with Map. + +## Examples + +### ASP.NET Core + +There is a [NuGet package](https://www.nuget.org/packages/AutoMapper.Extensions.Microsoft.DependencyInjection/) to be used with the default injection mechanism described [here](https://github.com/AutoMapper/AutoMapper.Extensions.Microsoft.DependencyInjection/blob/master/README.md) and used in [this project](https://github.com/jbogard/ContosoUniversityCore/blob/master/src/ContosoUniversityCore/Startup.cs). + +Once the nuget package is downloaded, simply add AutoMapper to your IServiceCollection in your startup.cs class: +```c# +services.AddAutoMapper(assembly1, assembly2 /*, ...*/); +``` +or marker types: +```c# +services.AddAutoMapper(type1, type2 /*, ...*/); +``` +Now you can inject AutoMapper at runtime into your services/controllers: +```c# +public class EmployeesController { + private readonly IMapper _mapper; + + public EmployeesController(IMapper mapper) + => _mapper = mapper; + + // use _mapper.Map to map +} +``` + +### Ninject + +For those using Ninject here is an example of a Ninject module for AutoMapper + +```c# +public class AutoMapperModule : NinjectModule +{ + public override void Load() + { + Bind>().To(); + + var mapperConfiguration = CreateConfiguration(); + Bind().ToConstant(mapperConfiguration).InSingletonScope(); + + // This teaches Ninject how to create automapper instances say if for instance + // MyResolver has a constructor with a parameter that needs to be injected + Bind().ToMethod(ctx => + new Mapper(mapperConfiguration, type => ctx.Kernel.Get(type))); + } + + private MapperConfiguration CreateConfiguration() + { + var config = new MapperConfiguration(cfg => + { + // Add all profiles in current assembly + cfg.AddProfiles(GetType().Assembly); + }); + + return config; + } +} +``` + +### Simple Injector + +The workflow is as follows: + +1) Register your types via MyRegistrar.Register +2) The MapperProvider allows you to directly inject an instance of IMapper into your other classes +3) SomeProfile resolves a value using PropertyThatDependsOnIocValueResolver +4) PropertyThatDependsOnIocValueResolver has IService injected into it, which is then able to be used + +The ValueResolver has access to IService because we register our container via MapperConfigurationExpression.ConstructServicesUsing + +```c# +public class MyRegistrar +{ + public void Register(Container container) + { + // Injectable service + container.RegisterSingleton(); + + // Automapper + container.RegisterSingleton(() => GetMapper(container)); + } + + private AutoMapper.IMapper GetMapper(Container container) + { + var mp = container.GetInstance(); + return mp.GetMapper(); + } +} + +public class MapperProvider +{ + private readonly Container _container; + + public MapperProvider(Container container) + { + _container = container; + } + + public IMapper GetMapper() + { + var mce = new MapperConfigurationExpression(); + mce.ConstructServicesUsing(_container.GetInstance); + + mce.AddProfiles(typeof(SomeProfile).Assembly); + + var mc = new MapperConfiguration(mce); + mc.AssertConfigurationIsValid(); + + IMapper m = new Mapper(mc, t => _container.GetInstance(t)); + + return m; + } +} + +public class SomeProfile : Profile +{ + public SomeProfile() + { + var map = CreateMap(); + map.ForMember(d => d.PropertyThatDependsOnIoc, opt => opt.MapFrom()); + } +} + +public class PropertyThatDependsOnIocValueResolver : IValueResolver +{ + private readonly IService _service; + + public PropertyThatDependsOnIocValueResolver(IService service) + { + _service = service; + } + + int IValueResolver.Resolve(MySourceType source, object destination, int destMember, ResolutionContext context) + { + return _service.MyMethod(source); + } +} +``` + +### Castle Windsor + +For those using Castle Windsor here is an example of an installer for AutoMapper + +```c# +public class AutoMapperInstaller : IWindsorInstaller +{ + public void Install(IWindsorContainer container, IConfigurationStore store) + { + // Register all mapper profiles + container.Register( + Classes.FromAssemblyInThisApplication(GetType().Assembly) + .BasedOn().WithServiceBase()); + + // Register IConfigurationProvider with all registered profiles + container.Register(Component.For().UsingFactoryMethod(kernel => + { + return new MapperConfiguration(configuration => + { + kernel.ResolveAll().ToList().ForEach(configuration.AddProfile); + }); + }).LifestyleSingleton()); + + // Register IMapper with registered IConfigurationProvider + container.Register( + Component.For().UsingFactoryMethod(kernel => + new Mapper(kernel.Resolve(), kernel.Resolve))); + } +} +``` diff --git a/docs/Dynamic-and-ExpandoObject-Mapping.md b/docs/Dynamic-and-ExpandoObject-Mapping.md new file mode 100644 index 0000000000..24af891117 --- /dev/null +++ b/docs/Dynamic-and-ExpandoObject-Mapping.md @@ -0,0 +1,25 @@ +# Dynamic and ExpandoObject Mapping + +AutoMapper can map to/from dynamic objects without any explicit configuration: + +```c# +public class Foo { + public int Bar { get; set; } + public int Baz { get; set; } +} +dynamic foo = new MyDynamicObject(); +foo.Bar = 5; +foo.Baz = 6; + +Mapper.Initialize(cfg => {}); + +var result = Mapper.Map(foo); +result.Bar.ShouldEqual(5); +result.Baz.ShouldEqual(6); + +dynamic foo2 = Mapper.Map(result); +foo2.Bar.ShouldEqual(5); +foo2.Baz.ShouldEqual(6); +``` + +Similarly you can map straight from Dictionary to objects, AutoMapper will line up the keys with property names. diff --git a/docs/Expression-Translation-(UseAsDataSource).md b/docs/Expression-Translation-(UseAsDataSource).md new file mode 100644 index 0000000000..8544156fad --- /dev/null +++ b/docs/Expression-Translation-(UseAsDataSource).md @@ -0,0 +1,184 @@ +# Expression Translation (UseAsDataSource) + +Automapper supports translating Expressions from one object to another in a separate [package](https://www.nuget.org/packages/AutoMapper.Extensions.ExpressionMapping/). +This is done by substituting the properties from the source class to what they map to in the destination class. + +Given the example classes: + +```c# +public class OrderLine +{ + public int Id { get; set; } + public int OrderId { get; set; } + public Item Item { get; set; } + public decimal Quantity { get; set; } +} + +public class Item +{ + public int Id { get; set; } + public string Name { get; set; } +} + +public class OrderLineDTO +{ + public int Id { get; set; } + public int OrderId { get; set; } + public string Item { get; set; } + public decimal Quantity { get; set; } +} + +Mapper.Initialize(cfg => +{ + cfg.CreateMap() + .ForMember(dto => dto.Item, conf => conf.MapFrom(ol => ol.Item.Name)); + cfg.CreateMap() + .ForMember(ol => ol.Item, conf => conf.MapFrom(dto => dto)); + cfg.CreateMap() + .ForMember(i => i.Name, conf => conf.MapFrom(dto => dto.Item)); +}); +``` + +When mapping from DTO Expression + +```c# +Expression> dtoExpression = dto=> dto.Item.StartsWith("A"); +var expression = Mapper.Map>>(dtoExpression); +``` + +Expression will be translated to `ol => ol.Item.Name.StartsWith("A")` + +Automapper knows `dto.Item` is mapped to `ol.Item.Name` so it substituted it for the expression. + +Expression translation can work on expressions of collections as well. + +```c# +Expression,IQueryable>> dtoExpression = dtos => dtos.Where(dto => dto.Quantity > 5).OrderBy(dto => dto.Quantity); +var expression = Mapper.Map,IQueryable>>(dtoExpression); +``` + +Resulting in `ols => ols.Where(ol => ol.Quantity > 5).OrderBy(ol => ol.Quantity)` + +### Mapping Flattened Properties to Navigation Properties + +AutoMapper also supports mapping flattened (TModel or DTO) properties in expressions to their corresponding (TData) navigation properties (when the navigation property has been removed from the view model or DTO) e.g. CourseModel.DepartmentName from the model expression becomes Course.Department in the data expression. + +Take the following set of classes: + +```c# +public class CourseModel +{ + public int CourseID { get; set; } + + public int DepartmentID { get; set; } + public string DepartmentName { get; set; } +} +public class Course +{ + public int CourseID { get; set; } + + public int DepartmentID { get; set; } + public Department Department { get; set; } +} + +public class Department +{ + public int DepartmentID { get; set; } + public string Name { get; set; } +} +``` + +Then map exp below to expMapped. + +```c# +Expression, IIncludableQueryable>> exp = i => i.Include(s => s.DepartmentName); +Expression, IIncludableQueryable>> expMapped = mapper.MapExpressionAsInclude, IIncludableQueryable>>>(exp); +``` + +The resulting mapped expression (expMapped.ToString()) is then ``` i => i.Include(s => s.Department); ``` . This feature allows navigation properties for the query to be defined based on the view model alone. + +### Supported Mapping options + +Much like how Queryable Extensions can only support certain things that the LINQ providers support, expression translation follows the same rules as what it can and can't support. + +## UseAsDataSource + +Mapping expressions to one another is a tedious and produces long ugly code. + +`UseAsDataSource().For()` makes this translation clean by not having to explicitly map expressions. +It also calls `ProjectTo()` for you as well, where applicable. + +Using EntityFramework as an example + +`dataContext.OrderLines.UseAsDataSource().For().Where(dto => dto.Name.StartsWith("A"))` + +Does the equivalent of + +`dataContext.OrderLines.Where(ol => ol.Item.Name.StartsWith("A")).ProjectTo()` + +### When ProjectTo() is not called + +Expression Translation works for all kinds of functions, including `Select` calls. If `Select` is used after `UseAsDataSource()` and changes return type, then `ProjectTo<>()` won't be called and value with be returned instead using `Mapper.Map`. + +Example: + +`dataContext.OrderLines.UseAsDataSource().For().Select(dto => dto.Name)` + +Does the equivalent of + +`dataContext.OrderLines.Select(ol => ol.Item.Name)` + +### Register a callback, for when an UseAsDataSource() query is enumerated + +Sometimes, you may want to edit the collection, that is returned from a mapped query before forwarding it to the next application layer. +With `.ProjectTo` this is quite simple, as there is no sense in directly returning the resulting `IQueryable` because you cannot edit it anymore anyways. So you will most likely do this: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForMember(dto => dto.Item, conf => conf.MapFrom(ol => ol.Item.Name))); + +public List GetLinesForOrder(int orderId) +{ + using (var context = new orderEntities()) + { + var dtos = context.OrderLines.Where(ol => ol.OrderId == orderId) + .ProjectTo().ToList(); + foreach(var dto in dtos) + { + // edit some property, or load additional data from the database and augment the dtos + } + return dtos; + } +} +``` + +However, if you did this with the `.UseAsDataSource()` approach, you would loose all its power - namely its ability to modify the internal expression until it is enumerated. +To solve that problem, we introduced the `.OnEnumerated` callback. +Using it, you can do the following: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForMember(dto => dto.Item, conf => conf.MapFrom(ol => ol.Item.Name))); + +public IQueryable GetLinesForOrder(int orderId) +{ + using (var context = new orderEntities()) + { + return context.OrderLines.Where(ol => ol.OrderId == orderId) + .UseAsDataSource() + .For() + .OnEnumerated((dtos) => + { + foreach(var dto in dtosCast()) + { + // edit some property, or load additional data from the database and augment the dtos + } + } + } +} +``` + +this `OnEnumerated(IEnumerable)`callback is executed, when the `IQueryable` itself is enumerated. +So this also works with the OData samples mentioned above: The OData $filter and $orderby expressions are still converted into SQL, and the `OnEnumerated()`callback is provided with the filtered, ordered resultset from the database. diff --git a/docs/Flattening.md b/docs/Flattening.md new file mode 100644 index 0000000000..657261b3e5 --- /dev/null +++ b/docs/Flattening.md @@ -0,0 +1,153 @@ +# Flattening + +One of the common usages of object-object mapping is to take a complex object model and flatten it to a simpler model. You can take a complex model such as: + +```c# +public class Order +{ + private readonly IList _orderLineItems = new List(); + + public Customer Customer { get; set; } + + public OrderLineItem[] GetOrderLineItems() + { + return _orderLineItems.ToArray(); + } + + public void AddOrderLineItem(Product product, int quantity) + { + _orderLineItems.Add(new OrderLineItem(product, quantity)); + } + + public decimal GetTotal() + { + return _orderLineItems.Sum(li => li.GetTotal()); + } +} + +public class Product +{ + public decimal Price { get; set; } + public string Name { get; set; } +} + +public class OrderLineItem +{ + public OrderLineItem(Product product, int quantity) + { + Product = product; + Quantity = quantity; + } + + public Product Product { get; private set; } + public int Quantity { get; private set;} + + public decimal GetTotal() + { + return Quantity*Product.Price; + } +} + +public class Customer +{ + public string Name { get; set; } +} +``` + +We want to flatten this complex Order object into a simpler OrderDto that contains only the data needed for a certain scenario: + +```c# +public class OrderDto +{ + public string CustomerName { get; set; } + public decimal Total { get; set; } +} +``` + +When you configure a source/destination type pair in AutoMapper, the configurator attempts to match properties and methods on the source type to properties on the destination type. If for any property on the destination type a property, method, or a method prefixed with "Get" does not exist on the source type, AutoMapper splits the destination member name into individual words (by PascalCase conventions). + +```c# +// Complex model + +var customer = new Customer + { + Name = "George Costanza" + }; +var order = new Order + { + Customer = customer + }; +var bosco = new Product + { + Name = "Bosco", + Price = 4.99m + }; +order.AddOrderLineItem(bosco, 15); + +// Configure AutoMapper + +Mapper.Initialize(cfg => cfg.CreateMap()); + +// Perform mapping + +OrderDto dto = Mapper.Map(order); + +dto.CustomerName.ShouldEqual("George Costanza"); +dto.Total.ShouldEqual(74.85m); +``` + +We configured the type map in AutoMapper with the CreateMap method. AutoMapper can only map type pairs it knows about, so we have explicitly register the source/destination type pair with CreateMap. To perform the mapping, we use the Map method. + +On the OrderDto type, the Total property matched to the GetTotal() method on Order. The CustomerName property matched to the Customer.Name property on Order. As long as we name our destination properties appropriately, we do not need to configure individual property matching. + +## IncludeMembers + +If you need more control when flattening, you can use IncludeMembers. You can map members of a child object to the destination object when you already have a map from the child type to the destination type (unlike the classic flattening that doesn't require a map for the child type). + +```c# +class Source +{ + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } +} +class InnerSource +{ + public string Name { get; set; } + public string Description { get; set; } +} +class OtherInnerSource +{ + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } +} +class Destination +{ + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } +} + +cfg.CreateMap().IncludeMembers(s=>s.InnerSource, s=>s.OtherInnerSource); +cfg.CreateMap(MemberList.None); +cfg.CreateMap(MemberList.None); + +var source = new Source { Name = "name", InnerSource = new InnerSource{ Description = "description" }, + OtherInnerSource = new OtherInnerSource{ Title = "title" } }; +var destination = mapper.Map(source); +destination.Name.ShouldBe("name"); +destination.Description.ShouldBe("description"); +destination.Title.ShouldBe("title"); +``` +So this allows you to reuse the configuration in the existing maps for the child types `InnerSource` and `OtherInnerSource` when mapping the parent types `Source` and `Destination`. It works in a similar way to [mapping inheritance](Mapping-inheritance.html), but it uses composition, not inheritance. + +The order of the parameters in the `IncludeMembers` call is relevant. When mapping a destination member, the first match wins, starting with the source object itself and then with the included child objects in the order you specified. So in the example above, `Name` is mapped from the source object itself and `Description` from `InnerSource` because it's the first match. + +IncludeMembers integrates with `ReverseMap`. An included member will be reversed to +```c# +ForMember(destination => destination.IncludedMember, member => member.MapFrom(source => source)) +``` +and the other way around. If that's not what you want, you can avoid `ReverseMap` (explicitly create the reverse map) or you can override the default settings (using `Ignore` or `IncludeMembers` without parameters respectively). + +For details, check [the tests](https://github.com/AutoMapper/AutoMapper/blob/master/src/UnitTests/IMappingExpression/IncludeMembers.cs). diff --git a/docs/Getting-started.md b/docs/Getting-started.md new file mode 100644 index 0000000000..d82df4cc06 --- /dev/null +++ b/docs/Getting-started.md @@ -0,0 +1,63 @@ +# Getting Started Guide + +## What is AutoMapper? + +AutoMapper is an object-object mapper. Object-object mapping works by transforming an input object of one type into an output object of a different type. What makes AutoMapper interesting is that it provides some interesting conventions to take the dirty work out of figuring out how to map type A to type B. As long as type B follows AutoMapper's established convention, almost zero configuration is needed to map two types. + +## Why use AutoMapper? + +Mapping code is boring. Testing mapping code is even more boring. AutoMapper provides simple configuration of types, as well as simple testing of mappings. The real question may be "why use object-object mapping?" Mapping can occur in many places in an application, but mostly in the boundaries between layers, such as between the UI/Domain layers, or Service/Domain layers. Concerns of one layer often conflict with concerns in another, so object-object mapping leads to segregated models, where concerns for each layer can affect only types in that layer. + +## How do I use AutoMapper? + +First, you need both a source and destination type to work with. The destination type's design can be influenced by the layer in which it lives, but AutoMapper works best as long as the names of the members match up to the source type's members. If you have a source member called "FirstName", this will automatically be mapped to a destination member with the name "FirstName". AutoMapper also supports [Flattening](Flattening.html). + +AutoMapper will ignore null reference exceptions when mapping your source to your target. This is by design. If you don't like this approach, you can combine AutoMapper's approach with [custom value resolvers](Custom-value-resolvers.html) if needed. + +Once you have your types you can create a map for the two types using a `MapperConfiguration` or the static `Mapper` instance and CreateMap. You only need one `MapperConfiguration` instance typically per AppDomain and should be instantiated during startup. Alternatively, you can just use `Mapper.Initialize` (more examples of initial setup see in [Static-and-Instance-API](Static-and-Instance-API.html). + +```c# +Mapper.Initialize(cfg => cfg.CreateMap()); +//or +var config = new MapperConfiguration(cfg => cfg.CreateMap()); +``` + +The type on the left is the source type, and the type on the right is the destination type. To perform a mapping, use the static or instance Mapper methods, depending on [static or instance initialization](Static-and-Instance-API.html): + +```c# +var mapper = config.CreateMapper(); +// or +var mapper = new Mapper(config); +OrderDto dto = mapper.Map(order); +// or +OrderDto dto = Mapper.Map(order); +``` + +Most applications can use dependency injection to inject the created `IMapper` instance. + +AutoMapper also has non-generic versions of these methods, for those cases where you might not know the type at compile time. + +## Where do I configure AutoMapper? + +If you're using the static Mapper method, configuration should only happen once per AppDomain. That means the best place to put the configuration code is in application startup, such as the Global.asax file for ASP.NET applications. Typically, the configuration bootstrapper class is in its own class, and this bootstrapper class is called from the startup method. The bootstrapper class should call Mapper.Initialize to configure the type maps. + +For ASP.NET Core the [Dependency Injection](Dependency-injection.html#asp-net-core) article shows how to configure AutoMapper in your application. + +## How do I test my mappings? + +To test your mappings, you need to create a test that does two things: + +* Call your bootstrapper class to create all the mappings +* Call MapperConfiguration.AssertConfigurationIsValid + +Here's an example: + +```c# +var config = AutoMapperConfiguration.Configure(); + +config.AssertConfigurationIsValid(); +``` + +## Can I see a demo? + +Check out the [dnrTV episode on AutoMapper](http://www.dnrtv.com/default.aspx?showNum=155). diff --git a/docs/Inline-Mapping.md b/docs/Inline-Mapping.md new file mode 100644 index 0000000000..528a31f565 --- /dev/null +++ b/docs/Inline-Mapping.md @@ -0,0 +1,66 @@ +# Inline Mapping + +AutoMapper creates type maps on the fly (new in 6.2.0). When you call `Mapper.Map` for the first time, AutoMapper will create the type map configuration and compile the mapping plan. Subsequent mapping calls will use the compiled map. + +## Inline configuration + +To configure an inline map, use the mapping options: + +```c# +var source = new Source(); + +var dest = Mapper.Map(source, opt => opt.ConfigureMap().ForMember(dest => dest.Value, m => m.MapFrom(src => src.Value + 10))); +``` + +You can use local functions to make the configuration a little easier to read: + +```c# +var source = new Source(); + +void ConfigureMap(IMappingOperationOptions opt) { + opt.ConfigureMap() + .ForMember(dest => dest.Value, m => m.MapFrom(src => src.Value + 10)) +}; + +var dest = Mapper.Map(source, ConfigureMap); +``` + +You can use closures in this inline map as well to capture and use runtime values in your configuration: + +```c# +int valueToAdd = 10; +var source = new Source(); + +void ConfigureMap(IMappingOperationOptions opt) { + opt.ConfigureMap() + .ForMember(dest => dest.Value, m => m.MapFrom(src => src.Value + valueToAdd)) +}; + +var dest = Mapper.Map(source, ConfigureMap); +``` + +## Inline validation + +The first time the map is used, AutoMapper validates the map using the default validation configuration (destination members must all be mapped). Subsequent map calls skip mapping validation. This ensures you can safely map your objects. + +You can configure the member list used to validate, to validate the source, destination, or no members to validate per map: + +```c# +var source = new Source(); + +var dest = Mapper.Map(source, opt => opt.ConfigureMap(MemberList.None); +``` + +You can also turn off inline map validation altogether (not recommended unless you're explicitly testing all of your maps): + +```c# +Mapper.Initialize(cfg => cfg.ValidateInlineMaps = false); +``` + +## Disabling inline maps + +To turn off inline mapping: + +```c# +Mapper.Initialize(cfg => cfg.CreateMissingTypeMaps = false); +``` diff --git a/docs/Lists-and-arrays.md b/docs/Lists-and-arrays.md new file mode 100644 index 0000000000..cddc22a9b1 --- /dev/null +++ b/docs/Lists-and-arrays.md @@ -0,0 +1,111 @@ +# Lists and Arrays + +AutoMapper only requires configuration of element types, not of any array or list type that might be used. For example, we might have a simple source and destination type: + +```c# +public class Source +{ + public int Value { get; set; } +} + +public class Destination +{ + public int Value { get; set; } +} +``` + +All the basic generic collection types are supported: + +```c# +Mapper.Initialize(cfg => cfg.CreateMap()); + +var sources = new[] + { + new Source { Value = 5 }, + new Source { Value = 6 }, + new Source { Value = 7 } + }; + +IEnumerable ienumerableDest = Mapper.Map>(sources); +ICollection icollectionDest = Mapper.Map>(sources); +IList ilistDest = Mapper.Map>(sources); +List listDest = Mapper.Map>(sources); +Destination[] arrayDest = Mapper.Map(sources); +``` + +To be specific, the source collection types supported include: + +* IEnumerable +* IEnumerable\ +* ICollection +* ICollection\ +* IList +* IList\ +* List\ +* Arrays + +For the non-generic enumerable types, only unmapped, assignable types are supported, as AutoMapper will be unable to "guess" what types you're trying to map. As shown in the example above, it's not necessary to explicitly configure list types, only their member types. + +When mapping to an existing collection, the destination collection is cleared first. If this is not what you want, take a look at [AutoMapper.Collection](https://github.com/AutoMapper/AutoMapper.Collection). + +## Handling null collections + +When mapping a collection property, if the source value is null AutoMapper will map the destination field to an empty collection rather than setting the destination value to null. This aligns with the behavior of Entity Framework and Framework Design Guidelines that believe C# references, arrays, lists, collections, dictionaries and IEnumerables should NEVER be null, ever. + +This behavior can be changed by setting the `AllowNullCollections` property to true when configuring the mapper. + +```c# +Mapper.Initialize(cfg => { + cfg.AllowNullCollections = true; + cfg.CreateMap(); +}); +``` + +## Polymorphic element types in collections + +Many times, we might have a hierarchy of types in both our source and destination types. AutoMapper supports polymorphic arrays and collections, such that derived source/destination types are used if found. + +```c# +public class ParentSource +{ + public int Value1 { get; set; } +} + +public class ChildSource : ParentSource +{ + public int Value2 { get; set; } +} + +public class ParentDestination +{ + public int Value1 { get; set; } +} + +public class ChildDestination : ParentDestination +{ + public int Value2 { get; set; } +} +``` + +AutoMapper still requires explicit configuration for child mappings, as AutoMapper cannot "guess" which specific child destination mapping to use. Here is an example of the above types: + +```c# +Mapper.Initialize(c=> { + c.CreateMap() + .Include(); + c.CreateMap(); +}); + +var sources = new[] + { + new ParentSource(), + new ChildSource(), + new ParentSource() + }; + +var destinations = Mapper.Map(sources); + +destinations[0].ShouldBeInstanceOf(); +destinations[1].ShouldBeInstanceOf(); +destinations[2].ShouldBeInstanceOf(); +``` diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000..2f136bfb63 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = python -msphinx +SPHINXPROJ = AutoMapper +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/Mapping-inheritance.md b/docs/Mapping-inheritance.md new file mode 100644 index 0000000000..3e3eee9add --- /dev/null +++ b/docs/Mapping-inheritance.md @@ -0,0 +1,145 @@ +# Mapping Inheritance + +Mapping inheritance serves two functions: + +- Inheriting mapping configuration from a base class or interface configuration +- Runtime polymorphic mapping + +Inheriting base class configuration is opt-in, and you can either explicitly specify the mapping to inherit from the base type configuration with `Include` or in the derived type configuration with `IncludeBase`: + +```c# +CreateMap() + .Include() + .ForMember(dest => dest.SomeMember, opt => opt.MapFrom(src => src.OtherMember)); + +CreateMap(); +``` + +or + +```c# +CreateMap() + .ForMember(dest => dest.SomeMember, opt => opt.MapFrom(src => src.OtherMember)); + +CreateMap() + .IncludeBase(); +``` + +In each case above, the derived mapping inherits the custom mapping configuration from the base mapping configuration. + +To include all derived maps, from the base type map configuration: + +```c# +CreateMap() + .IncludeAllDerived(); + +CreateMap(); +``` + +### Runtime polymorphism + +Take: + +```c# +public class Order { } +public class OnlineOrder : Order { } +public class MailOrder : Order { } + +public class OrderDto { } +public class OnlineOrderDto : OrderDto { } +public class MailOrderDto : OrderDto { } + +Mapper.Initialize(cfg => { + cfg.CreateMap() + .Include() + .Include(); + cfg.CreateMap(); + cfg.CreateMap(); +}); + +// Perform Mapping +var order = new OnlineOrder(); +var mapped = Mapper.Map(order, order.GetType(), typeof(OrderDto)); +Assert.IsType(mapped); +``` + +You will notice that because the mapped object is a OnlineOrder, AutoMapper has seen you have a more specific mapping for OnlineOrder than OrderDto, and automatically chosen that. + +## Specifying inheritance in derived classes + +Instead of configuring inheritance from the base class, you can specify inheritance from the derived classes: + +```c# +Mapper.Initialize(cfg => { + cfg.CreateMap() + .ForMember(o => o.Id, m => m.MapFrom(s => s.OrderId)); + cfg.CreateMap() + .IncludeBase(); + cfg.CreateMap() + .IncludeBase(); +}); +``` + +## As + +For simple cases, you can use `As` to redirect a base map to an existing derived map: + +```c# + cfg.CreateMap(); + cfg.CreateMap().As(); + + mapper.Map(new Order()).ShouldBeOfType(); +``` + +## Inheritance Mapping Priorities + +This introduces additional complexity because there are multiple ways a property can be mapped. The priority of these sources are as follows + + - Explicit Mapping (using .MapFrom()) + - Inherited Explicit Mapping + - Ignore Property Mapping + - Convention Mapping (Properties that are matched via convention) + +To demonstrate this, lets modify our classes shown above + +```c# +//Domain Objects +public class Order { } +public class OnlineOrder : Order +{ + public string Referrer { get; set; } +} +public class MailOrder : Order { } + +//Dtos +public class OrderDto +{ + public string Referrer { get; set; } +} + +//Mappings +Mapper.Initialize(cfg => { + cfg.CreateMap() + .Include() + .Include() + .ForMember(o=>o.Referrer, m=>m.Ignore()); + cfg.CreateMap(); + cfg.CreateMap(); +}); + +// Perform Mapping +var order = new OnlineOrder { Referrer = "google" }; +var mapped = Mapper.Map(order, order.GetType(), typeof(OrderDto)); +Assert.IsNull(mapped.Referrer); +``` + +Notice that in our mapping configuration, we have ignored `Referrer` (because it doesn't exist in the order base class) and that has a higher priority than convention mapping, so the property doesn't get mapped. + +If you do want the `Referrer` property to be mapped in the mapping from `OnlineOrder` to `OrderDto` you should include an explicit mapping in the mapping like this: + +``` + cfg.CreateMap() + .ForMember(o=>o.Referrer, m=>m.MapFrom(x=>x.Referrer)); +``` + +Overall this feature should make using AutoMapper with classes that leverage inheritance feel more natural. diff --git a/docs/Nested-mappings.md b/docs/Nested-mappings.md new file mode 100644 index 0000000000..237d2cba44 --- /dev/null +++ b/docs/Nested-mappings.md @@ -0,0 +1,60 @@ +# Nested Mappings + +As the mapping engine executes the mapping, it can use one of a variety of methods to resolve a destination member value. One of these methods is to use another type map, where the source member type and destination member type are also configured in the mapping configuration. This allows us to not only flatten our source types, but create complex destination types as well. For example, our source type might contain another complex type: + +```c# +public class OuterSource +{ + public int Value { get; set; } + public InnerSource Inner { get; set; } +} + +public class InnerSource +{ + public int OtherValue { get; set; } +} +``` + +We _could_ simply flatten the OuterSource.Inner.OtherValue to one InnerOtherValue property, but we might also want to create a corresponding complex type for the Inner property: + +```c# +public class OuterDest +{ + public int Value { get; set; } + public InnerDest Inner { get; set; } +} + +public class InnerDest +{ + public int OtherValue { get; set; } +} +``` + +In that case, we would need to configure the additional source/destination type mappings: + +```c# +var config = new MapperConfiguration(cfg => { + cfg.CreateMap(); + cfg.CreateMap(); +}); +config.AssertConfigurationIsValid(); + +var source = new OuterSource + { + Value = 5, + Inner = new InnerSource {OtherValue = 15} + }; +var mapper = config.CreateMapper(); +var dest = mapper.Map(source); + +dest.Value.ShouldEqual(5); +dest.Inner.ShouldNotBeNull(); +dest.Inner.OtherValue.ShouldEqual(15); +``` + +A few things to note here: + +* Order of configuring types does not matter +* Call to Map does not need to specify any inner type mappings, only the type map to use for the source value passed in + +With both flattening and nested mappings, we can create a variety of destination shapes to suit whatever our needs may be. diff --git a/docs/Null-substitution.md b/docs/Null-substitution.md new file mode 100644 index 0000000000..9ae3f481d7 --- /dev/null +++ b/docs/Null-substitution.md @@ -0,0 +1,22 @@ +# Null Substitution + +Null substitution allows you to supply an alternate value for a destination member if the source value is null anywhere along the member chain. This means that instead of mapping from null, it will map from the value you supply. + +```c# +var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(destination => destination.Value, opt => opt.NullSubstitute("Other Value"))); + +var source = new Source { Value = null }; +var mapper = config.CreateMapper(); +var dest = mapper.Map(source); + +dest.Value.ShouldEqual("Other Value"); + +source.Value = "Not null"; + +dest = mapper.Map(source); + +dest.Value.ShouldEqual("Not null"); +``` + +The substitute is assumed to be of the source member type, and will go through any mapping/conversion after to the destination type. diff --git a/docs/Open-Generics.md b/docs/Open-Generics.md new file mode 100644 index 0000000000..f41ca9ef82 --- /dev/null +++ b/docs/Open-Generics.md @@ -0,0 +1,45 @@ +# Open Generics + +AutoMapper can support an open generic type map. Create a map for the open generic types: + +```c# +public class Source { + public T Value { get; set; } +} + +public class Destination { + public T Value { get; set; } +} + +// Create the mapping +Mapper.Initialize(cfg => cfg.CreateMap(typeof(Source<>), typeof(Destination<>))); +``` + +You don't need to create maps for closed generic types. AutoMapper will apply any configuration from the open generic mapping to the closed mapping at runtime: + +```c# +var source = new Source { Value = 10 }; + +var dest = mapper.Map, Destination>(source); + +dest.Value.ShouldEqual(10); +``` + +Because C# only allows closed generic type parameters, you have to use the System.Type version of CreateMap to create your open generic type maps. From there, you can use all of the mapping configuration available and the open generic configuration will be applied to the closed type map at runtime. +AutoMapper will skip open generic type maps during configuration validation, since you can still create closed types that don't convert, such as `Source -> Destination` where there is no conversion from Foo to Bar. + +You can also create an open generic type converter: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap(typeof(Source<>), typeof(Destination<>)).ConvertUsing(typeof(Converter<>))); +``` + +AutoMapper also supports open generic type converters with any number of generic arguments: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap(typeof(Source<>), typeof(Destination<>)).ConvertUsing(typeof(Converter<,>))); +``` + +The closed type from `Source` will be the first generic argument, and the closed type of `Destination` will be the second argument to close `Converter<,>`. diff --git a/docs/Projection.md b/docs/Projection.md new file mode 100644 index 0000000000..edda58116a --- /dev/null +++ b/docs/Projection.md @@ -0,0 +1,50 @@ +# Projection + +Projection transforms a source to a destination beyond flattening the object model. Without extra configuration, AutoMapper requires a flattened destination to match the source type's naming structure. When you want to project source values into a destination that does not exactly match the source structure, you must specify custom member mapping definitions. For example, we might want to turn this source structure: +```c# +public class CalendarEvent +{ + public DateTime Date { get; set; } + public string Title { get; set; } +} +``` + +Into something that works better for an input form on a web page: + +```c# +public class CalendarEventForm +{ + public DateTime EventDate { get; set; } + public int EventHour { get; set; } + public int EventMinute { get; set; } + public string Title { get; set; } +} +``` + +Because the names of the destination properties do not exactly match the source property (`CalendarEvent.Date` would need to be `CalendarEventForm.EventDate`), we need to specify custom member mappings in our type map configuration: + +```c# +// Model +var calendarEvent = new CalendarEvent +{ + Date = new DateTime(2008, 12, 15, 20, 30, 0), + Title = "Company Holiday Party" +}; + +// Configure AutoMapper +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForMember(dest => dest.EventDate, opt => opt.MapFrom(src => src.Date.Date)) + .ForMember(dest => dest.EventHour, opt => opt.MapFrom(src => src.Date.Hour)) + .ForMember(dest => dest.EventMinute, opt => opt.MapFrom(src => src.Date.Minute))); + +// Perform mapping +CalendarEventForm form = Mapper.Map(calendarEvent); + +form.EventDate.ShouldEqual(new DateTime(2008, 12, 15)); +form.EventHour.ShouldEqual(20); +form.EventMinute.ShouldEqual(30); +form.Title.ShouldEqual("Company Holiday Party"); +``` + +Each custom member configuration uses an action delegate to configure each individual member. In the above example, we used the `MapFrom` option to perform custom source-to-destination member mappings. The `MapFrom` method takes a lambda expression as a parameter, which is then evaluated later during mapping. The `MapFrom` expression can be any `Func` lambda expression. diff --git a/docs/Queryable-Extensions.md b/docs/Queryable-Extensions.md new file mode 100644 index 0000000000..ec0125e043 --- /dev/null +++ b/docs/Queryable-Extensions.md @@ -0,0 +1,221 @@ +# Queryable Extensions + +When using an ORM such as NHibernate or Entity Framework with AutoMapper's standard `Mapper.Map` functions, you may notice that the ORM will query all the fields of all the objects within a graph when AutoMapper is attempting to map the results to a destination type. + +If your ORM exposes `IQueryable`s, you can use AutoMapper's QueryableExtensions helper methods to address this key pain. + +Using Entity Framework for an example, say that you have an entity `OrderLine` with a relationship with an entity `Item`. If you want to map this to an `OrderLineDTO` with the `Item`'s `Name` property, the standard `Mapper.Map` call will result in Entity Framework querying the entire `OrderLine` and `Item` table. + +Use this approach instead. + +Given the following entities: + +```c# +public class OrderLine +{ + public int Id { get; set; } + public int OrderId { get; set; } + public Item Item { get; set; } + public decimal Quantity { get; set; } +} + +public class Item +{ + public int Id { get; set; } + public string Name { get; set; } +} +``` + +And the following DTO: + +```c# +public class OrderLineDTO +{ + public int Id { get; set; } + public int OrderId { get; set; } + public string Item { get; set; } + public decimal Quantity { get; set; } +} +``` + +You can use the Queryable Extensions like so: + +```c# +Mapper.Initialize(cfg => + cfg.CreateMap() + .ForMember(dto => dto.Item, conf => conf.MapFrom(ol => ol.Item.Name))); + +public List GetLinesForOrder(int orderId) +{ + using (var context = new orderEntities()) + { + return context.OrderLines.Where(ol => ol.OrderId == orderId) + .ProjectTo().ToList(); + } +} +``` + +The `.ProjectTo()` will tell AutoMapper's mapping engine to emit a `select` clause to the IQueryable that will inform entity framework that it only needs to query the Name column of the Item table, same as if you manually projected your `IQueryable` to an `OrderLineDTO` with a `Select` clause. + +Note that for this feature to work, all type conversions must be explicitly handled in your Mapping. For example, you can not rely on the `ToString()` override of the `Item` class to inform entity framework to only select from the `Name` column, and any data type changes, such as `Double` to `Decimal` must be explicitly handled as well. + +### The instance API + +Starting with 8.0 there are similar ProjectTo methods on IMapper that feel more natural when you use IMapper with DI. + +### Preventing lazy loading/SELECT N+1 problems + +Because the LINQ projection built by AutoMapper is translated directly to a SQL query by the query provider, the mapping occurs at the SQL/ADO.NET level, and not touching your entities. All data is eagerly fetched and loaded into your DTOs. + +Nested collections use a Select to project child DTOs: + +```c# +from i in db.Instructors +orderby i.LastName +select new InstructorIndexData.InstructorModel +{ + ID = i.ID, + FirstMidName = i.FirstMidName, + LastName = i.LastName, + HireDate = i.HireDate, + OfficeAssignmentLocation = i.OfficeAssignment.Location, + Courses = i.Courses.Select(c => new InstructorIndexData.InstructorCourseModel + { + CourseID = c.CourseID, + CourseTitle = c.Title + }).ToList() +}; +``` + +This map through AutoMapper will result in a SELECT N+1 problem, as each child `Course` will be queried one at a time, unless specified through your ORM to eagerly fetch. With LINQ projection, no special configuration or specification is needed with your ORM. The ORM uses the LINQ projection to build the exact SQL query needed. + +### Custom projection + +In the case where members names don't line up, or you want to create calculated property, you can use MapFrom (the expression-based overload) to supply a custom expression for a destination member: + +```c# +Mapper.Initialize(cfg => cfg.CreateMap() + .ForMember(d => d.FullName, opt => opt.MapFrom(c => c.FirstName + " " + c.LastName)) + .ForMember(d => d.TotalContacts, opt => opt.MapFrom(c => c.Contacts.Count())); +``` + +AutoMapper passes the supplied expression with the built projection. As long as your query provider can interpret the supplied expression, everything will be passed down all the way to the database. + +If the expression is rejected from your query provider (Entity Framework, NHibernate, etc.), you might need to tweak your expression until you find one that is accepted. + +### Custom Type Conversion + +Occasionally, you need to completely replace a type conversion from a source to a destination type. In normal runtime mapping, this is accomplished via the ConvertUsing method. To perform the analog in LINQ projection, use the ConvertUsing method: + +```c# +cfg.CreateMap().ConvertUsing(src => new Dest { Value = 10 }); +``` + +The expression-based `ConvertUsing` is slightly more limited than Func-based `ConvertUsing` overloads as only what is allowed in an Expression and the underlying LINQ provider will work. + +### Custom destination type constructors + +If your destination type has a custom constructor but you don't want to override the entire mapping, use the ConstructUsing expression-based method overload: + +```c# +cfg.CreateMap() + .ConstructUsing(src => new Dest(src.Value + 10)); +``` + +AutoMapper will automatically match up destination constructor parameters to source members based on matching names, so only use this method if AutoMapper can't match up the destination constructor properly, or if you need extra customization during construction. + +### String conversion + +AutoMapper will automatically add `ToString()` when the destination member type is a string and the source member type is not. + +```c# +public class Order { + public OrderTypeEnum OrderType { get; set; } +} +public class OrderDto { + public string OrderType { get; set; } +} +var orders = dbContext.Orders.ProjectTo().ToList(); +orders[0].OrderType.ShouldEqual("Online"); +``` + +### Explicit expansion + +In some scenarios, such as OData, a generic DTO is returned through an IQueryable controller action. Without explicit instructions, AutoMapper will expand all members in the result. To control which members are expanded during projection, set ExplicitExpansion in the configuration and then pass in the members you want to explicitly expand: + +```c# +dbContext.Orders.ProjectTo( + dest => dest.Customer, + dest => dest.LineItems); +// or string-based +dbContext.Orders.ProjectTo( + null, + "Customer", + "LineItems"); +// for collections +dbContext.Orders.ProjectTo( + null, + dest => dest.LineItems.Select(item => item.Product)); +``` +For more information, see [the tests](https://github.com/AutoMapper/AutoMapper/search?p=1&q=ExplicitExpansion&utf8=%E2%9C%93). + +### Aggregations + +LINQ can support aggregate queries, and AutoMapper supports LINQ extension methods. In the custom projection example, if we renamed the `TotalContacts` property to `ContactsCount`, AutoMapper would match to the `Count()` extension method and the LINQ provider would translate the count into a correlated subquery to aggregate child records. + +AutoMapper can also support complex aggregations and nested restrictions, if the LINQ provider supports it: + +```c# +cfg.CreateMap() + .ForMember(m => m.EnrollmentsStartingWithA, + opt => opt.MapFrom(c => c.Enrollments.Where(e => e.Student.LastName.StartsWith("A")).Count())); +``` + +This query returns the total number of students, for each course, whose last name starts with the letter 'A'. + +### Parameterization + +Occasionally, projections need runtime parameters for their values. Consider a projection that needs to pull in the current username as part of its data. Instead of using post-mapping code, we can parameterize our MapFrom configuration: + +```c# +string currentUserName = null; +cfg.CreateMap() + .ForMember(m => m.CurrentUserName, opt => opt.MapFrom(src => currentUserName)); +``` + +When we project, we'll substitute our parameter at runtime: + +```c# +dbContext.Courses.ProjectTo(Config, new { currentUserName = Request.User.Name }); +``` + +This works by capturing the name of the closure's field name in the original expression, then using an anonymous object/dictionary to apply the value to the parameter value before the query is sent to the query provider. + +You may also use a dictionary to build the projection values: + +```c# +dbContext.Courses.ProjectTo(Config, new Dictionary { {"currentUserName", Request.User.Name} }); +``` + +However, using a dictionary will result in hard-coded values in the query instead of a parameterized query, so use with caution. + +### Supported mapping options + +Not all mapping options can be supported, as the expression generated must be interpreted by a LINQ provider. Only what is supported by LINQ providers is supported by AutoMapper: +* MapFrom (Expression-based) +* ConvertUsing (Expression-based) +* Ignore +* NullSubstitute + +Not supported: +* Condition +* SetMappingOrder +* UseDestinationValue +* MapFrom (Func-based) +* Before/AfterMap +* Custom resolvers +* Custom type converters +* ForPath +* **Any calculated property on your domain object** + +Additionally, recursive or self-referencing destination types are not supported as LINQ providers do not support this. Typically hierarchical relational data models require common table expressions (CTEs) to correctly resolve a recursive join. diff --git a/docs/Reverse-Mapping-and-Unflattening.md b/docs/Reverse-Mapping-and-Unflattening.md new file mode 100644 index 0000000000..dadebbb31d --- /dev/null +++ b/docs/Reverse-Mapping-and-Unflattening.md @@ -0,0 +1,93 @@ +# Reverse Mapping and Unflattening + +Starting with 6.1.0, AutoMapper now supports richer reverse mapping support. Given our entities: + +```c# +public class Order { + public decimal Total { get; set; } + public Customer Customer { get; set; } +} + +public class Customer { + public string Name { get; set; } +} +``` + +We can flatten this into a DTO: + +```c# +public class OrderDto { + public decimal Total { get; set; } + public string CustomerName { get; set; } +} +``` + +We can map both directions, including unflattening: + +```c# +Mapper.Initialize(cfg => { + cfg.CreateMap() + .ReverseMap(); +}); +``` + +By calling `ReverseMap`, AutoMapper creates a reverse mapping configuration that includes unflattening: + +```c# +var customer = new Customer { + Name = "Bob" +}; + +var order = new Order { + Customer = customer, + Total = 15.8m +}; + +var orderDto = Mapper.Map(order); + +orderDto.CustomerName = "Joe"; + +Mapper.Map(orderDto, order); + +order.Customer.Name.ShouldEqual("Joe"); +``` + +Unflattening is only configured for `ReverseMap`. If you want unflattening, you must configure `Entity` -> `Dto` then call `ReverseMap` to create an unflattening type map configuration from the `Dto` -> `Entity`. + +### Customizing reverse mapping + +AutoMapper will automatically reverse map "Customer.Name" from "CustomerName" based on the original flattening. If you use MapFrom, AutoMapper will attempt to reverse the map: + +```c# +cfg.CreateMap() + .ForMember(d => d.CustomerName, opt => opt.MapFrom(src => src.Customer.Name)) + .ReverseMap(); +``` + +As long as the `MapFrom` path are member accessors, AutoMapper will unflatten from the same path (`CustomerName` => `Customer.Name`). + +If you need to customize this, for a reverse map you can use `ForPath`: + +```c# +cfg.CreateMap() + .ForMember(d => d.CustomerName, opt => opt.MapFrom(src => src.Customer.Name)) + .ReverseMap() + .ForPath(s => s.Customer.Name, opt => opt.MapFrom(src => src.CustomerName)); +``` + +For most cases you shouldn't need this, as the original MapFrom will be reversed for you. Use ForPath when the path to get and set the values are different. + +If you do not want unflattening behavior, you can remove the call to `ReverseMap` and create two separate maps. Or, you can use Ignore: + +```c# +cfg.CreateMap() + .ForMember(d => d.CustomerName, opt => opt.MapFrom(src => src.Customer.Name)) + .ReverseMap() + .ForPath(s => s.Customer.Name, opt => opt.Ignore()); +``` +### IncludeMembers + +`ReverseMap` also integrates with [`IncludeMembers`](Flattening.html#includemembers) and configuration like +```c# +ForMember(destination => destination.IncludedMember, member => member.MapFrom(source => source)) +``` diff --git a/docs/Static-and-Instance-API.md b/docs/Static-and-Instance-API.md new file mode 100644 index 0000000000..34af06ae8b --- /dev/null +++ b/docs/Static-and-Instance-API.md @@ -0,0 +1,77 @@ +# Static and Instance API + +In 4.2.1 version of AutoMapper and later, AutoMapper provides two APIs: a static and an instance API. The static API: + +```c# +Mapper.Initialize(cfg => { + cfg.AddProfile(); + cfg.CreateMap(); +}); + +var dest = Mapper.Map(new Source()); +``` + +And the instance API: + +```c# +var config = new MapperConfiguration(cfg => { + cfg.AddProfile(); + cfg.CreateMap(); +}); + +var mapper = config.CreateMapper(); +// or +IMapper mapper = new Mapper(config); +var dest = mapper.Map(new Source()); +``` + +## Gathering configuration before initialization + +AutoMapper also lets you gather configuration before initialization: + +```c# +var cfg = new MapperConfigurationExpression(); +cfg.CreateMap(); +cfg.AddProfile(); +MyBootstrapper.InitAutoMapper(cfg); + +Mapper.Initialize(cfg); +// or +var mapperConfig = new MapperConfiguration(cfg); +IMapper mapper = new Mapper(mapperConfig); + +``` + +## LINQ projections + +For the instance API, you can use IMapper.ProjectTo. If you prefer to keep using the IQueryable extension methods, you have to pass in the MapperConfiguration instance: + +```c# +public class ProductsController : Controller { + public ProductsController(MapperConfiguration config) { + this.config = config; + } + private MapperConfiguration config; + + public ActionResult Index(int id) { + var dto = dbContext.Products + .Where(p => p.Id == id) + .ProjectTo(config) + .SingleOrDefault(); + + return View(dto); + } +} +``` + +## Unsupported operations + +One "feature" of AutoMapper allowed you to modify configuration at runtime. That caused many problems, so the new static API does not allow you to do this. You'll need to move all your `Mapper.CreateMap` calls into a profile, and into a `Mapper.Initialize`. + +For dynamic mapping, such as `Mapper.DynamicMap`, you can configure AutoMapper to create missing maps as needed: + +```c# +Mapper.Initialize(cfg => cfg.CreateMissingTypeMaps = true); +``` + +Internally this uses conventions to create maps as necessary. diff --git a/docs/The-MyGet-build.md b/docs/The-MyGet-build.md new file mode 100644 index 0000000000..b84e784230 --- /dev/null +++ b/docs/The-MyGet-build.md @@ -0,0 +1,13 @@ +# The MyGet Build + +AutoMapper uses MyGet to publish development builds based on the master branch. This means that the MyGet build sometimes contains fixes that are not available in the current NuGet package. Please try the latest MyGet build before reporting issues, in case your issue has already been fixed but not released. + +The AutoMapper MyGet gallery is available [here](https://myget.org/feed/automapperdev/package/nuget/AutoMapper). Be sure to include prereleases. + +## Installing the Package + +If you want to install the latest MyGet package into a project, you can use the following command: + +``` +Install-Package AutoMapper -Source https://www.myget.org/F/automapperdev/api/v3/index.json -IncludePrerelease +``` diff --git a/docs/Understanding-your-mapping.md b/docs/Understanding-your-mapping.md new file mode 100644 index 0000000000..25a8e008cd --- /dev/null +++ b/docs/Understanding-your-mapping.md @@ -0,0 +1,16 @@ +# Understanding Your Mappings + +AutoMapper creates an execution plan for your mapping. That execution plan can be viewed as [an expression tree](https://msdn.microsoft.com/en-us/library/mt654263.aspx?f=255&MSPPError=-2147217396) during debugging. You can get a better view of the resulting code by installing [the ReadableExpressions VS extension](https://marketplace.visualstudio.com/items?itemName=vs-publisher-1232914.ReadableExpressionsVisualizers). If you need to see the code outside VS, you can use [the ReadableExpressions package directly](https://www.nuget.org/packages/AgileObjects.ReadableExpressions). + +```c# +var configuration = new MapperConfiguration(cfg => cfg.CreateMap()); +var executionPlan = configuration.BuildExecutionPlan(typeof(Foo), typeof(Bar)); +``` + +Be sure to remove all such code before release. + +For ProjectTo, you need to inspect IQueryable.Expression. + +```c# +var expression = context.Entities.ProjectTo().Expression; +``` diff --git a/docs/Value-converters.md b/docs/Value-converters.md new file mode 100644 index 0000000000..eb0d649ac3 --- /dev/null +++ b/docs/Value-converters.md @@ -0,0 +1,76 @@ +# Value Converters + +Value converters are a cross between [Type Converters](Custom-type-converters.html) and [Value Resolvers](Custom-value-resolvers.html). Type converters are globally scoped, so that any time you map from type `Foo` to type `Bar` in any mapping, the type converter will be used. Value converters are scoped to a single map, and receive the source and destination objects to resolve to a value to map to the destination member. Optionally value converters can receive the source member as well. + +In simplified syntax: + + - Type converter = `Func` + - Value resolver = `Func` + - Member value resolver = `Func` + - Value converter = `Func` + + To configure a value converter, use at the member level: + + ```c# + public class CurrencyFormatter : IValueConverter { + public string Convert(decimal source) + => source.ToString("c"); + } + + Mapper.Initialize(cfg => { + cfg.CreateMap() + .ForMember(d => d.Amount, opt => opt.ConvertUsing(new CurrencyFormatter())); + cfg.CreateMap() + .ForMember(d => d.Total, opt => opt.ConvertUsing(new CurrencyFormatter())); + }); + ``` + +You can customize the source member when the source member name does not match: + + ```c# + public class CurrencyFormatter : IValueConverter { + public string Convert(decimal source) + => source.ToString("c"); + } + + Mapper.Initialize(cfg => { + cfg.CreateMap() + .ForMember(d => d.Amount, opt => opt.ConvertUsing(new CurrencyFormatter(), src => src.OrderAmount)); + cfg.CreateMap() + .ForMember(d => d.Total, opt => opt.ConvertUsing(new CurrencyFormatter(), src => src.LITotal)); + }); + ``` + +If you need the value converters instantiated by the [service locator](Dependency-injection.html), you can specify the type instead: + + ```c# + public class CurrencyFormatter : IValueConverter { + public string Convert(decimal source) + => source.ToString("c"); + } + + Mapper.Initialize(cfg => { + cfg.CreateMap() + .ForMember(d => d.Amount, opt => opt.ConvertUsing()); + cfg.CreateMap() + .ForMember(d => d.Total, opt => opt.ConvertUsing()); + }); + ``` + +If you do not know the types or member names at runtime, use the various overloads that accept `System.Type` and `string`-based members: + + ```c# + public class CurrencyFormatter : IValueConverter { + public string Convert(decimal source) + => source.ToString("c"); + } + + Mapper.Initialize(cfg => { + cfg.CreateMap(typeof(Order), typeof(OrderDto)) + .ForMember("Amount", opt => opt.ConvertUsing(new CurrencyFormatter(), "OrderAmount")); + cfg.CreateMap(typeof(OrderLineItem), typeof(OrderLineItemDto)) + .ForMember("Total", opt => opt.ConvertUsing(new CurrencyFormatter(), "LITotal")); + }); + ``` + + Value converters are only used for in-memory mapping execution. They will not work for [`ProjectTo`](Queryable-Extensions.html). diff --git a/docs/Value-transformers.md b/docs/Value-transformers.md new file mode 100644 index 0000000000..f3602dc54a --- /dev/null +++ b/docs/Value-transformers.md @@ -0,0 +1,21 @@ +# Value Transformers + +Value transformers apply an additional transformation to a single type. Before assigning the value, AutoMapper will check to see if the value to be set has any value transformations associated, and will apply them before setting. + +You can create value transformers at several different levels: + + - Globally + - Profile + - Map + - Member + +```c# +Mapper.Initialize(cfg => { + cfg.ValueTransformers.Add(val => val + "!!!"); +}); + +var source = new Source { Value = "Hello" }; +var dest = Mapper.Map(source); + +dest.Value.ShouldBe("Hello!!!"); +``` diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000000..cc465859ff --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +# +# AutoMapper documentation build configuration file, created by +# sphinx-quickstart on Thu Oct 05 09:44:33 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +from recommonmark.parser import CommonMarkParser + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +source_parsers = { + '.md': CommonMarkParser +} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = ['.rst', '.md'] + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'AutoMapper' +copyright = u'2017, Jimmy Bogard' +author = u'Jimmy Bogard' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'' +# The full version, including alpha/beta/rc tags. +release = u'' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +html_theme_options = { + 'logo_only': True, + 'display_version': False +} + +html_logo = 'img/logo.png' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# This is required for the alabaster theme +# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +html_sidebars = { + '**': [ + 'about.html', + 'navigation.html', + 'relations.html', # needs 'show_related': True theme option to display + 'searchbox.html', + 'donate.html', + ] +} + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'AutoMapperdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'AutoMapper.tex', u'AutoMapper Documentation', + u'Jimmy Bogard', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'automapper', u'AutoMapper Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'AutoMapper', u'AutoMapper Documentation', + author, 'AutoMapper', 'One line description of project.', + 'Miscellaneous'), +] diff --git a/docs/img/logo.png b/docs/img/logo.png new file mode 100644 index 0000000000..cb97d9226b Binary files /dev/null and b/docs/img/logo.png differ diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000000..cbc0e82290 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,77 @@ +AutoMapper +========== + +A convention-based object-object mapper. + +AutoMapper uses a fluent configuration API to define an object-object +mapping strategy. AutoMapper uses a convention-based matching algorithm +to match up source to destination values. AutoMapper is geared towards +model projection scenarios to flatten complex object models to DTOs and +other simple objects, whose design is better suited for serialization, +communication, messaging, or simply an anti-corruption layer between the +domain and application layer. + +AutoMapper supports the following platforms: + +* .NET 4.6.1+ +* `.NET Standard 2.0+ https://docs.microsoft.com/en-us/dotnet/standard/net-standard` + +New to AutoMapper? Check out the :doc:`Getting-started` page first. + +.. _user-docs: + +.. toctree:: + :hidden: + :maxdepth: 2 + :caption: User Documentation + + Getting-started + 5.0-Upgrade-Guide + 8.0-Upgrade-Guide + Static-and-Instance-API + Conventions + Understanding-your-mapping + The-MyGet-build + +.. _feature-docs: + +.. toctree:: + :maxdepth: 2 + :caption: Feature Documentation + + Flattening + Reverse-Mapping-and-Unflattening + Projection + Configuration-validation + Inline-Mapping + Lists-and-arrays + Nested-mappings + Custom-type-converters + Custom-value-resolvers + Value-converters + Value-transformers + Null-substitution + Before-and-after-map-actions + Dependency-injection + Mapping-inheritance + Queryable-Extensions + Configuration + Construction + Conditional-mapping + Open-Generics + Dynamic-and-ExpandoObject-Mapping + Expression-Translation-(UseAsDataSource) + +Examples +======== + +The source code contains unit tests for all of the features listed above. Use the GitHub search to find relevant examples. + +Housekeeping +============ + +The latest builds can be found at `NuGet `_ + +The dev builds can be found at `MyGet `_ + +The discussion group is hosted on `Google Groups `_ diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000000..1568929e2d --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=python -msphinx +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXPROJ=AutoMapper + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The Sphinx module was not found. Make sure you have Sphinx installed, + echo.then set the SPHINXBUILD environment variable to point to the full + echo.path of the 'sphinx-build' executable. Alternatively you may add the + echo.Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000000..4da41f9b71 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinx >= 1.6.0 diff --git a/global.json b/global.json deleted file mode 100644 index 4307d6ffd9..0000000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src\\AutoMapper", "test" ], - "sdk": { - "version": "1.0.0-preview1-002702" - } -} \ No newline at end of file diff --git a/lib/Microsoft.VisualStudio.Profiler.dll b/lib/Microsoft.VisualStudio.Profiler.dll new file mode 100644 index 0000000000..cf361ba3a0 Binary files /dev/null and b/lib/Microsoft.VisualStudio.Profiler.dll differ diff --git a/lib/Microsoft.VisualStudio.Profiler.xml b/lib/Microsoft.VisualStudio.Profiler.xml new file mode 100644 index 0000000000..67f5c2a43f --- /dev/null +++ b/lib/Microsoft.VisualStudio.Profiler.xml @@ -0,0 +1,145 @@ + + + + Microsoft.VisualStudio.Profiler + + + + The DataCollection class enables you to programmatically control the amount of data collected during profiling in the .vsp file. To programmatically control data collection, use methods and property of the DataCollection class in your managed code. + + + The CommentMarkAtProfile method inserts a timestamp value, a numeric mark and a comment string in the .vsp file. The timestamp value can be used to synchronize external events. Profiling for the thread containing the CommentMarkAtProfile function must be ON for the mark and comment to be inserted. + The return value, MarkOperationResult, is an enum. + A 64-bit integer representing a timestamp value. + The numeric marker to insert. The marker must greater than or equal to 0 (zero). + A pointer to the text string to insert. The string must be less than 256 characters including the NULL terminator. + + + The CommentMarkProfile method inserts a numeric marker and a text string in the .vsp file. Profiling for the thread containing the CommentMarkProfile function must be ON for the mark and comment to be inserted. + The return value, MarkOperationResult, is an enum. + The numeric marker to insert. The marker must greater than or equal to 0 (zero). + A pointer to the text string to insert. The string must be less than 256 characters including the NULL terminator. + + + The CurrentId property returns the pseudo-token for the thread id or process id, in a call to NameProfile, StartProfile, StopProfile, SuspendProfile, and ResumeProfile. Use this property to cause the method to operate on the current thread or process, rather than a specifically indicated one. + An unsigned integer value for the process or thread identifier. + + + The MarkProfile method inserts a profile mark in the .vsp file. Profiling for the thread containing the MarkProfile function must be ON for the mark to be inserted. + The return value, MarkOperationResult, is an enum. + The marker to insert. The marker must be greater than or equal to 0 (zero). + + + The NameProfile method assigns a string to the specified process or thread. + The return value, NameOperationResult, is an enum. + The name of the profiling element. + Identifies the execution level of the identifier specified in elementId. + Profiling level identifier. Use the process or thread identifier that is generated by the system. + + + The ResumeProfile method decrements the Suspend/Resume counter for the specified profiling level. + The return value, ProfileOperationResult, is an enum. + Identifies the execution level of the identifier specified in elementId. + The process or thread identifier generated by the system. + + + The StartProfile method sets the counter to 1 (on) for the specified profiling level. + The return value, ProfileOperationResult, is an enum. + Identifies the execution level of the identifier specified in elementId. + The process or thread identifier generated by the system. + + + The StopProfile method sets the counter to 0 (off) for the specified profiling level. + The return value, ProfileOperationResult, is an enum. + Identifies the execution level of the identifier specified in elementId. + The process or thread identifier generated by the system. + + + The SuspendProfile method increments the Suspend/Resume counter for the specified profiling level. + The return value, ProfileOperationResult, is an enum. + Identifies the execution level of the identifier specified in elementId. + The process or thread identifier generated by the system. + + + CommentMarkAtProfile, CommentMarkProfile, and MarkProfile return success or failure using the MarkOperationResult enum. + + + The parameter is less than or equal to 0. These values are reserved. The mark and comment are not recorded. + + + The profiling mode was set to NEVER when the function was called. The mark and comment are not recorded. + + + The global profiling level was set to OFF when the function was called. The mark and comment are not recorded. + + + No mark support in this context. The mark and comment are not recorded. + + + Memory was not available to record the event. The mark and comment are not recorded. + + + The string exceeds the maximum of 256 characters. The comment string is truncated and the mark and comment are recorded. + + + The call was successful. + + + NameProfile method returns NameOperationResult enum to indicate success or failure. + + + The profiling element specified does not exist. + + + The name is invalid. + + + The profile level specified does not exist. + + + The specified operation is not supported. + + + Memory was not available to record the event. + + + A name was already assigned to the profile element. The name in this function is ignored. + + + The name text exceeded 32 characters including the null character and was therefore truncated. + + + Name was registered successfully. + + + ProfileLevel enum is used indicate one of the three levels to which performance data collection can be applied. + + + Global level setting affects all processes and threads in the profiling run. + + + Process level setting affect all threads which are part of specified process. + + + Thread profiling Level setting affects the specified thread. + + + ResumeProfile, StartProfile, StopProfile, and SuspendProfile return success or failure using the ProfileOperationResult enum. + + + The profiling element does not exist. + + + The profiling level specified does not exist. + + + The profiling mode was set to NEVER when the function was called. + + + The profiling function call, profiling level, or combination of call and level is not yet implemented. + + + The call was successful. + + + \ No newline at end of file diff --git a/lib/Rhino.Mocks.dll b/lib/Rhino.Mocks.dll deleted file mode 100644 index a7055be238..0000000000 Binary files a/lib/Rhino.Mocks.dll and /dev/null differ diff --git a/lib/Should.dll b/lib/Should.dll deleted file mode 100644 index d8e3f6fc89..0000000000 Binary files a/lib/Should.dll and /dev/null differ diff --git a/lib/StructureMap/LICENSE.TXT b/lib/StructureMap/LICENSE.TXT deleted file mode 100644 index ef08e66590..0000000000 --- a/lib/StructureMap/LICENSE.TXT +++ /dev/null @@ -1,194 +0,0 @@ -StructureMap - -Copyright 2004-2009 Jeremy D. Miller - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/lib/StructureMap/Rhino.Mocks.dll b/lib/StructureMap/Rhino.Mocks.dll deleted file mode 100644 index 4b6904b6f8..0000000000 Binary files a/lib/StructureMap/Rhino.Mocks.dll and /dev/null differ diff --git a/lib/StructureMap/StructureMap.AutoMocking.dll b/lib/StructureMap/StructureMap.AutoMocking.dll deleted file mode 100644 index 40dc4235e5..0000000000 Binary files a/lib/StructureMap/StructureMap.AutoMocking.dll and /dev/null differ diff --git a/lib/StructureMap/StructureMap.chm b/lib/StructureMap/StructureMap.chm deleted file mode 100644 index 6c91685841..0000000000 Binary files a/lib/StructureMap/StructureMap.chm and /dev/null differ diff --git a/lib/StructureMap/StructureMap.dll b/lib/StructureMap/StructureMap.dll deleted file mode 100644 index a8e84e553b..0000000000 Binary files a/lib/StructureMap/StructureMap.dll and /dev/null differ diff --git a/lib/StructureMap/StructureMapDoctor.exe b/lib/StructureMap/StructureMapDoctor.exe deleted file mode 100644 index 0d8a1dfca9..0000000000 Binary files a/lib/StructureMap/StructureMapDoctor.exe and /dev/null differ diff --git a/lib/nunit.framework.dll b/lib/nunit.framework.dll deleted file mode 100644 index 2a0a0aa326..0000000000 Binary files a/lib/nunit.framework.dll and /dev/null differ diff --git a/lib/xunit.net/EULA.txt b/lib/xunit.net/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.net/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.net/HTML.xslt b/lib/xunit.net/HTML.xslt deleted file mode 100644 index 45b62c71a7..0000000000 --- a/lib/xunit.net/HTML.xslt +++ /dev/null @@ -1,128 +0,0 @@ - - - - - ]]> - - - - xUnit.net Test Results - <xsl:value-of select="@name"/> - - - - - - - - - - - - - - - -

Results for

-
- Tests run:   - Failures: , - Skipped: , - Run time: s -
- -
-

Failed tests

- -
- -
-

Failed fixtures

- -
- -
-

Skipped tests

- -
-
-

All tests

-
Click test class name to expand/collapse test details
- -
Results generated at
-
- - -
- altrow - s - Skipped - - -   - : -
- -
-
- -

Output

-
-
-
-
- - - :
- Stack Trace:
-
-
- - -

- s - - ToggleClass('class') - ToggleClass('class') - - -   -  ( tests) - -
-

-
- display: none; - class - -
-
- -
\ No newline at end of file diff --git a/lib/xunit.net/NUnitXml.xslt b/lib/xunit.net/NUnitXml.xslt deleted file mode 100644 index 4d82799f54..0000000000 --- a/lib/xunit.net/NUnitXml.xslt +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - True - - - - - - - - - - - - - - - - - - False - True - - - - - - - - - - - - - - - - - - - - - - - - - False - True - - - - False - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/xunit.net/xunit.console.clr4.exe b/lib/xunit.net/xunit.console.clr4.exe deleted file mode 100644 index 6a9fed2a4b..0000000000 Binary files a/lib/xunit.net/xunit.console.clr4.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.console.clr4.exe.config b/lib/xunit.net/xunit.console.clr4.exe.config deleted file mode 100644 index 1aae4c31f7..0000000000 --- a/lib/xunit.net/xunit.console.clr4.exe.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
- - - - - - - - - - \ No newline at end of file diff --git a/lib/xunit.net/xunit.console.clr4.x86.exe b/lib/xunit.net/xunit.console.clr4.x86.exe deleted file mode 100644 index 82d4b607ed..0000000000 Binary files a/lib/xunit.net/xunit.console.clr4.x86.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.console.clr4.x86.exe.config b/lib/xunit.net/xunit.console.clr4.x86.exe.config deleted file mode 100644 index 24ca922c93..0000000000 --- a/lib/xunit.net/xunit.console.clr4.x86.exe.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
- - - - - - - - - - \ No newline at end of file diff --git a/lib/xunit.net/xunit.console.exe b/lib/xunit.net/xunit.console.exe deleted file mode 100644 index ae9f370f41..0000000000 Binary files a/lib/xunit.net/xunit.console.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.console.exe.config b/lib/xunit.net/xunit.console.exe.config deleted file mode 100644 index a253b460df..0000000000 --- a/lib/xunit.net/xunit.console.exe.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
- - - - - - - - - - \ No newline at end of file diff --git a/lib/xunit.net/xunit.console.x86.exe b/lib/xunit.net/xunit.console.x86.exe deleted file mode 100644 index 14ac07aa50..0000000000 Binary files a/lib/xunit.net/xunit.console.x86.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.console.x86.exe.config b/lib/xunit.net/xunit.console.x86.exe.config deleted file mode 100644 index 89e63fa2e8..0000000000 --- a/lib/xunit.net/xunit.console.x86.exe.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - -
- - - - - - - - - - \ No newline at end of file diff --git a/lib/xunit.net/xunit.dll b/lib/xunit.net/xunit.dll deleted file mode 100644 index 3af4c873fa..0000000000 Binary files a/lib/xunit.net/xunit.dll and /dev/null differ diff --git a/lib/xunit.net/xunit.dll.tdnet b/lib/xunit.net/xunit.dll.tdnet deleted file mode 100644 index 4d8afc8efd..0000000000 --- a/lib/xunit.net/xunit.dll.tdnet +++ /dev/null @@ -1,5 +0,0 @@ - - xUnit.net {0}.{1}.{2} build {3} - xunit.runner.tdnet.dll - Xunit.Runner.TdNet.TdNetRunner - \ No newline at end of file diff --git a/lib/xunit.net/xunit.extensions.dll b/lib/xunit.net/xunit.extensions.dll deleted file mode 100644 index 5e1b188f2b..0000000000 Binary files a/lib/xunit.net/xunit.extensions.dll and /dev/null differ diff --git a/lib/xunit.net/xunit.extensions.xml b/lib/xunit.net/xunit.extensions.xml deleted file mode 100644 index 505b62c00e..0000000000 --- a/lib/xunit.net/xunit.extensions.xml +++ /dev/null @@ -1,797 +0,0 @@ - - - - xunit.extensions - - - - - A wrapper for Assert which is used by . - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - Verifies that two values are equal, within the number of decimal - places given by . - - The expected value - The value to be compared against - The number of decimal places (valid values: 0-15) - Thrown when the values are not equal - - - - Verifies that two values are equal, within the number of decimal - places given by . - - The expected value - The value to be compared against - The number of decimal places (valid values: 0-15) - Thrown when the values are not equal - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - A class which can be derived from for test classes, which bring an overridable version - of Assert (using the class. - - - - - Gets a class which provides assertions. - - - - - Apply this attribute to your test method to replace the - with another role. - - - - - Replaces the identity of the current thread with . - - The role's name - - - - Restores the original . - - The method under test - - - - Stores the current and replaces it with - a new role identified in constructor. - - The method under test - - - - Gets the name. - - - - - Apply this attribute to your test method to automatically create a - that is rolled back when the test is - finished. - - - - - Rolls back the transaction. - - - - - Creates the transaction. - - - - - Gets or sets the isolation level of the transaction. - Default value is .Unspecified. - - - - - Gets or sets the scope option for the transaction. - Default value is .Required. - - - - - Gets or sets the timeout of the transaction, in milliseconds. - By default, the transaction will not timeout. - - - - - Provides a data source for a data theory, with the data coming from a class - which must implement IEnumerable<object[]>. - - - - - Abstract attribute which represents a data source for a data theory. - Data source providers derive from this attribute and implement GetData - to return the data for the theory. - - - - - Returns the data to be used to test the theory. - - - The parameter is provided so that the - test data can be converted to the destination parameter type when necessary. - Generally, data should NOT be automatically converted, UNLESS the source data - format does not have rich types (for example, all numbers in Excel spreadsheets - are returned as even if they are integers). Derivers of - this class should NOT throw exceptions for mismatched types or mismatched number - of parameters; the test framework will throw these exceptions at the correct - time. - - The method that is being tested - The types of the parameters for the test method - The theory data - - - - - - - Initializes a new instance of the class. - - The class that provides the data. - - - - - - - Gets the type of the class that provides the data. - - - - - Represents an implementation of which uses an - instance of to get the data for a - decorated test method. - - - - - - - - Converts a parameter to its destination parameter type, if necessary. - - The parameter value - The destination parameter type (null if not known) - The converted parameter value - - - - Gets the data adapter to be used to retrieve the test data. - - - - - Provides a data source for a data theory, with the data coming from inline values. - - - - - Initializes a new instance of the class. - - The data values to pass to the theory - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Gets the data values. - - - - - Provides a data source for a data theory, with the data coming from an OLEDB connection. - - - - - Creates a new instance of . - - The OLEDB connection string to the data - The SELECT statement used to return the data for the theory - - - - Gets the connection string. - - - - - Gets the select statement. - - - - - - - - Provides a data source for a data theory, with the data coming from a public static property on the test class. - The property must return IEnumerable<object[]> with the test data. - - - - - Creates a new instance of / - - The name of the public static property on the test class that will provide the test data - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Gets the property name. - - - - - Provides a data source for a data theory, with the data coming a Microsoft SQL Server. - - - - - Creates a new instance of , using a trusted connection. - - The server name of the Microsoft SQL Server - The database name - The SQL SELECT statement to return the data for the data theory - - - - Creates a new instance of , using the provided username and password. - - The server name of the Microsoft SQL Server - The database name - The username for the server - The password for the server - The SQL SELECT statement to return the data for the data theory - - - - Provides a data source for a data theory, with the data coming a Microsoft Excel (.xls) spreadsheet. - - - - - Creates a new instance of . - - The filename of the XLS spreadsheet file; if the filename provided - is relative, then it is relative to the location of xunit.extensions.dll. - The SELECT statement that returns the data for the theory - - - - - - - Marks a test method as being a data theory. Data theories are tests which are fed - various bits of data from a data source, mapping to parameters on the test method. - If the data source contains multiple rows, then the test method is executed - multiple times (once with each data row). - - - - - Creates instances of which represent individual intended - invocations of the test method, one per data row in the data source. - - The method under test - An enumerator through the desired test method invocations - - - - Represents a single invocation of a data theory test method. - - - - - Creates a new instance of . - - The method under test - The parameters to be passed to the test method - - - - - - - Gets the parameter values that are passed to the test method. - - - - - A wrapper around the static operations on which allows time - to be frozen using the . The clock begins in the - thawed state; that is, calls to , , and - return current (non-frozen) values. - - - - - Freezes the clock with the current time. - Until is called, all calls to , , and - will return the exact same values. - - - - - Freezes the clock with the given date and time, considered to be local time. - Until is called, all calls to , , and - will return the exact same values. - - The local date and time to freeze to - - - - Freezes the clock with the given date and time, considered to be Coordinated Universal Time (UTC). - Until is called, all calls to , , and - will return the exact same values. - - The UTC date and time to freeze to - - - - Thaws the clock so that , , and - return normal values. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the local time. - - - - - Gets the current date. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the Coordinated Universal Time (UTC). - - - - - Apply this attribute to your test method to freeze the time represented by the - class. - - - - - Freeze the clock with the current date and time. - - - - - Freeze the clock with the given date, considered to be local time. - - The frozen year - The frozen month - The frozen day - - - - Freeze the clock with the given date and time, considered to be in local time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - - - - Freeze the clock with the given date and time, with the given kind of time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - The frozen time kind - - - - Thaws the clock. - - The method under test - - - - Freezes the clock. - - The method under test - - - - Apply to a test method to trace the method begin and end. - - - - - This method is called before the test method is executed. - - The method under test - - - - This method is called after the test method is executed. - - The method under test - - - diff --git a/lib/xunit.net/xunit.gui.clr4.exe b/lib/xunit.net/xunit.gui.clr4.exe deleted file mode 100644 index 72b00c5227..0000000000 Binary files a/lib/xunit.net/xunit.gui.clr4.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.gui.clr4.x86.exe b/lib/xunit.net/xunit.gui.clr4.x86.exe deleted file mode 100644 index 0ecde2bf5f..0000000000 Binary files a/lib/xunit.net/xunit.gui.clr4.x86.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.gui.exe b/lib/xunit.net/xunit.gui.exe deleted file mode 100644 index 89a015cf80..0000000000 Binary files a/lib/xunit.net/xunit.gui.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.gui.x86.exe b/lib/xunit.net/xunit.gui.x86.exe deleted file mode 100644 index f343bd76d9..0000000000 Binary files a/lib/xunit.net/xunit.gui.x86.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.installer.exe b/lib/xunit.net/xunit.installer.exe deleted file mode 100644 index eada92e841..0000000000 Binary files a/lib/xunit.net/xunit.installer.exe and /dev/null differ diff --git a/lib/xunit.net/xunit.runner.msbuild.dll b/lib/xunit.net/xunit.runner.msbuild.dll deleted file mode 100644 index 1e8b301336..0000000000 Binary files a/lib/xunit.net/xunit.runner.msbuild.dll and /dev/null differ diff --git a/lib/xunit.net/xunit.runner.tdnet.dll b/lib/xunit.net/xunit.runner.tdnet.dll deleted file mode 100644 index 236a1c8b5d..0000000000 Binary files a/lib/xunit.net/xunit.runner.tdnet.dll and /dev/null differ diff --git a/lib/xunit.net/xunit.runner.utility.dll b/lib/xunit.net/xunit.runner.utility.dll deleted file mode 100644 index 5ffb216d09..0000000000 Binary files a/lib/xunit.net/xunit.runner.utility.dll and /dev/null differ diff --git a/lib/xunit.net/xunit.runner.utility.xml b/lib/xunit.net/xunit.runner.utility.xml deleted file mode 100644 index eb13d4fd49..0000000000 --- a/lib/xunit.net/xunit.runner.utility.xml +++ /dev/null @@ -1,1212 +0,0 @@ - - - - xunit.runner.utility - - - - - Guard class, used for guard clauses and argument validation - - - - - - - - - - - - - - Wraps calls to the Executor. Used by runners to perform version-resilient test - enumeration and execution. - - - - - Wraps calls to the Executor. Used by runners to perform version-resilient test - enumeration and execution. - - - - - Enumerates the tests in an assembly. - - The fully-formed assembly node of the XML - - - - Gets a count of the tests in the assembly. - - Returns the number of tests, if known; returns -1 if not known. May not represent - an exact count, but should be a best effort guess by the framework. - - - - Runs all the tests in an assembly. - - The callback which is called as each test/class/assembly is - finished, providing XML nodes that are part of the xUnit.net XML output format. - Test runs can be cancelled by returning false to the callback. If null, there are - no status callbacks (and cancellation isn't possible). - Returns the fully-formed assembly node for the assembly that was just run. - - - - Runs all the tests in the given class. - - The type. - The callback which is called as each test/class is - finished, providing XML nodes that are part of the xUnit.net XML output format. - Test runs can be cancelled by returning false to the callback. If null, there are - no status callbacks (and cancellation isn't possible). - Returns the fully-formed class node for the class that was just run. - - - - Runs a single test in a class. - - The type to run. - The method to run. - The callback which is called as each test/class is - finished, providing XML nodes that are part of the xUnit.net XML output format. - Test runs can be cancelled by returning false to the callback. If null, there are - no status callbacks (and cancellation isn't possible). - Returns the fully-formed class node for the class of the test that was just run. - - - - Runs several tests in a single class. - - The type. - The methods to run. - The callback which is called as each test/class is - finished, providing XML nodes that are part of the xUnit.net XML output format. - Test runs can be cancelled by returning false to the callback. If null, there are - no status callbacks (and cancellation isn't possible). - Returns the fully-formed class node for the class of the tests that were just run. - - - - Gets the full pathname to the assembly under test. - - - - - Gets the full pathname to the configuration file. - - - - - Gets the version of xunit.dll used by the test assembly. - - - - - Initializes the class. - - - - - Initializes a new instance of the class. - - The assembly filename. - The config filename. If null, the default config filename will be used. - Set to true to enable shadow copying; false, otherwise. - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - - - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - - - - THIS CLASS IS FOR INTERNAL USE ONLY. - - - - - - - - - - - The callback object which receives real-time status notifications from the - test runner. - - - - - Called when the assembly has finished running. - - The test assembly. - The total number of tests run. - The number of failed tests. - The number of skipped tests. - The time taken to run, in seconds. - - - - Called when the assembly has started running. - - The test assembly. - - - - Called when a class failure is encountered (i.e., when a fixture from - IUseFixture throws an exception during construction or . - - The test class. - The full type name of the exception. - The exception message. - The exception stack trace. - - - - - Called when an exception is thrown (i.e., a catastrophic failure of the testing system). - - The test assembly. - The exception that was thrown. - - - - Called when a test has finished running, regardless of what the result was. - - The test method. - Return true to continue running tests; return false to stop the test run. - - - - Called when a test has started running. - - The test method. - Return true to continue running tests; return false to stop the test run. - - - - Represents the ability to load and unload test assemblies, as well as enumerate - the test assemblies, the test methods, and run tests. - - - - - Represents the ability to enumerate and filter test methods. - - - - - Enumerates all test methods. - - - - - Enumerates test methods which pass the given filter. - - The test method filter. - - - - The test assemblies loaded into the environment. - - - - - - - - Enumerates the test assemblies in the environment. - - - - - - - - - - - Enumerates the traits across all the loaded assemblies. - - - - - Loads the specified assembly, using the default configuration file. - - The assembly filename. - The which represents the newly - loaded test assembly. - - - - Loads the specified assembly using the specified configuration file. - - The assembly filename. - The config filename. - The which represents the newly - loaded test assembly. - - - - Loads the specified assembly using the specified configuration file. - - The assembly filename. - The config filename. - Whether the DLLs should be shadow copied. - The which represents the newly - loaded test assembly. - - - - Adds the assembly loaded into the given - into the environment. - - The executor wrapper. - The which represents the newly - loaded test assembly. - - - - Runs the specified test methods. - - The test methods to run. - The run status information callback. - Returns the result as XML. - - - - Unloads the specified assembly. - - The assembly to unload. - - - - Represents a failed test run in the object model. - - - - - Base class for all test results in the object model. - - - - - Initializes a new instance of the class. - - The duration the test took to run. For skipped tests, should be 0.0. - The display name of the test result. - - - - Gets the display name of the test result. - - - - - Gets the duration the test took to run. - - - - - Initializes a new instance of the class. - - The duration the test took to run. - The display name of the test result. - The output that was captured during the test run. - Type of the exception. - The exception message. - The exception stack trace. - - - - Gets the output that was captured during the test run. - - - - - Gets the type of the exception. - - - - - Gets the exception message. - - - - - Gets the exception stack trace. - - - - - Represents a skipped test run in the object model. - - - - - Initializes a new instance of the class. - - The display name of the test result. - The skip reason. - - - - Gets the skip reason. - - - - - Acts as an and adapts the callback messages - into calls to an instance of . - - - - - Represents a logger used by and . - - - - - Called when the assembly has finished running. - - The assembly filename. - The total number of tests run. - The number of failed tests. - The number of skipped tests. - The time taken to run, in seconds. - - - - Called when the assembly has started running. - - The assembly filename. - The configuration filename, if given; null, otherwise. - The version of xunit.dll. - - - - Called when a class failure is encountered (i.e., when a fixture from - IUseFixture throws an exception during construction or . - - The full type name of the class. - The full type name of the exception. - The exception message. - The exception stack trace. - - - - - Called when an exception is thrown (i.e., a catastrophic failure of the testing system). - - The assembly filename. - The exception that was thrown. - - - - Called when a test fails. - - The description name of the test. - The full type name of the test class. - The name of the method. - The time spent running the test, in seconds. - The output of the test during its run. - The full type name of the exception. - The exception message. - The exception stack trace. - - - - Called when a test has finished running, regardless of what the result was. - - The description name of the test. - The full type name of the test class. - The name of the method. - Return true to continue running tests; return false to stop the test run. - - - - Called when a test has passed. - - The description name of the test. - The full type name of the test class. - The name of the method. - The time spent running the test, in seconds. - The output of the test during its run. - - - - Called when a test was finished. - - The description name of the test. - The full type name of the test class. - The name of the method. - The skip reason. - - - - Called when a test has started running. - - The description name of the test. - The full type name of the test class. - The name of the method. - Return true to continue running tests; return false to stop the test run. - - - - Initializes a new instance of the class. - - The test class. - The run status information callback. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Represents a passed test run in the object model. - - - - - Initializes a new instance of the class. - - The duration the test took to run. - The display name of the test result. - The output that was captured during the test run. - - - - Gets the output that was captured during the test run. - - - - - Indicates the composite test method status - - - - - The method has not been run - - - - - All test results for the last run passed - - - - - At least one test result for the last run failed - - - - - At least one test result for the last run was skipped, and none failed - - - - - Represents a set of filters for an . - - - - - Initializes a new instance of the class. - - - - - Filters the given methods using the defined filter values. - - The methods to filter. - The filtered methods. - - - - Gets the set of trait filters for tests to exclude. - - - - - Gets the set of trait filters for tests to include. - - - - - Represents an xUnit Test Project file (.xunit file) - - - - - Initializes a new instance of the class. - - - - - Adds an assembly to the project - - The assembly to be added - - - - Loads an xUnit.net Test Project file from disk. - - The test project filename - - - - Removes assembly from the assembly list - - The assembly to be removed - - - - Saves the xUnit.net Test Project file to disk using the project's filename. - - - - - Saves the xUnit.net Test Project file to disk using the provided filename. - The projects filename is updated to match this new name. - - The test project filename - - - - Gets or sets the assemblies in the project. - - - - - Gets or set the filename of the project. - - - - - Gets the filters applied to this project. - - - - - Gets or sets a flag which indicates if this project has been modified since - the last time it was loaded or saved. - - - - - Represents an assembly in an . - - - - - Initializes a new instance of the class. - - - - - Gets or sets the assembly filename. - - - - - Gets or sets the config filename. - - - - - Gets or sets a value indicating whether to shadow copy the assembly - when running the tests. - - - The xUnit.net GUI runner does not support this field. - - - - - Gets or sets the output filenames. The dictionary key is the type - of the file to be output; the dictionary value is the filename to - write the output to. - - - The xUnit.net GUI runner does not support this field. The MSBuild - runner only supports output of type 'xml', 'html', and 'nunit'. - - - - - Interface which represents a high level test runner. - - - - - Executes the tests in the assembly. - - Returns true if there were no failures; return false otherwise. - - - - Executes the tests in the assembly, and then executes the transforms with the - resulting assembly XML. - - The transforms to execute. - Returns true if there were no failures; return false otherwise. - - - - Runs the class. - - The type. - - - - - Runs a single test in a test class. - - The full name of the class. - The name of the method. - - - - Runs the list of tests in a test class. - - The full name of the class. - The names of the methods to run. - - - - Represents a single test assembly with test classes. - - - - - Initializes a new instance of the class. - - The executor wrapper. - The test classes. - - - - - - - Enumerates the test classes in the assembly. - - - - - - - - - - - Runs the specified test methods. - - The test methods to run. - The run status information callback. - Returns the result as XML. - - - - Gets the assembly filename. - - - - - Gets the config filename. - - - - - Gets the executor wrapper. - - - - - Gets the version of xunit.dll that the tests are linked against. - - - - - Represents a single class with test methods. - - - - - Initializes a new instance of the class. - - The namespace-qualified type name that - this class represents. - The test methods inside this test class. - - - - - - - - - - Runs the specified test methods. - - The test methods to run. - The run status information callback. - Returns the result as XML. - - - - Runs the specified tests in the given type, calling the callback as appropriate. - This override point exists primarily for unit testing purposes. - - The test methods to run - The run status information callback. - - - - Gets the test assembly that this class belongs to. - - - - - Gets the namespace-qualified type name of this class. - - - - - Represents a single test method. - - - - - Initializes a new instance of the class. - - The method name. - The method's display name. - The method's traits. - - - - Gets the method's display name. - - - - - Gets the method's name. - - - - - Gets the run results for the last run. - - - - - Gets the composite run status for all the results of the last run. - - - - - Gets the test class this test method belongs to. - - - - - Gets the method's traits. - - - - - The result of a test run via . - - - - - All tests passed, with no class-level failures - - - - - At least one test failed, or there was a class-level failure - - - - - There were no tests to run - - - - - Represents a transformation of the resulting assembly XML into some output format. - - - - - Transforms the given assembly XML into the destination format. - - The assembly XML. - - - - Gets the output filename, if known; returns null if the output isn't done to file. - - - - - Runs tests in an assembly, and transforms the XML results into calls to - the provided . - - - - - Initializes a new instance of the class. - - The executor wrapper. - The logger. - - - - - - - - - - - - - - - - - - - An implementation of which writes the - XML to a file without any transformation applied. - - - - - Initializes a new instance of the class. - - The output filename. - - - - - - - - - - An implementation of which writes the - XML to a file after applying the XSL stylesheet in the given stream. - - - - - Initializes a new instance of the class. - - The XSL filename. - The output filename. - - - - Initializes a new instance of the class. - - The stream with the XSL stylesheet. - The output filename. - - - - - - - - - - Gets or sets the XSL filename. - - - - - Gets or sets the XSL stream. - - - - - A dictionary which contains multiple unique values for each key. - - The type of the key. - The type of the value. - - - - Adds the value for the given key. If the key does not exist in the - dictionary yet, it will add it. - - The key. - The value. - - - - Removes all keys and values from the dictionary. - - - - - Determines whether the dictionary contains to specified key and value. - - The key. - The value. - - - - Calls the delegate once for each key/value pair in the dictionary. - - - - - Removes the given key and all of its values. - - - - - Removes the given value from the given key. If this was the - last value for the key, then the key is removed as well. - - The key. - The value. - - - - Gets the values for the given key. - - - - - Gets the count of the keys in the dictionary. - - - - - Gets the keys. - - - - - - - - Responsible for building instances. Uses an instance - of to interrogate the list of available tests - and create the entire object model tree. - - - - - Creates a which is a complete object model over - the tests inside of instance of . - - The executor wrapper - The fully populated object model - - - - Parses the XML nodes from the version resilient runner facility and converts - them into calls against the provided . - - - - - Logs a result XML node. Maybe be any kind of XML node. - - The node to be logged. - The logger. - Returns true if the user wishes to continue running tests; returns false otherwise. - - - - Logs the assembly node by calling . - - The assembly node. - The logger. - - - - Logs the class node by calling (if the class failed). - The exception type was added in xUnit.net 1.1, so when the test assembly is linked against - xUnit.net versions prior to 1.1, the exception type will be null. - - The class node. - The logger. - Returns true if the user wishes to continue running tests; returns false otherwise. - - - - Logs the start node by calling . The start node was added - in xUnit.net 1.1, so it will only be present when the test assembly is linked against xunit.dll - version 1.1 or later. - - The start node. - The logger. - Returns true if the user wishes to continue running tests; returns false otherwise. - - - - Logs the test node by calling . It will also call - , , or - as appropriate. - - The test node. - The logger. - Returns true if the user wishes to continue running tests; returns false otherwise. - - - diff --git a/lib/xunit.net/xunit.xml b/lib/xunit.net/xunit.xml deleted file mode 100644 index 0702176e9a..0000000000 --- a/lib/xunit.net/xunit.xml +++ /dev/null @@ -1,2439 +0,0 @@ - - - - xunit - - - - - Contains various static methods that are used to verify that conditions are met during the - process of running tests. - - - - - Initializes a new instance of the class. - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - Verifies that two values are equal, within the number of decimal - places given by . - - The expected value - The value to be compared against - The number of decimal places (valid values: 0-15) - Thrown when the values are not equal - - - - Verifies that two values are equal, within the number of decimal - places given by . - - The expected value - The value to be compared against - The number of decimal places (valid values: 0-15) - Thrown when the values are not equal - - - Do not call this method. - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that the provided object raised INotifyPropertyChanged.PropertyChanged - as a result of executing the given test code. - - The object which should raise the notification - The property name for which the notification should be raised - The test code which should cause the notification to be raised - Thrown when the notification is not raised - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given value. The collection may or may not - contain other values. - - The collection. - The value to find in the collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type which matches the given predicate. The - collection may or may not contain other values which do not - match the given predicate. - - The collection type. - The collection. - The item matching predicate. - The single item in the filtered collection. - Thrown when the filtered collection does - not contain exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Used by the PropertyChanged. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - Attribute that is applied to a method to indicate that it is a fact that should be run - by the test runner. It can also be extended to support a customized definition of a - test method. - - - - - Creates instances of which represent individual intended - invocations of the test method. - - The method under test - An enumerator through the desired test method invocations - - - - Enumerates the test commands represented by this test method. Derived classes should - override this method to return instances of , one per execution - of a test method. - - The test method - The test commands which will execute the test runs for the given method - - - - Gets the name of the test to be used when the test is skipped. Defaults to - null, which will cause the fully qualified test name to be used. - - - - - Obsolete. Please use the property instead. - - - - - Marks the test so that it will not be run, and gets or sets the skip reason - - - - - Marks the test as failing if it does not finish running within the given time - period, in milliseconds; set to 0 or less to indicate the method has no timeout - - - - - Used to decorate xUnit.net test classes that utilize fixture classes. - An instance of the fixture data is initialized just before the first - test in the class is run, and if it implements IDisposable, is disposed - after the last test in the class is run. - - The type of the fixture - - - - Called on the test class just before each test method is run, - passing the fixture data so that it can be used for the test. - All test runs share the same instance of fixture data. - - The fixture data - - - - Allows the user to record actions for a test. - - - - - Records any exception which is thrown by the given code. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Records any exception which is thrown by the given code that has - a return value. Generally used for testing property accessors. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Attributes used to decorate a test fixture that is run with an alternate test runner. - The test runner must implement the interface. - - - - - Creates a new instance of the class. - - The class which implements ITestClassCommand and acts as the runner - for the test fixture. - - - - Gets the test class command. - - - - - Exception that is thrown when one or more exceptions are thrown from - the After method of a . - - - - - Initializes a new instance of the class. - - The exceptions. - - - - Initializes a new instance of the class. - - The exceptions. - - - - Gets the list of exceptions thrown in the After method. - - - - - Gets a message that describes the current exception. - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - - - - Base attribute which indicates a test method interception (allows code to be run before and - after the test is run). - - - - - This method is called after the test method is executed. - - The method under test - - - - This method is called before the test method is executed. - - The method under test - - - - - - - Interface which describes the ability to executes all the tests in a test class. - - - - - Allows the test class command to choose the next test to be run from the list of - tests that have not yet been run, thereby allowing it to choose the run order. - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the type that is being tested - - - - - Represents an xUnit.net test class - - - - - Creates a new instance of the class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The type under test - - - - Chooses the next test to run, randomly, using the . - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the randomizer used to determine the order in which tests are run. - - - - - Sets the type that is being tested - - - - - Factory for objects, based on the type under test. - - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Runner that executes an synchronously. - - - - - Execute the . - - The test class command to execute - The methods to execute; if null or empty, all methods will be executed - The start run callback - The end run result callback - A with the results of the test run - - - - Implementation of which executes the - instances attached to a test method. - - - - - Base class used by commands which delegate to inner commands. - - - - - Interface which represents the ability to invoke of a test method. - - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Creates the start XML to be sent to the callback when the test is about to start - running. - - Return the of the start node, or null if the test - is known that it will not be running. - - - - Gets the display name of the test method. - - - - - Determines if the test runner infrastructure should create a new instance of the - test class before running the test. - - - - - Determines if the test should be limited to running a specific amount of time - before automatically failing. - - The timeout value, in milliseconds; if zero, the test will not have - a timeout. - - - - Creates a new instance of the class. - - The inner command to delegate to. - - - - - - - - - - - - - - - - - - - - - - Initializes a new instance of the class. - - The inner command. - The method. - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - This command sets up the necessary trace listeners and standard - output/error listeners to capture Assert/Debug.Trace failures, - output to stdout/stderr, and Assert/Debug.Write text. It also - captures any exceptions that are thrown and packages them as - FailedResults, including the possibility that the configuration - file is messed up (which is exposed when we attempt to manipulate - the trace listener list). - - - - - Initializes a new instance of the - class. - - The command that will be wrapped. - The test method. - - - - - - - Represents an implementation of to be used with - tests which are decorated with the . - - - - - Represents an xUnit.net test command. - - - - - The method under test. - - - - - Initializes a new instance of the class. - - The method under test. - The display name of the test. - The timeout, in milliseconds. - - - - - - - - - - - - - Gets the name of the method under test. - - - - - - - - - - - Gets the name of the type under test. - - - - - Initializes a new instance of the class. - - The test method. - - - - - - - Command used to wrap a which has associated - fixture data. - - - - - Creates a new instance of the class. - - The inner command - The fixtures to be set on the test class - - - - Sets the fixtures on the test class by calling SetFixture, then - calls the inner command. - - The instance of the test class - Returns information about the test run - - - - Command that automatically creates the instance of the test class - and disposes it (if it implements ). - - - - - Creates a new instance of the object. - - The command that is bring wrapped - The method under test - - - - Executes the test method. Creates a new instance of the class - under tests and passes it to the inner command. Also catches - any exceptions and converts them into s. - - The instance of the test class - Returns information about the test run - - - - Implementation of that represents a skipped test. - - - - - Creates a new instance of the class. - - The method that is being skipped - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - - - - - - - Gets the skip reason. - - - - - - - - Factory for creating objects. - - - - - Make instances of objects for the given class and method. - - The class command - The method under test - The set of objects - - - - A command wrapper which times the running of a command. - - - - - Creates a new instance of the class. - - The command that will be timed. - - - - Executes the inner test method, gathering the amount of time it takes to run. - - Returns information about the test run - - - - Wraps a command which should fail if it runs longer than the given timeout value. - - - - - Creates a new instance of the class. - - The command to be run - The timout, in milliseconds - The method under test - - - - Executes the test method, failing if it takes too long. - - Returns information about the test run - - - - - - - Base class for exceptions that have actual and expected values - - - - - The base assert exception class - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The user message to be displayed - - - - Initializes a new instance of the class. - - The user message to be displayed - The inner exception - - - - Initializes a new instance of the class. - - The user message to be displayed - The stack trace to be displayed - - - - Filters the stack trace to remove all lines that occur within the testing framework. - - The original stack trace - The filtered stack trace - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Gets the user message - - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - Set to true to skip the check for difference position - - - - Gets the actual value. - - - - - Gets the expected value. - - - - - Gets a message that describes the current exception. Includes the expected and actual values. - - The error message that explains the reason for the exception, or an empty string(""). - 1 - - - - Exception thrown when a collection unexpectedly does not contain the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - Creates a new instance of the class. - - The expected object value - The actual value - - - - Exception thrown when a collection unexpectedly contains the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - Exception thrown when code unexpectedly throws an exception. - - - - - Creates a new instance of the class. - - Actual exception - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a collection is unexpectedly not empty. - - - - - Creates a new instance of the class. - - - - - Exception thrown when two values are unexpectedly not equal. - - - - - Creates a new instance of the class. - - The expected object value - The actual object value - - - - Creates a new instance of the class. - - The expected object value - The actual object value - Set to true to skip the check for difference position - - - - Exception thrown when a value is unexpectedly true. - - - - - Creates a new instance of the class. - - The user message to be display, or null for the default message - - - - Exception thrown when a value is unexpectedly not in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Exception thrown when the value is unexpectedly not of the given type or a derived type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Exception thrown when the value is unexpectedly of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Exception thrown when the value is unexpectedly not of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Exception thrown when a collection is unexpectedly empty. - - - - - Creates a new instance of the class. - - - - - Exception thrown when two values are unexpectedly equal. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a value is unexpectedly in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Exception thrown when an object is unexpectedly null. - - - - - Creates a new instance of the class. - - - - - Exception thrown when two values are unexpected the same instance. - - - - - Creates a new instance of the class. - - - - - Exception thrown when an object reference is unexpectedly not null. - - - - - Creates a new instance of the class. - - - - - - Exception to be thrown from when the number of - parameter values does not the test method signature. - - - - - - - - - - - Exception thrown when code unexpectedly fails change a property. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The type of the exception that was expected - - - - Exception thrown when two object references are unexpectedly not the same instance. - - - - - Creates a new instance of the class. - - The expected object reference - The actual object reference - - - - Exception thrown when the collection did not contain exactly one element. - - - - - Initializes a new instance of the class. - - The numbers of items in the collection. - - - - Exception thrown when code unexpectedly fails to throw an exception. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The type of the exception that was expected - - - - Creates a new instance of the class. Call this constructor - when an exception of the wrong type was thrown. - - The type of the exception that was expected - The actual exception that was thrown - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a test method exceeds the given timeout value - - - - - Creates a new instance of the class. - - The timeout value, in milliseconds - - - - Exception that is thrown when a call to Debug.Assert() fails. - - - - - Creates a new instance of the class. - - The original assert message - - - - Creates a new instance of the class. - - The original assert message - The original assert detailed message - - - - Gets the original assert detailed message. - - - - - Gets the original assert message. - - - - - Gets a message that describes the current exception. - - - - - Exception thrown when a value is unexpectedly false. - - - - - Creates a new instance of the class. - - The user message to be displayed, or null for the default message - - - - Internal class used for version-resilient test runners. DO NOT CALL DIRECTLY. - Version-resilient runners should link against xunit.runner.utility.dll and use - ExecutorWrapper instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This class supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - Contains the test results from an assembly. - - - - - Contains multiple test results, representing them as a composite test result. - - - - - Base class which contains XML manipulation helper methods - - - - - Interface that represents a single test result. - - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - The amount of time spent in execution - - - - - Adds the test execution time to the XML node. - - The XML node. - - - - - - - - - - Adds a test result to the composite test result list. - - - - - - Gets the test results. - - - - - Creates a new instance of the class. - - The filename of the assembly - - - - Creates a new instance of the class. - - The filename of the assembly - The configuration filename - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified filename of the configuration file. - - - - - Gets the directory where the assembly resides. - - - - - Gets the number of failed results. - - - - - Gets the fully qualified filename of the assembly. - - - - - Gets the number of passed results. - - - - - Gets the number of skipped results. - - - - - Contains the test results from a test class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The simple name of the type under test - The fully qualified name of the type under test - The namespace of the type under test - - - - Sets the exception thrown by the test fixture. - - The thrown exception - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified test fixture exception type, when an exception has occurred. - - - - - Gets the number of tests which failed. - - - - - Gets the fully qualified name of the type under test. - - - - - Gets the test fixture exception message, when an exception has occurred. - - - - - Gets the simple name of the type under test. - - - - - Gets the namespace of the type under test. - - - - - Gets the number of tests which passed. - - - - - Gets the number of tests which were skipped. - - - - - Gets the test fixture exception stack trace, when an exception has occurred. - - - - - Represents a failed test result. - - - - - Represents the results from running a test method - - - - - Initializes a new instance of the class. The traits for - the test method are discovered using reflection. - - The method under test. - The display name for the test. If null, the fully qualified - type name is used. - - - - Initializes a new instance of the class. - - The name of the method under test. - The type of the method under test. - The display name for the test. If null, the fully qualified - type name is used. - The traits. - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets or sets the display name of the method under test. This is the value that's shown - during failures and in the resulting output XML. - - - - - Gets the name of the method under test. - - - - - Gets or sets the standard output/standard error from the test that was captured - while the test was running. - - - - - Gets the traits attached to the test method. - - - - - Gets the name of the type under test. - - - - - Creates a new instance of the class. - - The method under test - The exception throw by the test - The display name for the test. If null, the fully qualified - type name is used. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name of the test - The custom properties attached to the test method - The full type name of the exception throw - The exception message - The exception stack trace - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the exception type thrown by the test method. - - - - - Gets the exception message thrown by the test method. - - - - - Gets the stack trace of the exception thrown by the test method. - - - - - Represents a passing test result. - - - - - Create a new instance of the class. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - - - - Create a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The custom properties attached to the test method - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Represents a skipped test result. - - - - - Creates a new instance of the class. Uses reflection to discover - the skip reason. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The traits attached to the method under test - The skip reason - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the skip reason. - - - - - A timer class used to figure out how long tests take to run. On most .NET implementations - this will use the class because it's a high - resolution timer; however, on Silverlight/CoreCLR, it will use - (which will provide lower resolution results). - - - - - Creates a new instance of the class. - - - - - Starts timing. - - - - - Stops timing. - - - - - Gets how long the timer ran, in milliseconds. In order for this to be valid, - both and must have been called. - - - - - Utility methods for dealing with exceptions. - - - - - Gets the message for the exception, including any inner exception messages. - - The exception - The formatted message - - - - Gets the stack trace for the exception, including any inner exceptions. - - The exception - The formatted stack trace - - - - Rethrows an exception object without losing the existing stack trace information - - The exception to re-throw. - - For more information on this technique, see - http://www.dotnetjunkies.com/WebLog/chris.taylor/archive/2004/03/03/8353.aspx - - - - - Guard class, used for guard clauses and argument validation - - - - - - - - - - - - - - Represents information about an attribute. - - - - - Gets the instance of the attribute, if available. - - The type of the attribute - The instance of the attribute, if available. - - - - Gets an initialized property value of the attribute. - - The type of the property - The name of the property - The property value - - - - Represents information about a method. - - - - - Creates an instance of the type where this test method was found. If using - reflection, this should be the ReflectedType. - - A new instance of the type. - - - - Gets all the custom attributes for the method that are of the given type. - - The type of the attribute - The matching attributes that decorate the method - - - - Determines if the method has at least one instance of the given attribute type. - - The type of the attribute - True if the method has at least one instance of the given attribute type; false, otherwise - - - - Invokes the test on the given class, with the given parameters. - - The instance of the test class (may be null if - the test method is static). - The parameters to be passed to the test method. - - - - Gets a value which represents the class that this method was - reflected from (i.e., equivalent to MethodInfo.ReflectedType) - - - - - Gets a value indicating whether the method is abstract. - - - - - Gets a value indicating whether the method is static. - - - - - Gets the underlying for the method, if available. - - - - - Gets the name of the method. - - - - - Gets the fully qualified type name of the return type. - - - - - Gets the fully qualified type name of the type that this method belongs to. If - using reflection, this should be the ReflectedType. - - - - - Represents information about a type. - - - - - Gets all the custom attributes for the type that are of the given attribute type. - - The type of the attribute - The matching attributes that decorate the type - - - - Gets a test method by name. - - The name of the method - The method, if it exists; null, otherwise. - - - - Gets all the methods - - - - - - Determines if the type has at least one instance of the given attribute type. - - The type of the attribute - True if the type has at least one instance of the given attribute type; false, otherwise - - - - Determines if the type implements the given interface. - - The type of the interface - True if the type implements the given interface; false, otherwise - - - - Gets a value indicating whether the type is abstract. - - - - - Gets a value indicating whether the type is sealed. - - - - - Gets the underlying object, if available. - - - - - Utility class which inspects methods for test information - - - - - Gets the display name. - - The method to be inspected - The display name - - - - Gets the skip reason from a test method. - - The method to be inspected - The skip reason - - - - Gets the test commands for a test method. - - The method to be inspected - The objects for the test method - - - - Gets the timeout value for a test method. - - The method to be inspected - The timeout, in milliseconds - - - - Gets the traits on a test method. - - The method to be inspected - A dictionary of the traits - - - - Determines whether a test method has a timeout. - - The method to be inspected - True if the method has a timeout; false, otherwise - - - - Determines whether a test method has traits. - - The method to be inspected - True if the method has traits; false, otherwise - - - - Determines whether a test method should be skipped. - - The method to be inspected - True if the method should be skipped; false, otherwise - - - - Determines whether a method is a test method. A test method must be decorated - with the (or derived class) and must not be abstract. - - The method to be inspected - True if the method is a test method; false, otherwise - - - - A dictionary which contains multiple unique values for each key. - - The type of the key. - The type of the value. - - - - Adds the value for the given key. If the key does not exist in the - dictionary yet, it will add it. - - The key. - The value. - - - - Removes all keys and values from the dictionary. - - - - - Determines whether the dictionary contains to specified key and value. - - The key. - The value. - - - - Calls the delegate once for each key/value pair in the dictionary. - - - - - Removes the given key and all of its values. - - - - - Removes the given value from the given key. If this was the - last value for the key, then the key is removed as well. - - The key. - The value. - - - - Gets the values for the given key. - - - - - Gets the count of the keys in the dictionary. - - - - - Gets the keys. - - - - - - - - Wrapper to implement and using reflection. - - - - - Converts an into an using reflection. - - - - - - - Converts a into an using reflection. - - The method to wrap - The wrapper - - - - Converts a into an using reflection. - - The type to wrap - The wrapper - - - - Utility class which inspects types for test information - - - - - Determines if a type contains any test methods - - The type to be inspected - True if the class contains any test methods; false, otherwise - - - - Retrieves the type to run the test class with from the , if present. - - The type to be inspected - The type of the test class runner, if present; null, otherwise - - - - Retrieves a list of the test methods from the test class. - - The type to be inspected - The test methods - - - - Determines if the test class has a applied to it. - - The type to be inspected - True if the test class has a run with attribute; false, otherwise - - - - Determines if the type implements . - - The type to be inspected - True if the type implements ; false, otherwise - - - - Determines whether the specified type is abstract. - - The type. - - true if the specified type is abstract; otherwise, false. - - - - - Determines whether the specified type is static. - - The type. - - true if the specified type is static; otherwise, false. - - - - - Determines if a class is a test class. - - The type to be inspected - True if the type is a test class; false, otherwise - - - - XML utility methods - - - - - Adds an attribute to an XML node. - - The XML node. - The attribute name. - The attribute value. - - - - Adds a child element to an XML node. - - The parent XML node. - The child element name. - The new child XML element. - - - - Attribute used to decorate a test method with arbitrary name/value pairs ("traits"). - - - - - Creates a new instance of the class. - - The trait name - The trait value - - - - Gets the trait name. - - - - - - - - Gets the trait value. - - - - diff --git a/lib/xunit.sl/Silverlight-2.0/EULA.txt b/lib/xunit.sl/Silverlight-2.0/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.sl/Silverlight-2.0/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.sl/Silverlight-2.0/xunit-silverlight.dll b/lib/xunit.sl/Silverlight-2.0/xunit-silverlight.dll deleted file mode 100644 index 49b44cd833..0000000000 Binary files a/lib/xunit.sl/Silverlight-2.0/xunit-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-2.0/xunit-silverlight.pdb b/lib/xunit.sl/Silverlight-2.0/xunit-silverlight.pdb deleted file mode 100644 index 0e5d3d7b75..0000000000 Binary files a/lib/xunit.sl/Silverlight-2.0/xunit-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-2.0/xunit.extensions-silverlight.dll b/lib/xunit.sl/Silverlight-2.0/xunit.extensions-silverlight.dll deleted file mode 100644 index fdf6b9e64a..0000000000 Binary files a/lib/xunit.sl/Silverlight-2.0/xunit.extensions-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-2.0/xunit.extensions-silverlight.pdb b/lib/xunit.sl/Silverlight-2.0/xunit.extensions-silverlight.pdb deleted file mode 100644 index 394523aa37..0000000000 Binary files a/lib/xunit.sl/Silverlight-2.0/xunit.extensions-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-2.0/xunit.runner.silverlight.dll b/lib/xunit.sl/Silverlight-2.0/xunit.runner.silverlight.dll deleted file mode 100644 index 319a00e806..0000000000 Binary files a/lib/xunit.sl/Silverlight-2.0/xunit.runner.silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-2.0/xunit.runner.silverlight.pdb b/lib/xunit.sl/Silverlight-2.0/xunit.runner.silverlight.pdb deleted file mode 100644 index 72581f3479..0000000000 Binary files a/lib/xunit.sl/Silverlight-2.0/xunit.runner.silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-3.0/EULA.txt b/lib/xunit.sl/Silverlight-3.0/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.sl/Silverlight-3.0/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.sl/Silverlight-3.0/xunit-silverlight.dll b/lib/xunit.sl/Silverlight-3.0/xunit-silverlight.dll deleted file mode 100644 index 49b44cd833..0000000000 Binary files a/lib/xunit.sl/Silverlight-3.0/xunit-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-3.0/xunit-silverlight.pdb b/lib/xunit.sl/Silverlight-3.0/xunit-silverlight.pdb deleted file mode 100644 index 0e5d3d7b75..0000000000 Binary files a/lib/xunit.sl/Silverlight-3.0/xunit-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-3.0/xunit.extensions-silverlight.dll b/lib/xunit.sl/Silverlight-3.0/xunit.extensions-silverlight.dll deleted file mode 100644 index fdf6b9e64a..0000000000 Binary files a/lib/xunit.sl/Silverlight-3.0/xunit.extensions-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-3.0/xunit.extensions-silverlight.pdb b/lib/xunit.sl/Silverlight-3.0/xunit.extensions-silverlight.pdb deleted file mode 100644 index 394523aa37..0000000000 Binary files a/lib/xunit.sl/Silverlight-3.0/xunit.extensions-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-3.0/xunit.runner.silverlight.dll b/lib/xunit.sl/Silverlight-3.0/xunit.runner.silverlight.dll deleted file mode 100644 index 319a00e806..0000000000 Binary files a/lib/xunit.sl/Silverlight-3.0/xunit.runner.silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-3.0/xunit.runner.silverlight.pdb b/lib/xunit.sl/Silverlight-3.0/xunit.runner.silverlight.pdb deleted file mode 100644 index 72581f3479..0000000000 Binary files a/lib/xunit.sl/Silverlight-3.0/xunit.runner.silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/EULA.txt b/lib/xunit.sl/Silverlight-4.0-wp7/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.sl/Silverlight-4.0-wp7/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/Microsoft.Phone.Interop.dll b/lib/xunit.sl/Silverlight-4.0-wp7/Microsoft.Phone.Interop.dll deleted file mode 100644 index 59b04e1df2..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/Microsoft.Phone.Interop.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/Microsoft.Phone.dll b/lib/xunit.sl/Silverlight-4.0-wp7/Microsoft.Phone.dll deleted file mode 100644 index b63010be49..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/Microsoft.Phone.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/xunit-silverlight.dll b/lib/xunit.sl/Silverlight-4.0-wp7/xunit-silverlight.dll deleted file mode 100644 index 6f2ae2182f..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/xunit-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/xunit-silverlight.pdb b/lib/xunit.sl/Silverlight-4.0-wp7/xunit-silverlight.pdb deleted file mode 100644 index cda1dcc1e1..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/xunit-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.extensions-silverlight.dll b/lib/xunit.sl/Silverlight-4.0-wp7/xunit.extensions-silverlight.dll deleted file mode 100644 index b4fc7631b2..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.extensions-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.extensions-silverlight.pdb b/lib/xunit.sl/Silverlight-4.0-wp7/xunit.extensions-silverlight.pdb deleted file mode 100644 index 4988ac71bc..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.extensions-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.runner.silverlight.dll b/lib/xunit.sl/Silverlight-4.0-wp7/xunit.runner.silverlight.dll deleted file mode 100644 index 4b8a4e3e90..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.runner.silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.runner.silverlight.pdb b/lib/xunit.sl/Silverlight-4.0-wp7/xunit.runner.silverlight.pdb deleted file mode 100644 index 9e60aec67a..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp7/xunit.runner.silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/EULA.txt b/lib/xunit.sl/Silverlight-4.0-wp71/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.sl/Silverlight-4.0-wp71/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/Microsoft.Phone.Interop.dll b/lib/xunit.sl/Silverlight-4.0-wp71/Microsoft.Phone.Interop.dll deleted file mode 100644 index 59b04e1df2..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/Microsoft.Phone.Interop.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/Microsoft.Phone.dll b/lib/xunit.sl/Silverlight-4.0-wp71/Microsoft.Phone.dll deleted file mode 100644 index b63010be49..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/Microsoft.Phone.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/xunit-silverlight.dll b/lib/xunit.sl/Silverlight-4.0-wp71/xunit-silverlight.dll deleted file mode 100644 index 6f2ae2182f..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/xunit-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/xunit-silverlight.pdb b/lib/xunit.sl/Silverlight-4.0-wp71/xunit-silverlight.pdb deleted file mode 100644 index cda1dcc1e1..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/xunit-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.extensions-silverlight.dll b/lib/xunit.sl/Silverlight-4.0-wp71/xunit.extensions-silverlight.dll deleted file mode 100644 index b4fc7631b2..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.extensions-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.extensions-silverlight.pdb b/lib/xunit.sl/Silverlight-4.0-wp71/xunit.extensions-silverlight.pdb deleted file mode 100644 index 4988ac71bc..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.extensions-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.runner.silverlight.dll b/lib/xunit.sl/Silverlight-4.0-wp71/xunit.runner.silverlight.dll deleted file mode 100644 index 4b8a4e3e90..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.runner.silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.runner.silverlight.pdb b/lib/xunit.sl/Silverlight-4.0-wp71/xunit.runner.silverlight.pdb deleted file mode 100644 index 9e60aec67a..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0-wp71/xunit.runner.silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0/EULA.txt b/lib/xunit.sl/Silverlight-4.0/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.sl/Silverlight-4.0/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.sl/Silverlight-4.0/xunit-silverlight.dll b/lib/xunit.sl/Silverlight-4.0/xunit-silverlight.dll deleted file mode 100644 index a82b5520ff..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0/xunit-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0/xunit-silverlight.pdb b/lib/xunit.sl/Silverlight-4.0/xunit-silverlight.pdb deleted file mode 100644 index f78a8fd61d..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0/xunit-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0/xunit.extensions-silverlight.dll b/lib/xunit.sl/Silverlight-4.0/xunit.extensions-silverlight.dll deleted file mode 100644 index 2e34fd7b51..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0/xunit.extensions-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0/xunit.extensions-silverlight.pdb b/lib/xunit.sl/Silverlight-4.0/xunit.extensions-silverlight.pdb deleted file mode 100644 index f03f5c4978..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0/xunit.extensions-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0/xunit.runner.silverlight.dll b/lib/xunit.sl/Silverlight-4.0/xunit.runner.silverlight.dll deleted file mode 100644 index 5242d740b9..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0/xunit.runner.silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-4.0/xunit.runner.silverlight.pdb b/lib/xunit.sl/Silverlight-4.0/xunit.runner.silverlight.pdb deleted file mode 100644 index 45885e11a7..0000000000 Binary files a/lib/xunit.sl/Silverlight-4.0/xunit.runner.silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-5.0/EULA.txt b/lib/xunit.sl/Silverlight-5.0/EULA.txt deleted file mode 100644 index e7039f6dc8..0000000000 --- a/lib/xunit.sl/Silverlight-5.0/EULA.txt +++ /dev/null @@ -1,29 +0,0 @@ -This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. \ No newline at end of file diff --git a/lib/xunit.sl/Silverlight-5.0/xunit-silverlight.dll b/lib/xunit.sl/Silverlight-5.0/xunit-silverlight.dll deleted file mode 100644 index c6cfa0bb3a..0000000000 Binary files a/lib/xunit.sl/Silverlight-5.0/xunit-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-5.0/xunit-silverlight.pdb b/lib/xunit.sl/Silverlight-5.0/xunit-silverlight.pdb deleted file mode 100644 index 2a5cded6de..0000000000 Binary files a/lib/xunit.sl/Silverlight-5.0/xunit-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-5.0/xunit.extensions-silverlight.dll b/lib/xunit.sl/Silverlight-5.0/xunit.extensions-silverlight.dll deleted file mode 100644 index d84061c623..0000000000 Binary files a/lib/xunit.sl/Silverlight-5.0/xunit.extensions-silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-5.0/xunit.extensions-silverlight.pdb b/lib/xunit.sl/Silverlight-5.0/xunit.extensions-silverlight.pdb deleted file mode 100644 index 34e01e455c..0000000000 Binary files a/lib/xunit.sl/Silverlight-5.0/xunit.extensions-silverlight.pdb and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-5.0/xunit.runner.silverlight.dll b/lib/xunit.sl/Silverlight-5.0/xunit.runner.silverlight.dll deleted file mode 100644 index fee45ee414..0000000000 Binary files a/lib/xunit.sl/Silverlight-5.0/xunit.runner.silverlight.dll and /dev/null differ diff --git a/lib/xunit.sl/Silverlight-5.0/xunit.runner.silverlight.pdb b/lib/xunit.sl/Silverlight-5.0/xunit.runner.silverlight.pdb deleted file mode 100644 index cb3a1a8037..0000000000 Binary files a/lib/xunit.sl/Silverlight-5.0/xunit.runner.silverlight.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.dll b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.dll deleted file mode 100644 index 0c6df1878d..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.pdb b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.pdb deleted file mode 100644 index a86119c8cf..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.xml b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.xml deleted file mode 100644 index 477ce707e7..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.Silverlight.Testing.xml +++ /dev/null @@ -1,14796 +0,0 @@ - - - - Microsoft.Silverlight.Testing - - - - - A class containing an Assert method. - - - - - The MethodInfo object used to invoke Assert.IsNotNull. - - - - - The MethodInfo object used to invoke Assert.AreNotSame. - - - - - The MethodInfo object used to invoke Assert.AreNotEqual. - - - - - The MethodInfo object used to invoke Assert.AreSame. - - - - - The MethodInfo object used to invoke Assert.AreEqual. - - - - - The MethodInfo object used to invoke Assert.IsNull. - - - - - The MethodInfo object used to invoke Assert.IsFalse. - - - - - The MethodInfo object used to invoke Assert.IsTrue. - - - - - A regular expression which identifies a pattern signifying an - anonymous type. This pattern is emitted by the Expression object - when it converts an anonymous type to a string. - - - - - A regular expression which identifies a pattern emitted by an - Expression object when it converts an anonymous type to a - string. - - - - - Asserts a condition is true. - - The condition that must be true. - - - - Asserts a condition is true. - - The condition that must be true. - The message to be displayed when the test fails. - - - - Generates an assert failure message using the code block - responsible for the failure. - - The predicate that fails. - The user-provided assertion failure message. - - A constant expression containing the user-provided failure - message or a description of the expression that failed. - - - - Analyzes the expression and creates an action which calls the - correct assert method based on its contents. - - The predicate expression. - The message to display if an assertion fails. - An action which calls the correct assert method. - - - - Analyzes a predicate expression and invokes the correct assert - method. - - The type of the argument to the predicate. - - A predicate to be converted into an - assert statement. - The assertion message. - - - - Creates an action from certain types of supported binary expression - patterns. If no supported pattern is found null is returned. Based - on analyzing the predicate the action invokes the correct Assert - method. - - A binary expression extracted from a - predicate expression. - The message to display if the assertion - fails. - An action that invokes an Assert method. - - - - Mark the test method as one which expects asynchronous execution. - It is important to call TestComplete() once it is ready or your - test will never continue/timeout. - - - - - An attribute that contains known bug information that can be logged - during a unit test run. - - When applied to a test method, it will invert the result. This makes it - possible to perform automated runs and continuous integration while - validating and tracking known issues. - - The attribute should have the Fixed bool set to True, or be removed, - once the issue is resolved. - - - - - Construct a new BugAttribute with no bug description. - - - - - Construct a new BugAttribute with a bug description. - - Known issue text. - - - - Return the bug information. - - Known issue as a string. - - - - Gets the bug description. - - - - - Gets or sets a value indicating whether the known issue has been - fixed. If it has, the attribute is ignored and will not affect - test results. - - - - - Represents a control that builds on top of the standard platform Button, - offering the ability to modify the corner radii or even use special - button modes. - - - - - Identifies the SecondaryVisibility dependency property. - - - - - Identifies the CornerRadius dependency property. - - - - - Gets or sets the visibility of a secondary set of visuals in the - template. - - - - - Gets or sets the corner radius to use. - - - - - A color selection converter for translating a bool result into - a color. - - - - - Initializes a new instance of the ColorSelectorConverter type. - - - - - Convert a boolean value to a Color value. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support 2-way databinding of the VisibilityConverter, converting - Visibility to a boolean. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Gets or sets the color to use for true values. - - - - - Gets or sets the color to use for false values. - - - - - A set of extension methods for manipulating collections. - - Experimental - - - - Returns a value indicating whether a collection is read-only. - - The collection to examine. - A value indicating whether a collection is read-only. - - - - Returns a value Indicating whether an item can be inserted in a - collection. - - The collection. - The item to be inserted. - A value Indicating whether an item can be inserted in a - collection. - - - - Inserts an item into the collection at an index. - - The collection. - The index at which to insert the item. - The item to be inserted. - - - - Gets the number of items in the collection. - - The collection. - The number of items in the collection. - - - - Adds an item to the collection. - - The collection. - The item to be added. - - - - Removes an item from the collection. - - The collection. - The item to be removed. - - - - Removes an item at a given index from the collection. - - The collection. - The index of the item to be removed. - - - - A color selection converter for translating a bool result into - a color. - - - - - The default true color. - - - - - The default false color. - - - - - Initializes a new instance of the ColorSelectorConverter type. - - - - - Convert a boolean value to a Color value. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support 2-way databinding of the VisibilityConverter, converting - Visibility to a boolean. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Gets or sets the color to use for true values. - - - - - Gets or sets the color to use for false values. - - - - - A set of extension methods for the sequence class. - ;dsf - - - - Produces a sequence of items using a seed value and iteration - method. - - The type of the sequence. - The initial value. - The iteration function. - A sequence of items using a seed value and iteration - method. - - - - Prepend an item to a sequence. - - The type of the sequence. - The sequence to append the item to. - The item to append to the sequence. - A new sequence. - - - - Accepts two sequences and applies a function to the corresponding - values in the two sequences. - - The type of the first sequence. - The type of the second sequence. - The return type of the function. - The first sequence. - The second sequence. - The function to apply to the corresponding values - from the two sequences. - A sequence of transformed values from both sequences. - - - - A converter for modifying the font weight based on a parameter. - - - - - Convert a boolean value to a FontWeight value. - - The value object. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support 2-way databinding of the VisibilityConverter, converting - Visibility to a bool. - - The value object. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Determine the visibility mode based on a converter parameter. This - parameter is of type Visibility, and specifies what visibility value - to return when the boolean value is true. - - The parameter object. - Returns a FontWeight value. - - - - Determine whether or not weight is inverted based on a converter - parameter. - - The parameter instance. - Returns a value indicating whether the instance is - inverting. - - - - Collection of functions for functional programming tasks. - - - - - Traverses a tree by accepting an initial value and a function that - retrieves the child nodes of a node. - - The type of the stream. - The initial node. - A function that retrieves the child - nodes of a node. - A predicate that evaluates a node - and returns a value indicating whether that node and it's children - should be traversed. - A stream of nodes. - - - - The test results header control. - - - - - Initializes a new instance of the Header type. - - - - - InitializeComponent - - - - - A value converter for collapsing or showing elements based on the bound - object's type name. Does not walk the hierarchy - it is explicit to the - most specific class for the value. This class, - InvertedTypeNameVisibilityConverter, offers the opposite behavior of the - TypeNameVisibilityConverter class. - - - - - A value converter for collapsing or showing elements based on the bound - object's type name. Does not walk the hierarchy - it is explicit to the - most specific class for the value. - - - - - Convert a value based on CLR type to a Visibility value. Does not - walk the type tree, however. - - The value instance. - The target parameter. - ConverterParameter is the name of the type, - both short and full names are checked, short name first. - The culture parameter. - Returns the object. - - - - Convert back, not supported with this value converter. - - The value instance. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Gets a value indicating whether the visibility value should be - inverted. - - - - - Gets a value indicating whether the visibility value should be - inverted. - - - - - Provides useful extensions to ItemsControl instances. - - Experimental - - - - Gets the Panel that contains the containers of an ItemsControl. - - The ItemsControl. - - The Panel that contains the containers of an ItemsControl, or null - if the Panel could not be found. - - - is null. - - - - - Gets the ScrollViewer that contains the containers of an - ItemsControl. - - The ItemsControl. - - The ScrollViewer that contains the containers of an ItemsControl, or - null if a ScrollViewer could not be found. - - - is null. - - - - - Get the item containers of an ItemsControl. - - The ItemsControl. - The item containers of an ItemsControl. - - is null. - - - - - Get the item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The item containers of an ItemsControl. - - is null. - - - - - Get the item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The item containers of an ItemsControl. - - - - Get the items and item containers of an ItemsControl. - - The ItemsControl. - The items and item containers of an ItemsControl. - - is null. - - - - - Get the items and item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The items and item containers of an ItemsControl. - - is null. - - - - - Get the items and item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The items and item containers of an ItemsControl. - - is null. - - - - - Returns a value indicating whether an item can be added to an - ItemsControl. - - The ItemsControl instance. - The item to be added. - A value Indicating whether an item can be added to an - ItemsControl. - - - - Returns a value indicating whether an item can be removed from the - ItemsControl. - - The items control. - A value indicating whether an item can be removed from the - ItemsControl. - - - - Inserts an item into an ItemsControl. - - The ItemsControl instance. - The index at which to insert the item. - The item to be inserted. - - - - Adds an item to an ItemsControl. - - The ItemsControl instance. - The item to be inserted. - - - - Removes an item from an ItemsControl. - - The ItemsControl instance. - The item to be removed. - - - - Removes an item from an ItemsControl. - - The ItemsControl instance. - The index of the item to be removed. - - - - Gets the number of items in an ItemsControl. - - The ItemsControl instance. - The number of items in the ItemsControl. - - - - Represents a control that applies a layout transformation to its Content. - - Preview - - - - Name of the TransformRoot template part. - - - - - Name of the Presenter template part. - - - - - Acceptable difference between two doubles. - - - - - Number of decimals to round the Matrix to. - - - - - Identifies the LayoutTransform DependencyProperty. - - - - - Root element for performing transformations. - - - - - ContentPresenter element for displaying the content. - - - - - RenderTransform/MatrixTransform applied to _transformRoot. - - - - - Transformation matrix corresponding to _matrixTransform. - - - - - Actual DesiredSize of Child element (the value it returned from its MeasureOverride method). - - - - - Initializes a new instance of the LayoutTransformer class. - - - - - Builds the visual tree for the LayoutTransformer control when a new - template is applied. - - - - - Handles changes to the Transform DependencyProperty. - - Source of the change. - Event args. - - - - Applies the layout transform on the LayoutTransformer control content. - - - Only used in advanced scenarios (like animating the LayoutTransform). - Should be used to notify the LayoutTransformer control that some aspect - of its Transform property has changed. - - - - - Processes the Transform to determine the corresponding Matrix. - - Transform to process. - - - - Walks the Transform(Group) and returns the corresponding Matrix. - - Transform(Group) to walk. - Computed Matrix. - - - - Provides the behavior for the "Measure" pass of layout. - - The available size that this element can give to child elements. - The size that this element determines it needs during layout, based on its calculations of child element sizes. - - - - Provides the behavior for the "Arrange" pass of layout. - - The final area within the parent that this element should use to arrange itself and its children. - The actual size used. - - Using the WPF paramater name finalSize instead of Silverlight's finalSize for clarity - - - - - Compute the largest usable size (greatest area) after applying the transformation to the specified bounds. - - Arrange bounds. - Largest Size possible. - - - - Returns true if Size a is smaller than Size b in either dimension. - - Second Size. - First Size. - True if Size a is smaller than Size b in either dimension. - - - - Rounds the non-offset elements of a Matrix to avoid issues due to floating point imprecision. - - Matrix to round. - Number of decimal places to round to. - Rounded Matrix. - - - - Implements WPF's Rect.Transform on Silverlight. - - Rect to transform. - Matrix to transform with. - Bounding box of transformed Rect. - - - - Implements WPF's Matrix.Multiply on Silverlight. - - First matrix. - Second matrix. - Multiplication result. - - - - Implements WPF's Matrix.HasInverse on Silverlight. - - Matrix to check for inverse. - True if the Matrix has an inverse. - - - - Outputs diagnostic info if DIAGNOSTICWRITELINE is defined. - - Diagnostic message. - - - - Gets or sets the layout transform to apply on the LayoutTransformer - control content. - - - Corresponds to UIElement.LayoutTransform. - - - - - Gets the child element being transformed. - - - - - The TagEditor control provides a brief user interface allowing for the - selection of a set of tests, used to filter the test run. - - - - - Key used to lookup the TagHistory site setting. - - - - - Number of seconds to wait before running the test. - - - - - Initializes a new instance of the TagEditor type. - - The tag expression to use. - - - - Initializes a new instance of the TagEditor type. - - - - - Fires the Complete event. - - The event arguments. - - - - Handle touch of the button to display the text box. - - Tag button. - Event arguments. - - - - Handle selection of a tag button. - - Tag button. - Event arguments. - - - - Handle changes to the Tag text. - - Tag TextBox. - Event arguments. - - - - Handle clicks to the Run button. - - Run Button. - Event arguments. - - - - Handle timer ticks. - - The timer. - Event arguments. - - - - Stop the timer. - - - - - Run the unit tests. - - - - - Cancels the selection of a tag expression. - - The source object. - The event data. - - - - InitializeComponent - - - - - Gets or sets the timer used to automatically run tests if no tag is - entered. - - - - - Gets or sets the number of seconds already waited. - - - - - Gets or sets the tag history. - - - - - An event that indicates that the tag editor is complete. This can be - in response to many actions: the user entering a tag expression, the - time expiring and the default being selected, or the selection being - canceled. - - - - - Mobile test exceptions page. - - - - - Initializes a new instance of the page. - - - - - InitializeComponent - - - - - Mobile test method details page. - - - - - Initializes a new instance of the page. - - - - - InitializeComponent - - - - - A user control designed for mobile platforms. The control should be used - as the root visual for a Silverlight plugin if developers would like to - use the advanced TestSurface functionality. - - - - - An interface for any test page instances to implement. - - - - - Gets the test panel instance. - - - - - An interface for any test page instances to implement. - - - - - Requests navigation back a page. - - A value indicating whether the operation was successful. - - - - Contains the slide manager for the primitive user interface - navigation system. - - - - - Backing field for the unit test harness instance. - - - - - Backing field for the startup timer. - - - - - Backing field for the model manager. - - - - - Initializes a new instance of the MobileTestPage class. - - - - - Initializes the MobileTestPage object. - - The test harness instance. - - - - Waits for the Settings to become available, either by the service or - system setting the instance property. - - The source timer. - The event arguments. - - - - Creates a new slide and inserts it into the slide manager, plus - visual tree. - - The text header to use. - The content to inside the slide. - Returns the new Slide instance. - - - - Handles the completion event on the tag expression editor to begin - the test run using the user-provided settings. - - The source object. - The event arguments. - - - - Starts the test run. - - - - - Handles the test harness complete event, to display results. - - The source object. - The event data. - - - - Handles the movement back to the test assemblies list. - - The source object. - The event arguments. - - - - Handles the movement back to the test classes list. - - The source object. - The event arguments. - - - - Handles the movement back to the test methods list. - - The source object. - The event arguments. - - - - Handles the selection of a test assembly. - - The source object. - The event arguments. - - - - Handles the selection of a test class. - - The source object. - The event arguments. - - - - Handles the selection of a test method. - - The source object. - The event arguments. - - - - Requests navigation back a page. - - A value indicating whether the operation was successful. - - - - InitializeComponent - - - - - Gets the test surface, a dynamic Panel that removes its children - elements after each test completes. - - - - - Gets the unit test harness instance. - - - - - A derived TreeView control specific to the application needs for - showing results in real-time. - - - - - Represents a control that displays hierarchical data in a tree structure - that has items that can expand and collapse. - - Stable - - - - The IUpdateVisualState interface is used to provide the - InteractionHelper with access to the type's UpdateVisualState method. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - A value indicating whether a read-only dependency property change - handler should allow the value to be set. This is used to ensure - that read-only properties cannot be changed via SetValue, etc. - - - - - A value indicating whether a dependency property change handler - should ignore the next change notification. This is used to reset - the value of properties without performing any of the actions in - their change handlers. - - - - - Identifies the - - dependency property. - - - The identifier for the - - property. - - - - - SelectedItemProperty property changed handler. - - TreeView that changed its SelectedItem. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - SelectedValueProperty property changed handler. - - TreeView that changed its SelectedValue. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - SelectedValuePathProperty property changed handler. - - TreeView that changed its SelectedValuePath. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - ItemContainerStyleProperty property changed handler. - - - TreeView that changed its ItemContainerStyle. - - Event arguments. - - - - Initializes a new instance of the - class. - - - - - Returns a - - for use by the Silverlight automation infrastructure. - - - A - - for the control. - - - - - Builds the visual tree for the - control when a new - control template is applied. - - - - - Update the visual state of the TreeView. - - - A value indicating whether to use transitions when updating the - visual state. - - - - - Creates a to - display content. - - - A to use as a - container for content. - - - - - Determines whether the specified item is a - , which is the - default container for items in the - control. - - The object to evaluate. - - True if the item is a - ; otherwise, - false. - - - - - Prepares the container element to display the specified item. - - - The container element used to display the specified item. - - The item to display. - - - - Removes all templates, styles, and bindings for the object displayed - as a . - - - The element to - clear. - - - The item that is contained in the - . - - - - - Makes adjustments to the - control when the - value of the - property - changes. - - - A - - that contains data about the change. - - - - - Select any descendents when adding new TreeViewItems to a TreeView. - - The added item. - - - - Propagate OnKeyDown messages from the root TreeViewItems to their - TreeView. - - Event arguments. - - Because Silverlight's ScrollViewer swallows many useful key events - (which it can ignore on WPF if you override HandlesScrolling or use - an internal only variable in Silverlight), the root TreeViewItems - explicitly propagate KeyDown events to their parent TreeView. - - - - - Provides handling for the - event when a key - is pressed while the control has focus. - - - A that contains - the event data. - - - is null. - - - - - Handle keys related to scrolling. - - The key to handle. - A value indicating whether the key was handled. - - - - Handle scrolling a page up or down. - - - A value indicating whether the page should be scrolled up. - - - A value indicating whether the scroll was handled. - - - - - Provides handling for the KeyUp event. - - Event arguments. - - - - Provides handling for the MouseEnter event. - - Event arguments. - - - - Provides handling for the MouseLeave event. - - Event arguments. - - - - Provides handling for the MouseMove event. - - Event arguments. - - - - Provides handling for the - - event. - - - A that - contains the event data. - - - - - Provides handling for the MouseLeftButtonUp event. - - Event arguments. - - - - Provides handling for mouse button events. - - A value indicating whether the event was handled. - - - - Provides handling for the GotFocus event. - - Event arguments. - - - - Provides handling for the LostFocus event. - - Event arguments. - - - - Raises the - - event when the - - property value changes. - - - A - that contains the event data. - - - - - Change whether a TreeViewItem is selected. - - - Item whose selection is changing. - - - Container of the item whose selection is changing. - - - A value indicating whether the TreeViewItem is selected. - - - - - Update the selected value of the of the TreeView based on the value - of the currently selected TreeViewItem and the SelectedValuePath. - - - Value of the currently selected TreeViewItem. - - - - - Select the first item of the TreeView. - - - - - Focus the first item in the TreeView. - - A value indicating whether the item was focused. - - - - Focus the last item in the TreeView. - - A value indicating whether the item was focused. - - - - Gets the selected item in a - . - - - The currently selected item or null if no item is selected. The - default value is null. - - - - - Gets the value of the - - property that is specified by the - - property. - - - The value of the - - property that is specified by the - - property, or null if no item is selected. The default value is null. - - - - - Gets or sets the property path that is used to get the - - property of the - - property in a . - - - The property path that is used to get the - - property of the - - property in a . The - default value is . - - - - - Gets or sets the that is - applied to the container element generated for each item. - - - The applied to the container - element that contains each item. - - - - - Gets the currently selected TreeViewItem container. - - - - - Gets a value indicating whether the currently selected TreeViewItem - container is properly hooked up to the TreeView. - - - - - Gets or sets a value indicating whether the selected item is - currently being changed. - - - - - Gets the ItemsControlHelper that is associated with this control. - - - - - Gets the helper that provides all of the standard - interaction functionality. - - - - - Gets a value indicating whether the Control key is currently - pressed. - - - - - Gets a value indicating whether the Shift key is currently pressed. - - - - - Occurs when the value of the - - property changes. - - - - - Overrides the item to allow for simple binding to the expanded - property on the item. - - Returns a new container for an item. - - - - This method returns the container with an expanded binding. - - Returns the container with an expanded binding. - - - - A derived TreeViewItem for IsExpanded binding. - - - - - Provides a selectable item for the - control. - - Stable - - - - Represents a control that contains a collection of items and a header. - - Stable - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - Note: WPF defines this property via a call to AddOwner of - HeaderedContentControl's HeaderProperty. - - - - - HeaderProperty property changed handler. - - - HeaderedItemsControl that changed its Header. - - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - Note: WPF defines this property via a call to AddOwner of - HeaderedContentControl's HeaderTemplateProperty. - - - - - HeaderTemplateProperty property changed handler. - - - HeaderedItemsControl that changed its HeaderTemplate. - - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - ItemContainerStyleProperty property changed handler. - - - HeaderedItemsControl that changed its ItemContainerStyle. - - Event arguments. - - - - Initializes a new instance of the - class. - - - - - Called when the value of the - - property changes. - - - The old value of the - - property. - - - The new value of the - - property. - - - - - Called when the value of the - - property changes. - - - The old value of the - - property. - - - The new value of the - - property. - - - - - Builds the visual tree for the - when a - new template is applied. - - - - - Prepares the specified element to display the specified item. - - - The container element used to display the specified item. - - The content to display. - - - - Prepares the specified container to display the specified item. - - - Container element used to display the specified item. - - Specified item to display. - The parent ItemsControl. - - The ItemContainerStyle for the parent ItemsControl. - - - - - Prepare a PrepareHeaderedItemsControlContainer container for an - item. - - Container to prepare. - Item to be placed in the container. - The parent ItemsControl. - - The ItemContainerStyle for the parent ItemsControl. - - - - - Check whether a control has the default value for a property. - - The control to check. - The property to check. - - True if the property has the default value; false otherwise. - - - - - Gets or sets a value indicating whether the Header property has been - set to the item of an ItemsControl. - - - - - Gets or sets the item that labels the control. - - - The item that labels the control. The default value is null. - - - - - Gets or sets a data template that is used to display the contents of - the control's header. - - - Gets or sets a data template that is used to display the contents of - the control's header. The default is null. - - - - - Gets or sets the that is - applied to the container element generated for each item. - - - The that is applied to the - container element generated for each item. The default is null. - - - - - Gets the ItemsControlHelper that is associated with this control. - - - - - The name of the ExpanderButton template part. - - - - - The name of the Header template part. - - - - - The ExpanderButton template part is used to expand and collapse the - TreeViewItem. - - - - - The Header template part is used to distinguish the bound Header - content of the TreeViewItem. - - - - - The ExpansionStates visual state group. - - - - - A value indicating whether a read-only dependency property change - handler should allow the value to be set. This is used to ensure - that read-only properties cannot be changed via SetValue, etc. - - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - HasItemsProperty property changed handler. - - TreeViewItem that changed its HasItems. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - IsExpandedProperty property changed handler. - - TreeViewItem that changed its IsExpanded. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - IsSelectedProperty property changed handler. - - TreeViewItem that changed its IsSelected. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - IsSelectionActiveProperty property changed handler. - - TreeViewItem that changed its IsSelectionActive. - Event arguments. - - - - A reference to the parent ItemsControl of a TreeViewItem. - - - - - Initializes a new instance of the - class. - - - - - Returns a - - for use by the Silverlight automation infrastructure. - - - A - - object for the - . - - - - - Builds the visual tree for the - control when a - new control template is applied. - - - - - Provides handling for the ExpansionStates CurrentChanged event. - - The ExpansionState VisualStateGroup. - Event arguments. - - - - Scroll the TreeViewItem into view. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - Creates a to - display content. - - - A to use as a - container for content. - - - - - Determines whether an object is a - . - - The object to evaluate. - - True if is a - ; otherwise, - false. - - - - - Prepares the specified container element to display the specified - item. - - - Container element used to display the specified item. - - The item to display. - - - - Removes all templates, styles, and bindings for the object displayed - as a . - - - The element to - clear. - - - The item that is contained in the - . - - - - - Makes adjustments to the - when the value - of the - property changes. - - - A - - that contains data about the change. - - - - - Raise a RoutedEvent. - - Event handler. - Event arguments. - - - - Raises an - event - when the - - property changes from false to true. - - - A that contains the - event data. - - - - - Raises a - - event when the - - property changes from true to false. - - - A that contains the - event data. - - - - - Handle changes to the IsExpanded property. - - Event handler. - Event arguments. - - - - Raises the - event - when the - - property changes from false to true. - - - A that contains the - event data. - - - - - Raises the - - event when the - - property changes from true to false. - - - A that contains the - event data. - - - - - Provides handling for the - event. - - - A that contains the - event data. - - - - - Provides handling for the - event. - - - A that contains the - event data. - - - - - Handle the ExpanderButton's GotFocus event. - - The ExpanderButton. - Event Arguments. - - - - Provides handling for the - event. - - - A that contains - the event data. - - - - - Provides handling for the - event. - - - A that contains - the event data. - - - - - Provides handling for the Header's MouseLeftButtonDown event. - - The Header template part. - Event arguments. - - - - Provides handling for the ExpanderButton's Click event. - - The ExpanderButton. - Event Arguments. - - - - Provides handling for the - event. - - - A that - contains the event data. - - - - - Provides handling for the - event. - - - A that - contains the event data. - - - - - Provides handling for the - event when the - has focus. - - - A that contains - the event data. - - - - - Try moving the focus down from the selected item. - - - A value indicating whether the focus was successfully moved. - - - - - Provides handling for the - event. - - - A that contains - the event data. - - - - - Try moving the focus up from the selected item. - - - A value indicating whether the focus was successfully moved. - - - - - Handle scrolling a page up or down. - - - A value indicating whether the page should be scrolled up. - - The ScrollViewer being scrolled. - The height of the viewport. - The top of item to start from. - The bottom of the item to start from. - The height of this item. - - A value indicating whether the scroll was handled. - - - - - Calculate the distance between this TreeViewItem and the item being - paged from. - - - A value indicating whether the page should be scrolled up. - - The element being paged from. - The ScrollViewer being scrolled. - The top of item to start from. - The bottom of the item to start from. - - The distance between the top/bottom of one item to the other. - - - A value indicating whether the scroll was handled. - - - - - Change the selected status of the TreeViewItem. - - - A value indicating whether the TreeViewItem is selected. - - - - - Update the ancestors of this item when it changes selection. - - - A value indicating whether the item is selected. - - - Unselection updates need to occur before selection updates because - the old and new selected items may share a partial path. - - - - - Determine whether the TreeViewItem should be allowed to handle a key - event. - - - A value indicating whether the key event should be handled. - - - - - Navigate the focus to the next TreeViewItem below this item. - - - A value indicating whether the focus was navigated. - - - - - Navigate the focus to the very last TreeViewItem descendent of the - this item. - - - A value indicating whether the focus was navigated. - - - - - Find the next focusable TreeViewItem below this item. - - - A value indicating whether the item should recurse into its child - items when searching for the next focusable TreeViewItem. - - The next focusable TreeViewItem below this item. - - - - Find the last focusable TreeViewItem contained by this item. - - - The last focusable TreeViewItem contained by this item. - - - - - Find the previous focusable TreeViewItem above this item. - - - The previous focusable TreeViewItem above this item. - - - - - Gets or sets the ExpanderButton template part is used to expand and - collapse the TreeViewItem. - - - - - Gets the Header template part that is used to distinguish the bound - Header content of the TreeViewItem. - - - - - Gets or sets the ExpansionStates visual state group. - - - - - Gets or sets a value indicating whether a dependency property change - handler should ignore the next change notification. This is used to - reset the value of properties without performing any of the actions - in their change handlers. - - - - - Gets a value indicating whether this - contains - items. - - - True if this - contains items; otherwise, false. The default is false. - - - - - Gets or sets a value indicating whether the - - contained by this - are expanded - or collapsed. - - - True to indicate the contents of the - - collection are expanded; false to indicate the items are collapsed. - The default is false. - - - - - Gets or sets a value indicating whether this - is selected. - - - True if this - is selected; otherwise, false. The default is false. - - - - - Gets a value indicating whether the - has focus. - - - True if this - has focus; otherwise, false. The default is false. - - - - - Gets the helper that provides all of the standard - interaction functionality. - - - - - Gets or sets a value indicating whether the TreeView's currently - selected item is a descendent of this TreeViewItem. - - - - - Gets or sets a value indicating whether the TreeViewItem should - ignore the next GotFocus event it receives because it has already - been handled by one of its children. - - - - - Gets or sets a value indicating whether checking ContainsSelection - should actually perform the update notifications because the item - was selected before it was in the visual tree. - - - - - Gets or sets a value indicating whether a user initiated action - caused the IsExpanded property to be set. - - - - - Gets or sets a reference to the parent ItemsControl of a - TreeViewItem. - - - - - Gets a reference to the parent TreeViewItem of this TreeViewItem. - - - - - Gets a reference to the parent TreeView of the TreeViewItem. - - - - - Gets a value indicating whether this TreeViewItem is a root of the - TreeView. - - - - - Gets a value indicating whether the TreeViewItem can expand when it - receives appropriate user input. - - - - - Occurs when the - - property changes from true to false. - - - - - Occurs when the - - property changes from false to true. - - - - - Occurs when the - - property of a - changes from false to true. - - - - - Occurs when the - - property of a - changes from true to false. - - - - - Overrides the item to allow for simple binding to the expanded - property on the item. - - Returns a new container for an item. - - - - Overrides the key down event to allow toggling the space. - - The key event arguments data. - - - - A specialized content control that contains a fixed header, a standard - header content property, plus content. It is designed specifically for - a "slide-based" user interface for simple user interfaces. - - - - - The visual state group name for slide position. - - - - - The visual state name for left position. - - - - - The visual state name for right position. - - - - - The normal visual state name for position. - - - - - The content template part name. - - - - - The header template part name. - - - - - The fixed header template name. - - - - - The manager of the slide and its siblings. - - - - - Identifies the Header dependency property. - - - - - Identifies the FixedHeader dependency property. - - - - - Identifies the Position dependency property. - - - - - PositionProperty property changed handler. - - Slide that changed its Position. - Event arguments. - - - - Initializes a new instance of the Slide class. - - - - - Remove the slide from the parent manager. - - - - - Locate template parts and assign instances to fields during template - application. - - - - - Fires the slide changed event. - - - - - Fires the current state changed event. - - The source object. - The event arguments. - - - - Helps debugging by providing information about the slide name. - - Returns the name of the slide. - - - - Updates the visual state. - - A value indicating whether to use - visual transitions for the state change. - The slide position to use. - - - - Event fired when the current slide changes. - - - - - Gets or sets the primary header content. - - - - - Gets or sets the fixed header content. - - - - - Gets or sets the position of the slide. - - - - - Gets or sets the slide manager for the slide. - - - - - A helper class to managing sets of slides. - - - - - Initializes a new instance of the SlideManager class. - - - - - Stores the linked list node for the current slide. - - - - - Backing field for the set of slides. - - - - - Adds a slide or an array of slides to the managed slide set. - - The slides to manage. - - - - Initializes the position of the slide based on location. - - The slide instance. - A property indicating whether the slide is the - first to be managed. - - - - Manages a new slide, inserting it after an existing slide node. - - The node to insert after. - The new slide instance. - Returns the linked list node that is inserted. - - - - Inserts a slide as the first in the linked list. - - The new slide instance. - Returns the linked list node. - - - - Insert a slide after a provided linked list node. - - The node to insert after. - The new slide to insert. - Returns the new linked list node. - - - - Remove a slide from management. - - The slide instance. - - - - Move to the previous slide. - - - - - Move to the next slide. - - - - - Moves to a specific slide, moving the others to the appropriate - direction on screen. - - The slide to move to. - - - - Move in a direction. - - A value indicating whether the direction to - move is forward or not. - - - - Gets the current slide instance. - - - - - Indicates the position that the slide should have. - - - - - Normal position, centered on the screen. - - - - - To the left of the screen. - - - - - To the right of the screen. - - - - - The TagEditor control provides a brief user interface allowing for the - selection of a set of tests, used to filter the test run. - - - - - Key used to lookup the TagHistory site setting. - - - - - Key used to lookup whether the last run used tag expressions. - - - - - Number of seconds to wait before running the test. - - - - - Backing field for the last run used value. - - - - - Initializes a new instance of the TagEditor type. Also includes a - set of sample tags for display to the end user. - - The tag expression to use. - Sample tags to display. - - - - Initializes a new instance of the TagEditor type. - - The tag expression to use. - - - - Initializes a new instance of the TagEditor type. - - - - - Handles the key down event. - - The key event arguments. - - - - Fires the Complete event. - - The event arguments. - - - - Creates a new button. - - The button content. - Returns a new Button instance. - - - - Handle selection of a tag button. - - Tag button. - Event arguments. - - - - Handle changes to the Tag text. - - Tag TextBox. - Event arguments. - - - - Handle clicks to the Run button. - - Run Button. - Event arguments. - - - - Handle timer ticks. - - The timer. - Event arguments. - - - - Stop the timer. - - - - - Run the unit tests. - - - - - Cancels the selection of a tag expression. - - The source object. - The event data. - - - - InitializeComponent - - - - - Gets or sets the timer used to automatically run tests if no tag is - entered. - - - - - Gets or sets the number of seconds already waited. - - - - - Gets or sets the tag history. - - - - - An event that indicates that the tag editor is complete. This can be - in response to many actions: the user entering a tag expression, the - time expiring and the default being selected, or the selection being - canceled. - - - - - A class for storing event information relating to a user's selected - tag expression for a test run. - - - - - Initializes a new instance of the TagExpression event arguments - class. - - The tag expression. - - - - Gets the tag expression stored in the event arguments. - - - - - Gets a value indicating whether a tag expression has been set. - - - - - Displays information about any exceptions listed in the results. - - - - - Initializes a new instance of the TestExceptionDetails class. - - - - - InitializeComponent - - - - - Details view for test method data. - - - - - Initializes a new instance of the TestMethodDetails class. - - - - - InitializeComponent - - - - - A set of simple time helper methods. - - - - - Returns a human-readable formatting of the time different between - two DateTime instances. - - The starting time. - The finishing time. - Returns a human-readable string. - - - - Returns a human-readable formatting of the time different between - two DateTime instances. - - The time span instance. - Returns a human-readable string. - - - - A plural 's' as the suffix, when not equal to one. - - The string value. - The number to check. - Returns an empty string or the English plural 's'. - - - - Provides the necessary infrastructure to enable drawing connecting - lines between the TreeViewItems in a TreeView. - - Experimental - - - - Gets the value of the ConnectingLineInfo attached property for a - specified TreeViewItem. - - - The TreeViewItem from which the property value is read. - - - The ConnectingLineInfo property value for the TreeViewItem. - - - - - Identifies the ConnectingLineInfo dependency property. - - - - - Gets the value of the IsVerticalConnectingLineOf attached property - for a specified Line. - - The Line from which the property value is read. - The IsVerticalConnectingLineOf property value for the Line. - - - - Sets the value of the IsVerticalConnectingLineOf attached property to a specified Line. - - The Line to which the attached property is written. - The needed IsVerticalConnectingLineOf value. - - - - Identifies the IsVerticalConnectingLineOf dependency property. - - - - - IsVerticalConnectingLineOfProperty property changed handler. - - - Line that changed its IsVerticalConnectingLineOf TreeViewItem. - - Event arguments. - - - - Gets the value of the IsHorizontalConnectingLineOf attached property - for a specified Line. - - - The Line from which the property value is read. - - - The IsHorizontalConnectingLineOf property value for the Line. - - - - - Sets the value of the IsHorizontalConnectingLineOf attached property - to a specified Line. - - - The Line to which the attached property is written. - - - The needed IsHorizontalConnectingLineOf value. - - - - - Identifies the IsHorizontalConnectingLineOf dependency property. - - - - - IsHorizontalConnectingLineOfProperty property changed handler. - - - Line that changed its IsHorizontalConnectingLineOf TreeViewItem. - - Event arguments. - - - - Gets the value of the IsExpanderButtonOf attached property for a - specified ToggleButton. - - - The ToggleButton from which the property value is read. - - - The IsExpanderButtonOf property value for the ToggleButton. - - - - - Sets the value of the IsExpanderButtonOf attached property to a - specified ToggleButton. - - - The ToggleButton to which the attached property is written. - - The needed IsExpanderButtonOf value. - - - - Identifies the IsExpanderButtonOf dependency property. - - - - - IsExpanderButtonOfProperty property changed handler. - - - ToggleButton that changed its IsExpanderButtonOf TreeViewItem. - - Event arguments. - - - - Gets the value of the IsHeaderOf attached property for a specified - FrameworkElement. - - - The FrameworkElement from which the property value is read. - - - The IsHeaderOf property value for the FrameworkElement. - - - - - Sets the value of the IsHeaderOf attached property to a specified - FrameworkElement. - - - The FrameworkElement to which the attached property is written. - - The needed IsHeaderOf value. - - - - Identifies the IsHeaderOf dependency property. - - - - - IsHeaderOfProperty property changed handler. - - - FrameworkElement that changed its IsHeaderOf TreeViewItem. - - Event arguments. - - - - Provides useful extensions to TreeView and TreeViewItem instances. - - Experimental - - - - Get the parent ItemsControl of an element. - - The element. - - The parent ItemsControl of an element, or null if not found. - - - - - Get the ancestor ItemsControls of an element. - - The element. - - The ancestor ItemsControls of an element. - - - - - Get the parent TreeViewItem of a TreeViewItem. - - The TreeViewItem. - - The parent TreeViewItem if found, otherwise null. - - - is null. - - - - - Get the parent TreeView of a TreeViewItem. - - The TreeViewItem. - The parent TreeView if found, otherwise null. - - is null. - - - - - Get the TreeViewItem containers of a TreeView. - - The TreeView. - The TreeViewItem containers of a TreeView. - - is null. - - - - - Get the child TreeViewItem containers of a TreeViewItem. - - The TreeViewItem. - - The child TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the items and TreeViewItem containers of a TreeView. - - The TreeView. - - The items and TreeViewItem containers of a TreeView. - - - is null. - - - - - Get the items and TreeViewItem containers of a TreeViewItem. - - The TreeViewItem. - - The items and TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the TreeViewItem containers of a TreeView. - - The TreeView. - The TreeViewItem containers of a TreeView. - - is null. - - - - - Get the descendant TreeViewItem containers of a TreeViewItem. - - The TreeViewItem. - - The descendant TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the descendant items and TreeViewItem containers of a TreeView. - - The TreeView. - - The descendant items and TreeViewItem containers of a TreeView. - - - is null. - - - - - Get the descendant items and TreeViewItem containers of a - TreeViewItem. - - The TreeViewItem. - - The descendant items and TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the items and TreeViewItem containers of a TreeView or - TreeViewItem. - - The TreeView or TreeViewItem. - - The items and TreeViewItem containers of a TreeView or TreeViewItem. - - - - - Get the sibling items and containers of the item. - - The TreeViewItem. - The sibling items and containers of the item. - - - - Get the TreeViewItems already created that are used to represent the - given item. - - The TreeView. - The item being represented. - - A sequence of TreeViewItems that represent the given item, or an - empty sequence if none were found. - - - is null. - - - - - Get the TreeViewItem already created that is used to represent the - given item. - - The TreeView. - The item being represented. - - The TreeViewItems that represents the given item, or null if no - container was found. - - - If multiple TreeViewItems represent the same item, the first item - found via a breadth-first search will be used. - - - is null. - - - - - Gets a path of items and TreeViewItem containers from the - TreeViewItem to the root of the TreeView. - - The TreeViewItem. - - A path of items and TreeViewItem containers from the TreeViewItem to - the root of the TreeView. - - - is null. - - - - - Gets a path of items and TreeViewItem containers from the - TreeViewItem to the root of the TreeView. - - The TreeViewItem. - - A path of items and TreeViewItem containers from the TreeViewItem to - the root of the TreeView. - - - - - Get the item wrapped by this container. - - The TreeViewItem. - - The item wrapped by the container, or null if not found. - - - is null. - - - - - Get the item of the parent container for a specified - . - - - The TreeView containing the . - - The child item. - - The item of the parent container for the specified - , or null if not found. - - - - - Gets a value indicating whether the TreeViewItem is a root of its - TreeView. - - The TreeViewItem. - - A value indicating whether the TreeViewItem is a root of its - TreeView. - - - is null. - - - - - Gets a value indicating whether the TreeViewItem is a leaf in its - TreeView. - - The TreeViewItem. - - A value indicating whether the TreeViewItem is a leaf in its - TreeView. - - - is null. - - - - - Gets the depth of a TreeViewItem in its TreeView (using a zero-based - index). - - The TreeViewItem. - - The depth of a TreeViewItem in its TreeView (using a zero-based - index). - - - is null. - - - is not in a TreeView. - - - - - Get the selected TreeViewItem in a TreeView. - - The TreeView. - - The selected TreeViewItem, or null if no selected item found. - - - is null. - - - - - Sets the selected TreeViewItem of a TreeView. - - The TreeView. - The TreeViewItem to select. - - is null. - - - - - Clear the selection of the TreeView. - - The TreeView. - - is null. - - - - - Select an item in the TreeView. - - The TreeView. - The item to select. - - A value indicating whether the item was successfully set as the - TreeView's SelectedItem. - - - is null. - - - - - Gets the path to the TreeView's selected item. - - The TreeView. - The path to the TreeView's selected item. - - is null. - - - - - Recursively expand or collapse the TreeViewItem and all of its - descendants. - - The TreeViewItem. - - A value indicating whether to expand or collapse. - - - The number of levels that have already been collapsed or expanded. - This is used in conjunction with the optional maximumDepth to only - expand a specified number of layers. - - - An optional depth that defines the number of layers to expand or - collapse. - - - - - Expand or collapse all of the descendants of the TreeView. - - The TreeView. - - A value indicating whether to expand or collapse. - - - An optional depth that defines the number of layers to expand or - collapse. - - - - - Expand all of the items in a TreeView. - - The TreeView. - - is null. - - - - - Collapse all of the items in a TreeView. - - The TreeView. - - is null. - - - - - Expand a specified number of layers in a TreeView. - - The TreeView. - The number of layers to expand. - - is null. - - - - - Expand a path from the given item to the root of it's TreeView. - - The TreeViewItem. - - A value indicating whether to collapse siblings while expanding the - path. This will result in only the path from the item to the root - being expanded. - - - - - Expand a path from the TreeViewItem to the root of the TreeView. - - The TreeViewItem. - - is null. - - - - - Expand the path from the SelectedItem to the root of the TreeView. - - The TreeView. - - is null. - - - - - Collapse all TreeViewItems except those along the path from the - TreeView's SelectedItem to the root of the TreeView. - - The TreeView. - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - The TreeView. - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - - The type of items provided in . - - The TreeView. - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - - The type of items provided in . - - The TreeView. - - A function that takes a TreeViewItem's item and returns a value to - compare against elements of the given . - The item itself will be used if - is null. - - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - - The type of items provided in . - - The TreeView. - - A function that takes a TreeViewItem's item and returns a value to - compare against elements of the given . - The item itself will be used if - is null. - - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Gets the value of the IsChecked attached property for a specified - TreeViewItem. - - - The TreeViewItem from which the property value is read. - - - The IsChecked property value for the TreeViewItem. - - - - - Sets the value of the IsChecked attached property to a specified - TreeViewItem. - - - The TreeViewItem to which the attached property is written. - - The needed IsChecked value. - - - - Identifies the IsChecked dependency property. - - - - - IsCheckedProperty property changed handler. - - The TreeViewItem that changed IsChecked. - Event arguments. - - - - Gets the value of the AssociatedCheckBox attached property for a - specified TreeViewItem. - - - The TreeViewItem from which the property value is read. - - - The AssociatedCheckBox property value for the TreeViewItem. - - - - - Sets the value of the AssociatedCheckBox attached property to a - specified TreeViewItem. - - - The TreeViewItem to which the attached property is written. - - The needed AssociatedCheckBox value. - - - - Identifies the AssociatedCheckBox dependency property. - - - - - AssociatedCheckBoxProperty property changed handler. - - - The TreeViewItem that changed its AssociatedCheckBox. - - Event arguments. - - - - Get the sequence of items and containers with their IsChecked - property set to True. - - The TreeView. - - The sequence of items and containers with their IsChecked property - set to True. - - - is null. - - - - - Get the sequence of items and containers with their IsChecked - property set to True. - - The TreeView. - - A value indicating whether to include TreeViewItems with an - indeterminate IsChecked value. - - - The sequence of items and containers with their IsChecked property - set to True or also set to null if indeterminate values are - included. - - - is null. - - - - - Gets or sets a value indicating whether recursive calls to - OnIsCheckedPropertyChanged should ignore their notifications or - process them accordingly. - - - - - Gets or sets a value indicating whether recursive calls to - OnIsCheckedPropertyChanged should update their children when their - IsChecked value has changed. - - - - - Represents a CheckBox whose value is associated with the - TreeViewExtensions.IsChecked attached property of TreeViewItems. - - Experimental - - - - The parent TreeViewItem of the CheckBox. - - - - - Initializes a new instance of the TreeViewItemCheckBox class. - - - - - Associate the parent TreeViewItem with the CheckBox. - - - - - Update the TreeViewItem's IsChecked property when this IsChecked - property is changed. - - The CheckBox. - Event arguments. - - - - Gets the parent TreeViewItem of the CheckBox. - - - - - Represents the necessary information to draw connecting lines in a - TreeViewItem. - - Experimental - - - - Initializes a new instance of the TreeViewItemConnectingLineInfo - class. - - The TreeViewItem. - - - - Position the connecting lines in the TreeViewItem. - - - - - Position the vertical connecting line in the TreeViewItem. - - - - - Gets the TreeViewItem. - - - - - Gets or sets the vertical connecting line of the TreeViewItem. - - - - - Gets or sets the horizontal connecting line of the TreeViewItem. - - - - - Gets or sets the expander button of the TreeViewItem. - - - - - Gets or sets the header of the TreeViewItem. - - - - - Used to convert TreeViewItems into a value based on their depth in - the TreeView. - - Experimental - - - - Initializes a new instance of the TreeViewItemIndentationConverter - class. - - - - - Convert a TreeViewItem into a value based on the depth of the item - in the TreeView. - - The TreeViewItem. - - The indentation type to convert to (such as Thickness or double). - - - The number of pixels to indent each level of the TreeView. A - default value of 15.0 will be used if no parameter is provided. - - - The culture used to convert the TreeViewItem. - - - A value based on the depth of the item in the TreeView. - - - - - Wrap the indentation in the desired type. - - - The number of pixels to indent the TreeViewItem. - - - The indentation type to convert to (such as Thickness or double). - - - A value based on the depth of the item in the TreeView. - - - - - Convert an indentation back into a TreeViewItem. This always throws - a NotSupportedException. - - The indentation. - The type of the indentation. - - The number of pixels to indent each level of the TreeView. - - - The culture used to convert the TreeViewItem. - - Always throws a NotSupportedException. - - - - A set of simple extension methods for applications. - - - - - Checks whether the application host object is not null. - - The application instance. - Returns a value indicating whether the object is not null. - - - - Checks whether the application host and its source object is not - null. - - The application instance. - Returns a value indicating whether the object is not null. - - - - A value converter for collapsing or showing elements. - - - - - Convert a boolean value to a Visibility value. - - The value instance. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support two-way databinding of the VisibilityConverter, converting - Visibility to a bool. - - The value instance. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Determine the visibility mode based on a converter parameter. This - parameter is of type Visibility,and specifies what visibility value - to return when the boolean value is true. - - The parameter object. - Returns a Visibility value. - - - - Determine whether or not visibility is inverted based on a converter - parameter. When the parameter is specified as Collapsed, that means - that when the boolean value is true, we should return Collapsed, - which is inverted. - - The parameter object. - Returns a value indicating whether the visibility is - inverted. - - - - Visual states helper code. - - - - - Gets the implementation root of the Control. - - The DependencyObject. - - Implements Silverlight's corresponding internal property on Control. - - Returns the implementation root or null. - - - - This method tries to get the named VisualStateGroup for the - dependency object. The provided object's ImplementationRoot will be - looked up in this call. - - The dependency object. - The visual state group's name. - Returns null or the VisualStateGroup object. - - - - Provides useful extensions for working with the visual tree. - - - Since many of these extension methods are declared on types like - DependencyObject high up in the class hierarchy, we've placed them in - the Primitives namespace which is less likely to be imported for normal - scenarios. - - Experimental - - - - Get the visual tree ancestors of an element. - - The element. - The visual tree ancestors of the element. - - is null. - - - - - Get the visual tree ancestors of an element and the element itself. - - The element. - - The visual tree ancestors of an element and the element itself. - - - is null. - - - - - Get the visual tree ancestors of an element and the element itself. - - The element. - - The visual tree ancestors of an element and the element itself. - - - - - Get the visual tree children of an element. - - The element. - The visual tree children of an element. - - is null. - - - - - Get the visual tree children of an element and the element itself. - - The element. - - The visual tree children of an element and the element itself. - - - is null. - - - - - Get the visual tree children of an element and the element itself. - - The element. - - The visual tree children of an element and the element itself. - - - - - Get the visual tree descendants of an element. - - The element. - The visual tree descendants of an element. - - is null. - - - - - Get the visual tree descendants of an element and the element - itself. - - The element. - - The visual tree descendants of an element and the element itself. - - - is null. - - - - - Get the visual tree descendants of an element and the element - itself. - - The element. - - The visual tree descendants of an element and the element itself. - - - - - Get the visual tree siblings of an element. - - The element. - The visual tree siblings of an element. - - is null. - - - - - Get the visual tree siblings of an element and the element itself. - - The element. - - The visual tree siblings of an element and the element itself. - - - is null. - - - - - Get the bounds of an element relative to another element. - - The element. - - The element relative to the other element. - - - The bounds of the element relative to another element, or null if - the elements are not related. - - - is null. - - - is null. - - - - - Perform an action when the element's LayoutUpdated event fires. - - The element. - The action to perform. - - is null. - - - is null. - - - - - Retrieves all the logical children of a framework element using a - breadth-first search. For performance reasons this method manually - manages the stack instead of using recursion. - - The parent framework element. - The logical children of the framework element. - - - - Retrieves all the logical descendents of a framework element using a - breadth-first search. For performance reasons this method manually - manages the stack instead of using recursion. - - The parent framework element. - The logical children of the framework element. - - - - The CodeCoverage class is used to collect code coverage information from - assemblies that have been instrumented to call the Visit function at the - beginning of every basic block. - - - - - A bit array used to track which basic blocks have been executed. - - - - - A counter of the hit blocks. - - - - - Record that a basic block is being executed. - - Id of the basic block. - - - - Get the coverage data serialized as a string for easy transport. - - Previous releases of the framework used a simplistic bit - list, this release updates the coverage reporting endpoint to an - alternate version that ends in base 64. This maintains test runner - compatibility with previous official releases. - Coverage data serialized as a string. - - - - Gets the current number of hit blocks. - - - - - Gets the current size of the blocks counter. This is not actually - the number of hit blocks, but it should return 0 always except - when at least one block is hit. - - - - - Base class for test cases that use special functionality of the - Microsoft.Silverlight.Testing unit test framework. - - Tests that derive from CustomTest in most cases will not be source- or - functionality- compatible with the more advanced desktop Visual Studio - Test Team environment and harnesses. - - - - - Process an exception using the test engine logic for - ExpectedExceptions and logging the exception if needed. - - Exception object. - - - - Gets or sets a value indicating whether global unhandled exceptions - should be intercepted by the test harness. - - - - - Gets or sets the unit test harness instance. Hidden from the VS - browser as test developers should not need to use this property. - - - - - Gets the current test task container. - - The current container for the test's tasks. - - - - Manages the unit test status and model by attaching to the unit test - harness instance. Validates that all key logging can be done without - special hooks inside of the unit test harness implementation. - - - - - The unit test harness instance. - - - - - The test run data. - - - - - Map assembly metadata to data objects. - - - - - Map test class metadata to data objects. - - - - - Map test metadata to data objects. - - - - - Backing field for the last result. - - - - - Backing field for the last failing result. - - - - - Initializes a new instance of the DataManager type. - - The unit test harness instance. - - - - Initializes a new instance of the DataManager. - - The unit test harness instance. - Returns a new instance of a DataManager class. - - - - Connect to unit test harness events for processing and updating the - underlying unit test run model. - - - - - Unhook from the unit test harness events. - - - - - Process the starting of the test run. - - The source object. - The event data. - - - - Process the test class starting event. - - The source object. - The event data. - - - - Process the test class complete event. - - The source object. - The event data. - - - - Process the start of a test method. - - The source object. - The event data. - - - - Process the completion of test methods. - - The source object. - The event data. - - - - Process a result. - - The result data. - - - - Gets or creates the data model object for an assembly. - - The test assembly. - Returns the data object. - - - - Gets or creates the data model object for a test class. - - The test class. - Returns the data object. - - - - Gets or creates the data model object for a test method. - - The test method. - The parent test class data object. - Returns the data object. - - - - Gets the unit test harness instance. - - - - - Gets the unit test model. - - - - - A data object storing the hierarchical results for a test assembly in a - test run. - - - - - A base class for model objects that implement the property - changed interface, to simplify calling the change handlers, - and cache the underlying event argument instances. - - - - - A static set of change argument instances, eventually - storing one argument instance for each property name to - reduce churn at runtime. - - - - - Notify any listeners that the property value has changed. - - The property name. - - - - The property changed event. - - - - - A type that provides a string result report. - - - - - Generates a simple text result report for the metadata. - - Reports a text report. - - - - Initializes a new instance of the TestAssemblyData type. - - The test assembly metadata. - - - - Backing field for the expanded property. - - - - - Backing field for a passed value. - - - - - Backing store for the set of test class. - - - - - Retrieves the results report. - - Returns a string containing the report. - - - - Gets or sets a value indicating whether the item is expanded in - a hierarchical display. - - - - - Gets or sets the checked value. Don't think this is actually used. - - - - - Gets or sets a value indicating whether the test passed. If failed, - will propagate to the parent metadata object. - - - - - Gets the name of the assembly. - - - - - Gets an observable collection of test class data objects. - - - - - A data object that generates property change notifications and can - be used for rich data binding to test results. Does keep a reference - to all results. - - - - - Stores the test method metadata. - - - - - Parent data object. - - - - - A value indicating whether the test is currently executing. - - - - - The test outcome. - - - - - Backing field for linked data. - - - - - Backing field for linked data. - - - - - Backing field for linked data. - - - - - Backing field for linked data. - - - - - Initializes a new instance of the TestMethodData type. - - The test method metadata. - The test class that is the parent object. - - - - Runs through the metadata for bugs. - - - - - Backing field for known bugs. - - - - - Backing field for bugs that are marked fixed. - - - - - Calculates whether the item is considered "notable", in that it - should have a visual cue or hint for the user. - - - - - Stores a value indicating whether the result is notable. - - - - - Backing field for the checked property. - - - - - Backing field for the expanded property. - - - - - Retrieves the results report. - - Returns a string containing the report. - - - - Gets or sets the result of the test method. - - - - - Gets the known bugs for display in the UI. - - - - - Gets the fixed bugs for display. - - - - - Gets the expected exception name for a negative test, if any. - - - - - Gets a simplified exception stack trace that omits the trace below - the invoke of the test method by the test framework. - - - - - Gets the short, simple name of the exception type recorded in the - test result, if any. - - - - - Gets a value indicating whether the method has results. - - - - - Gets a value indicating whether the method has passed. Returns - true until there is a result. - - - - - Gets or sets a value indicating whether the test method is running. - - - - - Gets or sets a value indicating whether the result is notable. - Notable is defined as either currently running, or not having - passed. This can allow a user interface to react to an - interesting result. - - - - - Gets the parent data object. - - - - - Gets an instance of the actual metadata object. - - - - - Gets the name of the test method. - - - - - Gets a visibility value to allow for easy showing or - hiding of a user interface component that displays the - description. - - Returns a visibility value. - - - - Gets the elapsed time in a readable format. - - Returns a string of the readable time elapsed. - - - - Gets the description of the test method. - - - - - Gets or sets a value indicating whether the item is checked in the - user interface. - - - - - Gets or sets a value indicating whether the item is expanded in - a hierarchical display. - - - - - Gets or sets the previous result. - - - - - Gets or sets the next result. - - - - - Gets or sets the previous failing result. - - - - - Gets or sets the next failing result. - - - - - A provider of code coverage information to an external process. - - - - - The base class for test service providers. - - - - - Initializes a new base provider class. - - The owning test service provider. - The display name of the service. - - - - Initializes the provider. - - - - - Increments the busy service counter. - - - - - Decrements the busy service counter. - - - - - Invokes a method on this provider using reflection. - - The name of the method. - The optional parameters. - - - - Call the InitializeCompleted event. - - - - - Performs a callback. Null action and/or result are permitted. - - The optional callback action. - The result to pass back. - - - - Event fired once initialization is complete. - - - - - Gets the display name for the provider. - - - - - Gets the owning test service. - - - - - Gets a value indicating whether the provider has been initialized - yet. - - - - - Initializes a new code coverage provider. - - The test service. - - - - Save string-based code coverage data. - - The code coverage data, as a string. - The callback action. - - - - A provider of environment variables and environmental information that - uses the test service provider infrastructure. - - - - - Initializes a new environment provider. - - The test service. - - - - Retrieve an environment variable from the system. - - The variable name. - The callback action. - - - - Miscellaneous internal extension methods. - - - - - Attempts to retrieve a custom assembly attribute. - - The type of attribute to retrieve. - The assembly reference. - An out attribute reference. - Returns true if the attribute is found. - - - - Transform the XElement into a dictionary of key/value pairs. - - The type of enumeration. - The key type. - The value type. - The root enumerable. - The key selector. - The item selector. - Returns a new dictionary. - - - - A type that stores global settings in the isolated storage for the - application. An implementation of the - type. - - - - - A provider of string dictionary values. - - - - - Initializes a new SettingsProvider object. - - The test service. - - - - Initializes a new SettingsProvider object. - - The test service. - The service name. - - - - Saves the settings. - - Classes that inherit from SettingsProvider: hide this - function. Do not call up through to this base method. - The service callback. - - - - Gets the settings dictionary. - - - - - Gets a value indicating whether the settings are read-only. - - - - - Gets the settings source for end-user display. - - - - - The unique key used for storing the test framework's settings - dictionary. - - - - - The underlying settings object. - - - - - Initializes a new isolated storage settings provider. - - The test service instance. - - - - Initializes the isolated storage settings provider. - - - - - Saves the current settings values. - - The service completion callback. - - - - Recalls the stored settings values from isolated storage. - - - - - Initialize the isolated storage application settings object. - - - - - Result object for asynchronous test service response. - - - - - Creates a new ServiceResult object for a failed result, the - sets the exception. - - The Exception object. - Returns a new ServiceResult with the Exception set. - - - - The result LINQ element. - - - - - Initializes a new instance of the ServiceResult class. - - - - - Process the response text. - - - - - Attempt to process and return the root element of a successful - request. Returns null if there was an Exception. - - The root XML element of the response. - - - - Sets the result. - - The LINQ element for the result. - - - - Gets or sets a value indicating whether the result has been - processed. - - - - - Gets or sets the exception intercepted or generated during the - request or - processing timeframe. - - - - - Gets the root XElement of the test service result. - - - - - Gets a value indicating whether the request was successful. - - - - - The type of test service in use. Used by the more advanced service - scenarios in SilverlightTestServiceProvider. - - - - - No service, or unknown service type. - - - - - A direct connection, be it the file system, isolated storage, or - similar. - - - - - A web service. - - - - - The Silverlight test service provider is built for compilation with - Silverlight builds of the test framework. Populates with the important - providers for web browser-hosted test runs. - - - The Silverlight test service provider is built for compilation with - Silverlight builds of the test framework. Populates with the important - providers for web browser-hosted test runs. - - - - - A system that provides test services. - - - - - The dictionary of services registered with this provider instance. - - - - - Initializes a new test service provider instance. - - - - - Initializes the provider and all of its test services. - - - - - Initialize all services and features synchronously. - - - - - Register a new service that the test service should expose. - - Known feature type. - Instance of the feature's - type. - - - - Register a new service that the test service should expose. - - String name of the feature if the known - enum value does not exist. - Instance of the feature's - type. - - - - Unregisters a feature. - - Known feature type. - - - - Unregisters a feature. - - Known feature type string. - - - - Check if a requested feature is supported by the test service - provider. - - Feature of interest. - A value indicating whether the feature exists. - - - - Check if a requested feature is supported by the test service - provider. - - Feature of interest. - A value indicating whether the feature exists. - - - - Retrieve a feature. An exception will be thrown if the service - does not exist. - - Type of a service, ProviderBase. - The feature of interest. - Returns the feature, cast properly. - - - - Retrieve a feature. - - Feature of interest. - The feature's provider. - - - - Retrieve a feature. - - Feature of interest. - The service or null if one was not present. - - - - Require a feature, or throw an exception if it isn't available. - - Feature of interest. - The required type. - The service or null if one was not present. - - - - Require a feature, or throw an exception if it isn't available. - - Feature of interest. - The required type. - The service or null if one was not present. - - - - Require a feature or interest. - - Feature of interest. - The service or null if one was not present. - - - - Requires a service. - - Feature of interest. - The service or null if one was not present. - - - - Check for and required the presence of a service. Throws an - InvalidOperationException message if the service is unavailable. - - Feature of interest. - The service or null if one was not present. - - - - Require a specific feature, and that it can be cast properly. - - Feature of interest. - The type to verify assignment for a cast. - The service or null if one was not present. - - - - Looks for a specific service. - - Feature of interest. - The service or null if one was not present. - - - - Gets or sets a unique test run identifier, if any is present. - - - - - Gets or sets an integer value that can be used to manage simple - reference counting services. - - - - - The service verifier and information. - - - - - Initializes a new instance of the SilverlightTestService class. - - - - - Initializes a new instance of the SilverlightTestService class. - - Unit test settings to read the service path - and other information from. - - - - Initializes the Silverlight test service. Performs a service check - if needed before initializing the other providers. - - - - - Sets the custom ID information for the test run, if passed into - the run. - - - - - Determine the service path to attempt to use, and prepares the - verification object using those parameters. - - Unit test settings object to try and read - settings from. - - - - Pauses the initialization process to attempt a service connection. - The result will alter the underlying ServiceType being used by - this provider to ensure a fallback experience can be used. - - This verification step will block the initialization and entire - test run until it continues. - - - - - Continues the initialization process for the test service provider. - - - - - Populates with the standard providers for Silverlight in-browser - testing. - - - - - Gets the service type that is in use. - - - - - Gets the web service proxy. - - - - - A special verification class used by SilverlightTestService. - - - - - The name of a simple 'ping' method exposed by the service. - - - - - Attempts to verify the service connection. Calls the proper - success/failure Action once a verification result is possible. - - The Action to call upon connection - verification. - An Action to call upon failure. - - - - Gets or sets the service hostname. - - - - - Gets or sets the service port. - - - - - Gets or sets path to the simple POX service. - - - - - Gets the URI to the service. - - - - - A test service that reports test run results. - - - - - Initializes a new reporting provider instance. - - The test service. - - - - Begins a call to the test service to write to the log. - - The callback, used to read or verify results - from the service call. - The name of the log to write. - The log file content. - - - - Begins a call to the test service to report a test run's results. - - The callback, used to read or verify results - from the service call. - A value indicating whether the test run was a - failure. - The failed scenario count. - The total scenario count. - Any message to report along with the failure. - - - - Set of known, well-defined test service features. - - - - - Code coverage reporting. - - - - - Provides run parameters and settings. - - - - - Provides test reporting services. - - - - - Provides environment information. - - - - - A provider of code coverage information to an external process. - - - - - The MethodName_SaveCodeCoverage method name. - - - - - Initializes a new code coverage provider. - - The test service. - - - - Save string-based code coverage data. - - The code coverage data, as a string. - The callback action. - - - - A provider of environment variables and environmental information that - uses the test service provider infrastructure. - - - - - The MethodName_GetEnvironmentVariable method name. - - - - - Initializes a new environment provider. - - The web test service. - - - - Retrieve an environment variable from the system. - - The variable name. - The callback action. - - - - Result object for asynchronous test service response that uses a simple - web service / POX call. - - - - - Initializes a new web service result. - - The request object. - The response object. - - - - Initializes a new web service result. - - The request object. - The response object. - The details to associate for debugging - purposes. - - - - Reads the web response, if successful, and parses out the string - content. - - - - - Process the response text. - - - - - Gets the web request associated with the service call. - - - - - Gets the web response associated with the service call. - - - - - Gets the details of the request, used for interactive debugging - sessions only. - - - - - Gets the string retrieved from the response. - - - - - A test service that reads command line settings. - - - - - Name of the method MethodName_GetRunParameters. - - - - - Initializes a new settings provider instance. - - The test service. - - - - Initialize the web settings provider. - - - - - Read the run parameters. - - The service result. - - - - A test service that reports test run results. - - - - - Name of the method MethodName_ReportTestResults. - - - - - Name of the method MethodName_WriteLog. - - - - - Initializes a new reporting provider instance. - - The test service. - - - - Begins a call to the test service to write to the log. - - The callback, used to read or verify results - from the service call. - The name of the log to write. - The log file content. - - - - Begins a call to the test service to report a test run's results. - - The callback, used to read or verify results - from the service call. - A value indicating whether the test run was a - failure. - The failed scenario count. - The total scenario count. - Any message to report along with the failure. - - - - Provides out-of-process access to operating system functions and other - services such as visual verification, if present. - - - Provides out-of-process access to operating system functions and other - services such as visual verification, if present. - - - Provides out-of-process access to operating system functions and other - services such as visual verification, if present. - - - - - The service address. - - - - - The synchronization context. - - - - - Initializes a new plain-old-XML test service. This assumes that - the caller has already verifier that a service is present and - responding at the service address. - - The base service URI, such as - "scheme://hostname:port/servicePath/". - - - - Creates a simple REST-style Uri given the method/service name and - a dictionary of key/value pairs to send as arguments. - - The method/service name. - A set of key/value pairs. - Returns a new Uri. - - - - Creates a simple REST-style Uri given the method/service name and - a dictionary of key/value pairs to send as arguments. - - The method/service name. - A set of key/value pairs. - Optional query string. - Returns a new Uri. - - - - Builds a simple dictionary from parameters. The value follows the - key parameter. {[key, value], } ... - - The ToString() method is called on every object. - - The parameters. - Returns a key/value dictionary from the parameters. - - - - Begin a POX method call. The callback is used with the result when - it becomes available. - - The method name. - The callback action. - - - - Begin a POX method call. The callback is used with the result when - it becomes available. - - The method name. - Dictionary of key/value pairs. - The callback action. - - - - Begin a POX method call. The callback is used with the result when - it becomes available. - - The method name. - Dictionary of key/value pairs. - Optional string that will transform the - request to a POST request. - The callback action. - - - - The intermediate step that writes the POST data and then continues - the web request. - - The async result object. - - - - Process the response callback from a POX method call. - - The async result object. - - - - On the UI thread, invoke the callback action with the result. - - The temporary state object. - - - - A simple type to store the state information for the cross-thread - callback. - - - - - Initializes a new TemporaryStateObject object. - - The callback action. - The result object. - - - - Gets the callback action. - - - - - Gets the result object. - - - - - The request data class, stores information used in a request for - associating this data with the response. - - - - - Initializes a new request data object. - - The request Uri. - The request object. - The callback action. - - - - Converts the request data object into a web service result - object. - - The response object. - Returns a new WebServiceResult instance. - - - - Gets or sets the optional post data for the request. - - - - - Gets the web request. - - - - - Gets the request Uri. - - - - - Gets the callback action. - - - - - A type which handles preparing the underlying dispatcher or timer from - which the test work items execute. - - - - - Handle calling into the test framework as needed to perform the test - run, process the internal test dispatcher queue, and keep execution - moving forward. - - - - - Delegate that returns whether more work remains and runs the next - set of work. - - - - - Backing field for a value indicaing whether the dispatcher should be - running. - - - - - Creates a new RunMethodManager, taking in a conditional delegate to - run for each step to see if more work remains. - - - The conditional delegate that performs work and indicates whether - additional work remains. - - - - - Create a new run method manager object. - - - Conditional indicating whether more work will remain after - performing the work. - - - Returns the run method manager. Typically depends on the execution - platform and environment. - - - - - Create a new run method manager object. - - - Conditional indicating whether more work will remain after - performing the work. - - A Dispatcher instance. - - Returns the run method manager. Typically depends on the execution - platform and environment. - - - - - A completely synchronous implementation, unless overridden, that - calls RunNextStep() until the harness is finished. - - The default implementation will not work with a presentation-rich - test environment. - - - - - Calls a conditional delegate, and returns whether there is more work - to be done. - - - Returns a value indicating whether there is additional work - remaining after executing the current work. - - - - - Calls the Complete event handler. - - - - - Event that is called when all work is complete. - - - - - Gets or sets a value indicating whether the dispatcher should be - running. - - - - - Stored Dispatcher instance. - - - - - Sets up a new run method manager. - - - Conditional delegate which returns true as long as there is - additional work. - - An instance of the dispatcher to use. - - - - Begin the execution process by hooking up the underlying - DispatcherTimer to call into the test framework regularly and - perform test work items. - - - - - A data object that generates property change notifications and can - be used for rich data binding to test results. Does keep a reference - to all results. - - - - - Parent object reference. - - - - - Initializes a new instance of the TestClassData type. - - The test class metadata. - The parent test assembly data object. - - - - Backing store for the set of test class. - - - - - Backing field for the expanded property. - - - - - Collapses the test class node unless there is at least one child - test method that failed. - - - - - Backing field for a passed value. - - - - - Retrieves the results report. - - Returns a string containing the report. - - - - Gets the parent data object. - - - - - Gets the name of the test class. - - - - - Gets the namespace for the test class. - - - - - Gets an observable collection of test class data objects. - - - - - Gets or sets a value indicating whether the item is expanded in - a hierarchical display. - - - - - Gets or sets the checked value. Don't think this is actually used. - - - - - Gets or sets a value indicating whether the test passed. If failed, - will propagate to the parent metadata object. - - - - - A data object that generates property change notifications and can - be used for rich data binding to test results. Does keep a reference - to all results. - - - - - The unit test harness instance. - - - - - Backing field for information about the test application in use. - - - - - Initializes a new instance of the test run results. - - The unit test harness. - - - - Backing store for the set of test assemblies. - - - - - Title backing field. - - - - - Stores the total number of expected scenarios. - - - - - Stores the current test information. - - - - - Stores the current test information. - - - - - Stores the number of run scenarios. - - - - - Count of failed scenarios. - - - - - Backing field for whether the app is running. - - - - - Gets the test application information instance. - - - - - Gets the unit test harness instance. - - - - - Gets an observable collection of test assembly data objects. - - - - - Gets or sets the informational run title. - - - - - Gets or sets the number of total scenarios. - - - - - Gets or sets the current test name. - - - - - Gets or sets the current test name. - - - - - Gets or sets the number of run scenarios. - - - - - Gets or sets the number of failed scenarios. - - - - - Gets a value indicating whether the run is complete and passed. - - - - - Gets a value indicating whether all passing results have been - processed. - - - - - Gets the number of passed scenarios, defined as the number of - run scenarios minus the number of failed scenarios tracked. - - - - - Gets a value indicating whether the dispatcher is currently running. - - - - - Gets a value indicating whether the test run is in action. - - - - - Assembly complete event arguments. - - - - - Generic unit test harness event arguments base class that contains a - reference to the harness. - - - - - Initializes a new instance of the UnitTestHarnessEventArgs class. - - The test harness. - - - - Gets the unit test harness reference. - - - - - Initializes a new instance of the TestAssemblyCompletedEventArgs - type. - - The assembly metadata. - The test harness instance. - - - - Gets the assembly metadata. - - - - - Test assembly starting event arguments. - - - - - Initializes a new instance of the TestAssemblyStartingEventArgs - type. - - The assembly metadata. - The unit test harness instance. - - - - Gets the assembly metadata information. - - - - - The test class completed event arguments. - - - - - Initializes a new instance of the TestClassCompletedEventArgs - class. - - Test class metadata. - The harness instance. - - - - Gets the test class metadata. - - - - - Information about the start of a test class event. - - - - - Initializes a new instance of the TestClassStartingEventArgs type. - - The test class metadata. - The unit test harness reference. - - - - Gets the test class instance. - - - - - Test method starting event arguments. - - - - - Initializes a new instance of the TestMethodStartingEventArgs type. - - The test method metadata. - The test class metadata. - The test harness instance. - - - - Gets the test method metadata. - - - - - Gets the test class metadata. - - - - - Test method completed event arguments, contains the result. - - - - - Initializes a new instance of the TestRunStartingEventArgs - type. - - The test run filter. - The test run settings object. - - - - Gets the unit test run settings. - - - - - Gets the test run filter. - - - - - Gets or sets the test harness name. - - - - - Gets or sets the number of valid, enqueued assemblies scheduled. - - - - - Tag attribute used to associate individual test cases with tags to - easily test related functionality. - - - The infrastructure associated with the TagAttribute is not yet in place. - - - - - List of reserved words that cannot be used as tags. - - - This list should be shared with the tag parser implementation when - available. - - - - - List of reserved characters that cannot be used in tags. - - - This list should be shared with the tag parser implementation when - available. - - - - - Initializes a new instance of the TagAttribute class. - - - Tag associated with the test method or class. - - - - - Gets the tag associated with the test method or class. - - - - - Set of extension methods used by the harness. - - - - - An AddRange implementation for the generic IList interface. - - The list type. - The list object. - The collection to copy into the list. - - - - Replace a list's contents with the items in the IEnumerable. - - The list type. - The list object. - The sequence to copy into the list. - - - - The IProvideDynamicTestMethods interface is used to provide additional - test methods dynamically at runtime. - - - - - Get the dynamic test methods. - - Sequence of dynamic test methods. - - - - A type filter for just a specific test. Allows the re-running of a - single result again in the same process. - - - - - A type to filter down complete sets of classes, tests and methods. - - - - - The default unit test run name. - - - - - Unit test settings. - - - - - Initializes a new test run filter using an existing settings file. - - A unit test settings instance. - The unit test harness. - - - - Retrieve a set of test classes from a test assembly. - - The test assembly metadata object. - Test class instance dictionary. - Returns a new list of test class metadata objects. - - - - Sort the test classes if the settings for alphabetical sorting are - present. - - List of test classes. - - - - Filter out tests based on the standard-supported methods. - - List of test classes. - Test class instance dictionary. - - - - Perform any custom filtering that the TestRunFilter needs. - - List of test classes. - Test class instance dictionary. - - - - If specific string-contains filters are present. - - List of test classes. - Test class instance dictionary. - - - - If any exclusive classes are found, filter them. - - List of test classes. - Test class instance dictionary. - - - - Retrieves the test methods from a test class metadata object. - - The test class metadata object. - The test class instance. - Returns a list of test method metadata objects. - - - - Filter the test methods. - - List of test methods. - - - - Perform any custom filtering that the TestRunFilter needs. - - List of test methods. - - - - If any exclusive classes are found, filter them. - - List of test methods. - - - - Sorts the test methods, if requested. - - List of test methods. - - - - Gets a friendly name for the test run. - - - - - Gets the unit test harness. - - - - - The test class. - - - - - The test method. - - - - - Initializes a new test run filter using an existing settings file. - - The test class metadata. - The test method metadata. - - - - Retrieve a set of test classes from a test assembly. - - The test assembly metadata object. - Test class instance dictionary. - Returns a new list of test class metadata objects. - - - - Retrieves the test methods from a test class metadata object. - - The test class metadata object. - The test class instance. - Returns a list of test method metadata objects. - - - - A helper class that manages tags and associated metadata. Tag - expressions are evaluated at the TestClass level. - - - A helper class that manages tags and associated metadata. Tag - expressions are evaluated at the TestClass level. - - - A helper class that manages tags and associated metadata. Tag - expressions are evaluated at the TestClass level. - - - - - The prefix for any tags generated from priority values. - - - - - A reference to the tag attribute type. - - - - - The test tags associated with the class. - - - - - The test tags associated with methods. - - - - - The ability to grab the set of methods, given a test class type, - and the tag of interest. - - - - - The test class type. - - - - - Initializes a new tag manager. - - The test class type. - The set of methods to run. - - - - Reflect, read and prepare the tags for the class metadata. Performs - the work if this is the first time the metadata has been seen. - - The reflection object for the test class. - - - - Reflect, read and prepare the tags for the method metadata. Performs - the work if this is the first time the metadata has been seen. - - The method metadata. - - - - Get the test methods that correspond to a tag expression. - - Tag expression. - Test methods for the tag expression. - - - - Gets or sets the universe of all test methods for expression - evaluation. - - - - - Evaluate tag expressions. - - - Tag expressions are derived from the following EBNF grammar: - {Expression} := - {Expression} + {Term} | - {Expression} - {Term} | - {Term} - {Term} := - {Term} * {Factor} | - {Factor} - {Factor} := - !{Factor} | - ({Expression}) | - {Tag} - {Tag} := - All | - [^InvalidCharacters]+ - - The non-terminals for {Expression} and {Term} will be left factored - in the recursive descent parser below. - - - - - Union character. - - - - - Intersection character. - - - - - Complement character. - - - - - Difference character. - - - - - The "All" string constant. - - - - - Invalid characters in a tag name. - - - - - Evaluate a tag expression. - - The owner object. - Tag expression. - Test methods associated with the tag expression. - - - - The owning TagManager instance. - - - - - Expression being evaluated. - - - - - Current position in the expression. - - - - - Create an expression evaluator. - - The owner object. - Expression object. - - - - Match a sequence of characters. - - String to match. - - - - Try to match a sequence of characters. - - String to match. - Returns a value indicating whether the match was - successful. - - - - Evaluate an expression. - - Test methods described by the expression. - - - - Evaluate an expression. - - Test methods described by the expression. - - We need to factor out left recursion, so: - {Expression} := - {Expression} + {Term} | - {Expression} - {Term} | - {Term} - becomes: - {Expression} := - {Term}{Expression'} - - {Expression'} := - #empty# - + {Term}{Expression'} - - {Term}{Expression'} - - - - - Evaluate an expression. - - - Left term already read as part of the expression. - - Test methods described by the expression. - - Non-terminal created for left-factoring: - {Expression'} := - #empty# - + {Term}{Expression'} - - {Term}{Expression'} - - - - - Evaluate a term. - - Test methods described by the expression. - - We need to factor out left recursion, so: - {Term} := - {Factor} * {Term} | - {Factor} - becomes: - {Term} := - {Factor}{Term'} - - {Term'} := - #empty# - ^ {Factor}{Term'} - - - - - Evaluate a term. - - - Left term already read as part of the expression. - - Test methods described by the expression. - - Non-terminal created for left-factoring: - {Term'} := - #empty# - ^ {Factor}{Term'} - - - - - Evaluate a factor. - - Test methods described by the expression. - - {Factor} := - !{Factor} | - ({Expression}) | - {Tag} - - - - - Creates a new empty collection. - - Returns an empty collection. - - - - Evaluate a tag. - - Test methods described by the expression. - - {Tag} := - All | - [^InvalidCharacters]+ - - - - - A string list for storing tags. Provides an Add method that takes - an attribute object and, if a TagAttribute, will append its tag - value to the list. - - - - - Initializes a new Tags instance. - - - - - Initializes a new Tags instance from an existing collection. - - The collection to copy. - - - - Adds a TagAttribute's tag value. - - The tag object. - - - - A method and class filter that uses expressions and the TagAttribute. - - - - - The name to use for the test run when the tag expression is null. - - - - - Initializes a new test run filter with the tag expression setting. - - Unit test settings. - Unit test harness. - - - - Initializes a new test run filter with the tag expression. - - Unit test settings. - Unit test harness. - The tag expression to use. - - - - Sets the tag expression property. - - The tag expression to use. - - - - A value indicating whether the warning has been logged yet. - - - - - Apply tag filtering. - - List of test classes. - Test class instance dictionary. - - - - Apply tag filtering. - - List of test methods. - - - - Apply the tag filtering. - - The tag manager instance. - Set of methods. - - - - Exclusive attributes are not supported when also using tagging. - - List of test classes. - Test class instance dictionary. - - - - Exclusive attributes are not supported when also using tagging. - - List of test methods. - - - - Gets the tag expression in use by the run filter. - - - - - Helper code for TestAssembly logic. - - - - - Check whether [Exclusive] attribute is present on any classes. - - Collection of class metadata objects. - Returns a value indicating whether any of the classes - include an [Exclusive] attribute. - - - - Sorts the test classes alphabetically by name. - - A list of test class metadata objects. - - - - Test class helper. - - - - - A value indicating whether the warning has been logged in this run. - - - - - Filter the set of test classes by removing unused classes. - - The input list of test class metadata objects. - The classes to run. - - - - Look through the classes for the [Exclusive] attribute. If found, - remove any classes where the attribute is not present. - - The input list of classes. - The log writer object. - - - - Look for the /p:FilterClass parameter in the test harness settings. - Try to do a substring match on all filtered test classes. - - The parameters. - List of test classes to be filtered. - - - - Test method completed event arguments, contains the result. - - - - - Initializes a new instance of the TestMethodCompletedEventArgs - type. - - The result instance. - - - - Initializes a new instance of the TestMethodCompletedEventArgs - type. - - The result instance. - The unit test harness. - - - - Gets the test method result. - - - - - Helper code for TestMethod logic. - - - - - A value indicating whether the warning has been logged in this run. - - - - - Check whether [Exclusive] is present on >= 1 of the methods. - - The methods to search through. - True if at least one of the methods has Exclusive. - - - - Look through the methods for the [Exclusive] attribute. If found, - remove any methods where the attribute is not present. - - The methods to filter. - The log writer object. - - - - A helper utility for firing events as the unit test harness from any - component, internal or not. Enables expansion. - - - - - Stored instance of the harness. - - - - - Initializes a new intance of the UnitTestHarnessEvents helper. - - The harness reference. - - - - Calls the test assembly starting event. - - The event data. - - - - Calls the test assembly completed event. - - The event data. - - - - Calls the test class starting event handlers. - - The event data. - - - - Calls the test class completed event. - - The event data. - - - - Calls the test method starting event. - - The event data. - - - - Calls the test method completed event. - - The event data. - - - - Calls the test run starting event. - - The event data. - - - - A factory for creating the unit test objects. - - - - - The unit test harness. - - - - - Initializes a new unit test logic factory. - - The unit test harness reference. - - - - Creates a new AssemblyManager. - - The unit test provider. - The run filter. - The unit test assembly metadata object. - Returns a new AssemblyManager. - - - - Creates a new TestClassManager. - - The unit test provider. - The run filter. - The test class metadata. - The test class instance. - Returns a new TestClassManager. - - - - Creates a new TestMethodManager. - - The unit test provider. - The test class metadata. - The test method metadata. - The test class instance. - Returns a new TestMethodManager. - - - - A log provider that outputs in a simple custom test format that Visual - Studio recognizes. - - - A log provider that outputs in a simple custom test format that Visual - Studio recognizes. - - - - - LogProvider interface with a single Process method that handles a - LogMessage object. - - - - - A dictionary of conditional action handlers. - - - - - A dictionary of types/actions for handling specific types of log - messages. - - - - - Perform any needed operations to log the message. - - Instance of LogMessage type. - - - - Method that processes any messages not handled any other way. - - The log message. - - - - Registers an action for a specific message type. - - The type of interest. - The handler for the type. Takes a LogMessage - parameter. - - - - Registers a conditional handler. During the log message processing - step, all conditional callbacks will be tried. The first positive - result will then call the associated processing Action for that - conditional method entry. - - A conditional callback that takes a - LogMessage input parameter. - A log message processing Action that is called - when the condition is true. - - - - Removes a conditional callback. - - The condition. - - - - Clear all existing conditional handlers. - - - - - Clear all existing message type handlers. - - - - - Interface for LogProviders that want access to external test settings. - - - - - Initializes the provider. - - The settings. - - - - The filename to use for saving test results. - - - - - The default test adapter type name. - - - - - The default test list name. - - - - - The default computer name. - - - - - The default user name. - - - - - The default configuration name. - - - - - The default configuration description. - - - - - The Visual Studio log format writer. - - - - - Initializes a new instance of the VisualStudioLogProvider class. - - - - - Register the handler conditions of interest to this log provider. - - - - - Assembly start code. - - The log message. - - - - Process an Exception that was not the expected Exception type. - - The log message. - - - - Process an Exception that is logged or stored. - - The log message object. - - - - Sets the test run configuration information when the test assembly - begins processing. - - The test assembly metadata object. - - - - Generate a name for the test run that will be used when - displaying the result in Visual Studio. - - The test assembly metadata object. - Returns the test run name. - - - - Generates a new Guid string value. - - Returns a new Guid string value. - - - - Process a UTF result message. - - The log message object. - - - - Process [Bug(...)]. - - A KnownBugLogMessage object. - - - - The run filter has been selected. - - The log message object. - - - - Saves the log file data. - - The unit test harness. - - - - Initializes the test harness. - - The test harness settings. - - - - Gets or sets the test results filename. - - - - - Gets or sets the test adapter type name reported in the Visual - Studio results log file. - - - - - Gets or sets the TestRunId. - - - - - Gets or sets the test list name. - - - - - Gets or sets the computer name that is reported in the results - log file. - - - - - Gets or sets the user name that is reported in the results file. - - - - - Gets or sets the TestRunConfigurationName. - - - - - Gets or sets the TestRunConfigurationDescription. - - - - - Gets or sets a prefix for use in the test run name. - - - - - Gets or sets the TestRunConfigurationId. - - - - - Gets the current assembly name. - - - - - A log provider that outputs in a simple custom test format that - Visual Studio recognizes. This is a simple, subset writer. - - - - - Date time format string representing round-trip date/time - pattern. - - - - - A unique ID representing the Visual Studio unit test type ID. - - - - - The namespace for Visual Studio team test results. - - Was of XNamespace type in XLinq implementation. - - - - A dictionary containing test list names and guids. - - - - - Stores temporary, pending elements for the next result. - - - - - Initializes a new Writer object. - - - - - Stores property values in the respective elements, clears any - lookup dictionaries. - - - - - Returns a string value of the DateTime object. - - The DateTime object. - Returns the formatted string. - - - - Returns the XML log file as a string. - - The XML value. - - - - Creates the initial results document and its XElements. - - - - - Creates a new XElement within the results XML namespace. - - The element name. - Returns a new named element. - - - - The total number of scenarios. - - - - - The set of outcomes and counts. - - - - - Increment the number of passing results. - - The test outcome. - - - - Adds the result of a test method into the log. - - The test metadata. - The storage value. - The code base value. - The adapter type name. - The class name. - The test list name. - The computer name. - The start time. - The end time. - The outcome. - - - - Adds a WriteLine to the next result to be processed. - - The text to output. - - - - Adds an error message to the next result to be processed. - - The message. - - - - Adds an Exception to the next result to be processed. - - The Exception object. - - - - Adds pending output for the next result. - - The element to wrap in an Output element. - - - - Returns the GUID for a test list name. The result is stored - in memory. - - The test list name. - Returns the test list name guid. - - - - Gets or sets the time that the test run started. - - - - - Gets or sets the time that the writer object and/or test run was created. - - - - - Gets or sets the time that the test run was finished. - - - - - Gets the root XML node for the test run and its results. - - - - - Gets or sets the test type ID used for new results. - - - - - Gets the TestRunConfiguration element. - - - - - Gets the Counters element. - - - - - Gets the TestDefinitions element. - - - - - Gets the TestLists element. - - - - - Gets the TestEntries element. - - - - - Gets the Times element. - - - - - Gets the ResultSummary element. - - - - - Gets the Results element. - - - - - Sets the TestRunId. - - - - - Sets the TestRunName. - - - - - Sets the TestRunUser. - - - - - Sets the TestRunConfigurationName. - - - - - Sets the TestRunConfigurationId. - - - - - Sets the overall run outcome value. - - - - - Sets the TestRunConfigurationDescription. - - - - - A user control that should be used as the root visual for a Silverlight - plugin if developers would like to use the advanced TestSurface - functionality within Microsoft.Silverlight.Testing. - - The TestSurface is automatically cleared after each test scenario - completes, eliminating the need for many additional cleanup methods. - - - - - Initializes the TestPage object. - - - - - InitializeComponent - - - - - Gets the test surface, a dynamic Panel that removes its children - elements after each test completes. - - - - - A log provider that outputs failures as a string. - - - - - A list of failing results. - - - - - Initializes a new TextFailuresLogProvider instance. - - - - - Retrieve the text log of all failures in the unit test run. - - Returns the log contents. - - - - Register the handler conditions of interest to this log provider. - - - - - Process a UTF result message. - - The log message object. - - - - A user control that should be used as the root visual for a Silverlight - plugin if developers would like to use the advanced TestSurface - functionality within Microsoft.Silverlight.Testing. The TestSurface is - automatically cleared after each test scenario completes, eliminating - the need for many additional cleanup methods. - - - - - Backing field for the unit test harness instance. - - - - - Backing field for the model manager. - - - - - Backing field for the startup timer. - - - - - Backing field for a value indicating whether the clipboard feature - is supported. - - - - - Initializes the TestPage object. - - - - - Initializes the TestPage object. - - The test harness instance. - - - - Waits for the Settings to become available, either by the service or - system setting the instance property. - - The source timer. - The event arguments. - - - - Starts the test run. - - - - - Handles the test assembly starting event to expand the test stage - height. - - The source object. - The event data. - - - - Handles the test harness complete event, to display results. - - The source object. - The event data. - - - - Handles the click on the test stage. - - The source object. - The event data. - - - - Expand and collapse the test stage. - - A value indicating whether to expand the stage. - - - - - Handles the completion of a test method. - - The source object. - The event arguments. - - - - Handles the completion event on the tag expression editor to begin - the test run using the user-provided settings. - - The source object. - The event arguments. - - - - Handles navigation back or forward. - - The source object. - The event arguments. - - - - Installs the application. - - The source object. - The event arguments. - - - - Offers clipboard interface support for copying test run results. - - The source object. - The event arguments. - - - - Handles the click on a play/pause button for the run dispatcher. - - The source object. - The event arguments. - - - - Copies text into the clipboard. If the Silverlight runtime on the - system does not support the clipboard API, then it reverts to a - large text box that allows the user to manually copy and paste. - - The text to set. - - - - InitializeComponent - - - - - Gets the test surface, a dynamic Panel that removes its children - elements after each test completes. - - - - - Gets the unit test harness instance. - - - - - Gets the tree view instance. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to There are no remaining test work items. - - - - - Looks up a localized string similar to Exception: Type "{0}" Message "{1}". - - - - - Looks up a localized string similar to Ignoring "{0}". - - - - - Looks up a localized string similar to Incorrect exception type "{0}" received. Was expecting a "{1}" type.. - - - - - Looks up a localized string similar to No Exception was observed. Was expecting a "{0}" type exception.. - - - - - Looks up a localized string similar to Tag cannot be empty!. - - - - - Looks up a localized string similar to The tag "{0}" contains the invalid character "{1}"!. - - - - - Looks up a localized string similar to Tag "{0}" is reserved!. - - - - - Looks up a localized string similar to tagExpression cannot be empty!. - - - - - Looks up a localized string similar to Expected end of tag expression "{0}" at position {1}!. - - - - - Looks up a localized string similar to Tag expected in expression "{0}" at position {1}!. - - - - - Looks up a localized string similar to Invalid tag expression "{0}" (expected "{1}" at position {2})!. - - - - - Looks up a localized string similar to Tag expression "{0}" is in use.. - - - - - Looks up a localized string similar to Exclusive classes are in use. - - - - - Looks up a localized string similar to Exclusive methods are in use. - - - - - Looks up a localized string similar to The known issue could not be verified. A failure will be recorded. If this bug has been fixed, please mark the Fixed attribute value to True.. - - - - - Looks up a localized string similar to No TestHarness is available.. - - - - - Looks up a localized string similar to The "{0}" functionality is not supported within this unit test system.. - - - - - Looks up a localized string similar to Initialization of UnitTestHarness. - - - - - Looks up a localized string similar to No composite work items exist to be cleared.. - - - - - Looks up a localized string similar to No test classes were selected to be in the test run.. - - - - - Looks up a localized string similar to Test harness was not specified on test harness settings object. If a test harness settings object was passed in, please verify that it contains a reference to a test harness.. - - - - - Looks up a localized string similar to Test bug: A test cannot use Test Task objects, such as callbacks and conditionals, or the PumpMessages feature, unless marked with the [Asynchronous] attribute.. - - - - - A central entry point for unit test projects and applications. - - - A central entry point for unit test projects and applications. - - - - - Friendly unit test system name. - - - - - A partial method for PrepareDefaultLogManager. - - The test harness settings. - - - - A partial method for setting the TestService. - - The test harness settings. - - - - Creates a new TestPage visual that in turn will setup and begin a - unit test run. - - A new RootVisual. - Assumes the calling assembly is a test assembly. - - - - Creates a new TestPage visual that in turn will setup and begin a - unit test run. - - Test harness settings to be applied. - A new RootVisual. - Assumes the calling assembly is a test assembly. - - - - Merge any settings provided by a test service with the parameters - that were passed inside the TestHarnessSettings. - - The test service. - The run settings. - - - - Initializes the test service and its contained providers. - - The run settings. - Action to call once the test service is - initialized and ready to continue the run's execution. - - - - Register another available unit test provider for the unit test system. - - A unit test provider. - - - - Test harness instance. - - - - - Start a new unit test run. - - Unit test settings object. - - - - Prepares the default log manager. - - The test harness settings. - - - - Tries to instantiate and initialize a VSTT provider. Requires that - XLinq is available and included in the application package. - - The test harness settings object. - - - - Creates the default settings that would be used by the UnitTestHarness - if none were specified. - - A new RootVisual. - Assumes the calling assembly is a test assembly. - - - - Call the TestHarnessCompleted event. - - The test harness completed event arguments. - - - - Create a default settings object for unit testing. - - The assembly reflection object. - A unit test settings instance. - - - - Gets the test system name built into the assembly. - - - - - Gets a string representing the file version attribute of the main - unit test framework assembly, if present. - - - - - A completed test harness handler. - - - - - A class contains extension methods and helpers for dealing with WorkItem - instances and improving framework performance. - - - - - Enqueues a work item into the task queue. The work item will run - immediately following the previous work item, and may not leave any - time before executing the next. This is a specialized method to be - used for performance improvements. - - The work item test. - The unit of work. - - - - Enqueues a method into the task queue. The method will run - immediately following the previous work item, and may not leave any - time before executing the next. This is a specialized method to be - used for performance improvements. - - The work item test. - The callback action or method. - - - - Enqueues a conditional statement into the task queue. The method will - run immediately following the previous work item, and may not leave - any time before executing the next. This is a specialized method to - be used for performance improvements. - - The work item test. - The conditional function or statement. - - - - Custom test class that provides the ability to perform semi-asynchronous - test tasks on the main thread. Requires the custom unit test harness - that manages and invokes test work items on the thread when needed. - - Tests using this functionality will not be compatible with the full - desktop framework's Visual Studio Team Test environment. - - - - - Signal that a test is complete when using Async testing. - - WARNING: If you use your own methods for completing, such as an - HtmlTimer or other threading method, it is possible that this call - will occur *AFTER* the test has timed out when using Timeouts. As - such, be very careful as you could complete the call to the *next* - test. - - - - - Add a task object to the test queue. For a test that is currently - executing, all tasks contained within the queue are executed to - completion (unless an Exception is thrown) -before- moving on to - the next test. - - The test task queue replaces the PumpMessages(...) system that - permitted a single callback. This enables specialized tasks, such - as DOM bridge tasks, sleep tasks, and conditional continue tasks. - - Asynchronous test task - instance. - - - - Delay a minimum amount of time before continuing. Similar to a sleep - call that is not a blocking call. - - The minimum time span to wait before continuing. - - - - Creates a delay work item instance. - - The minimum time span to wait before continuing. - Returns a new work item. - - - - Delay a minimum amount of time before continuing. Similar to a sleep - call that is not a blocking call. - - The minimum number of milliseconds to wait - until the delay is finished. - - - - Requires a bool returning delegate to be passed in. Instructs the - test task queue to wait until the conditional call returns True to - continue executing other test tasks and/or ending the test method. - - Conditional method or delegate. - Test will halt until this condition returns True. - - - - Creates a conditional work item instance. - - Conditional method or delegate. - Test will halt until this condition returns True. - Returns a new work item. - - - - Enqueue a test task which calls the TestComplete method of - SilverlightTest. - - - - - Add a Callback method into the test task queue. Similar to the - PumpMessages(...) call, with the difference being that there is no - longer a single requirement: you can enqueue several callback - methods and other test tasks, all of which will execute before the - test completes and/or the engine continues. - - Void-returning delegate, - anonymous delegates work fine too. - - - - Creates a callback work item instance. - - Void-returning delegate, - anonymous delegates work fine too. - Returns a new work item. - - - - Adds a number of callback methods into the test task queue. - - Set of Action instances. - - - - Sleep a minimum number of milliseconds before calling a test - callback delegate. - - Minimum number of - milliseconds to sleep. The only guarantee to the tester - is that the sleep will be >= this amount of ms, and NOT - that there is precision or an exact time. - Callback method to - execute after the minimum amount of time has - elapsed. - - - - Enqueue an action. A shortcut for the EnqueueCallback. - - The action to enqueue. - - - - Sleep a minimum number of milliseconds. This is the simplified - overload which requires no callback. - - Minimum number of - milliseconds to sleep. The only guarantee to the tester is that the - sleep will be >= this amount of ms, and NOT that there is precision - or an exact time. - - - - A special indicator attribute to enable better debugging using - Microsoft.Silverlight.Testing. - - As there is very little parameter information available for a test run, - this attribute singles out specific classes to execute when found. - - This attribute is unique to this environment and not compatible with any - desktop unit test framework without using a shim if it is left in code. - - - - - Implementation of useful properties and features for presentation - platform tests (Silverlight and WPF). - - Tests using this functionality will not be compatible with the full - desktop framework's Visual Studio Team Test environment. - - - - - Gets the test panel. - - - - - Provides access to Silverlight-specific test features and - functionality. - - Tests using this functionality will not be compatible with the full - desktop framework's Visual Studio Team Test environment. - - - - - A test work item is a task that is invoked until it is complete. It - maintains its own state to be able to notify the caller when it is - finally complete, with no further work to be run. - - It is possible that some implementations of a TestWorkItem may actually - contain a set of sub-tasks by implementing a composite pattern. - - - - - A value indicating whether the task can immediately execute. - - - - - Invoke the task. Return false only when the task is complete. - - True if there is additional work to be completed. False - when there is none. - - - - Called by the task after the work is complete. - - - - - Gets a value indicating whether the task's work is complete. - - - - - Gets or sets a value indicating whether the work item can be - executed immediately, and does not rely on special asynchronous - operation. Used for performance improvements. The setter is also - public. - - - - - The extended writer for the unit testing harness and consumers. - - - - - A utility type that writes new log messages to the test harness log - queue. - - - - - The factory used for creating new LogMessage types. - - - - - The test harness that contains the method to post new events into - the log message queue. - - - - - Initialize a new writer class, using the default LogMessageFactory - to create new messages. - - The test harness instance. - - - - Initialize a new writer class. - - The test harness instance. - - The factory to use when creating new messages. - - - - - Posts a log message to the test harness queue for processing. - - The log message object. - - - - Creates a new log message using the embedded factory. - - Returns a new LogMessage instance. - - - - Creates a new log message using the embedded factory. - - The message type. - Returns a new LogMessage instance. - - - - Creates a new log message using the embedded factory. - - The message type. - The text message. - Returns a new LogMessage instance. - - - - Decorate a log message with a value. - - The log message to decorate. - The key for this decoration. - The value of this decoration. - - - - Decorate the log message object with an Exception object. - - The log message object. - The Exception. - - - - Decorate the log message object with a name. - - The log message object. - Name property value. - - - - Decorate the log message object with a test stage value. - - The log message object. - Test stage value. - - - - Decorate the log message object with a test outcome object. - - The log message object. - Test outcome object. - - - - Decorate the log message object with a test granularity object. - - The log message object. - Test granularity object. - - - - Sets the type of the log message. - - The log message object. - The new value to set the message type to. - - - - This writes a new line of information similar to a Debug::WriteLine - call. - - The text to write. - - - - Writes information through a new log message. - - The information string. - - - - Writes a message relating to the test infrastructure. - - The text to write. - - - - Writes an environment message. - - The text to write. - - - - Writes a TestRun message. - - The text to write. - - - - Log an error message. - - The error message string. - The Exception object to decorate the message - with. - - - - Log an error message. - - The error message string. - - - - Log a warning message. - - The warning message string. - The Exception object to decorate the message - with. - - - - Log a warning message. - - The warning message string. - - - - Record a test outcome. - - The accompanying message. - The outcome value. - - - - Writes information about an encountered, known issue. - - Information about the known issue. - - - - Records a log message that indicates a named, granular test stage - has happened. - - Any message for the log. - A name for the object or event. - The test granularity value. - The test stage value. - - - - Initializes the unit test log message writer helper. - - The test harness reference. - - - - Marks a message as a unit test system-specific message. - - The log message object. - - - - An incorrect exception type has occurred. - - The expected type. - The actual exception's type. - The test metadata. - The method metadata. - - - - No Exception was intercepted, yet one was expected. - - The expected exception type. - The test class metadata. - The test method metadata. - - - - Logs and Exception that was intercepted or observed. - - The actual Exception instance. - The test class metadata. - The test method metadata. - - - - Enqueues a Ignore message. - - The granularity of the ignore operation. - The name of the test skipped. - - - - Enqueues a message containing a test run filter. - - The test run filter. - - - - Records a log message that indicates a named, granular test stage has - happened. - - The assembly metadata object. - The test granularity value. - The test stage value. - - - - Log a test class's stage. - - The test class metadata object. - The test stage. - - - - Log the result of a unit test scenario. - - The result of the test. - - - - Log a test method's stage. - - The test method metadata object. - The test stage. - - - - Records a harness state for the unit test harness. - - The unit test harness. - The harness name. - The test stage. - - - - A test harness for interacting with unit test providers such as Visual - Studio Team Test's metadata. - - - - - Display name for this harness. - - - - - Manages the attachment state of a global exception handler. - - - - - Container of all work items for the test harness. - - - - - Manager of the stack of dispatchers, so that the appropriate parent - container handles exceptions and completion events. - - - - - Number of valid test assemblies encountered. - - - - - The current run's known number of test methods. - - - - - Backing field for the event firing helper. - - - - - Initiate unit test harness. - - - - - Queue of log messages awaiting processing. - - - - - Adds a log provider to the listening log providers group. - - Log provider object. - - - - Enqueue a log message object for processing by the log providers. - - The log message object. - - - - Begin running the test harness. - - - Make sure to subscribe to the Complete event before calling this - method, in some harnesses this may be a synchronous Run followed - immediately by the Complete event being fired. - - - - - Complete event. - - The sender. - The event arguments. - - - - Stores a log file for the test run. Depending on the execution - environment, this call may not successful. - - The name of the log file. - The log file content as a string. - - - - If supported by any attached test service, this publishes the final - test results. Typical harness implementations may immediately close - the web browser channel upon receiving the message, so any other - reporting should be done first. - - - - - Process all queued log messages. - - - - - Fill member variables with any non-null settings of the same type. - - Settings container class. - - - - Initializes all log providers. - - - - - Call the TestHarnessCompleted event. - - - - - Call the Publishing event. - - The event arguments. - - - - Overrides the PublishResults method so that final reporting is only - done once all other logging is finished. - - - - - Publish final results. If not yet ready, will keep waiting around - as a work item until it is done. - - - - - Stored dispatcher instance. - - - - - Checks if a reporting provider is connected to the test service. - - Returns true if a reporting provider is connected to the - test service. - - - - Immediately sets the overall status using a log message and - processes the message queue. - - The message to set. - - - - Sets the unit test harness property for a test case that inherits - from the abstract base type 'CustomTest'. - - A CustomText instance. - - - - Initialize the harness with a set of test assemblies. - - - - - Restarts the run dispatcher. - - - - - Track the results for our execution and also track the fail state. - - Scenario result to process. - - - - Fires the test assembly starting event. - - The event data. - - - - Fires the play pause event. - - Event data. - - - - Fires the test assembly completed event. - - The event data. - - - - Fires the test class starting event. - - The event data. - - - - Fires the test class completed event. - - The event data. - - - - Fires the test method starting event. - - The event data. - - - - Notifies observers that a test method has been completed. Also - clears the test panel's visual tree. - - The event data. - - - - Notifies observers that a test run has been started. - - The event data. - - - - Reference to the test page object. - - - - - Attempts to report the code coverage information using the test - service provider. If there is no available coverage reporting - service, this is a silent failure. Only reports if >= 1 blocks - are hit. - - The test service. - - - - Enqueue a test assembly from a simple Assembly reference. - - The test assembly. - The run filter settings for the test assembly's run. - - - - Enqueues a test assembly. - - The test assembly metadata. - The run filter settings for the test assembly's run. - - - - Flush the current log manager and then perform the next invoke. - - Returns true if work remains. - - - - Creates the test run filter for the initial run. - - The unit test settings. - Returns a new TestRunFilter instance. - - - - Determine what test assemblies need to be executed. Enqueue tasks - for the unit test assembly providers to run the tests. - - - - - Calculates the number of methods for a run. - - The assembly manager. - The test assembly. - The test run filter. - Returns the number of known methods returned. - - - - Event fired at the completion of the harness' work. - - Sender object instance. - Event arguments. - - - - Listener event for any unhandled exceptions. - - Sender object instance. - Event arguments. - - - - Creates the set of harness tasks to run and hooks up to the Complete event. - - - - - Gets the list of results. - - - - - Gets the log message writer instance. This can be used to easily - post informative messages to the log message queue and providers. - - - - - Gets or sets the logic factory used for instantiating the - unit test logic and management objects. - - - - - Gets or sets the overall harness state - overloaded types can be - used to store additional information. - - - - - Gets the log providers list. - - - - - Gets or sets the wrapper that handles calling the next Run step - method until complete; allows for a virtual Run method. - - - - - Gets the dictionary of Parameters passed into the test harness. - - - - - Gets or sets the settings used to initialize the test harness. - - - - - Gets a set of events that can be fired for test results and other - important test runtime events. - - - - - The test harness is publishing results. - - - - - Gets the TestService referenced by the test harness settings. The - test service provides advanced, optional functionality that is - useful to harness and test case developers. A typical test service - operates outside the process or security boundary. - - - - - Complete event fired when the test harness has finished its test - run. - - - - - Gets a dispatcher instance. - - - - - Gets the root container for test work to be completed. - - - - - Gets the known number of test methods in the current test run. - - - - - Gets or sets a value indicating whether to intercept exceptions at - the app domain level and funnel into the current container or not. - - - - - Gets the internal DispatcherStack being used by the test harness. - - - - - The test assembly starting event. - - - - - On the play or pause change of the dispatcher. - - - - - Gets or sets a value indicating whether the dispatcher is currently - running. - - - - - Test assembly completed event. - - - - - Test class starting event. - - - - - The test class completed event. - - - - - The test method starting event. - - - - - An event that is fired whenever a test method completes. - - - - - An event that is fired when the test run is starting. - - - - - Gets or sets the test page. - - - - - Gets the test panel manager instance. - - - - - Well-known keys that can be used to mark decorator instances in log - message objects. - - - - - Indicates that the message is specific to the unit test system. - - - - - The unit test harness reference. - - - - - The metadata interfacing object for a test assembly. - - - - - The metadata interfacing object for a test class. - - - - - The metadata interfacing object for a test method. - - - - - Indicates that the incorrect exception was intercepted. - - - - - Indicates that the message indicates a skipped/ignored item. - - - - - The type of the expected exception. - - - - - The type of the actual exception. - - - - - The actual exception. - - - - - A TestRunFilter object. - - - - - A ScenarioResult object. - - - - - Helper conditional methods for unit test-specific log messages. - - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The unit test decorator of interest. - Returns true if the condition is met. - - - - Returns a value indicating whether the message is marked as a unit - test system message. - - The message. - Returns true if the message is a unit test system-marked - message. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message has an attached TestRunFilter. - - The log message object. - Returns a value indicating whether the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - A lazy method type. - - - - - A class that does a lazy lookup when needed using reflection. - - - - - Attribute Type instance. - - - - - The Type to search with. - - - - - Whether the search has happened. - - - - - The method reflection object. - - - - - Construct a new lazy method wrapper. - - The attribute type. - - - - Construct a new lazy method wrapper. - - Type to search. - Attribute type. - - - - Does a search and retrieves the method information. - - The method reflection object. - - - - Whether the type has a method info. - - A value indicating whether the method information has - been found. - - - - Perform a search on the type. - - - - - Gets the type of attribute the lazy method is searching for. - - - - - Gets the underlying type that is searched. - - - - - Gets or sets a value indicating whether a lookup has already been attempted. - - - - - Gets or sets the underlying MethodInfo from reflection. - - - - - Underlying Assembly reflection object. - - - - - Create a new lazy method from a MethodInfo instance. - - Assembly reflection object. - Attribute Type instance. - - - - Performs a search on the MethodInfo for the attributes needed. - - - - - Test assembly metadata interface. - - - - - Gets a collection of test class metadata objects. - - Returns a collection of metadata objects. - - - - Gets the initialization method. - - - - - Gets the cleanup method. - - - - - Gets a reference to the unit test provider. - - - - - Gets the name of the test assembly. - - - - - Gets the test harness used to initialize the assembly. - - - - - An expected exception marker for a test method. - - - - - Gets the expected exception type. - - - - - Gets any message associated with the expected exception object. - - - - - Represents the host type information for a test. - - - - - Gets the Host type. - - - - - Gets the host data. - - - - - A representation of a test's priority. - - - - - Metadata representing a test class. - - - - - Retrieve a collection of the test method metadata objects setup by - the unit test provider. - - A collection of test method interfaces. - - - - Gets the test class Type instance. - - - - - Gets a value indicating whether the test class should be ignored. - - - - - Gets the per-test initialization method. - - - - - Gets the per-test cleanup method. - - - - - Gets the one-time class initialization method. - - - - - Gets the one-time class cleanup method. - - - - - Gets the name of the test class. - - - - - Gets a reference to the parent test assembly metadata - instance. - - - - - Test method metadata. - - - - - Used for decorating with unit test provider-specific capabilities, - such as the TestContext concept. - - Instance to decorate. - - - - Get any attribute on the test method that are provided dynamically. - - - Dynamically provided attributes on the test method. - - - - - Invoke the test method. - - Instance of the test class. - - - - Gets the test method reflection object. - - - - - Hooks up to any unit test provider-enabled WriteLine capability - for unit tests. - - - - - Gets a value indicating whether the test is marked to be ignored. - - - - - Gets any description for the method. - - - - - Gets a name for the method. - - - - - Gets any category information for the method. - - - - - Gets any test owner information. - - - - - Gets any expected exception attribute . - - - - - Gets any timeout information. - - - - - Gets a collection of any test properties. - - - - - Gets a collection of any test work items. - - - - - Gets any priority information. - - - - - A property for a test method. - - - - - Gets the test property name. - - - - - Gets the test property value. - - - - - Provider model for a unit test system that uses reflection and metadata - to enable a unit test run. - - - - - Retrieve the metadata instance for a test assembly given a - reflection Assembly instance. - - The test harness using the provider. - Reflected test assembly. - Unit test provider-specific metadata instance for - the test assembly. - - - - Gets a value indicating whether a specific capability or set of - capabilities are supported by the unit test provider. - - Capability of interest. - Gets a value indicating whether the capability is - supported. - - - - Checks if an Exception actually represents an assertion that failed - to improve the logging experience. - - Exception object. - Returns true if the Exception is an assertion exception - type. - - - - Gets the name of the unit test provider. - - - - - Gets the capabilities that the unit test provider implements. - - - - - Work item for a test. - - - - - Gets the associated information from the work item. - - - - - Event arguments that pass along a string value. - - - - - Create a new event argument instance. - - - - - Create a new event argument instance that stores a string value. - - String value to pass along. - - - - String value stored in the event arguments. - - - - - Gets the stored string value. - - - - - A set of capabilities that a unit test provider may chose to implement - through the metadata interfaces. - - - - - No defined capabilities. - - - - - Support for attribute [AssemblyInitialize]. - - - - - Support for attribute [AssemblyCleanup]. - - - - - Support for attribute [Ignore] for classes. - - - - - Support for attribute [Ignore] for methods. - - - - - Support for attribute [Description] on methods. - - - - - Support for attribute [Category] on methods. - - - - - Support for attribute [Owner] on method. - - - - - Support for attribute [Priority] on method. - - - - - Support for attribute [TestProperty](...) on methods. - - - - - Support for attribute [Timeout] on methods. - - - - - Support for attribute [WorkItem(...)]('s) on methods. - - - - - Test work item type that does not complete until the sleep time has - elapsed. This is NOT a blocking Sleep. - - - - - The amount of time to delay for. - - - - - The DateTime that marks the point in time the task is complete. - - - - - Create a new Sleep work item, including the number of - milliseconds to wait until continuing. - - Amount of time to wait/delay. - - - - On the first time, will calculate the final DateTime. Otherwise, - null operation (returns) until that time. - - Returns a value indicating whether there is more work to be - done. - - - - Expected exception metadata. - - - - - Private constructor. - - - - - Creates a new expected exception metadata wrapper. - - Attribute value. - - - - The expected exception attribute. - - - - - Gets the type of the expected exception. - - - - - Gets any message to include in a failure. - - - - - A simple wrapper for a priority integer value that overrides the - ToString method. - - - - - Initializes a new instance of the Priority class. - - The priority. - - - - Gets the priority as string. - - Returns the priority. - - - - Gets the priority value. - - - - - The set of provider attributes. - - - - - Initializes the VSTT metadata provider. - - - - - Gets VSTT [TestClass] attribute. - - - - - Gets VSTT [Ignore] attribute. - - - - - Gets VSTT [ClassInitialize] attribute. - - - - - Gets VSTT [Priority] attribute. - - - - - Gets VSTT [ClassCleanup] attribute. - - - - - Gets VSTT [TestInitialize] attribute. - - - - - Gets VSTT [TestCleanup] attribute. - - - - - Gets VSTT [Description] attribute. - - - - - Gets VSTT [Timeout] attribute. - - - - - Gets VSTT [Owner] attribute. - - - - - Gets VSTT [ExpectedException] attribute. - - - - - Gets VSTT [AssemblyInitialize] attribute. - - - - - Gets VSTT [AssemblyCleanup] attribute. - - - - - Gets VSTT [TestMethod] attribute. - - - - - Gets VSTT [TestProperty] attribute. - - - - - Test class wrapper. - - - - - Construct a new test class metadata interface. - - Assembly metadata interface object. - - - - Creates a new test class wrapper. - - Assembly metadata object. - Type of the class. - - - - Test Type. - - - - - Collection of test method interface objects. - - - - - A value indicating whether tests are loaded. - - - - - A dictionary of method types and method interface objects. - - - - - Gets a collection of test method wrapper instances. - - A collection of test method interface objects. - - - - Exposes the name of the test class. - - Returns the name of the test class. - - - - Gets the test assembly metadata. - - - - - Gets the underlying Type of the test class. - - - - - Gets the name of the test class. - - - - - Gets a value indicating whether an Ignore attribute present - on the class. - - - - - Gets any test initialize method. - - - - - Gets any test cleanup method. - - - - - Gets any class initialize method. - - - - - Gets any class cleanup method. - - - - - Methods enum. - - - - - Initialize method. - - - - - Cleanup method. - - - - - Test init method. - - - - - Test cleanup method. - - - - - A provider wrapper for a test method. - - - - - Property name for the TestContext. - - - - - Default value for methods when no priority attribute is defined. - - - - - An empty object array. - - - - - Method reflection object. - - - - - Private constructor, the constructor requires the method reflection object. - - - - - Creates a new test method wrapper object. - - The reflected method. - - - - Call the WriteLine method. - - String to WriteLine. - - - - Decorates a test class instance with the unit test framework's - specific test context capability, if supported. - - Instance to decorate. - - - - Get any attribute on the test method that are provided dynamically. - - - Dynamically provided attributes on the test method. - - - - - Invoke the test method. - - Instance of the test class. - - - - Exposes the name of the test method as a string. - - Returns the name of the test method. - - - - Allows the test to perform a string WriteLine. - - - - - Gets the underlying reflected method. - - - - - Gets a value indicating whether there is an Ignore attribute. - - - - - Gets any description marked on the test method. - - - - - Gets the name of the method. - - - - - Gets the Category. - - - - - Gets the owner name of the test. - - - - - Gets any expected exception attribute information for the test method. - - - - - Gets any timeout. A Nullable property. - - - - - Gets a Collection of test properties. - - - - - Gets a collection of test work items. - - - - - Gets Priority information. - - - - - Represents a simple test property with a key/value string pair. - - - - - Initializes a new instance of the TestProperty class. - - - - - Initializes a new instance of the TestProperty class. - - The initial property name. - The initial property value. - - - - Gets or sets the property name. - - - - - Gets or sets the property value. - - - - - A wrapper for the unit test context capability of Visual Studio Team - Test's unit test framework. - - - - - Create a new unit test context wrapper for the test method. - - Test method. - - - - Constructor of a new unit test context. - - - - - Test method. - - - - - Used to write trace messages while the test is running. - - Format string. - The arguments. - - - - Throw a not supported exception. - - Functionality that is not supported (string). - A new NotSupportedException. - - - - Adds a file name to the list in TestResult.ResultFileNames. - - Filename to add as a result. - - - - Begins a timer with the specified name. - - The name of the timer to create. - - - - Ends a timer with the specified name. - - Name of the timer. - - - - Cache of properties. - - - - - Gets test properties. - - - - - Gets current data row when test is used for data driven testing. - - - - - Gets current data connection row when test is used for data driven testing. - - - - - Gets the name of the test method. - - - - - Gets the current enum outcome - passed, failed, or inconclusive. - - - - - Assembly metadata for the Visual Studio Team Test unit test framework. - - - - - Assembly reflection object. - - - - - Assembly initialization method information. - - - - - Assembly cleanup method information. - - - - - Unit test provider used for the assembly. - - - - - The unit test harness. - - - - - Creates a new unit test assembly wrapper. - - Unit test metadata provider. - A reference to the unit test harness. - Assembly reflection object. - - - - Reflect and retrieve the test class metadata wrappers for - the test assembly. - - Returns a collection of test class metadata - interface objects. - - - - Gets the name of the test assembly. - - - - - Gets the unit test provider instance. - - - - - Gets any assembly initialize method. - - - - - Gets any assembly cleanup method. - - - - - Gets the test harness used to initialize the assembly. - - - - - Gets the test harness as a unit test harness. - - - - - Provider for the Visual Studio Team Test unit test (UT) framework - metadata. - - - - - Name of this provider. - - - - - The capabilities of the VSTT UTF provider. - - - - - Whether the capability is supported by this provider. - - Capability type. - A value indicating whether the capability is available. - - - - Create a new Visual Studio Team Test unit test framework provider - instance. - - - - - Cache of assemblies and assembly unit test interface objects. - - - - - VSTT unit test provider constructor; takes an assembly reference to - perform reflection on to retrieve all test class types. In this - implementation of an engine for the VSTT metadata, only a single - test Assembly can be utilized at a time for simplicity. - - The unit test harness. - Assembly reflection object. - Returns the assembly metadata interface. - - - - Check if the Exception is actually a failed assertion. - - Exception object to check. - True if the exception is actually an assert failure. - - - - Gets the name of the provider. - - - - - Gets the specialized capability descriptor. - - - - - Settings for the unit test system. - - - - - The tag expression key name. - - - - - By default test methods are sorted. - - - - - By default test classes are sorted. - - - - - Settings for the unit test system. - - - - - Gets the parameters from the response file. - - The parameters. - - - - Gets the components initialized by the entry-point assembly. These - are the dynamically loaded objects that may be needed by the - TestHarness. - - The components. - - - - Gets the log providers. - - - - - Gets or sets a set of sample tags for use in a tag editor screen. - - - - - Gets the list of test assemblies. - - The test assembly. - - - - Gets or sets the test service provider. The test service lights up - advanced out-of-process communication, reporting, logging, and - other valuable services. - - - - - Gets or sets the test harness. - - The test harness. - - - - Gets or sets the test service hostname to try using. Defaults to - localhost. - - - - - Gets or sets the test service port to try using. Defaults to 8000. - - - - - Gets or sets the test service path to try using. Defaults to - /externalInterface/. - - - - - Gets or sets a value indicating whether to start the run - immediately when the test system is run. Defaults to false to enable - the test service to load and information to be provided in the - user interface. - - - - - Gets or sets the type of the TestPanel to create. The type must - derive from Microsoft.Silverlight.Testing.ITestPanel. - - - - - Gets or sets a value indicating whether test methods are sorted - alphabetically. By default this value is true. - - - It is worth understanding that the order of unit test - execution should not affect the results of a test run. Any expected - ordering and verification from multiple test methods should be - refactored into a single unit test. - - - - - Gets or sets a value indicating whether test classes are sorted - alphabetically. This setting is True by default. - - - - - Gets or sets a value indicating whether to show the tag expression - editor user interface before starting the test run. - - - - - Gets or sets the tag expression used for selecting tests to run. - - - - - Gets a list of test classes to run. Enables filtering. - - This property should be considered obsolete. - - - - A manager for the underlying TestSurface Panel. - - - - - Private constructor. - - - - - The test page object. - - - - - A value indicating whether the panel is dirty. - - - - - Remove the children from the test surface, if it has - been used. - - - - - Remove the children from the test surface. - - - - - Gets or sets the Reference to the TestPage user control. - - - - - Gets the TestSurface Panel, and tracks the use for the - current test method. When the test completes, the panel children - will be cleared automatically. - - - - - A result from a test scenario. - - - - - Creates a result record. - - Test method metadata object. - Test class metadata object. - Test result object. - Exception instance, if any. - - - - The string representation of the ScenarioResult. - - Returns a verbose string representation of the result. - - - - Gets or sets the scenario's started time. - - - - - Gets or sets the scenario's finishing time. - - - - - Gets the test method metadata. - - - - - Gets the test class metadata. - - - - - Gets or sets the Result object. - - - - - Gets the Exception instance, if any. - - - - - Container and manager type which handles an entire test assembly; contains sub work - items that represent all actions needed to execute its tests. - - - - - A container that stores instances of the unit test harness and provider. - - - - - TestWorkItem which can contain sub-tasks; the underlying work item is - not marked complete until the Children have completed or an Exception - is thrown. - - - - - Store the underlying tasks. - - - - - Whether the TestTaskContainer::IsComplete should be set to true - after all children have been de-queued. - - - - - Whether the first invoke has happened yet or not. - - - - - Constructor for the TestTaskContainer type. - - - - - Optional method to call on the first invoke. - - - - - Invoke the test container; in turn will execute child work items - as needed. Supports executing multiple items immediately for - performance reasons. - - True if additional work remains, False once IsComplete - is set to true. - - - - Invoke the test container; in turn will execute child work items - as needed. - - The work item used for the invoke. - True if additional work remains, False once IsComplete - is set to true. - - - - Clear the children. - - - - - Dequeue a work item. - - A work item. - - - - Add a new work item to the container to schedule it for invocation. - - New test work item to enqueue. - - - - Adds a new work item that will execute more quickly. - - The item of work. - - - - Enqueues a callback or action that will quickly execute. - - The action or method. - - - - Add a new callback action and schedule it for invocation. - - The action. - - - - Return the top work item, if any, from this container. - - Peek into any test work item. - - - - Work items must call this method to indicate completion of the work - item; in turn fires the Complete event delegates. - - - - - Internal-only version which can be called during a test completion - through the relation - not necessarily the best design; events - may make more sense long-term. - - - - - Call when an exception occurs inside a work item. - - Exception object. - - - - Fire the Complete event. - - Empty event arguments. - - - - Fire the unhandled exception event. - - Exception object. - - - - Gets a value indicating whether the container is marked Complete - when all children have executed or not. - - - - - Gets a value indicating whether sub tasks remain. - - - - - Complete event is fired when the underlying WorkItemComplete method - is called by the work item. - - - - - Event fired when an exception is thrown and unhandled within the - underlying Invoke sequence. - - - - - Gets or sets a value indicating whether the task can execute - immediately. - - - - - The unit test provider. - - - - - Initializes a new unit test work item container. - - The unit test harness. - The unit test metadata provider. - - - - Logs a new message. - - Message object. - - - - Logs a message about the harness. - - Information about the harness. - - - - Gets the log message writer for the unit test system. - - - - - Gets the test harness instance. - - - - - Gets the unit test provider instance. - - - - - The test run filter object. - - - - - Unit test provider-agnostic assembly metadata. - - - - - Container of work items for running test classes. - - - - - Create a new assembly manager, takes in the harness, provider - reference and actual IAssembly object. - - The test run filter object. - Harness object. - The unit test metadata provider. - The test assembly metadata object. - - - - When the test run is ready to test the underlying test assembly that - this class manages, perform reflection and enqueue work items to run - the tests. - - - - - The assembly initialize method. - - - - - The assembly cleanup method. - - - - - Reflect over all test classes in the assembly and add any which are not - filtered out into the test work item queue. - - - - - Helper to enqueue a new method dispatcher. - - The method reflection object. - - - - Gets the collection of all the instances of the assembly's test - classes, used to keep a single reference of the type. - - - - - A method container. - - - - - The timeout time. - - - - - The test method metadata. - - - - - Constructs a new method container. - - - - - Constructs a new method container. - - An instance of the method's type. - The method reflection object. - The test method. - - - - The task that involves the method, and contains its own internal - test queue, if needed for asynchronous tasks. - - - - - The reflection object for the method. - - - - - Invoke into the method. - - Returns the condition of any remaining work. - - - - On the first invoke, make sure there's a task to call the method. - - - - - Gets the method's reflection object. - - - - - A dictionary that manages single instances of types for use across the - unit test system. - - - - - Returns the instance for a Type; if there is not an instance yet, - this will use Activator.CreateInstance to create it. - - The Type instance to retrieve. - Returns an instance of the Type. Returns a new instance - if the Type has not yet been used. - - - - Remove any instance for the type. - - The Type of instance to remove. - - - - Test class manager. - - - - - Test run filter object. - - - - - Reference to the class and its metadata. - - - - - Queue of any tests to run. - - - - - Class instance. - - - - - A container type that handles an entire test class throughout the - test run. - - Test run filter object. - The unit test harness. - The test class metadata interface. - The object instance. - The unit test provider. - - - - Code run the first time this container is invoked. - - - - - Custom tests need to be prepared before use. - - - - - The test initialize method. - - - - - The test cleanup method. - - - - - Reflect through the class to find any test methods, and add them to - the list of queued methods. Also, sorts the methods if appropriate - based on the settings file. - - - - - Add a new method dispatcher to the test work item queue. This is a - work item container which is able to manage its own internal test - work item queue. - - The method reflection object. - - - - A special type dedicated to keeping a running stack of the dispatch - managers that are actually enabled for "work item" use. The current - dispatcher is used by the test work item queue. - - - - - Dispatcher stack; a stack of work item containers. - - - - - Creates a new empty stack for work item containers. - - - - - Push a new dispatcher onto the stack. - - The composite work item to push. - - - - Pop a dispatcher off the stack. - - Returns the top-most container. Throws an - InvalidOperationException if none is available. - - - - Gets the current test work item dispatcher, which is the dispatcher - on the top of the stack. Returns null if there is none. - - - - - Manager for planning, processing, and reporting the result of a single - test method for a unit test provider. - - - - - Underlying test class object. - - - - - Underlying test method object. - - - - - Reference to an instance of the test class. - - - - - Scenario result of the test method. - - - - - The started time of execution. - - - - - Stores a collection of written lines. - - - - - A value indicating whether the bug attribute was present on this - method. If it is, the result will be inverted at completion. - - - - - Contains the main test contents. - - - - - Constructor for a test method manager, which handles executing a single test method - for a unit test provider. - - The unit test harness object. - The test class metadata object. - The test method metadata object. - The test class instance. - The unit test provider. - - - - Log a start message. - - - - - Log an end message. - - - - - Handles the write line event for the test method. - - The string event arguments. - - - - First invoke, plan for the method's execution. - - - - - Sets the start and finish times on the ScenarioResult object. - - - - - Creates the ScenarioResult instance for this test method. - - The initial test outcome value. - - - - Process the result. - - Source object. - Event arguments. - - - - Process an unhandled exception for the method. - - Source object. - Unhandled exception event arguments. - - - - Create a new method container to enclose a reflected method for execution. - - The method reflection object. - - - - Gets or sets a value indicating whether the bug attribute's logic - has already been processed. - - - - - Gets the write line output list. - - - - - A container which is able to attach to the underlying test dispatcher - stack to enable advanced asynchronous functionality, when supported. - - - - - The unit test harness. - - - - - The granularity of the contained item. - - - - - The test method metadata object. - - - - - Initializes dispatcher-stack attaching method container work item. - - Test harness. - Test instance. - Method reflection object. - Test method metadata. - Granularity of test. - - - - Connect to dispatcher stack for advanced functions, if supported. - - - - - Check a MethodInfo for the advanced async attribute. - - True if the work item queue is supported. - - - - A work item for tests to use which will call the delegate when the work - item is executed. - - - - - Stored void delegate. - - - - - Create a new Callback work item. - - Action to execute on Invoke. - - - - Execute the callback. - - Whether the work item is complete. - - - - A test work item that is complete once the condition is asserted. - - - - - The conditional delegate. - - - - - Construct a new conditional work item. - - Conditional delegate. - - - - Invoke the condition, will continue invoking until - the condition is false. - - Completes the invocation once the condition is true. - - - - A simple work item that invokes a method through the reflection - MethodInfo instance. - - - - - An empty object array. - - - - - An object instance. - - - - - Method reflection object. - - - - - The test method to invoke. - - - - - Creates a new method invoke work item for a MethodInfo instance. - - The type instance. - The method on the type to invoke when the - work item is executed. - The test method metadata. - - - - Invokes the underlying method on the instance and marks the - test work item as complete. - - False, noting the completion of the work item. - - - - Unit test providers. - - - - - List of unit test providers. - - - - - Static constructor that initializes the built-in unit test metadata providers. - - - - - Gets the unit test provider for an assembly. The framework only - currently supports a single provider per test assembly, so if more - than one registered provider can handle the assembly, at runtime an - InvalidOperationException is thrown. - - The test harness making the request. - Assembly reflection object. - The unit test provider for the test assembly. Throws if - more than one can process the assembly. Returns null if there is - not a provider for the assembly. - - - - Returns the IAssembly provider for an assembly. - - Test harness object. - Assembly reflection object. - Returns null or an IAssembly instance. - - - - Gets the list of Unit Test providers. - - - - - A dictionary that can store just about any kind of object, keyed off any - object. As a Hashtable, it permits using keys of - - enums - - objects - - types - - This makes it ideal for use in decorating and adorning special types in - the system, such as log messages. - - A strongly-typed decorator key could come from an enum value, while a - prototype extension to the test system could simply use a string key for - organizing. - - In all instances, the resulting object needs to be cast appropriately. - - - - - Check if a decorator exists. - - The decorator key object. - - Returns a value indicating whether the decorator key exists. Even - if the key exists, the instance value for the key could be set to - null, yielding a null instance. - - - - - Check if a set of decorators exists. - - The set of decorator(s) of interest. - - Returns a value indicating whether the decorators of interest were - present. - - - - - Retrieves the decorator instance if it exists. If not, this method - returns null. - - The decorator key object. - - Returns the instance or null if it does not exist. No exceptions - are thrown in this method. - - - - - Helper functionality for dealing with embedded resources in an assembly. - - - - - Get a string containing the text of an embedded resource in an - assembly. - - - An instance whose assembly can be retrieved through reflection. - - - Complete embedded resource name. - - - A string containing the embedded resource's string contents. - - - - - A simple factory used for creating new log messages. - - - - - Create a new LogMessage instance. - - Returns a new LogMessage instance. - - - - Create a new LogMessage instance. - - The type of message to create. - Returns a new LogMessage instance. - - - - Gets or sets the default log message type used for the creation of - unspecific log message types. - - - - - Well-known keys that can be used to mark decorator instances in log - message objects. - - - - - Key for a decorator that is a simple Exception object. - - - - - Key for a decorator that is a simple Name string property. - - - - - An associated TestOutcome value. - - - - - The stage of a message or event. - - - - - The granularity of a message or event. - - - - - A number of possible test outcomes or results. For compatibility, this - information resembles that of the desktop test framework, although many - of the states may not apply or be valid for an in-browser test harness. - - - - - A test outcome of Error. - - - - - A test outcome of Failed. - - - - - A test outcome of Timeout. - - - - - A test outcome of Aborted. - - - - - A test outcome of Inconclusive. - - - - - A test outcome of a run that was aborted, but passed. - - - - - A test outcome of NotRunnable. - - - - - A test outcome of NotExecuted. - - - - - A test outcome of Disconnected. - - - - - A test outcome of Warning. - - - - - A test outcome of Passed. - - - - - A test outcome of Completed. - - - - - A test outcome of InProgress. - - - - - A test outcome of Pending. - - - - - The stage of a test scenario, case or system running. - - - - - In the process of starting. - - - - - Currently running. - - - - - Finishing up. - - - - - The test is canceling. - - - - - Provides a property that will attach and detach a known event handler - delegate when the bit is flipped. - - - - - The event to fire when attached. - - - - - Whether the event handler is attached as a global unhandled - exception handler. - - - - - Creates a new exception handler "manager" with the provided - EventHandler. - - The event handler to manage. - - - - Mark the Handled property in the event args as True to stop any - event bubbling. - - Event arguments. - - Value indicating whether the Exception should be marked as handled. - - - - - Return the Exception property from the EventArgs. - - Event arguments. - - Returns the Exception object that the event arguments stores. - - - This method is compatible with the full desktop framework as well as - Silverlight. - - - - - Internal event that is hooked up to the global exception handler. - - Source object of the event. - Event arguments. - - - - Called after a change to the attachment field value. - - - - - Attach the handler globally. - - - - - Detach the handler globally. - - - - - Gets or sets a value indicating whether the handler is currently - attached to the global exception handler. - - - - - A log message. - - - - - The default log message used during initialization. - - - - - Initializes a new log message of the default message type. - - - - - Initializes a new log message. - - The message type. - - - - Converts to string representation. - - A string version of the LogMessage. - - - - Check if a decorator is present on the LogMessage. - - The decorator of interest. - - Returns a value indicating whether the decorator is present in the - DecoratorDictionary. - - - - - Check if a set of decorators are present. - - The decorator(s) of interest. - - Returns a value indicating whether the decorator(s) of interest are - present. - - - - - Gets the set of decorator instances attached to the log message. - - - - - Gets or sets the type of message. - - - - - Gets or sets the log's message. - - - - - Gets or sets the decorator type for the message. - - - The type of decorator. Only one explicit Type is permitted, - although multiple types within the same type hierarchy are - legitimate. - - Returns the instance of the decorator, if any. - - - - The hierarchy of test execution represented in more generic terms, this - allows for more robust and useful actions by log providers. - - - - - Harness-level granularity. - - - - - Group of test-level granularity. - - - - - Test-level granularity. - - - - - Scenario-level granularity. - - - - - The most verbose log provider, this calls .ToString() on each and every - LogMessage that it processes. The output will appear in an attached - debugger's "Output" window. - - - - - Initializes a new instance of the DebugOutputProvider class. - - - - - Display a LogMessage in the debug output window. - - Message object. - - - - Gets or sets a value indicating whether any TestResult failures will - be reported, regardless of whether the TestResult type is being - monitored for debug output. - - - - - Gets or sets a value indicating whether all messages appear in the - debug output. - - - - - Set of defined types of log messages to allow for some level of - filtering and selective processing of log messages. - - - - - Pass, fail, etc. - - - - - Debug::WriteLine or tracing. - - - - - Non-fatal log message. - - - - - Fatal error message. - - - - - Information about a known defect. - - - - - General information similar to a Console::WriteLine. - - - - - Operating system setting or platform values. - - - - - New unit of test or test run note. - - - - - Related test systems or out-of-process communication information. - - - - - Event information marking the completion of a test run. - - - - - Creates a new TestHarnessCompletedEventArgs. - - The final test harness state. - - - - Gets the final test harness state. - - This contains the final pass versus fail result at a minimum. - Specific harnesses may extend the type to contain additional - information, logs, scenario counts, or anything else. - - - - - A type which handles preparing the underlying dispatcher or timer from - which the test work items execute. - - - - - Millisecond interval to use for the interval between DispatcherTimer - ticks. - - - - - Dispatcher timer. - - - - - Creates a new run method manager using the default value for the - timer's millisecond interval. - - - Conditional delegate which returns true as long as there is - additional work. - - - - - Sets up a new run method manager. - - - Conditional delegate which returns true as long as there is - additional work. - - Milliseconds between ticks, at a - minimum. - - - - Begin the execution process by hooking up the underlying - DispatcherTimer to call into the test framework regularly and - perform test work items. - - - - - Call into the underlying work item queue, if the method manager is - still set to run. - - Sending object. - Event arguments. - - - - Base class representing the overall state of a test run. - - - - - Increment the failures counter. - - - - - Increments the total scenarios counter. - - - - - Gets the count of failing scenarios. - - - - - Gets the total count of scenarios run. - - - - - Gets a value indicating whether the status recorded indicates a - failure. - - - - - A set of helper methods for interacting with methods and types that are - marked with attributes. - - - - - Retrieve all types in an assembly that are decorated with a specific - attribute. - - Assembly to search. - - Instance of the Type of attribute that marks interesting methods. - - - A collection of types from the assembly. An empty collection is - returned if no types were found matching the constraints. - - - - - Given a MethodInfo type, returns the attributes (if any) that are of - the decoratingAttribute parameter's type. - - MemberInfo instance. - Attribute of interest. - - A collection populated with the Attribute instances. - - - - - Given a MethodInfo type, returns the attributes (if any) that are of - the decoratingAttribute parameter's type. - - MemberInfo instance. - Attribute of interest. - A value indicating whether to look for - inheriting custom attributes. - - A collection populated with the Attribute instances. - - - - - Given a test method, returns the attributes (if any) that are of - the decoratingAttribute parameter's type. - - ITestMethod instance. - Attribute of interest. - Whether to inherit attributes. - - A collection populated with the Attribute instances. - - - - - Retrieve a list of Reflection.Assembly types from a set of - instances and/or types. - - Set of instances or types. - A set of Assembly instances from the instances or types. - - - - Returns a list of unique assemblies from a set of types. - - Set of types. - - A list of unique Assembly instances from the input types. - - - - - Given a list of attributes, retrieves a single Attribute instance. - Will throw an exception if multiple attributes exist on the method. - - List of attributes. - - The attribute instance, or null if it does not exist. - - - - - Given a method and a decorative attribute of interest, retrieves a - single Attribute instance. Will throw an exception if multiple - attributes exist on the method. - - MemberInfo instance. - - Attribute type of interest. - - - The attribute instance, or null if it does not exist. - - - - - Given a test method and a decorative attribute of interest, - retrieves a single Attribute instance. Will throw an exception if - multiple attributes exist on the method. - - ITestMethod instance. - - Attribute type of interest. - - - The attribute instance, or null if it does not exist. - - - - - Given a test method and a decorative attribute of interest, - retrieves a single Attribute instance. Will throw an exception if - multiple attributes exist on the method. - - ITestMethod instance. - - Attribute type of interest. - - A value indicating whether to look for custom - inherited attributes. - - The attribute instance, or null if it does not exist. - - - - - Returns a value indicating whether a method has the attribute. - - MemberInfo instance. - Attribute of interest. - - A value indicating whether the type has the decorating attribute or - not. - - - - - Returns a value indicating whether a method has the attribute. - - ITestMethod instance. - Attribute of interest. - - A value indicating whether the type has the decorating attribute or - not. - - - - - Return a collection of MethodInfo instances given a type to look - through and the attribute of interest. - - Type to look through for methods. - Attribute of interest. - - A collection of the method reflection objects, if any, with the - marked attribute present. - - - - - Retrieve a MethodInfo from a single decorated method inside a type, - if any. Throws an Exception if there are > 1 methods that are - decorated with the attribute. - - Type of interest. - Attribute of interest. - - MethodInfo reflection object. Null if none are found. - - - - - Exposes clipboard functionality within Silverlight 3 applications when a - Silverlight 4 runtime is in use. - - - - - An empty array of object type. - - - - - Backing field for set text. - - - - - Backing field for get text. - - - - - Backing field for the contains text method. - - - - - A value indicating whether the clipboard feature is present. This - assumes that all 3 methods are present, in their current form for a - more recent runtime. - - - - - Sets Unicode text data to store on the clipboard, for later access - with System.Windows.Clipboard.GetText(). - - A string that contains the Unicode text data to - store on the clipboard. - - - - Retrieves Unicode text data from the system clipboard, if Unicode - text data exists. - - If Unicode text data is present on the system clipboard, - returns a string that contains the Unicode text data. Otherwise, - returns an empty string. - - - - - Queries the clipboard for the presence of data in the Unicode text - format. - - True if the system clipboard contains Unicode text data; - otherwise, false. - - - - Prepares to use the System.Windows.Clipboard type and throws an - exception if the feature cannot be completely located. - - - - - Prepares the type and reflects for new Silverlight features. - - - - - Gets a value indicating whether the clipboard feature is available - and supported. - - - - - A framework element that permits a binding to be evaluated in a new data - context leaf node. - - The type of dynamic binding to return. - - - - Gets or sets the string value binding used by the control. - - - - - Identifies the Value dependency property. - - - - - Initializes a new instance of the BindingEvaluator class. - - - - - Initializes a new instance of the BindingEvaluator class, - setting the initial binding to the provided parameter. - - The initial string value binding. - - - - Clears the data context so that the control does not keep a - reference to the last-looked up item. - - - - - Updates the data context of the framework element and returns the - updated binding value. - - The object to use as the data context. - If set to true, this parameter will - clear the data context immediately after retrieving the value. - Returns the evaluated T value of the bound dependency - property. - - - - Updates the data context of the framework element and returns the - updated binding value. - - The object to use as the data context. - Returns the evaluated T value of the bound dependency - property. - - - - Gets or sets the data item string value. - - - - - Gets or sets the value binding. - - - - - Specifies values that control the behavior of a control positioned - inside another control. - - Stable - - - - Specifies that the control should be positioned on the left of the - control. - - - - - Specifies that the control should be positioned on top of the - control. - - - - - Specifies that the control should be positioned on the right of the - control. - - - - - Specifies that the control should be positioned at the bottom of - control. - - - - - The InteractionHelper provides controls with support for all of the - common interactions like mouse movement, mouse clicks, key presses, - etc., and also incorporates proper event semantics when the control is - disabled. - - - - - The threshold used to determine whether two clicks are temporally - local and considered a double click (or triple, quadruple, etc.). - 500 milliseconds is the default double click value on Windows. - This value would ideally be pulled form the system settings. - - - - - The threshold used to determine whether two clicks are spatially - local and considered a double click (or triple, quadruple, etc.) - in pixels squared. We use pixels squared so that we can compare to - the distance delta without taking a square root. - - - - - Reference used to call UpdateVisualState on the base class. - - - - - Initializes a new instance of the InteractionHelper class. - - Control receiving interaction. - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - UpdateVisualState works differently than the rest of the injected - functionality. Most of the other events are overridden by the - calling class which calls Allow, does what it wants, and then calls - Base. UpdateVisualState is the opposite because a number of the - methods in InteractionHelper need to trigger it in the calling - class. We do this using the IUpdateVisualState internal interface. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - Handle the control's Loaded event. - - The control. - Event arguments. - - - - Handle changes to the control's IsEnabled property. - - The control. - Event arguments. - - - - Handles changes to the control's IsReadOnly property. - - The value of the property. - - - - Update the visual state of the control when its template is changed. - - - - - Check if the control's GotFocus event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual GotFocus event handler. - - - - - Check if the control's LostFocus event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual LostFocus event handler. - - - - - Check if the control's MouseEnter event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseEnter event handler. - - - - - Check if the control's MouseLeave event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseLeave event handler. - - - - - Check if the control's MouseLeftButtonDown event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseLeftButtonDown event - handler. - - - - - Check if the control's MouseLeftButtonUp event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseLeftButtonUp event handler. - - - - - Check if the control's KeyDown event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Check if the control's KeyUp event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Gets the control the InteractionHelper is targeting. - - - - - Gets a value indicating whether the control has focus. - - - - - Gets a value indicating whether the mouse is over the control. - - - - - Gets a value indicating whether the read-only property is set. - - - - - Gets a value indicating whether the mouse button is pressed down - over the control. - - - - - Gets or sets the last time the control was clicked. - - - The value is stored as Utc time because it is slightly more - performant than converting to local time. - - - - - Gets or sets the mouse position of the last click. - - The value is relative to the control. - - - - Gets the number of times the control was clicked. - - - - - The ItemContainerGenerator provides useful utilities for ItemsControls. - - Preview - - - - A Panel that is used as the ItemsHost of the ItemsControl. This - property will only be valid when the ItemsControl is live in the - tree and has generated containers for some of its items. - - - - - A ScrollViewer that is used to scroll the items in the ItemsHost. - - - - - Initializes a new instance of the ItemContainerGenerator. - - - The ItemsControl being tracked by the ItemContainerGenerator. - - - - - Apply a control template to the ItemsControl. - - - - - Prepares the specified container to display the specified item. - - - Container element used to display the specified item. - - - The ItemContainerStyle for the parent ItemsControl. - - - - - Update the style of any generated items when the ItemContainerStyle - has been changed. - - The ItemContainerStyle. - - Silverlight does not support setting a Style multiple times, so we - only attempt to set styles on elements whose style hasn't already - been set. - - - - - Scroll the desired element into the ScrollHost's viewport. - - Element to scroll into view. - - - - Gets or sets the ItemsControl being tracked by the - ItemContainerGenerator. - - - - - Gets a Panel that is used as the ItemsHost of the ItemsControl. - This property will only be valid when the ItemsControl is live in - the tree and has generated containers for some of its items. - - - - - Gets a ScrollViewer that is used to scroll the items in the - ItemsHost. - - - - - Numeric utility methods used by controls. These methods are similar in - scope to the WPF DoubleUtil class. - - - - - Check if a number is zero. - - The number to check. - True if the number is zero, false otherwise. - - - - Check if a number isn't really a number. - - The number to check. - - True if the number is not a number, false if it is a number. - - - - - Determine if one number is greater than another. - - First number. - Second number. - - True if the first number is greater than the second, false - otherwise. - - - - - Determine if one number is less than or close to another. - - First number. - Second number. - - True if the first number is less than or close to the second, false - otherwise. - - - - - Determine if two numbers are close in value. - - First number. - Second number. - - True if the first number is close in value to the second, false - otherwise. - - - - - NanUnion is a C++ style type union used for efficiently converting - a double into an unsigned long, whose bits can be easily - manipulated. - - - - - Floating point representation of the union. - - - - - Integer representation of the union. - - - - - Provides event data for various routed events that track property values - changing. Typically the events denote a cancellable action. - - - The type of the value for the dependency property that is changing. - - Preview - - - - Private member variable for Cancel property. - - - - - Initializes a new instance of the - - class. - - - The identifier - for the property that is changing. - - The previous value of the property. - - The new value of the property, assuming that the property change is - not cancelled. - - - True if the property change is cancellable by setting - - to true in event handling. false if the property change is not - cancellable. - - - - - Gets the - identifier for the property that is changing. - - - The identifier - for the property that is changing. - - - - - Gets a value that reports the previous value of the changing - property. - - - The previous value of the changing property. - - - - - Gets or sets a value that reports the new value of the changing - property, assuming that the property change is not cancelled. - - - The new value of the changing property. - - - - - Gets a value indicating whether the property change that originated - the RoutedPropertyChanging event is cancellable. - - - True if the property change is cancellable. false if the property - change is not cancellable. - - - - - Gets or sets a value indicating whether the property change that - originated the RoutedPropertyChanging event should be cancelled. - - - True to cancel the property change; this resets the property to - . - false to not cancel the property change; the value changes to - . - - - Attempted to cancel in an instance where - - is false. - - - - - Gets or sets a value indicating whether internal value coercion is - acting on the property change that originated the - RoutedPropertyChanging event. - - - True if coercion is active. false if coercion is not active. - - - This is a total hack to work around the class hierarchy for Value - coercion in NumericUpDown. - - - - - Represents methods that handle various routed events that track property - values changing. Typically the events denote a cancellable action. - - - The type of the value for the dependency property that is changing. - - - The object where the initiating property is changing. - - Event data for the event. - Preview - - - - The ScrollExtensions class provides utility methods for scrolling items - ScrollViewers. - - - - - The amount to scroll a ScrollViewer for a line change. - - - - - Scroll a ScrollViewer vertically by a given offset. - - The ScrollViewer. - The vertical offset to scroll. - - - - Scroll a ScrollViewer horizontally by a given offset. - - The ScrollViewer. - The horizontal offset to scroll. - - - - Scroll the ScrollViewer up by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer down by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer left by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer right by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer up by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer down by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer left by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer right by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer to the top. - - The ScrollViewer. - - - - Scroll the ScrollViewer to the bottom. - - The ScrollViewer. - - - - Get the top and bottom of an element with respect to its parent. - - The element to get the position of. - The parent of the element. - Vertical offset to the top of the element. - - Vertical offset to the bottom of the element. - - - - - Common TypeConverter functionality. - - - - - Returns a value indicating whether this converter can convert an - object of the given type to an instance of the expected type. - - Expected type of the converter. - - The type of the source that is being evaluated for conversion. - - - A value indicating whether the converter can convert the provided - type. - - - - - Attempts to convert a specified object to an instance of the - expected type. - - Expected type of the converter. - TypeConverter instance. - The object being converted. - - The instance of the expected type created from the converted object. - - - - - Determines whether conversion is possible to a specified type. - - Expected type of the converter. - - Identifies the data type to evaluate for conversion. - - - A value indicating whether conversion is possible. - - - - - Attempts to convert a specified object to an instance of the - desired type. - - TypeConverter instance. - The object being converted. - - The type to convert the value to. - - - The value of the conversion to the specified type. - - - - - Names and helpers for visual states in the controls. - - - - - Common state group. - - - - - Normal state of the Common state group. - - - - - Normal state of the Common state group. - - - - - MouseOver state of the Common state group. - - - - - Pressed state of the Common state group. - - - - - Disabled state of the Common state group. - - - - - Focus state group. - - - - - Unfocused state of the Focus state group. - - - - - Focused state of the Focus state group. - - - - - Selection state group. - - - - - Selected state of the Selection state group. - - - - - Unselected state of the Selection state group. - - - - - Selected inactive state of the Selection state group. - - - - - Expansion state group. - - - - - Expanded state of the Expansion state group. - - - - - Collapsed state of the Expansion state group. - - - - - Popup state group. - - - - - Opened state of the Popup state group. - - - - - Closed state of the Popup state group. - - - - - ValidationStates state group. - - - - - The valid state for the ValidationStates group. - - - - - Invalid, focused state for the ValidationStates group. - - - - - Invalid, unfocused state for the ValidationStates group. - - - - - ExpandDirection state group. - - - - - Down expand direction state of ExpandDirection state group. - - - - - Up expand direction state of ExpandDirection state group. - - - - - Left expand direction state of ExpandDirection state group. - - - - - Right expand direction state of ExpandDirection state group. - - - - - HasItems state group. - - - - - HasItems state of the HasItems state group. - - - - - NoItems state of the HasItems state group. - - - - - Increment state group. - - - - - State enabled for increment group. - - - - - State disabled for increment group. - - - - - Decrement state group. - - - - - State enabled for decrement group. - - - - - State disabled for decrement group. - - - - - InteractionMode state group. - - - - - Edit of the DisplayMode state group. - - - - - Display of the DisplayMode state group. - - - - - DisplayMode state group. - - - - - Edit of the DisplayMode state group. - - - - - Display of the DisplayMode state group. - - - - - Active state. - - - - - Inactive state. - - - - - Active state group. - - - - - Non-watermarked state. - - - - - Watermarked state. - - - - - Watermark state group. - - - - - Unfocused state for Calendar Buttons. - - - - - Focused state for Calendar Buttons. - - - - - CalendarButtons Focus state group. - - - - - Use VisualStateManager to change the visual state of the control. - - - Control whose visual state is being changed. - - - A value indicating whether to use transitions when updating the - visual state, or to snap directly to the new visual state. - - - Ordered list of state names and fallback states to transition into. - Only the first state to be found will be used. - - - - - Gets the implementation root of the Control. - - The DependencyObject. - - Implements Silverlight's corresponding internal property on Control. - - Returns the implementation root or null. - - - - This method tries to get the named VisualStateGroup for the - dependency object. The provided object's ImplementationRoot will be - looked up in this call. - - The dependency object. - The visual state group's name. - Returns null or the VisualStateGroup object. - - - - Represents a that supports - objects, - such as . - - Stable - - - - The DataTemplate to apply to the ItemTemplate property on a - generated HeaderedItemsControl (such as a MenuItem or a - TreeViewItem), to indicate how to display items from the next level - in the data hierarchy. - - - - - The Style to apply to the ItemContainerStyle property on a generated - HeaderedItemsControl (such as a MenuItem or a TreeViewItem), to - indicate how to style items from the next level in the data - hierarchy. - - - - - Initializes a new instance of the - class. - - - - - Gets or sets the collection that is used to generate content for the - next sublevel in the data hierarchy. - - - The collection that is used to generate content for the next - sublevel in the data hierarchy. The default value is null. - - - - - Gets a value indicating whether the ItemTemplate property was set on - the template. - - - - - Gets or sets the to - apply to the - - property on a generated - , such - as a , to - indicate how to display items from the next sublevel in the data - hierarchy. - - - The to apply to the - - property on a generated - , such - as a , to - indicate how to display items from the next sublevel in the data - hierarchy. - - - - - Gets a value indicating whether the ItemContainerStyle property was - set on the template. - - - - - Gets or sets the that is - applied to the item container for each child item. - - - The style that is applied to the item container for each child item. - - - - - Class to encapsulate drag behavior for a UIElement. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Create an instance of the DragValidator class. - - - UIElement that represents the source of the drag operation. - - - - - Handle the MouseMove event for the UIElement to update the drag - operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the MouseLeftButtonUp event for the UIElement to complete the - drag operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the MouseLeftButtonDown event for the UIElement to start a - drag operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Invoke the DragStartedEvent handlers. - - - - - Invoke the DragDeltaEvent handlers. - - Inherited code: Requires comment. - - - - Invoke the DragCompletedEvent handlers. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Occurs when a drag operation has started. - - - - - Occurs when a drag operation has completed. - - - - - Occurs when a drag operation has progressed. - - - - - Represents a control that redistributes space between the rows of - columns of a control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Default increment parameter. - - - - - Default increment parameter. - - - - - Identifies the - - dependency property. - - - An identifier for the - - dependency property. - - - - - Identifies the - - dependency property. - - - An identifier for the - - dependency property. - - - - - Called when the IsEnabled property changes. - - Sender object. - Property changed args. - - - - Is Null until a resize operation is initiated with ShowsPreview == - True, then it persists for the life of the GridSplitter. - - - - - Is initialized in the constructor. - - - - - Inherited code: Requires comment. - - - - - Holds the state for whether the mouse is over the control or not. - - - - - Initializes a new instance of the - class. - - - - - Builds the visual tree for the - - control when a new template is applied. - - - - - Returns a - - for use by the Silverlight automation infrastructure. - - - A - - for the - object. - - - - - Method to change the visual state of the control. - - - - - Change to the correct visual state for the GridSplitter. - - - True to use transitions when updating the visual state, false to - snap directly to the new visual state. - - - - - Handle the drag completed event to commit or cancel the resize - operation in progress. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the drag delta event to update the UI for the resize - operation in progress. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the drag started event to start a resize operation if the - control is enabled. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the key down event to allow keyboard resizing or canceling a - resize operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Initialize the resize data and move the splitter by the specified - amount. - - - Horizontal amount to move the splitter. - - - Vertical amount to move the splitter. - - Inherited code: Requires comment. - - - - Called by keyboard event handler to move the splitter if allowed. - - - Horizontal amount to move the splitter. - - - Vertical amount to move the splitter. - - Inherited code: Requires comment. - - - - Creates the preview layer and adds it to the parent grid. - - Grid to add the preview layer to. - - - - Add the preview layer to the Grid if it is not there already and - then show the preview control. - - - - - Remove the preview control from the preview layer if it exists. - - - - - Initialize the resizeData object to hold the information for the - resize operation in progress. - - - Whether or not the preview should be shown. - - - - - Move the splitter and resize the affected columns or rows. - - - Amount to resize horizontally. - - - Amount to resize vertically. - - - Only one of horizontalChange or verticalChange will be non-zero. - - - - - Determine which adjacent column or row definitions need to be - included in the resize operation and set up resizeData accordingly. - - True if it is a valid resize operation. - - - - Cancel the resize operation in progress. - - - - - Get the actual length of the given definition. - - - Row or column definition to get the actual length for. - - - Height of a row definition or width of a column definition. - - - - - Determine the max and min that the two definitions can be resized. - - Inherited code: Requires comment. - - - - Determine the resize behavior based on the given direction and - alignment. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Determine the resize direction based on the horizontal and vertical - alignments. - - Inherited code: Requires comment. - - - - Create a DefinitionAbstraction instance for the given row or column - index in the grid. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - Inherited code: Requires comment 2. - Inherited code: Requires comment 3. - - - - Set the lengths of the two definitions depending on the split - behavior. - - - Inherited code: Requires comment. - - - Inherited code: Requires comment 1. - - - - - Set the height/width of the given row/column. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Determine if the given definition has its size set to the "*" value. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - This code will run whenever the effective resize direction changes, - to update the template being used to display this control. - - - - - Exposes test hooks to unit tests with internal access. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets the resize data. This is null unless a resize - operation is in progress. - - - - - Gets or sets a value indicating whether the - displays a - preview. - - - True if a preview is displayed; otherwise, false. - - - - - Gets or sets the that is used - for previewing changes. - - - The style that is used to preview changes. - - - - - Gets a value indicating whether or not the control has keyboard - focus. - - - - - Gets a test hook for unit tests with internal access. - - - - - Pretends to be the base class for RowDefinition and ClassDefinition - types so that objects of either type can be treated as one. - - Mature - - - - Creates an instance of the DefinitionAbstraction class based on - the given row or column definition. - - - RowDefinition or ColumnDefinition instance. - - - - - Gets the stored definition cast as a row definition. - - Null if not a RowDefinition. - - - - Gets the stored definition cast as a column definition. - - Null if not a ColumnDefinition. - - - - Gets the MaxHeight/MaxWidth for the row/column. - - - - - Gets the MinHeight/MinWidth for the row/column. - - - - - Gets the Height/Width for the row/column. - - - - - A collection of helper methods for working with double data types. - - Mature - - - - Epsilon is the smallest value such that 1.0+epsilon != 1.0. It - can be used to determine the acceptable tolerance for rounding - errors. - - - Epsilon is normally 2.2204460492503131E-16, but Silverlight 2 - uses floats so the effective epsilon is really 1.192093E-07. - - - - - Inherited code: Requires comment. - - - - - Determine if the two doubles are effectively equal within - tolerances. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - Inherited code: Requires comment 2. - - - - Inherited code: Requires comment. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Type to hold the data for the resize operation in progress. - - Mature - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets a value indicating whether Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Expose test hooks for internal and private members of the - GridSplitter. - - - - - Reference to the outer 'parent' GridSplitter. - - - - - Initializes a new instance of the InternalTestHook class. - - The grid splitter to hook. - - - - Simulate the DragValidator's DragCompleted event. - - The sender. - Event arguments. - - - - Simulate the DragValidator's DragDelta event. - - The sender. - Event arguments. - - - - Simulate the DragValidator's DragStarted event. - - The sender. - Event arguments. - - - - Simulate using the keyboard to move the splitter. - - Horizontal change. - Vertical change. - - A value indicating whether the splitter was moved. - - - - - Gets the GridSplitter's GridResizeDirection. - - - - - Gets the GridSplitter's PreviewLayer. - - - - - Gets the GridSplitter's ResizeData. - - - - - Exposes types to - UI automation. - - Mature - - - - Initializes a new instance of the - - class. - - - The to - associate with the - . - - - - - Gets the control type for the element that is associated with the UI - Automation peer. - - The control type. - - - - Called by GetClassName that gets a human readable name that, in - addition to AutomationControlType, differentiates the control - represented by this AutomationPeer. - - The string that contains the name. - - - - Gets the control pattern for the - that is - associated with this - . - - - One of the enumeration values. - - - The object that implements the pattern interface, or null if the - specified pattern interface is not implemented by this peer. - - - - - Moves the control. - - - Absolute screen coordinates of the left side of the control. - - - Absolute screen coordinates of the top of the control. - - - - - Resizes the control. - - The new width of the window, in pixels. - - The new height of the window, in pixels. - - - - - Rotates the control. - - - The number of degrees to rotate the control. A positive number - rotates clockwise; a negative number rotates counterclockwise. - - - - - Gets a value indicating whether the control can be moved. - - - True if the element can be moved; otherwise, false. - - - - - Gets a value indicating whether the UI automation element can be - resized. - - - True if the element can be resized; otherwise, false. - - - - - Gets a value indicating whether the control can be rotated. - - - True if the element can be rotated; otherwise, false. - - - - - Represents the control that shows a preview of the GridSplitter's - redistribution of space between columns or rows of a Grid control. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Is Null until the PreviewControl is bound to a GridSplitter. - - - - - Tracks the bound GridSplitter's location for calculating the - PreviewControl's offset. - - - - - Instantiate the PreviewControl. - - - - - Called when template should be applied to the control. - - - - - Bind the the dimensions of the preview control to the associated - grid splitter. - - GridSplitter instance to target. - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets the x-axis offset for the underlying render transform. - - - - - Gets or sets the y-axis offset for the underlying render transform. - - - - - Exposes types to UI - automation. - - Stable - - - - Initializes a new instance of the - - class. - - - The to associate - with the - . - - - - - Gets the control type for the - that is associated - with this - . - This method is called by - . - - - The - - enumeration value. - - - - - Gets the name of the - that is associated - with - . - This method is called by - . - - A string that contains TreeView. - - - - Gets a control pattern for the - that is associated - with this - . - - - One of the enumeration values that indicates the control pattern. - - - The object that implements the pattern interface, or null if the - specified pattern interface is not implemented by this peer. - - - - - Gets the collection of child elements of the - that is associated - with this - . - - The collection of child elements. - - - - Retrieves a UI automation provider for each child element that is - selected. - - An array of UI automation providers. - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets the TreeView that owns this TreeViewAutomationPeer. - - - - - Gets a value indicating whether the UI automation provider - allows more than one child element to be selected at the same time. - - - True if multiple selection is allowed; otherwise, false. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets a value indicating whether the UI automation provider - requires at least one child element to be selected. - - - True if selection is required; otherwise, false. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Exposes the items in - types to UI - automation. - - Stable - - - - Initializes a new instance of the - - class. - - - The instance - to associate with this - . - - - - - Gets the control type for the - that is - associated with this - . - This method is called by - . - - - The - - enumeration value. - - - - - Gets the name of the - that is - associated with this - . - This method is called by - . - - A string that contains TreeViewItem. - - - - Gets the control pattern for the - that is - associated with this - . - - - One of the enumeration values. - - - The object that implements the pattern interface, or null if the - specified pattern interface is not implemented by this peer. - - - - - Raise the IsSelected property changed event. - - - A value indicating whether the TreeViewItem is selected. - - - - - Raise an automation event when a TreeViewItem is expanded or - collapsed. - - - A value indicating whether the TreeViewItem was expanded. - - - A value indicating whether the TreeViewItem is expanded. - - - - - Displays all child nodes, controls, or content of the control. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Hides all nodes, controls, or content that are descendants of the - control. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Adds the current element to the collection of selected items. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Clears any selection and then selects the current element. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Removes the current element from the collection of selected items. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Scrolls the content area of a container object in order to display - the control within the visible region (viewport) of the container. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets the TreeViewItem that owns this TreeViewItemAutomationPeer. - - - - - Gets the state (expanded or collapsed) of the control. - - - The state (expanded or collapsed) of the control. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets a value indicating whether an item is selected. - - True if an item is selected; otherwise, false. - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets the UI automation provider that implements - - and acts as the container for the calling object. - - The UI automation provider. - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - A specialized data template selector. - - - - - Initializes a new instance of the DataTemplateSelector type. - - - - - Convert a value to a data template. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - No 2-way databinding support. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - Gets or sets the default data template. - - - - - Gets or sets the test method template. - - - - - Gets or sets the test class template. - - - - - A specialized bool inversion selector. - - - - - Initializes a new instance of the InvertValueConverter class. - - - - - Convert a value to its opposite. Defines that null value will also - return false. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - No 2-way databinding support. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - A notification type for use in the Notifications ItemsControl. - - - - - Name of the template part. - - - - - Identifies the Title dependency property. - - - - - Identifies the CloseButtonVisibility dependency property. - - - - - Backing field for the close button. - - - - - Initializes a new instance of the Notification class. - - - - - Fires the Closed event. - - The event data. - - - - Overrides the on apply template method. - - - - - Connects to the Click event of the Close button. - - The source object. - The event arguments. - - - - Gets or sets the title of the notification. - - - - - Gets or sets the visibility of the close button. - - - - - Closed event that connects to the close button of the notification. - - - - - A class that contains notification information. - - - - - Initialize a new intance of the Notifications type. - - - - - Overrides the on apply template method. - - - - - Adds a notification object to the set of notifications. Connects the - close button handler to automatically remove the notification from - the visual tree. - - A notification instance. - - - - Handles the Closed event from the notification and removes the - child. - - The source object. - The event data. - - - - This class contains information about the test application and its - deployment settings. - - - - - Initializes a new instance of the class. - - - - - Handles the install state changed event. - - The source object. - The event arguments. - - - - Backing field for an installed property. - - - - - Gets a value indicating whether the test application is currently - installed out of browser. - - - - - Gets the text to show the user the state of the out of browser test - application. - - - - - Gets a value indicating whether out of browser is both supported and - not currently installed. - - - - - Gets a value indicating whether out of browser is supported by this - test application. - - - - - A simple implementation similar to XElement. - - - - - Backing field for child elements. - - - - - Backing field for attributes. - - - - - Backing field for the element name. - - - - - Backing field for optional XML namespace. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the element. - - The name of the element. - - - - Initializes a new instance of the element. - - The name of the element. - The XML namespace of the element. - - - - Initializes a new instance of the class using the reader as the - current root of the element. - - The XmlReader instance. - - - - Sets the value of a new child element. - - The element name. - The value of the new element. - - - - Sets the value of a new child element with an XML namespace value. - - The element name. - The value of the new element. - The XML namespace. - - - - Sets the value of an attribute. - - The attribute name. - The attribute value. - - - - Sets the value of the element. - - The new string value. - - - - Gets an attribute value. - - The attribute name. - Returns an instance of the attribute value. - - - - Adds a child element to the simple element instance. - - The child element instance. - - - - Returns descendants. - - The element name to look for. - Returns an enumeration of elements. - - - - Creates a new SimpleXElement. - - XML content. - Returns a new instance of the element and children. - - - - Parses the current level with the XmlReader instance. - - The reader instance. - A value indicating whether this is the first - parse. Actually this will always be true for now. - - - - Generates the string representation of the element and its tree. - - Returns the string representation of the element. - - - - Writes to the XML writer without document start and ends. - - The writer instance. - - - - Gets the element name. - - - - - Gets or sets the element text, if any. - - - - diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll deleted file mode 100644 index 9313918b18..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb deleted file mode 100644 index 6096960ba5..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml deleted file mode 100644 index 0b84c0ae7d..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-04-2010-SL4/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml +++ /dev/null @@ -1,3429 +0,0 @@ - - - - Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight - - - - - UrlToTest specifies the url that should be requested to give context to the test. - - - - - An unused attribute. - - - - - - Gets the URL to test. - - - - - AspNetDevelopmentServer specifies the settings to be used for the - ASP.NET Development Server for the test. - - - - - Initializes the AspNetDevelopmentServerAttribute. - - The name. - The path to web app. - - - - Initializes the AspNetDevelopmentServerAttribute. - - The name. - The path to web app. - The web app root. - - - - Gets the name. - - - - - Gets the PathToWebApp. - - - - - Gets the web app root. - - - - - AspNetDevelopmentServerHost specifies the settings to be used when - ASP.NET Development Server is the host server for the test. - - - - - Initializes the AspNetDevelopmentServerHostAttribute. - - The path to the web app. - - - - Initializes the AspNetDevelopmentServerHostAttribute. - - The path to the web app. - The web app root. - - - - Gets the path to the web application. - - - - - Gets the WebAppRoot. - - - - - For ASP.NET sites that require basic authentication, specify the - user name and password using the Credential attribute. - WARNING: The password is stored in plain text in source code - and in the compiled assembly. Restrict access to the source code - and assembly to protect this sensitive information. - - - - - Specify the user name and password needed to access the web site under test. - - The user name. - - The password. WARNING: The password is stored in plain text in source code - and in the compiled assembly. Restrict access to the source code and assembly - to protect this sensitive information. - - - - - Specify the user name, password, and domain needed to access the web site under test. - - The user name. - - The password. WARNING: The password is stored in plain text in source code - and in the compiled assembly. Restrict access to the source code and assembly - to protect this sensitive information. - - The domain. - - - - Gets the user name. - - - - - Gets the password. - - - - - Gets the domain. - - - - - Base class for Framework Exceptions, provides localization trick so that messages are in HA locale. - - - - - Initializes a new UnitTestAssertException. - - - - - Initializes UnitTestAssertException. - - The message. - - - - Gets the Message string. - - - - - AssertFailedException class. Used to indicate failure for a test case - - - - - Initializes a new AssertFailedException. - - The message. - - - - AssertFailedException - - The message. - The inner exception. - - - - The AssertInconclusiveException class. - - - - - Initializes a new AssertInconclusiveException. - - The message. - - - - Initializes a new AssertInconclusiveException. - - The message. - The inner exception. - - - - Initializes a new AssertInconclusiveException. - - - - - InternalTestFailureException class. Used to indicate internal failure - for a test case. - - - - - Initializes a new InternalTestFailureException. - - The message. - - - - Initializes a new InternalTestFailureException. - - The message. - The inner exception. - - - - Initializes a new InternalTestFailureException. - - - - - A collection of helper classes to test various conditions within - unit tests. If the condition being tested is not met, an exception - is thrown. - - - - - - - - - - Tests whether the specified condition is true and throws an exception - if the condition is false. - - The condition the test expects to be true. - - Thrown if is false. - - - - - Tests whether the specified condition is true and throws an exception - if the condition is false. - - The condition the test expects to be true. - - The message to include in the exception when - is false. The message is shown in test results. - - - Thrown if is false. - - - - - Tests whether the specified condition is true and throws an exception - if the condition is false. - - The condition the test expects to be true. - - The message to include in the exception when - is false. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is false. - - - - - Tests whether the specified condition is false and throws an exception - if the condition is true. - - The condition the test expects to be false. - - Thrown if is true. - - - - - Tests whether the specified condition is false and throws an exception - if the condition is true. - - The condition the test expects to be false. - - The message to include in the exception when - is true. The message is shown in test results. - - - Thrown if is true. - - - - - Tests whether the specified condition is false and throws an exception - if the condition is true. - - The condition the test expects to be false. - - The message to include in the exception when - is true. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is true. - - - - - Tests whether the specified object is null and throws an exception - if it is not. - - The object the test expects to be null. - - Thrown if is not null. - - - - - Tests whether the specified object is null and throws an exception - if it is not. - - The object the test expects to be null. - - The message to include in the exception when - is not null. The message is shown in test results. - - - Thrown if is not null. - - - - - Tests whether the specified object is null and throws an exception - if it is not. - - The object the test expects to be null. - - The message to include in the exception when - is not null. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not null. - - - - - Tests whether the specified object is non-null and throws an exception - if it is null. - - The object the test expects not to be null. - - Thrown if is null. - - - - - Tests whether the specified object is non-null and throws an exception - if it is null. - - The object the test expects not to be null. - - The message to include in the exception when - is null. The message is shown in test results. - - - Thrown if is null. - - - - - Tests whether the specified object is non-null and throws an exception - if it is null. - - The object the test expects not to be null. - - The message to include in the exception when - is null. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is null. - - - - - Tests whether the specified objects both refer to the same object and - throws an exception if the two inputs do not refer to the same object. - - - The first object to compare. This is the value the test expects. - - - The second object to compare. This is the value produced by the code under test. - - - Thrown if does not refer to the same object - as . - - - - - Tests whether the specified objects both refer to the same object and - throws an exception if the two inputs do not refer to the same object. - - - The first object to compare. This is the value the test expects. - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not the same as . The message is shown - in test results. - - - Thrown if does not refer to the same object - as . - - - - - Tests whether the specified objects both refer to the same object and - throws an exception if the two inputs do not refer to the same object. - - - The first object to compare. This is the value the test expects. - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not the same as . The message is shown - in test results. - - - An array of parameters to use when formatting . - - - Thrown if does not refer to the same object - as . - - - - - Tests whether the specified objects refer to different objects and - throws an exception if the two inputs refer to the same object. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the value produced by the code under test. - - - Thrown if refers to the same object - as . - - - - - Tests whether the specified objects refer to different objects and - throws an exception if the two inputs refer to the same object. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is the same as . The message is shown in - test results. - - - Thrown if refers to the same object - as . - - - - - Tests whether the specified objects refer to different objects and - throws an exception if the two inputs refer to the same object. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is the same as . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if refers to the same object - as . - - - - - Tests whether the specified values are equal and throws an exception - if the two values are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the tests expects. - - - The second value to compare. This is the value produced by the code under test. - - - Thrown if is not equal to - . - - - - - Tests whether the specified values are equal and throws an exception - if the two values are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the tests expects. - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified values are equal and throws an exception - if the two values are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the tests expects. - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified values are unequal and throws an exception - if the two values are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the test expects not - to match . - - - The second value to compare. This is the value produced by the code under test. - - - Thrown if is equal to . - - - - - Tests whether the specified values are unequal and throws an exception - if the two values are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the test expects not - to match . - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified values are unequal and throws an exception - if the two values are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the test expects not - to match . - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified objects are equal and throws an exception - if the two objects are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the object the tests expects. - - - The second object to compare. This is the object produced by the code under test. - - - Thrown if is not equal to - . - - - - - Tests whether the specified objects are equal and throws an exception - if the two objects are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the object the tests expects. - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified objects are equal and throws an exception - if the two objects are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the object the tests expects. - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified objects are unequal and throws an exception - if the two objects are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the object produced by the code under test. - - - Thrown if is equal to . - - - - - Tests whether the specified objects are unequal and throws an exception - if the two objects are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified objects are unequal and throws an exception - if the two objects are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified floats are equal and throws an exception - if they are not equal. - - - The first float to compare. This is the float the tests expects. - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - Thrown if is not equal to - . - - - - - Tests whether the specified floats are equal and throws an exception - if they are not equal. - - - The first float to compare. This is the float the tests expects. - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified floats are equal and throws an exception - if they are not equal. - - - The first float to compare. This is the float the tests expects. - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified floats are unequal and throws an exception - if they are equal. - - - The first float to compare. This is the float the test expects not to - match . - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - Thrown if is equal to . - - - - - Tests whether the specified floats are unequal and throws an exception - if they are equal. - - - The first float to compare. This is the float the test expects not to - match . - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - Thrown if is equal to . - - - - - Tests whether the specified floats are unequal and throws an exception - if they are equal. - - - The first float to compare. This is the float the test expects not to - match . - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified doubles are equal and throws an exception - if they are not equal. - - - The first double to compare. This is the double the tests expects. - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - Thrown if is not equal to - . - - - - - Tests whether the specified doubles are equal and throws an exception - if they are not equal. - - - The first double to compare. This is the double the tests expects. - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified doubles are equal and throws an exception - if they are not equal. - - - The first double to compare. This is the double the tests expects. - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified doubles are unequal and throws an exception - if they are equal. - - - The first double to compare. This is the double the test expects not to - match . - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - Thrown if is equal to . - - - - - Tests whether the specified doubles are unequal and throws an exception - if they are equal. - - - The first double to compare. This is the double the test expects not to - match . - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - Thrown if is equal to . - - - - - Tests whether the specified doubles are unequal and throws an exception - if they are equal. - - - The first double to compare. This is the double the test expects not to - match . - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified object is an instance of the expected - type and throws an exception if the expected type is not in the - inheritance hierarchy of the object. - - - The object the test expects to be of the specified type. - - - The expected type of . - - - Thrown if is null or - is not in the inheritance hierarchy - of . - - - - - Tests whether the specified object is an instance of the expected - type and throws an exception if the expected type is not in the - inheritance hierarchy of the object. - - - The object the test expects to be of the specified type. - - - The expected type of . - - - The message to include in the exception when - is not an instance of . The message is - shown in test results. - - - Thrown if is null or - is not in the inheritance hierarchy - of . - - - - - Tests whether the specified object is an instance of the expected - type and throws an exception if the expected type is not in the - inheritance hierarchy of the object. - - - The object the test expects to be of the specified type. - - - The expected type of . - - - The message to include in the exception when - is not an instance of . The message is - shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is null or - is not in the inheritance hierarchy - of . - - - - - Tests whether the specified object is not an instance of the wrong - type and throws an exception if the specified type is in the - inheritance hierarchy of the object. - - - The object the test expects not to be of the specified type. - - - The type that should not be. - - - Thrown if is not null and - is in the inheritance hierarchy - of . - - - - - Tests whether the specified object is not an instance of the wrong - type and throws an exception if the specified type is in the - inheritance hierarchy of the object. - - - The object the test expects not to be of the specified type. - - - The type that should not be. - - - The message to include in the exception when - is an instance of . The message is shown - in test results. - - - Thrown if is not null and - is in the inheritance hierarchy - of . - - - - - Tests whether the specified object is not an instance of the wrong - type and throws an exception if the specified type is in the - inheritance hierarchy of the object. - - - The object the test expects not to be of the specified type. - - - The type that should not be. - - - The message to include in the exception when - is an instance of . The message is shown - in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not null and - is in the inheritance hierarchy - of . - - - - - Throws an AssertFailedException. - - - Always thrown. - - - - - Throws an AssertFailedException. - - - The message to include in the exception. The message is shown in - test results. - - - Always thrown. - - - - - Throws an AssertFailedException. - - - The message to include in the exception. The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Always thrown. - - - - - Throws an AssertInconclusiveException. - - - Always thrown. - - - - - Throws an AssertInconclusiveException. - - - The message to include in the exception. The message is shown in - test results. - - - Always thrown. - - - - - Throws an AssertInconclusiveException. - - - The message to include in the exception. The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Always thrown. - - - - - Helper function that creates and throws an AssertionFailedException. - - name of the assertion throwing an exception. - message describing conditions for assertion failure. - The parameters. - - - - Checks the parameter for valid conditions - - The parameter. - The assertion name. - The parameter name. - The message. - The parameters. - - - - Safely converts an object to a string, handling null values and null characters. - Null values are converted to "(null)". Null characters are converted to "\\0". - - The object to convert to a string. - The converted string. - - - - Replaces null characters ('\0') with "\\0". - - The string to search. - The converted string with null characters replaced by "\\0". - - - - An exception from reflection will always be a TargetInvocationException - however - the goal of Private Accessors is to be seamless to the original code. - The only problem with throwing the inner exception is that the stack trace will - be overwritten. From here we register the stack trace of the inner exception - and then throw it. The Unit Test Adapter will then later rebuild the stack - from the cached shadow information plus the remaining stack from this throw. - - - - - - A collection of helper classes to test various conditions associated - with collections within unit tests. If the condition being tested is not - met, an exception is thrown. - - - - - Tests whether the specified collection contains the specified element - and throws an exception if the element is not in the collection. - - - The collection in which to search for the element. - - - The element that is expected to be in the collection. - - - Thrown if is not found in - . - - - - - Tests whether the specified collection contains the specified element - and throws an exception if the element is not in the collection. - - - The collection in which to search for the element. - - - The element that is expected to be in the collection. - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - Thrown if is not found in - . - - - - - Tests whether the specified collection contains the specified element - and throws an exception if the element is not in the collection. - - - The collection in which to search for the element. - - - The element that is expected to be in the collection. - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not found in - . - - - - - Tests whether the specified collection does not contain the specified - element and throws an exception if the element is in the collection. - - - The collection in which to search for the element. - - - The element that is expected not to be in the collection. - - - Thrown if is found in - . - - - - - Tests whether the specified collection does not contain the specified - element and throws an exception if the element is in the collection. - - - The collection in which to search for the element. - - - The element that is expected not to be in the collection. - - - The message to include in the exception when - is in . The message is shown in test - results. - - - Thrown if is found in - . - - - - - Tests whether the specified collection does not contain the specified - element and throws an exception if the element is in the collection. - - - The collection in which to search for the element. - - - The element that is expected not to be in the collection. - - - The message to include in the exception when - is in . The message is shown in test - results. - - - An array of parameters to use when formatting . - - - Thrown if is found in - . - - - - - Tests whether all items in the specified collection are non-null and throws - an exception if any element is null. - - - The collection in which to search for null elements. - - - Thrown if a null element is found in . - - - - - Tests whether all items in the specified collection are non-null and throws - an exception if any element is null. - - - The collection in which to search for null elements. - - - The message to include in the exception when - contains a null element. The message is shown in test results. - - - Thrown if a null element is found in . - - - - - Tests whether all items in the specified collection are non-null and throws - an exception if any element is null. - - - The collection in which to search for null elements. - - - The message to include in the exception when - contains a null element. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if a null element is found in . - - - - - Tests whether all items in the specified collection are unique or not and - throws if any two elements in the collection are equal. - - - The collection in which to search for duplicate elements. - - - Thrown if a two or more equal elements are found in - . - - - - - Tests whether all items in the specified collection are unique or not and - throws if any two elements in the collection are equal. - - - The collection in which to search for duplicate elements. - - - The message to include in the exception when - contains at least one duplicate element. The message is shown in - test results. - - - Thrown if a two or more equal elements are found in - . - - - - - Tests whether all items in the specified collection are unique or not and - throws if any two elements in the collection are equal. - - - The collection in which to search for duplicate elements. - - - The message to include in the exception when - contains at least one duplicate element. The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if a two or more equal elements are found in - . - - - - - Tests whether one collection is a subset of another collection and - throws an exception if any element in the subset is not also in the - superset. - - - The collection expected to be a subset of . - - - The collection expected to be a superset of - - - Thrown if an element in is not found in - . - - - - - Tests whether one collection is a subset of another collection and - throws an exception if any element in the subset is not also in the - superset. - - - The collection expected to be a subset of . - - - The collection expected to be a superset of - - - The message to include in the exception when an element in - is not found in . - The message is shown in test results. - - - Thrown if an element in is not found in - . - - - - - Tests whether one collection is a subset of another collection and - throws an exception if any element in the subset is not also in the - superset. - - - The collection expected to be a subset of . - - - The collection expected to be a superset of - - - The message to include in the exception when an element in - is not found in . - The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if an element in is not found in - . - - - - - Tests whether one collection is not a subset of another collection and - throws an exception if all elements in the subset are also in the - superset. - - - The collection expected not to be a subset of . - - - The collection expected not to be a superset of - - - Thrown if every element in is also found in - . - - - - - Tests whether one collection is not a subset of another collection and - throws an exception if all elements in the subset are also in the - superset. - - - The collection expected not to be a subset of . - - - The collection expected not to be a superset of - - - The message to include in the exception when every element in - is also found in . - The message is shown in test results. - - - Thrown if every element in is also found in - . - - - - - Tests whether one collection is not a subset of another collection and - throws an exception if all elements in the subset are also in the - superset. - - - The collection expected not to be a subset of . - - - The collection expected not to be a superset of - - - The message to include in the exception when every element in - is also found in . - The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if every element in is also found in - . - - - - - Tests whether two collections contain the same elements and throws an - exception if either collection contains an element not in the other - collection. - - - The first collection to compare. This contains the elements the test - expects. - - - The second collection to compare. This is the collection produced by - the code under test. - - - Thrown if an element was found in one of the collections but not - the other. - - - - - Tests whether two collections contain the same elements and throws an - exception if either collection contains an element not in the other - collection. - - - The first collection to compare. This contains the elements the test - expects. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when an element was found - in one of the collections but not the other. The message is shown - in test results. - - - Thrown if an element was found in one of the collections but not - the other. - - - - - Tests whether two collections contain the same elements and throws an - exception if either collection contains an element not in the other - collection. - - - The first collection to compare. This contains the elements the test - expects. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when an element was found - in one of the collections but not the other. The message is shown - in test results. - - - An array of parameters to use when formatting . - - - Thrown if an element was found in one of the collections but not - the other. - - - - - Tests whether two collections contain the different elements and throws an - exception if the two collections contain identical elements without regard - to order. - - - The first collection to compare. This contains the elements the test - expects to be different than the actual collection. - - - The second collection to compare. This is the collection produced by - the code under test. - - - Thrown if the two collections contained the same elements, including - the same number of duplicate occurrences of each element. - - - - - Tests whether two collections contain the different elements and throws an - exception if the two collections contain identical elements without regard - to order. - - - The first collection to compare. This contains the elements the test - expects to be different than the actual collection. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when - contains the same elements as . The message - is shown in test results. - - - Thrown if the two collections contained the same elements, including - the same number of duplicate occurrences of each element. - - - - - Tests whether two collections contain the different elements and throws an - exception if the two collections contain identical elements without regard - to order. - - - The first collection to compare. This contains the elements the test - expects to be different than the actual collection. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when - contains the same elements as . The message - is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if the two collections contained the same elements, including - the same number of duplicate occurrences of each element. - - - - - Tests whether all elements in the specified collection are instances - of the expected type and throws an exception if the expected type is - not in the inheritance hierarchy of one or more of the elements. - - - The collection containing elements the test expects to be of the - specified type. - - - The expected type of each element of . - - - Thrown if an element in is null or - is not in the inheritance hierarchy - of an element in . - - - - - Tests whether all elements in the specified collection are instances - of the expected type and throws an exception if the expected type is - not in the inheritance hierarchy of one or more of the elements. - - - The collection containing elements the test expects to be of the - specified type. - - - The expected type of each element of . - - - The message to include in the exception when an element in - is not an instance of - . The message is shown in test results. - - - Thrown if an element in is null or - is not in the inheritance hierarchy - of an element in . - - - - - Tests whether all elements in the specified collection are instances - of the expected type and throws an exception if the expected type is - not in the inheritance hierarchy of one or more of the elements. - - - The collection containing elements the test expects to be of the - specified type. - - - The expected type of each element of . - - - The message to include in the exception when an element in - is not an instance of - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if an element in is null or - is not in the inheritance hierarchy - of an element in . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Constructs a dictionary containing the number of occurrences of each - element in the specified collection. - - - The collection to process. - - - The number of null elements in the collection. - - - A dictionary containing the number of occurrences of each element - in the specified collection. - - - - - Determines whether the first collection is a subset of the second - collection. If either set contains duplicate elements, the number - of occurrences of the element in the subset must be less than or - equal to the number of occurrences in the superset. - - - The collection the test expects to be contained in . - - - The collection the test expects to contain . - - - True if is a subset of - , false otherwise. - - - - - Finds a mismatched element between the two collections. A mismatched - element is one that appears a different number of times in the - expected collection than it does in the actual collection. The - collections are assumed to be different non-null references with the - same number of elements. The caller is responsible for this level of - verification. If there is no mismatched element, the function returns - false and the out parameters should not be used. - - The first collection to compare. - The second collection to compare. - - The expected number of occurrences of - or 0 if there is no mismatched - element. - - - The actual number of occurrences of - or 0 if there is no mismatched - element. - - - The mismatched element (may be null) or null if there is no - mismatched element. - - - true if a mismatched element was found; false otherwise. - - - - - compares the objects using object.Equals - - - - - This class is designed to help user doing unit testing. - GenericParameterHelper satisfies some comment generic type constraints - such as: - 1. public default constructor - 2. implements common interface: IComparable, IEnumerable, ICloneable - - - - - - public default constructor, satisfies the constraint in C# generics. - This constructor initializes the Data property to a random value. - - - - - This constructor initializes the Data property to a user-supplied value - - - - - - Do the value comparison for two GenericParameterHelper object - - object to do comparison with - true if obj has the same value as 'this' GenericParameterHelper object. - false otherwise. - - - - Returns a hash code for this object. - - - - - - Compares to the object. - - - - - - - Returns an IEnumerator object whose length is derived from - the Data property. - - - - - - Returns a GenericParameterHelper object that is equal to - 'this' one. - - - - - - Gets or sets the Data property. - - - - - Provides method signature discovery for generic methods. - - - - - Given a set of methods that match the base criteria, select a method based - upon an array of types. This method should return null if no method matches - the criteria. - - - - - Set of string assertions. - - - - - Tests whether the specified string contains the specified substring - and throws an exception if the substring does not occur within the - test string. - - - The string that is expected to contain . - - - The string expected to occur within . - - - Thrown if is not found in - . - - - - - Tests whether the specified string contains the specified substring - and throws an exception if the substring does not occur within the - test string. - - - The string that is expected to contain . - - - The string expected to occur within . - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - Thrown if is not found in - . - - - - - Tests whether the specified string contains the specified substring - and throws an exception if the substring does not occur within the - test string. - - - The string that is expected to contain . - - - The string expected to occur within . - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not found in - . - - - - - Tests whether the specified string begins with the specified substring - and throws an exception if the test string does not start with the - substring. - - - The string that is expected to begin with . - - - The string expected to be a prefix of . - - - Thrown if does not begin with - . - - - - - Tests whether the specified string begins with the specified substring - and throws an exception if the test string does not start with the - substring. - - - The string that is expected to begin with . - - - The string expected to be a prefix of . - - - The message to include in the exception when - does not begin with . The message is - shown in test results. - - - Thrown if does not begin with - . - - - - - Tests whether the specified string begins with the specified substring - and throws an exception if the test string does not start with the - substring. - - - The string that is expected to begin with . - - - The string expected to be a prefix of . - - - The message to include in the exception when - does not begin with . The message is - shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if does not begin with - . - - - - - Tests whether the specified string ends with the specified substring - and throws an exception if the test string does not end with the - substring. - - - The string that is expected to end with . - - - The string expected to be a suffix of . - - - Thrown if does not end with - . - - - - - Tests whether the specified string ends with the specified substring - and throws an exception if the test string does not end with the - substring. - - - The string that is expected to end with . - - - The string expected to be a suffix of . - - - The message to include in the exception when - does not end with . The message is - shown in test results. - - - Thrown if does not end with - . - - - - - Tests whether the specified string ends with the specified substring - and throws an exception if the test string does not end with the - substring. - - - The string that is expected to end with . - - - The string expected to be a suffix of . - - - The message to include in the exception when - does not end with . The message is - shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if does not end with - . - - - - - Tests whether the specified string matches a regular expression and - throws an exception if the string does not match the expression. - - - The string that is expected to match . - - - The regular expression that is - expected to match. - - - Thrown if does not match - . - - - - - Tests whether the specified string matches a regular expression and - throws an exception if the string does not match the expression. - - - The string that is expected to match . - - - The regular expression that is - expected to match. - - - The message to include in the exception when - does not match . The message is shown in - test results. - - - Thrown if does not match - . - - - - - Tests whether the specified string matches a regular expression and - throws an exception if the string does not match the expression. - - - The string that is expected to match . - - - The regular expression that is - expected to match. - - - The message to include in the exception when - does not match . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if does not match - . - - - - - Tests whether the specified string does not match a regular expression - and throws an exception if the string matches the expression. - - - The string that is expected not to match . - - - The regular expression that is - expected to not match. - - - Thrown if matches . - - - - - Tests whether the specified string does not match a regular expression - and throws an exception if the string matches the expression. - - - The string that is expected not to match . - - - The regular expression that is - expected to not match. - - - The message to include in the exception when - matches . The message is shown in test - results. - - - Thrown if matches . - - - - - Tests whether the specified string does not match a regular expression - and throws an exception if the string matches the expression. - - - The string that is expected not to match . - - - The regular expression that is - expected to not match. - - - The message to include in the exception when - matches . The message is shown in test - results. - - - An array of parameters to use when formatting . - - - Thrown if matches . - - - - - TestContext class. This class should be fully abstract and not contain any - members. The adapter will implement the members. Users in the framework should - only access this via a well-defined interface. - - - - - Used to write trace messages while the test is running - - format string - the arguments - - - - Adds a file name to the list in TestResult.ResultFileNames - - - - - Begins a timer with the specified name - - - - - Ends a timer with the specified name - - - - - Per test properties - - - - - - Current data row when test is used for data driven testing. - - - - - Current data connection row when test is used for data driven testing. - - - - - Gets the test logs directory. - - - - - Gets the test directory. - - - - - Gets the test deployment directory. - - - - - Gets the test name. - - - - - Gets the CurrentTestOutcome. - - - - - Outcome of a test or a run. - If a new successful state needs to be added you will need to modify - RunResultAndStatistics in TestRun and TestOutcomeHelper below. - - NOTE: the order is important and is used for computing outcome for aggregations. - More important outcomes come first. See TestOutcomeHelper.GetAggregationOutcome. - - - - - Test was executed, but there were issues. - Issues may involve exceptions or failed assertions. - - - - - Test has completed, but we can't say if it passed or failed. - May be used for aborted tests... - - - - - Test was executed w/o any issues. - - - - - Test is currently executing. - - - - - There was a system error while we were trying to execute a test. - - - - - The test timed out. - - - - - Test was aborted by the user. - - - - - Test is in an unknown state - - - - - The data row. - - - - - The database connection. - - - - - Marks a test class. - - - - - Initializes a new test class attribute. - - - - - Marks a test method. - - - - - Initializes a new TestMethodAttribute. - - - - - A method marker called before a test method runs. - - - - - Initializes a new TestInitializeAttribute. - - - - - A method marker called after a test method runs. - - - - - Initializes a new TestCleanupAttribute. - - - - - Ignores a unit test. - - - - - Initializes a new IgnoreAttribute. - - - - - The ExpectedExceptionAttribute. - - - - - Initializes the ExpectedExceptionAttribute. - - The exception type. - - - - Initializes the ExpectedExceptionAttribute. - - The exception type. - The message. - - - - Gets the exception type. - - - - - Gets the message. - - - - - The test property attribute. - - - - - Initializes the TestPropertyAttribute. - - - - - - - Gets the name. - - - - - Gets the value. - - - - - The ClassInitializeAttribute. - - - - - Initializes the ClassInitializeAttribute. - - - - - The ClassCleanupAttribute. - - - - - Initializes the ClassCleanupAttribute. - - - - - The AssemblyInitializeAttribute. - - - - - Initializes the AssemblyInitializeAttribute. - - - - - The AssemblyCleanupAttribute. - - - - - Initializes the AssemblyCleanupAttribute. - - - - - Description of the test. - - - - - Initializes the DescriptionAttribute. - - The description. - - - - Gets the description. - - - - - The OwnerAttribute. - - - - - Initializes the OwnerAttribute. - - The owner. - - - - Gets the owner. - - - - - CSS Project Structure URI. - - - - - Initializes the CSS Project Structure URI. - - The structure. - - - - Gets the property structure. - - - - - CSS Iteration URI - - - - - Initializes the CssIterationAttribute. - - The parameter. - - - - Gets the CssIteration. - - - - - Priority attribute; used to specify the priority of a unit test. - - - - - Initializes the PriorityAttribute. - - The priority. - - - - Gets the Priority. - - - - - Timeout attribute; used to specify the timeout of a unit test. - - - - - Initializes the TimeoutAttribute. - - - - - - Gets the Timeout. - - - - - WorkItem attribute; used to specify a work item associated with this test. - - - - - Initializes the WorkItemAttribute. - - - - - - Gets the ID. - - - - - HostType specifies the type of host that this unit test will - run in. - - - - - Initializes the host type attribute. - - - - - - Constructor of HostTypeAttribute. - - The type of the host. - Custom data for the host adapter. - - - The reason this is string (and not object) is that currently CMI cannot parse arbitrary instances of object and we deprioritized changing CMI. - - - - Gets the host type. - - - - - Gets the host data. - - - - - Used to specify deployment item (file or directory) for per-test deployment. - Can be specified on test class or test method. - Can have multiple instances of the attribute to specify more than one item. - The item path can be absolute or relative, if relative, it is relative to RunConfig.RelativePathRoot. - - - [DeploymentItem("file1.xml")] - [DeploymentItem("file2.xml", "DataFiles")] - [DeploymentItem("bin\Debug")] - - - - - Initializes DeploymentItemAttribute. - - The path. - - - - Initializes DeploymentItemAttribute. - - The path. - The output directory. - - - - Verifiable interface. - - - - - The IsValid method. - - Returns a value. - - - diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.dll b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.dll deleted file mode 100644 index f34e7840dd..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.pdb b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.pdb deleted file mode 100644 index cb3bc71624..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.xml b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.xml deleted file mode 100644 index 477ce707e7..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.Silverlight.Testing.xml +++ /dev/null @@ -1,14796 +0,0 @@ - - - - Microsoft.Silverlight.Testing - - - - - A class containing an Assert method. - - - - - The MethodInfo object used to invoke Assert.IsNotNull. - - - - - The MethodInfo object used to invoke Assert.AreNotSame. - - - - - The MethodInfo object used to invoke Assert.AreNotEqual. - - - - - The MethodInfo object used to invoke Assert.AreSame. - - - - - The MethodInfo object used to invoke Assert.AreEqual. - - - - - The MethodInfo object used to invoke Assert.IsNull. - - - - - The MethodInfo object used to invoke Assert.IsFalse. - - - - - The MethodInfo object used to invoke Assert.IsTrue. - - - - - A regular expression which identifies a pattern signifying an - anonymous type. This pattern is emitted by the Expression object - when it converts an anonymous type to a string. - - - - - A regular expression which identifies a pattern emitted by an - Expression object when it converts an anonymous type to a - string. - - - - - Asserts a condition is true. - - The condition that must be true. - - - - Asserts a condition is true. - - The condition that must be true. - The message to be displayed when the test fails. - - - - Generates an assert failure message using the code block - responsible for the failure. - - The predicate that fails. - The user-provided assertion failure message. - - A constant expression containing the user-provided failure - message or a description of the expression that failed. - - - - Analyzes the expression and creates an action which calls the - correct assert method based on its contents. - - The predicate expression. - The message to display if an assertion fails. - An action which calls the correct assert method. - - - - Analyzes a predicate expression and invokes the correct assert - method. - - The type of the argument to the predicate. - - A predicate to be converted into an - assert statement. - The assertion message. - - - - Creates an action from certain types of supported binary expression - patterns. If no supported pattern is found null is returned. Based - on analyzing the predicate the action invokes the correct Assert - method. - - A binary expression extracted from a - predicate expression. - The message to display if the assertion - fails. - An action that invokes an Assert method. - - - - Mark the test method as one which expects asynchronous execution. - It is important to call TestComplete() once it is ready or your - test will never continue/timeout. - - - - - An attribute that contains known bug information that can be logged - during a unit test run. - - When applied to a test method, it will invert the result. This makes it - possible to perform automated runs and continuous integration while - validating and tracking known issues. - - The attribute should have the Fixed bool set to True, or be removed, - once the issue is resolved. - - - - - Construct a new BugAttribute with no bug description. - - - - - Construct a new BugAttribute with a bug description. - - Known issue text. - - - - Return the bug information. - - Known issue as a string. - - - - Gets the bug description. - - - - - Gets or sets a value indicating whether the known issue has been - fixed. If it has, the attribute is ignored and will not affect - test results. - - - - - Represents a control that builds on top of the standard platform Button, - offering the ability to modify the corner radii or even use special - button modes. - - - - - Identifies the SecondaryVisibility dependency property. - - - - - Identifies the CornerRadius dependency property. - - - - - Gets or sets the visibility of a secondary set of visuals in the - template. - - - - - Gets or sets the corner radius to use. - - - - - A color selection converter for translating a bool result into - a color. - - - - - Initializes a new instance of the ColorSelectorConverter type. - - - - - Convert a boolean value to a Color value. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support 2-way databinding of the VisibilityConverter, converting - Visibility to a boolean. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Gets or sets the color to use for true values. - - - - - Gets or sets the color to use for false values. - - - - - A set of extension methods for manipulating collections. - - Experimental - - - - Returns a value indicating whether a collection is read-only. - - The collection to examine. - A value indicating whether a collection is read-only. - - - - Returns a value Indicating whether an item can be inserted in a - collection. - - The collection. - The item to be inserted. - A value Indicating whether an item can be inserted in a - collection. - - - - Inserts an item into the collection at an index. - - The collection. - The index at which to insert the item. - The item to be inserted. - - - - Gets the number of items in the collection. - - The collection. - The number of items in the collection. - - - - Adds an item to the collection. - - The collection. - The item to be added. - - - - Removes an item from the collection. - - The collection. - The item to be removed. - - - - Removes an item at a given index from the collection. - - The collection. - The index of the item to be removed. - - - - A color selection converter for translating a bool result into - a color. - - - - - The default true color. - - - - - The default false color. - - - - - Initializes a new instance of the ColorSelectorConverter type. - - - - - Convert a boolean value to a Color value. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support 2-way databinding of the VisibilityConverter, converting - Visibility to a boolean. - - The value. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Gets or sets the color to use for true values. - - - - - Gets or sets the color to use for false values. - - - - - A set of extension methods for the sequence class. - ;dsf - - - - Produces a sequence of items using a seed value and iteration - method. - - The type of the sequence. - The initial value. - The iteration function. - A sequence of items using a seed value and iteration - method. - - - - Prepend an item to a sequence. - - The type of the sequence. - The sequence to append the item to. - The item to append to the sequence. - A new sequence. - - - - Accepts two sequences and applies a function to the corresponding - values in the two sequences. - - The type of the first sequence. - The type of the second sequence. - The return type of the function. - The first sequence. - The second sequence. - The function to apply to the corresponding values - from the two sequences. - A sequence of transformed values from both sequences. - - - - A converter for modifying the font weight based on a parameter. - - - - - Convert a boolean value to a FontWeight value. - - The value object. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support 2-way databinding of the VisibilityConverter, converting - Visibility to a bool. - - The value object. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Determine the visibility mode based on a converter parameter. This - parameter is of type Visibility, and specifies what visibility value - to return when the boolean value is true. - - The parameter object. - Returns a FontWeight value. - - - - Determine whether or not weight is inverted based on a converter - parameter. - - The parameter instance. - Returns a value indicating whether the instance is - inverting. - - - - Collection of functions for functional programming tasks. - - - - - Traverses a tree by accepting an initial value and a function that - retrieves the child nodes of a node. - - The type of the stream. - The initial node. - A function that retrieves the child - nodes of a node. - A predicate that evaluates a node - and returns a value indicating whether that node and it's children - should be traversed. - A stream of nodes. - - - - The test results header control. - - - - - Initializes a new instance of the Header type. - - - - - InitializeComponent - - - - - A value converter for collapsing or showing elements based on the bound - object's type name. Does not walk the hierarchy - it is explicit to the - most specific class for the value. This class, - InvertedTypeNameVisibilityConverter, offers the opposite behavior of the - TypeNameVisibilityConverter class. - - - - - A value converter for collapsing or showing elements based on the bound - object's type name. Does not walk the hierarchy - it is explicit to the - most specific class for the value. - - - - - Convert a value based on CLR type to a Visibility value. Does not - walk the type tree, however. - - The value instance. - The target parameter. - ConverterParameter is the name of the type, - both short and full names are checked, short name first. - The culture parameter. - Returns the object. - - - - Convert back, not supported with this value converter. - - The value instance. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Gets a value indicating whether the visibility value should be - inverted. - - - - - Gets a value indicating whether the visibility value should be - inverted. - - - - - Provides useful extensions to ItemsControl instances. - - Experimental - - - - Gets the Panel that contains the containers of an ItemsControl. - - The ItemsControl. - - The Panel that contains the containers of an ItemsControl, or null - if the Panel could not be found. - - - is null. - - - - - Gets the ScrollViewer that contains the containers of an - ItemsControl. - - The ItemsControl. - - The ScrollViewer that contains the containers of an ItemsControl, or - null if a ScrollViewer could not be found. - - - is null. - - - - - Get the item containers of an ItemsControl. - - The ItemsControl. - The item containers of an ItemsControl. - - is null. - - - - - Get the item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The item containers of an ItemsControl. - - is null. - - - - - Get the item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The item containers of an ItemsControl. - - - - Get the items and item containers of an ItemsControl. - - The ItemsControl. - The items and item containers of an ItemsControl. - - is null. - - - - - Get the items and item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The items and item containers of an ItemsControl. - - is null. - - - - - Get the items and item containers of an ItemsControl. - - - The type of the item containers. - - The ItemsControl. - The items and item containers of an ItemsControl. - - is null. - - - - - Returns a value indicating whether an item can be added to an - ItemsControl. - - The ItemsControl instance. - The item to be added. - A value Indicating whether an item can be added to an - ItemsControl. - - - - Returns a value indicating whether an item can be removed from the - ItemsControl. - - The items control. - A value indicating whether an item can be removed from the - ItemsControl. - - - - Inserts an item into an ItemsControl. - - The ItemsControl instance. - The index at which to insert the item. - The item to be inserted. - - - - Adds an item to an ItemsControl. - - The ItemsControl instance. - The item to be inserted. - - - - Removes an item from an ItemsControl. - - The ItemsControl instance. - The item to be removed. - - - - Removes an item from an ItemsControl. - - The ItemsControl instance. - The index of the item to be removed. - - - - Gets the number of items in an ItemsControl. - - The ItemsControl instance. - The number of items in the ItemsControl. - - - - Represents a control that applies a layout transformation to its Content. - - Preview - - - - Name of the TransformRoot template part. - - - - - Name of the Presenter template part. - - - - - Acceptable difference between two doubles. - - - - - Number of decimals to round the Matrix to. - - - - - Identifies the LayoutTransform DependencyProperty. - - - - - Root element for performing transformations. - - - - - ContentPresenter element for displaying the content. - - - - - RenderTransform/MatrixTransform applied to _transformRoot. - - - - - Transformation matrix corresponding to _matrixTransform. - - - - - Actual DesiredSize of Child element (the value it returned from its MeasureOverride method). - - - - - Initializes a new instance of the LayoutTransformer class. - - - - - Builds the visual tree for the LayoutTransformer control when a new - template is applied. - - - - - Handles changes to the Transform DependencyProperty. - - Source of the change. - Event args. - - - - Applies the layout transform on the LayoutTransformer control content. - - - Only used in advanced scenarios (like animating the LayoutTransform). - Should be used to notify the LayoutTransformer control that some aspect - of its Transform property has changed. - - - - - Processes the Transform to determine the corresponding Matrix. - - Transform to process. - - - - Walks the Transform(Group) and returns the corresponding Matrix. - - Transform(Group) to walk. - Computed Matrix. - - - - Provides the behavior for the "Measure" pass of layout. - - The available size that this element can give to child elements. - The size that this element determines it needs during layout, based on its calculations of child element sizes. - - - - Provides the behavior for the "Arrange" pass of layout. - - The final area within the parent that this element should use to arrange itself and its children. - The actual size used. - - Using the WPF paramater name finalSize instead of Silverlight's finalSize for clarity - - - - - Compute the largest usable size (greatest area) after applying the transformation to the specified bounds. - - Arrange bounds. - Largest Size possible. - - - - Returns true if Size a is smaller than Size b in either dimension. - - Second Size. - First Size. - True if Size a is smaller than Size b in either dimension. - - - - Rounds the non-offset elements of a Matrix to avoid issues due to floating point imprecision. - - Matrix to round. - Number of decimal places to round to. - Rounded Matrix. - - - - Implements WPF's Rect.Transform on Silverlight. - - Rect to transform. - Matrix to transform with. - Bounding box of transformed Rect. - - - - Implements WPF's Matrix.Multiply on Silverlight. - - First matrix. - Second matrix. - Multiplication result. - - - - Implements WPF's Matrix.HasInverse on Silverlight. - - Matrix to check for inverse. - True if the Matrix has an inverse. - - - - Outputs diagnostic info if DIAGNOSTICWRITELINE is defined. - - Diagnostic message. - - - - Gets or sets the layout transform to apply on the LayoutTransformer - control content. - - - Corresponds to UIElement.LayoutTransform. - - - - - Gets the child element being transformed. - - - - - The TagEditor control provides a brief user interface allowing for the - selection of a set of tests, used to filter the test run. - - - - - Key used to lookup the TagHistory site setting. - - - - - Number of seconds to wait before running the test. - - - - - Initializes a new instance of the TagEditor type. - - The tag expression to use. - - - - Initializes a new instance of the TagEditor type. - - - - - Fires the Complete event. - - The event arguments. - - - - Handle touch of the button to display the text box. - - Tag button. - Event arguments. - - - - Handle selection of a tag button. - - Tag button. - Event arguments. - - - - Handle changes to the Tag text. - - Tag TextBox. - Event arguments. - - - - Handle clicks to the Run button. - - Run Button. - Event arguments. - - - - Handle timer ticks. - - The timer. - Event arguments. - - - - Stop the timer. - - - - - Run the unit tests. - - - - - Cancels the selection of a tag expression. - - The source object. - The event data. - - - - InitializeComponent - - - - - Gets or sets the timer used to automatically run tests if no tag is - entered. - - - - - Gets or sets the number of seconds already waited. - - - - - Gets or sets the tag history. - - - - - An event that indicates that the tag editor is complete. This can be - in response to many actions: the user entering a tag expression, the - time expiring and the default being selected, or the selection being - canceled. - - - - - Mobile test exceptions page. - - - - - Initializes a new instance of the page. - - - - - InitializeComponent - - - - - Mobile test method details page. - - - - - Initializes a new instance of the page. - - - - - InitializeComponent - - - - - A user control designed for mobile platforms. The control should be used - as the root visual for a Silverlight plugin if developers would like to - use the advanced TestSurface functionality. - - - - - An interface for any test page instances to implement. - - - - - Gets the test panel instance. - - - - - An interface for any test page instances to implement. - - - - - Requests navigation back a page. - - A value indicating whether the operation was successful. - - - - Contains the slide manager for the primitive user interface - navigation system. - - - - - Backing field for the unit test harness instance. - - - - - Backing field for the startup timer. - - - - - Backing field for the model manager. - - - - - Initializes a new instance of the MobileTestPage class. - - - - - Initializes the MobileTestPage object. - - The test harness instance. - - - - Waits for the Settings to become available, either by the service or - system setting the instance property. - - The source timer. - The event arguments. - - - - Creates a new slide and inserts it into the slide manager, plus - visual tree. - - The text header to use. - The content to inside the slide. - Returns the new Slide instance. - - - - Handles the completion event on the tag expression editor to begin - the test run using the user-provided settings. - - The source object. - The event arguments. - - - - Starts the test run. - - - - - Handles the test harness complete event, to display results. - - The source object. - The event data. - - - - Handles the movement back to the test assemblies list. - - The source object. - The event arguments. - - - - Handles the movement back to the test classes list. - - The source object. - The event arguments. - - - - Handles the movement back to the test methods list. - - The source object. - The event arguments. - - - - Handles the selection of a test assembly. - - The source object. - The event arguments. - - - - Handles the selection of a test class. - - The source object. - The event arguments. - - - - Handles the selection of a test method. - - The source object. - The event arguments. - - - - Requests navigation back a page. - - A value indicating whether the operation was successful. - - - - InitializeComponent - - - - - Gets the test surface, a dynamic Panel that removes its children - elements after each test completes. - - - - - Gets the unit test harness instance. - - - - - A derived TreeView control specific to the application needs for - showing results in real-time. - - - - - Represents a control that displays hierarchical data in a tree structure - that has items that can expand and collapse. - - Stable - - - - The IUpdateVisualState interface is used to provide the - InteractionHelper with access to the type's UpdateVisualState method. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - A value indicating whether a read-only dependency property change - handler should allow the value to be set. This is used to ensure - that read-only properties cannot be changed via SetValue, etc. - - - - - A value indicating whether a dependency property change handler - should ignore the next change notification. This is used to reset - the value of properties without performing any of the actions in - their change handlers. - - - - - Identifies the - - dependency property. - - - The identifier for the - - property. - - - - - SelectedItemProperty property changed handler. - - TreeView that changed its SelectedItem. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - SelectedValueProperty property changed handler. - - TreeView that changed its SelectedValue. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - SelectedValuePathProperty property changed handler. - - TreeView that changed its SelectedValuePath. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - ItemContainerStyleProperty property changed handler. - - - TreeView that changed its ItemContainerStyle. - - Event arguments. - - - - Initializes a new instance of the - class. - - - - - Returns a - - for use by the Silverlight automation infrastructure. - - - A - - for the control. - - - - - Builds the visual tree for the - control when a new - control template is applied. - - - - - Update the visual state of the TreeView. - - - A value indicating whether to use transitions when updating the - visual state. - - - - - Creates a to - display content. - - - A to use as a - container for content. - - - - - Determines whether the specified item is a - , which is the - default container for items in the - control. - - The object to evaluate. - - True if the item is a - ; otherwise, - false. - - - - - Prepares the container element to display the specified item. - - - The container element used to display the specified item. - - The item to display. - - - - Removes all templates, styles, and bindings for the object displayed - as a . - - - The element to - clear. - - - The item that is contained in the - . - - - - - Makes adjustments to the - control when the - value of the - property - changes. - - - A - - that contains data about the change. - - - - - Select any descendents when adding new TreeViewItems to a TreeView. - - The added item. - - - - Propagate OnKeyDown messages from the root TreeViewItems to their - TreeView. - - Event arguments. - - Because Silverlight's ScrollViewer swallows many useful key events - (which it can ignore on WPF if you override HandlesScrolling or use - an internal only variable in Silverlight), the root TreeViewItems - explicitly propagate KeyDown events to their parent TreeView. - - - - - Provides handling for the - event when a key - is pressed while the control has focus. - - - A that contains - the event data. - - - is null. - - - - - Handle keys related to scrolling. - - The key to handle. - A value indicating whether the key was handled. - - - - Handle scrolling a page up or down. - - - A value indicating whether the page should be scrolled up. - - - A value indicating whether the scroll was handled. - - - - - Provides handling for the KeyUp event. - - Event arguments. - - - - Provides handling for the MouseEnter event. - - Event arguments. - - - - Provides handling for the MouseLeave event. - - Event arguments. - - - - Provides handling for the MouseMove event. - - Event arguments. - - - - Provides handling for the - - event. - - - A that - contains the event data. - - - - - Provides handling for the MouseLeftButtonUp event. - - Event arguments. - - - - Provides handling for mouse button events. - - A value indicating whether the event was handled. - - - - Provides handling for the GotFocus event. - - Event arguments. - - - - Provides handling for the LostFocus event. - - Event arguments. - - - - Raises the - - event when the - - property value changes. - - - A - that contains the event data. - - - - - Change whether a TreeViewItem is selected. - - - Item whose selection is changing. - - - Container of the item whose selection is changing. - - - A value indicating whether the TreeViewItem is selected. - - - - - Update the selected value of the of the TreeView based on the value - of the currently selected TreeViewItem and the SelectedValuePath. - - - Value of the currently selected TreeViewItem. - - - - - Select the first item of the TreeView. - - - - - Focus the first item in the TreeView. - - A value indicating whether the item was focused. - - - - Focus the last item in the TreeView. - - A value indicating whether the item was focused. - - - - Gets the selected item in a - . - - - The currently selected item or null if no item is selected. The - default value is null. - - - - - Gets the value of the - - property that is specified by the - - property. - - - The value of the - - property that is specified by the - - property, or null if no item is selected. The default value is null. - - - - - Gets or sets the property path that is used to get the - - property of the - - property in a . - - - The property path that is used to get the - - property of the - - property in a . The - default value is . - - - - - Gets or sets the that is - applied to the container element generated for each item. - - - The applied to the container - element that contains each item. - - - - - Gets the currently selected TreeViewItem container. - - - - - Gets a value indicating whether the currently selected TreeViewItem - container is properly hooked up to the TreeView. - - - - - Gets or sets a value indicating whether the selected item is - currently being changed. - - - - - Gets the ItemsControlHelper that is associated with this control. - - - - - Gets the helper that provides all of the standard - interaction functionality. - - - - - Gets a value indicating whether the Control key is currently - pressed. - - - - - Gets a value indicating whether the Shift key is currently pressed. - - - - - Occurs when the value of the - - property changes. - - - - - Overrides the item to allow for simple binding to the expanded - property on the item. - - Returns a new container for an item. - - - - This method returns the container with an expanded binding. - - Returns the container with an expanded binding. - - - - A derived TreeViewItem for IsExpanded binding. - - - - - Provides a selectable item for the - control. - - Stable - - - - Represents a control that contains a collection of items and a header. - - Stable - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - Note: WPF defines this property via a call to AddOwner of - HeaderedContentControl's HeaderProperty. - - - - - HeaderProperty property changed handler. - - - HeaderedItemsControl that changed its Header. - - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - Note: WPF defines this property via a call to AddOwner of - HeaderedContentControl's HeaderTemplateProperty. - - - - - HeaderTemplateProperty property changed handler. - - - HeaderedItemsControl that changed its HeaderTemplate. - - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - ItemContainerStyleProperty property changed handler. - - - HeaderedItemsControl that changed its ItemContainerStyle. - - Event arguments. - - - - Initializes a new instance of the - class. - - - - - Called when the value of the - - property changes. - - - The old value of the - - property. - - - The new value of the - - property. - - - - - Called when the value of the - - property changes. - - - The old value of the - - property. - - - The new value of the - - property. - - - - - Builds the visual tree for the - when a - new template is applied. - - - - - Prepares the specified element to display the specified item. - - - The container element used to display the specified item. - - The content to display. - - - - Prepares the specified container to display the specified item. - - - Container element used to display the specified item. - - Specified item to display. - The parent ItemsControl. - - The ItemContainerStyle for the parent ItemsControl. - - - - - Prepare a PrepareHeaderedItemsControlContainer container for an - item. - - Container to prepare. - Item to be placed in the container. - The parent ItemsControl. - - The ItemContainerStyle for the parent ItemsControl. - - - - - Check whether a control has the default value for a property. - - The control to check. - The property to check. - - True if the property has the default value; false otherwise. - - - - - Gets or sets a value indicating whether the Header property has been - set to the item of an ItemsControl. - - - - - Gets or sets the item that labels the control. - - - The item that labels the control. The default value is null. - - - - - Gets or sets a data template that is used to display the contents of - the control's header. - - - Gets or sets a data template that is used to display the contents of - the control's header. The default is null. - - - - - Gets or sets the that is - applied to the container element generated for each item. - - - The that is applied to the - container element generated for each item. The default is null. - - - - - Gets the ItemsControlHelper that is associated with this control. - - - - - The name of the ExpanderButton template part. - - - - - The name of the Header template part. - - - - - The ExpanderButton template part is used to expand and collapse the - TreeViewItem. - - - - - The Header template part is used to distinguish the bound Header - content of the TreeViewItem. - - - - - The ExpansionStates visual state group. - - - - - A value indicating whether a read-only dependency property change - handler should allow the value to be set. This is used to ensure - that read-only properties cannot be changed via SetValue, etc. - - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - HasItemsProperty property changed handler. - - TreeViewItem that changed its HasItems. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - IsExpandedProperty property changed handler. - - TreeViewItem that changed its IsExpanded. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - IsSelectedProperty property changed handler. - - TreeViewItem that changed its IsSelected. - Event arguments. - - - - Identifies the - - dependency property. - - - The identifier for the - - dependency property. - - - - - IsSelectionActiveProperty property changed handler. - - TreeViewItem that changed its IsSelectionActive. - Event arguments. - - - - A reference to the parent ItemsControl of a TreeViewItem. - - - - - Initializes a new instance of the - class. - - - - - Returns a - - for use by the Silverlight automation infrastructure. - - - A - - object for the - . - - - - - Builds the visual tree for the - control when a - new control template is applied. - - - - - Provides handling for the ExpansionStates CurrentChanged event. - - The ExpansionState VisualStateGroup. - Event arguments. - - - - Scroll the TreeViewItem into view. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - Creates a to - display content. - - - A to use as a - container for content. - - - - - Determines whether an object is a - . - - The object to evaluate. - - True if is a - ; otherwise, - false. - - - - - Prepares the specified container element to display the specified - item. - - - Container element used to display the specified item. - - The item to display. - - - - Removes all templates, styles, and bindings for the object displayed - as a . - - - The element to - clear. - - - The item that is contained in the - . - - - - - Makes adjustments to the - when the value - of the - property changes. - - - A - - that contains data about the change. - - - - - Raise a RoutedEvent. - - Event handler. - Event arguments. - - - - Raises an - event - when the - - property changes from false to true. - - - A that contains the - event data. - - - - - Raises a - - event when the - - property changes from true to false. - - - A that contains the - event data. - - - - - Handle changes to the IsExpanded property. - - Event handler. - Event arguments. - - - - Raises the - event - when the - - property changes from false to true. - - - A that contains the - event data. - - - - - Raises the - - event when the - - property changes from true to false. - - - A that contains the - event data. - - - - - Provides handling for the - event. - - - A that contains the - event data. - - - - - Provides handling for the - event. - - - A that contains the - event data. - - - - - Handle the ExpanderButton's GotFocus event. - - The ExpanderButton. - Event Arguments. - - - - Provides handling for the - event. - - - A that contains - the event data. - - - - - Provides handling for the - event. - - - A that contains - the event data. - - - - - Provides handling for the Header's MouseLeftButtonDown event. - - The Header template part. - Event arguments. - - - - Provides handling for the ExpanderButton's Click event. - - The ExpanderButton. - Event Arguments. - - - - Provides handling for the - event. - - - A that - contains the event data. - - - - - Provides handling for the - event. - - - A that - contains the event data. - - - - - Provides handling for the - event when the - has focus. - - - A that contains - the event data. - - - - - Try moving the focus down from the selected item. - - - A value indicating whether the focus was successfully moved. - - - - - Provides handling for the - event. - - - A that contains - the event data. - - - - - Try moving the focus up from the selected item. - - - A value indicating whether the focus was successfully moved. - - - - - Handle scrolling a page up or down. - - - A value indicating whether the page should be scrolled up. - - The ScrollViewer being scrolled. - The height of the viewport. - The top of item to start from. - The bottom of the item to start from. - The height of this item. - - A value indicating whether the scroll was handled. - - - - - Calculate the distance between this TreeViewItem and the item being - paged from. - - - A value indicating whether the page should be scrolled up. - - The element being paged from. - The ScrollViewer being scrolled. - The top of item to start from. - The bottom of the item to start from. - - The distance between the top/bottom of one item to the other. - - - A value indicating whether the scroll was handled. - - - - - Change the selected status of the TreeViewItem. - - - A value indicating whether the TreeViewItem is selected. - - - - - Update the ancestors of this item when it changes selection. - - - A value indicating whether the item is selected. - - - Unselection updates need to occur before selection updates because - the old and new selected items may share a partial path. - - - - - Determine whether the TreeViewItem should be allowed to handle a key - event. - - - A value indicating whether the key event should be handled. - - - - - Navigate the focus to the next TreeViewItem below this item. - - - A value indicating whether the focus was navigated. - - - - - Navigate the focus to the very last TreeViewItem descendent of the - this item. - - - A value indicating whether the focus was navigated. - - - - - Find the next focusable TreeViewItem below this item. - - - A value indicating whether the item should recurse into its child - items when searching for the next focusable TreeViewItem. - - The next focusable TreeViewItem below this item. - - - - Find the last focusable TreeViewItem contained by this item. - - - The last focusable TreeViewItem contained by this item. - - - - - Find the previous focusable TreeViewItem above this item. - - - The previous focusable TreeViewItem above this item. - - - - - Gets or sets the ExpanderButton template part is used to expand and - collapse the TreeViewItem. - - - - - Gets the Header template part that is used to distinguish the bound - Header content of the TreeViewItem. - - - - - Gets or sets the ExpansionStates visual state group. - - - - - Gets or sets a value indicating whether a dependency property change - handler should ignore the next change notification. This is used to - reset the value of properties without performing any of the actions - in their change handlers. - - - - - Gets a value indicating whether this - contains - items. - - - True if this - contains items; otherwise, false. The default is false. - - - - - Gets or sets a value indicating whether the - - contained by this - are expanded - or collapsed. - - - True to indicate the contents of the - - collection are expanded; false to indicate the items are collapsed. - The default is false. - - - - - Gets or sets a value indicating whether this - is selected. - - - True if this - is selected; otherwise, false. The default is false. - - - - - Gets a value indicating whether the - has focus. - - - True if this - has focus; otherwise, false. The default is false. - - - - - Gets the helper that provides all of the standard - interaction functionality. - - - - - Gets or sets a value indicating whether the TreeView's currently - selected item is a descendent of this TreeViewItem. - - - - - Gets or sets a value indicating whether the TreeViewItem should - ignore the next GotFocus event it receives because it has already - been handled by one of its children. - - - - - Gets or sets a value indicating whether checking ContainsSelection - should actually perform the update notifications because the item - was selected before it was in the visual tree. - - - - - Gets or sets a value indicating whether a user initiated action - caused the IsExpanded property to be set. - - - - - Gets or sets a reference to the parent ItemsControl of a - TreeViewItem. - - - - - Gets a reference to the parent TreeViewItem of this TreeViewItem. - - - - - Gets a reference to the parent TreeView of the TreeViewItem. - - - - - Gets a value indicating whether this TreeViewItem is a root of the - TreeView. - - - - - Gets a value indicating whether the TreeViewItem can expand when it - receives appropriate user input. - - - - - Occurs when the - - property changes from true to false. - - - - - Occurs when the - - property changes from false to true. - - - - - Occurs when the - - property of a - changes from false to true. - - - - - Occurs when the - - property of a - changes from true to false. - - - - - Overrides the item to allow for simple binding to the expanded - property on the item. - - Returns a new container for an item. - - - - Overrides the key down event to allow toggling the space. - - The key event arguments data. - - - - A specialized content control that contains a fixed header, a standard - header content property, plus content. It is designed specifically for - a "slide-based" user interface for simple user interfaces. - - - - - The visual state group name for slide position. - - - - - The visual state name for left position. - - - - - The visual state name for right position. - - - - - The normal visual state name for position. - - - - - The content template part name. - - - - - The header template part name. - - - - - The fixed header template name. - - - - - The manager of the slide and its siblings. - - - - - Identifies the Header dependency property. - - - - - Identifies the FixedHeader dependency property. - - - - - Identifies the Position dependency property. - - - - - PositionProperty property changed handler. - - Slide that changed its Position. - Event arguments. - - - - Initializes a new instance of the Slide class. - - - - - Remove the slide from the parent manager. - - - - - Locate template parts and assign instances to fields during template - application. - - - - - Fires the slide changed event. - - - - - Fires the current state changed event. - - The source object. - The event arguments. - - - - Helps debugging by providing information about the slide name. - - Returns the name of the slide. - - - - Updates the visual state. - - A value indicating whether to use - visual transitions for the state change. - The slide position to use. - - - - Event fired when the current slide changes. - - - - - Gets or sets the primary header content. - - - - - Gets or sets the fixed header content. - - - - - Gets or sets the position of the slide. - - - - - Gets or sets the slide manager for the slide. - - - - - A helper class to managing sets of slides. - - - - - Initializes a new instance of the SlideManager class. - - - - - Stores the linked list node for the current slide. - - - - - Backing field for the set of slides. - - - - - Adds a slide or an array of slides to the managed slide set. - - The slides to manage. - - - - Initializes the position of the slide based on location. - - The slide instance. - A property indicating whether the slide is the - first to be managed. - - - - Manages a new slide, inserting it after an existing slide node. - - The node to insert after. - The new slide instance. - Returns the linked list node that is inserted. - - - - Inserts a slide as the first in the linked list. - - The new slide instance. - Returns the linked list node. - - - - Insert a slide after a provided linked list node. - - The node to insert after. - The new slide to insert. - Returns the new linked list node. - - - - Remove a slide from management. - - The slide instance. - - - - Move to the previous slide. - - - - - Move to the next slide. - - - - - Moves to a specific slide, moving the others to the appropriate - direction on screen. - - The slide to move to. - - - - Move in a direction. - - A value indicating whether the direction to - move is forward or not. - - - - Gets the current slide instance. - - - - - Indicates the position that the slide should have. - - - - - Normal position, centered on the screen. - - - - - To the left of the screen. - - - - - To the right of the screen. - - - - - The TagEditor control provides a brief user interface allowing for the - selection of a set of tests, used to filter the test run. - - - - - Key used to lookup the TagHistory site setting. - - - - - Key used to lookup whether the last run used tag expressions. - - - - - Number of seconds to wait before running the test. - - - - - Backing field for the last run used value. - - - - - Initializes a new instance of the TagEditor type. Also includes a - set of sample tags for display to the end user. - - The tag expression to use. - Sample tags to display. - - - - Initializes a new instance of the TagEditor type. - - The tag expression to use. - - - - Initializes a new instance of the TagEditor type. - - - - - Handles the key down event. - - The key event arguments. - - - - Fires the Complete event. - - The event arguments. - - - - Creates a new button. - - The button content. - Returns a new Button instance. - - - - Handle selection of a tag button. - - Tag button. - Event arguments. - - - - Handle changes to the Tag text. - - Tag TextBox. - Event arguments. - - - - Handle clicks to the Run button. - - Run Button. - Event arguments. - - - - Handle timer ticks. - - The timer. - Event arguments. - - - - Stop the timer. - - - - - Run the unit tests. - - - - - Cancels the selection of a tag expression. - - The source object. - The event data. - - - - InitializeComponent - - - - - Gets or sets the timer used to automatically run tests if no tag is - entered. - - - - - Gets or sets the number of seconds already waited. - - - - - Gets or sets the tag history. - - - - - An event that indicates that the tag editor is complete. This can be - in response to many actions: the user entering a tag expression, the - time expiring and the default being selected, or the selection being - canceled. - - - - - A class for storing event information relating to a user's selected - tag expression for a test run. - - - - - Initializes a new instance of the TagExpression event arguments - class. - - The tag expression. - - - - Gets the tag expression stored in the event arguments. - - - - - Gets a value indicating whether a tag expression has been set. - - - - - Displays information about any exceptions listed in the results. - - - - - Initializes a new instance of the TestExceptionDetails class. - - - - - InitializeComponent - - - - - Details view for test method data. - - - - - Initializes a new instance of the TestMethodDetails class. - - - - - InitializeComponent - - - - - A set of simple time helper methods. - - - - - Returns a human-readable formatting of the time different between - two DateTime instances. - - The starting time. - The finishing time. - Returns a human-readable string. - - - - Returns a human-readable formatting of the time different between - two DateTime instances. - - The time span instance. - Returns a human-readable string. - - - - A plural 's' as the suffix, when not equal to one. - - The string value. - The number to check. - Returns an empty string or the English plural 's'. - - - - Provides the necessary infrastructure to enable drawing connecting - lines between the TreeViewItems in a TreeView. - - Experimental - - - - Gets the value of the ConnectingLineInfo attached property for a - specified TreeViewItem. - - - The TreeViewItem from which the property value is read. - - - The ConnectingLineInfo property value for the TreeViewItem. - - - - - Identifies the ConnectingLineInfo dependency property. - - - - - Gets the value of the IsVerticalConnectingLineOf attached property - for a specified Line. - - The Line from which the property value is read. - The IsVerticalConnectingLineOf property value for the Line. - - - - Sets the value of the IsVerticalConnectingLineOf attached property to a specified Line. - - The Line to which the attached property is written. - The needed IsVerticalConnectingLineOf value. - - - - Identifies the IsVerticalConnectingLineOf dependency property. - - - - - IsVerticalConnectingLineOfProperty property changed handler. - - - Line that changed its IsVerticalConnectingLineOf TreeViewItem. - - Event arguments. - - - - Gets the value of the IsHorizontalConnectingLineOf attached property - for a specified Line. - - - The Line from which the property value is read. - - - The IsHorizontalConnectingLineOf property value for the Line. - - - - - Sets the value of the IsHorizontalConnectingLineOf attached property - to a specified Line. - - - The Line to which the attached property is written. - - - The needed IsHorizontalConnectingLineOf value. - - - - - Identifies the IsHorizontalConnectingLineOf dependency property. - - - - - IsHorizontalConnectingLineOfProperty property changed handler. - - - Line that changed its IsHorizontalConnectingLineOf TreeViewItem. - - Event arguments. - - - - Gets the value of the IsExpanderButtonOf attached property for a - specified ToggleButton. - - - The ToggleButton from which the property value is read. - - - The IsExpanderButtonOf property value for the ToggleButton. - - - - - Sets the value of the IsExpanderButtonOf attached property to a - specified ToggleButton. - - - The ToggleButton to which the attached property is written. - - The needed IsExpanderButtonOf value. - - - - Identifies the IsExpanderButtonOf dependency property. - - - - - IsExpanderButtonOfProperty property changed handler. - - - ToggleButton that changed its IsExpanderButtonOf TreeViewItem. - - Event arguments. - - - - Gets the value of the IsHeaderOf attached property for a specified - FrameworkElement. - - - The FrameworkElement from which the property value is read. - - - The IsHeaderOf property value for the FrameworkElement. - - - - - Sets the value of the IsHeaderOf attached property to a specified - FrameworkElement. - - - The FrameworkElement to which the attached property is written. - - The needed IsHeaderOf value. - - - - Identifies the IsHeaderOf dependency property. - - - - - IsHeaderOfProperty property changed handler. - - - FrameworkElement that changed its IsHeaderOf TreeViewItem. - - Event arguments. - - - - Provides useful extensions to TreeView and TreeViewItem instances. - - Experimental - - - - Get the parent ItemsControl of an element. - - The element. - - The parent ItemsControl of an element, or null if not found. - - - - - Get the ancestor ItemsControls of an element. - - The element. - - The ancestor ItemsControls of an element. - - - - - Get the parent TreeViewItem of a TreeViewItem. - - The TreeViewItem. - - The parent TreeViewItem if found, otherwise null. - - - is null. - - - - - Get the parent TreeView of a TreeViewItem. - - The TreeViewItem. - The parent TreeView if found, otherwise null. - - is null. - - - - - Get the TreeViewItem containers of a TreeView. - - The TreeView. - The TreeViewItem containers of a TreeView. - - is null. - - - - - Get the child TreeViewItem containers of a TreeViewItem. - - The TreeViewItem. - - The child TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the items and TreeViewItem containers of a TreeView. - - The TreeView. - - The items and TreeViewItem containers of a TreeView. - - - is null. - - - - - Get the items and TreeViewItem containers of a TreeViewItem. - - The TreeViewItem. - - The items and TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the TreeViewItem containers of a TreeView. - - The TreeView. - The TreeViewItem containers of a TreeView. - - is null. - - - - - Get the descendant TreeViewItem containers of a TreeViewItem. - - The TreeViewItem. - - The descendant TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the descendant items and TreeViewItem containers of a TreeView. - - The TreeView. - - The descendant items and TreeViewItem containers of a TreeView. - - - is null. - - - - - Get the descendant items and TreeViewItem containers of a - TreeViewItem. - - The TreeViewItem. - - The descendant items and TreeViewItem containers of a TreeViewItem. - - - is null. - - - - - Get the items and TreeViewItem containers of a TreeView or - TreeViewItem. - - The TreeView or TreeViewItem. - - The items and TreeViewItem containers of a TreeView or TreeViewItem. - - - - - Get the sibling items and containers of the item. - - The TreeViewItem. - The sibling items and containers of the item. - - - - Get the TreeViewItems already created that are used to represent the - given item. - - The TreeView. - The item being represented. - - A sequence of TreeViewItems that represent the given item, or an - empty sequence if none were found. - - - is null. - - - - - Get the TreeViewItem already created that is used to represent the - given item. - - The TreeView. - The item being represented. - - The TreeViewItems that represents the given item, or null if no - container was found. - - - If multiple TreeViewItems represent the same item, the first item - found via a breadth-first search will be used. - - - is null. - - - - - Gets a path of items and TreeViewItem containers from the - TreeViewItem to the root of the TreeView. - - The TreeViewItem. - - A path of items and TreeViewItem containers from the TreeViewItem to - the root of the TreeView. - - - is null. - - - - - Gets a path of items and TreeViewItem containers from the - TreeViewItem to the root of the TreeView. - - The TreeViewItem. - - A path of items and TreeViewItem containers from the TreeViewItem to - the root of the TreeView. - - - - - Get the item wrapped by this container. - - The TreeViewItem. - - The item wrapped by the container, or null if not found. - - - is null. - - - - - Get the item of the parent container for a specified - . - - - The TreeView containing the . - - The child item. - - The item of the parent container for the specified - , or null if not found. - - - - - Gets a value indicating whether the TreeViewItem is a root of its - TreeView. - - The TreeViewItem. - - A value indicating whether the TreeViewItem is a root of its - TreeView. - - - is null. - - - - - Gets a value indicating whether the TreeViewItem is a leaf in its - TreeView. - - The TreeViewItem. - - A value indicating whether the TreeViewItem is a leaf in its - TreeView. - - - is null. - - - - - Gets the depth of a TreeViewItem in its TreeView (using a zero-based - index). - - The TreeViewItem. - - The depth of a TreeViewItem in its TreeView (using a zero-based - index). - - - is null. - - - is not in a TreeView. - - - - - Get the selected TreeViewItem in a TreeView. - - The TreeView. - - The selected TreeViewItem, or null if no selected item found. - - - is null. - - - - - Sets the selected TreeViewItem of a TreeView. - - The TreeView. - The TreeViewItem to select. - - is null. - - - - - Clear the selection of the TreeView. - - The TreeView. - - is null. - - - - - Select an item in the TreeView. - - The TreeView. - The item to select. - - A value indicating whether the item was successfully set as the - TreeView's SelectedItem. - - - is null. - - - - - Gets the path to the TreeView's selected item. - - The TreeView. - The path to the TreeView's selected item. - - is null. - - - - - Recursively expand or collapse the TreeViewItem and all of its - descendants. - - The TreeViewItem. - - A value indicating whether to expand or collapse. - - - The number of levels that have already been collapsed or expanded. - This is used in conjunction with the optional maximumDepth to only - expand a specified number of layers. - - - An optional depth that defines the number of layers to expand or - collapse. - - - - - Expand or collapse all of the descendants of the TreeView. - - The TreeView. - - A value indicating whether to expand or collapse. - - - An optional depth that defines the number of layers to expand or - collapse. - - - - - Expand all of the items in a TreeView. - - The TreeView. - - is null. - - - - - Collapse all of the items in a TreeView. - - The TreeView. - - is null. - - - - - Expand a specified number of layers in a TreeView. - - The TreeView. - The number of layers to expand. - - is null. - - - - - Expand a path from the given item to the root of it's TreeView. - - The TreeViewItem. - - A value indicating whether to collapse siblings while expanding the - path. This will result in only the path from the item to the root - being expanded. - - - - - Expand a path from the TreeViewItem to the root of the TreeView. - - The TreeViewItem. - - is null. - - - - - Expand the path from the SelectedItem to the root of the TreeView. - - The TreeView. - - is null. - - - - - Collapse all TreeViewItems except those along the path from the - TreeView's SelectedItem to the root of the TreeView. - - The TreeView. - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - The TreeView. - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - - The type of items provided in . - - The TreeView. - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - - The type of items provided in . - - The TreeView. - - A function that takes a TreeViewItem's item and returns a value to - compare against elements of the given . - The item itself will be used if - is null. - - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Expand the given path of items starting from the TreeView's root. - - - The type of items provided in . - - The TreeView. - - A function that takes a TreeViewItem's item and returns a value to - compare against elements of the given . - The item itself will be used if - is null. - - - The sequence of items corresponding to the path to expand. - - - is null. - - - is null. - - - - - Gets the value of the IsChecked attached property for a specified - TreeViewItem. - - - The TreeViewItem from which the property value is read. - - - The IsChecked property value for the TreeViewItem. - - - - - Sets the value of the IsChecked attached property to a specified - TreeViewItem. - - - The TreeViewItem to which the attached property is written. - - The needed IsChecked value. - - - - Identifies the IsChecked dependency property. - - - - - IsCheckedProperty property changed handler. - - The TreeViewItem that changed IsChecked. - Event arguments. - - - - Gets the value of the AssociatedCheckBox attached property for a - specified TreeViewItem. - - - The TreeViewItem from which the property value is read. - - - The AssociatedCheckBox property value for the TreeViewItem. - - - - - Sets the value of the AssociatedCheckBox attached property to a - specified TreeViewItem. - - - The TreeViewItem to which the attached property is written. - - The needed AssociatedCheckBox value. - - - - Identifies the AssociatedCheckBox dependency property. - - - - - AssociatedCheckBoxProperty property changed handler. - - - The TreeViewItem that changed its AssociatedCheckBox. - - Event arguments. - - - - Get the sequence of items and containers with their IsChecked - property set to True. - - The TreeView. - - The sequence of items and containers with their IsChecked property - set to True. - - - is null. - - - - - Get the sequence of items and containers with their IsChecked - property set to True. - - The TreeView. - - A value indicating whether to include TreeViewItems with an - indeterminate IsChecked value. - - - The sequence of items and containers with their IsChecked property - set to True or also set to null if indeterminate values are - included. - - - is null. - - - - - Gets or sets a value indicating whether recursive calls to - OnIsCheckedPropertyChanged should ignore their notifications or - process them accordingly. - - - - - Gets or sets a value indicating whether recursive calls to - OnIsCheckedPropertyChanged should update their children when their - IsChecked value has changed. - - - - - Represents a CheckBox whose value is associated with the - TreeViewExtensions.IsChecked attached property of TreeViewItems. - - Experimental - - - - The parent TreeViewItem of the CheckBox. - - - - - Initializes a new instance of the TreeViewItemCheckBox class. - - - - - Associate the parent TreeViewItem with the CheckBox. - - - - - Update the TreeViewItem's IsChecked property when this IsChecked - property is changed. - - The CheckBox. - Event arguments. - - - - Gets the parent TreeViewItem of the CheckBox. - - - - - Represents the necessary information to draw connecting lines in a - TreeViewItem. - - Experimental - - - - Initializes a new instance of the TreeViewItemConnectingLineInfo - class. - - The TreeViewItem. - - - - Position the connecting lines in the TreeViewItem. - - - - - Position the vertical connecting line in the TreeViewItem. - - - - - Gets the TreeViewItem. - - - - - Gets or sets the vertical connecting line of the TreeViewItem. - - - - - Gets or sets the horizontal connecting line of the TreeViewItem. - - - - - Gets or sets the expander button of the TreeViewItem. - - - - - Gets or sets the header of the TreeViewItem. - - - - - Used to convert TreeViewItems into a value based on their depth in - the TreeView. - - Experimental - - - - Initializes a new instance of the TreeViewItemIndentationConverter - class. - - - - - Convert a TreeViewItem into a value based on the depth of the item - in the TreeView. - - The TreeViewItem. - - The indentation type to convert to (such as Thickness or double). - - - The number of pixels to indent each level of the TreeView. A - default value of 15.0 will be used if no parameter is provided. - - - The culture used to convert the TreeViewItem. - - - A value based on the depth of the item in the TreeView. - - - - - Wrap the indentation in the desired type. - - - The number of pixels to indent the TreeViewItem. - - - The indentation type to convert to (such as Thickness or double). - - - A value based on the depth of the item in the TreeView. - - - - - Convert an indentation back into a TreeViewItem. This always throws - a NotSupportedException. - - The indentation. - The type of the indentation. - - The number of pixels to indent each level of the TreeView. - - - The culture used to convert the TreeViewItem. - - Always throws a NotSupportedException. - - - - A set of simple extension methods for applications. - - - - - Checks whether the application host object is not null. - - The application instance. - Returns a value indicating whether the object is not null. - - - - Checks whether the application host and its source object is not - null. - - The application instance. - Returns a value indicating whether the object is not null. - - - - A value converter for collapsing or showing elements. - - - - - Convert a boolean value to a Visibility value. - - The value instance. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Support two-way databinding of the VisibilityConverter, converting - Visibility to a bool. - - The value instance. - The target parameter. - ConverterParameter is of type Visibility. - The culture parameter. - Returns the object. - - - - Determine the visibility mode based on a converter parameter. This - parameter is of type Visibility,and specifies what visibility value - to return when the boolean value is true. - - The parameter object. - Returns a Visibility value. - - - - Determine whether or not visibility is inverted based on a converter - parameter. When the parameter is specified as Collapsed, that means - that when the boolean value is true, we should return Collapsed, - which is inverted. - - The parameter object. - Returns a value indicating whether the visibility is - inverted. - - - - Visual states helper code. - - - - - Gets the implementation root of the Control. - - The DependencyObject. - - Implements Silverlight's corresponding internal property on Control. - - Returns the implementation root or null. - - - - This method tries to get the named VisualStateGroup for the - dependency object. The provided object's ImplementationRoot will be - looked up in this call. - - The dependency object. - The visual state group's name. - Returns null or the VisualStateGroup object. - - - - Provides useful extensions for working with the visual tree. - - - Since many of these extension methods are declared on types like - DependencyObject high up in the class hierarchy, we've placed them in - the Primitives namespace which is less likely to be imported for normal - scenarios. - - Experimental - - - - Get the visual tree ancestors of an element. - - The element. - The visual tree ancestors of the element. - - is null. - - - - - Get the visual tree ancestors of an element and the element itself. - - The element. - - The visual tree ancestors of an element and the element itself. - - - is null. - - - - - Get the visual tree ancestors of an element and the element itself. - - The element. - - The visual tree ancestors of an element and the element itself. - - - - - Get the visual tree children of an element. - - The element. - The visual tree children of an element. - - is null. - - - - - Get the visual tree children of an element and the element itself. - - The element. - - The visual tree children of an element and the element itself. - - - is null. - - - - - Get the visual tree children of an element and the element itself. - - The element. - - The visual tree children of an element and the element itself. - - - - - Get the visual tree descendants of an element. - - The element. - The visual tree descendants of an element. - - is null. - - - - - Get the visual tree descendants of an element and the element - itself. - - The element. - - The visual tree descendants of an element and the element itself. - - - is null. - - - - - Get the visual tree descendants of an element and the element - itself. - - The element. - - The visual tree descendants of an element and the element itself. - - - - - Get the visual tree siblings of an element. - - The element. - The visual tree siblings of an element. - - is null. - - - - - Get the visual tree siblings of an element and the element itself. - - The element. - - The visual tree siblings of an element and the element itself. - - - is null. - - - - - Get the bounds of an element relative to another element. - - The element. - - The element relative to the other element. - - - The bounds of the element relative to another element, or null if - the elements are not related. - - - is null. - - - is null. - - - - - Perform an action when the element's LayoutUpdated event fires. - - The element. - The action to perform. - - is null. - - - is null. - - - - - Retrieves all the logical children of a framework element using a - breadth-first search. For performance reasons this method manually - manages the stack instead of using recursion. - - The parent framework element. - The logical children of the framework element. - - - - Retrieves all the logical descendents of a framework element using a - breadth-first search. For performance reasons this method manually - manages the stack instead of using recursion. - - The parent framework element. - The logical children of the framework element. - - - - The CodeCoverage class is used to collect code coverage information from - assemblies that have been instrumented to call the Visit function at the - beginning of every basic block. - - - - - A bit array used to track which basic blocks have been executed. - - - - - A counter of the hit blocks. - - - - - Record that a basic block is being executed. - - Id of the basic block. - - - - Get the coverage data serialized as a string for easy transport. - - Previous releases of the framework used a simplistic bit - list, this release updates the coverage reporting endpoint to an - alternate version that ends in base 64. This maintains test runner - compatibility with previous official releases. - Coverage data serialized as a string. - - - - Gets the current number of hit blocks. - - - - - Gets the current size of the blocks counter. This is not actually - the number of hit blocks, but it should return 0 always except - when at least one block is hit. - - - - - Base class for test cases that use special functionality of the - Microsoft.Silverlight.Testing unit test framework. - - Tests that derive from CustomTest in most cases will not be source- or - functionality- compatible with the more advanced desktop Visual Studio - Test Team environment and harnesses. - - - - - Process an exception using the test engine logic for - ExpectedExceptions and logging the exception if needed. - - Exception object. - - - - Gets or sets a value indicating whether global unhandled exceptions - should be intercepted by the test harness. - - - - - Gets or sets the unit test harness instance. Hidden from the VS - browser as test developers should not need to use this property. - - - - - Gets the current test task container. - - The current container for the test's tasks. - - - - Manages the unit test status and model by attaching to the unit test - harness instance. Validates that all key logging can be done without - special hooks inside of the unit test harness implementation. - - - - - The unit test harness instance. - - - - - The test run data. - - - - - Map assembly metadata to data objects. - - - - - Map test class metadata to data objects. - - - - - Map test metadata to data objects. - - - - - Backing field for the last result. - - - - - Backing field for the last failing result. - - - - - Initializes a new instance of the DataManager type. - - The unit test harness instance. - - - - Initializes a new instance of the DataManager. - - The unit test harness instance. - Returns a new instance of a DataManager class. - - - - Connect to unit test harness events for processing and updating the - underlying unit test run model. - - - - - Unhook from the unit test harness events. - - - - - Process the starting of the test run. - - The source object. - The event data. - - - - Process the test class starting event. - - The source object. - The event data. - - - - Process the test class complete event. - - The source object. - The event data. - - - - Process the start of a test method. - - The source object. - The event data. - - - - Process the completion of test methods. - - The source object. - The event data. - - - - Process a result. - - The result data. - - - - Gets or creates the data model object for an assembly. - - The test assembly. - Returns the data object. - - - - Gets or creates the data model object for a test class. - - The test class. - Returns the data object. - - - - Gets or creates the data model object for a test method. - - The test method. - The parent test class data object. - Returns the data object. - - - - Gets the unit test harness instance. - - - - - Gets the unit test model. - - - - - A data object storing the hierarchical results for a test assembly in a - test run. - - - - - A base class for model objects that implement the property - changed interface, to simplify calling the change handlers, - and cache the underlying event argument instances. - - - - - A static set of change argument instances, eventually - storing one argument instance for each property name to - reduce churn at runtime. - - - - - Notify any listeners that the property value has changed. - - The property name. - - - - The property changed event. - - - - - A type that provides a string result report. - - - - - Generates a simple text result report for the metadata. - - Reports a text report. - - - - Initializes a new instance of the TestAssemblyData type. - - The test assembly metadata. - - - - Backing field for the expanded property. - - - - - Backing field for a passed value. - - - - - Backing store for the set of test class. - - - - - Retrieves the results report. - - Returns a string containing the report. - - - - Gets or sets a value indicating whether the item is expanded in - a hierarchical display. - - - - - Gets or sets the checked value. Don't think this is actually used. - - - - - Gets or sets a value indicating whether the test passed. If failed, - will propagate to the parent metadata object. - - - - - Gets the name of the assembly. - - - - - Gets an observable collection of test class data objects. - - - - - A data object that generates property change notifications and can - be used for rich data binding to test results. Does keep a reference - to all results. - - - - - Stores the test method metadata. - - - - - Parent data object. - - - - - A value indicating whether the test is currently executing. - - - - - The test outcome. - - - - - Backing field for linked data. - - - - - Backing field for linked data. - - - - - Backing field for linked data. - - - - - Backing field for linked data. - - - - - Initializes a new instance of the TestMethodData type. - - The test method metadata. - The test class that is the parent object. - - - - Runs through the metadata for bugs. - - - - - Backing field for known bugs. - - - - - Backing field for bugs that are marked fixed. - - - - - Calculates whether the item is considered "notable", in that it - should have a visual cue or hint for the user. - - - - - Stores a value indicating whether the result is notable. - - - - - Backing field for the checked property. - - - - - Backing field for the expanded property. - - - - - Retrieves the results report. - - Returns a string containing the report. - - - - Gets or sets the result of the test method. - - - - - Gets the known bugs for display in the UI. - - - - - Gets the fixed bugs for display. - - - - - Gets the expected exception name for a negative test, if any. - - - - - Gets a simplified exception stack trace that omits the trace below - the invoke of the test method by the test framework. - - - - - Gets the short, simple name of the exception type recorded in the - test result, if any. - - - - - Gets a value indicating whether the method has results. - - - - - Gets a value indicating whether the method has passed. Returns - true until there is a result. - - - - - Gets or sets a value indicating whether the test method is running. - - - - - Gets or sets a value indicating whether the result is notable. - Notable is defined as either currently running, or not having - passed. This can allow a user interface to react to an - interesting result. - - - - - Gets the parent data object. - - - - - Gets an instance of the actual metadata object. - - - - - Gets the name of the test method. - - - - - Gets a visibility value to allow for easy showing or - hiding of a user interface component that displays the - description. - - Returns a visibility value. - - - - Gets the elapsed time in a readable format. - - Returns a string of the readable time elapsed. - - - - Gets the description of the test method. - - - - - Gets or sets a value indicating whether the item is checked in the - user interface. - - - - - Gets or sets a value indicating whether the item is expanded in - a hierarchical display. - - - - - Gets or sets the previous result. - - - - - Gets or sets the next result. - - - - - Gets or sets the previous failing result. - - - - - Gets or sets the next failing result. - - - - - A provider of code coverage information to an external process. - - - - - The base class for test service providers. - - - - - Initializes a new base provider class. - - The owning test service provider. - The display name of the service. - - - - Initializes the provider. - - - - - Increments the busy service counter. - - - - - Decrements the busy service counter. - - - - - Invokes a method on this provider using reflection. - - The name of the method. - The optional parameters. - - - - Call the InitializeCompleted event. - - - - - Performs a callback. Null action and/or result are permitted. - - The optional callback action. - The result to pass back. - - - - Event fired once initialization is complete. - - - - - Gets the display name for the provider. - - - - - Gets the owning test service. - - - - - Gets a value indicating whether the provider has been initialized - yet. - - - - - Initializes a new code coverage provider. - - The test service. - - - - Save string-based code coverage data. - - The code coverage data, as a string. - The callback action. - - - - A provider of environment variables and environmental information that - uses the test service provider infrastructure. - - - - - Initializes a new environment provider. - - The test service. - - - - Retrieve an environment variable from the system. - - The variable name. - The callback action. - - - - Miscellaneous internal extension methods. - - - - - Attempts to retrieve a custom assembly attribute. - - The type of attribute to retrieve. - The assembly reference. - An out attribute reference. - Returns true if the attribute is found. - - - - Transform the XElement into a dictionary of key/value pairs. - - The type of enumeration. - The key type. - The value type. - The root enumerable. - The key selector. - The item selector. - Returns a new dictionary. - - - - A type that stores global settings in the isolated storage for the - application. An implementation of the - type. - - - - - A provider of string dictionary values. - - - - - Initializes a new SettingsProvider object. - - The test service. - - - - Initializes a new SettingsProvider object. - - The test service. - The service name. - - - - Saves the settings. - - Classes that inherit from SettingsProvider: hide this - function. Do not call up through to this base method. - The service callback. - - - - Gets the settings dictionary. - - - - - Gets a value indicating whether the settings are read-only. - - - - - Gets the settings source for end-user display. - - - - - The unique key used for storing the test framework's settings - dictionary. - - - - - The underlying settings object. - - - - - Initializes a new isolated storage settings provider. - - The test service instance. - - - - Initializes the isolated storage settings provider. - - - - - Saves the current settings values. - - The service completion callback. - - - - Recalls the stored settings values from isolated storage. - - - - - Initialize the isolated storage application settings object. - - - - - Result object for asynchronous test service response. - - - - - Creates a new ServiceResult object for a failed result, the - sets the exception. - - The Exception object. - Returns a new ServiceResult with the Exception set. - - - - The result LINQ element. - - - - - Initializes a new instance of the ServiceResult class. - - - - - Process the response text. - - - - - Attempt to process and return the root element of a successful - request. Returns null if there was an Exception. - - The root XML element of the response. - - - - Sets the result. - - The LINQ element for the result. - - - - Gets or sets a value indicating whether the result has been - processed. - - - - - Gets or sets the exception intercepted or generated during the - request or - processing timeframe. - - - - - Gets the root XElement of the test service result. - - - - - Gets a value indicating whether the request was successful. - - - - - The type of test service in use. Used by the more advanced service - scenarios in SilverlightTestServiceProvider. - - - - - No service, or unknown service type. - - - - - A direct connection, be it the file system, isolated storage, or - similar. - - - - - A web service. - - - - - The Silverlight test service provider is built for compilation with - Silverlight builds of the test framework. Populates with the important - providers for web browser-hosted test runs. - - - The Silverlight test service provider is built for compilation with - Silverlight builds of the test framework. Populates with the important - providers for web browser-hosted test runs. - - - - - A system that provides test services. - - - - - The dictionary of services registered with this provider instance. - - - - - Initializes a new test service provider instance. - - - - - Initializes the provider and all of its test services. - - - - - Initialize all services and features synchronously. - - - - - Register a new service that the test service should expose. - - Known feature type. - Instance of the feature's - type. - - - - Register a new service that the test service should expose. - - String name of the feature if the known - enum value does not exist. - Instance of the feature's - type. - - - - Unregisters a feature. - - Known feature type. - - - - Unregisters a feature. - - Known feature type string. - - - - Check if a requested feature is supported by the test service - provider. - - Feature of interest. - A value indicating whether the feature exists. - - - - Check if a requested feature is supported by the test service - provider. - - Feature of interest. - A value indicating whether the feature exists. - - - - Retrieve a feature. An exception will be thrown if the service - does not exist. - - Type of a service, ProviderBase. - The feature of interest. - Returns the feature, cast properly. - - - - Retrieve a feature. - - Feature of interest. - The feature's provider. - - - - Retrieve a feature. - - Feature of interest. - The service or null if one was not present. - - - - Require a feature, or throw an exception if it isn't available. - - Feature of interest. - The required type. - The service or null if one was not present. - - - - Require a feature, or throw an exception if it isn't available. - - Feature of interest. - The required type. - The service or null if one was not present. - - - - Require a feature or interest. - - Feature of interest. - The service or null if one was not present. - - - - Requires a service. - - Feature of interest. - The service or null if one was not present. - - - - Check for and required the presence of a service. Throws an - InvalidOperationException message if the service is unavailable. - - Feature of interest. - The service or null if one was not present. - - - - Require a specific feature, and that it can be cast properly. - - Feature of interest. - The type to verify assignment for a cast. - The service or null if one was not present. - - - - Looks for a specific service. - - Feature of interest. - The service or null if one was not present. - - - - Gets or sets a unique test run identifier, if any is present. - - - - - Gets or sets an integer value that can be used to manage simple - reference counting services. - - - - - The service verifier and information. - - - - - Initializes a new instance of the SilverlightTestService class. - - - - - Initializes a new instance of the SilverlightTestService class. - - Unit test settings to read the service path - and other information from. - - - - Initializes the Silverlight test service. Performs a service check - if needed before initializing the other providers. - - - - - Sets the custom ID information for the test run, if passed into - the run. - - - - - Determine the service path to attempt to use, and prepares the - verification object using those parameters. - - Unit test settings object to try and read - settings from. - - - - Pauses the initialization process to attempt a service connection. - The result will alter the underlying ServiceType being used by - this provider to ensure a fallback experience can be used. - - This verification step will block the initialization and entire - test run until it continues. - - - - - Continues the initialization process for the test service provider. - - - - - Populates with the standard providers for Silverlight in-browser - testing. - - - - - Gets the service type that is in use. - - - - - Gets the web service proxy. - - - - - A special verification class used by SilverlightTestService. - - - - - The name of a simple 'ping' method exposed by the service. - - - - - Attempts to verify the service connection. Calls the proper - success/failure Action once a verification result is possible. - - The Action to call upon connection - verification. - An Action to call upon failure. - - - - Gets or sets the service hostname. - - - - - Gets or sets the service port. - - - - - Gets or sets path to the simple POX service. - - - - - Gets the URI to the service. - - - - - A test service that reports test run results. - - - - - Initializes a new reporting provider instance. - - The test service. - - - - Begins a call to the test service to write to the log. - - The callback, used to read or verify results - from the service call. - The name of the log to write. - The log file content. - - - - Begins a call to the test service to report a test run's results. - - The callback, used to read or verify results - from the service call. - A value indicating whether the test run was a - failure. - The failed scenario count. - The total scenario count. - Any message to report along with the failure. - - - - Set of known, well-defined test service features. - - - - - Code coverage reporting. - - - - - Provides run parameters and settings. - - - - - Provides test reporting services. - - - - - Provides environment information. - - - - - A provider of code coverage information to an external process. - - - - - The MethodName_SaveCodeCoverage method name. - - - - - Initializes a new code coverage provider. - - The test service. - - - - Save string-based code coverage data. - - The code coverage data, as a string. - The callback action. - - - - A provider of environment variables and environmental information that - uses the test service provider infrastructure. - - - - - The MethodName_GetEnvironmentVariable method name. - - - - - Initializes a new environment provider. - - The web test service. - - - - Retrieve an environment variable from the system. - - The variable name. - The callback action. - - - - Result object for asynchronous test service response that uses a simple - web service / POX call. - - - - - Initializes a new web service result. - - The request object. - The response object. - - - - Initializes a new web service result. - - The request object. - The response object. - The details to associate for debugging - purposes. - - - - Reads the web response, if successful, and parses out the string - content. - - - - - Process the response text. - - - - - Gets the web request associated with the service call. - - - - - Gets the web response associated with the service call. - - - - - Gets the details of the request, used for interactive debugging - sessions only. - - - - - Gets the string retrieved from the response. - - - - - A test service that reads command line settings. - - - - - Name of the method MethodName_GetRunParameters. - - - - - Initializes a new settings provider instance. - - The test service. - - - - Initialize the web settings provider. - - - - - Read the run parameters. - - The service result. - - - - A test service that reports test run results. - - - - - Name of the method MethodName_ReportTestResults. - - - - - Name of the method MethodName_WriteLog. - - - - - Initializes a new reporting provider instance. - - The test service. - - - - Begins a call to the test service to write to the log. - - The callback, used to read or verify results - from the service call. - The name of the log to write. - The log file content. - - - - Begins a call to the test service to report a test run's results. - - The callback, used to read or verify results - from the service call. - A value indicating whether the test run was a - failure. - The failed scenario count. - The total scenario count. - Any message to report along with the failure. - - - - Provides out-of-process access to operating system functions and other - services such as visual verification, if present. - - - Provides out-of-process access to operating system functions and other - services such as visual verification, if present. - - - Provides out-of-process access to operating system functions and other - services such as visual verification, if present. - - - - - The service address. - - - - - The synchronization context. - - - - - Initializes a new plain-old-XML test service. This assumes that - the caller has already verifier that a service is present and - responding at the service address. - - The base service URI, such as - "scheme://hostname:port/servicePath/". - - - - Creates a simple REST-style Uri given the method/service name and - a dictionary of key/value pairs to send as arguments. - - The method/service name. - A set of key/value pairs. - Returns a new Uri. - - - - Creates a simple REST-style Uri given the method/service name and - a dictionary of key/value pairs to send as arguments. - - The method/service name. - A set of key/value pairs. - Optional query string. - Returns a new Uri. - - - - Builds a simple dictionary from parameters. The value follows the - key parameter. {[key, value], } ... - - The ToString() method is called on every object. - - The parameters. - Returns a key/value dictionary from the parameters. - - - - Begin a POX method call. The callback is used with the result when - it becomes available. - - The method name. - The callback action. - - - - Begin a POX method call. The callback is used with the result when - it becomes available. - - The method name. - Dictionary of key/value pairs. - The callback action. - - - - Begin a POX method call. The callback is used with the result when - it becomes available. - - The method name. - Dictionary of key/value pairs. - Optional string that will transform the - request to a POST request. - The callback action. - - - - The intermediate step that writes the POST data and then continues - the web request. - - The async result object. - - - - Process the response callback from a POX method call. - - The async result object. - - - - On the UI thread, invoke the callback action with the result. - - The temporary state object. - - - - A simple type to store the state information for the cross-thread - callback. - - - - - Initializes a new TemporaryStateObject object. - - The callback action. - The result object. - - - - Gets the callback action. - - - - - Gets the result object. - - - - - The request data class, stores information used in a request for - associating this data with the response. - - - - - Initializes a new request data object. - - The request Uri. - The request object. - The callback action. - - - - Converts the request data object into a web service result - object. - - The response object. - Returns a new WebServiceResult instance. - - - - Gets or sets the optional post data for the request. - - - - - Gets the web request. - - - - - Gets the request Uri. - - - - - Gets the callback action. - - - - - A type which handles preparing the underlying dispatcher or timer from - which the test work items execute. - - - - - Handle calling into the test framework as needed to perform the test - run, process the internal test dispatcher queue, and keep execution - moving forward. - - - - - Delegate that returns whether more work remains and runs the next - set of work. - - - - - Backing field for a value indicaing whether the dispatcher should be - running. - - - - - Creates a new RunMethodManager, taking in a conditional delegate to - run for each step to see if more work remains. - - - The conditional delegate that performs work and indicates whether - additional work remains. - - - - - Create a new run method manager object. - - - Conditional indicating whether more work will remain after - performing the work. - - - Returns the run method manager. Typically depends on the execution - platform and environment. - - - - - Create a new run method manager object. - - - Conditional indicating whether more work will remain after - performing the work. - - A Dispatcher instance. - - Returns the run method manager. Typically depends on the execution - platform and environment. - - - - - A completely synchronous implementation, unless overridden, that - calls RunNextStep() until the harness is finished. - - The default implementation will not work with a presentation-rich - test environment. - - - - - Calls a conditional delegate, and returns whether there is more work - to be done. - - - Returns a value indicating whether there is additional work - remaining after executing the current work. - - - - - Calls the Complete event handler. - - - - - Event that is called when all work is complete. - - - - - Gets or sets a value indicating whether the dispatcher should be - running. - - - - - Stored Dispatcher instance. - - - - - Sets up a new run method manager. - - - Conditional delegate which returns true as long as there is - additional work. - - An instance of the dispatcher to use. - - - - Begin the execution process by hooking up the underlying - DispatcherTimer to call into the test framework regularly and - perform test work items. - - - - - A data object that generates property change notifications and can - be used for rich data binding to test results. Does keep a reference - to all results. - - - - - Parent object reference. - - - - - Initializes a new instance of the TestClassData type. - - The test class metadata. - The parent test assembly data object. - - - - Backing store for the set of test class. - - - - - Backing field for the expanded property. - - - - - Collapses the test class node unless there is at least one child - test method that failed. - - - - - Backing field for a passed value. - - - - - Retrieves the results report. - - Returns a string containing the report. - - - - Gets the parent data object. - - - - - Gets the name of the test class. - - - - - Gets the namespace for the test class. - - - - - Gets an observable collection of test class data objects. - - - - - Gets or sets a value indicating whether the item is expanded in - a hierarchical display. - - - - - Gets or sets the checked value. Don't think this is actually used. - - - - - Gets or sets a value indicating whether the test passed. If failed, - will propagate to the parent metadata object. - - - - - A data object that generates property change notifications and can - be used for rich data binding to test results. Does keep a reference - to all results. - - - - - The unit test harness instance. - - - - - Backing field for information about the test application in use. - - - - - Initializes a new instance of the test run results. - - The unit test harness. - - - - Backing store for the set of test assemblies. - - - - - Title backing field. - - - - - Stores the total number of expected scenarios. - - - - - Stores the current test information. - - - - - Stores the current test information. - - - - - Stores the number of run scenarios. - - - - - Count of failed scenarios. - - - - - Backing field for whether the app is running. - - - - - Gets the test application information instance. - - - - - Gets the unit test harness instance. - - - - - Gets an observable collection of test assembly data objects. - - - - - Gets or sets the informational run title. - - - - - Gets or sets the number of total scenarios. - - - - - Gets or sets the current test name. - - - - - Gets or sets the current test name. - - - - - Gets or sets the number of run scenarios. - - - - - Gets or sets the number of failed scenarios. - - - - - Gets a value indicating whether the run is complete and passed. - - - - - Gets a value indicating whether all passing results have been - processed. - - - - - Gets the number of passed scenarios, defined as the number of - run scenarios minus the number of failed scenarios tracked. - - - - - Gets a value indicating whether the dispatcher is currently running. - - - - - Gets a value indicating whether the test run is in action. - - - - - Assembly complete event arguments. - - - - - Generic unit test harness event arguments base class that contains a - reference to the harness. - - - - - Initializes a new instance of the UnitTestHarnessEventArgs class. - - The test harness. - - - - Gets the unit test harness reference. - - - - - Initializes a new instance of the TestAssemblyCompletedEventArgs - type. - - The assembly metadata. - The test harness instance. - - - - Gets the assembly metadata. - - - - - Test assembly starting event arguments. - - - - - Initializes a new instance of the TestAssemblyStartingEventArgs - type. - - The assembly metadata. - The unit test harness instance. - - - - Gets the assembly metadata information. - - - - - The test class completed event arguments. - - - - - Initializes a new instance of the TestClassCompletedEventArgs - class. - - Test class metadata. - The harness instance. - - - - Gets the test class metadata. - - - - - Information about the start of a test class event. - - - - - Initializes a new instance of the TestClassStartingEventArgs type. - - The test class metadata. - The unit test harness reference. - - - - Gets the test class instance. - - - - - Test method starting event arguments. - - - - - Initializes a new instance of the TestMethodStartingEventArgs type. - - The test method metadata. - The test class metadata. - The test harness instance. - - - - Gets the test method metadata. - - - - - Gets the test class metadata. - - - - - Test method completed event arguments, contains the result. - - - - - Initializes a new instance of the TestRunStartingEventArgs - type. - - The test run filter. - The test run settings object. - - - - Gets the unit test run settings. - - - - - Gets the test run filter. - - - - - Gets or sets the test harness name. - - - - - Gets or sets the number of valid, enqueued assemblies scheduled. - - - - - Tag attribute used to associate individual test cases with tags to - easily test related functionality. - - - The infrastructure associated with the TagAttribute is not yet in place. - - - - - List of reserved words that cannot be used as tags. - - - This list should be shared with the tag parser implementation when - available. - - - - - List of reserved characters that cannot be used in tags. - - - This list should be shared with the tag parser implementation when - available. - - - - - Initializes a new instance of the TagAttribute class. - - - Tag associated with the test method or class. - - - - - Gets the tag associated with the test method or class. - - - - - Set of extension methods used by the harness. - - - - - An AddRange implementation for the generic IList interface. - - The list type. - The list object. - The collection to copy into the list. - - - - Replace a list's contents with the items in the IEnumerable. - - The list type. - The list object. - The sequence to copy into the list. - - - - The IProvideDynamicTestMethods interface is used to provide additional - test methods dynamically at runtime. - - - - - Get the dynamic test methods. - - Sequence of dynamic test methods. - - - - A type filter for just a specific test. Allows the re-running of a - single result again in the same process. - - - - - A type to filter down complete sets of classes, tests and methods. - - - - - The default unit test run name. - - - - - Unit test settings. - - - - - Initializes a new test run filter using an existing settings file. - - A unit test settings instance. - The unit test harness. - - - - Retrieve a set of test classes from a test assembly. - - The test assembly metadata object. - Test class instance dictionary. - Returns a new list of test class metadata objects. - - - - Sort the test classes if the settings for alphabetical sorting are - present. - - List of test classes. - - - - Filter out tests based on the standard-supported methods. - - List of test classes. - Test class instance dictionary. - - - - Perform any custom filtering that the TestRunFilter needs. - - List of test classes. - Test class instance dictionary. - - - - If specific string-contains filters are present. - - List of test classes. - Test class instance dictionary. - - - - If any exclusive classes are found, filter them. - - List of test classes. - Test class instance dictionary. - - - - Retrieves the test methods from a test class metadata object. - - The test class metadata object. - The test class instance. - Returns a list of test method metadata objects. - - - - Filter the test methods. - - List of test methods. - - - - Perform any custom filtering that the TestRunFilter needs. - - List of test methods. - - - - If any exclusive classes are found, filter them. - - List of test methods. - - - - Sorts the test methods, if requested. - - List of test methods. - - - - Gets a friendly name for the test run. - - - - - Gets the unit test harness. - - - - - The test class. - - - - - The test method. - - - - - Initializes a new test run filter using an existing settings file. - - The test class metadata. - The test method metadata. - - - - Retrieve a set of test classes from a test assembly. - - The test assembly metadata object. - Test class instance dictionary. - Returns a new list of test class metadata objects. - - - - Retrieves the test methods from a test class metadata object. - - The test class metadata object. - The test class instance. - Returns a list of test method metadata objects. - - - - A helper class that manages tags and associated metadata. Tag - expressions are evaluated at the TestClass level. - - - A helper class that manages tags and associated metadata. Tag - expressions are evaluated at the TestClass level. - - - A helper class that manages tags and associated metadata. Tag - expressions are evaluated at the TestClass level. - - - - - The prefix for any tags generated from priority values. - - - - - A reference to the tag attribute type. - - - - - The test tags associated with the class. - - - - - The test tags associated with methods. - - - - - The ability to grab the set of methods, given a test class type, - and the tag of interest. - - - - - The test class type. - - - - - Initializes a new tag manager. - - The test class type. - The set of methods to run. - - - - Reflect, read and prepare the tags for the class metadata. Performs - the work if this is the first time the metadata has been seen. - - The reflection object for the test class. - - - - Reflect, read and prepare the tags for the method metadata. Performs - the work if this is the first time the metadata has been seen. - - The method metadata. - - - - Get the test methods that correspond to a tag expression. - - Tag expression. - Test methods for the tag expression. - - - - Gets or sets the universe of all test methods for expression - evaluation. - - - - - Evaluate tag expressions. - - - Tag expressions are derived from the following EBNF grammar: - {Expression} := - {Expression} + {Term} | - {Expression} - {Term} | - {Term} - {Term} := - {Term} * {Factor} | - {Factor} - {Factor} := - !{Factor} | - ({Expression}) | - {Tag} - {Tag} := - All | - [^InvalidCharacters]+ - - The non-terminals for {Expression} and {Term} will be left factored - in the recursive descent parser below. - - - - - Union character. - - - - - Intersection character. - - - - - Complement character. - - - - - Difference character. - - - - - The "All" string constant. - - - - - Invalid characters in a tag name. - - - - - Evaluate a tag expression. - - The owner object. - Tag expression. - Test methods associated with the tag expression. - - - - The owning TagManager instance. - - - - - Expression being evaluated. - - - - - Current position in the expression. - - - - - Create an expression evaluator. - - The owner object. - Expression object. - - - - Match a sequence of characters. - - String to match. - - - - Try to match a sequence of characters. - - String to match. - Returns a value indicating whether the match was - successful. - - - - Evaluate an expression. - - Test methods described by the expression. - - - - Evaluate an expression. - - Test methods described by the expression. - - We need to factor out left recursion, so: - {Expression} := - {Expression} + {Term} | - {Expression} - {Term} | - {Term} - becomes: - {Expression} := - {Term}{Expression'} - - {Expression'} := - #empty# - + {Term}{Expression'} - - {Term}{Expression'} - - - - - Evaluate an expression. - - - Left term already read as part of the expression. - - Test methods described by the expression. - - Non-terminal created for left-factoring: - {Expression'} := - #empty# - + {Term}{Expression'} - - {Term}{Expression'} - - - - - Evaluate a term. - - Test methods described by the expression. - - We need to factor out left recursion, so: - {Term} := - {Factor} * {Term} | - {Factor} - becomes: - {Term} := - {Factor}{Term'} - - {Term'} := - #empty# - ^ {Factor}{Term'} - - - - - Evaluate a term. - - - Left term already read as part of the expression. - - Test methods described by the expression. - - Non-terminal created for left-factoring: - {Term'} := - #empty# - ^ {Factor}{Term'} - - - - - Evaluate a factor. - - Test methods described by the expression. - - {Factor} := - !{Factor} | - ({Expression}) | - {Tag} - - - - - Creates a new empty collection. - - Returns an empty collection. - - - - Evaluate a tag. - - Test methods described by the expression. - - {Tag} := - All | - [^InvalidCharacters]+ - - - - - A string list for storing tags. Provides an Add method that takes - an attribute object and, if a TagAttribute, will append its tag - value to the list. - - - - - Initializes a new Tags instance. - - - - - Initializes a new Tags instance from an existing collection. - - The collection to copy. - - - - Adds a TagAttribute's tag value. - - The tag object. - - - - A method and class filter that uses expressions and the TagAttribute. - - - - - The name to use for the test run when the tag expression is null. - - - - - Initializes a new test run filter with the tag expression setting. - - Unit test settings. - Unit test harness. - - - - Initializes a new test run filter with the tag expression. - - Unit test settings. - Unit test harness. - The tag expression to use. - - - - Sets the tag expression property. - - The tag expression to use. - - - - A value indicating whether the warning has been logged yet. - - - - - Apply tag filtering. - - List of test classes. - Test class instance dictionary. - - - - Apply tag filtering. - - List of test methods. - - - - Apply the tag filtering. - - The tag manager instance. - Set of methods. - - - - Exclusive attributes are not supported when also using tagging. - - List of test classes. - Test class instance dictionary. - - - - Exclusive attributes are not supported when also using tagging. - - List of test methods. - - - - Gets the tag expression in use by the run filter. - - - - - Helper code for TestAssembly logic. - - - - - Check whether [Exclusive] attribute is present on any classes. - - Collection of class metadata objects. - Returns a value indicating whether any of the classes - include an [Exclusive] attribute. - - - - Sorts the test classes alphabetically by name. - - A list of test class metadata objects. - - - - Test class helper. - - - - - A value indicating whether the warning has been logged in this run. - - - - - Filter the set of test classes by removing unused classes. - - The input list of test class metadata objects. - The classes to run. - - - - Look through the classes for the [Exclusive] attribute. If found, - remove any classes where the attribute is not present. - - The input list of classes. - The log writer object. - - - - Look for the /p:FilterClass parameter in the test harness settings. - Try to do a substring match on all filtered test classes. - - The parameters. - List of test classes to be filtered. - - - - Test method completed event arguments, contains the result. - - - - - Initializes a new instance of the TestMethodCompletedEventArgs - type. - - The result instance. - - - - Initializes a new instance of the TestMethodCompletedEventArgs - type. - - The result instance. - The unit test harness. - - - - Gets the test method result. - - - - - Helper code for TestMethod logic. - - - - - A value indicating whether the warning has been logged in this run. - - - - - Check whether [Exclusive] is present on >= 1 of the methods. - - The methods to search through. - True if at least one of the methods has Exclusive. - - - - Look through the methods for the [Exclusive] attribute. If found, - remove any methods where the attribute is not present. - - The methods to filter. - The log writer object. - - - - A helper utility for firing events as the unit test harness from any - component, internal or not. Enables expansion. - - - - - Stored instance of the harness. - - - - - Initializes a new intance of the UnitTestHarnessEvents helper. - - The harness reference. - - - - Calls the test assembly starting event. - - The event data. - - - - Calls the test assembly completed event. - - The event data. - - - - Calls the test class starting event handlers. - - The event data. - - - - Calls the test class completed event. - - The event data. - - - - Calls the test method starting event. - - The event data. - - - - Calls the test method completed event. - - The event data. - - - - Calls the test run starting event. - - The event data. - - - - A factory for creating the unit test objects. - - - - - The unit test harness. - - - - - Initializes a new unit test logic factory. - - The unit test harness reference. - - - - Creates a new AssemblyManager. - - The unit test provider. - The run filter. - The unit test assembly metadata object. - Returns a new AssemblyManager. - - - - Creates a new TestClassManager. - - The unit test provider. - The run filter. - The test class metadata. - The test class instance. - Returns a new TestClassManager. - - - - Creates a new TestMethodManager. - - The unit test provider. - The test class metadata. - The test method metadata. - The test class instance. - Returns a new TestMethodManager. - - - - A log provider that outputs in a simple custom test format that Visual - Studio recognizes. - - - A log provider that outputs in a simple custom test format that Visual - Studio recognizes. - - - - - LogProvider interface with a single Process method that handles a - LogMessage object. - - - - - A dictionary of conditional action handlers. - - - - - A dictionary of types/actions for handling specific types of log - messages. - - - - - Perform any needed operations to log the message. - - Instance of LogMessage type. - - - - Method that processes any messages not handled any other way. - - The log message. - - - - Registers an action for a specific message type. - - The type of interest. - The handler for the type. Takes a LogMessage - parameter. - - - - Registers a conditional handler. During the log message processing - step, all conditional callbacks will be tried. The first positive - result will then call the associated processing Action for that - conditional method entry. - - A conditional callback that takes a - LogMessage input parameter. - A log message processing Action that is called - when the condition is true. - - - - Removes a conditional callback. - - The condition. - - - - Clear all existing conditional handlers. - - - - - Clear all existing message type handlers. - - - - - Interface for LogProviders that want access to external test settings. - - - - - Initializes the provider. - - The settings. - - - - The filename to use for saving test results. - - - - - The default test adapter type name. - - - - - The default test list name. - - - - - The default computer name. - - - - - The default user name. - - - - - The default configuration name. - - - - - The default configuration description. - - - - - The Visual Studio log format writer. - - - - - Initializes a new instance of the VisualStudioLogProvider class. - - - - - Register the handler conditions of interest to this log provider. - - - - - Assembly start code. - - The log message. - - - - Process an Exception that was not the expected Exception type. - - The log message. - - - - Process an Exception that is logged or stored. - - The log message object. - - - - Sets the test run configuration information when the test assembly - begins processing. - - The test assembly metadata object. - - - - Generate a name for the test run that will be used when - displaying the result in Visual Studio. - - The test assembly metadata object. - Returns the test run name. - - - - Generates a new Guid string value. - - Returns a new Guid string value. - - - - Process a UTF result message. - - The log message object. - - - - Process [Bug(...)]. - - A KnownBugLogMessage object. - - - - The run filter has been selected. - - The log message object. - - - - Saves the log file data. - - The unit test harness. - - - - Initializes the test harness. - - The test harness settings. - - - - Gets or sets the test results filename. - - - - - Gets or sets the test adapter type name reported in the Visual - Studio results log file. - - - - - Gets or sets the TestRunId. - - - - - Gets or sets the test list name. - - - - - Gets or sets the computer name that is reported in the results - log file. - - - - - Gets or sets the user name that is reported in the results file. - - - - - Gets or sets the TestRunConfigurationName. - - - - - Gets or sets the TestRunConfigurationDescription. - - - - - Gets or sets a prefix for use in the test run name. - - - - - Gets or sets the TestRunConfigurationId. - - - - - Gets the current assembly name. - - - - - A log provider that outputs in a simple custom test format that - Visual Studio recognizes. This is a simple, subset writer. - - - - - Date time format string representing round-trip date/time - pattern. - - - - - A unique ID representing the Visual Studio unit test type ID. - - - - - The namespace for Visual Studio team test results. - - Was of XNamespace type in XLinq implementation. - - - - A dictionary containing test list names and guids. - - - - - Stores temporary, pending elements for the next result. - - - - - Initializes a new Writer object. - - - - - Stores property values in the respective elements, clears any - lookup dictionaries. - - - - - Returns a string value of the DateTime object. - - The DateTime object. - Returns the formatted string. - - - - Returns the XML log file as a string. - - The XML value. - - - - Creates the initial results document and its XElements. - - - - - Creates a new XElement within the results XML namespace. - - The element name. - Returns a new named element. - - - - The total number of scenarios. - - - - - The set of outcomes and counts. - - - - - Increment the number of passing results. - - The test outcome. - - - - Adds the result of a test method into the log. - - The test metadata. - The storage value. - The code base value. - The adapter type name. - The class name. - The test list name. - The computer name. - The start time. - The end time. - The outcome. - - - - Adds a WriteLine to the next result to be processed. - - The text to output. - - - - Adds an error message to the next result to be processed. - - The message. - - - - Adds an Exception to the next result to be processed. - - The Exception object. - - - - Adds pending output for the next result. - - The element to wrap in an Output element. - - - - Returns the GUID for a test list name. The result is stored - in memory. - - The test list name. - Returns the test list name guid. - - - - Gets or sets the time that the test run started. - - - - - Gets or sets the time that the writer object and/or test run was created. - - - - - Gets or sets the time that the test run was finished. - - - - - Gets the root XML node for the test run and its results. - - - - - Gets or sets the test type ID used for new results. - - - - - Gets the TestRunConfiguration element. - - - - - Gets the Counters element. - - - - - Gets the TestDefinitions element. - - - - - Gets the TestLists element. - - - - - Gets the TestEntries element. - - - - - Gets the Times element. - - - - - Gets the ResultSummary element. - - - - - Gets the Results element. - - - - - Sets the TestRunId. - - - - - Sets the TestRunName. - - - - - Sets the TestRunUser. - - - - - Sets the TestRunConfigurationName. - - - - - Sets the TestRunConfigurationId. - - - - - Sets the overall run outcome value. - - - - - Sets the TestRunConfigurationDescription. - - - - - A user control that should be used as the root visual for a Silverlight - plugin if developers would like to use the advanced TestSurface - functionality within Microsoft.Silverlight.Testing. - - The TestSurface is automatically cleared after each test scenario - completes, eliminating the need for many additional cleanup methods. - - - - - Initializes the TestPage object. - - - - - InitializeComponent - - - - - Gets the test surface, a dynamic Panel that removes its children - elements after each test completes. - - - - - A log provider that outputs failures as a string. - - - - - A list of failing results. - - - - - Initializes a new TextFailuresLogProvider instance. - - - - - Retrieve the text log of all failures in the unit test run. - - Returns the log contents. - - - - Register the handler conditions of interest to this log provider. - - - - - Process a UTF result message. - - The log message object. - - - - A user control that should be used as the root visual for a Silverlight - plugin if developers would like to use the advanced TestSurface - functionality within Microsoft.Silverlight.Testing. The TestSurface is - automatically cleared after each test scenario completes, eliminating - the need for many additional cleanup methods. - - - - - Backing field for the unit test harness instance. - - - - - Backing field for the model manager. - - - - - Backing field for the startup timer. - - - - - Backing field for a value indicating whether the clipboard feature - is supported. - - - - - Initializes the TestPage object. - - - - - Initializes the TestPage object. - - The test harness instance. - - - - Waits for the Settings to become available, either by the service or - system setting the instance property. - - The source timer. - The event arguments. - - - - Starts the test run. - - - - - Handles the test assembly starting event to expand the test stage - height. - - The source object. - The event data. - - - - Handles the test harness complete event, to display results. - - The source object. - The event data. - - - - Handles the click on the test stage. - - The source object. - The event data. - - - - Expand and collapse the test stage. - - A value indicating whether to expand the stage. - - - - - Handles the completion of a test method. - - The source object. - The event arguments. - - - - Handles the completion event on the tag expression editor to begin - the test run using the user-provided settings. - - The source object. - The event arguments. - - - - Handles navigation back or forward. - - The source object. - The event arguments. - - - - Installs the application. - - The source object. - The event arguments. - - - - Offers clipboard interface support for copying test run results. - - The source object. - The event arguments. - - - - Handles the click on a play/pause button for the run dispatcher. - - The source object. - The event arguments. - - - - Copies text into the clipboard. If the Silverlight runtime on the - system does not support the clipboard API, then it reverts to a - large text box that allows the user to manually copy and paste. - - The text to set. - - - - InitializeComponent - - - - - Gets the test surface, a dynamic Panel that removes its children - elements after each test completes. - - - - - Gets the unit test harness instance. - - - - - Gets the tree view instance. - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - - Looks up a localized string similar to There are no remaining test work items. - - - - - Looks up a localized string similar to Exception: Type "{0}" Message "{1}". - - - - - Looks up a localized string similar to Ignoring "{0}". - - - - - Looks up a localized string similar to Incorrect exception type "{0}" received. Was expecting a "{1}" type.. - - - - - Looks up a localized string similar to No Exception was observed. Was expecting a "{0}" type exception.. - - - - - Looks up a localized string similar to Tag cannot be empty!. - - - - - Looks up a localized string similar to The tag "{0}" contains the invalid character "{1}"!. - - - - - Looks up a localized string similar to Tag "{0}" is reserved!. - - - - - Looks up a localized string similar to tagExpression cannot be empty!. - - - - - Looks up a localized string similar to Expected end of tag expression "{0}" at position {1}!. - - - - - Looks up a localized string similar to Tag expected in expression "{0}" at position {1}!. - - - - - Looks up a localized string similar to Invalid tag expression "{0}" (expected "{1}" at position {2})!. - - - - - Looks up a localized string similar to Tag expression "{0}" is in use.. - - - - - Looks up a localized string similar to Exclusive classes are in use. - - - - - Looks up a localized string similar to Exclusive methods are in use. - - - - - Looks up a localized string similar to The known issue could not be verified. A failure will be recorded. If this bug has been fixed, please mark the Fixed attribute value to True.. - - - - - Looks up a localized string similar to No TestHarness is available.. - - - - - Looks up a localized string similar to The "{0}" functionality is not supported within this unit test system.. - - - - - Looks up a localized string similar to Initialization of UnitTestHarness. - - - - - Looks up a localized string similar to No composite work items exist to be cleared.. - - - - - Looks up a localized string similar to No test classes were selected to be in the test run.. - - - - - Looks up a localized string similar to Test harness was not specified on test harness settings object. If a test harness settings object was passed in, please verify that it contains a reference to a test harness.. - - - - - Looks up a localized string similar to Test bug: A test cannot use Test Task objects, such as callbacks and conditionals, or the PumpMessages feature, unless marked with the [Asynchronous] attribute.. - - - - - A central entry point for unit test projects and applications. - - - A central entry point for unit test projects and applications. - - - - - Friendly unit test system name. - - - - - A partial method for PrepareDefaultLogManager. - - The test harness settings. - - - - A partial method for setting the TestService. - - The test harness settings. - - - - Creates a new TestPage visual that in turn will setup and begin a - unit test run. - - A new RootVisual. - Assumes the calling assembly is a test assembly. - - - - Creates a new TestPage visual that in turn will setup and begin a - unit test run. - - Test harness settings to be applied. - A new RootVisual. - Assumes the calling assembly is a test assembly. - - - - Merge any settings provided by a test service with the parameters - that were passed inside the TestHarnessSettings. - - The test service. - The run settings. - - - - Initializes the test service and its contained providers. - - The run settings. - Action to call once the test service is - initialized and ready to continue the run's execution. - - - - Register another available unit test provider for the unit test system. - - A unit test provider. - - - - Test harness instance. - - - - - Start a new unit test run. - - Unit test settings object. - - - - Prepares the default log manager. - - The test harness settings. - - - - Tries to instantiate and initialize a VSTT provider. Requires that - XLinq is available and included in the application package. - - The test harness settings object. - - - - Creates the default settings that would be used by the UnitTestHarness - if none were specified. - - A new RootVisual. - Assumes the calling assembly is a test assembly. - - - - Call the TestHarnessCompleted event. - - The test harness completed event arguments. - - - - Create a default settings object for unit testing. - - The assembly reflection object. - A unit test settings instance. - - - - Gets the test system name built into the assembly. - - - - - Gets a string representing the file version attribute of the main - unit test framework assembly, if present. - - - - - A completed test harness handler. - - - - - A class contains extension methods and helpers for dealing with WorkItem - instances and improving framework performance. - - - - - Enqueues a work item into the task queue. The work item will run - immediately following the previous work item, and may not leave any - time before executing the next. This is a specialized method to be - used for performance improvements. - - The work item test. - The unit of work. - - - - Enqueues a method into the task queue. The method will run - immediately following the previous work item, and may not leave any - time before executing the next. This is a specialized method to be - used for performance improvements. - - The work item test. - The callback action or method. - - - - Enqueues a conditional statement into the task queue. The method will - run immediately following the previous work item, and may not leave - any time before executing the next. This is a specialized method to - be used for performance improvements. - - The work item test. - The conditional function or statement. - - - - Custom test class that provides the ability to perform semi-asynchronous - test tasks on the main thread. Requires the custom unit test harness - that manages and invokes test work items on the thread when needed. - - Tests using this functionality will not be compatible with the full - desktop framework's Visual Studio Team Test environment. - - - - - Signal that a test is complete when using Async testing. - - WARNING: If you use your own methods for completing, such as an - HtmlTimer or other threading method, it is possible that this call - will occur *AFTER* the test has timed out when using Timeouts. As - such, be very careful as you could complete the call to the *next* - test. - - - - - Add a task object to the test queue. For a test that is currently - executing, all tasks contained within the queue are executed to - completion (unless an Exception is thrown) -before- moving on to - the next test. - - The test task queue replaces the PumpMessages(...) system that - permitted a single callback. This enables specialized tasks, such - as DOM bridge tasks, sleep tasks, and conditional continue tasks. - - Asynchronous test task - instance. - - - - Delay a minimum amount of time before continuing. Similar to a sleep - call that is not a blocking call. - - The minimum time span to wait before continuing. - - - - Creates a delay work item instance. - - The minimum time span to wait before continuing. - Returns a new work item. - - - - Delay a minimum amount of time before continuing. Similar to a sleep - call that is not a blocking call. - - The minimum number of milliseconds to wait - until the delay is finished. - - - - Requires a bool returning delegate to be passed in. Instructs the - test task queue to wait until the conditional call returns True to - continue executing other test tasks and/or ending the test method. - - Conditional method or delegate. - Test will halt until this condition returns True. - - - - Creates a conditional work item instance. - - Conditional method or delegate. - Test will halt until this condition returns True. - Returns a new work item. - - - - Enqueue a test task which calls the TestComplete method of - SilverlightTest. - - - - - Add a Callback method into the test task queue. Similar to the - PumpMessages(...) call, with the difference being that there is no - longer a single requirement: you can enqueue several callback - methods and other test tasks, all of which will execute before the - test completes and/or the engine continues. - - Void-returning delegate, - anonymous delegates work fine too. - - - - Creates a callback work item instance. - - Void-returning delegate, - anonymous delegates work fine too. - Returns a new work item. - - - - Adds a number of callback methods into the test task queue. - - Set of Action instances. - - - - Sleep a minimum number of milliseconds before calling a test - callback delegate. - - Minimum number of - milliseconds to sleep. The only guarantee to the tester - is that the sleep will be >= this amount of ms, and NOT - that there is precision or an exact time. - Callback method to - execute after the minimum amount of time has - elapsed. - - - - Enqueue an action. A shortcut for the EnqueueCallback. - - The action to enqueue. - - - - Sleep a minimum number of milliseconds. This is the simplified - overload which requires no callback. - - Minimum number of - milliseconds to sleep. The only guarantee to the tester is that the - sleep will be >= this amount of ms, and NOT that there is precision - or an exact time. - - - - A special indicator attribute to enable better debugging using - Microsoft.Silverlight.Testing. - - As there is very little parameter information available for a test run, - this attribute singles out specific classes to execute when found. - - This attribute is unique to this environment and not compatible with any - desktop unit test framework without using a shim if it is left in code. - - - - - Implementation of useful properties and features for presentation - platform tests (Silverlight and WPF). - - Tests using this functionality will not be compatible with the full - desktop framework's Visual Studio Team Test environment. - - - - - Gets the test panel. - - - - - Provides access to Silverlight-specific test features and - functionality. - - Tests using this functionality will not be compatible with the full - desktop framework's Visual Studio Team Test environment. - - - - - A test work item is a task that is invoked until it is complete. It - maintains its own state to be able to notify the caller when it is - finally complete, with no further work to be run. - - It is possible that some implementations of a TestWorkItem may actually - contain a set of sub-tasks by implementing a composite pattern. - - - - - A value indicating whether the task can immediately execute. - - - - - Invoke the task. Return false only when the task is complete. - - True if there is additional work to be completed. False - when there is none. - - - - Called by the task after the work is complete. - - - - - Gets a value indicating whether the task's work is complete. - - - - - Gets or sets a value indicating whether the work item can be - executed immediately, and does not rely on special asynchronous - operation. Used for performance improvements. The setter is also - public. - - - - - The extended writer for the unit testing harness and consumers. - - - - - A utility type that writes new log messages to the test harness log - queue. - - - - - The factory used for creating new LogMessage types. - - - - - The test harness that contains the method to post new events into - the log message queue. - - - - - Initialize a new writer class, using the default LogMessageFactory - to create new messages. - - The test harness instance. - - - - Initialize a new writer class. - - The test harness instance. - - The factory to use when creating new messages. - - - - - Posts a log message to the test harness queue for processing. - - The log message object. - - - - Creates a new log message using the embedded factory. - - Returns a new LogMessage instance. - - - - Creates a new log message using the embedded factory. - - The message type. - Returns a new LogMessage instance. - - - - Creates a new log message using the embedded factory. - - The message type. - The text message. - Returns a new LogMessage instance. - - - - Decorate a log message with a value. - - The log message to decorate. - The key for this decoration. - The value of this decoration. - - - - Decorate the log message object with an Exception object. - - The log message object. - The Exception. - - - - Decorate the log message object with a name. - - The log message object. - Name property value. - - - - Decorate the log message object with a test stage value. - - The log message object. - Test stage value. - - - - Decorate the log message object with a test outcome object. - - The log message object. - Test outcome object. - - - - Decorate the log message object with a test granularity object. - - The log message object. - Test granularity object. - - - - Sets the type of the log message. - - The log message object. - The new value to set the message type to. - - - - This writes a new line of information similar to a Debug::WriteLine - call. - - The text to write. - - - - Writes information through a new log message. - - The information string. - - - - Writes a message relating to the test infrastructure. - - The text to write. - - - - Writes an environment message. - - The text to write. - - - - Writes a TestRun message. - - The text to write. - - - - Log an error message. - - The error message string. - The Exception object to decorate the message - with. - - - - Log an error message. - - The error message string. - - - - Log a warning message. - - The warning message string. - The Exception object to decorate the message - with. - - - - Log a warning message. - - The warning message string. - - - - Record a test outcome. - - The accompanying message. - The outcome value. - - - - Writes information about an encountered, known issue. - - Information about the known issue. - - - - Records a log message that indicates a named, granular test stage - has happened. - - Any message for the log. - A name for the object or event. - The test granularity value. - The test stage value. - - - - Initializes the unit test log message writer helper. - - The test harness reference. - - - - Marks a message as a unit test system-specific message. - - The log message object. - - - - An incorrect exception type has occurred. - - The expected type. - The actual exception's type. - The test metadata. - The method metadata. - - - - No Exception was intercepted, yet one was expected. - - The expected exception type. - The test class metadata. - The test method metadata. - - - - Logs and Exception that was intercepted or observed. - - The actual Exception instance. - The test class metadata. - The test method metadata. - - - - Enqueues a Ignore message. - - The granularity of the ignore operation. - The name of the test skipped. - - - - Enqueues a message containing a test run filter. - - The test run filter. - - - - Records a log message that indicates a named, granular test stage has - happened. - - The assembly metadata object. - The test granularity value. - The test stage value. - - - - Log a test class's stage. - - The test class metadata object. - The test stage. - - - - Log the result of a unit test scenario. - - The result of the test. - - - - Log a test method's stage. - - The test method metadata object. - The test stage. - - - - Records a harness state for the unit test harness. - - The unit test harness. - The harness name. - The test stage. - - - - A test harness for interacting with unit test providers such as Visual - Studio Team Test's metadata. - - - - - Display name for this harness. - - - - - Manages the attachment state of a global exception handler. - - - - - Container of all work items for the test harness. - - - - - Manager of the stack of dispatchers, so that the appropriate parent - container handles exceptions and completion events. - - - - - Number of valid test assemblies encountered. - - - - - The current run's known number of test methods. - - - - - Backing field for the event firing helper. - - - - - Initiate unit test harness. - - - - - Queue of log messages awaiting processing. - - - - - Adds a log provider to the listening log providers group. - - Log provider object. - - - - Enqueue a log message object for processing by the log providers. - - The log message object. - - - - Begin running the test harness. - - - Make sure to subscribe to the Complete event before calling this - method, in some harnesses this may be a synchronous Run followed - immediately by the Complete event being fired. - - - - - Complete event. - - The sender. - The event arguments. - - - - Stores a log file for the test run. Depending on the execution - environment, this call may not successful. - - The name of the log file. - The log file content as a string. - - - - If supported by any attached test service, this publishes the final - test results. Typical harness implementations may immediately close - the web browser channel upon receiving the message, so any other - reporting should be done first. - - - - - Process all queued log messages. - - - - - Fill member variables with any non-null settings of the same type. - - Settings container class. - - - - Initializes all log providers. - - - - - Call the TestHarnessCompleted event. - - - - - Call the Publishing event. - - The event arguments. - - - - Overrides the PublishResults method so that final reporting is only - done once all other logging is finished. - - - - - Publish final results. If not yet ready, will keep waiting around - as a work item until it is done. - - - - - Stored dispatcher instance. - - - - - Checks if a reporting provider is connected to the test service. - - Returns true if a reporting provider is connected to the - test service. - - - - Immediately sets the overall status using a log message and - processes the message queue. - - The message to set. - - - - Sets the unit test harness property for a test case that inherits - from the abstract base type 'CustomTest'. - - A CustomText instance. - - - - Initialize the harness with a set of test assemblies. - - - - - Restarts the run dispatcher. - - - - - Track the results for our execution and also track the fail state. - - Scenario result to process. - - - - Fires the test assembly starting event. - - The event data. - - - - Fires the play pause event. - - Event data. - - - - Fires the test assembly completed event. - - The event data. - - - - Fires the test class starting event. - - The event data. - - - - Fires the test class completed event. - - The event data. - - - - Fires the test method starting event. - - The event data. - - - - Notifies observers that a test method has been completed. Also - clears the test panel's visual tree. - - The event data. - - - - Notifies observers that a test run has been started. - - The event data. - - - - Reference to the test page object. - - - - - Attempts to report the code coverage information using the test - service provider. If there is no available coverage reporting - service, this is a silent failure. Only reports if >= 1 blocks - are hit. - - The test service. - - - - Enqueue a test assembly from a simple Assembly reference. - - The test assembly. - The run filter settings for the test assembly's run. - - - - Enqueues a test assembly. - - The test assembly metadata. - The run filter settings for the test assembly's run. - - - - Flush the current log manager and then perform the next invoke. - - Returns true if work remains. - - - - Creates the test run filter for the initial run. - - The unit test settings. - Returns a new TestRunFilter instance. - - - - Determine what test assemblies need to be executed. Enqueue tasks - for the unit test assembly providers to run the tests. - - - - - Calculates the number of methods for a run. - - The assembly manager. - The test assembly. - The test run filter. - Returns the number of known methods returned. - - - - Event fired at the completion of the harness' work. - - Sender object instance. - Event arguments. - - - - Listener event for any unhandled exceptions. - - Sender object instance. - Event arguments. - - - - Creates the set of harness tasks to run and hooks up to the Complete event. - - - - - Gets the list of results. - - - - - Gets the log message writer instance. This can be used to easily - post informative messages to the log message queue and providers. - - - - - Gets or sets the logic factory used for instantiating the - unit test logic and management objects. - - - - - Gets or sets the overall harness state - overloaded types can be - used to store additional information. - - - - - Gets the log providers list. - - - - - Gets or sets the wrapper that handles calling the next Run step - method until complete; allows for a virtual Run method. - - - - - Gets the dictionary of Parameters passed into the test harness. - - - - - Gets or sets the settings used to initialize the test harness. - - - - - Gets a set of events that can be fired for test results and other - important test runtime events. - - - - - The test harness is publishing results. - - - - - Gets the TestService referenced by the test harness settings. The - test service provides advanced, optional functionality that is - useful to harness and test case developers. A typical test service - operates outside the process or security boundary. - - - - - Complete event fired when the test harness has finished its test - run. - - - - - Gets a dispatcher instance. - - - - - Gets the root container for test work to be completed. - - - - - Gets the known number of test methods in the current test run. - - - - - Gets or sets a value indicating whether to intercept exceptions at - the app domain level and funnel into the current container or not. - - - - - Gets the internal DispatcherStack being used by the test harness. - - - - - The test assembly starting event. - - - - - On the play or pause change of the dispatcher. - - - - - Gets or sets a value indicating whether the dispatcher is currently - running. - - - - - Test assembly completed event. - - - - - Test class starting event. - - - - - The test class completed event. - - - - - The test method starting event. - - - - - An event that is fired whenever a test method completes. - - - - - An event that is fired when the test run is starting. - - - - - Gets or sets the test page. - - - - - Gets the test panel manager instance. - - - - - Well-known keys that can be used to mark decorator instances in log - message objects. - - - - - Indicates that the message is specific to the unit test system. - - - - - The unit test harness reference. - - - - - The metadata interfacing object for a test assembly. - - - - - The metadata interfacing object for a test class. - - - - - The metadata interfacing object for a test method. - - - - - Indicates that the incorrect exception was intercepted. - - - - - Indicates that the message indicates a skipped/ignored item. - - - - - The type of the expected exception. - - - - - The type of the actual exception. - - - - - The actual exception. - - - - - A TestRunFilter object. - - - - - A ScenarioResult object. - - - - - Helper conditional methods for unit test-specific log messages. - - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The unit test decorator of interest. - Returns true if the condition is met. - - - - Returns a value indicating whether the message is marked as a unit - test system message. - - The message. - Returns true if the message is a unit test system-marked - message. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message has an attached TestRunFilter. - - The log message object. - Returns a value indicating whether the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - Determines whether a log message meets a specific condition or set - of conditions. - - The log message object. - Returns true if the condition is met. - - - - A lazy method type. - - - - - A class that does a lazy lookup when needed using reflection. - - - - - Attribute Type instance. - - - - - The Type to search with. - - - - - Whether the search has happened. - - - - - The method reflection object. - - - - - Construct a new lazy method wrapper. - - The attribute type. - - - - Construct a new lazy method wrapper. - - Type to search. - Attribute type. - - - - Does a search and retrieves the method information. - - The method reflection object. - - - - Whether the type has a method info. - - A value indicating whether the method information has - been found. - - - - Perform a search on the type. - - - - - Gets the type of attribute the lazy method is searching for. - - - - - Gets the underlying type that is searched. - - - - - Gets or sets a value indicating whether a lookup has already been attempted. - - - - - Gets or sets the underlying MethodInfo from reflection. - - - - - Underlying Assembly reflection object. - - - - - Create a new lazy method from a MethodInfo instance. - - Assembly reflection object. - Attribute Type instance. - - - - Performs a search on the MethodInfo for the attributes needed. - - - - - Test assembly metadata interface. - - - - - Gets a collection of test class metadata objects. - - Returns a collection of metadata objects. - - - - Gets the initialization method. - - - - - Gets the cleanup method. - - - - - Gets a reference to the unit test provider. - - - - - Gets the name of the test assembly. - - - - - Gets the test harness used to initialize the assembly. - - - - - An expected exception marker for a test method. - - - - - Gets the expected exception type. - - - - - Gets any message associated with the expected exception object. - - - - - Represents the host type information for a test. - - - - - Gets the Host type. - - - - - Gets the host data. - - - - - A representation of a test's priority. - - - - - Metadata representing a test class. - - - - - Retrieve a collection of the test method metadata objects setup by - the unit test provider. - - A collection of test method interfaces. - - - - Gets the test class Type instance. - - - - - Gets a value indicating whether the test class should be ignored. - - - - - Gets the per-test initialization method. - - - - - Gets the per-test cleanup method. - - - - - Gets the one-time class initialization method. - - - - - Gets the one-time class cleanup method. - - - - - Gets the name of the test class. - - - - - Gets a reference to the parent test assembly metadata - instance. - - - - - Test method metadata. - - - - - Used for decorating with unit test provider-specific capabilities, - such as the TestContext concept. - - Instance to decorate. - - - - Get any attribute on the test method that are provided dynamically. - - - Dynamically provided attributes on the test method. - - - - - Invoke the test method. - - Instance of the test class. - - - - Gets the test method reflection object. - - - - - Hooks up to any unit test provider-enabled WriteLine capability - for unit tests. - - - - - Gets a value indicating whether the test is marked to be ignored. - - - - - Gets any description for the method. - - - - - Gets a name for the method. - - - - - Gets any category information for the method. - - - - - Gets any test owner information. - - - - - Gets any expected exception attribute . - - - - - Gets any timeout information. - - - - - Gets a collection of any test properties. - - - - - Gets a collection of any test work items. - - - - - Gets any priority information. - - - - - A property for a test method. - - - - - Gets the test property name. - - - - - Gets the test property value. - - - - - Provider model for a unit test system that uses reflection and metadata - to enable a unit test run. - - - - - Retrieve the metadata instance for a test assembly given a - reflection Assembly instance. - - The test harness using the provider. - Reflected test assembly. - Unit test provider-specific metadata instance for - the test assembly. - - - - Gets a value indicating whether a specific capability or set of - capabilities are supported by the unit test provider. - - Capability of interest. - Gets a value indicating whether the capability is - supported. - - - - Checks if an Exception actually represents an assertion that failed - to improve the logging experience. - - Exception object. - Returns true if the Exception is an assertion exception - type. - - - - Gets the name of the unit test provider. - - - - - Gets the capabilities that the unit test provider implements. - - - - - Work item for a test. - - - - - Gets the associated information from the work item. - - - - - Event arguments that pass along a string value. - - - - - Create a new event argument instance. - - - - - Create a new event argument instance that stores a string value. - - String value to pass along. - - - - String value stored in the event arguments. - - - - - Gets the stored string value. - - - - - A set of capabilities that a unit test provider may chose to implement - through the metadata interfaces. - - - - - No defined capabilities. - - - - - Support for attribute [AssemblyInitialize]. - - - - - Support for attribute [AssemblyCleanup]. - - - - - Support for attribute [Ignore] for classes. - - - - - Support for attribute [Ignore] for methods. - - - - - Support for attribute [Description] on methods. - - - - - Support for attribute [Category] on methods. - - - - - Support for attribute [Owner] on method. - - - - - Support for attribute [Priority] on method. - - - - - Support for attribute [TestProperty](...) on methods. - - - - - Support for attribute [Timeout] on methods. - - - - - Support for attribute [WorkItem(...)]('s) on methods. - - - - - Test work item type that does not complete until the sleep time has - elapsed. This is NOT a blocking Sleep. - - - - - The amount of time to delay for. - - - - - The DateTime that marks the point in time the task is complete. - - - - - Create a new Sleep work item, including the number of - milliseconds to wait until continuing. - - Amount of time to wait/delay. - - - - On the first time, will calculate the final DateTime. Otherwise, - null operation (returns) until that time. - - Returns a value indicating whether there is more work to be - done. - - - - Expected exception metadata. - - - - - Private constructor. - - - - - Creates a new expected exception metadata wrapper. - - Attribute value. - - - - The expected exception attribute. - - - - - Gets the type of the expected exception. - - - - - Gets any message to include in a failure. - - - - - A simple wrapper for a priority integer value that overrides the - ToString method. - - - - - Initializes a new instance of the Priority class. - - The priority. - - - - Gets the priority as string. - - Returns the priority. - - - - Gets the priority value. - - - - - The set of provider attributes. - - - - - Initializes the VSTT metadata provider. - - - - - Gets VSTT [TestClass] attribute. - - - - - Gets VSTT [Ignore] attribute. - - - - - Gets VSTT [ClassInitialize] attribute. - - - - - Gets VSTT [Priority] attribute. - - - - - Gets VSTT [ClassCleanup] attribute. - - - - - Gets VSTT [TestInitialize] attribute. - - - - - Gets VSTT [TestCleanup] attribute. - - - - - Gets VSTT [Description] attribute. - - - - - Gets VSTT [Timeout] attribute. - - - - - Gets VSTT [Owner] attribute. - - - - - Gets VSTT [ExpectedException] attribute. - - - - - Gets VSTT [AssemblyInitialize] attribute. - - - - - Gets VSTT [AssemblyCleanup] attribute. - - - - - Gets VSTT [TestMethod] attribute. - - - - - Gets VSTT [TestProperty] attribute. - - - - - Test class wrapper. - - - - - Construct a new test class metadata interface. - - Assembly metadata interface object. - - - - Creates a new test class wrapper. - - Assembly metadata object. - Type of the class. - - - - Test Type. - - - - - Collection of test method interface objects. - - - - - A value indicating whether tests are loaded. - - - - - A dictionary of method types and method interface objects. - - - - - Gets a collection of test method wrapper instances. - - A collection of test method interface objects. - - - - Exposes the name of the test class. - - Returns the name of the test class. - - - - Gets the test assembly metadata. - - - - - Gets the underlying Type of the test class. - - - - - Gets the name of the test class. - - - - - Gets a value indicating whether an Ignore attribute present - on the class. - - - - - Gets any test initialize method. - - - - - Gets any test cleanup method. - - - - - Gets any class initialize method. - - - - - Gets any class cleanup method. - - - - - Methods enum. - - - - - Initialize method. - - - - - Cleanup method. - - - - - Test init method. - - - - - Test cleanup method. - - - - - A provider wrapper for a test method. - - - - - Property name for the TestContext. - - - - - Default value for methods when no priority attribute is defined. - - - - - An empty object array. - - - - - Method reflection object. - - - - - Private constructor, the constructor requires the method reflection object. - - - - - Creates a new test method wrapper object. - - The reflected method. - - - - Call the WriteLine method. - - String to WriteLine. - - - - Decorates a test class instance with the unit test framework's - specific test context capability, if supported. - - Instance to decorate. - - - - Get any attribute on the test method that are provided dynamically. - - - Dynamically provided attributes on the test method. - - - - - Invoke the test method. - - Instance of the test class. - - - - Exposes the name of the test method as a string. - - Returns the name of the test method. - - - - Allows the test to perform a string WriteLine. - - - - - Gets the underlying reflected method. - - - - - Gets a value indicating whether there is an Ignore attribute. - - - - - Gets any description marked on the test method. - - - - - Gets the name of the method. - - - - - Gets the Category. - - - - - Gets the owner name of the test. - - - - - Gets any expected exception attribute information for the test method. - - - - - Gets any timeout. A Nullable property. - - - - - Gets a Collection of test properties. - - - - - Gets a collection of test work items. - - - - - Gets Priority information. - - - - - Represents a simple test property with a key/value string pair. - - - - - Initializes a new instance of the TestProperty class. - - - - - Initializes a new instance of the TestProperty class. - - The initial property name. - The initial property value. - - - - Gets or sets the property name. - - - - - Gets or sets the property value. - - - - - A wrapper for the unit test context capability of Visual Studio Team - Test's unit test framework. - - - - - Create a new unit test context wrapper for the test method. - - Test method. - - - - Constructor of a new unit test context. - - - - - Test method. - - - - - Used to write trace messages while the test is running. - - Format string. - The arguments. - - - - Throw a not supported exception. - - Functionality that is not supported (string). - A new NotSupportedException. - - - - Adds a file name to the list in TestResult.ResultFileNames. - - Filename to add as a result. - - - - Begins a timer with the specified name. - - The name of the timer to create. - - - - Ends a timer with the specified name. - - Name of the timer. - - - - Cache of properties. - - - - - Gets test properties. - - - - - Gets current data row when test is used for data driven testing. - - - - - Gets current data connection row when test is used for data driven testing. - - - - - Gets the name of the test method. - - - - - Gets the current enum outcome - passed, failed, or inconclusive. - - - - - Assembly metadata for the Visual Studio Team Test unit test framework. - - - - - Assembly reflection object. - - - - - Assembly initialization method information. - - - - - Assembly cleanup method information. - - - - - Unit test provider used for the assembly. - - - - - The unit test harness. - - - - - Creates a new unit test assembly wrapper. - - Unit test metadata provider. - A reference to the unit test harness. - Assembly reflection object. - - - - Reflect and retrieve the test class metadata wrappers for - the test assembly. - - Returns a collection of test class metadata - interface objects. - - - - Gets the name of the test assembly. - - - - - Gets the unit test provider instance. - - - - - Gets any assembly initialize method. - - - - - Gets any assembly cleanup method. - - - - - Gets the test harness used to initialize the assembly. - - - - - Gets the test harness as a unit test harness. - - - - - Provider for the Visual Studio Team Test unit test (UT) framework - metadata. - - - - - Name of this provider. - - - - - The capabilities of the VSTT UTF provider. - - - - - Whether the capability is supported by this provider. - - Capability type. - A value indicating whether the capability is available. - - - - Create a new Visual Studio Team Test unit test framework provider - instance. - - - - - Cache of assemblies and assembly unit test interface objects. - - - - - VSTT unit test provider constructor; takes an assembly reference to - perform reflection on to retrieve all test class types. In this - implementation of an engine for the VSTT metadata, only a single - test Assembly can be utilized at a time for simplicity. - - The unit test harness. - Assembly reflection object. - Returns the assembly metadata interface. - - - - Check if the Exception is actually a failed assertion. - - Exception object to check. - True if the exception is actually an assert failure. - - - - Gets the name of the provider. - - - - - Gets the specialized capability descriptor. - - - - - Settings for the unit test system. - - - - - The tag expression key name. - - - - - By default test methods are sorted. - - - - - By default test classes are sorted. - - - - - Settings for the unit test system. - - - - - Gets the parameters from the response file. - - The parameters. - - - - Gets the components initialized by the entry-point assembly. These - are the dynamically loaded objects that may be needed by the - TestHarness. - - The components. - - - - Gets the log providers. - - - - - Gets or sets a set of sample tags for use in a tag editor screen. - - - - - Gets the list of test assemblies. - - The test assembly. - - - - Gets or sets the test service provider. The test service lights up - advanced out-of-process communication, reporting, logging, and - other valuable services. - - - - - Gets or sets the test harness. - - The test harness. - - - - Gets or sets the test service hostname to try using. Defaults to - localhost. - - - - - Gets or sets the test service port to try using. Defaults to 8000. - - - - - Gets or sets the test service path to try using. Defaults to - /externalInterface/. - - - - - Gets or sets a value indicating whether to start the run - immediately when the test system is run. Defaults to false to enable - the test service to load and information to be provided in the - user interface. - - - - - Gets or sets the type of the TestPanel to create. The type must - derive from Microsoft.Silverlight.Testing.ITestPanel. - - - - - Gets or sets a value indicating whether test methods are sorted - alphabetically. By default this value is true. - - - It is worth understanding that the order of unit test - execution should not affect the results of a test run. Any expected - ordering and verification from multiple test methods should be - refactored into a single unit test. - - - - - Gets or sets a value indicating whether test classes are sorted - alphabetically. This setting is True by default. - - - - - Gets or sets a value indicating whether to show the tag expression - editor user interface before starting the test run. - - - - - Gets or sets the tag expression used for selecting tests to run. - - - - - Gets a list of test classes to run. Enables filtering. - - This property should be considered obsolete. - - - - A manager for the underlying TestSurface Panel. - - - - - Private constructor. - - - - - The test page object. - - - - - A value indicating whether the panel is dirty. - - - - - Remove the children from the test surface, if it has - been used. - - - - - Remove the children from the test surface. - - - - - Gets or sets the Reference to the TestPage user control. - - - - - Gets the TestSurface Panel, and tracks the use for the - current test method. When the test completes, the panel children - will be cleared automatically. - - - - - A result from a test scenario. - - - - - Creates a result record. - - Test method metadata object. - Test class metadata object. - Test result object. - Exception instance, if any. - - - - The string representation of the ScenarioResult. - - Returns a verbose string representation of the result. - - - - Gets or sets the scenario's started time. - - - - - Gets or sets the scenario's finishing time. - - - - - Gets the test method metadata. - - - - - Gets the test class metadata. - - - - - Gets or sets the Result object. - - - - - Gets the Exception instance, if any. - - - - - Container and manager type which handles an entire test assembly; contains sub work - items that represent all actions needed to execute its tests. - - - - - A container that stores instances of the unit test harness and provider. - - - - - TestWorkItem which can contain sub-tasks; the underlying work item is - not marked complete until the Children have completed or an Exception - is thrown. - - - - - Store the underlying tasks. - - - - - Whether the TestTaskContainer::IsComplete should be set to true - after all children have been de-queued. - - - - - Whether the first invoke has happened yet or not. - - - - - Constructor for the TestTaskContainer type. - - - - - Optional method to call on the first invoke. - - - - - Invoke the test container; in turn will execute child work items - as needed. Supports executing multiple items immediately for - performance reasons. - - True if additional work remains, False once IsComplete - is set to true. - - - - Invoke the test container; in turn will execute child work items - as needed. - - The work item used for the invoke. - True if additional work remains, False once IsComplete - is set to true. - - - - Clear the children. - - - - - Dequeue a work item. - - A work item. - - - - Add a new work item to the container to schedule it for invocation. - - New test work item to enqueue. - - - - Adds a new work item that will execute more quickly. - - The item of work. - - - - Enqueues a callback or action that will quickly execute. - - The action or method. - - - - Add a new callback action and schedule it for invocation. - - The action. - - - - Return the top work item, if any, from this container. - - Peek into any test work item. - - - - Work items must call this method to indicate completion of the work - item; in turn fires the Complete event delegates. - - - - - Internal-only version which can be called during a test completion - through the relation - not necessarily the best design; events - may make more sense long-term. - - - - - Call when an exception occurs inside a work item. - - Exception object. - - - - Fire the Complete event. - - Empty event arguments. - - - - Fire the unhandled exception event. - - Exception object. - - - - Gets a value indicating whether the container is marked Complete - when all children have executed or not. - - - - - Gets a value indicating whether sub tasks remain. - - - - - Complete event is fired when the underlying WorkItemComplete method - is called by the work item. - - - - - Event fired when an exception is thrown and unhandled within the - underlying Invoke sequence. - - - - - Gets or sets a value indicating whether the task can execute - immediately. - - - - - The unit test provider. - - - - - Initializes a new unit test work item container. - - The unit test harness. - The unit test metadata provider. - - - - Logs a new message. - - Message object. - - - - Logs a message about the harness. - - Information about the harness. - - - - Gets the log message writer for the unit test system. - - - - - Gets the test harness instance. - - - - - Gets the unit test provider instance. - - - - - The test run filter object. - - - - - Unit test provider-agnostic assembly metadata. - - - - - Container of work items for running test classes. - - - - - Create a new assembly manager, takes in the harness, provider - reference and actual IAssembly object. - - The test run filter object. - Harness object. - The unit test metadata provider. - The test assembly metadata object. - - - - When the test run is ready to test the underlying test assembly that - this class manages, perform reflection and enqueue work items to run - the tests. - - - - - The assembly initialize method. - - - - - The assembly cleanup method. - - - - - Reflect over all test classes in the assembly and add any which are not - filtered out into the test work item queue. - - - - - Helper to enqueue a new method dispatcher. - - The method reflection object. - - - - Gets the collection of all the instances of the assembly's test - classes, used to keep a single reference of the type. - - - - - A method container. - - - - - The timeout time. - - - - - The test method metadata. - - - - - Constructs a new method container. - - - - - Constructs a new method container. - - An instance of the method's type. - The method reflection object. - The test method. - - - - The task that involves the method, and contains its own internal - test queue, if needed for asynchronous tasks. - - - - - The reflection object for the method. - - - - - Invoke into the method. - - Returns the condition of any remaining work. - - - - On the first invoke, make sure there's a task to call the method. - - - - - Gets the method's reflection object. - - - - - A dictionary that manages single instances of types for use across the - unit test system. - - - - - Returns the instance for a Type; if there is not an instance yet, - this will use Activator.CreateInstance to create it. - - The Type instance to retrieve. - Returns an instance of the Type. Returns a new instance - if the Type has not yet been used. - - - - Remove any instance for the type. - - The Type of instance to remove. - - - - Test class manager. - - - - - Test run filter object. - - - - - Reference to the class and its metadata. - - - - - Queue of any tests to run. - - - - - Class instance. - - - - - A container type that handles an entire test class throughout the - test run. - - Test run filter object. - The unit test harness. - The test class metadata interface. - The object instance. - The unit test provider. - - - - Code run the first time this container is invoked. - - - - - Custom tests need to be prepared before use. - - - - - The test initialize method. - - - - - The test cleanup method. - - - - - Reflect through the class to find any test methods, and add them to - the list of queued methods. Also, sorts the methods if appropriate - based on the settings file. - - - - - Add a new method dispatcher to the test work item queue. This is a - work item container which is able to manage its own internal test - work item queue. - - The method reflection object. - - - - A special type dedicated to keeping a running stack of the dispatch - managers that are actually enabled for "work item" use. The current - dispatcher is used by the test work item queue. - - - - - Dispatcher stack; a stack of work item containers. - - - - - Creates a new empty stack for work item containers. - - - - - Push a new dispatcher onto the stack. - - The composite work item to push. - - - - Pop a dispatcher off the stack. - - Returns the top-most container. Throws an - InvalidOperationException if none is available. - - - - Gets the current test work item dispatcher, which is the dispatcher - on the top of the stack. Returns null if there is none. - - - - - Manager for planning, processing, and reporting the result of a single - test method for a unit test provider. - - - - - Underlying test class object. - - - - - Underlying test method object. - - - - - Reference to an instance of the test class. - - - - - Scenario result of the test method. - - - - - The started time of execution. - - - - - Stores a collection of written lines. - - - - - A value indicating whether the bug attribute was present on this - method. If it is, the result will be inverted at completion. - - - - - Contains the main test contents. - - - - - Constructor for a test method manager, which handles executing a single test method - for a unit test provider. - - The unit test harness object. - The test class metadata object. - The test method metadata object. - The test class instance. - The unit test provider. - - - - Log a start message. - - - - - Log an end message. - - - - - Handles the write line event for the test method. - - The string event arguments. - - - - First invoke, plan for the method's execution. - - - - - Sets the start and finish times on the ScenarioResult object. - - - - - Creates the ScenarioResult instance for this test method. - - The initial test outcome value. - - - - Process the result. - - Source object. - Event arguments. - - - - Process an unhandled exception for the method. - - Source object. - Unhandled exception event arguments. - - - - Create a new method container to enclose a reflected method for execution. - - The method reflection object. - - - - Gets or sets a value indicating whether the bug attribute's logic - has already been processed. - - - - - Gets the write line output list. - - - - - A container which is able to attach to the underlying test dispatcher - stack to enable advanced asynchronous functionality, when supported. - - - - - The unit test harness. - - - - - The granularity of the contained item. - - - - - The test method metadata object. - - - - - Initializes dispatcher-stack attaching method container work item. - - Test harness. - Test instance. - Method reflection object. - Test method metadata. - Granularity of test. - - - - Connect to dispatcher stack for advanced functions, if supported. - - - - - Check a MethodInfo for the advanced async attribute. - - True if the work item queue is supported. - - - - A work item for tests to use which will call the delegate when the work - item is executed. - - - - - Stored void delegate. - - - - - Create a new Callback work item. - - Action to execute on Invoke. - - - - Execute the callback. - - Whether the work item is complete. - - - - A test work item that is complete once the condition is asserted. - - - - - The conditional delegate. - - - - - Construct a new conditional work item. - - Conditional delegate. - - - - Invoke the condition, will continue invoking until - the condition is false. - - Completes the invocation once the condition is true. - - - - A simple work item that invokes a method through the reflection - MethodInfo instance. - - - - - An empty object array. - - - - - An object instance. - - - - - Method reflection object. - - - - - The test method to invoke. - - - - - Creates a new method invoke work item for a MethodInfo instance. - - The type instance. - The method on the type to invoke when the - work item is executed. - The test method metadata. - - - - Invokes the underlying method on the instance and marks the - test work item as complete. - - False, noting the completion of the work item. - - - - Unit test providers. - - - - - List of unit test providers. - - - - - Static constructor that initializes the built-in unit test metadata providers. - - - - - Gets the unit test provider for an assembly. The framework only - currently supports a single provider per test assembly, so if more - than one registered provider can handle the assembly, at runtime an - InvalidOperationException is thrown. - - The test harness making the request. - Assembly reflection object. - The unit test provider for the test assembly. Throws if - more than one can process the assembly. Returns null if there is - not a provider for the assembly. - - - - Returns the IAssembly provider for an assembly. - - Test harness object. - Assembly reflection object. - Returns null or an IAssembly instance. - - - - Gets the list of Unit Test providers. - - - - - A dictionary that can store just about any kind of object, keyed off any - object. As a Hashtable, it permits using keys of - - enums - - objects - - types - - This makes it ideal for use in decorating and adorning special types in - the system, such as log messages. - - A strongly-typed decorator key could come from an enum value, while a - prototype extension to the test system could simply use a string key for - organizing. - - In all instances, the resulting object needs to be cast appropriately. - - - - - Check if a decorator exists. - - The decorator key object. - - Returns a value indicating whether the decorator key exists. Even - if the key exists, the instance value for the key could be set to - null, yielding a null instance. - - - - - Check if a set of decorators exists. - - The set of decorator(s) of interest. - - Returns a value indicating whether the decorators of interest were - present. - - - - - Retrieves the decorator instance if it exists. If not, this method - returns null. - - The decorator key object. - - Returns the instance or null if it does not exist. No exceptions - are thrown in this method. - - - - - Helper functionality for dealing with embedded resources in an assembly. - - - - - Get a string containing the text of an embedded resource in an - assembly. - - - An instance whose assembly can be retrieved through reflection. - - - Complete embedded resource name. - - - A string containing the embedded resource's string contents. - - - - - A simple factory used for creating new log messages. - - - - - Create a new LogMessage instance. - - Returns a new LogMessage instance. - - - - Create a new LogMessage instance. - - The type of message to create. - Returns a new LogMessage instance. - - - - Gets or sets the default log message type used for the creation of - unspecific log message types. - - - - - Well-known keys that can be used to mark decorator instances in log - message objects. - - - - - Key for a decorator that is a simple Exception object. - - - - - Key for a decorator that is a simple Name string property. - - - - - An associated TestOutcome value. - - - - - The stage of a message or event. - - - - - The granularity of a message or event. - - - - - A number of possible test outcomes or results. For compatibility, this - information resembles that of the desktop test framework, although many - of the states may not apply or be valid for an in-browser test harness. - - - - - A test outcome of Error. - - - - - A test outcome of Failed. - - - - - A test outcome of Timeout. - - - - - A test outcome of Aborted. - - - - - A test outcome of Inconclusive. - - - - - A test outcome of a run that was aborted, but passed. - - - - - A test outcome of NotRunnable. - - - - - A test outcome of NotExecuted. - - - - - A test outcome of Disconnected. - - - - - A test outcome of Warning. - - - - - A test outcome of Passed. - - - - - A test outcome of Completed. - - - - - A test outcome of InProgress. - - - - - A test outcome of Pending. - - - - - The stage of a test scenario, case or system running. - - - - - In the process of starting. - - - - - Currently running. - - - - - Finishing up. - - - - - The test is canceling. - - - - - Provides a property that will attach and detach a known event handler - delegate when the bit is flipped. - - - - - The event to fire when attached. - - - - - Whether the event handler is attached as a global unhandled - exception handler. - - - - - Creates a new exception handler "manager" with the provided - EventHandler. - - The event handler to manage. - - - - Mark the Handled property in the event args as True to stop any - event bubbling. - - Event arguments. - - Value indicating whether the Exception should be marked as handled. - - - - - Return the Exception property from the EventArgs. - - Event arguments. - - Returns the Exception object that the event arguments stores. - - - This method is compatible with the full desktop framework as well as - Silverlight. - - - - - Internal event that is hooked up to the global exception handler. - - Source object of the event. - Event arguments. - - - - Called after a change to the attachment field value. - - - - - Attach the handler globally. - - - - - Detach the handler globally. - - - - - Gets or sets a value indicating whether the handler is currently - attached to the global exception handler. - - - - - A log message. - - - - - The default log message used during initialization. - - - - - Initializes a new log message of the default message type. - - - - - Initializes a new log message. - - The message type. - - - - Converts to string representation. - - A string version of the LogMessage. - - - - Check if a decorator is present on the LogMessage. - - The decorator of interest. - - Returns a value indicating whether the decorator is present in the - DecoratorDictionary. - - - - - Check if a set of decorators are present. - - The decorator(s) of interest. - - Returns a value indicating whether the decorator(s) of interest are - present. - - - - - Gets the set of decorator instances attached to the log message. - - - - - Gets or sets the type of message. - - - - - Gets or sets the log's message. - - - - - Gets or sets the decorator type for the message. - - - The type of decorator. Only one explicit Type is permitted, - although multiple types within the same type hierarchy are - legitimate. - - Returns the instance of the decorator, if any. - - - - The hierarchy of test execution represented in more generic terms, this - allows for more robust and useful actions by log providers. - - - - - Harness-level granularity. - - - - - Group of test-level granularity. - - - - - Test-level granularity. - - - - - Scenario-level granularity. - - - - - The most verbose log provider, this calls .ToString() on each and every - LogMessage that it processes. The output will appear in an attached - debugger's "Output" window. - - - - - Initializes a new instance of the DebugOutputProvider class. - - - - - Display a LogMessage in the debug output window. - - Message object. - - - - Gets or sets a value indicating whether any TestResult failures will - be reported, regardless of whether the TestResult type is being - monitored for debug output. - - - - - Gets or sets a value indicating whether all messages appear in the - debug output. - - - - - Set of defined types of log messages to allow for some level of - filtering and selective processing of log messages. - - - - - Pass, fail, etc. - - - - - Debug::WriteLine or tracing. - - - - - Non-fatal log message. - - - - - Fatal error message. - - - - - Information about a known defect. - - - - - General information similar to a Console::WriteLine. - - - - - Operating system setting or platform values. - - - - - New unit of test or test run note. - - - - - Related test systems or out-of-process communication information. - - - - - Event information marking the completion of a test run. - - - - - Creates a new TestHarnessCompletedEventArgs. - - The final test harness state. - - - - Gets the final test harness state. - - This contains the final pass versus fail result at a minimum. - Specific harnesses may extend the type to contain additional - information, logs, scenario counts, or anything else. - - - - - A type which handles preparing the underlying dispatcher or timer from - which the test work items execute. - - - - - Millisecond interval to use for the interval between DispatcherTimer - ticks. - - - - - Dispatcher timer. - - - - - Creates a new run method manager using the default value for the - timer's millisecond interval. - - - Conditional delegate which returns true as long as there is - additional work. - - - - - Sets up a new run method manager. - - - Conditional delegate which returns true as long as there is - additional work. - - Milliseconds between ticks, at a - minimum. - - - - Begin the execution process by hooking up the underlying - DispatcherTimer to call into the test framework regularly and - perform test work items. - - - - - Call into the underlying work item queue, if the method manager is - still set to run. - - Sending object. - Event arguments. - - - - Base class representing the overall state of a test run. - - - - - Increment the failures counter. - - - - - Increments the total scenarios counter. - - - - - Gets the count of failing scenarios. - - - - - Gets the total count of scenarios run. - - - - - Gets a value indicating whether the status recorded indicates a - failure. - - - - - A set of helper methods for interacting with methods and types that are - marked with attributes. - - - - - Retrieve all types in an assembly that are decorated with a specific - attribute. - - Assembly to search. - - Instance of the Type of attribute that marks interesting methods. - - - A collection of types from the assembly. An empty collection is - returned if no types were found matching the constraints. - - - - - Given a MethodInfo type, returns the attributes (if any) that are of - the decoratingAttribute parameter's type. - - MemberInfo instance. - Attribute of interest. - - A collection populated with the Attribute instances. - - - - - Given a MethodInfo type, returns the attributes (if any) that are of - the decoratingAttribute parameter's type. - - MemberInfo instance. - Attribute of interest. - A value indicating whether to look for - inheriting custom attributes. - - A collection populated with the Attribute instances. - - - - - Given a test method, returns the attributes (if any) that are of - the decoratingAttribute parameter's type. - - ITestMethod instance. - Attribute of interest. - Whether to inherit attributes. - - A collection populated with the Attribute instances. - - - - - Retrieve a list of Reflection.Assembly types from a set of - instances and/or types. - - Set of instances or types. - A set of Assembly instances from the instances or types. - - - - Returns a list of unique assemblies from a set of types. - - Set of types. - - A list of unique Assembly instances from the input types. - - - - - Given a list of attributes, retrieves a single Attribute instance. - Will throw an exception if multiple attributes exist on the method. - - List of attributes. - - The attribute instance, or null if it does not exist. - - - - - Given a method and a decorative attribute of interest, retrieves a - single Attribute instance. Will throw an exception if multiple - attributes exist on the method. - - MemberInfo instance. - - Attribute type of interest. - - - The attribute instance, or null if it does not exist. - - - - - Given a test method and a decorative attribute of interest, - retrieves a single Attribute instance. Will throw an exception if - multiple attributes exist on the method. - - ITestMethod instance. - - Attribute type of interest. - - - The attribute instance, or null if it does not exist. - - - - - Given a test method and a decorative attribute of interest, - retrieves a single Attribute instance. Will throw an exception if - multiple attributes exist on the method. - - ITestMethod instance. - - Attribute type of interest. - - A value indicating whether to look for custom - inherited attributes. - - The attribute instance, or null if it does not exist. - - - - - Returns a value indicating whether a method has the attribute. - - MemberInfo instance. - Attribute of interest. - - A value indicating whether the type has the decorating attribute or - not. - - - - - Returns a value indicating whether a method has the attribute. - - ITestMethod instance. - Attribute of interest. - - A value indicating whether the type has the decorating attribute or - not. - - - - - Return a collection of MethodInfo instances given a type to look - through and the attribute of interest. - - Type to look through for methods. - Attribute of interest. - - A collection of the method reflection objects, if any, with the - marked attribute present. - - - - - Retrieve a MethodInfo from a single decorated method inside a type, - if any. Throws an Exception if there are > 1 methods that are - decorated with the attribute. - - Type of interest. - Attribute of interest. - - MethodInfo reflection object. Null if none are found. - - - - - Exposes clipboard functionality within Silverlight 3 applications when a - Silverlight 4 runtime is in use. - - - - - An empty array of object type. - - - - - Backing field for set text. - - - - - Backing field for get text. - - - - - Backing field for the contains text method. - - - - - A value indicating whether the clipboard feature is present. This - assumes that all 3 methods are present, in their current form for a - more recent runtime. - - - - - Sets Unicode text data to store on the clipboard, for later access - with System.Windows.Clipboard.GetText(). - - A string that contains the Unicode text data to - store on the clipboard. - - - - Retrieves Unicode text data from the system clipboard, if Unicode - text data exists. - - If Unicode text data is present on the system clipboard, - returns a string that contains the Unicode text data. Otherwise, - returns an empty string. - - - - - Queries the clipboard for the presence of data in the Unicode text - format. - - True if the system clipboard contains Unicode text data; - otherwise, false. - - - - Prepares to use the System.Windows.Clipboard type and throws an - exception if the feature cannot be completely located. - - - - - Prepares the type and reflects for new Silverlight features. - - - - - Gets a value indicating whether the clipboard feature is available - and supported. - - - - - A framework element that permits a binding to be evaluated in a new data - context leaf node. - - The type of dynamic binding to return. - - - - Gets or sets the string value binding used by the control. - - - - - Identifies the Value dependency property. - - - - - Initializes a new instance of the BindingEvaluator class. - - - - - Initializes a new instance of the BindingEvaluator class, - setting the initial binding to the provided parameter. - - The initial string value binding. - - - - Clears the data context so that the control does not keep a - reference to the last-looked up item. - - - - - Updates the data context of the framework element and returns the - updated binding value. - - The object to use as the data context. - If set to true, this parameter will - clear the data context immediately after retrieving the value. - Returns the evaluated T value of the bound dependency - property. - - - - Updates the data context of the framework element and returns the - updated binding value. - - The object to use as the data context. - Returns the evaluated T value of the bound dependency - property. - - - - Gets or sets the data item string value. - - - - - Gets or sets the value binding. - - - - - Specifies values that control the behavior of a control positioned - inside another control. - - Stable - - - - Specifies that the control should be positioned on the left of the - control. - - - - - Specifies that the control should be positioned on top of the - control. - - - - - Specifies that the control should be positioned on the right of the - control. - - - - - Specifies that the control should be positioned at the bottom of - control. - - - - - The InteractionHelper provides controls with support for all of the - common interactions like mouse movement, mouse clicks, key presses, - etc., and also incorporates proper event semantics when the control is - disabled. - - - - - The threshold used to determine whether two clicks are temporally - local and considered a double click (or triple, quadruple, etc.). - 500 milliseconds is the default double click value on Windows. - This value would ideally be pulled form the system settings. - - - - - The threshold used to determine whether two clicks are spatially - local and considered a double click (or triple, quadruple, etc.) - in pixels squared. We use pixels squared so that we can compare to - the distance delta without taking a square root. - - - - - Reference used to call UpdateVisualState on the base class. - - - - - Initializes a new instance of the InteractionHelper class. - - Control receiving interaction. - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - UpdateVisualState works differently than the rest of the injected - functionality. Most of the other events are overridden by the - calling class which calls Allow, does what it wants, and then calls - Base. UpdateVisualState is the opposite because a number of the - methods in InteractionHelper need to trigger it in the calling - class. We do this using the IUpdateVisualState internal interface. - - - - - Update the visual state of the control. - - - A value indicating whether to automatically generate transitions to - the new state, or instantly transition to the new state. - - - - - Handle the control's Loaded event. - - The control. - Event arguments. - - - - Handle changes to the control's IsEnabled property. - - The control. - Event arguments. - - - - Handles changes to the control's IsReadOnly property. - - The value of the property. - - - - Update the visual state of the control when its template is changed. - - - - - Check if the control's GotFocus event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual GotFocus event handler. - - - - - Check if the control's LostFocus event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual LostFocus event handler. - - - - - Check if the control's MouseEnter event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseEnter event handler. - - - - - Check if the control's MouseLeave event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseLeave event handler. - - - - - Check if the control's MouseLeftButtonDown event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseLeftButtonDown event - handler. - - - - - Check if the control's MouseLeftButtonUp event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Base implementation of the virtual MouseLeftButtonUp event handler. - - - - - Check if the control's KeyDown event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Check if the control's KeyUp event should be handled. - - Event arguments. - - A value indicating whether the event should be handled. - - - - - Gets the control the InteractionHelper is targeting. - - - - - Gets a value indicating whether the control has focus. - - - - - Gets a value indicating whether the mouse is over the control. - - - - - Gets a value indicating whether the read-only property is set. - - - - - Gets a value indicating whether the mouse button is pressed down - over the control. - - - - - Gets or sets the last time the control was clicked. - - - The value is stored as Utc time because it is slightly more - performant than converting to local time. - - - - - Gets or sets the mouse position of the last click. - - The value is relative to the control. - - - - Gets the number of times the control was clicked. - - - - - The ItemContainerGenerator provides useful utilities for ItemsControls. - - Preview - - - - A Panel that is used as the ItemsHost of the ItemsControl. This - property will only be valid when the ItemsControl is live in the - tree and has generated containers for some of its items. - - - - - A ScrollViewer that is used to scroll the items in the ItemsHost. - - - - - Initializes a new instance of the ItemContainerGenerator. - - - The ItemsControl being tracked by the ItemContainerGenerator. - - - - - Apply a control template to the ItemsControl. - - - - - Prepares the specified container to display the specified item. - - - Container element used to display the specified item. - - - The ItemContainerStyle for the parent ItemsControl. - - - - - Update the style of any generated items when the ItemContainerStyle - has been changed. - - The ItemContainerStyle. - - Silverlight does not support setting a Style multiple times, so we - only attempt to set styles on elements whose style hasn't already - been set. - - - - - Scroll the desired element into the ScrollHost's viewport. - - Element to scroll into view. - - - - Gets or sets the ItemsControl being tracked by the - ItemContainerGenerator. - - - - - Gets a Panel that is used as the ItemsHost of the ItemsControl. - This property will only be valid when the ItemsControl is live in - the tree and has generated containers for some of its items. - - - - - Gets a ScrollViewer that is used to scroll the items in the - ItemsHost. - - - - - Numeric utility methods used by controls. These methods are similar in - scope to the WPF DoubleUtil class. - - - - - Check if a number is zero. - - The number to check. - True if the number is zero, false otherwise. - - - - Check if a number isn't really a number. - - The number to check. - - True if the number is not a number, false if it is a number. - - - - - Determine if one number is greater than another. - - First number. - Second number. - - True if the first number is greater than the second, false - otherwise. - - - - - Determine if one number is less than or close to another. - - First number. - Second number. - - True if the first number is less than or close to the second, false - otherwise. - - - - - Determine if two numbers are close in value. - - First number. - Second number. - - True if the first number is close in value to the second, false - otherwise. - - - - - NanUnion is a C++ style type union used for efficiently converting - a double into an unsigned long, whose bits can be easily - manipulated. - - - - - Floating point representation of the union. - - - - - Integer representation of the union. - - - - - Provides event data for various routed events that track property values - changing. Typically the events denote a cancellable action. - - - The type of the value for the dependency property that is changing. - - Preview - - - - Private member variable for Cancel property. - - - - - Initializes a new instance of the - - class. - - - The identifier - for the property that is changing. - - The previous value of the property. - - The new value of the property, assuming that the property change is - not cancelled. - - - True if the property change is cancellable by setting - - to true in event handling. false if the property change is not - cancellable. - - - - - Gets the - identifier for the property that is changing. - - - The identifier - for the property that is changing. - - - - - Gets a value that reports the previous value of the changing - property. - - - The previous value of the changing property. - - - - - Gets or sets a value that reports the new value of the changing - property, assuming that the property change is not cancelled. - - - The new value of the changing property. - - - - - Gets a value indicating whether the property change that originated - the RoutedPropertyChanging event is cancellable. - - - True if the property change is cancellable. false if the property - change is not cancellable. - - - - - Gets or sets a value indicating whether the property change that - originated the RoutedPropertyChanging event should be cancelled. - - - True to cancel the property change; this resets the property to - . - false to not cancel the property change; the value changes to - . - - - Attempted to cancel in an instance where - - is false. - - - - - Gets or sets a value indicating whether internal value coercion is - acting on the property change that originated the - RoutedPropertyChanging event. - - - True if coercion is active. false if coercion is not active. - - - This is a total hack to work around the class hierarchy for Value - coercion in NumericUpDown. - - - - - Represents methods that handle various routed events that track property - values changing. Typically the events denote a cancellable action. - - - The type of the value for the dependency property that is changing. - - - The object where the initiating property is changing. - - Event data for the event. - Preview - - - - The ScrollExtensions class provides utility methods for scrolling items - ScrollViewers. - - - - - The amount to scroll a ScrollViewer for a line change. - - - - - Scroll a ScrollViewer vertically by a given offset. - - The ScrollViewer. - The vertical offset to scroll. - - - - Scroll a ScrollViewer horizontally by a given offset. - - The ScrollViewer. - The horizontal offset to scroll. - - - - Scroll the ScrollViewer up by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer down by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer left by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer right by a line. - - The ScrollViewer. - - - - Scroll the ScrollViewer up by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer down by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer left by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer right by a page. - - The ScrollViewer. - - - - Scroll the ScrollViewer to the top. - - The ScrollViewer. - - - - Scroll the ScrollViewer to the bottom. - - The ScrollViewer. - - - - Get the top and bottom of an element with respect to its parent. - - The element to get the position of. - The parent of the element. - Vertical offset to the top of the element. - - Vertical offset to the bottom of the element. - - - - - Common TypeConverter functionality. - - - - - Returns a value indicating whether this converter can convert an - object of the given type to an instance of the expected type. - - Expected type of the converter. - - The type of the source that is being evaluated for conversion. - - - A value indicating whether the converter can convert the provided - type. - - - - - Attempts to convert a specified object to an instance of the - expected type. - - Expected type of the converter. - TypeConverter instance. - The object being converted. - - The instance of the expected type created from the converted object. - - - - - Determines whether conversion is possible to a specified type. - - Expected type of the converter. - - Identifies the data type to evaluate for conversion. - - - A value indicating whether conversion is possible. - - - - - Attempts to convert a specified object to an instance of the - desired type. - - TypeConverter instance. - The object being converted. - - The type to convert the value to. - - - The value of the conversion to the specified type. - - - - - Names and helpers for visual states in the controls. - - - - - Common state group. - - - - - Normal state of the Common state group. - - - - - Normal state of the Common state group. - - - - - MouseOver state of the Common state group. - - - - - Pressed state of the Common state group. - - - - - Disabled state of the Common state group. - - - - - Focus state group. - - - - - Unfocused state of the Focus state group. - - - - - Focused state of the Focus state group. - - - - - Selection state group. - - - - - Selected state of the Selection state group. - - - - - Unselected state of the Selection state group. - - - - - Selected inactive state of the Selection state group. - - - - - Expansion state group. - - - - - Expanded state of the Expansion state group. - - - - - Collapsed state of the Expansion state group. - - - - - Popup state group. - - - - - Opened state of the Popup state group. - - - - - Closed state of the Popup state group. - - - - - ValidationStates state group. - - - - - The valid state for the ValidationStates group. - - - - - Invalid, focused state for the ValidationStates group. - - - - - Invalid, unfocused state for the ValidationStates group. - - - - - ExpandDirection state group. - - - - - Down expand direction state of ExpandDirection state group. - - - - - Up expand direction state of ExpandDirection state group. - - - - - Left expand direction state of ExpandDirection state group. - - - - - Right expand direction state of ExpandDirection state group. - - - - - HasItems state group. - - - - - HasItems state of the HasItems state group. - - - - - NoItems state of the HasItems state group. - - - - - Increment state group. - - - - - State enabled for increment group. - - - - - State disabled for increment group. - - - - - Decrement state group. - - - - - State enabled for decrement group. - - - - - State disabled for decrement group. - - - - - InteractionMode state group. - - - - - Edit of the DisplayMode state group. - - - - - Display of the DisplayMode state group. - - - - - DisplayMode state group. - - - - - Edit of the DisplayMode state group. - - - - - Display of the DisplayMode state group. - - - - - Active state. - - - - - Inactive state. - - - - - Active state group. - - - - - Non-watermarked state. - - - - - Watermarked state. - - - - - Watermark state group. - - - - - Unfocused state for Calendar Buttons. - - - - - Focused state for Calendar Buttons. - - - - - CalendarButtons Focus state group. - - - - - Use VisualStateManager to change the visual state of the control. - - - Control whose visual state is being changed. - - - A value indicating whether to use transitions when updating the - visual state, or to snap directly to the new visual state. - - - Ordered list of state names and fallback states to transition into. - Only the first state to be found will be used. - - - - - Gets the implementation root of the Control. - - The DependencyObject. - - Implements Silverlight's corresponding internal property on Control. - - Returns the implementation root or null. - - - - This method tries to get the named VisualStateGroup for the - dependency object. The provided object's ImplementationRoot will be - looked up in this call. - - The dependency object. - The visual state group's name. - Returns null or the VisualStateGroup object. - - - - Represents a that supports - objects, - such as . - - Stable - - - - The DataTemplate to apply to the ItemTemplate property on a - generated HeaderedItemsControl (such as a MenuItem or a - TreeViewItem), to indicate how to display items from the next level - in the data hierarchy. - - - - - The Style to apply to the ItemContainerStyle property on a generated - HeaderedItemsControl (such as a MenuItem or a TreeViewItem), to - indicate how to style items from the next level in the data - hierarchy. - - - - - Initializes a new instance of the - class. - - - - - Gets or sets the collection that is used to generate content for the - next sublevel in the data hierarchy. - - - The collection that is used to generate content for the next - sublevel in the data hierarchy. The default value is null. - - - - - Gets a value indicating whether the ItemTemplate property was set on - the template. - - - - - Gets or sets the to - apply to the - - property on a generated - , such - as a , to - indicate how to display items from the next sublevel in the data - hierarchy. - - - The to apply to the - - property on a generated - , such - as a , to - indicate how to display items from the next sublevel in the data - hierarchy. - - - - - Gets a value indicating whether the ItemContainerStyle property was - set on the template. - - - - - Gets or sets the that is - applied to the item container for each child item. - - - The style that is applied to the item container for each child item. - - - - - Class to encapsulate drag behavior for a UIElement. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Create an instance of the DragValidator class. - - - UIElement that represents the source of the drag operation. - - - - - Handle the MouseMove event for the UIElement to update the drag - operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the MouseLeftButtonUp event for the UIElement to complete the - drag operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the MouseLeftButtonDown event for the UIElement to start a - drag operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Invoke the DragStartedEvent handlers. - - - - - Invoke the DragDeltaEvent handlers. - - Inherited code: Requires comment. - - - - Invoke the DragCompletedEvent handlers. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Occurs when a drag operation has started. - - - - - Occurs when a drag operation has completed. - - - - - Occurs when a drag operation has progressed. - - - - - Represents a control that redistributes space between the rows of - columns of a control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - Represents the control that redistributes space between columns or rows - of a Grid control. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Default increment parameter. - - - - - Default increment parameter. - - - - - Identifies the - - dependency property. - - - An identifier for the - - dependency property. - - - - - Identifies the - - dependency property. - - - An identifier for the - - dependency property. - - - - - Called when the IsEnabled property changes. - - Sender object. - Property changed args. - - - - Is Null until a resize operation is initiated with ShowsPreview == - True, then it persists for the life of the GridSplitter. - - - - - Is initialized in the constructor. - - - - - Inherited code: Requires comment. - - - - - Holds the state for whether the mouse is over the control or not. - - - - - Initializes a new instance of the - class. - - - - - Builds the visual tree for the - - control when a new template is applied. - - - - - Returns a - - for use by the Silverlight automation infrastructure. - - - A - - for the - object. - - - - - Method to change the visual state of the control. - - - - - Change to the correct visual state for the GridSplitter. - - - True to use transitions when updating the visual state, false to - snap directly to the new visual state. - - - - - Handle the drag completed event to commit or cancel the resize - operation in progress. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the drag delta event to update the UI for the resize - operation in progress. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the drag started event to start a resize operation if the - control is enabled. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Handle the key down event to allow keyboard resizing or canceling a - resize operation. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Initialize the resize data and move the splitter by the specified - amount. - - - Horizontal amount to move the splitter. - - - Vertical amount to move the splitter. - - Inherited code: Requires comment. - - - - Called by keyboard event handler to move the splitter if allowed. - - - Horizontal amount to move the splitter. - - - Vertical amount to move the splitter. - - Inherited code: Requires comment. - - - - Creates the preview layer and adds it to the parent grid. - - Grid to add the preview layer to. - - - - Add the preview layer to the Grid if it is not there already and - then show the preview control. - - - - - Remove the preview control from the preview layer if it exists. - - - - - Initialize the resizeData object to hold the information for the - resize operation in progress. - - - Whether or not the preview should be shown. - - - - - Move the splitter and resize the affected columns or rows. - - - Amount to resize horizontally. - - - Amount to resize vertically. - - - Only one of horizontalChange or verticalChange will be non-zero. - - - - - Determine which adjacent column or row definitions need to be - included in the resize operation and set up resizeData accordingly. - - True if it is a valid resize operation. - - - - Cancel the resize operation in progress. - - - - - Get the actual length of the given definition. - - - Row or column definition to get the actual length for. - - - Height of a row definition or width of a column definition. - - - - - Determine the max and min that the two definitions can be resized. - - Inherited code: Requires comment. - - - - Determine the resize behavior based on the given direction and - alignment. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Determine the resize direction based on the horizontal and vertical - alignments. - - Inherited code: Requires comment. - - - - Create a DefinitionAbstraction instance for the given row or column - index in the grid. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - Inherited code: Requires comment 2. - Inherited code: Requires comment 3. - - - - Set the lengths of the two definitions depending on the split - behavior. - - - Inherited code: Requires comment. - - - Inherited code: Requires comment 1. - - - - - Set the height/width of the given row/column. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - Determine if the given definition has its size set to the "*" value. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - - - - This code will run whenever the effective resize direction changes, - to update the template being used to display this control. - - - - - Exposes test hooks to unit tests with internal access. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets the resize data. This is null unless a resize - operation is in progress. - - - - - Gets or sets a value indicating whether the - displays a - preview. - - - True if a preview is displayed; otherwise, false. - - - - - Gets or sets the that is used - for previewing changes. - - - The style that is used to preview changes. - - - - - Gets a value indicating whether or not the control has keyboard - focus. - - - - - Gets a test hook for unit tests with internal access. - - - - - Pretends to be the base class for RowDefinition and ClassDefinition - types so that objects of either type can be treated as one. - - Mature - - - - Creates an instance of the DefinitionAbstraction class based on - the given row or column definition. - - - RowDefinition or ColumnDefinition instance. - - - - - Gets the stored definition cast as a row definition. - - Null if not a RowDefinition. - - - - Gets the stored definition cast as a column definition. - - Null if not a ColumnDefinition. - - - - Gets the MaxHeight/MaxWidth for the row/column. - - - - - Gets the MinHeight/MinWidth for the row/column. - - - - - Gets the Height/Width for the row/column. - - - - - A collection of helper methods for working with double data types. - - Mature - - - - Epsilon is the smallest value such that 1.0+epsilon != 1.0. It - can be used to determine the acceptable tolerance for rounding - errors. - - - Epsilon is normally 2.2204460492503131E-16, but Silverlight 2 - uses floats so the effective epsilon is really 1.192093E-07. - - - - - Inherited code: Requires comment. - - - - - Determine if the two doubles are effectively equal within - tolerances. - - Inherited code: Requires comment. - Inherited code: Requires comment 1. - Inherited code: Requires comment 2. - - - - Inherited code: Requires comment. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Type to hold the data for the resize operation in progress. - - Mature - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets a value indicating whether Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Expose test hooks for internal and private members of the - GridSplitter. - - - - - Reference to the outer 'parent' GridSplitter. - - - - - Initializes a new instance of the InternalTestHook class. - - The grid splitter to hook. - - - - Simulate the DragValidator's DragCompleted event. - - The sender. - Event arguments. - - - - Simulate the DragValidator's DragDelta event. - - The sender. - Event arguments. - - - - Simulate the DragValidator's DragStarted event. - - The sender. - Event arguments. - - - - Simulate using the keyboard to move the splitter. - - Horizontal change. - Vertical change. - - A value indicating whether the splitter was moved. - - - - - Gets the GridSplitter's GridResizeDirection. - - - - - Gets the GridSplitter's PreviewLayer. - - - - - Gets the GridSplitter's ResizeData. - - - - - Exposes types to - UI automation. - - Mature - - - - Initializes a new instance of the - - class. - - - The to - associate with the - . - - - - - Gets the control type for the element that is associated with the UI - Automation peer. - - The control type. - - - - Called by GetClassName that gets a human readable name that, in - addition to AutomationControlType, differentiates the control - represented by this AutomationPeer. - - The string that contains the name. - - - - Gets the control pattern for the - that is - associated with this - . - - - One of the enumeration values. - - - The object that implements the pattern interface, or null if the - specified pattern interface is not implemented by this peer. - - - - - Moves the control. - - - Absolute screen coordinates of the left side of the control. - - - Absolute screen coordinates of the top of the control. - - - - - Resizes the control. - - The new width of the window, in pixels. - - The new height of the window, in pixels. - - - - - Rotates the control. - - - The number of degrees to rotate the control. A positive number - rotates clockwise; a negative number rotates counterclockwise. - - - - - Gets a value indicating whether the control can be moved. - - - True if the element can be moved; otherwise, false. - - - - - Gets a value indicating whether the UI automation element can be - resized. - - - True if the element can be resized; otherwise, false. - - - - - Gets a value indicating whether the control can be rotated. - - - True if the element can be rotated; otherwise, false. - - - - - Represents the control that shows a preview of the GridSplitter's - redistribution of space between columns or rows of a Grid control. - - Mature - - - - Inherited code: Requires comment. - - - - - Inherited code: Requires comment. - - - - - Is Null until the PreviewControl is bound to a GridSplitter. - - - - - Tracks the bound GridSplitter's location for calculating the - PreviewControl's offset. - - - - - Instantiate the PreviewControl. - - - - - Called when template should be applied to the control. - - - - - Bind the the dimensions of the preview control to the associated - grid splitter. - - GridSplitter instance to target. - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets Inherited code: Requires comment. - - - - - Gets or sets the x-axis offset for the underlying render transform. - - - - - Gets or sets the y-axis offset for the underlying render transform. - - - - - Exposes types to UI - automation. - - Stable - - - - Initializes a new instance of the - - class. - - - The to associate - with the - . - - - - - Gets the control type for the - that is associated - with this - . - This method is called by - . - - - The - - enumeration value. - - - - - Gets the name of the - that is associated - with - . - This method is called by - . - - A string that contains TreeView. - - - - Gets a control pattern for the - that is associated - with this - . - - - One of the enumeration values that indicates the control pattern. - - - The object that implements the pattern interface, or null if the - specified pattern interface is not implemented by this peer. - - - - - Gets the collection of child elements of the - that is associated - with this - . - - The collection of child elements. - - - - Retrieves a UI automation provider for each child element that is - selected. - - An array of UI automation providers. - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets the TreeView that owns this TreeViewAutomationPeer. - - - - - Gets a value indicating whether the UI automation provider - allows more than one child element to be selected at the same time. - - - True if multiple selection is allowed; otherwise, false. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets a value indicating whether the UI automation provider - requires at least one child element to be selected. - - - True if selection is required; otherwise, false. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Exposes the items in - types to UI - automation. - - Stable - - - - Initializes a new instance of the - - class. - - - The instance - to associate with this - . - - - - - Gets the control type for the - that is - associated with this - . - This method is called by - . - - - The - - enumeration value. - - - - - Gets the name of the - that is - associated with this - . - This method is called by - . - - A string that contains TreeViewItem. - - - - Gets the control pattern for the - that is - associated with this - . - - - One of the enumeration values. - - - The object that implements the pattern interface, or null if the - specified pattern interface is not implemented by this peer. - - - - - Raise the IsSelected property changed event. - - - A value indicating whether the TreeViewItem is selected. - - - - - Raise an automation event when a TreeViewItem is expanded or - collapsed. - - - A value indicating whether the TreeViewItem was expanded. - - - A value indicating whether the TreeViewItem is expanded. - - - - - Displays all child nodes, controls, or content of the control. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Hides all nodes, controls, or content that are descendants of the - control. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Adds the current element to the collection of selected items. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Clears any selection and then selects the current element. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Removes the current element from the collection of selected items. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Scrolls the content area of a container object in order to display - the control within the visible region (viewport) of the container. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets the TreeViewItem that owns this TreeViewItemAutomationPeer. - - - - - Gets the state (expanded or collapsed) of the control. - - - The state (expanded or collapsed) of the control. - - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets a value indicating whether an item is selected. - - True if an item is selected; otherwise, false. - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - Gets the UI automation provider that implements - - and acts as the container for the calling object. - - The UI automation provider. - - This API supports the .NET Framework infrastructure and is not - intended to be used directly from your code. - - - - - A specialized data template selector. - - - - - Initializes a new instance of the DataTemplateSelector type. - - - - - Convert a value to a data template. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - No 2-way databinding support. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - Gets or sets the default data template. - - - - - Gets or sets the test method template. - - - - - Gets or sets the test class template. - - - - - A specialized bool inversion selector. - - - - - Initializes a new instance of the InvertValueConverter class. - - - - - Convert a value to its opposite. Defines that null value will also - return false. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - No 2-way databinding support. - - The value. - The target parameter. - ConverterParameter value. - The culture parameter. - Returns the object. - - - - A notification type for use in the Notifications ItemsControl. - - - - - Name of the template part. - - - - - Identifies the Title dependency property. - - - - - Identifies the CloseButtonVisibility dependency property. - - - - - Backing field for the close button. - - - - - Initializes a new instance of the Notification class. - - - - - Fires the Closed event. - - The event data. - - - - Overrides the on apply template method. - - - - - Connects to the Click event of the Close button. - - The source object. - The event arguments. - - - - Gets or sets the title of the notification. - - - - - Gets or sets the visibility of the close button. - - - - - Closed event that connects to the close button of the notification. - - - - - A class that contains notification information. - - - - - Initialize a new intance of the Notifications type. - - - - - Overrides the on apply template method. - - - - - Adds a notification object to the set of notifications. Connects the - close button handler to automatically remove the notification from - the visual tree. - - A notification instance. - - - - Handles the Closed event from the notification and removes the - child. - - The source object. - The event data. - - - - This class contains information about the test application and its - deployment settings. - - - - - Initializes a new instance of the class. - - - - - Handles the install state changed event. - - The source object. - The event arguments. - - - - Backing field for an installed property. - - - - - Gets a value indicating whether the test application is currently - installed out of browser. - - - - - Gets the text to show the user the state of the out of browser test - application. - - - - - Gets a value indicating whether out of browser is both supported and - not currently installed. - - - - - Gets a value indicating whether out of browser is supported by this - test application. - - - - - A simple implementation similar to XElement. - - - - - Backing field for child elements. - - - - - Backing field for attributes. - - - - - Backing field for the element name. - - - - - Backing field for optional XML namespace. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the element. - - The name of the element. - - - - Initializes a new instance of the element. - - The name of the element. - The XML namespace of the element. - - - - Initializes a new instance of the class using the reader as the - current root of the element. - - The XmlReader instance. - - - - Sets the value of a new child element. - - The element name. - The value of the new element. - - - - Sets the value of a new child element with an XML namespace value. - - The element name. - The value of the new element. - The XML namespace. - - - - Sets the value of an attribute. - - The attribute name. - The attribute value. - - - - Sets the value of the element. - - The new string value. - - - - Gets an attribute value. - - The attribute name. - Returns an instance of the attribute value. - - - - Adds a child element to the simple element instance. - - The child element instance. - - - - Returns descendants. - - The element name to look for. - Returns an enumeration of elements. - - - - Creates a new SimpleXElement. - - XML content. - Returns a new instance of the element and children. - - - - Parses the current level with the XmlReader instance. - - The reader instance. - A value indicating whether this is the first - parse. Actually this will always be true for now. - - - - Generates the string representation of the element and its tree. - - Returns the string representation of the element. - - - - Writes to the XML writer without document start and ends. - - The writer instance. - - - - Gets the element name. - - - - - Gets or sets the element text, if any. - - - - diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll deleted file mode 100644 index 3e06f9ad96..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb deleted file mode 100644 index 302f19be71..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml b/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml deleted file mode 100644 index 0b84c0ae7d..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/MicrosoftSilverlightTesting-05-2010-SL3/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.xml +++ /dev/null @@ -1,3429 +0,0 @@ - - - - Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight - - - - - UrlToTest specifies the url that should be requested to give context to the test. - - - - - An unused attribute. - - - - - - Gets the URL to test. - - - - - AspNetDevelopmentServer specifies the settings to be used for the - ASP.NET Development Server for the test. - - - - - Initializes the AspNetDevelopmentServerAttribute. - - The name. - The path to web app. - - - - Initializes the AspNetDevelopmentServerAttribute. - - The name. - The path to web app. - The web app root. - - - - Gets the name. - - - - - Gets the PathToWebApp. - - - - - Gets the web app root. - - - - - AspNetDevelopmentServerHost specifies the settings to be used when - ASP.NET Development Server is the host server for the test. - - - - - Initializes the AspNetDevelopmentServerHostAttribute. - - The path to the web app. - - - - Initializes the AspNetDevelopmentServerHostAttribute. - - The path to the web app. - The web app root. - - - - Gets the path to the web application. - - - - - Gets the WebAppRoot. - - - - - For ASP.NET sites that require basic authentication, specify the - user name and password using the Credential attribute. - WARNING: The password is stored in plain text in source code - and in the compiled assembly. Restrict access to the source code - and assembly to protect this sensitive information. - - - - - Specify the user name and password needed to access the web site under test. - - The user name. - - The password. WARNING: The password is stored in plain text in source code - and in the compiled assembly. Restrict access to the source code and assembly - to protect this sensitive information. - - - - - Specify the user name, password, and domain needed to access the web site under test. - - The user name. - - The password. WARNING: The password is stored in plain text in source code - and in the compiled assembly. Restrict access to the source code and assembly - to protect this sensitive information. - - The domain. - - - - Gets the user name. - - - - - Gets the password. - - - - - Gets the domain. - - - - - Base class for Framework Exceptions, provides localization trick so that messages are in HA locale. - - - - - Initializes a new UnitTestAssertException. - - - - - Initializes UnitTestAssertException. - - The message. - - - - Gets the Message string. - - - - - AssertFailedException class. Used to indicate failure for a test case - - - - - Initializes a new AssertFailedException. - - The message. - - - - AssertFailedException - - The message. - The inner exception. - - - - The AssertInconclusiveException class. - - - - - Initializes a new AssertInconclusiveException. - - The message. - - - - Initializes a new AssertInconclusiveException. - - The message. - The inner exception. - - - - Initializes a new AssertInconclusiveException. - - - - - InternalTestFailureException class. Used to indicate internal failure - for a test case. - - - - - Initializes a new InternalTestFailureException. - - The message. - - - - Initializes a new InternalTestFailureException. - - The message. - The inner exception. - - - - Initializes a new InternalTestFailureException. - - - - - A collection of helper classes to test various conditions within - unit tests. If the condition being tested is not met, an exception - is thrown. - - - - - - - - - - Tests whether the specified condition is true and throws an exception - if the condition is false. - - The condition the test expects to be true. - - Thrown if is false. - - - - - Tests whether the specified condition is true and throws an exception - if the condition is false. - - The condition the test expects to be true. - - The message to include in the exception when - is false. The message is shown in test results. - - - Thrown if is false. - - - - - Tests whether the specified condition is true and throws an exception - if the condition is false. - - The condition the test expects to be true. - - The message to include in the exception when - is false. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is false. - - - - - Tests whether the specified condition is false and throws an exception - if the condition is true. - - The condition the test expects to be false. - - Thrown if is true. - - - - - Tests whether the specified condition is false and throws an exception - if the condition is true. - - The condition the test expects to be false. - - The message to include in the exception when - is true. The message is shown in test results. - - - Thrown if is true. - - - - - Tests whether the specified condition is false and throws an exception - if the condition is true. - - The condition the test expects to be false. - - The message to include in the exception when - is true. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is true. - - - - - Tests whether the specified object is null and throws an exception - if it is not. - - The object the test expects to be null. - - Thrown if is not null. - - - - - Tests whether the specified object is null and throws an exception - if it is not. - - The object the test expects to be null. - - The message to include in the exception when - is not null. The message is shown in test results. - - - Thrown if is not null. - - - - - Tests whether the specified object is null and throws an exception - if it is not. - - The object the test expects to be null. - - The message to include in the exception when - is not null. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not null. - - - - - Tests whether the specified object is non-null and throws an exception - if it is null. - - The object the test expects not to be null. - - Thrown if is null. - - - - - Tests whether the specified object is non-null and throws an exception - if it is null. - - The object the test expects not to be null. - - The message to include in the exception when - is null. The message is shown in test results. - - - Thrown if is null. - - - - - Tests whether the specified object is non-null and throws an exception - if it is null. - - The object the test expects not to be null. - - The message to include in the exception when - is null. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is null. - - - - - Tests whether the specified objects both refer to the same object and - throws an exception if the two inputs do not refer to the same object. - - - The first object to compare. This is the value the test expects. - - - The second object to compare. This is the value produced by the code under test. - - - Thrown if does not refer to the same object - as . - - - - - Tests whether the specified objects both refer to the same object and - throws an exception if the two inputs do not refer to the same object. - - - The first object to compare. This is the value the test expects. - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not the same as . The message is shown - in test results. - - - Thrown if does not refer to the same object - as . - - - - - Tests whether the specified objects both refer to the same object and - throws an exception if the two inputs do not refer to the same object. - - - The first object to compare. This is the value the test expects. - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not the same as . The message is shown - in test results. - - - An array of parameters to use when formatting . - - - Thrown if does not refer to the same object - as . - - - - - Tests whether the specified objects refer to different objects and - throws an exception if the two inputs refer to the same object. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the value produced by the code under test. - - - Thrown if refers to the same object - as . - - - - - Tests whether the specified objects refer to different objects and - throws an exception if the two inputs refer to the same object. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is the same as . The message is shown in - test results. - - - Thrown if refers to the same object - as . - - - - - Tests whether the specified objects refer to different objects and - throws an exception if the two inputs refer to the same object. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is the same as . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if refers to the same object - as . - - - - - Tests whether the specified values are equal and throws an exception - if the two values are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the tests expects. - - - The second value to compare. This is the value produced by the code under test. - - - Thrown if is not equal to - . - - - - - Tests whether the specified values are equal and throws an exception - if the two values are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the tests expects. - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified values are equal and throws an exception - if the two values are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the tests expects. - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified values are unequal and throws an exception - if the two values are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the test expects not - to match . - - - The second value to compare. This is the value produced by the code under test. - - - Thrown if is equal to . - - - - - Tests whether the specified values are unequal and throws an exception - if the two values are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the test expects not - to match . - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified values are unequal and throws an exception - if the two values are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - The type of values to compare. - - The first value to compare. This is the value the test expects not - to match . - - - The second value to compare. This is the value produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified objects are equal and throws an exception - if the two objects are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the object the tests expects. - - - The second object to compare. This is the object produced by the code under test. - - - Thrown if is not equal to - . - - - - - Tests whether the specified objects are equal and throws an exception - if the two objects are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the object the tests expects. - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified objects are equal and throws an exception - if the two objects are not equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the object the tests expects. - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified objects are unequal and throws an exception - if the two objects are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the object produced by the code under test. - - - Thrown if is equal to . - - - - - Tests whether the specified objects are unequal and throws an exception - if the two objects are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified objects are unequal and throws an exception - if the two objects are equal. Different numeric types are treated - as unequal even if the logical values are equal. 42L is not equal to 42. - - - The first object to compare. This is the value the test expects not - to match . - - - The second object to compare. This is the object produced by the code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified floats are equal and throws an exception - if they are not equal. - - - The first float to compare. This is the float the tests expects. - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - Thrown if is not equal to - . - - - - - Tests whether the specified floats are equal and throws an exception - if they are not equal. - - - The first float to compare. This is the float the tests expects. - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified floats are equal and throws an exception - if they are not equal. - - - The first float to compare. This is the float the tests expects. - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified floats are unequal and throws an exception - if they are equal. - - - The first float to compare. This is the float the test expects not to - match . - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - Thrown if is equal to . - - - - - Tests whether the specified floats are unequal and throws an exception - if they are equal. - - - The first float to compare. This is the float the test expects not to - match . - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - Thrown if is equal to . - - - - - Tests whether the specified floats are unequal and throws an exception - if they are equal. - - - The first float to compare. This is the float the test expects not to - match . - - - The second float to compare. This is the float produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified doubles are equal and throws an exception - if they are not equal. - - - The first double to compare. This is the double the tests expects. - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - Thrown if is not equal to - . - - - - - Tests whether the specified doubles are equal and throws an exception - if they are not equal. - - - The first double to compare. This is the double the tests expects. - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified doubles are equal and throws an exception - if they are not equal. - - - The first double to compare. This is the double the tests expects. - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by more than . - - - The message to include in the exception when - is different than by more than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified doubles are unequal and throws an exception - if they are equal. - - - The first double to compare. This is the double the test expects not to - match . - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - Thrown if is equal to . - - - - - Tests whether the specified doubles are unequal and throws an exception - if they are equal. - - - The first double to compare. This is the double the test expects not to - match . - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - Thrown if is equal to . - - - - - Tests whether the specified doubles are unequal and throws an exception - if they are equal. - - - The first double to compare. This is the double the test expects not to - match . - - - The second double to compare. This is the double produced by the code under test. - - - The required accuracy. An exception will be thrown only if - is different than - by at most . - - - The message to include in the exception when - is equal to or different by less than - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are equal and throws an exception - if they are not equal. - - - The first string to compare. This is the string the tests expects. - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. The invariant culture is used for the comparison. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified strings are unequal and throws an exception - if they are equal. - - - The first string to compare. This is the string the test expects not to - match . - - - The second string to compare. This is the string produced by the code under test. - - - A Boolean indicating a case-sensitive or insensitive comparison. (true - indicates a case-insensitive comparison.) - - - A CultureInfo object that supplies culture-specific comparison information. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified object is an instance of the expected - type and throws an exception if the expected type is not in the - inheritance hierarchy of the object. - - - The object the test expects to be of the specified type. - - - The expected type of . - - - Thrown if is null or - is not in the inheritance hierarchy - of . - - - - - Tests whether the specified object is an instance of the expected - type and throws an exception if the expected type is not in the - inheritance hierarchy of the object. - - - The object the test expects to be of the specified type. - - - The expected type of . - - - The message to include in the exception when - is not an instance of . The message is - shown in test results. - - - Thrown if is null or - is not in the inheritance hierarchy - of . - - - - - Tests whether the specified object is an instance of the expected - type and throws an exception if the expected type is not in the - inheritance hierarchy of the object. - - - The object the test expects to be of the specified type. - - - The expected type of . - - - The message to include in the exception when - is not an instance of . The message is - shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if is null or - is not in the inheritance hierarchy - of . - - - - - Tests whether the specified object is not an instance of the wrong - type and throws an exception if the specified type is in the - inheritance hierarchy of the object. - - - The object the test expects not to be of the specified type. - - - The type that should not be. - - - Thrown if is not null and - is in the inheritance hierarchy - of . - - - - - Tests whether the specified object is not an instance of the wrong - type and throws an exception if the specified type is in the - inheritance hierarchy of the object. - - - The object the test expects not to be of the specified type. - - - The type that should not be. - - - The message to include in the exception when - is an instance of . The message is shown - in test results. - - - Thrown if is not null and - is in the inheritance hierarchy - of . - - - - - Tests whether the specified object is not an instance of the wrong - type and throws an exception if the specified type is in the - inheritance hierarchy of the object. - - - The object the test expects not to be of the specified type. - - - The type that should not be. - - - The message to include in the exception when - is an instance of . The message is shown - in test results. - - - An array of parameters to use when formatting . - - - Thrown if is not null and - is in the inheritance hierarchy - of . - - - - - Throws an AssertFailedException. - - - Always thrown. - - - - - Throws an AssertFailedException. - - - The message to include in the exception. The message is shown in - test results. - - - Always thrown. - - - - - Throws an AssertFailedException. - - - The message to include in the exception. The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Always thrown. - - - - - Throws an AssertInconclusiveException. - - - Always thrown. - - - - - Throws an AssertInconclusiveException. - - - The message to include in the exception. The message is shown in - test results. - - - Always thrown. - - - - - Throws an AssertInconclusiveException. - - - The message to include in the exception. The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Always thrown. - - - - - Helper function that creates and throws an AssertionFailedException. - - name of the assertion throwing an exception. - message describing conditions for assertion failure. - The parameters. - - - - Checks the parameter for valid conditions - - The parameter. - The assertion name. - The parameter name. - The message. - The parameters. - - - - Safely converts an object to a string, handling null values and null characters. - Null values are converted to "(null)". Null characters are converted to "\\0". - - The object to convert to a string. - The converted string. - - - - Replaces null characters ('\0') with "\\0". - - The string to search. - The converted string with null characters replaced by "\\0". - - - - An exception from reflection will always be a TargetInvocationException - however - the goal of Private Accessors is to be seamless to the original code. - The only problem with throwing the inner exception is that the stack trace will - be overwritten. From here we register the stack trace of the inner exception - and then throw it. The Unit Test Adapter will then later rebuild the stack - from the cached shadow information plus the remaining stack from this throw. - - - - - - A collection of helper classes to test various conditions associated - with collections within unit tests. If the condition being tested is not - met, an exception is thrown. - - - - - Tests whether the specified collection contains the specified element - and throws an exception if the element is not in the collection. - - - The collection in which to search for the element. - - - The element that is expected to be in the collection. - - - Thrown if is not found in - . - - - - - Tests whether the specified collection contains the specified element - and throws an exception if the element is not in the collection. - - - The collection in which to search for the element. - - - The element that is expected to be in the collection. - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - Thrown if is not found in - . - - - - - Tests whether the specified collection contains the specified element - and throws an exception if the element is not in the collection. - - - The collection in which to search for the element. - - - The element that is expected to be in the collection. - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not found in - . - - - - - Tests whether the specified collection does not contain the specified - element and throws an exception if the element is in the collection. - - - The collection in which to search for the element. - - - The element that is expected not to be in the collection. - - - Thrown if is found in - . - - - - - Tests whether the specified collection does not contain the specified - element and throws an exception if the element is in the collection. - - - The collection in which to search for the element. - - - The element that is expected not to be in the collection. - - - The message to include in the exception when - is in . The message is shown in test - results. - - - Thrown if is found in - . - - - - - Tests whether the specified collection does not contain the specified - element and throws an exception if the element is in the collection. - - - The collection in which to search for the element. - - - The element that is expected not to be in the collection. - - - The message to include in the exception when - is in . The message is shown in test - results. - - - An array of parameters to use when formatting . - - - Thrown if is found in - . - - - - - Tests whether all items in the specified collection are non-null and throws - an exception if any element is null. - - - The collection in which to search for null elements. - - - Thrown if a null element is found in . - - - - - Tests whether all items in the specified collection are non-null and throws - an exception if any element is null. - - - The collection in which to search for null elements. - - - The message to include in the exception when - contains a null element. The message is shown in test results. - - - Thrown if a null element is found in . - - - - - Tests whether all items in the specified collection are non-null and throws - an exception if any element is null. - - - The collection in which to search for null elements. - - - The message to include in the exception when - contains a null element. The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if a null element is found in . - - - - - Tests whether all items in the specified collection are unique or not and - throws if any two elements in the collection are equal. - - - The collection in which to search for duplicate elements. - - - Thrown if a two or more equal elements are found in - . - - - - - Tests whether all items in the specified collection are unique or not and - throws if any two elements in the collection are equal. - - - The collection in which to search for duplicate elements. - - - The message to include in the exception when - contains at least one duplicate element. The message is shown in - test results. - - - Thrown if a two or more equal elements are found in - . - - - - - Tests whether all items in the specified collection are unique or not and - throws if any two elements in the collection are equal. - - - The collection in which to search for duplicate elements. - - - The message to include in the exception when - contains at least one duplicate element. The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if a two or more equal elements are found in - . - - - - - Tests whether one collection is a subset of another collection and - throws an exception if any element in the subset is not also in the - superset. - - - The collection expected to be a subset of . - - - The collection expected to be a superset of - - - Thrown if an element in is not found in - . - - - - - Tests whether one collection is a subset of another collection and - throws an exception if any element in the subset is not also in the - superset. - - - The collection expected to be a subset of . - - - The collection expected to be a superset of - - - The message to include in the exception when an element in - is not found in . - The message is shown in test results. - - - Thrown if an element in is not found in - . - - - - - Tests whether one collection is a subset of another collection and - throws an exception if any element in the subset is not also in the - superset. - - - The collection expected to be a subset of . - - - The collection expected to be a superset of - - - The message to include in the exception when an element in - is not found in . - The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if an element in is not found in - . - - - - - Tests whether one collection is not a subset of another collection and - throws an exception if all elements in the subset are also in the - superset. - - - The collection expected not to be a subset of . - - - The collection expected not to be a superset of - - - Thrown if every element in is also found in - . - - - - - Tests whether one collection is not a subset of another collection and - throws an exception if all elements in the subset are also in the - superset. - - - The collection expected not to be a subset of . - - - The collection expected not to be a superset of - - - The message to include in the exception when every element in - is also found in . - The message is shown in test results. - - - Thrown if every element in is also found in - . - - - - - Tests whether one collection is not a subset of another collection and - throws an exception if all elements in the subset are also in the - superset. - - - The collection expected not to be a subset of . - - - The collection expected not to be a superset of - - - The message to include in the exception when every element in - is also found in . - The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if every element in is also found in - . - - - - - Tests whether two collections contain the same elements and throws an - exception if either collection contains an element not in the other - collection. - - - The first collection to compare. This contains the elements the test - expects. - - - The second collection to compare. This is the collection produced by - the code under test. - - - Thrown if an element was found in one of the collections but not - the other. - - - - - Tests whether two collections contain the same elements and throws an - exception if either collection contains an element not in the other - collection. - - - The first collection to compare. This contains the elements the test - expects. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when an element was found - in one of the collections but not the other. The message is shown - in test results. - - - Thrown if an element was found in one of the collections but not - the other. - - - - - Tests whether two collections contain the same elements and throws an - exception if either collection contains an element not in the other - collection. - - - The first collection to compare. This contains the elements the test - expects. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when an element was found - in one of the collections but not the other. The message is shown - in test results. - - - An array of parameters to use when formatting . - - - Thrown if an element was found in one of the collections but not - the other. - - - - - Tests whether two collections contain the different elements and throws an - exception if the two collections contain identical elements without regard - to order. - - - The first collection to compare. This contains the elements the test - expects to be different than the actual collection. - - - The second collection to compare. This is the collection produced by - the code under test. - - - Thrown if the two collections contained the same elements, including - the same number of duplicate occurrences of each element. - - - - - Tests whether two collections contain the different elements and throws an - exception if the two collections contain identical elements without regard - to order. - - - The first collection to compare. This contains the elements the test - expects to be different than the actual collection. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when - contains the same elements as . The message - is shown in test results. - - - Thrown if the two collections contained the same elements, including - the same number of duplicate occurrences of each element. - - - - - Tests whether two collections contain the different elements and throws an - exception if the two collections contain identical elements without regard - to order. - - - The first collection to compare. This contains the elements the test - expects to be different than the actual collection. - - - The second collection to compare. This is the collection produced by - the code under test. - - - The message to include in the exception when - contains the same elements as . The message - is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if the two collections contained the same elements, including - the same number of duplicate occurrences of each element. - - - - - Tests whether all elements in the specified collection are instances - of the expected type and throws an exception if the expected type is - not in the inheritance hierarchy of one or more of the elements. - - - The collection containing elements the test expects to be of the - specified type. - - - The expected type of each element of . - - - Thrown if an element in is null or - is not in the inheritance hierarchy - of an element in . - - - - - Tests whether all elements in the specified collection are instances - of the expected type and throws an exception if the expected type is - not in the inheritance hierarchy of one or more of the elements. - - - The collection containing elements the test expects to be of the - specified type. - - - The expected type of each element of . - - - The message to include in the exception when an element in - is not an instance of - . The message is shown in test results. - - - Thrown if an element in is null or - is not in the inheritance hierarchy - of an element in . - - - - - Tests whether all elements in the specified collection are instances - of the expected type and throws an exception if the expected type is - not in the inheritance hierarchy of one or more of the elements. - - - The collection containing elements the test expects to be of the - specified type. - - - The expected type of each element of . - - - The message to include in the exception when an element in - is not an instance of - . The message is shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if an element in is null or - is not in the inheritance hierarchy - of an element in . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are equal and throws an exception - if the two collections are not equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects. - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is not equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not equal to - . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - Thrown if is equal to . - - - - - Tests whether the specified collections are unequal and throws an exception - if the two collections are equal. Equality is defined as having the same - elements in the same order and quantity. Different references to the same - value are considered equal. - - - The first collection to compare. This is the collection the tests expects - not to match . - - - The second collection to compare. This is the collection produced by the - code under test. - - - The compare implementation to use when comparing elements of the collection. - - - The message to include in the exception when - is equal to . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is equal to . - - - - - Constructs a dictionary containing the number of occurrences of each - element in the specified collection. - - - The collection to process. - - - The number of null elements in the collection. - - - A dictionary containing the number of occurrences of each element - in the specified collection. - - - - - Determines whether the first collection is a subset of the second - collection. If either set contains duplicate elements, the number - of occurrences of the element in the subset must be less than or - equal to the number of occurrences in the superset. - - - The collection the test expects to be contained in . - - - The collection the test expects to contain . - - - True if is a subset of - , false otherwise. - - - - - Finds a mismatched element between the two collections. A mismatched - element is one that appears a different number of times in the - expected collection than it does in the actual collection. The - collections are assumed to be different non-null references with the - same number of elements. The caller is responsible for this level of - verification. If there is no mismatched element, the function returns - false and the out parameters should not be used. - - The first collection to compare. - The second collection to compare. - - The expected number of occurrences of - or 0 if there is no mismatched - element. - - - The actual number of occurrences of - or 0 if there is no mismatched - element. - - - The mismatched element (may be null) or null if there is no - mismatched element. - - - true if a mismatched element was found; false otherwise. - - - - - compares the objects using object.Equals - - - - - This class is designed to help user doing unit testing. - GenericParameterHelper satisfies some comment generic type constraints - such as: - 1. public default constructor - 2. implements common interface: IComparable, IEnumerable, ICloneable - - - - - - public default constructor, satisfies the constraint in C# generics. - This constructor initializes the Data property to a random value. - - - - - This constructor initializes the Data property to a user-supplied value - - - - - - Do the value comparison for two GenericParameterHelper object - - object to do comparison with - true if obj has the same value as 'this' GenericParameterHelper object. - false otherwise. - - - - Returns a hash code for this object. - - - - - - Compares to the object. - - - - - - - Returns an IEnumerator object whose length is derived from - the Data property. - - - - - - Returns a GenericParameterHelper object that is equal to - 'this' one. - - - - - - Gets or sets the Data property. - - - - - Provides method signature discovery for generic methods. - - - - - Given a set of methods that match the base criteria, select a method based - upon an array of types. This method should return null if no method matches - the criteria. - - - - - Set of string assertions. - - - - - Tests whether the specified string contains the specified substring - and throws an exception if the substring does not occur within the - test string. - - - The string that is expected to contain . - - - The string expected to occur within . - - - Thrown if is not found in - . - - - - - Tests whether the specified string contains the specified substring - and throws an exception if the substring does not occur within the - test string. - - - The string that is expected to contain . - - - The string expected to occur within . - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - Thrown if is not found in - . - - - - - Tests whether the specified string contains the specified substring - and throws an exception if the substring does not occur within the - test string. - - - The string that is expected to contain . - - - The string expected to occur within . - - - The message to include in the exception when - is not in . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if is not found in - . - - - - - Tests whether the specified string begins with the specified substring - and throws an exception if the test string does not start with the - substring. - - - The string that is expected to begin with . - - - The string expected to be a prefix of . - - - Thrown if does not begin with - . - - - - - Tests whether the specified string begins with the specified substring - and throws an exception if the test string does not start with the - substring. - - - The string that is expected to begin with . - - - The string expected to be a prefix of . - - - The message to include in the exception when - does not begin with . The message is - shown in test results. - - - Thrown if does not begin with - . - - - - - Tests whether the specified string begins with the specified substring - and throws an exception if the test string does not start with the - substring. - - - The string that is expected to begin with . - - - The string expected to be a prefix of . - - - The message to include in the exception when - does not begin with . The message is - shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if does not begin with - . - - - - - Tests whether the specified string ends with the specified substring - and throws an exception if the test string does not end with the - substring. - - - The string that is expected to end with . - - - The string expected to be a suffix of . - - - Thrown if does not end with - . - - - - - Tests whether the specified string ends with the specified substring - and throws an exception if the test string does not end with the - substring. - - - The string that is expected to end with . - - - The string expected to be a suffix of . - - - The message to include in the exception when - does not end with . The message is - shown in test results. - - - Thrown if does not end with - . - - - - - Tests whether the specified string ends with the specified substring - and throws an exception if the test string does not end with the - substring. - - - The string that is expected to end with . - - - The string expected to be a suffix of . - - - The message to include in the exception when - does not end with . The message is - shown in test results. - - - An array of parameters to use when formatting . - - - Thrown if does not end with - . - - - - - Tests whether the specified string matches a regular expression and - throws an exception if the string does not match the expression. - - - The string that is expected to match . - - - The regular expression that is - expected to match. - - - Thrown if does not match - . - - - - - Tests whether the specified string matches a regular expression and - throws an exception if the string does not match the expression. - - - The string that is expected to match . - - - The regular expression that is - expected to match. - - - The message to include in the exception when - does not match . The message is shown in - test results. - - - Thrown if does not match - . - - - - - Tests whether the specified string matches a regular expression and - throws an exception if the string does not match the expression. - - - The string that is expected to match . - - - The regular expression that is - expected to match. - - - The message to include in the exception when - does not match . The message is shown in - test results. - - - An array of parameters to use when formatting . - - - Thrown if does not match - . - - - - - Tests whether the specified string does not match a regular expression - and throws an exception if the string matches the expression. - - - The string that is expected not to match . - - - The regular expression that is - expected to not match. - - - Thrown if matches . - - - - - Tests whether the specified string does not match a regular expression - and throws an exception if the string matches the expression. - - - The string that is expected not to match . - - - The regular expression that is - expected to not match. - - - The message to include in the exception when - matches . The message is shown in test - results. - - - Thrown if matches . - - - - - Tests whether the specified string does not match a regular expression - and throws an exception if the string matches the expression. - - - The string that is expected not to match . - - - The regular expression that is - expected to not match. - - - The message to include in the exception when - matches . The message is shown in test - results. - - - An array of parameters to use when formatting . - - - Thrown if matches . - - - - - TestContext class. This class should be fully abstract and not contain any - members. The adapter will implement the members. Users in the framework should - only access this via a well-defined interface. - - - - - Used to write trace messages while the test is running - - format string - the arguments - - - - Adds a file name to the list in TestResult.ResultFileNames - - - - - Begins a timer with the specified name - - - - - Ends a timer with the specified name - - - - - Per test properties - - - - - - Current data row when test is used for data driven testing. - - - - - Current data connection row when test is used for data driven testing. - - - - - Gets the test logs directory. - - - - - Gets the test directory. - - - - - Gets the test deployment directory. - - - - - Gets the test name. - - - - - Gets the CurrentTestOutcome. - - - - - Outcome of a test or a run. - If a new successful state needs to be added you will need to modify - RunResultAndStatistics in TestRun and TestOutcomeHelper below. - - NOTE: the order is important and is used for computing outcome for aggregations. - More important outcomes come first. See TestOutcomeHelper.GetAggregationOutcome. - - - - - Test was executed, but there were issues. - Issues may involve exceptions or failed assertions. - - - - - Test has completed, but we can't say if it passed or failed. - May be used for aborted tests... - - - - - Test was executed w/o any issues. - - - - - Test is currently executing. - - - - - There was a system error while we were trying to execute a test. - - - - - The test timed out. - - - - - Test was aborted by the user. - - - - - Test is in an unknown state - - - - - The data row. - - - - - The database connection. - - - - - Marks a test class. - - - - - Initializes a new test class attribute. - - - - - Marks a test method. - - - - - Initializes a new TestMethodAttribute. - - - - - A method marker called before a test method runs. - - - - - Initializes a new TestInitializeAttribute. - - - - - A method marker called after a test method runs. - - - - - Initializes a new TestCleanupAttribute. - - - - - Ignores a unit test. - - - - - Initializes a new IgnoreAttribute. - - - - - The ExpectedExceptionAttribute. - - - - - Initializes the ExpectedExceptionAttribute. - - The exception type. - - - - Initializes the ExpectedExceptionAttribute. - - The exception type. - The message. - - - - Gets the exception type. - - - - - Gets the message. - - - - - The test property attribute. - - - - - Initializes the TestPropertyAttribute. - - - - - - - Gets the name. - - - - - Gets the value. - - - - - The ClassInitializeAttribute. - - - - - Initializes the ClassInitializeAttribute. - - - - - The ClassCleanupAttribute. - - - - - Initializes the ClassCleanupAttribute. - - - - - The AssemblyInitializeAttribute. - - - - - Initializes the AssemblyInitializeAttribute. - - - - - The AssemblyCleanupAttribute. - - - - - Initializes the AssemblyCleanupAttribute. - - - - - Description of the test. - - - - - Initializes the DescriptionAttribute. - - The description. - - - - Gets the description. - - - - - The OwnerAttribute. - - - - - Initializes the OwnerAttribute. - - The owner. - - - - Gets the owner. - - - - - CSS Project Structure URI. - - - - - Initializes the CSS Project Structure URI. - - The structure. - - - - Gets the property structure. - - - - - CSS Iteration URI - - - - - Initializes the CssIterationAttribute. - - The parameter. - - - - Gets the CssIteration. - - - - - Priority attribute; used to specify the priority of a unit test. - - - - - Initializes the PriorityAttribute. - - The priority. - - - - Gets the Priority. - - - - - Timeout attribute; used to specify the timeout of a unit test. - - - - - Initializes the TimeoutAttribute. - - - - - - Gets the Timeout. - - - - - WorkItem attribute; used to specify a work item associated with this test. - - - - - Initializes the WorkItemAttribute. - - - - - - Gets the ID. - - - - - HostType specifies the type of host that this unit test will - run in. - - - - - Initializes the host type attribute. - - - - - - Constructor of HostTypeAttribute. - - The type of the host. - Custom data for the host adapter. - - - The reason this is string (and not object) is that currently CMI cannot parse arbitrary instances of object and we deprioritized changing CMI. - - - - Gets the host type. - - - - - Gets the host data. - - - - - Used to specify deployment item (file or directory) for per-test deployment. - Can be specified on test class or test method. - Can have multiple instances of the attribute to specify more than one item. - The item path can be absolute or relative, if relative, it is relative to RunConfig.RelativePathRoot. - - - [DeploymentItem("file1.xml")] - [DeploymentItem("file2.xml", "DataFiles")] - [DeploymentItem("bin\Debug")] - - - - - Initializes DeploymentItemAttribute. - - The path. - - - - Initializes DeploymentItemAttribute. - - The path. - The output directory. - - - - Verifiable interface. - - - - - The IsValid method. - - Returns a value. - - - diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.dll b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.dll deleted file mode 100644 index 7ce5b1a25b..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.pdb b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.pdb deleted file mode 100644 index 3b9267a83d..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.xml b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.xml deleted file mode 100644 index cd168af892..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit-silverlight3.xml +++ /dev/null @@ -1,2383 +0,0 @@ - - - - xunit-silverlight3 - - - - - Contains various static methods that are used to verify that conditions are met during the - process of running tests. - - - - - Initializes a new instance of the class. - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given string, using a string comparer. - - The type of the object to be verified - The string expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected string - Thrown when the string is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given string, using a string comparer. - - The type of the string to be compared - The string that is expected not to be in the collection - The collection to be inspected - The comparer used to equate strings in the collection with the expected string - Thrown when the string is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that two strings are not equal, using the given string comparer. - - The type of the strings to be compared - The expected string - The actual string - The comparer used to examine the strings - Thrown when the strings are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type which matches the given predicate. - - The collection type. - The collection. - The item matching predicate. - The single item in the filtered collection. - Thrown when the filtered collection does - not contain exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Used by the Throws and DoesNotThrow methods. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - Exception to be thrown from when the number of - parameter values does not the test method signature. - - - - - - - - Command that automatically creates the instance of the test class - and disposes it (if it implements ). - - - - - Base class used by commands which delegate to inner commands. - - - - - Interface which represents the ability to invoke of a test method. - - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Creates the start XML to be sent to the callback when the test is about to start - running. - - Return the of the start node, or null if the test - is known that it will not be running. - - - - Gets the display name of the test method. - - - - - Determines if the test runner infrastructure should create a new instance of the - test class before running the test. - - - - - Determines if the test should be limited to running a specific amount of time - before automatically failing. - - The timeout value, in milliseconds; if zero, the test will not have - a timeout. - - - - Creates a new instance of the class. - - The inner command to delegate to. - - - - - - - - - - - - - - - - - - - - - - Creates a new instance of the object. - - The command that is bring wrapped - The method under test - - - - Executes the test method. Creates a new instance of the class - under tests and passes it to the inner command. Also catches - any exceptions and converts them into s. - - The instance of the test class - Returns information about the test run - - - - Command used to wrap a which has associated - fixture data. - - - - - Creates a new instance of the class. - - The inner command - The fixtures to be set on the test class - - - - Sets the fixtures on the test class by calling SetFixture, then - calls the inner command. - - The instance of the test class - Returns information about the test run - - - - Implementation of which executes the - instances attached to a test method. - - - - - Initializes a new instance of the class. - - The inner command. - The method. - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Utility methods for dealing with exceptions. - - - - - Gets the message for the exception, including any inner exception messages. - - The exception - The formatted message - - - - Gets the stack trace for the exception, including any inner exceptions. - - The exception - The formatted stack trace - - - - Rethrows an exception object without losing the existing stack trace information - - The exception to re-throw. - - For more information on this technique, see - http://www.dotnetjunkies.com/WebLog/chris.taylor/archive/2004/03/03/8353.aspx - - - - - Exception thrown when a value is unexpectedly not in the given range. - - - - - The base assert exception class - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The user message to be displayed - - - - Initializes a new instance of the class. - - The user message to be displayed - The inner exception - - - - Initializes a new instance of the class. - - The user message to be displayed - The stack trace to be displayed - - - - Filters the stack trace to remove all lines that occur within the testing framework. - - The original stack trace - The filtered stack trace - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Gets the user message - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Interface which describes the ability to executes all the tests in a test class. - - - - - Allows the test class command to choose the next test to be run from the list of - tests that have not yet been run, thereby allowing it to choose the run order. - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the type that is being tested - - - - - Attributes used to decorate a test fixture that is run with an alternate test runner. - The test runner must implement the interface. - - - - - Creates a new instance of the class. - - The class which implements ITestClassCommand and acts as the runner - for the test fixture. - - - - Gets the test class command. - - - - - Utility class which inspects methods for test information - - - - - Gets the display name. - - The method to be inspected - The display name - - - - Gets the skip reason from a test method. - - The method to be inspected - The skip reason - - - - Gets the test commands for a test method. - - The method to be inspected - The objects for the test method - - - - Gets the timeout value for a test method. - - The method to be inspected - The timeout, in milliseconds - - - - Gets the traits on a test method. - - The method to be inspected - A dictionary of the traits - - - - Determines whether a test method has a timeout. - - The method to be inspected - True if the method has a timeout; false, otherwise - - - - Determines whether a test method has traits. - - The method to be inspected - True if the method has traits; false, otherwise - - - - Determines whether a test method should be skipped. - - The method to be inspected - True if the method should be skipped; false, otherwise - - - - Determines whether a method is a test method. A test method must be decorated - with the (or derived class) and must not be abstract. - - The method to be inspected - True if the method is a test method; false, otherwise - - - - Represents information about an attribute. - - - - - Gets the instance of the attribute, if available. - - The type of the attribute - The instance of the attribute, if available. - - - - Gets an initialized property value of the attribute. - - The type of the property - The name of the property - The property value - - - - Represents the results from running a test method - - - - - Base class which contains XML manipulation helper methods - - - - - Interface that represents a single test result. - - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - The amount of time spent in execution - - - - - Adds the test execution time to the XML node. - - The XML node. - - - - - - - - - - Initializes a new instance of the class. The traits for - the test method are discovered using reflection. - - The method under test. - The display name for the test. If null, the fully qualified - type name is used. - - - - Initializes a new instance of the class. - - The name of the method under test. - The type of the method under test. - The display name for the test. If null, the fully qualified - type name is used. - The traits. - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets or sets the display name of the method under test. This is the value that's shown - during failures and in the resulting output XML. - - - - - Gets the name of the method under test. - - - - - Gets or sets the standard output/standard error from the test that was captured - while the test was running. - - - - - Gets the traits attached to the test method. - - - - - Gets the name of the type under test. - - - - - Exception thrown when the collection did not contain exactly one element. - - - - - Initializes a new instance of the class. - - The numbers of items in the collection. - - - - Represents a failed test result. - - - - - Creates a new instance of the class. - - The method under test - The exception throw by the test - The display name for the test. If null, the fully qualified - type name is used. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name of the test - The custom properties attached to the test method - The full type name of the exception throw - The exception message - The exception stack trace - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the exception type thrown by the test method. - - - - - Gets the exception message thrown by the test method. - - - - - Gets the stack trace of the exception thrown by the test method. - - - - - Allows the user to record actions for a test. - - - - - Records any exception which is thrown by the given code. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Records any exception which is thrown by the given code that has - a return value. Generally used for testing property accessors. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Attribute that is applied to a method to indicate that it is a fact that should be run - by the test runner. It can also be extended to support a customized definition of a - test method. - - - - - Creates instances of which represent individual intended - invocations of the test method. - - The method under test - An enumerator through the desired test method invocations - - - - Enumerates the test commands represented by this test method. Derived classes should - override this method to return instances of , one per execution - of a test method. - - The test method - The test commands which will execute the test runs for the given method - - - - Gets the name of the test to be used when the test is skipped. Defaults to - null, which will cause the fully qualified test name to be used. - - - - - Obsolete. Please use the property instead. - - - - - Marks the test so that it will not be run, and gets or sets the skip reason - - - - - Marks the test as failing if it does not finish running within the given time - period, in milliseconds; set to 0 or less to indicate the method has no timeout - - - - - Contains multiple test results, representing them as a composite test result. - - - - - Adds a test result to the composite test result list. - - - - - - Gets the test results. - - - - - Used to decorate xUnit.net test classes that utilize fixture classes. - An instance of the fixture data is initialized just before the first - test in the class is run, and if it implements IDisposable, is disposed - after the last test in the class is run. - - The type of the fixture - - - - Called on the test class just before each test method is run, - passing the fixture data so that it can be used for the test. - All test runs share the same instance of fixture data. - - The fixture data - - - - Wraps a command which should fail if it runs longer than the given timeout value. - - - - - Creates a new instance of the class. - - The command to be run - The timout, in milliseconds - The method under test - - - - Executes the test method, failing if it takes too long. - - Returns information about the test run - - - - - - - Implementation of that represents a skipped test. - - - - - Represents an xUnit.net test command. - - - - - The method under test. - - - - - Initializes a new instance of the class. - - The method under test. - The display name of the test. - The timeout, in milliseconds. - - - - - - - - - - - - - Gets the name of the method under test. - - - - - - - - - - - Gets the name of the type under test. - - - - - Creates a new instance of the class. - - The method that is being skipped - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - - - - - - - Gets the skip reason. - - - - - - - - Represents information about a type. - - - - - Gets all the custom attributes for the type that are of the given attribute type. - - The type of the attribute - The matching attributes that decorate the type - - - - Gets a test method by name. - - The name of the method - The method, if it exists; null, otherwise. - - - - Gets all the methods - - - - - - Determines if the type has at least one instance of the given attribute type. - - The type of the attribute - True if the type has at least one instance of the given attribute type; false, otherwise - - - - Determines if the type implements the given interface. - - The type of the interface - True if the type implements the given interface; false, otherwise - - - - Gets a value indicating whether the type is abstract. - - - - - Gets a value indicating whether the type is sealed. - - - - - Gets the underlying object, if available. - - - - - Represents an implementation of to be used with - tests which are decorated with the . - - - - - Initializes a new instance of the class. - - The test method. - - - - - - - Represents an xUnit.net test class - - - - - Creates a new instance of the class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The type under test - - - - Chooses the next test to run, randomly, using the . - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the randomizer used to determine the order in which tests are run. - - - - - Sets the type that is being tested - - - - - Exception thrown when a test method exceeds the given timeout value - - - - - Creates a new instance of the class. - - The timeout value, in milliseconds - - - - Exception thrown when two values are unexpected the same instance. - - - - - Creates a new instance of the class. - - - - - Exception thrown when an object is unexpectedly null. - - - - - Creates a new instance of the class. - - - - - Runner that executes an synchronously. - - - - - Execute the . - - The test class command to execute - The methods to execute; if null or empty, all methods will be executed - The start run callback - The end run result callback - A with the results of the test run - - - - Represents a passing test result. - - - - - Create a new instance of the class. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - - - - Create a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The custom properties attached to the test method - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Exception thrown when the value is unexpectedly not of the exact given type. - - - - - Base class for exceptions that have actual and expected values - - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - Set to true to skip the check for difference position - - - - Gets the actual value. - - - - - Gets the expected value. - - - - - Gets a message that describes the current exception. Includes the expected and actual values. - - The error message that explains the reason for the exception, or an empty string(""). - 1 - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Exception thrown when the value is unexpectedly of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Contains the test results from a test class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The simple name of the type under test - The fully qualified name of the type under test - The namespace of the type under test - - - - Sets the exception thrown by the test fixture. - - The thrown exception - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified test fixture exception type, when an exception has occurred. - - - - - Gets the number of tests which failed. - - - - - Gets the fully qualified name of the type under test. - - - - - Gets the test fixture exception message, when an exception has occurred. - - - - - Gets the simple name of the type under test. - - - - - Gets the namespace of the type under test. - - - - - Gets the number of tests which passed. - - - - - Gets the number of tests which were skipped. - - - - - Gets the test fixture exception stack trace, when an exception has occurred. - - - - - Exception thrown when a collection is unexpectedly empty. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a collection unexpectedly contains the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - A command wrapper which times the running of a command. - - - - - Creates a new instance of the class. - - The command that will be timed. - - - - Executes the inner test method, gathering the amount of time it takes to run. - - Returns information about the test run - - - - This command sets up the necessary trace listeners and standard - output/error listeners to capture Assert/Debug.Trace failures, - output to stdout/stderr, and Assert/Debug.Write text. It also - captures any exceptions that are thrown and packages them as - FailedResults, including the possibility that the configuration - file is messed up (which is exposed when we attempt to manipulate - the trace listener list). - - - - - Initializes a new instance of the - class. - - The command that will be wrapped. - The test method. - - - - - - - Attribute used to decorate a test method with arbitrary name/value pairs ("traits"). - - - - - Creates a new instance of the class. - - The trait name - The trait value - - - - Gets the trait name. - - - - - - - - Gets the trait value. - - - - - Utility class which inspects types for test information - - - - - Determines if a type contains any test methods - - The type to be inspected - True if the class contains any test methods; false, otherwise - - - - Retrieves the type to run the test class with from the , if present. - - The type to be inspected - The type of the test class runner, if present; null, otherwise - - - - Retrieves a list of the test methods from the test class. - - The type to be inspected - The test methods - - - - Determines if the test class has a applied to it. - - The type to be inspected - True if the test class has a run with attribute; false, otherwise - - - - Determines if the type implements . - - The type to be inspected - True if the type implements ; false, otherwise - - - - Determines whether the specified type is abstract. - - The type. - - true if the specified type is abstract; otherwise, false. - - - - - Determines whether the specified type is static. - - The type. - - true if the specified type is static; otherwise, false. - - - - - Determines if a class is a test class. - - The type to be inspected - True if the type is a test class; false, otherwise - - - - A dictionary which contains multiple unique values for each key. - - The type of the key. - The type of the value. - - - - Adds the value for the given key. If the key does not exist in the - dictionary yet, it will add it. - - The key. - The value. - - - - Removes all keys and values from the dictionary. - - - - - Determines whether the dictionary contains to specified key and value. - - The key. - The value. - - - - Calls the delegate once for each key/value pair in the dictionary. - - - - - Removes the given key and all of its values. - - - - - Removes the given value from the given key. If this was the - last value for the key, then the key is removed as well. - - The key. - The value. - - - - Gets the values for the given key. - - - - - Gets the count of the keys in the dictionary. - - - - - Gets the keys. - - - - - - - - A timer class used to figure out how long tests take to run. On most .NET implementations - this will use the class because it's a high - resolution timer; however, on Silverlight/CoreCLR, it will use - (which will provide lower resolution results). - - - - - Creates a new instance of the class. - - - - - Starts timing. - - - - - Stops timing. - - - - - Gets how long the timer ran, in milliseconds. In order for this to be valid, - both and must have been called. - - - - - Internal class used for version-resilient test runners. DO NOT CALL DIRECTLY. - Version-resilient runners should link against xunit.runner.utility.dll and use - ExecutorWrapper instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Exception thrown when the value is unexpectedly not of the given type or a derived type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Factory for creating objects. - - - - - Make instances of objects for the given class and method. - - The class command - The method under test - The set of objects - - - - Guard class, used for guard clauses and argument validation - - - - - - - - - - - - - - Exception that is thrown when a call to Debug.Assert() fails. - - - - - Creates a new instance of the class. - - The original assert message - - - - Creates a new instance of the class. - - The original assert message - The original assert detailed message - - - - Gets the original assert detailed message. - - - - - Gets the original assert message. - - - - - Gets a message that describes the current exception. - - - - - Factory for objects, based on the type under test. - - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Represents a skipped test result. - - - - - Creates a new instance of the class. Uses reflection to discover - the skip reason. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The traits attached to the method under test - The skip reason - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the skip reason. - - - - - Contains the test results from an assembly. - - - - - Creates a new instance of the class. - - The filename of the assembly - - - - Creates a new instance of the class. - - The filename of the assembly - The configuration filename - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified filename of the configuration file. - - - - - Gets the directory where the assembly resides. - - - - - Gets the number of failed results. - - - - - Gets the fully qualified filename of the assembly. - - - - - Gets the number of passed results. - - - - - Gets the number of skipped results. - - - - - Exception thrown when a value is unexpectedly false. - - - - - Creates a new instance of the class. - - The user message to be displayed, or null for the default message - - - - Exception thrown when code unexpectedly fails to throw an exception. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The type of the exception that was expected - - - - Creates a new instance of the class. Call this constructor - when an exception of the wrong type was thrown. - - The type of the exception that was expected - The actual exception that was thrown - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when an object reference is unexpectedly not null. - - - - - Creates a new instance of the class. - - - - - - Exception thrown when two values are unexpectedly equal. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a collection is unexpectedly not empty. - - - - - Creates a new instance of the class. - - - - - Base attribute which indicates a test method interception (allows code to be run before and - after the test is run). - - - - - This method is called after the test method is executed. - - The method under test - - - - This method is called before the test method is executed. - - The method under test - - - - - - - Wrapper to implement and using reflection. - - - - - Converts an into an using reflection. - - - - - - - Converts a into an using reflection. - - The method to wrap - The wrapper - - - - Converts a into an using reflection. - - The type to wrap - The wrapper - - - - Represents information about a method. - - - - - Creates an instance of the type where this test method was found. If using - reflection, this should be the ReflectedType. - - A new instance of the type. - - - - Gets all the custom attributes for the method that are of the given type. - - The type of the attribute - The matching attributes that decorate the method - - - - Determines if the method has at least one instance of the given attribute type. - - The type of the attribute - True if the method has at least one instance of the given attribute type; false, otherwise - - - - Invokes the test on the given class, with the given parameters. - - The instance of the test class (may be null if - the test method is static). - The parameters to be passed to the test method. - - - - Gets a value indicating whether the method is abstract. - - - - - Gets a value indicating whether the method is static. - - - - - Gets the underlying for the method, if available. - - - - - Gets the name of the method. - - - - - Gets the fully qualified type name of the return type. - - - - - Gets the fully qualified type name of the type that this method belongs to. If - using reflection, this should be the ReflectedType. - - - - - Exception thrown when two object references are unexpectedly not the same instance. - - - - - Creates a new instance of the class. - - The expected object reference - The actual object reference - - - - Exception thrown when a value is unexpectedly in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Exception thrown when code unexpectedly throws an exception. - - - - - Creates a new instance of the class. - - Actual exception - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a collection unexpectedly does not contain the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - Exception that is thrown when one or more exceptions are thrown from - the After method of a . - - - - - Initializes a new instance of the class. - - The exceptions. - - - - Initializes a new instance of the class. - - The exceptions. - - - - Gets the list of exceptions thrown in the After method. - - - - - Gets a message that describes the current exception. - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - - - - XML utility methods - - - - - Adds an attribute to an XML node. - - The XML node. - The attribute name. - The attribute value. - - - - Adds a child element to an XML node. - - The parent XML node. - The child element name. - The new child XML element. - - - - This class supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - Exception thrown when a value is unexpectedly true. - - - - - Creates a new instance of the class. - - The user message to be display, or null for the default message - - - - Exception thrown when two values are unexpectedly not equal. - - - - - Creates a new instance of the class. - - The expected object value - The actual object value - - - diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.dll b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.dll deleted file mode 100644 index b3565021eb..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.pdb b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.pdb deleted file mode 100644 index 31de1fbe36..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.xml b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.xml deleted file mode 100644 index 8cf67c3684..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunit.extensions-silverlight3.xml +++ /dev/null @@ -1,610 +0,0 @@ - - - - xunit.extensions-silverlight3 - - - - - A class which can be derived from for test classes, which bring an overridable version - of Assert (using the class. - - - - - Gets a class which provides assertions. - - - - - Represents a single invocation of a data theory test method. - - - - - Creates a new instance of . - - The method under test - The parameters to be passed to the test method - - - - - - - Gets the parameter values that are passed to the test method. - - - - - Provides a data source for a data theory, with the data coming from a public static property on the test class. - The property must return IEnumerable<object[]> with the test data. - - - - - Abstract attribute which represents a data source for a data theory. - Data source providers derive from this attribute and implement GetData - to return the data for the theory. - - - - - Returns the data to be used to test the theory. - - - The parameter is provided so that the - test data can be converted to the destination parameter type when necessary. - Generally, data should NOT be automatically converted, UNLESS the source data - format does not have rich types (for example, all numbers in Excel spreadsheets - are returned as even if they are integers). Derivers of - this class should NOT throw exceptions for mismatched types or mismatched number - of parameters; the test framework will throw these exceptions at the correct - time. - - The method that is being tested - The types of the parameters for the test method - The theory data - - - - - - - Creates a new instance of / - - The name of the public static property on the test class that will provide the test data - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Provides a data source for a data theory, with the data coming from inline values. - - - - - Initializes a new instance of the class. - - The data values to pass to the theory - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Apply to a test method to trace the method begin and end. - - - - - This method is called before the test method is executed. - - The method under test - - - - This method is called after the test method is executed. - - The method under test - - - - A wrapper around the static operations on which allows time - to be frozen using the . The clock begins in the - thawed state; that is, calls to , , and - return current (non-frozen) values. - - - - - Freezes the clock with the current time. - Until is called, all calls to , , and - will return the exact same values. - - - - - Freezes the clock with the given date and time, considered to be local time. - Until is called, all calls to , , and - will return the exact same values. - - The local date and time to freeze to - - - - Freezes the clock with the given date and time, considered to be Coordinated Universal Time (UTC). - Until is called, all calls to , , and - will return the exact same values. - - The UTC date and time to freeze to - - - - Thaws the clock so that , , and - return normal values. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the local time. - - - - - Gets the current date. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the Coordinated Universal Time (UTC). - - - - - Apply this attribute to your test method to freeze the time represented by the - class. - - - - - Freeze the clock with the current date and time. - - - - - Freeze the clock with the given date, considered to be local time. - - The frozen year - The frozen month - The frozen day - - - - Freeze the clock with the given date and time, considered to be in local time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - - - - Freeze the clock with the given date and time, with the given kind of time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - The frozen time kind - - - - Thaws the clock. - - The method under test - - - - Freezes the clock. - - The method under test - - - - Provides a data source for a data theory, with the data coming from a class - which must implement IEnumerable<object[]>. - - - - - Initializes a new instance of the class. - - The class that provides the data. - - - - - - - A wrapper for Assert which is used by . - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Marks a test method as being a data theory. Data theories are tests which are fed - various bits of data from a data source, mapping to parameters on the test method. - If the data source contains multiple rows, then the test method is executed - multiple times (once with each data row). - - - - - Creates instances of which represent individual intended - invocations of the test method, one per data row in the data source. - - The method under test - An enumerator through the desired test method invocations - - - diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.dll b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.dll deleted file mode 100644 index 0cdbf509c1..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.pdb b/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.pdb deleted file mode 100644 index f9bd8c6c1f..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight3/xunitcontrib.runner.silverlight.toolkit-sl3.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.dll b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.dll deleted file mode 100644 index 3eb641bd8b..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.pdb b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.pdb deleted file mode 100644 index d3c6a0d200..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.xml b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.xml deleted file mode 100644 index 51bc71ba6d..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit-silverlight4.xml +++ /dev/null @@ -1,2383 +0,0 @@ - - - - xunit-silverlight4 - - - - - Contains various static methods that are used to verify that conditions are met during the - process of running tests. - - - - - Initializes a new instance of the class. - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given string, using a string comparer. - - The type of the object to be verified - The string expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected string - Thrown when the string is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given string, using a string comparer. - - The type of the string to be compared - The string that is expected not to be in the collection - The collection to be inspected - The comparer used to equate strings in the collection with the expected string - Thrown when the string is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that two strings are not equal, using the given string comparer. - - The type of the strings to be compared - The expected string - The actual string - The comparer used to examine the strings - Thrown when the strings are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type which matches the given predicate. - - The collection type. - The collection. - The item matching predicate. - The single item in the filtered collection. - Thrown when the filtered collection does - not contain exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Used by the Throws and DoesNotThrow methods. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - Exception to be thrown from when the number of - parameter values does not the test method signature. - - - - - - - - Command that automatically creates the instance of the test class - and disposes it (if it implements ). - - - - - Base class used by commands which delegate to inner commands. - - - - - Interface which represents the ability to invoke of a test method. - - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Creates the start XML to be sent to the callback when the test is about to start - running. - - Return the of the start node, or null if the test - is known that it will not be running. - - - - Gets the display name of the test method. - - - - - Determines if the test runner infrastructure should create a new instance of the - test class before running the test. - - - - - Determines if the test should be limited to running a specific amount of time - before automatically failing. - - The timeout value, in milliseconds; if zero, the test will not have - a timeout. - - - - Creates a new instance of the class. - - The inner command to delegate to. - - - - - - - - - - - - - - - - - - - - - - Creates a new instance of the object. - - The command that is bring wrapped - The method under test - - - - Executes the test method. Creates a new instance of the class - under tests and passes it to the inner command. Also catches - any exceptions and converts them into s. - - The instance of the test class - Returns information about the test run - - - - Command used to wrap a which has associated - fixture data. - - - - - Creates a new instance of the class. - - The inner command - The fixtures to be set on the test class - - - - Sets the fixtures on the test class by calling SetFixture, then - calls the inner command. - - The instance of the test class - Returns information about the test run - - - - Implementation of which executes the - instances attached to a test method. - - - - - Initializes a new instance of the class. - - The inner command. - The method. - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Utility methods for dealing with exceptions. - - - - - Gets the message for the exception, including any inner exception messages. - - The exception - The formatted message - - - - Gets the stack trace for the exception, including any inner exceptions. - - The exception - The formatted stack trace - - - - Rethrows an exception object without losing the existing stack trace information - - The exception to re-throw. - - For more information on this technique, see - http://www.dotnetjunkies.com/WebLog/chris.taylor/archive/2004/03/03/8353.aspx - - - - - Exception thrown when a value is unexpectedly not in the given range. - - - - - The base assert exception class - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The user message to be displayed - - - - Initializes a new instance of the class. - - The user message to be displayed - The inner exception - - - - Initializes a new instance of the class. - - The user message to be displayed - The stack trace to be displayed - - - - Filters the stack trace to remove all lines that occur within the testing framework. - - The original stack trace - The filtered stack trace - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Gets the user message - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Interface which describes the ability to executes all the tests in a test class. - - - - - Allows the test class command to choose the next test to be run from the list of - tests that have not yet been run, thereby allowing it to choose the run order. - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the type that is being tested - - - - - Attributes used to decorate a test fixture that is run with an alternate test runner. - The test runner must implement the interface. - - - - - Creates a new instance of the class. - - The class which implements ITestClassCommand and acts as the runner - for the test fixture. - - - - Gets the test class command. - - - - - Utility class which inspects methods for test information - - - - - Gets the display name. - - The method to be inspected - The display name - - - - Gets the skip reason from a test method. - - The method to be inspected - The skip reason - - - - Gets the test commands for a test method. - - The method to be inspected - The objects for the test method - - - - Gets the timeout value for a test method. - - The method to be inspected - The timeout, in milliseconds - - - - Gets the traits on a test method. - - The method to be inspected - A dictionary of the traits - - - - Determines whether a test method has a timeout. - - The method to be inspected - True if the method has a timeout; false, otherwise - - - - Determines whether a test method has traits. - - The method to be inspected - True if the method has traits; false, otherwise - - - - Determines whether a test method should be skipped. - - The method to be inspected - True if the method should be skipped; false, otherwise - - - - Determines whether a method is a test method. A test method must be decorated - with the (or derived class) and must not be abstract. - - The method to be inspected - True if the method is a test method; false, otherwise - - - - Represents information about an attribute. - - - - - Gets the instance of the attribute, if available. - - The type of the attribute - The instance of the attribute, if available. - - - - Gets an initialized property value of the attribute. - - The type of the property - The name of the property - The property value - - - - Represents the results from running a test method - - - - - Base class which contains XML manipulation helper methods - - - - - Interface that represents a single test result. - - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - The amount of time spent in execution - - - - - Adds the test execution time to the XML node. - - The XML node. - - - - - - - - - - Initializes a new instance of the class. The traits for - the test method are discovered using reflection. - - The method under test. - The display name for the test. If null, the fully qualified - type name is used. - - - - Initializes a new instance of the class. - - The name of the method under test. - The type of the method under test. - The display name for the test. If null, the fully qualified - type name is used. - The traits. - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets or sets the display name of the method under test. This is the value that's shown - during failures and in the resulting output XML. - - - - - Gets the name of the method under test. - - - - - Gets or sets the standard output/standard error from the test that was captured - while the test was running. - - - - - Gets the traits attached to the test method. - - - - - Gets the name of the type under test. - - - - - Exception thrown when the collection did not contain exactly one element. - - - - - Initializes a new instance of the class. - - The numbers of items in the collection. - - - - Represents a failed test result. - - - - - Creates a new instance of the class. - - The method under test - The exception throw by the test - The display name for the test. If null, the fully qualified - type name is used. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name of the test - The custom properties attached to the test method - The full type name of the exception throw - The exception message - The exception stack trace - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the exception type thrown by the test method. - - - - - Gets the exception message thrown by the test method. - - - - - Gets the stack trace of the exception thrown by the test method. - - - - - Allows the user to record actions for a test. - - - - - Records any exception which is thrown by the given code. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Records any exception which is thrown by the given code that has - a return value. Generally used for testing property accessors. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Attribute that is applied to a method to indicate that it is a fact that should be run - by the test runner. It can also be extended to support a customized definition of a - test method. - - - - - Creates instances of which represent individual intended - invocations of the test method. - - The method under test - An enumerator through the desired test method invocations - - - - Enumerates the test commands represented by this test method. Derived classes should - override this method to return instances of , one per execution - of a test method. - - The test method - The test commands which will execute the test runs for the given method - - - - Gets the name of the test to be used when the test is skipped. Defaults to - null, which will cause the fully qualified test name to be used. - - - - - Obsolete. Please use the property instead. - - - - - Marks the test so that it will not be run, and gets or sets the skip reason - - - - - Marks the test as failing if it does not finish running within the given time - period, in milliseconds; set to 0 or less to indicate the method has no timeout - - - - - Contains multiple test results, representing them as a composite test result. - - - - - Adds a test result to the composite test result list. - - - - - - Gets the test results. - - - - - Used to decorate xUnit.net test classes that utilize fixture classes. - An instance of the fixture data is initialized just before the first - test in the class is run, and if it implements IDisposable, is disposed - after the last test in the class is run. - - The type of the fixture - - - - Called on the test class just before each test method is run, - passing the fixture data so that it can be used for the test. - All test runs share the same instance of fixture data. - - The fixture data - - - - Wraps a command which should fail if it runs longer than the given timeout value. - - - - - Creates a new instance of the class. - - The command to be run - The timout, in milliseconds - The method under test - - - - Executes the test method, failing if it takes too long. - - Returns information about the test run - - - - - - - Implementation of that represents a skipped test. - - - - - Represents an xUnit.net test command. - - - - - The method under test. - - - - - Initializes a new instance of the class. - - The method under test. - The display name of the test. - The timeout, in milliseconds. - - - - - - - - - - - - - Gets the name of the method under test. - - - - - - - - - - - Gets the name of the type under test. - - - - - Creates a new instance of the class. - - The method that is being skipped - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - - - - - - - Gets the skip reason. - - - - - - - - Represents information about a type. - - - - - Gets all the custom attributes for the type that are of the given attribute type. - - The type of the attribute - The matching attributes that decorate the type - - - - Gets a test method by name. - - The name of the method - The method, if it exists; null, otherwise. - - - - Gets all the methods - - - - - - Determines if the type has at least one instance of the given attribute type. - - The type of the attribute - True if the type has at least one instance of the given attribute type; false, otherwise - - - - Determines if the type implements the given interface. - - The type of the interface - True if the type implements the given interface; false, otherwise - - - - Gets a value indicating whether the type is abstract. - - - - - Gets a value indicating whether the type is sealed. - - - - - Gets the underlying object, if available. - - - - - Represents an implementation of to be used with - tests which are decorated with the . - - - - - Initializes a new instance of the class. - - The test method. - - - - - - - Represents an xUnit.net test class - - - - - Creates a new instance of the class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The type under test - - - - Chooses the next test to run, randomly, using the . - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the randomizer used to determine the order in which tests are run. - - - - - Sets the type that is being tested - - - - - Exception thrown when a test method exceeds the given timeout value - - - - - Creates a new instance of the class. - - The timeout value, in milliseconds - - - - Exception thrown when two values are unexpected the same instance. - - - - - Creates a new instance of the class. - - - - - Exception thrown when an object is unexpectedly null. - - - - - Creates a new instance of the class. - - - - - Runner that executes an synchronously. - - - - - Execute the . - - The test class command to execute - The methods to execute; if null or empty, all methods will be executed - The start run callback - The end run result callback - A with the results of the test run - - - - Represents a passing test result. - - - - - Create a new instance of the class. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - - - - Create a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The custom properties attached to the test method - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Exception thrown when the value is unexpectedly not of the exact given type. - - - - - Base class for exceptions that have actual and expected values - - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - Set to true to skip the check for difference position - - - - Gets the actual value. - - - - - Gets the expected value. - - - - - Gets a message that describes the current exception. Includes the expected and actual values. - - The error message that explains the reason for the exception, or an empty string(""). - 1 - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Exception thrown when the value is unexpectedly of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Contains the test results from a test class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The simple name of the type under test - The fully qualified name of the type under test - The namespace of the type under test - - - - Sets the exception thrown by the test fixture. - - The thrown exception - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified test fixture exception type, when an exception has occurred. - - - - - Gets the number of tests which failed. - - - - - Gets the fully qualified name of the type under test. - - - - - Gets the test fixture exception message, when an exception has occurred. - - - - - Gets the simple name of the type under test. - - - - - Gets the namespace of the type under test. - - - - - Gets the number of tests which passed. - - - - - Gets the number of tests which were skipped. - - - - - Gets the test fixture exception stack trace, when an exception has occurred. - - - - - Exception thrown when a collection is unexpectedly empty. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a collection unexpectedly contains the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - A command wrapper which times the running of a command. - - - - - Creates a new instance of the class. - - The command that will be timed. - - - - Executes the inner test method, gathering the amount of time it takes to run. - - Returns information about the test run - - - - This command sets up the necessary trace listeners and standard - output/error listeners to capture Assert/Debug.Trace failures, - output to stdout/stderr, and Assert/Debug.Write text. It also - captures any exceptions that are thrown and packages them as - FailedResults, including the possibility that the configuration - file is messed up (which is exposed when we attempt to manipulate - the trace listener list). - - - - - Initializes a new instance of the - class. - - The command that will be wrapped. - The test method. - - - - - - - Attribute used to decorate a test method with arbitrary name/value pairs ("traits"). - - - - - Creates a new instance of the class. - - The trait name - The trait value - - - - Gets the trait name. - - - - - - - - Gets the trait value. - - - - - Utility class which inspects types for test information - - - - - Determines if a type contains any test methods - - The type to be inspected - True if the class contains any test methods; false, otherwise - - - - Retrieves the type to run the test class with from the , if present. - - The type to be inspected - The type of the test class runner, if present; null, otherwise - - - - Retrieves a list of the test methods from the test class. - - The type to be inspected - The test methods - - - - Determines if the test class has a applied to it. - - The type to be inspected - True if the test class has a run with attribute; false, otherwise - - - - Determines if the type implements . - - The type to be inspected - True if the type implements ; false, otherwise - - - - Determines whether the specified type is abstract. - - The type. - - true if the specified type is abstract; otherwise, false. - - - - - Determines whether the specified type is static. - - The type. - - true if the specified type is static; otherwise, false. - - - - - Determines if a class is a test class. - - The type to be inspected - True if the type is a test class; false, otherwise - - - - A dictionary which contains multiple unique values for each key. - - The type of the key. - The type of the value. - - - - Adds the value for the given key. If the key does not exist in the - dictionary yet, it will add it. - - The key. - The value. - - - - Removes all keys and values from the dictionary. - - - - - Determines whether the dictionary contains to specified key and value. - - The key. - The value. - - - - Calls the delegate once for each key/value pair in the dictionary. - - - - - Removes the given key and all of its values. - - - - - Removes the given value from the given key. If this was the - last value for the key, then the key is removed as well. - - The key. - The value. - - - - Gets the values for the given key. - - - - - Gets the count of the keys in the dictionary. - - - - - Gets the keys. - - - - - - - - A timer class used to figure out how long tests take to run. On most .NET implementations - this will use the class because it's a high - resolution timer; however, on Silverlight/CoreCLR, it will use - (which will provide lower resolution results). - - - - - Creates a new instance of the class. - - - - - Starts timing. - - - - - Stops timing. - - - - - Gets how long the timer ran, in milliseconds. In order for this to be valid, - both and must have been called. - - - - - Internal class used for version-resilient test runners. DO NOT CALL DIRECTLY. - Version-resilient runners should link against xunit.runner.utility.dll and use - ExecutorWrapper instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Exception thrown when the value is unexpectedly not of the given type or a derived type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Factory for creating objects. - - - - - Make instances of objects for the given class and method. - - The class command - The method under test - The set of objects - - - - Guard class, used for guard clauses and argument validation - - - - - - - - - - - - - - Exception that is thrown when a call to Debug.Assert() fails. - - - - - Creates a new instance of the class. - - The original assert message - - - - Creates a new instance of the class. - - The original assert message - The original assert detailed message - - - - Gets the original assert detailed message. - - - - - Gets the original assert message. - - - - - Gets a message that describes the current exception. - - - - - Factory for objects, based on the type under test. - - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Represents a skipped test result. - - - - - Creates a new instance of the class. Uses reflection to discover - the skip reason. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The traits attached to the method under test - The skip reason - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the skip reason. - - - - - Contains the test results from an assembly. - - - - - Creates a new instance of the class. - - The filename of the assembly - - - - Creates a new instance of the class. - - The filename of the assembly - The configuration filename - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified filename of the configuration file. - - - - - Gets the directory where the assembly resides. - - - - - Gets the number of failed results. - - - - - Gets the fully qualified filename of the assembly. - - - - - Gets the number of passed results. - - - - - Gets the number of skipped results. - - - - - Exception thrown when a value is unexpectedly false. - - - - - Creates a new instance of the class. - - The user message to be displayed, or null for the default message - - - - Exception thrown when code unexpectedly fails to throw an exception. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The type of the exception that was expected - - - - Creates a new instance of the class. Call this constructor - when an exception of the wrong type was thrown. - - The type of the exception that was expected - The actual exception that was thrown - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when an object reference is unexpectedly not null. - - - - - Creates a new instance of the class. - - - - - - Exception thrown when two values are unexpectedly equal. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a collection is unexpectedly not empty. - - - - - Creates a new instance of the class. - - - - - Base attribute which indicates a test method interception (allows code to be run before and - after the test is run). - - - - - This method is called after the test method is executed. - - The method under test - - - - This method is called before the test method is executed. - - The method under test - - - - - - - Wrapper to implement and using reflection. - - - - - Converts an into an using reflection. - - - - - - - Converts a into an using reflection. - - The method to wrap - The wrapper - - - - Converts a into an using reflection. - - The type to wrap - The wrapper - - - - Represents information about a method. - - - - - Creates an instance of the type where this test method was found. If using - reflection, this should be the ReflectedType. - - A new instance of the type. - - - - Gets all the custom attributes for the method that are of the given type. - - The type of the attribute - The matching attributes that decorate the method - - - - Determines if the method has at least one instance of the given attribute type. - - The type of the attribute - True if the method has at least one instance of the given attribute type; false, otherwise - - - - Invokes the test on the given class, with the given parameters. - - The instance of the test class (may be null if - the test method is static). - The parameters to be passed to the test method. - - - - Gets a value indicating whether the method is abstract. - - - - - Gets a value indicating whether the method is static. - - - - - Gets the underlying for the method, if available. - - - - - Gets the name of the method. - - - - - Gets the fully qualified type name of the return type. - - - - - Gets the fully qualified type name of the type that this method belongs to. If - using reflection, this should be the ReflectedType. - - - - - Exception thrown when two object references are unexpectedly not the same instance. - - - - - Creates a new instance of the class. - - The expected object reference - The actual object reference - - - - Exception thrown when a value is unexpectedly in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Exception thrown when code unexpectedly throws an exception. - - - - - Creates a new instance of the class. - - Actual exception - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a collection unexpectedly does not contain the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - Exception that is thrown when one or more exceptions are thrown from - the After method of a . - - - - - Initializes a new instance of the class. - - The exceptions. - - - - Initializes a new instance of the class. - - The exceptions. - - - - Gets the list of exceptions thrown in the After method. - - - - - Gets a message that describes the current exception. - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - - - - XML utility methods - - - - - Adds an attribute to an XML node. - - The XML node. - The attribute name. - The attribute value. - - - - Adds a child element to an XML node. - - The parent XML node. - The child element name. - The new child XML element. - - - - This class supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - Exception thrown when a value is unexpectedly true. - - - - - Creates a new instance of the class. - - The user message to be display, or null for the default message - - - - Exception thrown when two values are unexpectedly not equal. - - - - - Creates a new instance of the class. - - The expected object value - The actual object value - - - diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.dll b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.dll deleted file mode 100644 index 29e717a524..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.pdb b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.pdb deleted file mode 100644 index 16da874e7d..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.xml b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.xml deleted file mode 100644 index 8967588bad..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunit.extensions-silverlight4.xml +++ /dev/null @@ -1,610 +0,0 @@ - - - - xunit.extensions-silverlight4 - - - - - A class which can be derived from for test classes, which bring an overridable version - of Assert (using the class. - - - - - Gets a class which provides assertions. - - - - - Represents a single invocation of a data theory test method. - - - - - Creates a new instance of . - - The method under test - The parameters to be passed to the test method - - - - - - - Gets the parameter values that are passed to the test method. - - - - - Provides a data source for a data theory, with the data coming from a public static property on the test class. - The property must return IEnumerable<object[]> with the test data. - - - - - Abstract attribute which represents a data source for a data theory. - Data source providers derive from this attribute and implement GetData - to return the data for the theory. - - - - - Returns the data to be used to test the theory. - - - The parameter is provided so that the - test data can be converted to the destination parameter type when necessary. - Generally, data should NOT be automatically converted, UNLESS the source data - format does not have rich types (for example, all numbers in Excel spreadsheets - are returned as even if they are integers). Derivers of - this class should NOT throw exceptions for mismatched types or mismatched number - of parameters; the test framework will throw these exceptions at the correct - time. - - The method that is being tested - The types of the parameters for the test method - The theory data - - - - - - - Creates a new instance of / - - The name of the public static property on the test class that will provide the test data - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Provides a data source for a data theory, with the data coming from inline values. - - - - - Initializes a new instance of the class. - - The data values to pass to the theory - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Apply to a test method to trace the method begin and end. - - - - - This method is called before the test method is executed. - - The method under test - - - - This method is called after the test method is executed. - - The method under test - - - - A wrapper around the static operations on which allows time - to be frozen using the . The clock begins in the - thawed state; that is, calls to , , and - return current (non-frozen) values. - - - - - Freezes the clock with the current time. - Until is called, all calls to , , and - will return the exact same values. - - - - - Freezes the clock with the given date and time, considered to be local time. - Until is called, all calls to , , and - will return the exact same values. - - The local date and time to freeze to - - - - Freezes the clock with the given date and time, considered to be Coordinated Universal Time (UTC). - Until is called, all calls to , , and - will return the exact same values. - - The UTC date and time to freeze to - - - - Thaws the clock so that , , and - return normal values. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the local time. - - - - - Gets the current date. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the Coordinated Universal Time (UTC). - - - - - Apply this attribute to your test method to freeze the time represented by the - class. - - - - - Freeze the clock with the current date and time. - - - - - Freeze the clock with the given date, considered to be local time. - - The frozen year - The frozen month - The frozen day - - - - Freeze the clock with the given date and time, considered to be in local time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - - - - Freeze the clock with the given date and time, with the given kind of time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - The frozen time kind - - - - Thaws the clock. - - The method under test - - - - Freezes the clock. - - The method under test - - - - Provides a data source for a data theory, with the data coming from a class - which must implement IEnumerable<object[]>. - - - - - Initializes a new instance of the class. - - The class that provides the data. - - - - - - - A wrapper for Assert which is used by . - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Marks a test method as being a data theory. Data theories are tests which are fed - various bits of data from a data source, mapping to parameters on the test method. - If the data source contains multiple rows, then the test method is executed - multiple times (once with each data row). - - - - - Creates instances of which represent individual intended - invocations of the test method, one per data row in the data source. - - The method under test - An enumerator through the desired test method invocations - - - diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.dll b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.dll deleted file mode 100644 index 6542591557..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.pdb b/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.pdb deleted file mode 100644 index dd552768ea..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/Silverlight4/xunitcontrib.runner.silverlight.toolkit-sl4.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.dll b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.dll deleted file mode 100644 index bf35dfdcda..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.pdb b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.pdb deleted file mode 100644 index 5da28608f1..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.xml b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.xml deleted file mode 100644 index 975b0026d4..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit-silverlight-wp7.xml +++ /dev/null @@ -1,2383 +0,0 @@ - - - - xunit-silverlight-wp7 - - - - - Contains various static methods that are used to verify that conditions are met during the - process of running tests. - - - - - Initializes a new instance of the class. - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given string, using a string comparer. - - The type of the object to be verified - The string expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected string - Thrown when the string is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given string, using a string comparer. - - The type of the string to be compared - The string that is expected not to be in the collection - The collection to be inspected - The comparer used to equate strings in the collection with the expected string - Thrown when the string is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that two strings are not equal, using the given string comparer. - - The type of the strings to be compared - The expected string - The actual string - The comparer used to examine the strings - Thrown when the strings are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type which matches the given predicate. - - The collection type. - The collection. - The item matching predicate. - The single item in the filtered collection. - Thrown when the filtered collection does - not contain exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Used by the Throws and DoesNotThrow methods. - - - - - Used by the Throws and DoesNotThrow methods. - - - - - Exception to be thrown from when the number of - parameter values does not the test method signature. - - - - - - - - Command that automatically creates the instance of the test class - and disposes it (if it implements ). - - - - - Base class used by commands which delegate to inner commands. - - - - - Interface which represents the ability to invoke of a test method. - - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Creates the start XML to be sent to the callback when the test is about to start - running. - - Return the of the start node, or null if the test - is known that it will not be running. - - - - Gets the display name of the test method. - - - - - Determines if the test runner infrastructure should create a new instance of the - test class before running the test. - - - - - Determines if the test should be limited to running a specific amount of time - before automatically failing. - - The timeout value, in milliseconds; if zero, the test will not have - a timeout. - - - - Creates a new instance of the class. - - The inner command to delegate to. - - - - - - - - - - - - - - - - - - - - - - Creates a new instance of the object. - - The command that is bring wrapped - The method under test - - - - Executes the test method. Creates a new instance of the class - under tests and passes it to the inner command. Also catches - any exceptions and converts them into s. - - The instance of the test class - Returns information about the test run - - - - Command used to wrap a which has associated - fixture data. - - - - - Creates a new instance of the class. - - The inner command - The fixtures to be set on the test class - - - - Sets the fixtures on the test class by calling SetFixture, then - calls the inner command. - - The instance of the test class - Returns information about the test run - - - - Implementation of which executes the - instances attached to a test method. - - - - - Initializes a new instance of the class. - - The inner command. - The method. - - - - Executes the test method. - - The instance of the test class - Returns information about the test run - - - - Utility methods for dealing with exceptions. - - - - - Gets the message for the exception, including any inner exception messages. - - The exception - The formatted message - - - - Gets the stack trace for the exception, including any inner exceptions. - - The exception - The formatted stack trace - - - - Rethrows an exception object without losing the existing stack trace information - - The exception to re-throw. - - For more information on this technique, see - http://www.dotnetjunkies.com/WebLog/chris.taylor/archive/2004/03/03/8353.aspx - - - - - Exception thrown when a value is unexpectedly not in the given range. - - - - - The base assert exception class - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The user message to be displayed - - - - Initializes a new instance of the class. - - The user message to be displayed - The inner exception - - - - Initializes a new instance of the class. - - The user message to be displayed - The stack trace to be displayed - - - - Filters the stack trace to remove all lines that occur within the testing framework. - - The original stack trace - The filtered stack trace - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Gets the user message - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Interface which describes the ability to executes all the tests in a test class. - - - - - Allows the test class command to choose the next test to be run from the list of - tests that have not yet been run, thereby allowing it to choose the run order. - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the type that is being tested - - - - - Attributes used to decorate a test fixture that is run with an alternate test runner. - The test runner must implement the interface. - - - - - Creates a new instance of the class. - - The class which implements ITestClassCommand and acts as the runner - for the test fixture. - - - - Gets the test class command. - - - - - Utility class which inspects methods for test information - - - - - Gets the display name. - - The method to be inspected - The display name - - - - Gets the skip reason from a test method. - - The method to be inspected - The skip reason - - - - Gets the test commands for a test method. - - The method to be inspected - The objects for the test method - - - - Gets the timeout value for a test method. - - The method to be inspected - The timeout, in milliseconds - - - - Gets the traits on a test method. - - The method to be inspected - A dictionary of the traits - - - - Determines whether a test method has a timeout. - - The method to be inspected - True if the method has a timeout; false, otherwise - - - - Determines whether a test method has traits. - - The method to be inspected - True if the method has traits; false, otherwise - - - - Determines whether a test method should be skipped. - - The method to be inspected - True if the method should be skipped; false, otherwise - - - - Determines whether a method is a test method. A test method must be decorated - with the (or derived class) and must not be abstract. - - The method to be inspected - True if the method is a test method; false, otherwise - - - - Represents information about an attribute. - - - - - Gets the instance of the attribute, if available. - - The type of the attribute - The instance of the attribute, if available. - - - - Gets an initialized property value of the attribute. - - The type of the property - The name of the property - The property value - - - - Represents the results from running a test method - - - - - Base class which contains XML manipulation helper methods - - - - - Interface that represents a single test result. - - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - The amount of time spent in execution - - - - - Adds the test execution time to the XML node. - - The XML node. - - - - - - - - - - Initializes a new instance of the class. The traits for - the test method are discovered using reflection. - - The method under test. - The display name for the test. If null, the fully qualified - type name is used. - - - - Initializes a new instance of the class. - - The name of the method under test. - The type of the method under test. - The display name for the test. If null, the fully qualified - type name is used. - The traits. - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets or sets the display name of the method under test. This is the value that's shown - during failures and in the resulting output XML. - - - - - Gets the name of the method under test. - - - - - Gets or sets the standard output/standard error from the test that was captured - while the test was running. - - - - - Gets the traits attached to the test method. - - - - - Gets the name of the type under test. - - - - - Exception thrown when the collection did not contain exactly one element. - - - - - Initializes a new instance of the class. - - The numbers of items in the collection. - - - - Represents a failed test result. - - - - - Creates a new instance of the class. - - The method under test - The exception throw by the test - The display name for the test. If null, the fully qualified - type name is used. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name of the test - The custom properties attached to the test method - The full type name of the exception throw - The exception message - The exception stack trace - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the exception type thrown by the test method. - - - - - Gets the exception message thrown by the test method. - - - - - Gets the stack trace of the exception thrown by the test method. - - - - - Allows the user to record actions for a test. - - - - - Records any exception which is thrown by the given code. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Records any exception which is thrown by the given code that has - a return value. Generally used for testing property accessors. - - The code which may thrown an exception. - Returns the exception that was thrown by the code; null, otherwise. - - - - Attribute that is applied to a method to indicate that it is a fact that should be run - by the test runner. It can also be extended to support a customized definition of a - test method. - - - - - Creates instances of which represent individual intended - invocations of the test method. - - The method under test - An enumerator through the desired test method invocations - - - - Enumerates the test commands represented by this test method. Derived classes should - override this method to return instances of , one per execution - of a test method. - - The test method - The test commands which will execute the test runs for the given method - - - - Gets the name of the test to be used when the test is skipped. Defaults to - null, which will cause the fully qualified test name to be used. - - - - - Obsolete. Please use the property instead. - - - - - Marks the test so that it will not be run, and gets or sets the skip reason - - - - - Marks the test as failing if it does not finish running within the given time - period, in milliseconds; set to 0 or less to indicate the method has no timeout - - - - - Contains multiple test results, representing them as a composite test result. - - - - - Adds a test result to the composite test result list. - - - - - - Gets the test results. - - - - - Used to decorate xUnit.net test classes that utilize fixture classes. - An instance of the fixture data is initialized just before the first - test in the class is run, and if it implements IDisposable, is disposed - after the last test in the class is run. - - The type of the fixture - - - - Called on the test class just before each test method is run, - passing the fixture data so that it can be used for the test. - All test runs share the same instance of fixture data. - - The fixture data - - - - Wraps a command which should fail if it runs longer than the given timeout value. - - - - - Creates a new instance of the class. - - The command to be run - The timout, in milliseconds - The method under test - - - - Executes the test method, failing if it takes too long. - - Returns information about the test run - - - - - - - Implementation of that represents a skipped test. - - - - - Represents an xUnit.net test command. - - - - - The method under test. - - - - - Initializes a new instance of the class. - - The method under test. - The display name of the test. - The timeout, in milliseconds. - - - - - - - - - - - - - Gets the name of the method under test. - - - - - - - - - - - Gets the name of the type under test. - - - - - Creates a new instance of the class. - - The method that is being skipped - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - - - - - - - Gets the skip reason. - - - - - - - - Represents information about a type. - - - - - Gets all the custom attributes for the type that are of the given attribute type. - - The type of the attribute - The matching attributes that decorate the type - - - - Gets a test method by name. - - The name of the method - The method, if it exists; null, otherwise. - - - - Gets all the methods - - - - - - Determines if the type has at least one instance of the given attribute type. - - The type of the attribute - True if the type has at least one instance of the given attribute type; false, otherwise - - - - Determines if the type implements the given interface. - - The type of the interface - True if the type implements the given interface; false, otherwise - - - - Gets a value indicating whether the type is abstract. - - - - - Gets a value indicating whether the type is sealed. - - - - - Gets the underlying object, if available. - - - - - Represents an implementation of to be used with - tests which are decorated with the . - - - - - Initializes a new instance of the class. - - The test method. - - - - - - - Represents an xUnit.net test class - - - - - Creates a new instance of the class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The type under test - - - - Chooses the next test to run, randomly, using the . - - The tests remaining to be run - The index of the test that should be run - - - - Execute actions to be run after all the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Execute actions to be run before any of the test methods of this test class are run. - - Returns the thrown during execution, if any; null, otherwise - - - - Enumerates the test commands for a given test method in this test class. - - The method under test - The test commands for the given test method - - - - Enumerates the methods which are test methods in this test class. - - The test methods - - - - Determines if a given refers to a test method. - - The test method to validate - True if the method is a test method; false, otherwise - - - - Gets the object instance that is under test. May return null if you wish - the test framework to create a new object instance for each test method. - - - - - Gets or sets the randomizer used to determine the order in which tests are run. - - - - - Sets the type that is being tested - - - - - Exception thrown when a test method exceeds the given timeout value - - - - - Creates a new instance of the class. - - The timeout value, in milliseconds - - - - Exception thrown when two values are unexpected the same instance. - - - - - Creates a new instance of the class. - - - - - Exception thrown when an object is unexpectedly null. - - - - - Creates a new instance of the class. - - - - - Runner that executes an synchronously. - - - - - Execute the . - - The test class command to execute - The methods to execute; if null or empty, all methods will be executed - The start run callback - The end run result callback - A with the results of the test run - - - - Represents a passing test result. - - - - - Create a new instance of the class. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - - - - Create a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The custom properties attached to the test method - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Exception thrown when the value is unexpectedly not of the exact given type. - - - - - Base class for exceptions that have actual and expected values - - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - - - - Creates a new instance of the class. - - The expected value - The actual value - The user message to be shown - Set to true to skip the check for difference position - - - - Gets the actual value. - - - - - Gets the expected value. - - - - - Gets a message that describes the current exception. Includes the expected and actual values. - - The error message that explains the reason for the exception, or an empty string(""). - 1 - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Exception thrown when the value is unexpectedly of the exact given type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Contains the test results from a test class. - - - - - Creates a new instance of the class. - - The type under test - - - - Creates a new instance of the class. - - The simple name of the type under test - The fully qualified name of the type under test - The namespace of the type under test - - - - Sets the exception thrown by the test fixture. - - The thrown exception - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified test fixture exception type, when an exception has occurred. - - - - - Gets the number of tests which failed. - - - - - Gets the fully qualified name of the type under test. - - - - - Gets the test fixture exception message, when an exception has occurred. - - - - - Gets the simple name of the type under test. - - - - - Gets the namespace of the type under test. - - - - - Gets the number of tests which passed. - - - - - Gets the number of tests which were skipped. - - - - - Gets the test fixture exception stack trace, when an exception has occurred. - - - - - Exception thrown when a collection is unexpectedly empty. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a collection unexpectedly contains the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - A command wrapper which times the running of a command. - - - - - Creates a new instance of the class. - - The command that will be timed. - - - - Executes the inner test method, gathering the amount of time it takes to run. - - Returns information about the test run - - - - This command sets up the necessary trace listeners and standard - output/error listeners to capture Assert/Debug.Trace failures, - output to stdout/stderr, and Assert/Debug.Write text. It also - captures any exceptions that are thrown and packages them as - FailedResults, including the possibility that the configuration - file is messed up (which is exposed when we attempt to manipulate - the trace listener list). - - - - - Initializes a new instance of the - class. - - The command that will be wrapped. - The test method. - - - - - - - Attribute used to decorate a test method with arbitrary name/value pairs ("traits"). - - - - - Creates a new instance of the class. - - The trait name - The trait value - - - - Gets the trait name. - - - - - - - - Gets the trait value. - - - - - Utility class which inspects types for test information - - - - - Determines if a type contains any test methods - - The type to be inspected - True if the class contains any test methods; false, otherwise - - - - Retrieves the type to run the test class with from the , if present. - - The type to be inspected - The type of the test class runner, if present; null, otherwise - - - - Retrieves a list of the test methods from the test class. - - The type to be inspected - The test methods - - - - Determines if the test class has a applied to it. - - The type to be inspected - True if the test class has a run with attribute; false, otherwise - - - - Determines if the type implements . - - The type to be inspected - True if the type implements ; false, otherwise - - - - Determines whether the specified type is abstract. - - The type. - - true if the specified type is abstract; otherwise, false. - - - - - Determines whether the specified type is static. - - The type. - - true if the specified type is static; otherwise, false. - - - - - Determines if a class is a test class. - - The type to be inspected - True if the type is a test class; false, otherwise - - - - A dictionary which contains multiple unique values for each key. - - The type of the key. - The type of the value. - - - - Adds the value for the given key. If the key does not exist in the - dictionary yet, it will add it. - - The key. - The value. - - - - Removes all keys and values from the dictionary. - - - - - Determines whether the dictionary contains to specified key and value. - - The key. - The value. - - - - Calls the delegate once for each key/value pair in the dictionary. - - - - - Removes the given key and all of its values. - - - - - Removes the given value from the given key. If this was the - last value for the key, then the key is removed as well. - - The key. - The value. - - - - Gets the values for the given key. - - - - - Gets the count of the keys in the dictionary. - - - - - Gets the keys. - - - - - - - - A timer class used to figure out how long tests take to run. On most .NET implementations - this will use the class because it's a high - resolution timer; however, on Silverlight/CoreCLR, it will use - (which will provide lower resolution results). - - - - - Creates a new instance of the class. - - - - - Starts timing. - - - - - Stops timing. - - - - - Gets how long the timer ran, in milliseconds. In order for this to be valid, - both and must have been called. - - - - - Internal class used for version-resilient test runners. DO NOT CALL DIRECTLY. - Version-resilient runners should link against xunit.runner.utility.dll and use - ExecutorWrapper instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Exception thrown when the value is unexpectedly not of the given type or a derived type. - - - - - Creates a new instance of the class. - - The expected type - The actual object value - - - - Factory for creating objects. - - - - - Make instances of objects for the given class and method. - - The class command - The method under test - The set of objects - - - - Guard class, used for guard clauses and argument validation - - - - - - - - - - - - - - Exception that is thrown when a call to Debug.Assert() fails. - - - - - Creates a new instance of the class. - - The original assert message - - - - Creates a new instance of the class. - - The original assert message - The original assert detailed message - - - - Gets the original assert detailed message. - - - - - Gets the original assert message. - - - - - Gets a message that describes the current exception. - - - - - Factory for objects, based on the type under test. - - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Creates the test class command, which implements , for a given type. - - The type under test - The test class command, if the class is a test class; null, otherwise - - - - Represents a skipped test result. - - - - - Creates a new instance of the class. Uses reflection to discover - the skip reason. - - The method under test - The display name for the test. If null, the fully qualified - type name is used. - The reason the test was skipped. - - - - Creates a new instance of the class. - - The name of the method under test - The name of the type under test - The display name for the test. If null, the fully qualified - type name is used. - The traits attached to the method under test - The skip reason - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the skip reason. - - - - - Contains the test results from an assembly. - - - - - Creates a new instance of the class. - - The filename of the assembly - - - - Creates a new instance of the class. - - The filename of the assembly - The configuration filename - - - - Converts the test result into XML that is consumed by the test runners. - - The parent node. - The newly created XML node. - - - - Gets the fully qualified filename of the configuration file. - - - - - Gets the directory where the assembly resides. - - - - - Gets the number of failed results. - - - - - Gets the fully qualified filename of the assembly. - - - - - Gets the number of passed results. - - - - - Gets the number of skipped results. - - - - - Exception thrown when a value is unexpectedly false. - - - - - Creates a new instance of the class. - - The user message to be displayed, or null for the default message - - - - Exception thrown when code unexpectedly fails to throw an exception. - - - - - Creates a new instance of the class. Call this constructor - when no exception was thrown. - - The type of the exception that was expected - - - - Creates a new instance of the class. Call this constructor - when an exception of the wrong type was thrown. - - The type of the exception that was expected - The actual exception that was thrown - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when an object reference is unexpectedly not null. - - - - - Creates a new instance of the class. - - - - - - Exception thrown when two values are unexpectedly equal. - - - - - Creates a new instance of the class. - - - - - Exception thrown when a collection is unexpectedly not empty. - - - - - Creates a new instance of the class. - - - - - Base attribute which indicates a test method interception (allows code to be run before and - after the test is run). - - - - - This method is called after the test method is executed. - - The method under test - - - - This method is called before the test method is executed. - - The method under test - - - - - - - Wrapper to implement and using reflection. - - - - - Converts an into an using reflection. - - - - - - - Converts a into an using reflection. - - The method to wrap - The wrapper - - - - Converts a into an using reflection. - - The type to wrap - The wrapper - - - - Represents information about a method. - - - - - Creates an instance of the type where this test method was found. If using - reflection, this should be the ReflectedType. - - A new instance of the type. - - - - Gets all the custom attributes for the method that are of the given type. - - The type of the attribute - The matching attributes that decorate the method - - - - Determines if the method has at least one instance of the given attribute type. - - The type of the attribute - True if the method has at least one instance of the given attribute type; false, otherwise - - - - Invokes the test on the given class, with the given parameters. - - The instance of the test class (may be null if - the test method is static). - The parameters to be passed to the test method. - - - - Gets a value indicating whether the method is abstract. - - - - - Gets a value indicating whether the method is static. - - - - - Gets the underlying for the method, if available. - - - - - Gets the name of the method. - - - - - Gets the fully qualified type name of the return type. - - - - - Gets the fully qualified type name of the type that this method belongs to. If - using reflection, this should be the ReflectedType. - - - - - Exception thrown when two object references are unexpectedly not the same instance. - - - - - Creates a new instance of the class. - - The expected object reference - The actual object reference - - - - Exception thrown when a value is unexpectedly in the given range. - - - - - Creates a new instance of the class. - - The actual object value - The low value of the range - The high value of the range - - - - Gets the actual object value - - - - - Gets the high value of the range - - - - - Gets the low value of the range - - - - - Gets a message that describes the current exception. - - The error message that explains the reason for the exception, or an empty string(""). - - - - Exception thrown when code unexpectedly throws an exception. - - - - - Creates a new instance of the class. - - Actual exception - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - A string that describes the contents of the call stack, with the most recent method call appearing first. - - - - Exception thrown when a collection unexpectedly does not contain the expected value. - - - - - Creates a new instance of the class. - - The expected object value - - - - Exception that is thrown when one or more exceptions are thrown from - the After method of a . - - - - - Initializes a new instance of the class. - - The exceptions. - - - - Initializes a new instance of the class. - - The exceptions. - - - - Gets the list of exceptions thrown in the After method. - - - - - Gets a message that describes the current exception. - - - - - Gets a string representation of the frames on the call stack at the time the current exception was thrown. - - - - - XML utility methods - - - - - Adds an attribute to an XML node. - - The XML node. - The attribute name. - The attribute value. - - - - Adds a child element to an XML node. - - The parent XML node. - The child element name. - The new child XML element. - - - - This class supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - This API supports the xUnit.net infrastructure and is not intended to be used - directly from your code. - - - - - Exception thrown when a value is unexpectedly true. - - - - - Creates a new instance of the class. - - The user message to be display, or null for the default message - - - - Exception thrown when two values are unexpectedly not equal. - - - - - Creates a new instance of the class. - - The expected object value - The actual object value - - - diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.dll b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.dll deleted file mode 100644 index 94c96b6446..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.pdb b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.pdb deleted file mode 100644 index db997ff6d5..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.pdb and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.xml b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.xml deleted file mode 100644 index 976d849769..0000000000 --- a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunit.extensions-silverlight-wp7.xml +++ /dev/null @@ -1,610 +0,0 @@ - - - - xunit.extensions-silverlight-wp7 - - - - - A class which can be derived from for test classes, which bring an overridable version - of Assert (using the class. - - - - - Gets a class which provides assertions. - - - - - Represents a single invocation of a data theory test method. - - - - - Creates a new instance of . - - The method under test - The parameters to be passed to the test method - - - - - - - Gets the parameter values that are passed to the test method. - - - - - Provides a data source for a data theory, with the data coming from a public static property on the test class. - The property must return IEnumerable<object[]> with the test data. - - - - - Abstract attribute which represents a data source for a data theory. - Data source providers derive from this attribute and implement GetData - to return the data for the theory. - - - - - Returns the data to be used to test the theory. - - - The parameter is provided so that the - test data can be converted to the destination parameter type when necessary. - Generally, data should NOT be automatically converted, UNLESS the source data - format does not have rich types (for example, all numbers in Excel spreadsheets - are returned as even if they are integers). Derivers of - this class should NOT throw exceptions for mismatched types or mismatched number - of parameters; the test framework will throw these exceptions at the correct - time. - - The method that is being tested - The types of the parameters for the test method - The theory data - - - - - - - Creates a new instance of / - - The name of the public static property on the test class that will provide the test data - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Provides a data source for a data theory, with the data coming from inline values. - - - - - Initializes a new instance of the class. - - The data values to pass to the theory - - - - Returns the data to be used to test the theory. - - The method that is being tested - The types of the parameters for the test method - The theory data, in table form - - - - Apply to a test method to trace the method begin and end. - - - - - This method is called before the test method is executed. - - The method under test - - - - This method is called after the test method is executed. - - The method under test - - - - A wrapper around the static operations on which allows time - to be frozen using the . The clock begins in the - thawed state; that is, calls to , , and - return current (non-frozen) values. - - - - - Freezes the clock with the current time. - Until is called, all calls to , , and - will return the exact same values. - - - - - Freezes the clock with the given date and time, considered to be local time. - Until is called, all calls to , , and - will return the exact same values. - - The local date and time to freeze to - - - - Freezes the clock with the given date and time, considered to be Coordinated Universal Time (UTC). - Until is called, all calls to , , and - will return the exact same values. - - The UTC date and time to freeze to - - - - Thaws the clock so that , , and - return normal values. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the local time. - - - - - Gets the current date. - - - - - Gets a object that is set to the current date and time on this computer, - expressed as the Coordinated Universal Time (UTC). - - - - - Apply this attribute to your test method to freeze the time represented by the - class. - - - - - Freeze the clock with the current date and time. - - - - - Freeze the clock with the given date, considered to be local time. - - The frozen year - The frozen month - The frozen day - - - - Freeze the clock with the given date and time, considered to be in local time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - - - - Freeze the clock with the given date and time, with the given kind of time. - - The frozen year - The frozen month - The frozen day - The frozen hour - The frozen minute - The frozen second - The frozen time kind - - - - Thaws the clock. - - The method under test - - - - Freezes the clock. - - The method under test - - - - Provides a data source for a data theory, with the data coming from a class - which must implement IEnumerable<object[]>. - - - - - Initializes a new instance of the class. - - The class that provides the data. - - - - - - - A wrapper for Assert which is used by . - - - - - Verifies that a collection contains a given object. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - Thrown when the object is not present in the collection - - - - Verifies that a collection contains a given object, using an equality comparer. - - The type of the object to be verified - The object expected to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is not present in the collection - - - - Verifies that a string contains a given sub-string, using the current culture. - - The sub-string expected to be in the string - The string to be inspected - Thrown when the sub-string is not present inside the string - - - - Verifies that a string contains a given sub-string, using the given comparison type. - - The sub-string expected to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is not present inside the string - - - - Verifies that a collection does not contain a given object. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - Thrown when the object is present inside the container - - - - Verifies that a collection does not contain a given object, using an equality comparer. - - The type of the object to be compared - The object that is expected not to be in the collection - The collection to be inspected - The comparer used to equate objects in the collection with the expected object - Thrown when the object is present inside the container - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - Thrown when the sub-string is present inside the string - - - - Verifies that a string does not contain a given sub-string, using the current culture. - - The sub-string which is expected not to be in the string - The string to be inspected - The type of string comparison to perform - Thrown when the sub-string is present inside the given string - - - - Verifies that a block of code does not throw any exceptions. - - A delegate to the code to be tested - - - - Verifies that a collection is empty. - - The collection to be inspected - Thrown when the collection is null - Thrown when the collection is not empty - - - - Verifies that two objects are equal, using a default comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - Thrown when the objects are not equal - - - - Verifies that two objects are equal, using a custom equatable comparer. - - The type of the objects to be compared - The expected value - The value to be compared against - The comparer used to compare the two objects - Thrown when the objects are not equal - - - - Verifies that the condition is false. - - The condition to be tested - Thrown if the condition is not false - - - - Verifies that the condition is false. - - The condition to be tested - The message to show when the condition is not false - Thrown if the condition is not false - - - - Verifies that a value is within a given range. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is not in the given range - - - - Verifies that a value is within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is not in the given range - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is of the given type or a derived type. - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is not exactly the given type. - - The type the object should not be - The object to be evaluated - Thrown when the object is the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - The object, casted to type T when successful - Thrown when the object is not the given type - - - - Verifies that an object is exactly the given type (and not a derived type). - - The type the object should be - The object to be evaluated - Thrown when the object is not the given type - - - - Verifies that a collection is not empty. - - The collection to be inspected - Thrown when a null collection is passed - Thrown when the collection is empty - - - - Verifies that two objects are not equal, using a default comparer. - - The type of the objects to be compared - The expected object - The actual object - Thrown when the objects are equal - - - - Verifies that two objects are not equal, using a custom equality comparer. - - The type of the objects to be compared - The expected object - The actual object - The comparer used to examine the objects - Thrown when the objects are equal - - - - Verifies that a value is not within a given range, using the default comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - Thrown when the value is in the given range - - - - Verifies that a value is not within a given range, using a comparer. - - The type of the value to be compared - The actual value to be evaluated - The (inclusive) low value of the range - The (inclusive) high value of the range - The comparer used to evaluate the value's range - Thrown when the value is in the given range - - - - Verifies that an object reference is not null. - - The object to be validated - Thrown when the object is not null - - - - Verifies that two objects are not the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are the same instance - - - - Verifies that an object reference is null. - - The object to be inspected - Thrown when the object reference is not null - - - - Verifies that two objects are the same instance. - - The expected object instance - The actual object instance - Thrown when the objects are not the same instance - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the given collection contains only a single - element of the given type. - - The collection type. - The collection. - The single item in the collection. - Thrown when the collection does not contain - exactly one element. - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that the exact exception is thrown (and not a derived exception type). - Generally used to test property accessors. - - The type of the exception expected to be thrown - A delegate to the code to be tested - The exception that was thrown, when successful - Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - - - - Verifies that an expression is true. - - The condition to be inspected - Thrown when the condition is false - - - - Verifies that an expression is true. - - The condition to be inspected - The message to be shown when the condition is false - Thrown when the condition is false - - - - Marks a test method as being a data theory. Data theories are tests which are fed - various bits of data from a data source, mapping to parameters on the test method. - If the data source contains multiple rows, then the test method is executed - multiple times (once with each data row). - - - - - Creates instances of which represent individual intended - invocations of the test method, one per data row in the data source. - - The method under test - An enumerator through the desired test method invocations - - - diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.dll b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.dll deleted file mode 100644 index 9b53622d45..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.dll and /dev/null differ diff --git a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.pdb b/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.pdb deleted file mode 100644 index d040f3d46b..0000000000 Binary files a/lib/xunitcontrib-silverlight.0.2/WindowsPhone7/xunitcontrib.runner.silverlight.toolkit-wp7.pdb and /dev/null differ diff --git a/nuget.exe b/nuget.exe new file mode 100644 index 0000000000..e42e6d8277 Binary files /dev/null and b/nuget.exe differ diff --git a/psake.bat b/psake.bat deleted file mode 100644 index 2ec861dc80..0000000000 --- a/psake.bat +++ /dev/null @@ -1,8 +0,0 @@ -@echo off -cd %~dp0 - -SETLOCAL -powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "& {Import-Module '.\tools\psake\psake.psm1'; invoke-psake .\default.ps1 %*; if ($lastexitcode -ne 0) {write-host "ERROR: $lastexitcode" -fore RED; exit $lastexitcode} }" - - - diff --git a/tools/psake/psake.cmd b/psake.cmd similarity index 97% rename from tools/psake/psake.cmd rename to psake.cmd index 56cf6f954d..f1aadc48d3 100644 --- a/tools/psake/psake.cmd +++ b/psake.cmd @@ -1,14 +1,14 @@ -@echo off -rem Helper script for those who want to run psake from cmd.exe -rem Example run from cmd.exe: -rem psake "default.ps1" "BuildHelloWord" "4.0" - -if '%1'=='/?' goto help -if '%1'=='-help' goto help -if '%1'=='-h' goto help - -powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }" -exit /B %errorlevel% - -:help -powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' -help" +@echo off +rem Helper script for those who want to run psake from cmd.exe +rem Example run from cmd.exe: +rem psake "default.ps1" "BuildHelloWord" "4.0" + +if '%1'=='/?' goto help +if '%1'=='-help' goto help +if '%1'=='-h' goto help + +powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }" +exit /B %errorlevel% + +:help +powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' -help" diff --git a/tools/psake/psake.ps1 b/psake.ps1 similarity index 97% rename from tools/psake/psake.ps1 rename to psake.ps1 index c1f030940a..23c6f2d810 100644 --- a/tools/psake/psake.ps1 +++ b/psake.ps1 @@ -1,53 +1,53 @@ -# Helper script for those who want to run psake without importing the module. -# Example run from PowerShell: -# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0" - -# Must match parameter definitions for psake.psm1/invoke-psake -# otherwise named parameter binding fails -param( - [Parameter(Position=0,Mandatory=0)] - [string]$buildFile, - [Parameter(Position=1,Mandatory=0)] - [string[]]$taskList = @(), - [Parameter(Position=2,Mandatory=0)] - [string]$framework, - [Parameter(Position=3,Mandatory=0)] - [switch]$docs = $false, - [Parameter(Position=4,Mandatory=0)] - [System.Collections.Hashtable]$parameters = @{}, - [Parameter(Position=5, Mandatory=0)] - [System.Collections.Hashtable]$properties = @{}, - [Parameter(Position=6, Mandatory=0)] - [alias("init")] - [scriptblock]$initialization = {}, - [Parameter(Position=7, Mandatory=0)] - [switch]$nologo = $false, - [Parameter(Position=8, Mandatory=0)] - [switch]$help = $false, - [Parameter(Position=9, Mandatory=0)] - [string]$scriptPath, - [Parameter(Position=10,Mandatory=0)] - [switch]$detailedDocs = $false -) - -# setting $scriptPath here, not as default argument, to support calling as "powershell -File psake.ps1" -if (!$scriptPath) { - $scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path) -} - -# '[p]sake' is the same as 'psake' but $Error is not polluted -remove-module [p]sake -import-module (join-path $scriptPath psake.psm1) -if ($help) { - Get-Help Invoke-psake -full - return -} - -if ($buildFile -and (-not(test-path $buildFile))) { - $absoluteBuildFile = (join-path $scriptPath $buildFile) - if (test-path $absoluteBuildFile) { - $buildFile = $absoluteBuildFile - } -} - -Invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo $detailedDocs +# Helper script for those who want to run psake without importing the module. +# Example run from PowerShell: +# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0" + +# Must match parameter definitions for psake.psm1/invoke-psake +# otherwise named parameter binding fails +param( + [Parameter(Position=0,Mandatory=0)] + [string]$buildFile, + [Parameter(Position=1,Mandatory=0)] + [string[]]$taskList = @(), + [Parameter(Position=2,Mandatory=0)] + [string]$framework, + [Parameter(Position=3,Mandatory=0)] + [switch]$docs = $false, + [Parameter(Position=4,Mandatory=0)] + [System.Collections.Hashtable]$parameters = @{}, + [Parameter(Position=5, Mandatory=0)] + [System.Collections.Hashtable]$properties = @{}, + [Parameter(Position=6, Mandatory=0)] + [alias("init")] + [scriptblock]$initialization = {}, + [Parameter(Position=7, Mandatory=0)] + [switch]$nologo = $false, + [Parameter(Position=8, Mandatory=0)] + [switch]$help = $false, + [Parameter(Position=9, Mandatory=0)] + [string]$scriptPath, + [Parameter(Position=10,Mandatory=0)] + [switch]$detailedDocs = $false +) + +# setting $scriptPath here, not as default argument, to support calling as "powershell -File psake.ps1" +if (!$scriptPath) { + $scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path) +} + +# '[p]sake' is the same as 'psake' but $Error is not polluted +remove-module [p]sake +import-module (join-path $scriptPath psake.psm1) +if ($help) { + Get-Help Invoke-psake -full + return +} + +if ($buildFile -and (-not(test-path $buildFile))) { + $absoluteBuildFile = (join-path $scriptPath $buildFile) + if (test-path $absoluteBuildFile) { + $buildFile = $absoluteBuildFile + } +} + +Invoke-psake $buildFile $taskList $framework $docs $parameters $properties $initialization $nologo $detailedDocs diff --git a/psake.psd1 b/psake.psd1 new file mode 100644 index 0000000000..3d01672896 --- /dev/null +++ b/psake.psd1 @@ -0,0 +1,31 @@ +@{ + ModuleToProcess = 'psake.psm1' + ModuleVersion = '4.6.0' + GUID = 'cfb53216-072f-4a46-8975-ff7e6bda05a5' + Author = 'James Kovacs' + Copyright = 'Copyright (c) 2012-16 James Kovacs, Damian Hickey and Contributors' + PowerShellVersion = '2.0' + Description = 'psake is a build automation tool written in PowerShell.' + FunctionsToExport = @('Invoke-psake', + 'Invoke-Task', + 'Get-PSakeScriptTasks', + 'Task', + 'Properties', + 'Include', + 'FormatTaskName', + 'TaskSetup', + 'TaskTearDown', + 'Framework', + 'Assert', + 'Exec') + VariablesToExport = 'psake' + + PrivateData = @{ + PSData = @{ + LicenseUri = 'https://github.com/psake/psake/blob/master/license.txt' + ProjectUri = 'https://github.com/psake/psake' + Tags = @('Build', 'Task') + IconUri = 'https://raw.githubusercontent.com/psake/graphics/master/png/psake-single-icon-teal-bg-256x256.png' + } + } +} diff --git a/tools/psake/psake.psm1 b/psake.psm1 similarity index 81% rename from tools/psake/psake.psm1 rename to psake.psm1 index 106a0ae7fa..a27f54b36d 100644 --- a/tools/psake/psake.psm1 +++ b/psake.psm1 @@ -1,860 +1,925 @@ -# psake -# Copyright (c) 2012 James Kovacs -# 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. - -#Requires -Version 2.0 - -#-- Public Module Functions --# - -# .ExternalHelp psake.psm1-help.xml -function Invoke-Task -{ - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)] [string]$taskName - ) - - Assert $taskName ($msgs.error_invalid_task_name) - - $taskKey = $taskName.ToLower() - - if ($currentContext.aliases.Contains($taskKey)) { - $taskName = $currentContext.aliases.$taskKey.Name - $taskKey = $taskName.ToLower() - } - - $currentContext = $psake.context.Peek() - - Assert ($currentContext.tasks.Contains($taskKey)) ($msgs.error_task_name_does_not_exist -f $taskName) - - if ($currentContext.executedTasks.Contains($taskKey)) { return } - - Assert (!$currentContext.callStack.Contains($taskKey)) ($msgs.error_circular_reference -f $taskName) - - $currentContext.callStack.Push($taskKey) - - $task = $currentContext.tasks.$taskKey - - $precondition_is_valid = & $task.Precondition - - if (!$precondition_is_valid) { - WriteColoredOutput ($msgs.precondition_was_false -f $taskName) -foregroundcolor Cyan - } else { - if ($taskKey -ne 'default') { - - if ($task.PreAction -or $task.PostAction) { - Assert ($task.Action -ne $null) ($msgs.error_missing_action_parameter -f $taskName) - } - - if ($task.Action) { - try { - foreach($childTask in $task.DependsOn) { - Invoke-Task $childTask - } - - $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() - $currentContext.currentTaskName = $taskName - - & $currentContext.taskSetupScriptBlock - - if ($task.PreAction) { - & $task.PreAction - } - - if ($currentContext.config.taskNameFormat -is [ScriptBlock]) { - & $currentContext.config.taskNameFormat $taskName - } else { - WriteColoredOutput ($currentContext.config.taskNameFormat -f $taskName) -foregroundcolor Cyan - } - - foreach ($variable in $task.requiredVariables) { - Assert ((test-path "variable:$variable") -and ((get-variable $variable).Value -ne $null)) ($msgs.required_variable_not_set -f $variable, $taskName) - } - - & $task.Action - - if ($task.PostAction) { - & $task.PostAction - } - - & $currentContext.taskTearDownScriptBlock - $task.Duration = $stopwatch.Elapsed - } catch { - if ($task.ContinueOnError) { - "-"*70 - WriteColoredOutput ($msgs.continue_on_error -f $taskName,$_) -foregroundcolor Yellow - "-"*70 - $task.Duration = $stopwatch.Elapsed - } else { - throw $_ - } - } - } else { - # no action was specified but we still execute all the dependencies - foreach($childTask in $task.DependsOn) { - Invoke-Task $childTask - } - } - } else { - foreach($childTask in $task.DependsOn) { - Invoke-Task $childTask - } - } - - Assert (& $task.Postcondition) ($msgs.postcondition_failed -f $taskName) - } - - $poppedTaskKey = $currentContext.callStack.Pop() - Assert ($poppedTaskKey -eq $taskKey) ($msgs.error_corrupt_callstack -f $taskKey,$poppedTaskKey) - - $currentContext.executedTasks.Push($taskKey) -} - -# .ExternalHelp psake.psm1-help.xml -function Exec -{ - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][scriptblock]$cmd, - [Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd), - [Parameter(Position=2,Mandatory=0)][int]$maxRetries = 0, - [Parameter(Position=3,Mandatory=0)][string]$retryTriggerErrorPattern = $null - ) - - $tryCount = 1 - - do { - try { - $global:lastexitcode = 0 - & $cmd - if ($lastexitcode -ne 0) { - throw ("Exec: " + $errorMessage) - } - break - } - catch [Exception] - { - if ($tryCount -gt $maxRetries) { - throw $_ - } - - if ($retryTriggerErrorPattern -ne $null) { - $isMatch = [regex]::IsMatch($_.Exception.Message, $retryTriggerErrorPattern) - - if ($isMatch -eq $false) { - throw $_ - } - } - - Write-Host "Try $tryCount failed, retrying again in 1 second..." - - $tryCount++ - - [System.Threading.Thread]::Sleep([System.TimeSpan]::FromSeconds(1)) - } - } - while ($true) -} - -# .ExternalHelp psake.psm1-help.xml -function Assert -{ - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)]$conditionToCheck, - [Parameter(Position=1,Mandatory=1)]$failureMessage - ) - if (!$conditionToCheck) { - throw ("Assert: " + $failureMessage) - } -} - -# .ExternalHelp psake.psm1-help.xml -function Task -{ - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][string]$name = $null, - [Parameter(Position=1,Mandatory=0)][scriptblock]$action = $null, - [Parameter(Position=2,Mandatory=0)][scriptblock]$preaction = $null, - [Parameter(Position=3,Mandatory=0)][scriptblock]$postaction = $null, - [Parameter(Position=4,Mandatory=0)][scriptblock]$precondition = {$true}, - [Parameter(Position=5,Mandatory=0)][scriptblock]$postcondition = {$true}, - [Parameter(Position=6,Mandatory=0)][switch]$continueOnError = $false, - [Parameter(Position=7,Mandatory=0)][string[]]$depends = @(), - [Parameter(Position=8,Mandatory=0)][string[]]$requiredVariables = @(), - [Parameter(Position=9,Mandatory=0)][string]$description = $null, - [Parameter(Position=10,Mandatory=0)][string]$alias = $null, - [Parameter(Position=11,Mandatory=0)][string]$maxRetries = 0, - [Parameter(Position=12,Mandatory=0)][string]$retryTriggerErrorPattern = $null - ) - if ($name -eq 'default') { - Assert (!$action) ($msgs.error_default_task_cannot_have_action) - } - - $newTask = @{ - Name = $name - DependsOn = $depends - PreAction = $preaction - Action = $action - PostAction = $postaction - Precondition = $precondition - Postcondition = $postcondition - ContinueOnError = $continueOnError - Description = $description - Duration = [System.TimeSpan]::Zero - RequiredVariables = $requiredVariables - Alias = $alias - MaxRetries = $maxRetries - RetryTriggerErrorPattern = $retryTriggerErrorPattern - } - - $taskKey = $name.ToLower() - - $currentContext = $psake.context.Peek() - - Assert (!$currentContext.tasks.ContainsKey($taskKey)) ($msgs.error_duplicate_task_name -f $name) - - $currentContext.tasks.$taskKey = $newTask - - if($alias) - { - $aliasKey = $alias.ToLower() - - Assert (!$currentContext.aliases.ContainsKey($aliasKey)) ($msgs.error_duplicate_alias_name -f $alias) - - $currentContext.aliases.$aliasKey = $newTask - } -} - -# .ExternalHelp psake.psm1-help.xml -function Properties { - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][scriptblock]$properties - ) - $psake.context.Peek().properties += $properties -} - -# .ExternalHelp psake.psm1-help.xml -function Include { - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][string]$fileNamePathToInclude - ) - Assert (test-path $fileNamePathToInclude -pathType Leaf) ($msgs.error_invalid_include_path -f $fileNamePathToInclude) - $psake.context.Peek().includes.Enqueue((Resolve-Path $fileNamePathToInclude)); -} - -# .ExternalHelp psake.psm1-help.xml -function FormatTaskName { - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)]$format - ) - $psake.context.Peek().config.taskNameFormat = $format -} - -# .ExternalHelp psake.psm1-help.xml -function TaskSetup { - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][scriptblock]$setup - ) - $psake.context.Peek().taskSetupScriptBlock = $setup -} - -# .ExternalHelp psake.psm1-help.xml -function TaskTearDown { - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][scriptblock]$teardown - ) - $psake.context.Peek().taskTearDownScriptBlock = $teardown -} - -# .ExternalHelp psake.psm1-help.xml -function Framework { - [CmdletBinding()] - param( - [Parameter(Position=0,Mandatory=1)][string]$framework - ) - $psake.context.Peek().config.framework = $framework - ConfigureBuildEnvironment -} - -# .ExternalHelp psake.psm1-help.xml -function Invoke-psake { - [CmdletBinding()] - param( - [Parameter(Position = 0, Mandatory = 0)][string] $buildFile, - [Parameter(Position = 1, Mandatory = 0)][string[]] $taskList = @(), - [Parameter(Position = 2, Mandatory = 0)][string] $framework, - [Parameter(Position = 3, Mandatory = 0)][switch] $docs = $false, - [Parameter(Position = 4, Mandatory = 0)][hashtable] $parameters = @{}, - [Parameter(Position = 5, Mandatory = 0)][hashtable] $properties = @{}, - [Parameter(Position = 6, Mandatory = 0)][alias("init")][scriptblock] $initialization = {}, - [Parameter(Position = 7, Mandatory = 0)][switch] $nologo = $false, - [Parameter(Position = 8, Mandatory = 0)][switch] $detailedDocs = $false - ) - try { - if (-not $nologo) { - "psake version {0}`nCopyright (c) 2010-2014 James Kovacs & Contributors`n" -f $psake.version - } - - if (!$buildFile) { - $buildFile = $psake.config_default.buildFileName - } - elseif (!(test-path $buildFile -pathType Leaf) -and (test-path $psake.config_default.buildFileName -pathType Leaf)) { - # If the $config.buildFileName file exists and the given "buildfile" isn 't found assume that the given - # $buildFile is actually the target Tasks to execute in the $config.buildFileName script. - $taskList = $buildFile.Split(', ') - $buildFile = $psake.config_default.buildFileName - } - - # Execute the build file to set up the tasks and defaults - Assert (test-path $buildFile -pathType Leaf) ($msgs.error_build_file_not_found -f $buildFile) - - $psake.build_script_file = get-item $buildFile - $psake.build_script_dir = $psake.build_script_file.DirectoryName - $psake.build_success = $false - - $psake.context.push(@{ - "taskSetupScriptBlock" = {}; - "taskTearDownScriptBlock" = {}; - "executedTasks" = new-object System.Collections.Stack; - "callStack" = new-object System.Collections.Stack; - "originalEnvPath" = $env:path; - "originalDirectory" = get-location; - "originalErrorActionPreference" = $global:ErrorActionPreference; - "tasks" = @{}; - "aliases" = @{}; - "properties" = @(); - "includes" = new-object System.Collections.Queue; - "config" = CreateConfigurationForNewContext $buildFile $framework - }) - - LoadConfiguration $psake.build_script_dir - - $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() - - set-location $psake.build_script_dir - - LoadModules - - $frameworkOldValue = $framework - . $psake.build_script_file.FullName - - $currentContext = $psake.context.Peek() - - if ($framework -ne $frameworkOldValue) { - writecoloredoutput $msgs.warning_deprecated_framework_variable -foregroundcolor Yellow - $currentContext.config.framework = $framework - } - - ConfigureBuildEnvironment - - while ($currentContext.includes.Count -gt 0) { - $includeFilename = $currentContext.includes.Dequeue() - . $includeFilename - } - - if ($docs -or $detailedDocs) { - WriteDocumentation($detailedDocs) - CleanupEnvironment - return - } - - foreach ($key in $parameters.keys) { - if (test-path "variable:\$key") { - set-item -path "variable:\$key" -value $parameters.$key -WhatIf:$false -Confirm:$false | out-null - } else { - new-item -path "variable:\$key" -value $parameters.$key -WhatIf:$false -Confirm:$false | out-null - } - } - - # The initial dot (.) indicates that variables initialized/modified in the propertyBlock are available in the parent scope. - foreach ($propertyBlock in $currentContext.properties) { - . $propertyBlock - } - - foreach ($key in $properties.keys) { - if (test-path "variable:\$key") { - set-item -path "variable:\$key" -value $properties.$key -WhatIf:$false -Confirm:$false | out-null - } - } - - # Simple dot sourcing will not work. We have to force the script block into our - # module's scope in order to initialize variables properly. - . $MyInvocation.MyCommand.Module $initialization - - # Execute the list of tasks or the default task - if ($taskList) { - foreach ($task in $taskList) { - invoke-task $task - } - } elseif ($currentContext.tasks.default) { - invoke-task default - } else { - throw $msgs.error_no_default_task - } - - WriteColoredOutput ("`n" + $msgs.build_success + "`n") -foregroundcolor Green - - WriteTaskTimeSummary $stopwatch.Elapsed - - $psake.build_success = $true - } catch { - $currentConfig = GetCurrentConfigurationOrDefault - if ($currentConfig.verboseError) { - $error_message = "{0}: An Error Occurred. See Error Details Below: `n" -f (Get-Date) - $error_message += ("-" * 70) + "`n" - $error_message += "Error: {0}`n" -f (ResolveError $_ -Short) - $error_message += ("-" * 70) + "`n" - $error_message += ResolveError $_ - $error_message += ("-" * 70) + "`n" - $error_message += "Script Variables" + "`n" - $error_message += ("-" * 70) + "`n" - $error_message += get-variable -scope script | format-table | out-string - } else { - # ($_ | Out-String) gets error messages with source information included. - $error_message = "Error: {0}: `n{1}" -f (Get-Date), (ResolveError $_ -Short) - } - - $psake.build_success = $false - - # if we are running in a nested scope (i.e. running a psake script from a psake script) then we need to re-throw the exception - # so that the parent script will fail otherwise the parent script will report a successful build - $inNestedScope = ($psake.context.count -gt 1) - if ( $inNestedScope ) { - throw $_ - } else { - if (!$psake.run_by_psake_build_tester) { - WriteColoredOutput $error_message -foregroundcolor Red - } - } - } finally { - CleanupEnvironment - } -} - -#-- Private Module Functions --# -function WriteColoredOutput { - param( - [string] $message, - [System.ConsoleColor] $foregroundcolor - ) - - $currentConfig = GetCurrentConfigurationOrDefault - if ($currentConfig.coloredOutput -eq $true) { - if (($Host.UI -ne $null) -and ($Host.UI.RawUI -ne $null) -and ($Host.UI.RawUI.ForegroundColor -ne $null)) { - $previousColor = $Host.UI.RawUI.ForegroundColor - $Host.UI.RawUI.ForegroundColor = $foregroundcolor - } - } - - $message - - if ($previousColor -ne $null) { - $Host.UI.RawUI.ForegroundColor = $previousColor - } -} - -function LoadModules { - $currentConfig = $psake.context.peek().config - if ($currentConfig.modules) { - - $scope = $currentConfig.moduleScope - - $global = [string]::Equals($scope, "global", [StringComparison]::CurrentCultureIgnoreCase) - - $currentConfig.modules | foreach { - resolve-path $_ | foreach { - "Loading module: $_" - $module = import-module $_ -passthru -DisableNameChecking -global:$global - if (!$module) { - throw ($msgs.error_loading_module -f $_.Name) - } - } - } - "" - } -} - -function LoadConfiguration { - param( - [string] $configdir = $PSScriptRoot - ) - - $psakeConfigFilePath = (join-path $configdir "psake-config.ps1") - - if (test-path $psakeConfigFilePath -pathType Leaf) { - try { - $config = GetCurrentConfigurationOrDefault - . $psakeConfigFilePath - } catch { - throw "Error Loading Configuration from psake-config.ps1: " + $_ - } - } -} - -function GetCurrentConfigurationOrDefault() { - if ($psake.context.count -gt 0) { - return $psake.context.peek().config - } else { - return $psake.config_default - } -} - -function CreateConfigurationForNewContext { - param( - [string] $buildFile, - [string] $framework - ) - - $previousConfig = GetCurrentConfigurationOrDefault - - $config = new-object psobject -property @{ - buildFileName = $previousConfig.buildFileName; - framework = $previousConfig.framework; - taskNameFormat = $previousConfig.taskNameFormat; - verboseError = $previousConfig.verboseError; - coloredOutput = $previousConfig.coloredOutput; - modules = $previousConfig.modules; - moduleScope = $previousConfig.moduleScope; - } - - if ($framework) { - $config.framework = $framework; - } - - if ($buildFile) { - $config.buildFileName = $buildFile; - } - - return $config -} - -function ConfigureBuildEnvironment { - $framework = $psake.context.peek().config.framework - if ($framework -cmatch '^((?:\d+\.\d+)(?:\.\d+){0,1})(x86|x64){0,1}$') { - $versionPart = $matches[1] - $bitnessPart = $matches[2] - } else { - throw ($msgs.error_invalid_framework -f $framework) - } - $versions = $null - $buildToolsVersions = $null - switch ($versionPart) { - '1.0' { - $versions = @('v1.0.3705') - } - '1.1' { - $versions = @('v1.1.4322') - } - '2.0' { - $versions = @('v2.0.50727') - } - '3.0' { - $versions = @('v2.0.50727') - } - '3.5' { - $versions = @('v3.5', 'v2.0.50727') - } - '4.0' { - $versions = @('v4.0.30319') - } - '4.5.1' { - $versions = @('v4.0.30319') - $buildToolsVersions = @('14.0', '12.0') - } - default { - throw ($msgs.error_unknown_framework -f $versionPart, $framework) - } - } - - $bitness = 'Framework' - if ($versionPart -ne '1.0' -and $versionPart -ne '1.1') { - switch ($bitnessPart) { - 'x86' { - $bitness = 'Framework' - $buildToolsKey = 'MSBuildToolsPath32' - } - 'x64' { - $bitness = 'Framework64' - $buildToolsKey = 'MSBuildToolsPath' - } - { [string]::IsNullOrEmpty($_) } { - $ptrSize = [System.IntPtr]::Size - switch ($ptrSize) { - 4 { - $bitness = 'Framework' - $buildToolsKey = 'MSBuildToolsPath32' - } - 8 { - $bitness = 'Framework64' - $buildToolsKey = 'MSBuildToolsPath' - } - default { - throw ($msgs.error_unknown_pointersize -f $ptrSize) - } - } - } - default { - throw ($msgs.error_unknown_bitnesspart -f $bitnessPart, $framework) - } - } - } - $frameworkDirs = @() - if ($buildToolsVersions -ne $null) { - foreach($ver in $buildToolsVersions) { - if (Test-Path "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$ver") { - $frameworkDirs += (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$ver" -Name $buildToolsKey).$buildToolsKey - } - } - } - $frameworkDirs = $frameworkDirs + @($versions | foreach { "$env:windir\Microsoft.NET\$bitness\$_\" }) - - for ($i = 0; $i -lt $frameworkDirs.Count; $i++) { - $dir = $frameworkDirs[$i] - if ($dir -Match "\$\(Registry:HKEY_LOCAL_MACHINE(.*?)@(.*)\)") { - $key = "HKLM:" + $matches[1] - $name = $matches[2] - $dir = (Get-ItemProperty -Path $key -Name $name).$name - $frameworkDirs[$i] = $dir - } - } - - $frameworkDirs | foreach { Assert (test-path $_ -pathType Container) ($msgs.error_no_framework_install_dir_found -f $_)} - - $env:path = ($frameworkDirs -join ";") + ";$env:path" - # if any error occurs in a PS function then "stop" processing immediately - # this does not effect any external programs that return a non-zero exit code - $global:ErrorActionPreference = "Stop" -} - -function CleanupEnvironment { - if ($psake.context.Count -gt 0) { - $currentContext = $psake.context.Peek() - $env:path = $currentContext.originalEnvPath - Set-Location $currentContext.originalDirectory - $global:ErrorActionPreference = $currentContext.originalErrorActionPreference - [void] $psake.context.Pop() - } -} - -function SelectObjectWithDefault -{ - [CmdletBinding()] - param( - [Parameter(ValueFromPipeline=$true)] - [PSObject] - $InputObject, - [string] - $Name, - $Value - ) - - process { - if ($_ -eq $null) { $Value } - elseif ($_ | Get-Member -Name $Name) { - $_.$Name - } - elseif (($_ -is [Hashtable]) -and ($_.Keys -contains $Name)) { - $_.$Name - } - else { $Value } - } -} - -# borrowed from Jeffrey Snover http://blogs.msdn.com/powershell/archive/2006/12/07/resolve-error.aspx -# modified to better handle SQL errors -function ResolveError -{ - [CmdletBinding()] - param( - [Parameter(ValueFromPipeline=$true)] - $ErrorRecord=$Error[0], - [Switch] - $Short - ) - - process { - if ($_ -eq $null) { $_ = $ErrorRecord } - $ex = $_.Exception - - if (-not $Short) { - $error_message = "`nErrorRecord:{0}ErrorRecord.InvocationInfo:{1}Exception:`n{2}" - $formatted_errorRecord = $_ | format-list * -force | out-string - $formatted_invocationInfo = $_.InvocationInfo | format-list * -force | out-string - $formatted_exception = '' - - $i = 0 - while ($ex -ne $null) { - $i++ - $formatted_exception += ("$i" * 70) + "`n" + - ($ex | format-list * -force | out-string) + "`n" - $ex = $ex | SelectObjectWithDefault -Name 'InnerException' -Value $null - } - - return $error_message -f $formatted_errorRecord, $formatted_invocationInfo, $formatted_exception - } - - $lastException = @() - while ($ex -ne $null) { - $lastMessage = $ex | SelectObjectWithDefault -Name 'Message' -Value '' - $lastException += ($lastMessage -replace "`n", '') - if ($ex -is [Data.SqlClient.SqlException]) { - $lastException += "(Line [$($ex.LineNumber)] " + - "Procedure [$($ex.Procedure)] Class [$($ex.Class)] " + - " Number [$($ex.Number)] State [$($ex.State)] )" - } - $ex = $ex | SelectObjectWithDefault -Name 'InnerException' -Value $null - } - $shortException = $lastException -join ' --> ' - - $header = $null - $current = $_ - $header = (($_.InvocationInfo | - SelectObjectWithDefault -Name 'PositionMessage' -Value '') -replace "`n", ' '), - ($_ | SelectObjectWithDefault -Name 'Message' -Value ''), - ($_ | SelectObjectWithDefault -Name 'Exception' -Value '') | - ? { -not [String]::IsNullOrEmpty($_) } | - Select -First 1 - - $delimiter = '' - if ((-not [String]::IsNullOrEmpty($header)) -and - (-not [String]::IsNullOrEmpty($shortException))) - { $delimiter = ' [<<==>>] ' } - - return "$($header)$($delimiter)Exception: $($shortException)" - } -} - -function WriteDocumentation($showDetailed) { - $currentContext = $psake.context.Peek() - - if ($currentContext.tasks.default) { - $defaultTaskDependencies = $currentContext.tasks.default.DependsOn - } else { - $defaultTaskDependencies = @() - } - - $docs = $currentContext.tasks.Keys | foreach-object { - if ($_ -eq "default") { - return - } - - $task = $currentContext.tasks.$_ - new-object PSObject -property @{ - Name = $task.Name; - Alias = $task.Alias; - Description = $task.Description; - "Depends On" = $task.DependsOn -join ", " - Default = if ($defaultTaskDependencies -contains $task.Name) { $true } - } - } - if ($showDetailed) { - $docs | sort 'Name' | format-list -property Name,Alias,Description,"Depends On",Default - } else { - $docs | sort 'Name' | format-table -autoSize -wrap -property Name,Alias,"Depends On",Default,Description - } - -} - -function WriteTaskTimeSummary($invokePsakeDuration) { - if ($psake.context.count -gt 0) { - "-" * 70 - "Build Time Report" - "-" * 70 - $list = @() - $currentContext = $psake.context.Peek() - while ($currentContext.executedTasks.Count -gt 0) { - $taskKey = $currentContext.executedTasks.Pop() - $task = $currentContext.tasks.$taskKey - if ($taskKey -eq "default") { - continue - } - $list += new-object PSObject -property @{ - Name = $task.Name; - Duration = $task.Duration - } - } - [Array]::Reverse($list) - $list += new-object PSObject -property @{ - Name = "Total:"; - Duration = $invokePsakeDuration - } - # using "out-string | where-object" to filter out the blank line that format-table prepends - $list | format-table -autoSize -property Name,Duration | out-string -stream | where-object { $_ } - } -} - -DATA msgs { -convertfrom-stringdata @' - error_invalid_task_name = Task name should not be null or empty string. - error_task_name_does_not_exist = Task {0} does not exist. - error_circular_reference = Circular reference found for task {0}. - error_missing_action_parameter = Action parameter must be specified when using PreAction or PostAction parameters for task {0}. - error_corrupt_callstack = Call stack was corrupt. Expected {0}, but got {1}. - error_invalid_framework = Invalid .NET Framework version, {0} specified. - error_unknown_framework = Unknown .NET Framework version, {0} specified in {1}. - error_unknown_pointersize = Unknown pointer size ({0}) returned from System.IntPtr. - error_unknown_bitnesspart = Unknown .NET Framework bitness, {0}, specified in {1}. - error_no_framework_install_dir_found = No .NET Framework installation directory found at {0}. - error_bad_command = Error executing command {0}. - error_default_task_cannot_have_action = 'default' task cannot specify an action. - error_duplicate_task_name = Task {0} has already been defined. - error_duplicate_alias_name = Alias {0} has already been defined. - error_invalid_include_path = Unable to include {0}. File not found. - error_build_file_not_found = Could not find the build file {0}. - error_no_default_task = 'default' task required. - error_loading_module = Error loading module {0}. - warning_deprecated_framework_variable = Warning: Using global variable $framework to set .NET framework version used is deprecated. Instead use Framework function or configuration file psake-config.ps1. - required_variable_not_set = Variable {0} must be set to run task {1}. - postcondition_failed = Postcondition failed for task {0}. - precondition_was_false = Precondition was false, not executing task {0}. - continue_on_error = Error in task {0}. {1} - build_success = Build Succeeded! -'@ -} - -import-localizeddata -bindingvariable msgs -erroraction silentlycontinue - -$script:psake = @{} -$psake.version = "4.4.1" # contains the current version of psake -$psake.context = new-object system.collections.stack # holds onto the current state of all variables -$psake.run_by_psake_build_tester = $false # indicates that build is being run by psake-BuildTester -$psake.config_default = new-object psobject -property @{ - buildFileName = "default.ps1"; - framework = "4.0"; - taskNameFormat = "Executing {0}"; - verboseError = $false; - coloredOutput = $true; - modules = $null; - moduleScope = ""; -} # contains default configuration, can be overriden in psake-config.ps1 in directory with psake.psm1 or in directory with current build script - -$psake.build_success = $false # indicates that the current build was successful -$psake.build_script_file = $null # contains a System.IO.FileInfo for the current build script -$psake.build_script_dir = "" # contains a string with fully-qualified path to current build script - -LoadConfiguration - -export-modulemember -function Invoke-psake, Invoke-Task, Task, Properties, Include, FormatTaskName, TaskSetup, TaskTearDown, Framework, Assert, Exec -variable psake +# psake +# Copyright (c) 2012 James Kovacs +# 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. + +#Requires -Version 2.0 + +if ($PSVersionTable.PSVersion.Major -ge 3) +{ + $script:IgnoreError = 'Ignore' +} +else +{ + $script:IgnoreError = 'SilentlyContinue' +} + +#-- Public Module Functions --# + +# .ExternalHelp psake.psm1-help.xml +function Invoke-Task +{ + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)] [string]$taskName + ) + + Assert $taskName ($msgs.error_invalid_task_name) + + $taskKey = $taskName.ToLower() + + if ($currentContext.aliases.Contains($taskKey)) { + $taskName = $currentContext.aliases.$taskKey.Name + $taskKey = $taskName.ToLower() + } + + $currentContext = $psake.context.Peek() + + Assert ($currentContext.tasks.Contains($taskKey)) ($msgs.error_task_name_does_not_exist -f $taskName) + + if ($currentContext.executedTasks.Contains($taskKey)) { return } + + Assert (!$currentContext.callStack.Contains($taskKey)) ($msgs.error_circular_reference -f $taskName) + + $currentContext.callStack.Push($taskKey) + + $task = $currentContext.tasks.$taskKey + + $precondition_is_valid = & $task.Precondition + + if (!$precondition_is_valid) { + WriteColoredOutput ($msgs.precondition_was_false -f $taskName) -foregroundcolor Cyan + } else { + if ($taskKey -ne 'default') { + + if ($task.PreAction -or $task.PostAction) { + Assert ($task.Action -ne $null) ($msgs.error_missing_action_parameter -f $taskName) + } + + if ($task.Action) { + try { + foreach($childTask in $task.DependsOn) { + Invoke-Task $childTask + } + + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() + $currentContext.currentTaskName = $taskName + + & $currentContext.taskSetupScriptBlock + + if ($task.PreAction) { + & $task.PreAction + } + + if ($currentContext.config.taskNameFormat -is [ScriptBlock]) { + & $currentContext.config.taskNameFormat $taskName + } else { + WriteColoredOutput ($currentContext.config.taskNameFormat -f $taskName) -foregroundcolor Cyan + } + + foreach ($variable in $task.requiredVariables) { + Assert ((test-path "variable:$variable") -and ((get-variable $variable).Value -ne $null)) ($msgs.required_variable_not_set -f $variable, $taskName) + } + + & $task.Action + + if ($task.PostAction) { + & $task.PostAction + } + + & $currentContext.taskTearDownScriptBlock + $task.Duration = $stopwatch.Elapsed + } catch { + if ($task.ContinueOnError) { + "-"*70 + WriteColoredOutput ($msgs.continue_on_error -f $taskName,$_) -foregroundcolor Yellow + "-"*70 + $task.Duration = $stopwatch.Elapsed + } else { + throw $_ + } + } + } else { + # no action was specified but we still execute all the dependencies + foreach($childTask in $task.DependsOn) { + Invoke-Task $childTask + } + } + } else { + foreach($childTask in $task.DependsOn) { + Invoke-Task $childTask + } + } + + Assert (& $task.Postcondition) ($msgs.postcondition_failed -f $taskName) + } + + $poppedTaskKey = $currentContext.callStack.Pop() + Assert ($poppedTaskKey -eq $taskKey) ($msgs.error_corrupt_callstack -f $taskKey,$poppedTaskKey) + + $currentContext.executedTasks.Push($taskKey) +} + +# .ExternalHelp psake.psm1-help.xml +function Exec +{ + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][scriptblock]$cmd, + [Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd), + [Parameter(Position=2,Mandatory=0)][int]$maxRetries = 0, + [Parameter(Position=3,Mandatory=0)][string]$retryTriggerErrorPattern = $null + ) + + $tryCount = 1 + + do { + try { + $global:lastexitcode = 0 + & $cmd + if ($lastexitcode -ne 0) { + throw ("Exec: " + $errorMessage) + } + break + } + catch [Exception] + { + if ($tryCount -gt $maxRetries) { + throw $_ + } + + if ($retryTriggerErrorPattern -ne $null) { + $isMatch = [regex]::IsMatch($_.Exception.Message, $retryTriggerErrorPattern) + + if ($isMatch -eq $false) { + throw $_ + } + } + + Write-Host "Try $tryCount failed, retrying again in 1 second..." + + $tryCount++ + + [System.Threading.Thread]::Sleep([System.TimeSpan]::FromSeconds(1)) + } + } + while ($true) +} + +# .ExternalHelp psake.psm1-help.xml +function Assert +{ + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)]$conditionToCheck, + [Parameter(Position=1,Mandatory=1)]$failureMessage + ) + if (!$conditionToCheck) { + throw ("Assert: " + $failureMessage) + } +} + +# .ExternalHelp psake.psm1-help.xml +function Task +{ + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][string]$name = $null, + [Parameter(Position=1,Mandatory=0)][scriptblock]$action = $null, + [Parameter(Position=2,Mandatory=0)][scriptblock]$preaction = $null, + [Parameter(Position=3,Mandatory=0)][scriptblock]$postaction = $null, + [Parameter(Position=4,Mandatory=0)][scriptblock]$precondition = {$true}, + [Parameter(Position=5,Mandatory=0)][scriptblock]$postcondition = {$true}, + [Parameter(Position=6,Mandatory=0)][switch]$continueOnError = $false, + [Parameter(Position=7,Mandatory=0)][string[]]$depends = @(), + [Parameter(Position=8,Mandatory=0)][string[]]$requiredVariables = @(), + [Parameter(Position=9,Mandatory=0)][string]$description = $null, + [Parameter(Position=10,Mandatory=0)][string]$alias = $null + ) + if ($name -eq 'default') { + Assert (!$action) ($msgs.error_default_task_cannot_have_action) + } + + $newTask = @{ + Name = $name + DependsOn = $depends + PreAction = $preaction + Action = $action + PostAction = $postaction + Precondition = $precondition + Postcondition = $postcondition + ContinueOnError = $continueOnError + Description = $description + Duration = [System.TimeSpan]::Zero + RequiredVariables = $requiredVariables + Alias = $alias + } + + $taskKey = $name.ToLower() + + $currentContext = $psake.context.Peek() + + Assert (!$currentContext.tasks.ContainsKey($taskKey)) ($msgs.error_duplicate_task_name -f $name) + + $currentContext.tasks.$taskKey = $newTask + + if($alias) + { + $aliasKey = $alias.ToLower() + + Assert (!$currentContext.aliases.ContainsKey($aliasKey)) ($msgs.error_duplicate_alias_name -f $alias) + + $currentContext.aliases.$aliasKey = $newTask + } +} + +# .ExternalHelp psake.psm1-help.xml +function Properties { + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][scriptblock]$properties + ) + $psake.context.Peek().properties += $properties +} + +# .ExternalHelp psake.psm1-help.xml +function Include { + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][string]$fileNamePathToInclude + ) + Assert (test-path $fileNamePathToInclude -pathType Leaf) ($msgs.error_invalid_include_path -f $fileNamePathToInclude) + $psake.context.Peek().includes.Enqueue((Resolve-Path $fileNamePathToInclude)); +} + +# .ExternalHelp psake.psm1-help.xml +function FormatTaskName { + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)]$format + ) + $psake.context.Peek().config.taskNameFormat = $format +} + +# .ExternalHelp psake.psm1-help.xml +function TaskSetup { + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][scriptblock]$setup + ) + $psake.context.Peek().taskSetupScriptBlock = $setup +} + +# .ExternalHelp psake.psm1-help.xml +function TaskTearDown { + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][scriptblock]$teardown + ) + $psake.context.Peek().taskTearDownScriptBlock = $teardown +} + +# .ExternalHelp psake.psm1-help.xml +function Framework { + [CmdletBinding()] + param( + [Parameter(Position=0,Mandatory=1)][string]$framework + ) + $psake.context.Peek().config.framework = $framework + ConfigureBuildEnvironment +} + +# .ExternalHelp psake.psm1-help.xml +function Get-PSakeScriptTasks { + [CmdletBinding()] + param( + [Parameter(Position = 0, Mandatory = 0)][string] $buildFile + ) + + if (!$buildFile) { + $buildFile = $psake.config_default.buildFileName + } + + try + { + ExecuteInBuildFileScope $buildFile $MyInvocation.MyCommand.Module { + param($currentContext, $module) + return GetTasksFromContext $currentContext + } + + } finally { + + CleanupEnvironment + } +} + +# .ExternalHelp psake.psm1-help.xml +function Invoke-psake { + [CmdletBinding()] + param( + [Parameter(Position = 0, Mandatory = 0)][string] $buildFile, + [Parameter(Position = 1, Mandatory = 0)][string[]] $taskList = @(), + [Parameter(Position = 2, Mandatory = 0)][string] $framework, + [Parameter(Position = 3, Mandatory = 0)][switch] $docs = $false, + [Parameter(Position = 4, Mandatory = 0)][hashtable] $parameters = @{}, + [Parameter(Position = 5, Mandatory = 0)][hashtable] $properties = @{}, + [Parameter(Position = 6, Mandatory = 0)][alias("init")][scriptblock] $initialization = {}, + [Parameter(Position = 7, Mandatory = 0)][switch] $nologo = $false, + [Parameter(Position = 8, Mandatory = 0)][switch] $detailedDocs = $false, + [Parameter(Position = 9, Mandatory = 0)][switch] $notr = $false # disable time report + ) + try { + if (-not $nologo) { + "psake version {0}`nCopyright (c) 2010-2014 James Kovacs & Contributors`n" -f $psake.version + } + + if (!$buildFile) { + $buildFile = $psake.config_default.buildFileName + } + elseif (!(test-path $buildFile -pathType Leaf) -and (test-path $psake.config_default.buildFileName -pathType Leaf)) { + # If the $config.buildFileName file exists and the given "buildfile" isn't found assume that the given + # $buildFile is actually the target Tasks to execute in the $config.buildFileName script. + $taskList = $buildFile.Split(', ') + $buildFile = $psake.config_default.buildFileName + } + + ExecuteInBuildFileScope $buildFile $MyInvocation.MyCommand.Module { + param($currentContext, $module) + + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() + + if ($docs -or $detailedDocs) { + WriteDocumentation($detailedDocs) + return + } + + foreach ($key in $parameters.keys) { + if (test-path "variable:\$key") { + set-item -path "variable:\$key" -value $parameters.$key -WhatIf:$false -Confirm:$false | out-null + } else { + new-item -path "variable:\$key" -value $parameters.$key -WhatIf:$false -Confirm:$false | out-null + } + } + + # The initial dot (.) indicates that variables initialized/modified in the propertyBlock are available in the parent scope. + foreach ($propertyBlock in $currentContext.properties) { + . $propertyBlock + } + + foreach ($key in $properties.keys) { + if (test-path "variable:\$key") { + set-item -path "variable:\$key" -value $properties.$key -WhatIf:$false -Confirm:$false | out-null + } + } + + # Simple dot sourcing will not work. We have to force the script block into our + # module's scope in order to initialize variables properly. + . $module $initialization + + # Execute the list of tasks or the default task + if ($taskList) { + foreach ($task in $taskList) { + invoke-task $task + } + } elseif ($currentContext.tasks.default) { + invoke-task default + } else { + throw $msgs.error_no_default_task + } + + WriteColoredOutput ("`n" + $msgs.build_success + "`n") -foregroundcolor Green + + $stopwatch.Stop() + if (-not $notr) { + WriteTaskTimeSummary $stopwatch.Elapsed + } + } + + $psake.build_success = $true + + } catch { + $currentConfig = GetCurrentConfigurationOrDefault + if ($currentConfig.verboseError) { + $error_message = "{0}: An Error Occurred. See Error Details Below: `n" -f (Get-Date) + $error_message += ("-" * 70) + "`n" + $error_message += "Error: {0}`n" -f (ResolveError $_ -Short) + $error_message += ("-" * 70) + "`n" + $error_message += ResolveError $_ + $error_message += ("-" * 70) + "`n" + $error_message += "Script Variables" + "`n" + $error_message += ("-" * 70) + "`n" + $error_message += get-variable -scope script | format-table | out-string + } else { + # ($_ | Out-String) gets error messages with source information included. + $error_message = "Error: {0}: `n{1}" -f (Get-Date), (ResolveError $_ -Short) + } + + $psake.build_success = $false + + # if we are running in a nested scope (i.e. running a psake script from a psake script) then we need to re-throw the exception + # so that the parent script will fail otherwise the parent script will report a successful build + $inNestedScope = ($psake.context.count -gt 1) + if ( $inNestedScope ) { + throw $_ + } else { + if (!$psake.run_by_psake_build_tester) { + WriteColoredOutput $error_message -foregroundcolor Red + } + } + } finally { + CleanupEnvironment + } +} + +#-- Private Module Functions --# +function WriteColoredOutput { + param( + [string] $message, + [System.ConsoleColor] $foregroundcolor + ) + + $currentConfig = GetCurrentConfigurationOrDefault + if ($currentConfig.coloredOutput -eq $true) { + if (($Host.UI -ne $null) -and ($Host.UI.RawUI -ne $null) -and ($Host.UI.RawUI.ForegroundColor -ne $null)) { + $previousColor = $Host.UI.RawUI.ForegroundColor + $Host.UI.RawUI.ForegroundColor = $foregroundcolor + } + } + + $message + + if ($previousColor -ne $null) { + $Host.UI.RawUI.ForegroundColor = $previousColor + } +} + +function LoadModules { + $currentConfig = $psake.context.peek().config + if ($currentConfig.modules) { + + $scope = $currentConfig.moduleScope + + $global = [string]::Equals($scope, "global", [StringComparison]::CurrentCultureIgnoreCase) + + $currentConfig.modules | foreach { + resolve-path $_ | foreach { + "Loading module: $_" + $module = import-module $_ -passthru -DisableNameChecking -global:$global + if (!$module) { + throw ($msgs.error_loading_module -f $_.Name) + } + } + } + "" + } +} + +function LoadConfiguration { + param( + [string] $configdir = $PSScriptRoot + ) + + $psakeConfigFilePath = (join-path $configdir "psake-config.ps1") + + if (test-path $psakeConfigFilePath -pathType Leaf) { + try { + $config = GetCurrentConfigurationOrDefault + . $psakeConfigFilePath + } catch { + throw "Error Loading Configuration from psake-config.ps1: " + $_ + } + } +} + +function GetCurrentConfigurationOrDefault() { + if ($psake.context.count -gt 0) { + return $psake.context.peek().config + } else { + return $psake.config_default + } +} + +function CreateConfigurationForNewContext { + param( + [string] $buildFile, + [string] $framework + ) + + $previousConfig = GetCurrentConfigurationOrDefault + + $config = new-object psobject -property @{ + buildFileName = $previousConfig.buildFileName; + framework = $previousConfig.framework; + taskNameFormat = $previousConfig.taskNameFormat; + verboseError = $previousConfig.verboseError; + coloredOutput = $previousConfig.coloredOutput; + modules = $previousConfig.modules; + moduleScope = $previousConfig.moduleScope; + } + + if ($framework) { + $config.framework = $framework; + } + + if ($buildFile) { + $config.buildFileName = $buildFile; + } + + return $config +} + +function ConfigureBuildEnvironment { + $framework = $psake.context.peek().config.framework + if ($framework -cmatch '^((?:\d+\.\d+)(?:\.\d+){0,1})(x86|x64){0,1}$') { + $versionPart = $matches[1] + $bitnessPart = $matches[2] + } else { + throw ($msgs.error_invalid_framework -f $framework) + } + $versions = $null + $buildToolsVersions = $null + switch ($versionPart) { + '1.0' { + $versions = @('v1.0.3705') + } + '1.1' { + $versions = @('v1.1.4322') + } + '2.0' { + $versions = @('v2.0.50727') + } + '3.0' { + $versions = @('v2.0.50727') + } + '3.5' { + $versions = @('v3.5', 'v2.0.50727') + } + '4.0' { + $versions = @('v4.0.30319') + } + {($_ -eq '4.5.1') -or ($_ -eq '4.5.2')} { + $versions = @('v4.0.30319') + $buildToolsVersions = @('14.0', '12.0') + } + {($_ -eq '4.6') -or ($_ -eq '4.6.1')} { + $versions = @('v4.0.30319') + $buildToolsVersions = @('14.0') + } + + default { + throw ($msgs.error_unknown_framework -f $versionPart, $framework) + } + } + + $bitness = 'Framework' + if ($versionPart -ne '1.0' -and $versionPart -ne '1.1') { + switch ($bitnessPart) { + 'x86' { + $bitness = 'Framework' + $buildToolsKey = 'MSBuildToolsPath32' + } + 'x64' { + $bitness = 'Framework64' + $buildToolsKey = 'MSBuildToolsPath' + } + { [string]::IsNullOrEmpty($_) } { + $ptrSize = [System.IntPtr]::Size + switch ($ptrSize) { + 4 { + $bitness = 'Framework' + $buildToolsKey = 'MSBuildToolsPath32' + } + 8 { + $bitness = 'Framework64' + $buildToolsKey = 'MSBuildToolsPath' + } + default { + throw ($msgs.error_unknown_pointersize -f $ptrSize) + } + } + } + default { + throw ($msgs.error_unknown_bitnesspart -f $bitnessPart, $framework) + } + } + } + $frameworkDirs = @() + if ($buildToolsVersions -ne $null) { + foreach($ver in $buildToolsVersions) { + if (Test-Path "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$ver") { + $frameworkDirs += (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$ver" -Name $buildToolsKey).$buildToolsKey + } + } + } + $frameworkDirs = $frameworkDirs + @($versions | foreach { "$env:windir\Microsoft.NET\$bitness\$_\" }) + + for ($i = 0; $i -lt $frameworkDirs.Count; $i++) { + $dir = $frameworkDirs[$i] + if ($dir -Match "\$\(Registry:HKEY_LOCAL_MACHINE(.*?)@(.*)\)") { + $key = "HKLM:" + $matches[1] + $name = $matches[2] + $dir = (Get-ItemProperty -Path $key -Name $name).$name + $frameworkDirs[$i] = $dir + } + } + + $frameworkDirs | foreach { Assert (test-path $_ -pathType Container) ($msgs.error_no_framework_install_dir_found -f $_)} + + $env:path = ($frameworkDirs -join ";") + ";$env:path" + # if any error occurs in a PS function then "stop" processing immediately + # this does not effect any external programs that return a non-zero exit code + $global:ErrorActionPreference = "Stop" +} + +function ExecuteInBuildFileScope { + param([string]$buildFile, $module, [scriptblock]$sb) + + # Execute the build file to set up the tasks and defaults + Assert (test-path $buildFile -pathType Leaf) ($msgs.error_build_file_not_found -f $buildFile) + + $psake.build_script_file = get-item $buildFile + $psake.build_script_dir = $psake.build_script_file.DirectoryName + $psake.build_success = $false + + $psake.context.push(@{ + "taskSetupScriptBlock" = {}; + "taskTearDownScriptBlock" = {}; + "executedTasks" = new-object System.Collections.Stack; + "callStack" = new-object System.Collections.Stack; + "originalEnvPath" = $env:path; + "originalDirectory" = get-location; + "originalErrorActionPreference" = $global:ErrorActionPreference; + "tasks" = @{}; + "aliases" = @{}; + "properties" = @(); + "includes" = new-object System.Collections.Queue; + "config" = CreateConfigurationForNewContext $buildFile $framework + }) + + LoadConfiguration $psake.build_script_dir + + set-location $psake.build_script_dir + + LoadModules + + $frameworkOldValue = $framework + . $psake.build_script_file.FullName + + $currentContext = $psake.context.Peek() + + if ($framework -ne $frameworkOldValue) { + writecoloredoutput $msgs.warning_deprecated_framework_variable -foregroundcolor Yellow + $currentContext.config.framework = $framework + } + + ConfigureBuildEnvironment + + while ($currentContext.includes.Count -gt 0) { + $includeFilename = $currentContext.includes.Dequeue() + . $includeFilename + } + + & $sb $currentContext $module +} + +function CleanupEnvironment { + if ($psake.context.Count -gt 0) { + $currentContext = $psake.context.Peek() + $env:path = $currentContext.originalEnvPath + Set-Location $currentContext.originalDirectory + $global:ErrorActionPreference = $currentContext.originalErrorActionPreference + [void] $psake.context.Pop() + } +} + +function SelectObjectWithDefault +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline=$true)] + [PSObject] + $InputObject, + [string] + $Name, + $Value + ) + + process { + if ($_ -eq $null) { $Value } + elseif ($_ | Get-Member -Name $Name) { + $_.$Name + } + elseif (($_ -is [Hashtable]) -and ($_.Keys -contains $Name)) { + $_.$Name + } + else { $Value } + } +} + +# borrowed from Jeffrey Snover http://blogs.msdn.com/powershell/archive/2006/12/07/resolve-error.aspx +# modified to better handle SQL errors +function ResolveError +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline=$true)] + $ErrorRecord=$Error[0], + [Switch] + $Short + ) + + process { + if ($_ -eq $null) { $_ = $ErrorRecord } + $ex = $_.Exception + + if (-not $Short) { + $error_message = "`nErrorRecord:{0}ErrorRecord.InvocationInfo:{1}Exception:`n{2}" + $formatted_errorRecord = $_ | format-list * -force | out-string + $formatted_invocationInfo = $_.InvocationInfo | format-list * -force | out-string + $formatted_exception = '' + + $i = 0 + while ($ex -ne $null) { + $i++ + $formatted_exception += ("$i" * 70) + "`n" + + ($ex | format-list * -force | out-string) + "`n" + $ex = $ex | SelectObjectWithDefault -Name 'InnerException' -Value $null + } + + return $error_message -f $formatted_errorRecord, $formatted_invocationInfo, $formatted_exception + } + + $lastException = @() + while ($ex -ne $null) { + $lastMessage = $ex | SelectObjectWithDefault -Name 'Message' -Value '' + $lastException += ($lastMessage -replace "`n", '') + if ($ex -is [Data.SqlClient.SqlException]) { + $lastException += "(Line [$($ex.LineNumber)] " + + "Procedure [$($ex.Procedure)] Class [$($ex.Class)] " + + " Number [$($ex.Number)] State [$($ex.State)] )" + } + $ex = $ex | SelectObjectWithDefault -Name 'InnerException' -Value $null + } + $shortException = $lastException -join ' --> ' + + $header = $null + $current = $_ + $header = (($_.InvocationInfo | + SelectObjectWithDefault -Name 'PositionMessage' -Value '') -replace "`n", ' '), + ($_ | SelectObjectWithDefault -Name 'Message' -Value ''), + ($_ | SelectObjectWithDefault -Name 'Exception' -Value '') | + ? { -not [String]::IsNullOrEmpty($_) } | + Select -First 1 + + $delimiter = '' + if ((-not [String]::IsNullOrEmpty($header)) -and + (-not [String]::IsNullOrEmpty($shortException))) + { $delimiter = ' [<<==>>] ' } + + return "$($header)$($delimiter)Exception: $($shortException)" + } +} + +function GetTasksFromContext($currentContext) { + + $docs = $currentContext.tasks.Keys | foreach-object { + + $task = $currentContext.tasks.$_ + new-object PSObject -property @{ + Name = $task.Name; + Alias = $task.Alias; + Description = $task.Description; + DependsOn = $task.DependsOn; + } + } + + return $docs +} + +function WriteDocumentation($showDetailed) { + + $currentContext = $psake.context.Peek() + + if ($currentContext.tasks.default) { + $defaultTaskDependencies = $currentContext.tasks.default.DependsOn + } else { + $defaultTaskDependencies = @() + } + + $docs = GetTasksFromContext $currentContext | + Where {$_.Name -ne 'default'} | + ForEach { + $isDefault = $null + if ($defaultTaskDependencies -contains $_.Name) { + $isDefault = $true + } + return Add-Member -InputObject $_ 'Default' $isDefault -PassThru + } + + if ($showDetailed) { + $docs | sort 'Name' | format-list -property Name,Alias,Description,@{Label="Depends On";Expression={$_.DependsOn -join ', '}},Default + } else { + $docs | sort 'Name' | format-table -autoSize -wrap -property Name,Alias,@{Label="Depends On";Expression={$_.DependsOn -join ', '}},Default,Description + } +} + +function WriteTaskTimeSummary($invokePsakeDuration) { + if ($psake.context.count -gt 0) { + "-" * 70 + "Build Time Report" + "-" * 70 + $list = @() + $currentContext = $psake.context.Peek() + while ($currentContext.executedTasks.Count -gt 0) { + $taskKey = $currentContext.executedTasks.Pop() + $task = $currentContext.tasks.$taskKey + if ($taskKey -eq "default") { + continue + } + $list += new-object PSObject -property @{ + Name = $task.Name; + Duration = $task.Duration + } + } + [Array]::Reverse($list) + $list += new-object PSObject -property @{ + Name = "Total:"; + Duration = $invokePsakeDuration + } + # using "out-string | where-object" to filter out the blank line that format-table prepends + $list | format-table -autoSize -property Name,Duration | out-string -stream | where-object { $_ } + } +} + +DATA msgs { +convertfrom-stringdata @' + error_invalid_task_name = Task name should not be null or empty string. + error_task_name_does_not_exist = Task {0} does not exist. + error_circular_reference = Circular reference found for task {0}. + error_missing_action_parameter = Action parameter must be specified when using PreAction or PostAction parameters for task {0}. + error_corrupt_callstack = Call stack was corrupt. Expected {0}, but got {1}. + error_invalid_framework = Invalid .NET Framework version, {0} specified. + error_unknown_framework = Unknown .NET Framework version, {0} specified in {1}. + error_unknown_pointersize = Unknown pointer size ({0}) returned from System.IntPtr. + error_unknown_bitnesspart = Unknown .NET Framework bitness, {0}, specified in {1}. + error_no_framework_install_dir_found = No .NET Framework installation directory found at {0}. + error_bad_command = Error executing command {0}. + error_default_task_cannot_have_action = 'default' task cannot specify an action. + error_duplicate_task_name = Task {0} has already been defined. + error_duplicate_alias_name = Alias {0} has already been defined. + error_invalid_include_path = Unable to include {0}. File not found. + error_build_file_not_found = Could not find the build file {0}. + error_no_default_task = 'default' task required. + error_loading_module = Error loading module {0}. + warning_deprecated_framework_variable = Warning: Using global variable $framework to set .NET framework version used is deprecated. Instead use Framework function or configuration file psake-config.ps1. + required_variable_not_set = Variable {0} must be set to run task {1}. + postcondition_failed = Postcondition failed for task {0}. + precondition_was_false = Precondition was false, not executing task {0}. + continue_on_error = Error in task {0}. {1} + build_success = Build Succeeded! +'@ +} + +Import-LocalizedData -BindingVariable msgs -FileName messages.psd1 -ErrorAction $script:IgnoreError + +$scriptDir = Split-Path $MyInvocation.MyCommand.Path +$manifestPath = Join-Path $scriptDir psake.psd1 +$manifest = Test-ModuleManifest -Path $manifestPath -WarningAction SilentlyContinue + +$script:psake = @{} + +$psake.version = $manifest.Version.ToString() +$psake.context = new-object system.collections.stack # holds onto the current state of all variables +$psake.run_by_psake_build_tester = $false # indicates that build is being run by psake-BuildTester +$psake.config_default = new-object psobject -property @{ + buildFileName = "default.ps1"; + framework = "4.0"; + taskNameFormat = "Executing {0}"; + verboseError = $false; + coloredOutput = $true; + modules = $null; + moduleScope = ""; +} # contains default configuration, can be overridden in psake-config.ps1 in directory with psake.psm1 or in directory with current build script + +$psake.build_success = $false # indicates that the current build was successful +$psake.build_script_file = $null # contains a System.IO.FileInfo for the current build script +$psake.build_script_dir = "" # contains a string with fully-qualified path to current build script + +LoadConfiguration + +export-modulemember -function Invoke-psake, Invoke-Task, Get-PSakeScriptTasks, Task, Properties, Include, FormatTaskName, TaskSetup, TaskTearDown, Framework, Assert, Exec -variable psake diff --git a/src/.nuget/NuGet.exe b/src/.nuget/NuGet.exe deleted file mode 100644 index 31fc9885e4..0000000000 Binary files a/src/.nuget/NuGet.exe and /dev/null differ diff --git a/src/.nuget/NuGet.targets b/src/.nuget/NuGet.targets deleted file mode 100644 index 83fe906016..0000000000 --- a/src/.nuget/NuGet.targets +++ /dev/null @@ -1,136 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - false - - - false - - - true - - - false - - - - - - - - - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) - - - - - $(SolutionDir).nuget - packages.config - - - - - $(NuGetToolsPath)\NuGet.exe - @(PackageSource) - - "$(NuGetExePath)" - mono --runtime=v4.0.30319 $(NuGetExePath) - - $(TargetDir.Trim('\\')) - - -RequireConsent - -NonInteractive - - "$(SolutionDir) " - "$(SolutionDir)" - - - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) - $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AutoMapper.Net4/AutoMapper.Net4.csproj b/src/AutoMapper.Net4/AutoMapper.Net4.csproj deleted file mode 100644 index bf298d3ad7..0000000000 --- a/src/AutoMapper.Net4/AutoMapper.Net4.csproj +++ /dev/null @@ -1,72 +0,0 @@ - - - - - Debug - AnyCPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9} - Library - Properties - AutoMapper - AutoMapper - v4.5 - 512 - - - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET45 - prompt - 4 - bin\Debug\AutoMapper.XML - false - 1591 - - - pdbonly - true - bin\Release\ - TRACE;NET4 - prompt - 4 - bin\Release\AutoMapper.XML - false - 1591 - - - true - - - ..\AutoMapper.snk - - - - - - - - - %(RecursiveDir)%(Filename)%(Extension) - - - - - AutoMapper.snk - - - - - - - - \ No newline at end of file diff --git a/src/AutoMapper.Portable/AutoMapper.Portable.csproj b/src/AutoMapper.Portable/AutoMapper.Portable.csproj deleted file mode 100644 index 2b459443bf..0000000000 --- a/src/AutoMapper.Portable/AutoMapper.Portable.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - - 10.0 - Debug - AnyCPU - {7FF22411-6E09-4504-BFE6-F1489C927E61} - Library - Properties - AutoMapper - AutoMapper - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile111 - v4.5 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;PORTABLE - prompt - 4 - bin\Debug\AutoMapper.XML - false - 1591 - - - pdbonly - true - bin\Release\ - TRACE;PORTABLE - prompt - 4 - bin\Release\AutoMapper.XML - false - 1591 - - - true - - - ..\AutoMapper.snk - - - - - - - - - %(RecursiveDir)%(Filename)%(Extension) - - - - - AutoMapper.snk - - - - - - - - \ No newline at end of file diff --git a/src/AutoMapper.Portable/ClassLibrary1.csproj b/src/AutoMapper.Portable/ClassLibrary1.csproj deleted file mode 100644 index 520540dc56..0000000000 --- a/src/AutoMapper.Portable/ClassLibrary1.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - - 10.0 - Debug - AnyCPU - {273a9243-2ffd-485e-9645-312a10a75bf9} - Library - Properties - ClassLibrary1 - ClassLibrary1 - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile111 - v4.5 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - diff --git a/src/AutoMapper.sln b/src/AutoMapper.sln deleted file mode 100644 index 4c2b2b4e72..0000000000 --- a/src/AutoMapper.sln +++ /dev/null @@ -1,172 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0691ABF2-B3C7-43BF-9862-2D8D1299CE58}" - ProjectSection(SolutionItems) = preProject - AutoMapper.targets = AutoMapper.targets - ..\default.ps1 = ..\default.ps1 - ..\global.json = ..\global.json - NuGet.config = NuGet.config - ..\psake.bat = ..\psake.bat - ..\README.md = ..\README.md - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Net4", "UnitTests\UnitTests.Net4.csproj", "{002075C5-6517-4794-BC99-9B17B9E884E7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapperSamples", "AutoMapperSamples\AutoMapperSamples.csproj", "{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{C1930F52-C66E-4E56-B7DB-FD42E497FFF0}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1BCC7A00-6382-4891-936A-F164614D26A4}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.Net4", "IntegrationTests.Net4\IntegrationTests.Net4.csproj", "{906F2125-2AEC-44A3-A95F-CB79C0A745BB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1A726C5A-1BDC-4275-95EB-1FAFCCCB4F20}" - ProjectSection(SolutionItems) = preProject - .nuget\NuGet.exe = .nuget\NuGet.exe - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoMapper", "AutoMapper\AutoMapper.xproj", "{35888286-1428-4BF3-BB0C-D8BC092D0A5D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapper.Net4", "AutoMapper.Net4\AutoMapper.Net4.csproj", "{8C955148-FA96-4F0D-880D-ABB6770F54E9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapper.Portable", "AutoMapper.Portable\AutoMapper.Portable.csproj", "{7FF22411-6E09-4504-BFE6-F1489C927E61}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Portable", "UnitTests.Portable\UnitTests.Portable.csproj", "{273A9243-2FFD-485E-9645-312A10A75BF9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|ARM.ActiveCfg = Debug|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|x64.ActiveCfg = Debug|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Debug|x86.ActiveCfg = Debug|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|Any CPU.Build.0 = Release|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|ARM.ActiveCfg = Release|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|x64.ActiveCfg = Release|Any CPU - {002075C5-6517-4794-BC99-9B17B9E884E7}.Release|x86.ActiveCfg = Release|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|ARM.ActiveCfg = Debug|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|x64.ActiveCfg = Debug|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|x86.ActiveCfg = Debug|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|Any CPU.Build.0 = Release|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|ARM.ActiveCfg = Release|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|x64.ActiveCfg = Release|Any CPU - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|x86.ActiveCfg = Release|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|ARM.ActiveCfg = Debug|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|x64.ActiveCfg = Debug|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Release|Any CPU.Build.0 = Release|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Release|ARM.ActiveCfg = Release|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Release|x64.ActiveCfg = Release|Any CPU - {B8051389-CB47-46FB-B234-9D49506704AA}.Release|x86.ActiveCfg = Release|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Debug|ARM.ActiveCfg = Debug|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Debug|x64.ActiveCfg = Debug|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Debug|x86.ActiveCfg = Debug|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Release|Any CPU.Build.0 = Release|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Release|ARM.ActiveCfg = Release|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Release|x64.ActiveCfg = Release|Any CPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB}.Release|x86.ActiveCfg = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|ARM.ActiveCfg = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|ARM.Build.0 = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x64.ActiveCfg = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x64.Build.0 = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x86.ActiveCfg = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Debug|x86.Build.0 = Debug|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|Any CPU.Build.0 = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|ARM.ActiveCfg = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|ARM.Build.0 = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x64.ActiveCfg = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x64.Build.0 = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x86.ActiveCfg = Release|Any CPU - {35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x86.Build.0 = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|ARM.ActiveCfg = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|ARM.Build.0 = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|x64.ActiveCfg = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|x64.Build.0 = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|x86.ActiveCfg = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Debug|x86.Build.0 = Debug|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|Any CPU.Build.0 = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|ARM.ActiveCfg = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|ARM.Build.0 = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|x64.ActiveCfg = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|x64.Build.0 = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|x86.ActiveCfg = Release|Any CPU - {8C955148-FA96-4F0D-880D-ABB6770F54E9}.Release|x86.Build.0 = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|ARM.Build.0 = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|x64.ActiveCfg = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|x64.Build.0 = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|x86.ActiveCfg = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Debug|x86.Build.0 = Debug|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|Any CPU.Build.0 = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|ARM.ActiveCfg = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|ARM.Build.0 = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|x64.ActiveCfg = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|x64.Build.0 = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|x86.ActiveCfg = Release|Any CPU - {7FF22411-6E09-4504-BFE6-F1489C927E61}.Release|x86.Build.0 = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|ARM.ActiveCfg = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|ARM.Build.0 = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|x64.ActiveCfg = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|x64.Build.0 = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|x86.ActiveCfg = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Debug|x86.Build.0 = Debug|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|Any CPU.Build.0 = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|ARM.ActiveCfg = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|ARM.Build.0 = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|x64.ActiveCfg = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|x64.Build.0 = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|x86.ActiveCfg = Release|Any CPU - {273A9243-2FFD-485E-9645-312A10A75BF9}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {002075C5-6517-4794-BC99-9B17B9E884E7} = {1BCC7A00-6382-4891-936A-F164614D26A4} - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7} = {B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD} - {B8051389-CB47-46FB-B234-9D49506704AA} = {1BCC7A00-6382-4891-936A-F164614D26A4} - {906F2125-2AEC-44A3-A95F-CB79C0A745BB} = {1BCC7A00-6382-4891-936A-F164614D26A4} - {35888286-1428-4BF3-BB0C-D8BC092D0A5D} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0} - {8C955148-FA96-4F0D-880D-ABB6770F54E9} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0} - {7FF22411-6E09-4504-BFE6-F1489C927E61} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0} - {273A9243-2FFD-485E-9645-312A10A75BF9} = {1BCC7A00-6382-4891-936A-F164614D26A4} - EndGlobalSection -EndGlobal diff --git a/src/AutoMapper/AdvancedConfiguration.cs b/src/AutoMapper/AdvancedConfiguration.cs new file mode 100644 index 0000000000..78b99c9a44 --- /dev/null +++ b/src/AutoMapper/AdvancedConfiguration.cs @@ -0,0 +1,44 @@ +using AutoMapper.QueryableExtensions; +using System; +using System.Collections.Generic; + +namespace AutoMapper +{ + using Validator = Action; + + public class AdvancedConfiguration + { + private readonly List _validators = new List(); + private readonly IList> _beforeSealActions = new List>(); + public IEnumerable> BeforeSealActions => _beforeSealActions; + + /// + /// Add Action called against the IConfigurationProvider before it gets sealed + /// + public void BeforeSeal(Action action) => _beforeSealActions.Add(action); + + /// + /// Add an action to be called when validating the configuration. + /// + /// the validation callback + public void Validator(Validator validator) => _validators.Add(validator); + + /// + /// Allow the same map to exist in different profiles. + /// The default is to throw an exception, true means the maps are merged. + /// + public bool AllowAdditiveTypeMapCreation { get; set; } + + /// + /// How many levels deep should AutoMapper try to inline the execution plan for child classes. + /// See the docs for details. + /// + public int MaxExecutionPlanDepth { get; set; } = 1; + + internal Validator[] GetValidators() => _validators.ToArray(); + + public List QueryableResultConverters { get; } = ExpressionBuilder.DefaultResultConverters(); + + public List QueryableBinders { get; } = ExpressionBuilder.DefaultBinders(); + } +} diff --git a/src/AutoMapper/AssemblyInfo.cs b/src/AutoMapper/AssemblyInfo.cs index c3b25c1ca1..0e62ae86a3 100644 --- a/src/AutoMapper/AssemblyInfo.cs +++ b/src/AutoMapper/AssemblyInfo.cs @@ -1,3 +1,9 @@ using System; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; -[assembly:CLSCompliant(true)] \ No newline at end of file +[assembly: CLSCompliant(true)] +[assembly: AllowPartiallyTrustedCallers] +[assembly: ComVisible(false)] +[assembly: NeutralResourcesLanguage("en")] \ No newline at end of file diff --git a/src/AutoMapper/AutoMapAttribute.cs b/src/AutoMapper/AutoMapAttribute.cs new file mode 100644 index 0000000000..153c73f24a --- /dev/null +++ b/src/AutoMapper/AutoMapAttribute.cs @@ -0,0 +1,86 @@ +using System; + +namespace AutoMapper +{ + /// + /// Auto map to this destination type from the specified source type. + /// Discovered during scanning assembly scanning for configuration when calling + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct)] + public sealed class AutoMapAttribute : Attribute + { + public AutoMapAttribute(Type sourceType) + => SourceType = sourceType; + + public Type SourceType { get; } + public bool ReverseMap { get; set; } + + /// + /// If set to true, construct the destination object using the service locator. + /// + public bool ConstructUsingServiceLocator { get; set; } + + /// + /// For self-referential types, limit recurse depth. + /// + public int MaxDepth { get; set; } + + /// + /// If set to true, preserve object identity. Useful for circular references. + /// + public bool PreserveReferences { get; set; } + + /// + /// If set to true, disable constructor validation. + /// + public bool DisableCtorValidation { get; set; } + + /// + /// If set to true, include this configuration in all derived types' maps. + /// + public bool IncludeAllDerived { get; set; } + + /// + /// Skip normal member mapping and convert using a instantiated during mapping. + /// + public Type TypeConverter { get; set; } + + public void ApplyConfiguration(IMappingExpression mappingExpression) + { + if (ReverseMap) + { + mappingExpression.ReverseMap(); + } + + if (ConstructUsingServiceLocator) + { + mappingExpression.ConstructUsingServiceLocator(); + } + + if (MaxDepth > 0) + { + mappingExpression.MaxDepth(MaxDepth); + } + + if (PreserveReferences) + { + mappingExpression.PreserveReferences(); + } + + if (DisableCtorValidation) + { + mappingExpression.DisableCtorValidation(); + } + + if (IncludeAllDerived) + { + mappingExpression.IncludeAllDerived(); + } + + if (TypeConverter != null) + { + mappingExpression.ConvertUsing(TypeConverter); + } + } + } +} diff --git a/src/AutoMapper/AutoMapper.csproj b/src/AutoMapper/AutoMapper.csproj new file mode 100644 index 0000000000..1e03b0bdf5 --- /dev/null +++ b/src/AutoMapper/AutoMapper.csproj @@ -0,0 +1,36 @@ + + + + A convention-based object-object mapper. + A convention-based object-object mapper. + netstandard2.0;net461 + true + AutoMapper + ..\..\AutoMapper.snk + true + true + AutoMapper + https://s3.amazonaws.com/automapper/icon.png + https://automapper.org + https://github.com/AutoMapper/AutoMapper/blob/master/LICENSE.txt + git + https://github.com/AutoMapper/AutoMapper + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + 8.1.0.1 + + + + + + + + + + + + + + + + diff --git a/src/AutoMapper/AutoMapper.xproj b/src/AutoMapper/AutoMapper.xproj deleted file mode 100644 index d0dd9edd8c..0000000000 --- a/src/AutoMapper/AutoMapper.xproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - 35888286-1428-4bf3-bb0c-d8bc092d0a5d - AutoMapper - .\obj - .\bin\ - - - AutoMapper - - - 2.0 - - - - - - - - \ No newline at end of file diff --git a/src/AutoMapper/AutoMapperConfigurationException.cs b/src/AutoMapper/AutoMapperConfigurationException.cs index 82ad44dc70..60cafd1e3e 100644 --- a/src/AutoMapper/AutoMapperConfigurationException.cs +++ b/src/AutoMapper/AutoMapperConfigurationException.cs @@ -1,123 +1,128 @@ -namespace AutoMapper -{ - using System; - using System.Linq; - using System.Text; - - public class AutoMapperConfigurationException : Exception - { - public TypeMapConfigErrors[] Errors { get; } - public ResolutionContext Context { get; } - public PropertyMap PropertyMap { get; set; } - - public class TypeMapConfigErrors - { - public TypeMap TypeMap { get; } - public string[] UnmappedPropertyNames { get; } - - public TypeMapConfigErrors(TypeMap typeMap, string[] unmappedPropertyNames) - { - TypeMap = typeMap; - UnmappedPropertyNames = unmappedPropertyNames; - } - } - - public AutoMapperConfigurationException(string message) - : base(message) - { - } - - protected AutoMapperConfigurationException(string message, Exception inner) - : base(message, inner) - { - } - - public AutoMapperConfigurationException(TypeMapConfigErrors[] errors) - { - Errors = errors; - } - - public AutoMapperConfigurationException(ResolutionContext context) - { - Context = context; - } - - public override string Message - { - get - { - if (Context != null) - { - var message = - string.Format( - "The following property on {0} cannot be mapped: \n\t{2}\nAdd a custom mapping expression, ignore, add a custom resolver, or modify the destination type {1}.", - Context.DestinationType.FullName, Context.DestinationType.FullName, - PropertyMap.DestinationProperty.Name); - - message += "\nContext:"; - - Exception exToUse = this; - while (exToUse != null) - { - var configExc = exToUse as AutoMapperConfigurationException; - if (configExc != null) - { message += configExc.PropertyMap == null - ? string.Format("\n\tMapping from type {1} to {0}", configExc.Context.DestinationType.FullName, - configExc.Context.SourceType.FullName) - : string.Format("\n\tMapping to property {0} from {2} to {1}", - configExc.PropertyMap.DestinationProperty.Name, - configExc.Context.DestinationType.FullName, configExc.Context.SourceType.FullName); - } - - exToUse = exToUse.InnerException; - } - - return message + "\n" + base.Message; - } - if (Errors != null) - { - var message = - new StringBuilder( - "\nUnmapped members were found. Review the types and members below.\nAdd a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type\n"); - - foreach (var error in Errors) - { - var len = error.TypeMap.SourceType.FullName.Length + - error.TypeMap.DestinationType.FullName.Length + 5; - - message.AppendLine(new string('=', len)); - message.AppendLine(error.TypeMap.SourceType.Name + " -> " + error.TypeMap.DestinationType.Name + - " (" + - error.TypeMap.ConfiguredMemberList + " member list)"); - message.AppendLine(error.TypeMap.SourceType.FullName + " -> " + - error.TypeMap.DestinationType.FullName + " (" + - error.TypeMap.ConfiguredMemberList + " member list)"); - message.AppendLine(); - message.AppendLine("Unmapped properties:"); - foreach (var name in error.UnmappedPropertyNames) - { - message.AppendLine(name); - } - } - return message.ToString(); - } - return base.Message; - } - } - - public override string StackTrace - { - get - { - if (Errors != null) - return string.Join(Environment.NewLine, - base.StackTrace - .Split(new[] {Environment.NewLine}, StringSplitOptions.None) - .Where(str => !str.TrimStart().StartsWith("at AutoMapper.")) - .ToArray()); - - return base.StackTrace; - } - } - } +using System; +using System.Linq; +using System.Text; + +namespace AutoMapper +{ + public class AutoMapperConfigurationException : Exception + { + public TypeMapConfigErrors[] Errors { get; } + public TypePair? Types { get; } + public PropertyMap PropertyMap { get; set; } + + public class TypeMapConfigErrors + { + public TypeMap TypeMap { get; } + public string[] UnmappedPropertyNames { get; } + public bool CanConstruct { get; } + + public TypeMapConfigErrors(TypeMap typeMap, string[] unmappedPropertyNames, bool canConstruct) + { + TypeMap = typeMap; + UnmappedPropertyNames = unmappedPropertyNames; + CanConstruct = canConstruct; + } + } + + public AutoMapperConfigurationException(string message) + : base(message) + { + } + + protected AutoMapperConfigurationException(string message, Exception inner) + : base(message, inner) + { + } + + public AutoMapperConfigurationException(TypeMapConfigErrors[] errors) => Errors = errors; + + public AutoMapperConfigurationException(TypePair types) => Types = types; + + public override string Message + { + get + { + if (Types != null) + { + var message = + string.Format( + "The following property on {0} cannot be mapped: \n\t{2} \nAdd a custom mapping expression, ignore, add a custom resolver, or modify the destination type {1}.", + Types?.DestinationType.FullName, Types?.DestinationType.FullName, + PropertyMap?.DestinationName); + + message += "\nContext:"; + + Exception exToUse = this; + while (exToUse != null) + { + if (exToUse is AutoMapperConfigurationException configExc) + { + message += configExc.PropertyMap == null + ? $"\n\tMapping from type {configExc.Types?.SourceType.FullName} to {configExc.Types?.DestinationType.FullName}" + : $"\n\tMapping to property {configExc.PropertyMap.DestinationName} from {configExc.Types?.SourceType.FullName} to {configExc.Types?.DestinationType.FullName}"; + } + + exToUse = exToUse.InnerException; + } + + return message + "\n" + base.Message; + } + if (Errors != null) + { + var message = + new StringBuilder( + "\nUnmapped members were found. Review the types and members below.\nAdd a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type\nFor no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters\n"); + + foreach (var error in Errors) + { + var len = error.TypeMap.SourceType.FullName.Length + + error.TypeMap.DestinationType.FullName.Length + 5; + + message.AppendLine(new string('=', len)); + if(error.TypeMap.IsConventionMap) + { + message.AppendLine("AutoMapper created this type map for you, but your types cannot be mapped using the current configuration."); + } + message.AppendLine(error.TypeMap.SourceType.Name + " -> " + error.TypeMap.DestinationType.Name + + " (" + + error.TypeMap.ConfiguredMemberList + " member list)"); + message.AppendLine(error.TypeMap.SourceType.FullName + " -> " + + error.TypeMap.DestinationType.FullName + " (" + + error.TypeMap.ConfiguredMemberList + " member list)"); + message.AppendLine(); + + if (error.UnmappedPropertyNames.Any()) + { + message.AppendLine("Unmapped properties:"); + foreach (var name in error.UnmappedPropertyNames) + { + message.AppendLine(name); + } + } + if (!error.CanConstruct) + { + message.AppendLine("No available constructor."); + } + } + return message.ToString(); + } + return base.Message; + } + } + + public override string StackTrace + { + get + { + if (Errors != null) + return string.Join(Environment.NewLine, + base.StackTrace + .Split(new[] {Environment.NewLine}, StringSplitOptions.None) + .Where(str => !str.TrimStart().StartsWith("at AutoMapper.")) + .ToArray()); + + return base.StackTrace; + } + } + } } \ No newline at end of file diff --git a/src/AutoMapper/AutoMapperMappingException.cs b/src/AutoMapper/AutoMapperMappingException.cs index 3463581c18..094d434ae3 100644 --- a/src/AutoMapper/AutoMapperMappingException.cs +++ b/src/AutoMapper/AutoMapperMappingException.cs @@ -1,134 +1,83 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - - public class AutoMapperMappingException : Exception - { - private readonly string _message; - - // - // For guidelines regarding the creation of new exception types, see - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp - // and - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp - // - - public AutoMapperMappingException() - { - } - - public AutoMapperMappingException(string message) - : base(message) - { - _message = message; - } - - public AutoMapperMappingException(ResolutionContext context) - { - Context = context; - Types = context.Types; - } - - public AutoMapperMappingException(ResolutionContext context, Exception inner) - : base(null, inner) - { - Context = context; - Types = context.Types; - } - - public AutoMapperMappingException(ResolutionContext context, Exception inner, PropertyMap propertyMap) - : base(null, inner) - { - Context = context; - Types = context.Types; - PropertyMap = propertyMap; - } - - public AutoMapperMappingException(ResolutionContext context, string message) - : this(context) - { - _message = message; - } - - public ResolutionContext Context { get; set; } - public TypePair Types { get; set; } - public PropertyMap PropertyMap { get; set; } - - public override string Message - { - get - { - string message = null; - var newLine = Environment.NewLine; - if (Types.SourceType != null && Types.DestinationType != null) - { - message = _message + newLine + newLine + "Mapping types:"; - message += newLine + - $"{Types.SourceType.Name} -> {Types.DestinationType.Name}"; - message += newLine + - $"{Types.SourceType.FullName} -> {Types.DestinationType.FullName}"; - } - if (Context != null) - { - var destPath = GetDestPath(); - message += newLine + newLine + "Destination path:" + newLine + destPath; - - message += newLine + newLine + "Source value:" + newLine + (Context.SourceValue ?? "(null)"); - - return message; - } - if (_message != null) - { - message = _message; - } - - message = (message == null ? null : message + newLine) + base.Message; - - return message; - } - } - - private string GetDestPath() - { - var allContexts = GetExceptions().ToArray(); - - var context = allContexts[0].Context?.Parent ?? allContexts[0].Context; - var builder = new StringBuilder(context?.DestinationType.Name); - - foreach (var memberName in allContexts.Select(ctxt => ctxt?.PropertyMap?.DestinationProperty?.Name).Where(memberName => !string.IsNullOrEmpty(memberName))) - { - builder.Append("."); - builder.Append(memberName); - } - return builder.ToString(); - } - - private IEnumerable GetExceptions() - { - Exception exc = this; - while (exc != null) - { - var mappingEx = exc as AutoMapperMappingException; - if (mappingEx != null) - yield return mappingEx; - exc = exc.InnerException; - } - } - -#if !DEBUG - public override string StackTrace - { - get - { - return string.Join(Environment.NewLine, - base.StackTrace - .Split(new[] {Environment.NewLine}, StringSplitOptions.None) - .Where(str => !str.TrimStart().StartsWith("at AutoMapper."))); - } - } -#endif - } -} +using System; +#if !DEBUG +using System.Linq; +#endif + +namespace AutoMapper +{ + public class AutoMapperMappingException : Exception + { + private readonly string _message; + + // + // For guidelines regarding the creation of new exception types, see + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp + // and + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp + // + + public AutoMapperMappingException() + { + } + + public AutoMapperMappingException(string message) + : base(message) => _message = message; + + public AutoMapperMappingException(string message, Exception innerException) + : base(message, innerException) => _message = message; + + public AutoMapperMappingException(string message, Exception innerException, TypePair types) + : this(message, innerException) => Types = types; + + public AutoMapperMappingException(string message, Exception innerException, TypePair types, TypeMap typeMap) + : this(message, innerException, types) => TypeMap = typeMap; + + public AutoMapperMappingException(string message, Exception innerException, TypePair types, TypeMap typeMap, IMemberMap memberMap) + : this(message, innerException, types, typeMap) => MemberMap = memberMap; + + public TypePair? Types { get; set; } + public TypeMap TypeMap { get; set; } + public IMemberMap MemberMap { get; set; } + + public override string Message + { + get + { + var message = _message; + var newLine = Environment.NewLine; + if (Types?.SourceType != null && Types?.DestinationType != null) + { + message = message + newLine + newLine + "Mapping types:"; + message += newLine + $"{Types?.SourceType.Name} -> {Types?.DestinationType.Name}"; + message += newLine + $"{Types?.SourceType.FullName} -> {Types?.DestinationType.FullName}"; + } + if (TypeMap != null) + { + message = message + newLine + newLine + "Type Map configuration:"; + message += newLine + $"{TypeMap.SourceType.Name} -> {TypeMap.DestinationType.Name}"; + message += newLine + $"{TypeMap.SourceType.FullName} -> {TypeMap.DestinationType.FullName}"; + } + if (MemberMap != null) + { + message = message + newLine + newLine + "Destination Member:"; + message += newLine + $"{MemberMap.DestinationName}" + newLine; + } + + return message; + } + } + +#if !DEBUG + public override string StackTrace + { + get + { + return string.Join(Environment.NewLine, + base.StackTrace + .Split(new[] {Environment.NewLine}, StringSplitOptions.None) + .Where(str => !str.TrimStart().StartsWith("at AutoMapper."))); + } + } +#endif + } +} diff --git a/src/AutoMapper/Configuration/Annotations/IgnoreAttribute.cs b/src/AutoMapper/Configuration/Annotations/IgnoreAttribute.cs new file mode 100644 index 0000000000..de5ec40ade --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/IgnoreAttribute.cs @@ -0,0 +1,19 @@ +using System; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Ignore this member for configuration validation and skip during mapping. + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class IgnoreAttribute : Attribute, IMemberConfigurationProvider + { + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + memberConfigurationExpression.Ignore(); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/MapAtRuntimeAttribute.cs b/src/AutoMapper/Configuration/Annotations/MapAtRuntimeAttribute.cs new file mode 100644 index 0000000000..5d178b276f --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/MapAtRuntimeAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Do not precompute the execution plan for this member, just map it at runtime. + /// Simplifies the execution plan by not inlining. + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class MapAtRuntimeAttribute : Attribute, IMemberConfigurationProvider + { + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + memberConfigurationExpression.MapAtRuntime(); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/MappingOrderAttribute.cs b/src/AutoMapper/Configuration/Annotations/MappingOrderAttribute.cs new file mode 100644 index 0000000000..fd66142983 --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/MappingOrderAttribute.cs @@ -0,0 +1,26 @@ +using System; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Supply a custom mapping order instead of what the .NET runtime returns + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class MappingOrderAttribute : Attribute, IMemberConfigurationProvider + { + public int Value { get; } + + public MappingOrderAttribute(int value) + { + Value = value; + } + + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + memberConfigurationExpression.SetMappingOrder(Value); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/NullSubstituteAttribute.cs b/src/AutoMapper/Configuration/Annotations/NullSubstituteAttribute.cs new file mode 100644 index 0000000000..a673520904 --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/NullSubstituteAttribute.cs @@ -0,0 +1,29 @@ +using System; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Substitute a custom value when the source member resolves as null + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class NullSubstituteAttribute : Attribute, IMemberConfigurationProvider + { + /// + /// Value to use if source value is null + /// + public object Value { get; } + + public NullSubstituteAttribute(object value) + { + Value = value; + } + + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + memberConfigurationExpression.NullSubstitute(Value); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/SourceMemberAttribute.cs b/src/AutoMapper/Configuration/Annotations/SourceMemberAttribute.cs new file mode 100644 index 0000000000..fc74b0e0f3 --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/SourceMemberAttribute.cs @@ -0,0 +1,23 @@ +using System; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Specify the source member to map from. Can only reference a member on the type + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class SourceMemberAttribute : Attribute, IMemberConfigurationProvider + { + public string Name { get; } + + public SourceMemberAttribute(string name) => Name = name; + + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + memberConfigurationExpression.MapFrom(Name); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/UseExistingValueAttribute.cs b/src/AutoMapper/Configuration/Annotations/UseExistingValueAttribute.cs new file mode 100644 index 0000000000..defd4131e1 --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/UseExistingValueAttribute.cs @@ -0,0 +1,19 @@ +using System; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Use the destination value instead of mapping from the source value or creating a new instance + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class UseExistingValueAttribute : Attribute, IMemberConfigurationProvider + { + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + memberConfigurationExpression.UseDestinationValue(); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/ValueConverterAttribute.cs b/src/AutoMapper/Configuration/Annotations/ValueConverterAttribute.cs new file mode 100644 index 0000000000..6d3759782d --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/ValueConverterAttribute.cs @@ -0,0 +1,40 @@ +using System; +using System.Reflection; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Specify a value converter type to convert from the matching source member to the destination member + /// Use with to specify a separate source member to supply to the value converter + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class ValueConverterAttribute : Attribute, IMemberConfigurationProvider + { + /// + /// type + /// + public Type Type { get; } + + public ValueConverterAttribute(Type type) + { + Type = type; + } + + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + var sourceMemberAttribute = memberConfigurationExpression.DestinationMember.GetCustomAttribute(); + + if (sourceMemberAttribute != null) + { + memberConfigurationExpression.ConvertUsing(Type, sourceMemberAttribute.Name); + } + else + { + memberConfigurationExpression.ConvertUsing(Type); + } + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs b/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs new file mode 100644 index 0000000000..5fd5bb4719 --- /dev/null +++ b/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs @@ -0,0 +1,40 @@ +using System; +using System.Reflection; + +namespace AutoMapper.Configuration.Annotations +{ + /// + /// Map destination member using a custom value resolver. + /// Use with to specify an type. + /// + /// + /// Must be used in combination with + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class ValueResolverAttribute : Attribute, IMemberConfigurationProvider + { + /// + /// or type + /// + public Type Type { get; } + + public ValueResolverAttribute(Type type) + { + Type = type; + } + + public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) + { + var sourceMemberAttribute = memberConfigurationExpression.DestinationMember.GetCustomAttribute(); + + if (sourceMemberAttribute != null) + { + memberConfigurationExpression.MapFrom(Type, sourceMemberAttribute.Name); + } + else + { + memberConfigurationExpression.MapFrom(Type); + } + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Conventions/AllMemberInfo.cs b/src/AutoMapper/Configuration/Conventions/AllMemberInfo.cs index 8a2d293e2a..df66103475 100644 --- a/src/AutoMapper/Configuration/Conventions/AllMemberInfo.cs +++ b/src/AutoMapper/Configuration/Conventions/AllMemberInfo.cs @@ -1,17 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - public class AllMemberInfo : IGetTypeInfoMembers { private readonly IList> _predicates = new List>(); public IEnumerable GetMemberInfos(TypeDetails typeInfo) { - return AllMembers(typeInfo).Where(m => _predicates.All(p => p(m))).ToList(); + return !_predicates.Any() + ? typeInfo.AllMembers + : typeInfo.AllMembers.Where(m => _predicates.All(p => p(m))).ToList(); } public IGetTypeInfoMembers AddCondition(Func predicate) @@ -19,10 +21,5 @@ public IGetTypeInfoMembers AddCondition(Func predicate) _predicates.Add(predicate); return this; } - - private static IEnumerable AllMembers(TypeDetails typeInfo) - { - return typeInfo.PublicReadAccessors.Concat(typeInfo.PublicNoArgMethods).Concat(typeInfo.PublicNoArgExtensionMethods).ToList(); - } } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Conventions/CaseInsensitiveName.cs b/src/AutoMapper/Configuration/Conventions/CaseInsensitiveName.cs index 103e16cdf9..5e4fc1d069 100644 --- a/src/AutoMapper/Configuration/Conventions/CaseInsensitiveName.cs +++ b/src/AutoMapper/Configuration/Conventions/CaseInsensitiveName.cs @@ -1,9 +1,9 @@ +using System; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Linq; - using System.Reflection; - public class CaseInsensitiveName : ISourceToDestinationNameMapper { public MemberInfo GetMatchingMemberInfo(IGetTypeInfoMembers getTypeInfoMembers, TypeDetails typeInfo, Type destType, Type destMemberType, string nameToSearch) diff --git a/src/AutoMapper/Configuration/Conventions/CaseSensitiveName.cs b/src/AutoMapper/Configuration/Conventions/CaseSensitiveName.cs index 9c12b944eb..ab1c449d79 100644 --- a/src/AutoMapper/Configuration/Conventions/CaseSensitiveName.cs +++ b/src/AutoMapper/Configuration/Conventions/CaseSensitiveName.cs @@ -1,9 +1,9 @@ +using System; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Linq; - using System.Reflection; - public class CaseSensitiveName : ISourceToDestinationNameMapper { public bool MethodCaseSensitive { get; set; } diff --git a/src/AutoMapper/Configuration/Conventions/DefaultMember.cs b/src/AutoMapper/Configuration/Conventions/DefaultMember.cs index 95dc815436..e1b9089747 100644 --- a/src/AutoMapper/Configuration/Conventions/DefaultMember.cs +++ b/src/AutoMapper/Configuration/Conventions/DefaultMember.cs @@ -1,23 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using Execution; - // Source Destination Mapper public class DefaultMember : IChildMemberConfiguration { public IParentSourceToDestinationNameMapper NameMapper { get; set; } - public bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers, IMemberConfiguration parent = null) + public bool MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers, IMemberConfiguration parent = null) { if (string.IsNullOrEmpty(nameToSearch)) return true; var matchingMemberInfo = NameMapper.GetMatchingMemberInfo(sourceType, destType, destMemberType, nameToSearch); if (matchingMemberInfo != null) - resolvers.AddLast(matchingMemberInfo.ToMemberGetter()); + resolvers.AddLast(matchingMemberInfo); return matchingMemberInfo != null; } } diff --git a/src/AutoMapper/Configuration/Conventions/IChildMemberConfiguration.cs b/src/AutoMapper/Configuration/Conventions/IChildMemberConfiguration.cs index 0b4865b01c..8c3383d05f 100644 --- a/src/AutoMapper/Configuration/Conventions/IChildMemberConfiguration.cs +++ b/src/AutoMapper/Configuration/Conventions/IChildMemberConfiguration.cs @@ -1,10 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - public interface IChildMemberConfiguration { - bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers, IMemberConfiguration parent); + bool MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers, IMemberConfiguration parent); } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Conventions/IGetTypeInfoMembers.cs b/src/AutoMapper/Configuration/Conventions/IGetTypeInfoMembers.cs index 6b02959c4f..14284b0ed1 100644 --- a/src/AutoMapper/Configuration/Conventions/IGetTypeInfoMembers.cs +++ b/src/AutoMapper/Configuration/Conventions/IGetTypeInfoMembers.cs @@ -1,9 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Reflection; - public interface IGetTypeInfoMembers { IEnumerable GetMemberInfos(TypeDetails typeInfo); diff --git a/src/AutoMapper/Configuration/Conventions/IMemberConfiguration.cs b/src/AutoMapper/Configuration/Conventions/IMemberConfiguration.cs index cf95246c36..9a761796d7 100644 --- a/src/AutoMapper/Configuration/Conventions/IMemberConfiguration.cs +++ b/src/AutoMapper/Configuration/Conventions/IMemberConfiguration.cs @@ -1,8 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - public interface IMemberConfiguration { IList MemberMappers { get; } @@ -13,6 +14,6 @@ IMemberConfiguration AddName(Action setupAction = null where TNameMapper : ISourceToDestinationNameMapper, new(); IParentSourceToDestinationNameMapper NameMapper { get; set; } - bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers); + bool MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers); } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Conventions/IParentSourceToDestinationNameMapper.cs b/src/AutoMapper/Configuration/Conventions/IParentSourceToDestinationNameMapper.cs index 03c8acf493..4d214423b0 100644 --- a/src/AutoMapper/Configuration/Conventions/IParentSourceToDestinationNameMapper.cs +++ b/src/AutoMapper/Configuration/Conventions/IParentSourceToDestinationNameMapper.cs @@ -1,9 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Reflection; - public interface IParentSourceToDestinationNameMapper { ICollection NamedMappers { get; } diff --git a/src/AutoMapper/Configuration/Conventions/ISourceToDestinationNameMapper.cs b/src/AutoMapper/Configuration/Conventions/ISourceToDestinationNameMapper.cs index ec755226c6..68d0dd6ca3 100644 --- a/src/AutoMapper/Configuration/Conventions/ISourceToDestinationNameMapper.cs +++ b/src/AutoMapper/Configuration/Conventions/ISourceToDestinationNameMapper.cs @@ -1,8 +1,8 @@ +using System; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Reflection; - public interface ISourceToDestinationNameMapper { MemberInfo GetMatchingMemberInfo(IGetTypeInfoMembers getTypeInfoMembers, TypeDetails typeInfo, Type destType, Type destMemberType, string nameToSearch); diff --git a/src/AutoMapper/Configuration/Conventions/MapToAttribute.cs b/src/AutoMapper/Configuration/Conventions/MapToAttribute.cs index 0c847f9edc..c8c117276f 100644 --- a/src/AutoMapper/Configuration/Conventions/MapToAttribute.cs +++ b/src/AutoMapper/Configuration/Conventions/MapToAttribute.cs @@ -1,21 +1,17 @@ +using System; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Reflection; - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class MapToAttribute : SourceToDestinationMapperAttribute { public string MatchingName { get; } - public MapToAttribute(string matchingName) - { - MatchingName = matchingName; - } + public MapToAttribute(string matchingName) + => MatchingName = matchingName; - public override bool IsMatch(TypeDetails typeInfo, MemberInfo memberInfo, Type destType, Type destMemberType, string nameToSearch) - { - return string.Compare(MatchingName, nameToSearch, StringComparison.OrdinalIgnoreCase) == 0; - } + public override bool IsMatch(TypeDetails typeInfo, MemberInfo memberInfo, Type destType, Type destMemberType, string nameToSearch) + => string.Compare(MatchingName, nameToSearch, StringComparison.OrdinalIgnoreCase) == 0; } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Conventions/MemberConfiguration.cs b/src/AutoMapper/Configuration/Conventions/MemberConfiguration.cs index 3ae96d87d0..c3450954d1 100644 --- a/src/AutoMapper/Configuration/Conventions/MemberConfiguration.cs +++ b/src/AutoMapper/Configuration/Conventions/MemberConfiguration.cs @@ -1,11 +1,12 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; - public class MemberConfiguration : IMemberConfiguration { public IParentSourceToDestinationNameMapper NameMapper { get; set; } @@ -45,7 +46,7 @@ public MemberConfiguration() MemberMappers.Add(new DefaultMember { NameMapper = NameMapper }); } - public bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers) + public bool MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers) { var foundMap = false; foreach (var memberMapper in MemberMappers) diff --git a/src/AutoMapper/Configuration/Conventions/MemberNameReplacer.cs b/src/AutoMapper/Configuration/Conventions/MemberNameReplacer.cs index 3379cc5543..a8d099c86d 100644 --- a/src/AutoMapper/Configuration/Conventions/MemberNameReplacer.cs +++ b/src/AutoMapper/Configuration/Conventions/MemberNameReplacer.cs @@ -8,7 +8,7 @@ public MemberNameReplacer(string originalValue, string newValue) NewValue = newValue; } - public string OriginalValue { get; private set; } - public string NewValue { get; private set; } + public string OriginalValue { get; } + public string NewValue { get; } } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/Conventions/NameSplitMember.cs b/src/AutoMapper/Configuration/Conventions/NameSplitMember.cs index ca975a945d..363582f03b 100644 --- a/src/AutoMapper/Configuration/Conventions/NameSplitMember.cs +++ b/src/AutoMapper/Configuration/Conventions/NameSplitMember.cs @@ -1,12 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using System.Text.RegularExpressions; - using Execution; - public class NameSplitMember : IChildMemberConfiguration { public INamingConvention SourceMemberNamingConvention { get; set; } @@ -18,25 +17,25 @@ public NameSplitMember() DestinationMemberNamingConvention = new PascalCaseNamingConvention(); } - public bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers, IMemberConfiguration parent ) + public bool MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceType, Type destType, Type destMemberType, string nameToSearch, LinkedList resolvers, IMemberConfiguration parent ) { - string[] matches = DestinationMemberNamingConvention.SplittingExpression + var matches = DestinationMemberNamingConvention.SplittingExpression .Matches(nameToSearch) .Cast() .Select(m => SourceMemberNamingConvention.ReplaceValue(m)) .ToArray(); MemberInfo matchingMemberInfo = null; - for (int i = 1; i <= matches.Length; i++) + for (var i = 1; i <= matches.Length; i++) { - NameSnippet snippet = CreateNameSnippet(matches, i); + var snippet = CreateNameSnippet(matches, i); matchingMemberInfo = parent.NameMapper.GetMatchingMemberInfo(sourceType, destType, destMemberType, snippet.First); if (matchingMemberInfo != null) { - resolvers.AddLast(matchingMemberInfo.ToMemberGetter()); + resolvers.AddLast(matchingMemberInfo); - var details = new TypeDetails(matchingMemberInfo.GetMemberType(), options); + var details = options.CreateTypeDetails(matchingMemberInfo.GetMemberType()); var foundMatch = parent.MapDestinationPropertyToSource(options, details, destType, destMemberType, snippet.Second, resolvers); if (!foundMatch) diff --git a/src/AutoMapper/Configuration/Conventions/ParentSourceToDestinationNameMapper.cs b/src/AutoMapper/Configuration/Conventions/ParentSourceToDestinationNameMapper.cs index 63574c3539..62e8d24612 100644 --- a/src/AutoMapper/Configuration/Conventions/ParentSourceToDestinationNameMapper.cs +++ b/src/AutoMapper/Configuration/Conventions/ParentSourceToDestinationNameMapper.cs @@ -1,10 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Reflection; - public class ParentSourceToDestinationNameMapper : IParentSourceToDestinationNameMapper { public IGetTypeInfoMembers GetMembers { get; } = new AllMemberInfo(); diff --git a/src/AutoMapper/Configuration/Conventions/PrePostfixName.cs b/src/AutoMapper/Configuration/Conventions/PrePostfixName.cs index 872d6a250f..96aca98ec4 100644 --- a/src/AutoMapper/Configuration/Conventions/PrePostfixName.cs +++ b/src/AutoMapper/Configuration/Conventions/PrePostfixName.cs @@ -1,11 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; - using System.Reflection; - public class PrePostfixName : ISourceToDestinationNameMapper { public ICollection Prefixes { get; } = new Collection(); @@ -23,17 +23,18 @@ public PrePostfixName AddStrings(Func> getSt public MemberInfo GetMatchingMemberInfo(IGetTypeInfoMembers getTypeInfoMembers, TypeDetails typeInfo, Type destType, Type destMemberType, string nameToSearch) { - var possibleSourceNames = PossibleNames(nameToSearch, DestinationPrefixes, DestinationPostfixes); - var possibleDestNames = getTypeInfoMembers.GetMemberInfos(typeInfo).Select(mi => new { mi, possibles = PossibleNames(mi.Name, Prefixes, Postfixes) }); + var possibleSourceNames = DestinationPostfixes.Any() || DestinationPrefixes.Any() + ? PossibleNames(nameToSearch, DestinationPrefixes, DestinationPostfixes) + : new[] {nameToSearch}; var all = from sourceName in possibleSourceNames - from destName in possibleDestNames + from destName in typeInfo.DestinationMemberNames select new { sourceName, destName }; var match = all.FirstOrDefault( - pair => pair.destName.possibles.Any(p => string.Compare(p, pair.sourceName, StringComparison.OrdinalIgnoreCase) == 0)); - return match?.destName.mi; + pair => pair.destName.Possibles.Any(p => string.Compare(p, pair.sourceName, StringComparison.OrdinalIgnoreCase) == 0)); + return match?.destName.Member; } private IEnumerable PossibleNames(string memberName, IEnumerable prefixes, IEnumerable postfixes) diff --git a/src/AutoMapper/Configuration/Conventions/ReplaceName.cs b/src/AutoMapper/Configuration/Conventions/ReplaceName.cs index 5075358cbe..31c7844715 100644 --- a/src/AutoMapper/Configuration/Conventions/ReplaceName.cs +++ b/src/AutoMapper/Configuration/Conventions/ReplaceName.cs @@ -1,19 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; - using System.Reflection; - public class ReplaceName : ISourceToDestinationNameMapper { private ICollection MemberNameReplacers { get; } - public ReplaceName() - { - MemberNameReplacers = new Collection(); - } + public ReplaceName() => MemberNameReplacers = new Collection(); public ReplaceName AddReplace(string original, string newValue) { @@ -32,9 +29,8 @@ from destName in possibleDestNames var match = all.FirstOrDefault( pair => pair.destName.possibles.Any(p => string.Compare(p, pair.sourceName, StringComparison.OrdinalIgnoreCase) == 0)); - if (match == null) - return null; - return match.destName.mi; + + return match?.destName.mi; } private IEnumerable PossibleNames(string nameToSearch) diff --git a/src/AutoMapper/Configuration/Conventions/SourceToDestinationMapperAttribute.cs b/src/AutoMapper/Configuration/Conventions/SourceToDestinationMapperAttribute.cs index 573eb8ec85..dc2b11f23d 100644 --- a/src/AutoMapper/Configuration/Conventions/SourceToDestinationMapperAttribute.cs +++ b/src/AutoMapper/Configuration/Conventions/SourceToDestinationMapperAttribute.cs @@ -1,8 +1,8 @@ +using System; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Reflection; - public abstract class SourceToDestinationMapperAttribute : Attribute { public abstract bool IsMatch(TypeDetails typeInfo, MemberInfo memberInfo, Type destType, Type destMemberType, string nameToSearch); diff --git a/src/AutoMapper/Configuration/Conventions/SourceToDestinationNameMapperAttributesMember.cs b/src/AutoMapper/Configuration/Conventions/SourceToDestinationNameMapperAttributesMember.cs index 2f3260772a..5fb68326bd 100644 --- a/src/AutoMapper/Configuration/Conventions/SourceToDestinationNameMapperAttributesMember.cs +++ b/src/AutoMapper/Configuration/Conventions/SourceToDestinationNameMapperAttributesMember.cs @@ -1,20 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + namespace AutoMapper.Configuration.Conventions { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - public class SourceToDestinationNameMapperAttributesMember : ISourceToDestinationNameMapper { - private static readonly ConcurrentDictionary>> Cache = new ConcurrentDictionary>>(); + private static readonly SourceMember[] Empty = new SourceMember[0]; + private readonly Dictionary _allSourceMembers = new Dictionary(); public MemberInfo GetMatchingMemberInfo(IGetTypeInfoMembers getTypeInfoMembers, TypeDetails typeInfo, Type destType, Type destMemberType, string nameToSearch) { - Cache.GetOrAdd(typeInfo, ti => getTypeInfoMembers.GetMemberInfos(ti).ToDictionary(mi => mi, mi => CustomAttributeExtensions.GetCustomAttributes((MemberInfo) mi, typeof(SourceToDestinationMapperAttribute), true).OfType())); + if (!_allSourceMembers.TryGetValue(typeInfo, out SourceMember[] sourceMembers)) + { + sourceMembers = getTypeInfoMembers.GetMemberInfos(typeInfo).Select(sourceMember => new SourceMember(sourceMember)).Where(s => s.Attribute != null).ToArray(); + _allSourceMembers[typeInfo] = sourceMembers.Length == 0 ? Empty : sourceMembers; + } + return sourceMembers.FirstOrDefault(d => d.Attribute.IsMatch(typeInfo, d.Member, destType, destMemberType, nameToSearch)).Member; + } + + struct SourceMember + { + public SourceMember(MemberInfo sourceMember) + { + Member = sourceMember; + Attribute = sourceMember.GetCustomAttribute(inherit:true); + } - return Cache[typeInfo].FirstOrDefault(kp => kp.Value.Any(_ => _.IsMatch(typeInfo, kp.Key, destType, destMemberType, nameToSearch))).Key; + public MemberInfo Member { get; } + public SourceToDestinationMapperAttribute Attribute { get; } } } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/CtorParamConfigurationExpression.cs b/src/AutoMapper/Configuration/CtorParamConfigurationExpression.cs new file mode 100644 index 0000000000..65d4053551 --- /dev/null +++ b/src/AutoMapper/Configuration/CtorParamConfigurationExpression.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; + +namespace AutoMapper.Configuration +{ + public class CtorParamConfigurationExpression : ICtorParamConfigurationExpression, ICtorParameterConfiguration + { + private readonly string _ctorParamName; + private readonly List> _ctorParamActions = new List>(); + + public CtorParamConfigurationExpression(string ctorParamName) => _ctorParamName = ctorParamName; + + public void MapFrom(Expression> sourceMember) + { + _ctorParamActions.Add(cpm => cpm.CustomMapExpression = sourceMember); + } + + public void MapFrom(Func resolver) + { + Expression> resolverExpression = (src, ctxt) => resolver(src, ctxt); + _ctorParamActions.Add(cpm => cpm.CustomMapFunction = resolverExpression); + } + + public void Configure(TypeMap typeMap) + { + var ctorParams = typeMap.ConstructorMap?.CtorParams; + if (ctorParams == null) + { + throw new AutoMapperConfigurationException($"The type {typeMap.Types.DestinationType.Name} does not have a constructor.\n{typeMap.Types.DestinationType.FullName}"); + } + + var parameter = ctorParams.SingleOrDefault(p => p.Parameter.Name == _ctorParamName); + if (parameter == null) + { + throw new AutoMapperConfigurationException($"{typeMap.Types.DestinationType.Name} does not have a constructor with a parameter named '{_ctorParamName}'.\n{typeMap.Types.DestinationType.FullName}"); + } + parameter.CanResolveValue = true; + + foreach (var action in _ctorParamActions) + { + action(parameter); + } + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/IConfiguration.cs b/src/AutoMapper/Configuration/IConfiguration.cs new file mode 100644 index 0000000000..74148f5f96 --- /dev/null +++ b/src/AutoMapper/Configuration/IConfiguration.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace AutoMapper.Configuration +{ + public interface IConfiguration : IProfileConfiguration + { + Func ServiceCtor { get; } + IEnumerable Profiles { get; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/ICtorParameterConfiguration.cs b/src/AutoMapper/Configuration/ICtorParameterConfiguration.cs new file mode 100644 index 0000000000..59e126b4ce --- /dev/null +++ b/src/AutoMapper/Configuration/ICtorParameterConfiguration.cs @@ -0,0 +1,7 @@ +namespace AutoMapper.Configuration +{ + public interface ICtorParameterConfiguration + { + void Configure(TypeMap typeMap); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/IMemberConfigurationProvider.cs b/src/AutoMapper/Configuration/IMemberConfigurationProvider.cs new file mode 100644 index 0000000000..962bf1ec9c --- /dev/null +++ b/src/AutoMapper/Configuration/IMemberConfigurationProvider.cs @@ -0,0 +1,7 @@ +namespace AutoMapper.Configuration +{ + public interface IMemberConfigurationProvider + { + void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/IProfileConfiguration.cs b/src/AutoMapper/Configuration/IProfileConfiguration.cs new file mode 100644 index 0000000000..30d3f332d1 --- /dev/null +++ b/src/AutoMapper/Configuration/IProfileConfiguration.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using AutoMapper.Configuration.Conventions; +using AutoMapper.Mappers; + +namespace AutoMapper.Configuration +{ + /// + /// Contains profile-specific configuration + /// + public interface IProfileConfiguration + { + IEnumerable MemberConfigurations { get; } + IEnumerable TypeConfigurations { get; } + bool? ConstructorMappingEnabled { get; } + bool? AllowNullDestinationValues { get; } + bool? AllowNullCollections { get; } + bool? EnableNullPropagationForQueryMapping { get; } + bool? CreateMissingTypeMaps { get; } + bool? ValidateInlineMaps { get; } + IEnumerable> AllTypeMapActions { get; } + IEnumerable> AllPropertyMapActions { get; } + + /// + /// Source extension methods included for search + /// + IEnumerable SourceExtensionMethods { get; } + + /// + /// Specify which properties should be mapped. + /// By default only public properties are mapped. + /// + Func ShouldMapProperty { get; } + + /// + /// Specify which fields should be mapped. + /// By default only public fields are mapped. + /// + Func ShouldMapField { get; } + + /// + /// Specify which methods, of those that are eligible (public, parameterless, and non-static or extension methods), should be mapped. + /// By default all eligible methods are mapped. + /// + Func ShouldMapMethod { get; } + + + /// + /// Specify which constructors should be considered for the destination objects. + /// By default all constructors are considered. + /// + Func ShouldUseConstructor { get; } + + string ProfileName { get; } + IEnumerable GlobalIgnores { get; } + INamingConvention SourceMemberNamingConvention { get; } + INamingConvention DestinationMemberNamingConvention { get; } + IEnumerable TypeMapConfigs { get; } + IEnumerable OpenTypeMapConfigs { get; } + IEnumerable ValueTransformers { get; } + } +} diff --git a/src/AutoMapper/Configuration/IPropertyMapConfiguration.cs b/src/AutoMapper/Configuration/IPropertyMapConfiguration.cs new file mode 100644 index 0000000000..a156500f97 --- /dev/null +++ b/src/AutoMapper/Configuration/IPropertyMapConfiguration.cs @@ -0,0 +1,14 @@ +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.Configuration +{ + public interface IPropertyMapConfiguration + { + void Configure(TypeMap typeMap); + MemberInfo DestinationMember { get; } + LambdaExpression SourceExpression { get; } + LambdaExpression GetDestinationExpression(); + IPropertyMapConfiguration Reverse(); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/ISourceMemberConfiguration.cs b/src/AutoMapper/Configuration/ISourceMemberConfiguration.cs new file mode 100644 index 0000000000..9ce9bb3f7d --- /dev/null +++ b/src/AutoMapper/Configuration/ISourceMemberConfiguration.cs @@ -0,0 +1,7 @@ +namespace AutoMapper.Configuration +{ + public interface ISourceMemberConfiguration + { + void Configure(TypeMap typeMap); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/ITypeMapConfiguration.cs b/src/AutoMapper/Configuration/ITypeMapConfiguration.cs index ed43bb7798..bb03c14a95 100644 --- a/src/AutoMapper/Configuration/ITypeMapConfiguration.cs +++ b/src/AutoMapper/Configuration/ITypeMapConfiguration.cs @@ -1,13 +1,13 @@ +using System; + namespace AutoMapper.Configuration { - using System; - public interface ITypeMapConfiguration { - void Configure(IProfileConfiguration profile, TypeMap typeMap); - MemberList MemberList { get; } + void Configure(TypeMap typeMap); Type SourceType { get; } Type DestinationType { get; } + bool IsOpenGeneric { get; } TypePair Types { get; } ITypeMapConfiguration ReverseTypeMap { get; } } diff --git a/src/AutoMapper/Configuration/Internal/PrimitiveHelper.cs b/src/AutoMapper/Configuration/Internal/PrimitiveHelper.cs new file mode 100644 index 0000000000..021c908763 --- /dev/null +++ b/src/AutoMapper/Configuration/Internal/PrimitiveHelper.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace AutoMapper.Configuration.Internal +{ + public static class PrimitiveHelper + { + public static TValue GetOrDefault(IDictionary dictionary, TKey key) + { + dictionary.TryGetValue(key, out TValue value); + return value; + } + + private static IEnumerable GetAllMembers(this Type type) => + type.GetTypeInheritance().Concat(type.GetTypeInfo().ImplementedInterfaces).SelectMany(i => i.GetDeclaredMembers()); + + public static MemberInfo GetInheritedMember(this Type type, string name) => type.GetAllMembers().FirstOrDefault(mi => mi.Name == name); + + public static MethodInfo GetInheritedMethod(Type type, string name) + => type.GetInheritedMember(name) as MethodInfo ?? throw new ArgumentOutOfRangeException(nameof(name), $"Cannot find method {name} of type {type}."); + + public static MemberInfo GetFieldOrProperty(Type type, string name) + => type.GetInheritedMember(name) ?? throw new ArgumentOutOfRangeException(nameof(name), $"Cannot find member {name} of type {type}."); + + public static bool IsNullableType(Type type) + => type.IsGenericType(typeof(Nullable<>)); + + public static Type GetTypeOfNullable(Type type) + => type.GetTypeInfo().GenericTypeArguments[0]; + + public static bool IsCollectionType(Type type) + => type.ImplementsGenericInterface(typeof(ICollection<>)); + + public static bool IsEnumerableType(Type type) + => typeof(IEnumerable).IsAssignableFrom(type); + + public static bool IsQueryableType(Type type) + => typeof(IQueryable).IsAssignableFrom(type); + + public static bool IsListType(Type type) + => typeof(IList).IsAssignableFrom(type); + + public static bool IsListOrDictionaryType(Type type) + => type.IsListType() || type.IsDictionaryType(); + + public static bool IsDictionaryType(Type type) + => type.ImplementsGenericInterface(typeof(IDictionary<,>)); + + public static bool IsReadOnlyDictionaryType(Type type) + => type.ImplementsGenericInterface(typeof(IReadOnlyDictionary<,>)); + + public static bool ImplementsGenericInterface(Type type, Type interfaceType) + { + return type.IsGenericType(interfaceType) + || type.GetTypeInfo().ImplementedInterfaces.Any(@interface => @interface.IsGenericType(interfaceType)); + } + + public static bool IsGenericType(Type type, Type genericType) + => type.IsGenericType() && type.GetGenericTypeDefinition() == genericType; + + public static Type GetIEnumerableType(Type type) + => type.GetGenericInterface(typeof(IEnumerable<>)); + + public static Type GetDictionaryType(Type type) + => type.GetGenericInterface(typeof(IDictionary<,>)); + + public static Type GetReadOnlyDictionaryType(Type type) + => type.GetGenericInterface(typeof(IReadOnlyDictionary<,>)); + + public static Type GetGenericInterface(Type type, Type genericInterface) + { + return type.IsGenericType(genericInterface) + ? type + : type.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(t => t.IsGenericType(genericInterface)); + } + + public static Type GetGenericElementType(Type type) + => type.HasElementType ? type.GetElementType() : type.GetTypeInfo().GenericTypeArguments[0]; + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/MapperConfigurationExpression.cs b/src/AutoMapper/Configuration/MapperConfigurationExpression.cs index 8581accb2a..69f616d2e4 100644 --- a/src/AutoMapper/Configuration/MapperConfigurationExpression.cs +++ b/src/AutoMapper/Configuration/MapperConfigurationExpression.cs @@ -1,46 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using AutoMapper.Features; +using AutoMapper.Mappers; + namespace AutoMapper.Configuration { - using System; - using System.Collections.Generic; - using System.Reflection; - using Mappers; - - public class MapperConfigurationExpression : IMapperConfigurationExpression + public class MapperConfigurationExpression : Profile, IMapperConfigurationExpression, IConfiguration { - private readonly Profile _defaultProfile; private readonly IList _profiles = new List(); - private readonly List> _allTypeMapActions = new List>(); - public MapperConfigurationExpression() + public MapperConfigurationExpression() : base() { - _defaultProfile = new NamedProfile(ProfileName); - _profiles.Add(_defaultProfile); + IncludeSourceExtensionMethods(typeof(Enumerable)); + + Mappers = MapperRegistry.Mappers(); } - public string ProfileName => ""; - public IEnumerable Profiles => _profiles; - public IEnumerable> AllTypeMapActions => _allTypeMapActions; - public Func ServiceCtor { get; private set; } = ObjectCreator.CreateObject; + public IEnumerable Profiles => _profiles; + public Func ServiceCtor { get; private set; } = Activator.CreateInstance; - public void CreateProfile(string profileName, Action config) - { - var profile = new NamedProfile(profileName); + public void CreateProfile(string profileName, Action config) + => AddProfile(new NamedProfile(profileName, config)); - config(profile); + public IList Mappers { get; } - AddProfile(profile); - } + public AdvancedConfiguration Advanced { get; } = new AdvancedConfiguration(); + + public Features Features { get; } = new Features(); private class NamedProfile : Profile { public NamedProfile(string profileName) : base(profileName) { } + + public NamedProfile(string profileName, Action config) : base(profileName, config) + { + } } public void AddProfile(Profile profile) { - profile.Initialize(); _profiles.Add(profile); } @@ -48,98 +50,81 @@ public void AddProfile(Profile profile) public void AddProfile(Type profileType) => AddProfile((Profile)Activator.CreateInstance(profileType)); - public void ConstructServicesUsing(Func constructor) => ServiceCtor = constructor; + public void AddProfiles(IEnumerable assembliesToScan) + => AddMaps(assembliesToScan); - public Func ShouldMapProperty - { - get { return _defaultProfile.ShouldMapProperty; } - set { _defaultProfile.ShouldMapProperty = value; } - } + public void AddProfiles(params Assembly[] assembliesToScan) + => AddMaps(assembliesToScan); - public Func ShouldMapField - { - get { return _defaultProfile.ShouldMapField; } - set { _defaultProfile.ShouldMapField = value; } - } + public void AddProfiles(IEnumerable assemblyNamesToScan) + => AddMaps(assemblyNamesToScan); - public bool CreateMissingTypeMaps - { - get { return _defaultProfile.CreateMissingTypeMaps; } - set { _defaultProfile.CreateMissingTypeMaps = value; } - } - - public void IncludeSourceExtensionMethods(Type type) => _defaultProfile.IncludeSourceExtensionMethods(type); - - public INamingConvention SourceMemberNamingConvention - { - get { return _defaultProfile.SourceMemberNamingConvention; } - set { _defaultProfile.SourceMemberNamingConvention = value; } - } + public void AddProfiles(params string[] assemblyNamesToScan) + => AddMaps(assemblyNamesToScan); - public INamingConvention DestinationMemberNamingConvention - { - get { return _defaultProfile.DestinationMemberNamingConvention; } - set { _defaultProfile.DestinationMemberNamingConvention = value; } - } + public void AddProfiles(IEnumerable typesFromAssembliesContainingProfiles) + => AddMaps(typesFromAssembliesContainingProfiles); - public bool AllowNullDestinationValues - { - get { return _defaultProfile.AllowNullDestinationValues; } - set { _defaultProfile.AllowNullDestinationValues = value; } - } + public void AddProfiles(params Type[] typesFromAssembliesContainingProfiles) + => AddMaps(typesFromAssembliesContainingProfiles); - public bool AllowNullCollections + public void AddProfiles(IEnumerable enumerableOfProfiles) { - get { return _defaultProfile.AllowNullCollections; } - set { _defaultProfile.AllowNullCollections = value; } + foreach (var profile in enumerableOfProfiles) + { + AddProfile(profile); + } } - public void ForAllMaps(Action configuration) - => _allTypeMapActions.Add(configuration); - - public Conventions.IMemberConfiguration AddMemberConfiguration() - => _defaultProfile.AddMemberConfiguration(); - - public IConditionalObjectMapper AddConditionalObjectMapper() - => _defaultProfile.AddConditionalObjectMapper(); - - public void DisableConstructorMapping() => _defaultProfile.DisableConstructorMapping(); + public void AddMaps(IEnumerable assembliesToScan) + => AddMapsCore(assembliesToScan); - public IMappingExpression CreateMap() - => _defaultProfile.CreateMap(); + public void AddMaps(params Assembly[] assembliesToScan) + => AddMapsCore(assembliesToScan); - public IMappingExpression CreateMap( - MemberList memberList) - => _defaultProfile.CreateMap(memberList); + public void AddMaps(IEnumerable assemblyNamesToScan) + => AddMapsCore(assemblyNamesToScan.Select(Assembly.Load)); - public IMappingExpression CreateMap(Type sourceType, Type destinationType) - => _defaultProfile.CreateMap(sourceType, destinationType, MemberList.Destination); + public void AddMaps(params string[] assemblyNamesToScan) + => AddMaps((IEnumerable)assemblyNamesToScan); - public IMappingExpression CreateMap(Type sourceType, Type destinationType, MemberList memberList) - => _defaultProfile.CreateMap(sourceType, destinationType, memberList); + public void AddMaps(IEnumerable typesFromAssembliesContainingMappingDefinitions) + => AddMapsCore(typesFromAssembliesContainingMappingDefinitions.Select(t => t.GetTypeInfo().Assembly)); - public void ClearPrefixes() => _defaultProfile.ClearPrefixes(); + public void AddMaps(params Type[] typesFromAssembliesContainingMappingDefinitions) + => AddMaps((IEnumerable)typesFromAssembliesContainingMappingDefinitions); - public void RecognizeAlias(string original, string alias) - => _defaultProfile.RecognizeAlias(original, alias); - - public void ReplaceMemberName(string original, string newValue) - => _defaultProfile.ReplaceMemberName(original, newValue); - - public void RecognizePrefixes(params string[] prefixes) - => _defaultProfile.RecognizePrefixes(prefixes); - - public void RecognizePostfixes(params string[] postfixes) - => _defaultProfile.RecognizePostfixes(postfixes); - - public void RecognizeDestinationPrefixes(params string[] prefixes) - => _defaultProfile.RecognizeDestinationPrefixes(prefixes); + private void AddMapsCore(IEnumerable assembliesToScan) + { + var allTypes = assembliesToScan.Where(a => !a.IsDynamic && a != typeof(NamedProfile).Assembly).SelectMany(a => a.GetDefinedTypes()).ToArray(); + var autoMapAttributeProfile = new NamedProfile(nameof(AutoMapAttribute)); - public void RecognizeDestinationPostfixes(params string[] postfixes) - => _defaultProfile.RecognizeDestinationPostfixes(postfixes); + foreach (var type in allTypes) + { + if (typeof(Profile).IsAssignableFrom(type) && !type.IsAbstract) + { + AddProfile(type.AsType()); + } + + var autoMapAttribute = type.GetCustomAttribute(); + if (autoMapAttribute != null) + { + var mappingExpression = (MappingExpression) autoMapAttributeProfile.CreateMap(autoMapAttribute.SourceType, type); + autoMapAttribute.ApplyConfiguration(mappingExpression); + + foreach (var memberInfo in type.GetMembers(BindingFlags.Public | BindingFlags.Instance)) + { + foreach (var memberConfigurationProvider in memberInfo.GetCustomAttributes().OfType()) + { + mappingExpression.ForMember(memberInfo, cfg => memberConfigurationProvider.ApplyConfiguration(cfg)); + } + } + } + } - public void AddGlobalIgnore(string startingwith) - => _defaultProfile.AddGlobalIgnore(startingwith); + AddProfile(autoMapAttributeProfile); + } + public void ConstructServicesUsing(Func constructor) => ServiceCtor = constructor; } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/MappingExpression.cs b/src/AutoMapper/Configuration/MappingExpression.cs index 70223498aa..acff13b79d 100644 --- a/src/AutoMapper/Configuration/MappingExpression.cs +++ b/src/AutoMapper/Configuration/MappingExpression.cs @@ -1,282 +1,259 @@ +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; + namespace AutoMapper.Configuration { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Execution; - using QueryableExtensions.Impl; - using static System.Linq.Expressions.Expression; - - public class MappingExpression : MappingExpression, IMappingExpression + public class MappingExpression : MappingExpressionBase, IMappingExpression { - public MappingExpression(TypePair types, MemberList memberList) : base(memberList, types.SourceType, types.DestinationType) + public MappingExpression(TypePair types, MemberList memberList) : base(memberList, types) { } - public new IMappingExpression ReverseMap() => (IMappingExpression) base.ReverseMap(); - - public IMappingExpression Substitute(Func substituteFunc) - => (IMappingExpression) base.Substitute(substituteFunc); - - public new IMappingExpression ConstructUsingServiceLocator() - => (IMappingExpression)base.ConstructUsingServiceLocator(); - - public void ForAllMembers(Action memberOptions) - => base.ForAllMembers(opts => memberOptions((IMemberConfigurationExpression)opts)); - - void IMappingExpression.ConvertUsing() - => ConvertUsing(typeof(TTypeConverter)); - - public void ConvertUsing(Type typeConverterType) - => TypeMapActions.Add(tm => tm.TypeConverterType = typeConverterType); - - public void As(Type typeOverride) - => TypeMapActions.Add(tm => tm.DestinationTypeOverride = typeOverride); - - public void ForAllOtherMembers(Action memberOptions) - => base.ForAllOtherMembers(o => memberOptions((IMemberConfigurationExpression)o)); - - public IMappingExpression ForMember(string name, Action memberOptions) - => (IMappingExpression)base.ForMember(name, c => memberOptions((IMemberConfigurationExpression)c)); - - public new IMappingExpression ForSourceMember(string sourceMemberName, Action memberOptions) - => (IMappingExpression)base.ForSourceMember(sourceMemberName, memberOptions); - - public new IMappingExpression Include(Type otherSourceType, Type otherDestinationType) - => (IMappingExpression)base.Include(otherSourceType, otherDestinationType); - - public new IMappingExpression IgnoreAllPropertiesWithAnInaccessibleSetter() - => (IMappingExpression)base.IgnoreAllPropertiesWithAnInaccessibleSetter(); - - public new IMappingExpression IgnoreAllSourcePropertiesWithAnInaccessibleSetter() - => (IMappingExpression)base.IgnoreAllSourcePropertiesWithAnInaccessibleSetter(); - - public new IMappingExpression IncludeBase(Type sourceBase, Type destinationBase) - => (IMappingExpression)base.IncludeBase(sourceBase, destinationBase); - - public new IMappingExpression BeforeMap(Action beforeFunction) - => (IMappingExpression)base.BeforeMap(beforeFunction); - - public new IMappingExpression BeforeMap() where TMappingAction : IMappingAction - => (IMappingExpression)base.BeforeMap(); + public string[] IncludedMembersNames { get; internal set; } = Array.Empty(); - public new IMappingExpression AfterMap(Action afterFunction) - => (IMappingExpression)base.AfterMap(afterFunction); - - public new IMappingExpression AfterMap() where TMappingAction : IMappingAction - => (IMappingExpression)base.AfterMap(); - - public new IMappingExpression ConstructUsing(Func ctor) - => (IMappingExpression)base.ConstructUsing(ctor); + public IMappingExpression ReverseMap() + { + var reversedTypes = new TypePair(Types.DestinationType, Types.SourceType); + var reverseMap = new MappingExpression(reversedTypes, MemberList.None); + if(!reversedTypes.IsGenericTypeDefinition) + { + reverseMap.MemberConfigurations.AddRange(MemberConfigurations.Select(m => m.Reverse()).Where(m => m != null)); + } + ReverseMapExpression = reverseMap; + reverseMap.IncludeMembers(MapToSourceMembers().Select(m => m.DestinationMember.Name).ToArray()); + foreach(var includedMemberName in IncludedMembersNames) + { + reverseMap.ForMember(includedMemberName, m => m.MapFrom(s => s)); + } + + ReverseFeatures(); + + return reverseMap; + } + + public IMappingExpression IncludeMembers(params string[] memberNames) + { + IncludedMembersNames = memberNames; + foreach(var memberName in memberNames) + { + SourceType.GetFieldOrProperty(memberName); + ForSourceMemberCore(memberName, o => o.DoNotValidate()); + } + TypeMapActions.Add(tm => tm.IncludedMembersNames = memberNames); + return this; + } - public new IMappingExpression ConstructUsing(Func ctor) - => (IMappingExpression)base.ConstructUsing(ctor); + public void ForAllMembers(Action memberOptions) + { + TypeMapActions.Add(typeMap => + { + foreach (var accessor in typeMap.DestinationTypeDetails.PublicReadAccessors) + { + ForMember(accessor, memberOptions); + } + }); + } - public IMappingExpression ConstructProjectionUsing(LambdaExpression ctor) + public void ForAllOtherMembers(Action memberOptions) { - TypeMapActions.Add(tm => tm.ConstructExpression = ctor); + TypeMapActions.Add(typeMap => + { + foreach (var accessor in typeMap.DestinationTypeDetails.PublicReadAccessors.Where(m => + GetDestinationMemberConfiguration(m) == null)) + { + ForMember(accessor, memberOptions); + } + }); + } + public IMappingExpression ForMember(string name, Action memberOptions) + { + var member = DestinationType.GetFieldOrProperty(name); + ForMember(member, memberOptions); return this; } - public new IMappingExpression MaxDepth(int depth) - => (IMappingExpression)base.MaxDepth(depth); + protected override void IgnoreDestinationMember(MemberInfo property, bool ignorePaths = true) + { + ForMember(property, _ => {}).Ignore(ignorePaths); + } - public new IMappingExpression ForCtorParam(string ctorParamName, Action> paramOptions) - => (IMappingExpression)base.ForCtorParam(ctorParamName, paramOptions); + internal MemberConfigurationExpression ForMember(MemberInfo destinationProperty, Action memberOptions) + { + var expression = new MemberConfigurationExpression(destinationProperty, Types.SourceType); - public new IMappingExpression PreserveReferences() => (IMappingExpression)base.PreserveReferences(); + MemberConfigurations.Add(expression); - protected override IMemberConfiguration CreateMemberConfigurationExpression(IMemberAccessor member, Type sourceType) - => new MemberConfigurationExpression(member, sourceType); + memberOptions(expression); - protected override MappingExpression CreateReverseMapExpression() - => new MappingExpression(new TypePair(DestinationType, SourceType), MemberList.Source); + return expression; + } - private class MemberConfigurationExpression : MemberConfigurationExpression, IMemberConfigurationExpression + internal class MemberConfigurationExpression : MemberConfigurationExpression, IMemberConfigurationExpression { - public MemberConfigurationExpression(IMemberAccessor destinationMember, Type sourceType) + public MemberConfigurationExpression(MemberInfo destinationMember, Type sourceType) : base(destinationMember, sourceType) { } - public void ResolveUsing(Type valueResolverType) + public void MapFrom(Type valueResolverType) { - var config = new ValueResolverConfiguration(valueResolverType); + var config = new ValueResolverConfiguration(valueResolverType, valueResolverType.GetGenericInterface(typeof(IValueResolver<,,>))); PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - public void ResolveUsing(Type valueResolverType, string memberName) + public void MapFrom(Type valueResolverType, string sourceMemberName) { - var config = new ValueResolverConfiguration(valueResolverType) + var config = new ValueResolverConfiguration(valueResolverType, valueResolverType.GetGenericInterface(typeof(IMemberValueResolver<,,,>))) { - SourceMemberName = memberName + SourceMemberName = sourceMemberName }; PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - public void ResolveUsing(IValueResolver resolver, string memberName) + public void MapFrom(IMemberValueResolver resolver, string sourceMemberName) { - var config = new ValueResolverConfiguration(resolver) + var config = new ValueResolverConfiguration(resolver, typeof(IMemberValueResolver)) { - SourceMemberName = memberName + SourceMemberName = sourceMemberName }; PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - } + public void ConvertUsing(Type valueConverterType) + => PropertyMapActions.Add(pm => ConvertUsing(pm, valueConverterType)); + + public void ConvertUsing(Type valueConverterType, string sourceMemberName) + => PropertyMapActions.Add(pm => ConvertUsing(pm, valueConverterType, sourceMemberName)); + + public void ConvertUsing(IValueConverter valueConverter, string sourceMemberName) + { + PropertyMapActions.Add(pm => + { + var config = new ValueConverterConfiguration(valueConverter, typeof(IValueConverter)) + { + SourceMemberName = sourceMemberName + }; + + pm.ValueConverterConfig = config; + }); + } + + private static void ConvertUsing(PropertyMap propertyMap, Type valueConverterType, string sourceMemberName = null) + { + var config = new ValueConverterConfiguration(valueConverterType, valueConverterType.GetGenericInterface(typeof(IValueConverter<,>))) + { + SourceMemberName = sourceMemberName + }; + + propertyMap.ValueConverterConfig = config; + } + } } - public class MappingExpression : IMappingExpression, ITypeMapConfiguration + public class MappingExpression : + MappingExpressionBase>, + IMappingExpression { - private readonly List _memberConfigurations = new List(); - private readonly List _sourceMemberConfigurations = new List(); - private readonly List> _ctorParamConfigurations = new List>(); - private MappingExpression _reverseMap; - private Action> _allMemberOptions; - private Func _memberFilter; public MappingExpression(MemberList memberList) + : base(memberList) { - MemberList = memberList; - Types = new TypePair(typeof(TSource), typeof(TDestination)); } public MappingExpression(MemberList memberList, Type sourceType, Type destinationType) + : base(memberList, sourceType, destinationType) { - MemberList = memberList; - Types = new TypePair(sourceType, destinationType); } - public MemberList MemberList { get; } - public TypePair Types { get; } - public Type SourceType => Types.SourceType; - public Type DestinationType => Types.DestinationType; - public ITypeMapConfiguration ReverseTypeMap => _reverseMap; - protected List> TypeMapActions { get; } = new List>(); - - public IMappingExpression PreserveReferences() + public MappingExpression(MemberList memberList, TypePair types) + : base(memberList, types) { - TypeMapActions.Add(tm => tm.PreserveReferences = true); + } + public IMappingExpression ForPath(Expression> destinationMember, + Action> memberOptions) + { + destinationMember.EnsureMemberPath(nameof(destinationMember)); + var expression = new PathConfigurationExpression(destinationMember); + var firstMember = expression.MemberPath.First; + var firstMemberConfig = GetDestinationMemberConfiguration(firstMember); + if(firstMemberConfig == null) + { + IgnoreDestinationMember(firstMember, ignorePaths: false); + } + MemberConfigurations.Add(expression); + memberOptions(expression); return this; } - protected virtual IMemberConfiguration CreateMemberConfigurationExpression(IMemberAccessor member, Type sourceType) + public IMappingExpression ForMember(Expression> destinationMember, Action> memberOptions) { - return new MemberConfigurationExpression(member, sourceType); + var memberInfo = ReflectionHelper.FindProperty(destinationMember); + return ForDestinationMember(memberInfo, memberOptions); } - protected virtual MappingExpression CreateReverseMapExpression() + private void IncludeMembersCore(LambdaExpression[] memberExpressions) { - return new MappingExpression(MemberList.Source, DestinationType, SourceType); + foreach(var member in memberExpressions) + { + member.EnsureMemberPath(nameof(memberExpressions)); + ForSourceMemberCore(new MemberPath(member).First, o => o.DoNotValidate()); + } + TypeMapActions.Add(tm => tm.IncludedMembers = memberExpressions); } - public IMappingExpression ForMember(Expression> destinationMember, - Action> memberOptions) + public IMappingExpression IncludeMembers(params Expression>[] memberExpressions) { - var memberInfo = ReflectionHelper.FindProperty(destinationMember); - IMemberAccessor destProperty = memberInfo.ToMemberAccessor(); - - ForDestinationMember(destProperty, memberOptions); - + IncludeMembersCore(memberExpressions); return this; } - public IMappingExpression ForMember(string name, - Action> memberOptions) + public IMappingExpression ForMember(string name, Action> memberOptions) { var member = DestinationType.GetFieldOrProperty(name); - ForDestinationMember(member.ToMemberAccessor(), memberOptions); - return this; + return ForDestinationMember(member, memberOptions); } public void ForAllOtherMembers(Action> memberOptions) { - _allMemberOptions = memberOptions; - _memberFilter = m => _memberConfigurations.All(c=>c.DestinationMember.MemberInfo != m.MemberInfo); + TypeMapActions.Add(typeMap => + { + foreach (var accessor in typeMap.DestinationTypeDetails.PublicReadAccessors.Where(m => GetDestinationMemberConfiguration(m) == null)) + { + ForDestinationMember(accessor, memberOptions); + } + }); } public void ForAllMembers(Action> memberOptions) { - _allMemberOptions = memberOptions; - _memberFilter = _ => true; - } - - public IMappingExpression IgnoreAllPropertiesWithAnInaccessibleSetter() - { - var properties = DestinationType.GetDeclaredProperties().Where(pm => pm.HasAnInaccessibleSetter()); - foreach (var property in properties) - ForMember(property.Name, opt => opt.Ignore()); - return this; - } - - public IMappingExpression IgnoreAllSourcePropertiesWithAnInaccessibleSetter() - { - var properties = SourceType.GetDeclaredProperties().Where(pm => pm.HasAnInaccessibleSetter()); - foreach (var property in properties) - ForSourceMember(property.Name, opt => opt.Ignore()); - return this; + TypeMapActions.Add(typeMap => + { + foreach (var accessor in typeMap.DestinationTypeDetails.PublicReadAccessors) + { + ForDestinationMember(accessor, memberOptions); + } + }); } public IMappingExpression Include() where TOtherSource : TSource where TOtherDestination : TDestination { - return Include(typeof(TOtherSource), typeof(TOtherDestination)); - } - - public IMappingExpression Include(Type otherSourceType, Type otherDestinationType) - { - TypeMapActions.Add(tm => tm.IncludeDerivedTypes(otherSourceType, otherDestinationType)); - + IncludeCore(typeof(TOtherSource), typeof(TOtherDestination)); + return this; } - public IMappingExpression IncludeBase() - { - return IncludeBase(typeof(TSourceBase), typeof(TDestinationBase)); - } - - public IMappingExpression IncludeBase(Type sourceBase, Type destinationBase) - { - TypeMapActions.Add(tm => tm.IncludeBaseTypes(sourceBase, destinationBase)); - - return this; - } - - public void ProjectUsing(Expression> projectionExpression) - { - TypeMapActions.Add(tm => tm.CustomProjection = projectionExpression); - } - - public IMappingExpression MaxDepth(int depth) - { - TypeMapActions.Add(tm => tm.MaxDepth = depth); - - return PreserveReferences(); - } - - public IMappingExpression ConstructUsingServiceLocator() - { - TypeMapActions.Add(tm => tm.ConstructDestinationUsingServiceLocator = true); - - return this; - } - - public IMappingExpression ReverseMap() - { - var mappingExpression = CreateReverseMapExpression(); - - _reverseMap = mappingExpression; - - return mappingExpression; - } + public IMappingExpression IncludeBase() + => IncludeBase(typeof(TSourceBase), typeof(TDestinationBase)); public IMappingExpression ForSourceMember(Expression> sourceMember, Action memberOptions) { @@ -286,256 +263,44 @@ public IMappingExpression ForSourceMember(Expression ForSourceMember(string sourceMemberName, Action memberOptions) - { - var memberInfo = SourceType.GetMember(sourceMemberName).First(); - - var srcConfig = new SourceMappingExpression(memberInfo); + public void As() where T : TDestination => As(typeof(T)); - memberOptions(srcConfig); - - _sourceMemberConfigurations.Add(srcConfig); - - return this; - } - - public IMappingExpression Substitute(Func substituteFunc) + public IMappingExpression AddTransform(Expression> transformer) { - TypeMapActions.Add(tm => - { - Expression> expr = (src, dest, ctxt) => substituteFunc(src); + var config = new ValueTransformerConfiguration(typeof(TValue), transformer); - tm.Substitution = expr; - }); + ValueTransformers.Add(config); return this; } - public void ConvertUsing(Func mappingFunction) - { - TypeMapActions.Add(tm => - { - Expression> expr = - (src, dest, ctxt) => mappingFunction(src); - - tm.CustomMapper = expr; - }); - } - - public void ConvertUsing(Func mappingFunction) - { - TypeMapActions.Add(tm => - { - Expression> expr = - (src, dest, ctxt) => mappingFunction(src, ctxt); - - tm.CustomMapper = expr; - }); - } - - public void ConvertUsing(ITypeConverter converter) - { - ConvertUsing(converter.Convert); - } - - public void ConvertUsing() where TTypeConverter : ITypeConverter - { - TypeMapActions.Add(tm => tm.TypeConverterType = typeof (TTypeConverter)); - } - - public IMappingExpression BeforeMap(Action beforeFunction) - { - TypeMapActions.Add(tm => - { - Expression> expr = - (src, dest, ctxt) => beforeFunction(src, dest); - - tm.AddBeforeMapAction(expr); - }); - - return this; - } - - public IMappingExpression BeforeMap(Action beforeFunction) - { - TypeMapActions.Add(tm => - { - Expression> expr = - (src, dest, ctxt) => beforeFunction(src, dest, ctxt); - - tm.AddBeforeMapAction(expr); - }); - - return this; - } - - public IMappingExpression BeforeMap() where TMappingAction : IMappingAction - { - Action beforeFunction = (src, dest, ctxt) => - ((TMappingAction)ctxt.Options.ServiceCtor(typeof(TMappingAction))).Process(src, dest); - - return BeforeMap(beforeFunction); - } - - public IMappingExpression AfterMap(Action afterFunction) - { - TypeMapActions.Add(tm => - { - Expression> expr = - (src, dest, ctxt) => afterFunction(src, dest); - - tm.AddAfterMapAction(expr); - }); - - return this; - } - - public IMappingExpression AfterMap(Action afterFunction) - { - TypeMapActions.Add(tm => - { - Expression> expr = - (src, dest, ctxt) => afterFunction(src, dest, ctxt); - - tm.AddAfterMapAction(expr); - }); - - return this; - } - - public IMappingExpression AfterMap() where TMappingAction : IMappingAction - { - Action afterFunction = (src, dest, ctxt) - => ((TMappingAction)ctxt.Options.ServiceCtor(typeof(TMappingAction))).Process(src, dest); - - return AfterMap(afterFunction); - } - - public IMappingExpression ConstructUsing(Func ctor) - { - TypeMapActions.Add(tm => - { - Expression> expr = (src, ctxt) => ctor(src); - - tm.DestinationCtor = expr; - }); - - return this; - } - - public IMappingExpression ConstructUsing(Func ctor) - { - TypeMapActions.Add(tm => - { - Expression> expr = (src, ctxt) => ctor(src, ctxt); - - tm.DestinationCtor = expr; - }); - - return this; - } - - public IMappingExpression ConstructProjectionUsing(Expression> ctor) + public IMappingExpression ReverseMap() { - TypeMapActions.Add(tm => - { - tm.ConstructExpression = ctor; - - var ctxtParam = Parameter(typeof (ResolutionContext), "ctxt"); - var srcParam = Parameter(typeof (TSource), "src"); - - var body = ctor.ReplaceParameters(srcParam); - - tm.DestinationCtor = Lambda(body, srcParam, ctxtParam); - }); - - return this; + var reverseMap = new MappingExpression(MemberList.None, Types.DestinationType, Types.SourceType); + reverseMap.MemberConfigurations.AddRange(MemberConfigurations.Select(m => m.Reverse()).Where(m => m != null)); + ReverseMapExpression = reverseMap; + reverseMap.IncludeMembersCore(MapToSourceMembers().Select(m => m.GetDestinationExpression()).ToArray()); + ReverseFeatures(); + return reverseMap; } - private void ForDestinationMember(IMemberAccessor destinationProperty, Action> memberOptions) + private IMappingExpression ForDestinationMember(MemberInfo destinationProperty, Action> memberOptions) { - var expression = (MemberConfigurationExpression) CreateMemberConfigurationExpression(destinationProperty, SourceType); + var expression = new MemberConfigurationExpression(destinationProperty, Types.SourceType); - _memberConfigurations.Add(expression); + MemberConfigurations.Add(expression); memberOptions(expression); - } - - public void As() - { - TypeMapActions.Add(tm => tm.DestinationTypeOverride = typeof(T)); - } - - public IMappingExpression ForCtorParam(string ctorParamName, Action> paramOptions) - { - var ctorParamExpression = new CtorParamConfigurationExpression(ctorParamName); - - paramOptions(ctorParamExpression); - - _ctorParamConfigurations.Add(ctorParamExpression); return this; } - public void Configure(IProfileConfiguration profile, TypeMap typeMap) - { - foreach (var destProperty in typeMap.DestinationTypeDetails.PublicWriteAccessors) - { - var attrs = destProperty.GetCustomAttributes(true); - if (attrs.Any(x => x is IgnoreMapAttribute)) - { - ForMember(destProperty.Name, y => y.Ignore()); - _reverseMap?.ForMember(destProperty.Name, opt => opt.Ignore()); - } - if (profile.GlobalIgnores.Contains(destProperty.Name)) - { - ForMember(destProperty.Name, y => y.Ignore()); - } - } - - if (_allMemberOptions != null) - { - foreach (var accessor in typeMap.DestinationTypeDetails.PublicReadAccessors.Select(m=>m.ToMemberAccessor()).Where(_memberFilter)) - { - ForDestinationMember(accessor, _allMemberOptions); - } - } - - foreach (var action in TypeMapActions) - { - action(typeMap); - } - foreach (var memberConfig in _memberConfigurations) - { - memberConfig.Configure(typeMap); - } - foreach (var memberConfig in _sourceMemberConfigurations) - { - memberConfig.Configure(typeMap); - } - foreach (var paramConfig in _ctorParamConfigurations) - { - paramConfig.Configure(typeMap); - } - - if (_reverseMap != null) - { - foreach (var destProperty in typeMap.GetPropertyMaps().Where(pm => pm.Ignored)) - { - _reverseMap.ForSourceMember(destProperty.DestinationProperty.Name, opt => opt.Ignore()); - } - foreach (var includedDerivedType in typeMap.IncludedDerivedTypes) - { - _reverseMap.Include(includedDerivedType.DestinationType, includedDerivedType.SourceType); - } - } - } - + protected override void IgnoreDestinationMember(MemberInfo property, bool ignorePaths = true) + => ForDestinationMember(property, options => options.Ignore(ignorePaths)); } -} - +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/MappingExpressionBase.cs b/src/AutoMapper/Configuration/MappingExpressionBase.cs new file mode 100644 index 0000000000..f913c797e2 --- /dev/null +++ b/src/AutoMapper/Configuration/MappingExpressionBase.cs @@ -0,0 +1,434 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration.Internal; +using AutoMapper.Features; +using AutoMapper.Internal; + +namespace AutoMapper.Configuration +{ + using static Expression; + + public abstract class MappingExpressionBase : ITypeMapConfiguration + { + protected MappingExpressionBase(MemberList memberList, Type sourceType, Type destinationType) + : this(memberList, new TypePair(sourceType, destinationType)) + { + } + + protected MappingExpressionBase(MemberList memberList, TypePair types) + { + Types = types; + IsOpenGeneric = types.SourceType.IsGenericTypeDefinition() || types.DestinationType.IsGenericTypeDefinition(); + TypeMapActions.Add(tm => tm.ConfiguredMemberList = memberList); + } + public TypePair Types { get; } + public bool IsOpenGeneric { get; } + public Type SourceType => Types.SourceType; + public Type DestinationType => Types.DestinationType; + public Features Features { get; } = new Features(); + public ITypeMapConfiguration ReverseTypeMap => ReverseMapExpression; + public IList ValueTransformers { get; } = new List(); + + protected MappingExpressionBase ReverseMapExpression { get; set; } + protected List> TypeMapActions { get; } = new List>(); + protected List MemberConfigurations { get; } = new List(); + protected List SourceMemberConfigurations { get; } = new List(); + protected List CtorParamConfigurations { get; } = new List(); + + public void Configure(TypeMap typeMap) + { + foreach(var destProperty in typeMap.DestinationTypeDetails.PublicWriteAccessors) + { + var attrs = destProperty.GetCustomAttributes(true); + if(attrs.Any(x => x is IgnoreMapAttribute)) + { + IgnoreDestinationMember(destProperty); + var sourceProperty = typeMap.SourceType.GetInheritedMember(destProperty.Name); + if(sourceProperty != null) + { + ReverseMapExpression?.IgnoreDestinationMember(sourceProperty); + } + } + if(typeMap.Profile.GlobalIgnores.Contains(destProperty.Name) && GetDestinationMemberConfiguration(destProperty) == null) + { + IgnoreDestinationMember(destProperty); + } + } + + foreach(var action in TypeMapActions) + { + action(typeMap); + } + foreach(var memberConfig in MemberConfigurations) + { + memberConfig.Configure(typeMap); + } + foreach(var memberConfig in SourceMemberConfigurations) + { + memberConfig.Configure(typeMap); + } + foreach(var paramConfig in CtorParamConfigurations) + { + paramConfig.Configure(typeMap); + } + foreach(var valueTransformer in ValueTransformers) + { + typeMap.AddValueTransformation(valueTransformer); + } + + Features.Configure(typeMap); + + if(ReverseMapExpression != null) + { + ReverseSourceMembers(typeMap); + foreach(var destProperty in typeMap.PropertyMaps.Where(pm => pm.Ignored)) + { + ReverseMapExpression.ForSourceMemberCore(destProperty.DestinationName, opt => opt.DoNotValidate()); + } + foreach(var includedDerivedType in typeMap.IncludedDerivedTypes) + { + ReverseMapExpression.IncludeCore(includedDerivedType.DestinationType, includedDerivedType.SourceType); + } + foreach(var includedBaseType in typeMap.IncludedBaseTypes) + { + ReverseMapExpression.IncludeBaseCore(includedBaseType.DestinationType, includedBaseType.SourceType); + } + ReverseIncludedMembers(typeMap); + } + } + + protected IEnumerable MapToSourceMembers() => + MemberConfigurations.Where(m => m.SourceExpression != null && m.SourceExpression.Body == m.SourceExpression.Parameters[0]); + + private void ReverseIncludedMembers(TypeMap typeMap) + { + foreach(var includedMember in typeMap.IncludedMembers) + { + var memberPath = new MemberPath(includedMember); + var newSource = Parameter(typeMap.DestinationType, "source"); + var customExpression = Lambda(newSource, newSource); + ReverseSourceMembers(memberPath, customExpression); + } + } + + private void ReverseSourceMembers(TypeMap typeMap) + { + foreach(var propertyMap in typeMap.PropertyMaps.Where(p => p.SourceMembers.Count() > 1 && !p.SourceMembers.Any(s => s is MethodInfo))) + { + var memberPath = new MemberPath(propertyMap.SourceMembers); + var customExpression = ExpressionFactory.MemberAccessLambda(propertyMap.DestinationMember); + ReverseSourceMembers(memberPath, customExpression); + } + } + + private void ReverseSourceMembers(MemberPath memberPath, LambdaExpression customExpression) + { + ReverseMapExpression.TypeMapActions.Add(reverseTypeMap => + { + var newDestination = Parameter(reverseTypeMap.DestinationType, "destination"); + var path = memberPath.Members.MemberAccesses(newDestination); + var forPathLambda = Lambda(path, newDestination); + + var pathMap = reverseTypeMap.FindOrCreatePathMapFor(forPathLambda, memberPath, reverseTypeMap); + + pathMap.CustomMapExpression = customExpression; + }); + } + + protected void ForSourceMemberCore(string sourceMemberName, Action memberOptions) + { + var memberInfo = Types.SourceType.GetFieldOrProperty(sourceMemberName); + + ForSourceMemberCore(memberInfo, memberOptions); + } + + protected void ForSourceMemberCore(MemberInfo memberInfo, Action memberOptions) + { + var srcConfig = new SourceMappingExpression(memberInfo); + + memberOptions(srcConfig); + + SourceMemberConfigurations.Add(srcConfig); + } + + protected void IncludeCore(Type otherSourceType, Type otherDestinationType) + { + CheckIsDerived(otherSourceType, Types.SourceType); + CheckIsDerived(otherDestinationType, Types.DestinationType); + TypeMapActions.Add(tm => tm.IncludeDerivedTypes(otherSourceType, otherDestinationType)); + } + + protected void CheckIsDerived(Type derivedType, Type baseType) + { + if(!baseType.IsAssignableFrom(derivedType) && !derivedType.IsGenericTypeDefinition() && !baseType.IsGenericTypeDefinition()) + { + throw new ArgumentOutOfRangeException(nameof(derivedType), $"{derivedType} is not derived from {baseType}."); + } + } + + protected void IncludeBaseCore(Type sourceBase, Type destinationBase) + { + CheckIsDerived(Types.SourceType, sourceBase); + CheckIsDerived(Types.DestinationType, destinationBase); + TypeMapActions.Add(tm => tm.IncludeBaseTypes(sourceBase, destinationBase)); + } + + protected IPropertyMapConfiguration GetDestinationMemberConfiguration(MemberInfo destinationMember) => + MemberConfigurations.FirstOrDefault(m => m.DestinationMember.Name == destinationMember.Name); + + protected abstract void IgnoreDestinationMember(MemberInfo property, bool ignorePaths = true); + } + + public abstract class MappingExpressionBase + : MappingExpressionBase, IMappingExpressionBase + where TMappingExpression : class, IMappingExpressionBase + { + + protected MappingExpressionBase(MemberList memberList) + : base(memberList, typeof(TSource), typeof(TDestination)) + { + } + + protected MappingExpressionBase(MemberList memberList, Type sourceType, Type destinationType) + : base(memberList, sourceType, destinationType) + { + } + + protected MappingExpressionBase(MemberList memberList, TypePair types) + : base(memberList, types) + { + } + + public TMappingExpression MaxDepth(int depth) + { + TypeMapActions.Add(tm => tm.MaxDepth = depth); + + return this as TMappingExpression; + } + + protected void ReverseFeatures() => Features.ReverseTo(ReverseMapExpression.Features); + + public TMappingExpression ConstructUsingServiceLocator() + { + TypeMapActions.Add(tm => tm.ConstructDestinationUsingServiceLocator = true); + + return this as TMappingExpression; + } + + public TMappingExpression BeforeMap(Action beforeFunction) + { + TypeMapActions.Add(tm => + { + Expression> expr = + (src, dest, ctxt) => beforeFunction(src, dest); + + tm.AddBeforeMapAction(expr); + }); + + return this as TMappingExpression; + } + + public TMappingExpression BeforeMap(Action beforeFunction) + { + TypeMapActions.Add(tm => + { + Expression> expr = + (src, dest, ctxt) => beforeFunction(src, dest, ctxt); + + tm.AddBeforeMapAction(expr); + }); + + return this as TMappingExpression; + } + + public TMappingExpression BeforeMap() where TMappingAction : IMappingAction + { + void BeforeFunction(TSource src, TDestination dest, ResolutionContext ctxt) + => ((TMappingAction)ctxt.Options.ServiceCtor(typeof(TMappingAction))).Process(src, dest); + + return BeforeMap(BeforeFunction); + } + + public TMappingExpression AfterMap(Action afterFunction) + { + TypeMapActions.Add(tm => + { + Expression> expr = + (src, dest, ctxt) => afterFunction(src, dest); + + tm.AddAfterMapAction(expr); + }); + + return this as TMappingExpression; + } + + public TMappingExpression AfterMap(Action afterFunction) + { + TypeMapActions.Add(tm => + { + Expression> expr = + (src, dest, ctxt) => afterFunction(src, dest, ctxt); + + tm.AddAfterMapAction(expr); + }); + + return this as TMappingExpression; + } + + public TMappingExpression AfterMap() where TMappingAction : IMappingAction + { + void AfterFunction(TSource src, TDestination dest, ResolutionContext ctxt) + => ((TMappingAction)ctxt.Options.ServiceCtor(typeof(TMappingAction))).Process(src, dest); + + return AfterMap(AfterFunction); + } + + public TMappingExpression PreserveReferences() + { + TypeMapActions.Add(tm => tm.PreserveReferences = true); + + return this as TMappingExpression; + } + + public TMappingExpression DisableCtorValidation() + { + TypeMapActions.Add(tm => + { + tm.DisableConstructorValidation = true; + }); + + return this as TMappingExpression; + } + + public TMappingExpression ValidateMemberList(MemberList memberList) + { + TypeMapActions.Add(tm => + { + tm.ConfiguredMemberList = memberList; + }); + return this as TMappingExpression; + } + + public TMappingExpression IncludeAllDerived() + { + TypeMapActions.Add(tm => tm.IncludeAllDerivedTypes = true); + return this as TMappingExpression; + } + + public TMappingExpression Include(Type otherSourceType, Type otherDestinationType) + { + IncludeCore(otherSourceType, otherDestinationType); + + return this as TMappingExpression; + } + + public TMappingExpression IncludeBase(Type sourceBase, Type destinationBase) + { + IncludeBaseCore(sourceBase, destinationBase); + + return this as TMappingExpression; + } + + public TMappingExpression ForSourceMember(string sourceMemberName, Action memberOptions) + { + ForSourceMemberCore(sourceMemberName, memberOptions); + + return this as TMappingExpression; + } + + public void As(Type typeOverride) + { + CheckIsDerived(typeOverride, Types.DestinationType); + TypeMapActions.Add(tm => tm.DestinationTypeOverride = typeOverride); + } + + public TMappingExpression ConstructUsing(Expression> ctor) + { + TypeMapActions.Add(tm => tm.CustomCtorExpression = ctor); + + return this as TMappingExpression; + } + + public TMappingExpression ConstructUsing(Func ctor) + { + TypeMapActions.Add(tm => + { + Expression> expr = (src, ctxt) => ctor(src, ctxt); + + tm.CustomCtorFunction = expr; + }); + + return this as TMappingExpression; + } + + public void ConvertUsing(Type typeConverterType) + => TypeMapActions.Add(tm => tm.TypeConverterType = typeConverterType); + + public void ConvertUsing(Func mappingFunction) + { + TypeMapActions.Add(tm => + { + Expression> expr = + (src, dest, ctxt) => mappingFunction(src, dest); + + tm.CustomMapFunction = expr; + }); + } + + public void ConvertUsing(Func mappingFunction) + { + TypeMapActions.Add(tm => + { + Expression> expr = + (src, dest, ctxt) => mappingFunction(src, dest, ctxt); + + tm.CustomMapFunction = expr; + }); + } + + public void ConvertUsing(ITypeConverter converter) + { + ConvertUsing(converter.Convert); + } + + public void ConvertUsing() where TTypeConverter : ITypeConverter + { + TypeMapActions.Add(tm => tm.TypeConverterType = typeof(TTypeConverter)); + } + + public TMappingExpression ForCtorParam(string ctorParamName, Action> paramOptions) + { + var ctorParamExpression = new CtorParamConfigurationExpression(ctorParamName); + + paramOptions(ctorParamExpression); + + CtorParamConfigurations.Add(ctorParamExpression); + + return this as TMappingExpression; + } + + public TMappingExpression IgnoreAllPropertiesWithAnInaccessibleSetter() + { + foreach(var property in Types.DestinationType.PropertiesWithAnInaccessibleSetter()) + { + IgnoreDestinationMember(property); + } + return this as TMappingExpression; + } + + public TMappingExpression IgnoreAllSourcePropertiesWithAnInaccessibleSetter() + { + foreach (var property in Types.SourceType.PropertiesWithAnInaccessibleSetter()) + { + ForSourceMember(property.Name, options => options.DoNotValidate()); + } + return this as TMappingExpression; + } + + public void ConvertUsing(Expression> mappingFunction) => + TypeMapActions.Add(tm => tm.CustomMapExpression = mappingFunction); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/MemberConfigurationExpression.cs b/src/AutoMapper/Configuration/MemberConfigurationExpression.cs index 3623b37b06..2c34c745bc 100644 --- a/src/AutoMapper/Configuration/MemberConfigurationExpression.cs +++ b/src/AutoMapper/Configuration/MemberConfigurationExpression.cs @@ -1,48 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + namespace AutoMapper.Configuration { - using System; - using System.Collections.Generic; - using System.Reflection; - using System.Linq; - using System.Linq.Expressions; - - public interface IMemberConfiguration - { - void Configure(TypeMap typeMap); - IMemberAccessor DestinationMember { get; } - } + using static AutoMapper.Internal.ExpressionFactory; - public class MemberConfigurationExpression : IMemberConfigurationExpression, IMemberConfiguration + public class MemberConfigurationExpression : IMemberConfigurationExpression, IPropertyMapConfiguration { - private readonly IMemberAccessor _destinationMember; + private LambdaExpression _sourceMember; private readonly Type _sourceType; - protected List> PropertyMapActions { get; } = new List>(); + protected List> PropertyMapActions { get; } = new List>(); - public MemberConfigurationExpression(IMemberAccessor destinationMember, Type sourceType) + public MemberConfigurationExpression(MemberInfo destinationMember, Type sourceType) { - _destinationMember = destinationMember; + DestinationMember = destinationMember; _sourceType = sourceType; } - public IMemberAccessor DestinationMember => _destinationMember; + public MemberInfo DestinationMember { get; } + + public void MapAtRuntime() + { + PropertyMapActions.Add(pm => pm.Inline = false); + } - public void NullSubstitute(TMember nullSubstitute) + public void NullSubstitute(object nullSubstitute) { PropertyMapActions.Add(pm => pm.NullSubstitute = nullSubstitute); } - public void ResolveUsing() - where TValueResolver : IValueResolver + public void MapFrom() + where TValueResolver : IValueResolver { - var config = new ValueResolverConfiguration(typeof(TValueResolver)); + var config = new ValueResolverConfiguration(typeof(TValueResolver), typeof(IValueResolver)); PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - public void ResolveUsing(Expression> sourceMember) - where TValueResolver : IValueResolver + public void MapFrom(Expression> sourceMember) + where TValueResolver : IMemberValueResolver { - var config = new ValueResolverConfiguration(typeof (TValueResolver)) + var config = new ValueResolverConfiguration(typeof(TValueResolver), typeof(IMemberValueResolver)) { SourceMember = sourceMember }; @@ -50,10 +51,10 @@ public void ResolveUsing(Expression pm.ValueResolverConfig = config); } - public void ResolveUsing(string sourceMemberName) - where TValueResolver : IValueResolver + public void MapFrom(string sourceMemberName) + where TValueResolver : IMemberValueResolver { - var config = new ValueResolverConfiguration(typeof (TValueResolver)) + var config = new ValueResolverConfiguration(typeof(TValueResolver), typeof(IMemberValueResolver)) { SourceMemberName = sourceMemberName }; @@ -61,16 +62,16 @@ public void ResolveUsing(string sourceMemberName) PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - public void ResolveUsing(IValueResolver valueResolver) + public void MapFrom(IValueResolver valueResolver) { - var config = new ValueResolverConfiguration(valueResolver); + var config = new ValueResolverConfiguration(valueResolver, typeof(IValueResolver)); PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - public void ResolveUsing(IValueResolver valueResolver, Expression> sourceMember) + public void MapFrom(IMemberValueResolver valueResolver, Expression> sourceMember) { - var config = new ValueResolverConfiguration(valueResolver) + var config = new ValueResolverConfiguration(valueResolver, typeof(IMemberValueResolver)) { SourceMember = sourceMember }; @@ -78,43 +79,51 @@ public void ResolveUsing(IValueResolver v PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); } - public void ResolveUsing(Func resolver) + public void MapFrom(Func mappingFunction) { PropertyMapActions.Add(pm => { - Expression> expr = (src, ctxt) => resolver(src); + Expression> expr = (src, dest, destMember, ctxt) => mappingFunction(src, dest); - pm.CustomResolver = expr; + pm.CustomMapFunction = expr; }); } - public void ResolveUsing(Func resolver) + public void MapFrom(Func mappingFunction) { PropertyMapActions.Add(pm => { - Expression> expr = (src, ctxt) => resolver(src, ctxt); + Expression> expr = (src, dest, destMember, ctxt) => mappingFunction(src, dest, destMember); - pm.CustomResolver = expr; + pm.CustomMapFunction = expr; }); } - public void MapFrom(Expression> sourceMember) + public void MapFrom(Func mappingFunction) { - PropertyMapActions.Add(pm => pm.SetCustomValueResolverExpression(sourceMember)); + PropertyMapActions.Add(pm => + { + Expression> expr = (src, dest, destMember, ctxt) => mappingFunction(src, dest, destMember, ctxt); + + pm.CustomMapFunction = expr; + }); } - public void MapFrom(string sourceMember) + public void MapFrom(Expression> mapExpression) { - var memberInfo = _sourceType.GetMember(sourceMember).FirstOrDefault(); - if (memberInfo == null) - throw new AutoMapperConfigurationException($"Cannot find member {sourceMember} of type {_sourceType}"); + MapFromUntyped(mapExpression); + } - PropertyMapActions.Add(pm => pm.CustomSourceMember = memberInfo); + internal void MapFromUntyped(LambdaExpression sourceExpression) + { + _sourceMember = sourceExpression; + PropertyMapActions.Add(pm => pm.MapFrom(sourceExpression)); } - public void UseValue(TValue value) + public void MapFrom(string sourceMemberName) { - PropertyMapActions.Add(pm => pm.CustomValue = value); + _sourceType.GetFieldOrProperty(sourceMemberName); + PropertyMapActions.Add(pm => pm.MapFrom(sourceMemberName)); } public void Condition(Func condition) @@ -172,36 +181,80 @@ public void Condition(Func condition) }); } - public void PreCondition(Func condition) - { - PropertyMapActions.Add(pm => - { - Expression> expr = - (src, ctxt) => condition(src); - - pm.PreCondition = expr; - }); + public void PreCondition(Func condition) + { + PropertyMapActions.Add(pm => + { + Expression> expr = + (src, dest, ctxt) => condition(src); + + pm.PreCondition = expr; + }); + } + + public void PreCondition(Func condition) + { + PropertyMapActions.Add(pm => + { + Expression> expr = + (src, dest, ctxt) => condition(ctxt); + + pm.PreCondition = expr; + }); + } + + public void PreCondition(Func condition) + { + PropertyMapActions.Add(pm => + { + Expression> expr = + (src, dest, ctxt) => condition(src, ctxt); + + pm.PreCondition = expr; + }); + } + + public void PreCondition(Func condition) + { + PropertyMapActions.Add(pm => + { + Expression> expr = + (src, dest, ctxt) => condition(src, dest, ctxt); + + pm.PreCondition = expr; + }); } - public void PreCondition(Func condition) + public void AddTransform(Expression> transformer) { PropertyMapActions.Add(pm => { - Expression> expr = - (src, ctxt) => condition(ctxt); + var config = new ValueTransformerConfiguration(typeof(TMember), transformer); - pm.PreCondition = expr; + pm.AddValueTransformation(config); }); - } + } public void ExplicitExpansion() { PropertyMapActions.Add(pm => pm.ExplicitExpansion = true); } - public void Ignore() + public void Ignore() => Ignore(ignorePaths: true); + + public void Ignore(bool ignorePaths) => + PropertyMapActions.Add(pm => + { + pm.Ignored = true; + if(ignorePaths) + { + pm.TypeMap.IgnorePaths(DestinationMember); + } + }); + + public void AllowNull() { - PropertyMapActions.Add(pm => pm.Ignored = true); + PropertyMapActions.Add(pm => pm.AllowNull = true); } public void UseDestinationValue() @@ -209,24 +262,86 @@ public void UseDestinationValue() PropertyMapActions.Add(pm => pm.UseDestinationValue = true); } - public void DoNotUseDestinationValue() + public void SetMappingOrder(int mappingOrder) + { + PropertyMapActions.Add(pm => pm.MappingOrder = mappingOrder); + } + + public void ConvertUsing() + where TValueConverter : IValueConverter + => PropertyMapActions.Add(pm => ConvertUsing(pm)); + + public void ConvertUsing(Expression> sourceMember) + where TValueConverter : IValueConverter + => PropertyMapActions.Add(pm => ConvertUsing(pm, sourceMember)); + + public void ConvertUsing(string sourceMemberName) + where TValueConverter : IValueConverter + => PropertyMapActions.Add(pm => ConvertUsing(pm, sourceMemberName: sourceMemberName)); + + public void ConvertUsing(IValueConverter valueConverter) + => PropertyMapActions.Add(pm => ConvertUsing(pm, valueConverter)); + + public void ConvertUsing(IValueConverter valueConverter, Expression> sourceMember) + => PropertyMapActions.Add(pm => ConvertUsing(pm, valueConverter, sourceMember)); + + public void ConvertUsing(IValueConverter valueConverter, string sourceMemberName) + => PropertyMapActions.Add(pm => ConvertUsing(pm, valueConverter, sourceMemberName: sourceMemberName)); + + private static void ConvertUsing(PropertyMap propertyMap, + Expression> sourceMember = null, + string sourceMemberName = null) { - PropertyMapActions.Add(pm => pm.UseDestinationValue = false); + var config = new ValueConverterConfiguration(typeof(TValueConverter), + typeof(IValueConverter)) + { + SourceMember = sourceMember, + SourceMemberName = sourceMemberName + }; + + propertyMap.ValueConverterConfig = config; } - public void SetMappingOrder(int mappingOrder) + private static void ConvertUsing(PropertyMap propertyMap, IValueConverter valueConverter, + Expression> sourceMember = null, string sourceMemberName = null) { - PropertyMapActions.Add(pm => pm.MappingOrder = mappingOrder); + var config = new ValueConverterConfiguration(valueConverter, + typeof(IValueConverter)) + { + SourceMember = sourceMember, + SourceMemberName = sourceMemberName + }; + + propertyMap.ValueConverterConfig = config; } public void Configure(TypeMap typeMap) { - var propertyMap = typeMap.FindOrCreatePropertyMapFor(_destinationMember); + var destMember = DestinationMember; - foreach (var action in PropertyMapActions) + if(destMember.DeclaringType.IsGenericTypeDefinition()) + { + destMember = typeMap.DestinationTypeDetails.PublicReadAccessors.Single(m => m.Name == destMember.Name); + } + + var propertyMap = typeMap.FindOrCreatePropertyMapFor(destMember); + + Apply(propertyMap); + } + + private void Apply(PropertyMap propertyMap) + { + foreach(var action in PropertyMapActions) { action(propertyMap); } - } + propertyMap.CheckMappedReadonly(); + } + + public LambdaExpression SourceExpression => _sourceMember; + public LambdaExpression GetDestinationExpression() => MemberAccessLambda(DestinationMember); + + public IPropertyMapConfiguration Reverse() => + PathConfigurationExpression.Create(_sourceMember, GetDestinationExpression()); } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/MemberPath.cs b/src/AutoMapper/Configuration/MemberPath.cs new file mode 100644 index 0000000000..d63937ed94 --- /dev/null +++ b/src/AutoMapper/Configuration/MemberPath.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.Internal +{ + public struct MemberPath : IEquatable + { + private readonly MemberInfo[] _members; + public IEnumerable Members => _members; + + public MemberPath(Expression destinationExpression) : this(MemberVisitor.GetMemberPath(destinationExpression).Reverse()) + { + } + + public MemberPath(IEnumerable members) + { + _members = members.ToArray(); + } + + public MemberInfo Last => _members[_members.Length - 1]; + + public MemberInfo First => _members[0]; + + public int Length => _members.Length; + + public bool Equals(MemberPath other) => Members.SequenceEqual(other.Members); + + public override bool Equals(object obj) + { + if(ReferenceEquals(null, obj)) return false; + return obj is MemberPath && Equals((MemberPath)obj); + } + + public override int GetHashCode() + { + var hashCode = 0; + foreach(var member in Members) + { + hashCode = HashCodeCombiner.CombineCodes(hashCode, member.GetHashCode()); + } + return hashCode; + } + + public override string ToString() + => string.Join(".", Members.Select(mi => mi.Name)); + + public static bool operator==(MemberPath left, MemberPath right) => left.Equals(right); + + public static bool operator!=(MemberPath left, MemberPath right) => !left.Equals(right); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/PathConfigurationExpression.cs b/src/AutoMapper/Configuration/PathConfigurationExpression.cs new file mode 100644 index 0000000000..626ebcc5e9 --- /dev/null +++ b/src/AutoMapper/Configuration/PathConfigurationExpression.cs @@ -0,0 +1,93 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; + +namespace AutoMapper.Configuration +{ + public class PathConfigurationExpression : IPathConfigurationExpression, IPropertyMapConfiguration + { + private readonly LambdaExpression _destinationExpression; + private LambdaExpression _sourceExpression; + protected List> PathMapActions { get; } = new List>(); + + public PathConfigurationExpression(LambdaExpression destinationExpression) + { + _destinationExpression = destinationExpression; + MemberPath = new MemberPath(destinationExpression); + } + + public MemberPath MemberPath { get; } + + public MemberInfo DestinationMember => MemberPath.Last; + + public void MapFrom(Expression> sourceExpression) + { + MapFromUntyped(sourceExpression); + } + + public void Ignore() + { + PathMapActions.Add(pm => pm.Ignored = true); + } + + public void MapFromUntyped(LambdaExpression sourceExpression) + { + _sourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression), $"{nameof(sourceExpression)} may not be null when mapping {DestinationMember.Name} from {typeof(TSource)} to {typeof(TDestination)}."); + PathMapActions.Add(pm => + { + pm.CustomMapExpression = sourceExpression; + pm.Ignored = false; + }); + } + + public void Configure(TypeMap typeMap) + { + var pathMap = typeMap.FindOrCreatePathMapFor(_destinationExpression, MemberPath, typeMap); + + Apply(pathMap); + } + + private void Apply(PathMap pathMap) + { + foreach (var action in PathMapActions) + { + action(pathMap); + } + } + + internal static IPropertyMapConfiguration Create(LambdaExpression destination, LambdaExpression source) + { + if (destination == null || !destination.IsMemberPath()) + { + return null; + } + var reversed = new PathConfigurationExpression(destination); + if (reversed.MemberPath.Length == 1) + { + var reversedMemberExpression = new MemberConfigurationExpression(reversed.DestinationMember, typeof(TSource)); + reversedMemberExpression.MapFromUntyped(source); + return reversedMemberExpression; + } + reversed.MapFromUntyped(source); + return reversed; + } + + public LambdaExpression SourceExpression => _sourceExpression; + public LambdaExpression GetDestinationExpression() => _destinationExpression; + public IPropertyMapConfiguration Reverse() => Create(_sourceExpression, _destinationExpression); + + public void Condition(Func, bool> condition) + { + PathMapActions.Add(pm => + { + Expression> expr = + (src, dest, srcMember, destMember, ctxt) => + condition(new ConditionParameters(src, dest, srcMember, destMember, ctxt)); + pm.Condition = expr; + }); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/PrimitiveExtensions.cs b/src/AutoMapper/Configuration/PrimitiveExtensions.cs index ce6fc0d8bf..33e514f83c 100644 --- a/src/AutoMapper/Configuration/PrimitiveExtensions.cs +++ b/src/AutoMapper/Configuration/PrimitiveExtensions.cs @@ -1,142 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using AutoMapper.Configuration.Internal; + namespace AutoMapper.Configuration { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - - public static class PrimitiveExtensions + internal static class PrimitiveExtensions { - public static TValue GetOrDefault(this IDictionary dictionary, TKey key) + public static void ForAll(this IEnumerable enumerable, Action action) { - TValue value; - dictionary.TryGetValue(key, out value); - return value; - } - - public static MemberInfo GetFieldOrProperty(this Type type, string name) - { - var memberInfo = new[] { type } - .RecursiveSelect(i => i.GetTypeInfo().ImplementedInterfaces) - .Distinct() - .Select(i => i.GetMember(name).FirstOrDefault()) - .FirstOrDefault(m => m != null); - if(memberInfo == null) - { - throw new ArgumentOutOfRangeException(nameof(name), "Cannot find a field or property named " + name); - } - return memberInfo; + foreach (var feature in enumerable) + { + action(feature); + } } - public static bool IsNullableType(this Type type) - { - return type.IsGenericType() && (type.GetGenericTypeDefinition().Equals(typeof(Nullable<>))); - } + public static bool IsSetType(this Type type) + => type.ImplementsGenericInterface(typeof(ISet<>)); + + public static TValue GetOrDefault(this IDictionary dictionary, TKey key) + => PrimitiveHelper.GetOrDefault(dictionary, key); + + public static MethodInfo GetInheritedMethod(this Type type, string name) + => PrimitiveHelper.GetInheritedMethod(type, name); + + public static MemberInfo GetFieldOrProperty(this Type type, string name) + => PrimitiveHelper.GetFieldOrProperty(type, name); + + public static bool IsNullableType(this Type type) + => PrimitiveHelper.IsNullableType(type); public static Type GetTypeOfNullable(this Type type) - { - return type.GetTypeInfo().GenericTypeArguments[0]; - } + => PrimitiveHelper.GetTypeOfNullable(type); public static bool IsCollectionType(this Type type) - { - if(type.IsGenericType() && type.GetGenericTypeDefinition() == typeof(ICollection<>)) - { - return true; - } + => PrimitiveHelper.IsCollectionType(type); - IEnumerable genericInterfaces = type.GetTypeInfo().ImplementedInterfaces.Where(t => t.IsGenericType()); - IEnumerable baseDefinitions = genericInterfaces.Select(t => t.GetGenericTypeDefinition()); - - var isCollectionType = baseDefinitions.Any(t => t == typeof(ICollection<>)); - - return isCollectionType; - } - - - public static bool IsEnumerableType(this Type type) - { - return type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IEnumerable)); - } + public static bool IsEnumerableType(this Type type) + => PrimitiveHelper.IsEnumerableType(type); public static bool IsQueryableType(this Type type) - { - return type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IQueryable)); - } - - public static bool IsListType(this Type type) - { - return type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IList)); - } - - public static bool IsListOrDictionaryType(this Type type) - { - return type.IsListType() || type.IsDictionaryType(); - } - - public static bool IsDictionaryType(this Type type) - { - if(type.IsGenericType() && - type.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IDictionary<,>)) - return true; - - var genericInterfaces = type.GetTypeInfo().ImplementedInterfaces.Where(t => t.IsGenericType()); - var baseDefinitions = genericInterfaces.Select(t => t.GetGenericTypeDefinition()); - return baseDefinitions.Any(t => t == typeof(System.Collections.Generic.IDictionary<,>)); - } - - public static Type GetDictionaryType(this Type type) - { - if(type.IsGenericType() && - type.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IDictionary<,>)) - return type; - - var genericInterfaces = - type.GetTypeInfo().ImplementedInterfaces - .Where( - t => - t.IsGenericType() && - t.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IDictionary<,>)); - return genericInterfaces.FirstOrDefault(); - } + => PrimitiveHelper.IsQueryableType(type); + + public static bool IsListType(this Type type) + => PrimitiveHelper.IsListType(type); + + public static bool IsListOrDictionaryType(this Type type) + => PrimitiveHelper.IsListOrDictionaryType(type); + + public static bool IsDictionaryType(this Type type) + => PrimitiveHelper.IsDictionaryType(type); + + public static bool IsReadOnlyDictionaryType(this Type type) + => PrimitiveHelper.IsReadOnlyDictionaryType(type); + + public static bool ImplementsGenericInterface(this Type type, Type interfaceType) + => PrimitiveHelper.ImplementsGenericInterface(type, interfaceType); + + public static bool IsGenericType(this Type type, Type genericType) + => PrimitiveHelper.IsGenericType(type, genericType); + + public static Type GetIEnumerableType(this Type type) + => PrimitiveHelper.GetIEnumerableType(type); + + public static Type GetDictionaryType(this Type type) + => PrimitiveHelper.GetDictionaryType(type); + + public static Type GetReadOnlyDictionaryType(this Type type) + => PrimitiveHelper.GetReadOnlyDictionaryType(type); + + public static Type GetGenericInterface(this Type type, Type genericInterface) + => PrimitiveHelper.GetGenericInterface(type, genericInterface); public static Type GetGenericElementType(this Type type) - { - if(type.HasElementType) - return type.GetElementType(); - return type.GetTypeInfo().GenericTypeArguments[0]; - } - - public static IEnumerable RecursiveSelect(this IEnumerable source, Func> childSelector) - { - return RecursiveSelect(source, childSelector, element => element); - } - - public static IEnumerable RecursiveSelect(this IEnumerable source, - Func> childSelector, Func selector) - { - return RecursiveSelect(source, childSelector, (element, index, depth) => selector(element)); - } - - public static IEnumerable RecursiveSelect(this IEnumerable source, - Func> childSelector, Func selector) - { - return RecursiveSelect(source, childSelector, (element, index, depth) => selector(element, index)); - } - - public static IEnumerable RecursiveSelect(this IEnumerable source, - Func> childSelector, Func selector) - { - return RecursiveSelect(source, childSelector, selector, 0); - } - - private static IEnumerable RecursiveSelect(this IEnumerable source, - Func> childSelector, Func selector, int depth) - { - return source.SelectMany((element, index) => Enumerable.Repeat(selector(element, index, depth), 1) - .Concat(RecursiveSelect(childSelector(element) ?? Enumerable.Empty(), - childSelector, selector, depth + 1))); - } + => PrimitiveHelper.GetGenericElementType(type); } } \ No newline at end of file diff --git a/src/AutoMapper/Configuration/ResolutionExpression.cs b/src/AutoMapper/Configuration/ResolutionExpression.cs deleted file mode 100644 index da9e396db0..0000000000 --- a/src/AutoMapper/Configuration/ResolutionExpression.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace AutoMapper.Configuration -{ - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - - public class ResolutionExpression : IResolverConfigurationExpression, IResolutionExpression - { - private readonly ValueResolverConfiguration _config; - private readonly List> _propertyMapActions = new List>(); - - public ResolutionExpression(ValueResolverConfiguration config) - { - _config = config; - - _propertyMapActions.Add(pm => pm.ValueResolverConfig = _config); - } - - public void FromMember(Expression> sourceMember) - { - _config.SourceMember = sourceMember; - } - - public void FromMember(string sourcePropertyName) - { - _config.SourceMemberName = sourcePropertyName; - } - - public void Configure(PropertyMap propertyMap) - { - foreach (var action in _propertyMapActions) - { - action(propertyMap); - } - } - } - - public class ResolutionExpression : ResolutionExpression - { - public ResolutionExpression(ValueResolverConfiguration config) : base(config) - { - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Configuration/SourceMappingExpression.cs b/src/AutoMapper/Configuration/SourceMappingExpression.cs index c7e29b8ea1..95a906c69e 100644 --- a/src/AutoMapper/Configuration/SourceMappingExpression.cs +++ b/src/AutoMapper/Configuration/SourceMappingExpression.cs @@ -1,23 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + namespace AutoMapper.Configuration { - using System; - using System.Collections.Generic; - using System.Reflection; - - public class SourceMappingExpression : ISourceMemberConfigurationExpression + public class SourceMappingExpression : ISourceMemberConfigurationExpression, ISourceMemberConfiguration { private readonly MemberInfo _sourceMember; private readonly List> _sourceMemberActions = new List>(); - public SourceMappingExpression(MemberInfo sourceMember) - { - _sourceMember = sourceMember; - } + public SourceMappingExpression(MemberInfo sourceMember) => _sourceMember = sourceMember; - public void Ignore() - { - _sourceMemberActions.Add(smc => smc.Ignore()); - } + public void DoNotValidate() => _sourceMemberActions.Add(smc => smc.Ignore()); public void Configure(TypeMap typeMap) { diff --git a/src/AutoMapper/Configuration/SourceMemberConfig.cs b/src/AutoMapper/Configuration/SourceMemberConfig.cs index 79a9e20060..5b1d29f8c9 100644 --- a/src/AutoMapper/Configuration/SourceMemberConfig.cs +++ b/src/AutoMapper/Configuration/SourceMemberConfig.cs @@ -1,7 +1,7 @@ +using System.Reflection; + namespace AutoMapper.Configuration { - using System.Reflection; - /// /// Contains member configuration relating to source members /// @@ -9,12 +9,9 @@ public class SourceMemberConfig { private bool _ignored; - public SourceMemberConfig(MemberInfo sourceMember) - { - SourceMember = sourceMember; - } + public SourceMemberConfig(MemberInfo sourceMember) => SourceMember = sourceMember; - public MemberInfo SourceMember { get; private set; } + public MemberInfo SourceMember { get; } public void Ignore() => _ignored = true; diff --git a/src/AutoMapper/ConfigurationValidator.cs b/src/AutoMapper/ConfigurationValidator.cs index 50e8ab76db..1f2d8a7b59 100644 --- a/src/AutoMapper/ConfigurationValidator.cs +++ b/src/AutoMapper/ConfigurationValidator.cs @@ -1,29 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper.Configuration; + namespace AutoMapper { - using System; - using System.Collections.Generic; - using System.Linq; - using Configuration; - using Mappers; - public class ConfigurationValidator { private readonly IConfigurationProvider _config; - public ConfigurationValidator(IConfigurationProvider config) - { - _config = config; - } + public ConfigurationValidator(IConfigurationProvider config) => _config = config; public void AssertConfigurationIsValid(IEnumerable typeMaps) { var maps = typeMaps as TypeMap[] ?? typeMaps.ToArray(); var badTypeMaps = (from typeMap in maps - where typeMap.ShouldCheckForValid() + where typeMap.ShouldCheckForValid let unmappedPropertyNames = typeMap.GetUnmappedPropertyNames() - where unmappedPropertyNames.Length > 0 - select new AutoMapperConfigurationException.TypeMapConfigErrors(typeMap, unmappedPropertyNames) + let canConstruct = typeMap.PassesCtorValidation + where unmappedPropertyNames.Length > 0 || !canConstruct + select new AutoMapperConfigurationException.TypeMapConfigErrors(typeMap, unmappedPropertyNames, canConstruct) ).ToArray(); if (badTypeMaps.Any()) @@ -38,8 +35,7 @@ where unmappedPropertyNames.Length > 0 { try { - DryRunTypeMap(typeMapsChecked, - new ResolutionContext(null, null, typeMap.Types, new MappingOperationOptions(_config.ServiceCtor), new Mapper(_config)) {TypeMap = typeMap}); + DryRunTypeMap(typeMapsChecked, typeMap.Types, typeMap, null); } catch (Exception e) { @@ -57,53 +53,67 @@ where unmappedPropertyNames.Length > 0 } } - private void DryRunTypeMap(ICollection typeMapsChecked, ResolutionContext context) + private void DryRunTypeMap(ICollection typeMapsChecked, TypePair types, TypeMap typeMap, PropertyMap propertyMap) { - var typeMap = context.TypeMap; + if(typeMap == null) + { + if (types.SourceType.IsGenericParameter || types.DestinationType.IsGenericParameter) + { + return; + } + typeMap = _config.ResolveTypeMap(types.SourceType, types.DestinationType); + } if (typeMap != null) { + if (typeMap.IsClosedGeneric) + { + // it was already validated + return; + } + // dynamic maps get mapped at runtime yolo + if (typeMap.IsConventionMap && typeMap.Profile.CreateMissingTypeMaps) + { + return; + } + if (typeMapsChecked.Contains(typeMap)) + { + return; + } typeMapsChecked.Add(typeMap); - CheckPropertyMaps(typeMapsChecked, context); + if(typeMap.CustomMapFunction != null || typeMap.TypeConverterType != null) + { + return; + } + var context = new ValidationContext(types, propertyMap, typeMap); + _config.Validate(context); + CheckPropertyMaps(typeMapsChecked, typeMap); + typeMap.IsValid = true; } else { - var mapperToUse = _config.GetMappers().FirstOrDefault(mapper => mapper.IsMatch(context.Types)); - if (mapperToUse == null && context.SourceType.IsNullableType()) - { - var nullableTypes = new TypePair(Nullable.GetUnderlyingType(context.SourceType), - context.DestinationType); - mapperToUse = _config.GetMappers().FirstOrDefault(mapper => mapper.IsMatch(nullableTypes)); - } + var mapperToUse = _config.FindMapper(types); if (mapperToUse == null) { - throw new AutoMapperConfigurationException(context); + throw new AutoMapperConfigurationException(propertyMap.TypeMap.Types) { PropertyMap = propertyMap }; } - if (mapperToUse is ArrayMapper || mapperToUse is EnumerableMapper || mapperToUse is CollectionMapper) + var context = new ValidationContext(types, propertyMap, mapperToUse); + _config.Validate(context); + if(mapperToUse is IObjectMapperInfo mapperInfo) { - CheckElementMaps(typeMapsChecked, context); + var newTypePair = mapperInfo.GetAssociatedTypes(types); + DryRunTypeMap(typeMapsChecked, newTypePair, null, propertyMap); } } } - private void CheckElementMaps(ICollection typeMapsChecked, ResolutionContext context) + private void CheckPropertyMaps(ICollection typeMapsChecked, TypeMap typeMap) { - Type sourceElementType = TypeHelper.GetElementType(context.SourceType); - Type destElementType = TypeHelper.GetElementType(context.DestinationType); - TypeMap itemTypeMap = _config.ResolveTypeMap(sourceElementType, destElementType); - - if (typeMapsChecked.Any(typeMap => Equals(typeMap, itemTypeMap))) - return; - - var memberContext = new ResolutionContext(null, null, new TypePair(sourceElementType, destElementType), context) {TypeMap = itemTypeMap}; - - DryRunTypeMap(typeMapsChecked, memberContext); - } - - private void CheckPropertyMaps(ICollection typeMapsChecked, ResolutionContext context) - { - foreach (var propertyMap in context.TypeMap.GetPropertyMaps()) + foreach (var propertyMap in typeMap.PropertyMaps) { - if (propertyMap.Ignored) continue; + if(propertyMap.Ignored || propertyMap.ValueConverterConfig != null || propertyMap.ValueResolverConfig != null) + { + continue; + } var sourceType = propertyMap.SourceType; @@ -113,27 +123,8 @@ private void CheckPropertyMaps(ICollection typeMapsChecked, ResolutionC if (sourceType.IsGenericParameter || sourceType == typeof (object)) return; - var destinationType = propertyMap.DestinationProperty.MemberType; - var memberTypeMap = _config.ResolveTypeMap(sourceType, - destinationType); - - if (typeMapsChecked.Any(typeMap => Equals(typeMap, memberTypeMap))) - continue; - - var memberContext = new ResolutionContext(null, null, new TypePair(sourceType, destinationType), context) - { - TypeMap = memberTypeMap - }; - - try - { - DryRunTypeMap(typeMapsChecked, memberContext); - } - catch (AutoMapperMappingException ex) - { - ex.PropertyMap = propertyMap; - throw; - } + var destinationType = propertyMap.DestinationMember.GetMemberType(); + DryRunTypeMap(typeMapsChecked, new TypePair(sourceType, destinationType), null, propertyMap); } } } diff --git a/src/AutoMapper/ConstructorMap.cs b/src/AutoMapper/ConstructorMap.cs index 902a17a7d8..99e2595f7c 100644 --- a/src/AutoMapper/ConstructorMap.cs +++ b/src/AutoMapper/ConstructorMap.cs @@ -1,85 +1,58 @@ -using AutoMapper.QueryableExtensions; -using AutoMapper.QueryableExtensions.Impl; -using System.Linq.Expressions; - -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Execution; - using static Expression; - - public class ConstructorMap - { - private readonly IList _ctorParams = new List(); - - public ConstructorInfo Ctor { get; } - public TypeMap TypeMap { get; } - internal IEnumerable CtorParams => _ctorParams; - - public ConstructorMap(ConstructorInfo ctor, TypeMap typeMap) - { - Ctor = ctor; - TypeMap = typeMap; - } - - private static readonly IExpressionResultConverter[] ExpressionResultConverters = - { - new MemberResolverExpressionResultConverter(), - new MemberGetterExpressionResultConverter(), - }; - - public bool CanResolve => CtorParams.All(param => param.CanResolve); - - public Expression NewExpression(Expression instanceParameter) - { - var parameters = CtorParams.Select(map => - { - var result = new ExpressionResolutionResult(instanceParameter, Ctor.DeclaringType); - - var matchingExpressionConverter = - ExpressionResultConverters.FirstOrDefault(c => c.CanGetExpressionResolutionResult(result, map)); - - if (matchingExpressionConverter == null) - throw new Exception("Can't resolve this to Queryable Expression"); - - result = matchingExpressionConverter.GetExpressionResolutionResult(result, map); - - return result; - }); - return New(Ctor, parameters.Select(p => p.ResolutionExpression)); - } - - public Expression BuildExpression( - TypeMapRegistry typeMapRegistry, - ParameterExpression srcParam, - ParameterExpression ctxtParam) - { - if (!CanResolve) - return null; - - ParameterExpression parameterContext = null; - var ctorArgs = CtorParams.Select(p => p.CreateExpression(typeMapRegistry, srcParam, ctxtParam, ref parameterContext)); - - ctorArgs = - ctorArgs.Zip(Ctor.GetParameters(), - (exp, pi) => exp.Type == pi.ParameterType ? exp : Convert(exp, pi.ParameterType)) - .ToArray(); - - var newExpr = New(Ctor, ctorArgs); - if(parameterContext == null) - { - return newExpr; - } - var mapExpression = Invoke(Lambda(Block(new[] { parameterContext }, TypeMapPlanBuilder.CreatePropertyContext(parameterContext, ctxtParam), newExpr))); - return mapExpression; - } - - public void AddParameter(ParameterInfo parameter, IMemberGetter[] resolvers, bool canResolve) - { - _ctorParams.Add(new ConstructorParameterMap(parameter, resolvers, canResolve)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Execution; +using AutoMapper.QueryableExtensions; +using AutoMapper.QueryableExtensions.Impl; + +namespace AutoMapper +{ + using static Expression; + + public class ConstructorMap + { + private readonly IList _ctorParams = new List(); + + public ConstructorInfo Ctor { get; } + public TypeMap TypeMap { get; } + public IEnumerable CtorParams => _ctorParams; + + public ConstructorMap(ConstructorInfo ctor, TypeMap typeMap) + { + Ctor = ctor; + TypeMap = typeMap; + } + + private static readonly IExpressionResultConverter[] ExpressionResultConverters = + { + new MemberResolverExpressionResultConverter(), + new MemberGetterExpressionResultConverter() + }; + + public bool CanResolve => CtorParams.All(param => param.CanResolveValue); + + public Expression NewExpression(Expression instanceParameter) + { + var parameters = CtorParams.Select(map => + { + var result = new ExpressionResolutionResult(instanceParameter, Ctor.DeclaringType); + + var matchingExpressionConverter = + ExpressionResultConverters.FirstOrDefault(c => c.CanGetExpressionResolutionResult(result, map)); + + result = matchingExpressionConverter?.GetExpressionResolutionResult(result, map) + ?? throw new AutoMapperMappingException($"Unable to generate the instantiation expression for the constructor {Ctor}: no expression could be mapped for constructor parameter '{map.Parameter}'.", null, TypeMap.Types); + + return result; + }); + return New(Ctor, parameters.Select(p => p.ResolutionExpression)); + } + + public void AddParameter(ParameterInfo parameter, MemberInfo[] resolvers, bool canResolve) + { + _ctorParams.Add(new ConstructorParameterMap(TypeMap, parameter, resolvers, canResolve)); + } + } +} diff --git a/src/AutoMapper/ConstructorParameterMap.cs b/src/AutoMapper/ConstructorParameterMap.cs index 3956fce896..c8ba3959d0 100644 --- a/src/AutoMapper/ConstructorParameterMap.cs +++ b/src/AutoMapper/ConstructorParameterMap.cs @@ -1,80 +1,45 @@ -using System; - -namespace AutoMapper -{ - using AutoMapper.Execution; - using System.Linq; - using System.Linq.Expressions; - using static System.Linq.Expressions.Expression; - using static ExpressionExtensions; - using System.Reflection; - using Configuration; - using Mappers; - - public class ConstructorParameterMap - { - public ConstructorParameterMap(ParameterInfo parameter, IMemberGetter[] sourceMembers, bool canResolve) - { - Parameter = parameter; - SourceMembers = sourceMembers; - CanResolve = canResolve; - } - - public ParameterInfo Parameter { get; } - - public IMemberGetter[] SourceMembers { get; } - - public bool CanResolve { get; set; } - public LambdaExpression CustomExpression { get; set; } - public Func CustomValueResolver { get; set; } - - public Type SourceType => CustomExpression?.ReturnType ?? SourceMembers.LastOrDefault()?.MemberType; - public Type DestinationType => Parameter.ParameterType; - - public Expression CreateExpression(TypeMapRegistry typeMapRegistry, - ParameterExpression srcParam, - ParameterExpression ctxtParam, - ref ParameterExpression parameterContext) - { - if (CustomExpression != null) - return CustomExpression.ConvertReplaceParameters(srcParam).IfNotNull(); - - if (CustomValueResolver != null) - { - return Invoke(Constant(CustomValueResolver), srcParam, ctxtParam); - } - - if (!SourceMembers.Any() && Parameter.IsOptional) - { - return Constant(Parameter.GetDefaultValue()); - } - - if (typeMapRegistry.GetTypeMap(new TypePair(SourceType, DestinationType)) == null - && Parameter.IsOptional) - { - return Constant(Parameter.GetDefaultValue()); - } - - var valueResolverExpr = SourceMembers.Aggregate( - (Expression) srcParam, - (inner, getter) => getter.MemberInfo is MethodInfo - ? getter.MemberInfo.IsStatic() - ? Call(null, (MethodInfo) getter.MemberInfo, inner) - : (Expression) Call(inner, (MethodInfo) getter.MemberInfo) - : MakeMemberAccess(getter.MemberInfo.IsStatic() ? null : inner, getter.MemberInfo) - ); - valueResolverExpr = valueResolverExpr.IfNotNull(); - - if ((SourceType.IsEnumerableType() && SourceType != typeof (string)) - || typeMapRegistry.GetTypeMap(new TypePair(SourceType, DestinationType)) != null - || !DestinationType.IsAssignableFrom(SourceType)) - { - /* - var value = context.Mapper.Map(result, null, sourceType, destinationType, context); - */ - return TypeMapPlanBuilder.ContextMap(ToObject(valueResolverExpr), Constant(null), DestinationType, ref parameterContext); - } - return valueResolverExpr; - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper +{ + public class ConstructorParameterMap : DefaultMemberMap + { + public ConstructorParameterMap(TypeMap typeMap, ParameterInfo parameter, IEnumerable sourceMembers, + bool canResolveValue) + { + TypeMap = typeMap; + Parameter = parameter; + SourceMembers = sourceMembers.ToList(); + CanResolveValue = canResolveValue; + } + + public ParameterInfo Parameter { get; } + + public override TypeMap TypeMap { get; } + + public override Type SourceType => + CustomMapExpression?.Type + ?? CustomMapFunction?.Type + ?? (Parameter.IsOptional + ? Parameter.ParameterType + : SourceMembers.Last().GetMemberType()); + + public override Type DestinationType => Parameter.ParameterType; + + public override IEnumerable SourceMembers { get; } + public override string DestinationName => Parameter.Member.DeclaringType + "." + Parameter.Member + ".parameter " + Parameter.Name; + + public bool HasDefaultValue => Parameter.IsOptional; + + public override LambdaExpression CustomMapExpression { get; set; } + public override LambdaExpression CustomMapFunction { get; set; } + + public override bool CanResolveValue { get; set; } + + public override bool Inline { get; set; } + } } \ No newline at end of file diff --git a/src/AutoMapper/DefaultMemberMap.cs b/src/AutoMapper/DefaultMemberMap.cs new file mode 100644 index 0000000000..0998de0fe6 --- /dev/null +++ b/src/AutoMapper/DefaultMemberMap.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper +{ + /// + /// Member maps with default values. Used in dynamic/dictionary scenarios when source/destination members do not exist. + /// + public class DefaultMemberMap : IMemberMap + { + protected DefaultMemberMap() { } + + public static readonly IMemberMap Instance = new DefaultMemberMap(); + + public virtual TypeMap TypeMap => default; + public virtual Type SourceType => default; + public virtual IEnumerable SourceMembers => Enumerable.Empty(); + public virtual LambdaExpression CustomSource { get => default; set { } } + public virtual string DestinationName => default; + public virtual Type DestinationType => default; + public virtual TypePair Types => new TypePair(SourceType, DestinationType); + public virtual bool CanResolveValue { get => default; set { } } + public virtual bool IsMapped => Ignored || CanResolveValue; + public virtual bool Ignored { get => default; set { } } + public virtual bool Inline { get => true; set { } } + public virtual bool UseDestinationValue { get => default; set { } } + public virtual object NullSubstitute { get => default; set { } } + public virtual LambdaExpression PreCondition { get => default; set { } } + public virtual LambdaExpression Condition { get => default; set { } } + public virtual LambdaExpression CustomMapExpression { get => default; set { } } + public virtual LambdaExpression CustomMapFunction { get => default; set { } } + public virtual ValueResolverConfiguration ValueResolverConfig { get => default; set { } } + public virtual ValueConverterConfiguration ValueConverterConfig { get => default; set { } } + + public virtual IEnumerable ValueTransformers => Enumerable.Empty(); + + public MemberInfo SourceMember + { + get + { + if (CustomMapExpression != null) + { + var finder = new MemberFinderVisitor(); + finder.Visit(CustomMapExpression); + + if (finder.Member != null) + { + return finder.Member.Member; + } + } + return SourceMembers.LastOrDefault(); + } + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/DuplicateTypeMapConfigurationException.cs b/src/AutoMapper/DuplicateTypeMapConfigurationException.cs new file mode 100644 index 0000000000..7c3fc82cd9 --- /dev/null +++ b/src/AutoMapper/DuplicateTypeMapConfigurationException.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; + +namespace AutoMapper +{ + public class DuplicateTypeMapConfigurationException : Exception + { + public TypeMapConfigErrors[] Errors { get; } + + public DuplicateTypeMapConfigurationException(TypeMapConfigErrors[] errors) + { + Errors = errors; + var builder = new StringBuilder(); + builder.AppendLine("The following type maps were found in multiple profiles:"); + foreach (var error in Errors) + { + builder.AppendLine($"{error.Types.SourceType.FullName} to {error.Types.DestinationType.FullName} defined in profiles:"); + builder.AppendLine(string.Join(Environment.NewLine, error.ProfileNames)); + } + builder.AppendLine("This can cause configuration collisions and inconsistent mapping."); + builder.AppendLine("Consolidate the CreateMap calls into one profile, or set the root Advanced.AllowAdditiveTypeMapCreation configuration value to 'true'."); + + Message = builder.ToString(); + } + + public class TypeMapConfigErrors + { + public string[] ProfileNames { get; } + public TypePair Types { get; } + + public TypeMapConfigErrors(TypePair types, string[] profileNames) + { + Types = types; + ProfileNames = profileNames; + } + } + + public override string Message { get; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Execution/DeferredInstantiatedConverter.cs b/src/AutoMapper/Execution/DeferredInstantiatedConverter.cs deleted file mode 100644 index 141d8784fb..0000000000 --- a/src/AutoMapper/Execution/DeferredInstantiatedConverter.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace AutoMapper.Execution -{ - using System; - using System.Reflection; - - public class DeferredInstantiatedConverter : ITypeConverter - { - private readonly Func _instantiator; - private readonly MethodInfo _converterMethod; - - public DeferredInstantiatedConverter(Type typeConverterType, Func instantiator) - { - _instantiator = instantiator; - _converterMethod = typeConverterType.GetMethod("Convert"); - } - - public object Convert(object source, ResolutionContext context) - { - var converter = _instantiator(context); - var method = _converterMethod.ContainsGenericParameters ? GetClosedConvertMethod(context) : _converterMethod; - return method.Invoke(converter, new[] { source, context }); - } - - private MethodInfo GetClosedConvertMethod(ResolutionContext context) - { - var interfaceType = typeof(ITypeConverter<,>).MakeGenericType(context.SourceType, context.DestinationType); - return interfaceType.GetMethod("Convert"); - } - } - - public class DeferredInstantiatedConverter : ITypeConverter - { - private readonly Func> _instantiator; - - public DeferredInstantiatedConverter(Func> instantiator) - { - _instantiator = instantiator; - } - - public TDestination Convert(TSource source, ResolutionContext context) - { - var typeConverter = _instantiator(context); - - return typeConverter.Convert(source, context); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/DelegateFactory.cs b/src/AutoMapper/Execution/DelegateFactory.cs index 41a5e9f696..568ba57ef8 100644 --- a/src/AutoMapper/Execution/DelegateFactory.cs +++ b/src/AutoMapper/Execution/DelegateFactory.cs @@ -1,175 +1,112 @@ -namespace AutoMapper.Execution -{ - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using System.Runtime.CompilerServices; - - public class DelegateFactory - { - private readonly ConcurrentDictionary _ctorCache = - new ConcurrentDictionary(); - - private readonly Func _generateConstructor; - - public DelegateFactory() - { - _generateConstructor = GenerateConstructor; - } - - public Expression> CreateGet(MethodInfo method) - { - ParameterExpression instanceParameter = Expression.Parameter(typeof(object), "target"); - ParameterExpression argumentsParameter = Expression.Parameter(typeof (object[]), "arguments"); - - MethodCallExpression call; - if (!method.IsDefined(typeof (ExtensionAttribute), false)) - { - // instance member method - call = Expression.Call(Expression.Convert(instanceParameter, method.DeclaringType), method, - CreateParameterExpressions(method, instanceParameter, argumentsParameter)); - } - else - { - // static extension method - call = Expression.Call( - method, - CreateParameterExpressions(method, instanceParameter, argumentsParameter)); - } - - Expression> lambda = Expression.Lambda>( - call, - instanceParameter, - argumentsParameter); - - return lambda; - } - - public Expression> CreateGet(PropertyInfo property) - { - ParameterExpression instanceParameter = Expression.Parameter(typeof(TSource), "target"); - - Expression member = IfNotNullExpression(Expression.Property(instanceParameter, property)); - - Expression> lambda = Expression.Lambda>(member,instanceParameter); - - return lambda; - } - - public Expression> CreateGet(FieldInfo field) - { - ParameterExpression instanceParameter = Expression.Parameter(typeof(TSource), "target"); - - Expression member = IfNotNullExpression(Expression.Field(instanceParameter, field)); - - Expression> lambda = Expression.Lambda>(member, instanceParameter); - - return lambda; - } - - public static Expression IfNotNullExpression(MemberExpression member) - { - if (member.Expression != null && !member.Expression.Type.IsValueType()) - return Expression.Condition(Expression.Equal(member.Expression, Expression.Default(member.Expression.Type)), - Expression.Default(member.Type), member); - return member; - } - - public Expression> CreateSet(FieldInfo field) - { - ParameterExpression instanceParameter = Expression.Parameter(field.DeclaringType, "target"); - ParameterExpression valueParameter = Expression.Parameter(field.FieldType, "value"); - - MemberExpression member = Expression.Field(instanceParameter, field); - BinaryExpression assignExpression = Expression.Assign(member, valueParameter); - - Expression> lambda = Expression.Lambda>( - assignExpression, - instanceParameter, - valueParameter - ); - - return lambda; - } - - public Expression> CreateSet(PropertyInfo property) - { - ParameterExpression instanceParameter = Expression.Parameter(property.DeclaringType, "target"); - ParameterExpression valueParameter = Expression.Parameter(property.PropertyType, "value"); - - MemberExpression member = Expression.Property(instanceParameter, property); - BinaryExpression assignExpression = Expression.Assign(member, valueParameter); - - Expression> lambda = Expression.Lambda>( - assignExpression, - instanceParameter, - valueParameter - ); - - - return lambda; - } - - public LateBoundCtor CreateCtor(Type type) - { - var ctor = _ctorCache.GetOrAdd(type, _generateConstructor); - return ctor; - } - - private static LateBoundCtor GenerateConstructor(Type type) - { - var ctorExpr = GenerateConstructorExpression(type); - - return Expression.Lambda(Expression.Convert(ctorExpr, typeof (object))).Compile(); - } - - public static Expression GenerateConstructorExpression(Type type) - { - //handle valuetypes - if (!type.IsClass()) - { - return Expression.Convert(Expression.New(type), typeof(object)); - } - - var constructors = type - .GetDeclaredConstructors() - .Where(ci => !ci.IsStatic); - - //find a ctor with only optional args - var ctorWithOptionalArgs = constructors.FirstOrDefault(c => c.GetParameters().All(p => p.IsOptional)); - if (ctorWithOptionalArgs == null) - throw new ArgumentException(type + " needs to have a constructor with 0 args or only optional args", "type"); - - //get all optional default values - var args = ctorWithOptionalArgs - .GetParameters() - .Select(p => Expression.Constant(p.GetDefaultValue(), p.ParameterType)).ToArray(); - - //create the ctor expression - return Expression.New(ctorWithOptionalArgs, args); - } - - private static Expression[] CreateParameterExpressions(MethodInfo method, Expression instanceParameter, - Expression argumentsParameter) - { - var expressions = new List(); - var realMethodParameters = method.GetParameters(); - if (method.IsDefined(typeof (ExtensionAttribute), false)) - { - Type extendedType = method.GetParameters()[0].ParameterType; - expressions.Add(Expression.Convert(instanceParameter, extendedType)); - realMethodParameters = realMethodParameters.Skip(1).ToArray(); - } - - expressions.AddRange(realMethodParameters.Select((parameter, index) => - Expression.Convert( - Expression.ArrayIndex(argumentsParameter, Expression.Constant(index)), - parameter.ParameterType))); - - return expressions.ToArray(); - } - } +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Execution +{ + using static Expression; + using static Internal.ExpressionFactory; + using static ElementTypeHelper; + + public static class DelegateFactory + { + private static readonly LockingConcurrentDictionary> CtorCache = new LockingConcurrentDictionary>(GenerateConstructor); + + public static Func CreateCtor(Type type) => CtorCache.GetOrAdd(type); + + private static Func GenerateConstructor(Type type) + { + var ctorExpr = GenerateConstructorExpression(type); + + return Lambda>(Convert(ctorExpr, typeof(object))).Compile(); + } + + public static Expression GenerateConstructorExpression(Type type, ProfileMap configuration) => + configuration.AllowNullDestinationValues + ? GenerateConstructorExpression(type) + : GenerateNonNullConstructorExpression(type); + + public static Expression GenerateNonNullConstructorExpression(Type type) => type.IsValueType() + ? Default(type) + : (type == typeof(string) + ? Constant(string.Empty) + : GenerateConstructorExpression(type) + ); + + public static Expression GenerateConstructorExpression(Type type) + { + if (type.IsValueType()) + { + return Default(type); + } + + if (type == typeof(string)) + { + return Constant(null, typeof(string)); + } + + if (type.IsInterface()) + { + return + type.IsDictionaryType() ? CreateCollection(type, typeof(Dictionary<,>)) + : type.IsReadOnlyDictionaryType() ? CreateReadOnlyCollection(type, typeof(ReadOnlyDictionary<,>)) + : type.IsSetType() ? CreateCollection(type, typeof(HashSet<>)) + : type.IsEnumerableType() ? CreateCollection(type, typeof(List<>)) + : InvalidType(type, $"Cannot create an instance of interface type {type}."); + } + + if (type.IsAbstract()) + { + return InvalidType(type, $"Cannot create an instance of abstract type {type}."); + } + + var constructors = type + .GetDeclaredConstructors() + .Where(ci => !ci.IsStatic); + + //find a ctor with only optional args + var ctorWithOptionalArgs = constructors.FirstOrDefault(c => c.GetParameters().All(p => p.IsOptional)); + if (ctorWithOptionalArgs == null) + { + return InvalidType(type, $"{type} needs to have a constructor with 0 args or only optional args."); + } + //get all optional default values + var args = ctorWithOptionalArgs + .GetParameters() + .Select(p => Constant(p.GetDefaultValue(), p.ParameterType)).ToArray(); + + //create the ctor expression + return New(ctorWithOptionalArgs, args); + } + + private static Expression CreateCollection(Type type, Type collectionType) + { + var listType = collectionType.MakeGenericType(GetElementTypes(type, ElementTypeFlags.BreakKeyValuePair)); + if (type.IsAssignableFrom(listType)) + return ToType(New(listType), type); + + return InvalidType(type, $"Cannot create an instance of interface type {type}."); + } + + private static Expression CreateReadOnlyCollection(Type type, Type collectionType) + { + var listType = collectionType.MakeGenericType(GetElementTypes(type, ElementTypeFlags.BreakKeyValuePair)); + var ctor = listType.GetConstructors()[0]; + var innerType = ctor.GetParameters()[0].ParameterType; + if (type.IsAssignableFrom(listType)) + return ToType(New(ctor, GenerateConstructorExpression(innerType)), type); + + return InvalidType(type, $"Cannot create an instance of interface type {type}."); + } + + private static Expression InvalidType(Type type, string message) + { + var ex = new ArgumentException(message, "type"); + return Block(Throw(Constant(ex)), Constant(null, type)); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/Execution/ExpressionBuilder.cs b/src/AutoMapper/Execution/ExpressionBuilder.cs new file mode 100644 index 0000000000..c7a2581638 --- /dev/null +++ b/src/AutoMapper/Execution/ExpressionBuilder.cs @@ -0,0 +1,125 @@ + +namespace AutoMapper.Execution +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Linq.Expressions; + using System.Reflection; + using AutoMapper.Configuration; + using AutoMapper.Internal; + using AutoMapper.Mappers.Internal; + using static System.Linq.Expressions.Expression; + + public static class ExpressionBuilder + { + private static readonly Expression> CreateContext = + mapper => new ResolutionContext(mapper.DefaultContext.Options, mapper); + + private static readonly MethodInfo ContextMapMethod = + ExpressionFactory.Method(a => a.Map(null, null, null)).GetGenericMethodDefinition(); + + public static Expression MapExpression(IConfigurationProvider configurationProvider, + ProfileMap profileMap, + TypePair typePair, + Expression sourceParameter, + Expression contextParameter, + IMemberMap propertyMap = null, Expression destinationParameter = null) + { + if (destinationParameter == null) + destinationParameter = Default(typePair.DestinationType); + var typeMap = configurationProvider.ResolveTypeMap(typePair); + if (typeMap != null) + { + if (!typeMap.HasDerivedTypesToInclude()) + { + typeMap.Seal(configurationProvider); + + return typeMap.MapExpression != null + ? typeMap.MapExpression.ConvertReplaceParameters(sourceParameter, destinationParameter, + contextParameter) + : ContextMap(typePair, sourceParameter, contextParameter, destinationParameter, propertyMap); + } + return ContextMap(typePair, sourceParameter, contextParameter, destinationParameter, propertyMap); + } + var objectMapperExpression = ObjectMapperExpression(configurationProvider, profileMap, typePair, + sourceParameter, contextParameter, propertyMap, destinationParameter); + var nullCheckSource = NullCheckSource(profileMap, sourceParameter, destinationParameter, objectMapperExpression, propertyMap); + return ExpressionFactory.ToType(nullCheckSource, typePair.DestinationType); + } + + public static Expression NullCheckSource(ProfileMap profileMap, + Expression sourceParameter, + Expression destinationParameter, + Expression objectMapperExpression, + IMemberMap memberMap) + { + var declaredDestinationType = destinationParameter.Type; + var destinationType = objectMapperExpression.Type; + var defaultDestination = DefaultDestination(destinationType, declaredDestinationType, profileMap); + var destination = memberMap == null + ? destinationParameter.IfNullElse(defaultDestination, destinationParameter) + : memberMap.UseDestinationValue ? destinationParameter : defaultDestination; + var ifSourceNull = destinationParameter.Type.IsCollectionType() ? ClearDestinationCollection() : destination; + return sourceParameter.IfNullElse(ifSourceNull, objectMapperExpression); + Expression ClearDestinationCollection() + { + var destinationElementType = ElementTypeHelper.GetElementType(destinationParameter.Type); + var destinationCollectionType = typeof(ICollection<>).MakeGenericType(destinationElementType); + var destinationVariable = Variable(destinationCollectionType, "collectionDestination"); + var clear = Call(destinationVariable, destinationCollectionType.GetDeclaredMethod("Clear")); + var isReadOnly = Property(destinationVariable, "IsReadOnly"); + return Block(new[] {destinationVariable}, + Assign(destinationVariable, ExpressionFactory.ToType(destinationParameter, destinationCollectionType)), + Condition(OrElse(Equal(destinationVariable, Constant(null)), isReadOnly), Empty(), clear), + destination); + } + } + + private static Expression DefaultDestination(Type destinationType, Type declaredDestinationType, ProfileMap profileMap) + { + if(profileMap.AllowNullCollections || destinationType == typeof(string) || !destinationType.IsEnumerableType()) + { + return Default(declaredDestinationType); + } + if(destinationType.IsArray) + { + var destinationElementType = destinationType.GetElementType(); + return NewArrayBounds(destinationElementType, Enumerable.Repeat(Constant(0), destinationType.GetArrayRank())); + } + return DelegateFactory.GenerateNonNullConstructorExpression(destinationType); + } + + private static Expression ObjectMapperExpression(IConfigurationProvider configurationProvider, + ProfileMap profileMap, TypePair typePair, Expression sourceParameter, Expression contextParameter, + IMemberMap propertyMap, Expression destinationParameter) + { + var match = configurationProvider.FindMapper(typePair); + if (match != null) + { + var mapperExpression = match.MapExpression(configurationProvider, profileMap, propertyMap, + sourceParameter, destinationParameter, contextParameter); + return mapperExpression; + } + return ContextMap(typePair, sourceParameter, contextParameter, destinationParameter, propertyMap); + } + + public static Expression ContextMap(TypePair typePair, Expression sourceParameter, Expression contextParameter, + Expression destinationParameter, IMemberMap memberMap) + { + var mapMethod = ContextMapMethod.MakeGenericMethod(typePair.SourceType, typePair.DestinationType); + return Call(contextParameter, mapMethod, sourceParameter, destinationParameter, Constant(memberMap, typeof(IMemberMap))); + } + + public static ConditionalExpression CheckContext(TypeMap typeMap, Expression context) + { + if (typeMap.MaxDepth > 0 || typeMap.PreserveReferences) + { + var mapper = Property(context, "Mapper"); + return IfThen(Property(context, "IsDefault"), Assign(context, Invoke(CreateContext, mapper))); + } + return null; + } + + } +} \ No newline at end of file diff --git a/src/AutoMapper/Execution/FieldAccessor.cs b/src/AutoMapper/Execution/FieldAccessor.cs deleted file mode 100644 index d9fac39366..0000000000 --- a/src/AutoMapper/Execution/FieldAccessor.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Execution -{ - using System; - using System.Reflection; - - public class FieldAccessor : FieldGetter, IMemberAccessor - { - private readonly Lazy>> _lateBoundFieldSetExpression; - private readonly Lazy> _lateBoundFieldSet; - - public FieldAccessor(FieldInfo fieldInfo) - : base(fieldInfo) - { - _lateBoundFieldSetExpression = new Lazy>>(() => DelegateFactory.CreateSet(fieldInfo)); - _lateBoundFieldSet = new Lazy>(() => _lateBoundFieldSetExpression.Value.Compile()); - } - - public void SetValue(object destination, object value) - { - _lateBoundFieldSet.Value((TSource)destination, value != null ? (TValue)value : default(TValue)); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/FieldGetter.cs b/src/AutoMapper/Execution/FieldGetter.cs deleted file mode 100644 index 49fba9b40d..0000000000 --- a/src/AutoMapper/Execution/FieldGetter.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Execution -{ - using System; - using System.Collections.Generic; - using System.Reflection; - - public class FieldGetter : MemberGetter - { - private readonly FieldInfo _fieldInfo; - private readonly Lazy>> _lateBoundFieldGetExpression; - private readonly Lazy> _lateBoundFieldGet; - - public FieldGetter(FieldInfo fieldInfo) - { - _fieldInfo = fieldInfo; - Name = fieldInfo.Name; - MemberType = fieldInfo.FieldType; - _lateBoundFieldGetExpression = new Lazy>>(() => DelegateFactory.CreateGet(fieldInfo)); - _lateBoundFieldGet = new Lazy>(() => _lateBoundFieldGetExpression.Value.Compile()); - } - - public override MemberInfo MemberInfo => _fieldInfo; - - public override string Name { get; } - public override LambdaExpression GetExpression => _lateBoundFieldGetExpression.Value; - - public override Type MemberType { get; } - - public override object GetValue(object source) - { - return _lateBoundFieldGet.Value((TSource)source); - } - - public bool Equals(FieldGetter other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other._fieldInfo, _fieldInfo); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (FieldGetter)) return false; - return Equals((FieldGetter) obj); - } - - public override int GetHashCode() - { - return _fieldInfo.GetHashCode(); - } - - public override IEnumerable GetCustomAttributes(Type attributeType, bool inherit) - { - return _fieldInfo.GetCustomAttributes(attributeType, inherit); - } - - public override IEnumerable GetCustomAttributes(bool inherit) - { - return _fieldInfo.GetCustomAttributes(inherit); - } - - public override bool IsDefined(Type attributeType, bool inherit) - { - return _fieldInfo.IsDefined(attributeType, inherit); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/IDelegateFactory.cs b/src/AutoMapper/Execution/IDelegateFactory.cs deleted file mode 100644 index 52a6d067e0..0000000000 --- a/src/AutoMapper/Execution/IDelegateFactory.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace AutoMapper.Execution -{ - public delegate TValue LateBoundMethod(TSource target, object[] arguments); - - public delegate TValue LateBoundPropertyGet(TSource target); - - public delegate TValue LateBoundFieldGet(TSource target); - - public delegate void LateBoundFieldSet(TSource target, TValue value); - - public delegate void LateBoundPropertySet(TSource target, TValue value); - - public delegate void LateBoundValueTypeFieldSet(ref object target, object value); - - public delegate void LateBoundValueTypePropertySet(ref object target, object value); - - public delegate object LateBoundCtor(); - - public delegate object LateBoundParamsCtor(params object[] parameters); -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/IProxyGenerator.cs b/src/AutoMapper/Execution/IProxyGenerator.cs deleted file mode 100644 index a4ee886b41..0000000000 --- a/src/AutoMapper/Execution/IProxyGenerator.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace AutoMapper.Execution -{ - using System; - - public interface IProxyGenerator - { - Type GetProxyType(Type interfaceType); - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/MemberGetter.cs b/src/AutoMapper/Execution/MemberGetter.cs deleted file mode 100644 index 2c7bd82d93..0000000000 --- a/src/AutoMapper/Execution/MemberGetter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Execution -{ - using System; - using System.Collections.Generic; - using System.Reflection; - - public abstract class MemberGetter : IMemberGetter - { - protected static readonly DelegateFactory DelegateFactory = new DelegateFactory(); - - public abstract MemberInfo MemberInfo { get; } - public abstract string Name { get; } - public abstract LambdaExpression GetExpression { get; } - public abstract Type MemberType { get; } - public abstract object GetValue(object source); - - public abstract IEnumerable GetCustomAttributes(Type attributeType, bool inherit); - public abstract IEnumerable GetCustomAttributes(bool inherit); - public abstract bool IsDefined(Type attributeType, bool inherit); - } - - public class NulloMemberGetter : IMemberGetter - { - public MemberInfo MemberInfo { get; } - public string Name { get; } - public LambdaExpression GetExpression { get; } - public Type MemberType { get; } - public object GetValue(object source) => source; - } - public class NulloMemberAccessor : NulloMemberGetter, IMemberAccessor - { - public void SetValue(object destination, object value) { } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/MethodGetter.cs b/src/AutoMapper/Execution/MethodGetter.cs deleted file mode 100644 index 3d1429220a..0000000000 --- a/src/AutoMapper/Execution/MethodGetter.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Execution -{ - using System; - using System.Collections.Generic; - using System.Reflection; - - public class MethodGetter : MemberGetter - { - private readonly MethodInfo _methodInfo; - private readonly Type _memberType; - private readonly Lazy>> _lateBoundMethodExpression; - private readonly Lazy> _lateBoundMethod; - - public MethodGetter(MethodInfo methodInfo) - { - _methodInfo = methodInfo; - Name = _methodInfo.Name; - _memberType = _methodInfo.ReturnType; - _lateBoundMethodExpression = new Lazy>>(() => DelegateFactory.CreateGet(methodInfo)); - _lateBoundMethod = new Lazy>(() => _lateBoundMethodExpression.Value.Compile()); - } - - public override MemberInfo MemberInfo => _methodInfo; - - public override string Name { get; } - public override LambdaExpression GetExpression => _lateBoundMethodExpression.Value; - - public override Type MemberType => _memberType; - - public override object GetValue(object source) - { - return _memberType == null - ? default(TValue) - : _lateBoundMethod.Value(source, new object[0]); - } - - public override IEnumerable GetCustomAttributes(Type attributeType, bool inherit) - { - return _methodInfo.GetCustomAttributes(attributeType, inherit); - } - - public override IEnumerable GetCustomAttributes(bool inherit) - { - return _methodInfo.GetCustomAttributes(inherit); - } - - public override bool IsDefined(Type attributeType, bool inherit) - { - return _methodInfo.IsDefined(attributeType, inherit); - } - - public bool Equals(MethodGetter other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other._methodInfo, _methodInfo); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (MethodGetter)) return false; - return Equals((MethodGetter) obj); - } - - public override int GetHashCode() - { - return _methodInfo.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/PropertyAccessor.cs b/src/AutoMapper/Execution/PropertyAccessor.cs deleted file mode 100644 index 8ca3096ed6..0000000000 --- a/src/AutoMapper/Execution/PropertyAccessor.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Execution -{ - using System; - using System.Reflection; - - public class PropertyAccessor : PropertyGetter, IMemberAccessor - { - private readonly Lazy>> _lateBoundPropertySetExpression; - private readonly Lazy> _lateBoundPropertySet; - - public PropertyAccessor(PropertyInfo propertyInfo) - : base(propertyInfo) - { - var HasSetter = propertyInfo.GetSetMethod(true) != null; - _lateBoundPropertySetExpression = HasSetter - ? new Lazy>>(() => DelegateFactory.CreateSet(propertyInfo)) - : new Lazy>>(() => Expression.Lambda>(Expression.Empty(), Expression.Parameter(typeof(TSource)), Expression.Parameter(typeof(TValue)))); - _lateBoundPropertySet = new Lazy>(() => _lateBoundPropertySetExpression.Value.Compile()); - } - - public virtual void SetValue(object destination, object value) - { - _lateBoundPropertySet.Value((TSource)destination, value != null ? (TValue)value : default(TValue)); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/PropertyDescription.cs b/src/AutoMapper/Execution/PropertyDescription.cs new file mode 100644 index 0000000000..44b91e4f48 --- /dev/null +++ b/src/AutoMapper/Execution/PropertyDescription.cs @@ -0,0 +1,46 @@ +using System; +using System.Diagnostics; +using System.Reflection; + +namespace AutoMapper.Execution +{ + [DebuggerDisplay("{Name}-{Type.Name}")] + public struct PropertyDescription : IEquatable + { + internal static PropertyDescription[] Empty = new PropertyDescription[0]; + + public PropertyDescription(string name, Type type, bool canWrite = true) + { + Name = name; + Type = type; + CanWrite = canWrite; + } + + public PropertyDescription(PropertyInfo property) + { + Name = property.Name; + Type = property.PropertyType; + CanWrite = property.CanWrite; + } + + public string Name { get; } + + public Type Type { get; } + + public bool CanWrite { get; } + + public override int GetHashCode() + { + var code = HashCodeCombiner.Combine(Name, Type); + return HashCodeCombiner.CombineCodes(code, CanWrite.GetHashCode()); + } + + public override bool Equals(object other) => other is PropertyDescription description && Equals(description); + + public bool Equals(PropertyDescription other) => Name == other.Name && Type == other.Type && CanWrite == other.CanWrite; + + public static bool operator ==(PropertyDescription left, PropertyDescription right) => left.Equals(right); + + public static bool operator !=(PropertyDescription left, PropertyDescription right) => !left.Equals(right); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Execution/PropertyEmitter.cs b/src/AutoMapper/Execution/PropertyEmitter.cs index ab08bd4663..f2954c7153 100644 --- a/src/AutoMapper/Execution/PropertyEmitter.cs +++ b/src/AutoMapper/Execution/PropertyEmitter.cs @@ -1,71 +1,67 @@ -#if !PORTABLE namespace AutoMapper.Execution { using System; + using System.Linq; using System.Reflection; using System.Reflection.Emit; public class PropertyEmitter { - private static readonly MethodInfo proxyBase_NotifyPropertyChanged = - typeof (ProxyBase).GetMethod("NotifyPropertyChanged", - BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); + private static readonly MethodInfo ProxyBaseNotifyPropertyChanged = + typeof (ProxyBase).GetTypeInfo().DeclaredMethods.Single(m => m.Name == "NotifyPropertyChanged"); - private readonly FieldBuilder fieldBuilder; - private readonly MethodBuilder getterBuilder; - private readonly PropertyBuilder propertyBuilder; - private readonly MethodBuilder setterBuilder; + private readonly FieldBuilder _fieldBuilder; + private readonly MethodBuilder _getterBuilder; + private readonly PropertyBuilder _propertyBuilder; + private readonly MethodBuilder _setterBuilder; - public PropertyEmitter(TypeBuilder owner, string name, Type propertyType, FieldBuilder propertyChangedField) + public PropertyEmitter(TypeBuilder owner, PropertyDescription property, FieldBuilder propertyChangedField) { - fieldBuilder = owner.DefineField($"<{name}>", propertyType, FieldAttributes.Private); - getterBuilder = owner.DefineMethod($"get_{name}", + var name = property.Name; + var propertyType = property.Type; + _fieldBuilder = owner.DefineField($"<{name}>", propertyType, FieldAttributes.Private); + _propertyBuilder = owner.DefineProperty(name, PropertyAttributes.None, propertyType, null); + _getterBuilder = owner.DefineMethod($"get_{name}", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig | - MethodAttributes.SpecialName, propertyType, Type.EmptyTypes); - ILGenerator getterIl = getterBuilder.GetILGenerator(); + MethodAttributes.SpecialName, propertyType, new Type[0]); + ILGenerator getterIl = _getterBuilder.GetILGenerator(); getterIl.Emit(OpCodes.Ldarg_0); - getterIl.Emit(OpCodes.Ldfld, fieldBuilder); + getterIl.Emit(OpCodes.Ldfld, _fieldBuilder); getterIl.Emit(OpCodes.Ret); - setterBuilder = owner.DefineMethod($"set_{name}", + _propertyBuilder.SetGetMethod(_getterBuilder); + if(!property.CanWrite) + { + return; + } + _setterBuilder = owner.DefineMethod($"set_{name}", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig | MethodAttributes.SpecialName, typeof (void), new[] {propertyType}); - ILGenerator setterIl = setterBuilder.GetILGenerator(); + ILGenerator setterIl = _setterBuilder.GetILGenerator(); setterIl.Emit(OpCodes.Ldarg_0); setterIl.Emit(OpCodes.Ldarg_1); - setterIl.Emit(OpCodes.Stfld, fieldBuilder); + setterIl.Emit(OpCodes.Stfld, _fieldBuilder); if (propertyChangedField != null) { setterIl.Emit(OpCodes.Ldarg_0); setterIl.Emit(OpCodes.Dup); setterIl.Emit(OpCodes.Ldfld, propertyChangedField); setterIl.Emit(OpCodes.Ldstr, name); - setterIl.Emit(OpCodes.Call, proxyBase_NotifyPropertyChanged); + setterIl.Emit(OpCodes.Call, ProxyBaseNotifyPropertyChanged); } setterIl.Emit(OpCodes.Ret); - propertyBuilder = owner.DefineProperty(name, PropertyAttributes.None, propertyType, null); - propertyBuilder.SetGetMethod(getterBuilder); - propertyBuilder.SetSetMethod(setterBuilder); + _propertyBuilder.SetSetMethod(_setterBuilder); } - public Type PropertyType => propertyBuilder.PropertyType; + public Type PropertyType => _propertyBuilder.PropertyType; - public MethodBuilder GetGetter(Type requiredType) - { - if (!requiredType.IsAssignableFrom(PropertyType)) - { - throw new InvalidOperationException("Types are not compatible"); - } - return getterBuilder; - } + public MethodBuilder GetGetter(Type requiredType) + => !requiredType.IsAssignableFrom(PropertyType) + ? throw new InvalidOperationException("Types are not compatible") + : _getterBuilder; - public MethodBuilder GetSetter(Type requiredType) - { - if (!PropertyType.IsAssignableFrom(requiredType)) - { - throw new InvalidOperationException("Types are not compatible"); - } - return setterBuilder; - } + public MethodBuilder GetSetter(Type requiredType) + => !PropertyType.IsAssignableFrom(requiredType) + ? throw new InvalidOperationException("Types are not compatible") + : _setterBuilder; } } -#endif \ No newline at end of file diff --git a/src/AutoMapper/Execution/PropertyGetter.cs b/src/AutoMapper/Execution/PropertyGetter.cs deleted file mode 100644 index 96d84fdcd6..0000000000 --- a/src/AutoMapper/Execution/PropertyGetter.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Execution -{ - using System; - using System.Collections.Generic; - using System.Reflection; - - public class PropertyGetter : MemberGetter - { - private readonly PropertyInfo _propertyInfo; - private readonly Lazy>> _lateBoundPropertyGetExpression; - private readonly Lazy> _lateBoundPropertyGet; - - public PropertyGetter(PropertyInfo propertyInfo) - { - _propertyInfo = propertyInfo; - Name = _propertyInfo.Name; - MemberType = _propertyInfo.PropertyType; - _lateBoundPropertyGetExpression = - _propertyInfo.GetGetMethod(true) != null - ? new Lazy>>(() => DelegateFactory.CreateGet(propertyInfo)) - : new Lazy>>(() => src => default(TValue)); - _lateBoundPropertyGet = - new Lazy>(() => _lateBoundPropertyGetExpression.Value.Compile()); - } - - public override MemberInfo MemberInfo => _propertyInfo; - - public override string Name { get; } - public override LambdaExpression GetExpression => _lateBoundPropertyGetExpression.Value; - - public override Type MemberType { get; } - - public override object GetValue(object source) - { - return _lateBoundPropertyGet.Value((TSource)source); - } - - public override IEnumerable GetCustomAttributes(Type attributeType, bool inherit) - { - return _propertyInfo.GetCustomAttributes(attributeType, inherit); - } - - public override IEnumerable GetCustomAttributes(bool inherit) - { - return _propertyInfo.GetCustomAttributes(inherit); - } - - public override bool IsDefined(Type attributeType, bool inherit) - { - return _propertyInfo.IsDefined(attributeType, inherit); - } - - public bool Equals(PropertyGetter other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other._propertyInfo, _propertyInfo); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (PropertyGetter)) return false; - return Equals((PropertyGetter) obj); - } - - public override int GetHashCode() - { - return _propertyInfo.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/ProxyBase.cs b/src/AutoMapper/Execution/ProxyBase.cs index 43ffa031b1..da3495dbf9 100644 --- a/src/AutoMapper/Execution/ProxyBase.cs +++ b/src/AutoMapper/Execution/ProxyBase.cs @@ -1,14 +1,9 @@ +using System.ComponentModel; + namespace AutoMapper.Execution { - using System.ComponentModel; - public abstract class ProxyBase { - public ProxyBase() - { - - } - protected void NotifyPropertyChanged(PropertyChangedEventHandler handler, string method) { handler?.Invoke(this, new PropertyChangedEventArgs(method)); diff --git a/src/AutoMapper/Execution/ProxyGenerator.cs b/src/AutoMapper/Execution/ProxyGenerator.cs index b7bab2f5d9..0e5041604f 100644 --- a/src/AutoMapper/Execution/ProxyGenerator.cs +++ b/src/AutoMapper/Execution/ProxyGenerator.cs @@ -1,8 +1,6 @@ -#if !PORTABLE namespace AutoMapper.Execution { using System; - using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -11,7 +9,7 @@ namespace AutoMapper.Execution using System.Reflection.Emit; using System.Text.RegularExpressions; - public class ProxyGenerator : IProxyGenerator + public static class ProxyGenerator { private static readonly byte[] privateKey = StringToByteArray( @@ -19,19 +17,19 @@ public class ProxyGenerator : IProxyGenerator private static readonly byte[] privateKeyToken = StringToByteArray("be96cd2c38ef1005"); - private static readonly MethodInfo delegate_Combine = typeof (Delegate).GetMethod("Combine", new[] { typeof(Delegate), typeof(Delegate) }); + private static readonly MethodInfo delegate_Combine = typeof(Delegate).GetDeclaredMethod("Combine", new[] { typeof(Delegate), typeof(Delegate) }); - private static readonly MethodInfo delegate_Remove = typeof (Delegate).GetMethod("Remove", new[] { typeof(Delegate), typeof(Delegate) }); + private static readonly MethodInfo delegate_Remove = typeof(Delegate).GetDeclaredMethod("Remove", new[] { typeof(Delegate), typeof(Delegate) }); private static readonly EventInfo iNotifyPropertyChanged_PropertyChanged = - typeof (INotifyPropertyChanged).GetEvent("PropertyChanged", BindingFlags.Instance | BindingFlags.Public); + typeof(INotifyPropertyChanged).GetRuntimeEvent("PropertyChanged"); private static readonly ConstructorInfo proxyBase_ctor = - typeof (ProxyBase).GetConstructor(Type.EmptyTypes); + typeof(ProxyBase).GetDeclaredConstructor(new Type[0]); private static readonly ModuleBuilder proxyModule = CreateProxyModule(); - private static readonly ConcurrentDictionary proxyTypes = new ConcurrentDictionary(); + private static readonly LockingConcurrentDictionary proxyTypes = new LockingConcurrentDictionary(EmitProxy); private static ModuleBuilder CreateProxyModule() { @@ -44,58 +42,55 @@ private static ModuleBuilder CreateProxyModule() return builder.DefineDynamicModule("AutoMapper.Proxies.emit"); } - private static Type CreateProxyType(Type interfaceType) + private static Type EmitProxy(TypeDescription typeDescription) { - if (!interfaceType.IsInterface()) - { - throw new ArgumentException("Only interfaces can be proxied", nameof(interfaceType)); - } - string name = - $"Proxy<{Regex.Replace(interfaceType.AssemblyQualifiedName ?? interfaceType.FullName ?? interfaceType.Name, @"[\s,]+", "_")}>"; - List allInterfaces = new List - { - interfaceType - }; - allInterfaces.AddRange(interfaceType.GetInterfaces()); - Debug.WriteLine(name, "Emitting proxy type"); - TypeBuilder typeBuilder = proxyModule.DefineType(name, - TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.Public, typeof (ProxyBase), - allInterfaces.ToArray()); + var interfaceType = typeDescription.Type; + var additionalProperties = typeDescription.AdditionalProperties; + var propertyNames = string.Join("_", additionalProperties.Select(p => p.Name)); + var typeName = $"Proxy_{interfaceType.FullName}_{typeDescription.GetHashCode()}_{propertyNames}"; + const int MaxTypeNameLength = 1023; + typeName = typeName.Substring(0, Math.Min(MaxTypeNameLength, typeName.Length)); + var allInterfaces = new List { interfaceType }; + allInterfaces.AddRange(interfaceType.GetTypeInfo().ImplementedInterfaces); + Debug.WriteLine(typeName, "Emitting proxy type"); + TypeBuilder typeBuilder = proxyModule.DefineType(typeName, + TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.Public, typeof(ProxyBase), + interfaceType.IsInterface() ? new[] { interfaceType } : new Type[0]); ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, - CallingConventions.Standard, Type.EmptyTypes); + CallingConventions.Standard, new Type[0]); ILGenerator ctorIl = constructorBuilder.GetILGenerator(); ctorIl.Emit(OpCodes.Ldarg_0); ctorIl.Emit(OpCodes.Call, proxyBase_ctor); ctorIl.Emit(OpCodes.Ret); FieldBuilder propertyChangedField = null; - if (typeof (INotifyPropertyChanged).IsAssignableFrom(interfaceType)) + if(typeof(INotifyPropertyChanged).IsAssignableFrom(interfaceType)) { - propertyChangedField = typeBuilder.DefineField("PropertyChanged", typeof (PropertyChangedEventHandler), + propertyChangedField = typeBuilder.DefineField("PropertyChanged", typeof(PropertyChangedEventHandler), FieldAttributes.Private); MethodBuilder addPropertyChangedMethod = typeBuilder.DefineMethod("add_PropertyChanged", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | - MethodAttributes.NewSlot | MethodAttributes.Virtual, typeof (void), - new[] {typeof (PropertyChangedEventHandler)}); + MethodAttributes.NewSlot | MethodAttributes.Virtual, typeof(void), + new[] { typeof(PropertyChangedEventHandler) }); ILGenerator addIl = addPropertyChangedMethod.GetILGenerator(); addIl.Emit(OpCodes.Ldarg_0); addIl.Emit(OpCodes.Dup); addIl.Emit(OpCodes.Ldfld, propertyChangedField); addIl.Emit(OpCodes.Ldarg_1); addIl.Emit(OpCodes.Call, delegate_Combine); - addIl.Emit(OpCodes.Castclass, typeof (PropertyChangedEventHandler)); + addIl.Emit(OpCodes.Castclass, typeof(PropertyChangedEventHandler)); addIl.Emit(OpCodes.Stfld, propertyChangedField); addIl.Emit(OpCodes.Ret); MethodBuilder removePropertyChangedMethod = typeBuilder.DefineMethod("remove_PropertyChanged", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | - MethodAttributes.NewSlot | MethodAttributes.Virtual, typeof (void), - new[] {typeof (PropertyChangedEventHandler)}); + MethodAttributes.NewSlot | MethodAttributes.Virtual, typeof(void), + new[] { typeof(PropertyChangedEventHandler) }); ILGenerator removeIl = removePropertyChangedMethod.GetILGenerator(); removeIl.Emit(OpCodes.Ldarg_0); removeIl.Emit(OpCodes.Dup); removeIl.Emit(OpCodes.Ldfld, propertyChangedField); removeIl.Emit(OpCodes.Ldarg_1); removeIl.Emit(OpCodes.Call, delegate_Remove); - removeIl.Emit(OpCodes.Castclass, typeof (PropertyChangedEventHandler)); + removeIl.Emit(OpCodes.Castclass, typeof(PropertyChangedEventHandler)); removeIl.Emit(OpCodes.Stfld, propertyChangedField); removeIl.Emit(OpCodes.Ret); typeBuilder.DefineMethodOverride(addPropertyChangedMethod, @@ -103,14 +98,15 @@ private static Type CreateProxyType(Type interfaceType) typeBuilder.DefineMethodOverride(removePropertyChangedMethod, iNotifyPropertyChanged_PropertyChanged.GetRemoveMethod()); } - List propertiesToImplement = new List(); + var propertiesToImplement = new List(); // first we collect all properties, those with setters before getters in order to enable less specific redundant getters - foreach ( - PropertyInfo property in - allInterfaces.Where(intf => intf != typeof (INotifyPropertyChanged)) - .SelectMany(intf => intf.GetProperties())) + foreach(var property in + allInterfaces.Where(intf => intf != typeof(INotifyPropertyChanged)) + .SelectMany(intf => intf.GetProperties()) + .Select(p => new PropertyDescription(p)) + .Concat(additionalProperties)) { - if (property.CanWrite) + if(property.CanWrite) { propertiesToImplement.Insert(0, property); } @@ -119,14 +115,13 @@ PropertyInfo property in propertiesToImplement.Add(property); } } - Dictionary fieldBuilders = new Dictionary(); - foreach (PropertyInfo property in propertiesToImplement) + var fieldBuilders = new Dictionary(); + foreach(var property in propertiesToImplement) { - PropertyEmitter propertyEmitter; - if (fieldBuilders.TryGetValue(property.Name, out propertyEmitter)) + if(fieldBuilders.TryGetValue(property.Name, out var propertyEmitter)) { - if ((propertyEmitter.PropertyType != property.PropertyType) && - ((property.CanWrite) || (!property.PropertyType.IsAssignableFrom(propertyEmitter.PropertyType)))) + if((propertyEmitter.PropertyType != property.Type) && + ((property.CanWrite) || (!property.Type.IsAssignableFrom(propertyEmitter.PropertyType)))) { throw new ArgumentException( $"The interface has a conflicting property {property.Name}", @@ -136,41 +131,34 @@ PropertyInfo property in else { fieldBuilders.Add(property.Name, - propertyEmitter = - new PropertyEmitter(typeBuilder, property.Name, property.PropertyType, propertyChangedField)); - } - if (property.CanRead) - { - typeBuilder.DefineMethodOverride(propertyEmitter.GetGetter(property.PropertyType), - property.GetGetMethod()); - } - if (property.CanWrite) - { - typeBuilder.DefineMethodOverride(propertyEmitter.GetSetter(property.PropertyType), - property.GetSetMethod()); + new PropertyEmitter(typeBuilder, property, propertyChangedField)); } } return typeBuilder.CreateType(); } - public Type GetProxyType(Type interfaceType) + public static Type GetProxyType(Type interfaceType) { - if (interfaceType == null) + var key = new TypeDescription(interfaceType); + if(!interfaceType.IsInterface()) { - throw new ArgumentNullException(nameof(interfaceType)); + throw new ArgumentException("Only interfaces can be proxied", nameof(interfaceType)); } + return proxyTypes.GetOrAdd(key); + } - return proxyTypes.GetOrAdd(interfaceType, CreateProxyType); + public static Type GetSimilarType(Type sourceType, IEnumerable additionalProperties) + { + return proxyTypes.GetOrAdd(new TypeDescription(sourceType, additionalProperties)); } private static byte[] StringToByteArray(string hex) { int numberChars = hex.Length; - byte[] bytes = new byte[numberChars/2]; - for (int i = 0; i < numberChars; i += 2) - bytes[i/2] = Convert.ToByte(hex.Substring(i, 2), 16); + byte[] bytes = new byte[numberChars / 2]; + for(int i = 0; i < numberChars; i += 2) + bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); return bytes; } } } -#endif \ No newline at end of file diff --git a/src/AutoMapper/Execution/ReflectionHelper.cs b/src/AutoMapper/Execution/ReflectionHelper.cs deleted file mode 100644 index 40652056e5..0000000000 --- a/src/AutoMapper/Execution/ReflectionHelper.cs +++ /dev/null @@ -1,236 +0,0 @@ -namespace AutoMapper.Execution -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Dynamic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - - public static class ReflectionHelper - { - public static object GetDefaultValue(this ParameterInfo parameter) - { - if(parameter.DefaultValue == null && parameter.ParameterType.IsValueType()) - { - return Activator.CreateInstance(parameter.ParameterType); - } - return parameter.DefaultValue; - } - - public static object Map(this ResolutionContext context, MemberInfo member, object value) - { - var memberType = member.GetMemberType(); - return context.Map(value, null, value?.GetType() ?? memberType, memberType); - } - - public static bool IsDynamic(this object obj) - { - return obj is IDynamicMetaObjectProvider; - } - - public static bool IsDynamic(this Type type) - { - return typeof(IDynamicMetaObjectProvider).IsAssignableFrom(type); - } - - public static void SetMemberValue(this MemberInfo propertyOrField, object target, object value) - { - var property = propertyOrField as PropertyInfo; - if(property != null) - { - property.SetValue(target, value, null); - return; - } - var field = propertyOrField as FieldInfo; - if(field != null) - { - field.SetValue(target, value); - return; - } - throw Expected(propertyOrField); - } - - private static ArgumentOutOfRangeException Expected(MemberInfo propertyOrField) - { - return new ArgumentOutOfRangeException("propertyOrField", "Expected a property or field, not " + propertyOrField); - } - - public static object GetMemberValue(this MemberInfo propertyOrField, object target) - { - var property = propertyOrField as PropertyInfo; - if(property != null) - { - return property.GetValue(target, null); - } - var field = propertyOrField as FieldInfo; - if(field != null) - { - return field.GetValue(target); - } - throw Expected(propertyOrField); - } - - public static IEnumerable GetMemberPath(Type type, string fullMemberName) - { - MemberInfo property = null; - foreach(var memberName in fullMemberName.Split('.')) - { - var currentType = GetCurrentType(property, type); - yield return property = currentType.GetMember(memberName).Single(); - } - } - - private static Type GetCurrentType(MemberInfo member, Type type) - { - var memberType = member?.GetMemberType() ?? type; - if(memberType.IsGenericType() && typeof(IEnumerable).IsAssignableFrom(memberType)) - { - memberType = memberType.GetTypeInfo().GenericTypeArguments[0]; - } - return memberType; - } - - public static MemberInfo GetFieldOrProperty(this LambdaExpression expression) - { - var memberExpression = expression.Body as MemberExpression; - if(memberExpression == null) - { - throw new ArgumentOutOfRangeException("expression", "Expected a property/field access expression, not " + expression); - } - return (MemberInfo)memberExpression.Member; - } - - public static MemberInfo FindProperty(LambdaExpression lambdaExpression) - { - Expression expressionToCheck = lambdaExpression; - - bool done = false; - - while (!done) - { - switch (expressionToCheck.NodeType) - { - case ExpressionType.Convert: - expressionToCheck = ((UnaryExpression)expressionToCheck).Operand; - break; - case ExpressionType.Lambda: - expressionToCheck = ((LambdaExpression)expressionToCheck).Body; - break; - case ExpressionType.MemberAccess: - var memberExpression = ((MemberExpression)expressionToCheck); - - if (memberExpression.Expression.NodeType != ExpressionType.Parameter && - memberExpression.Expression.NodeType != ExpressionType.Convert) - { - throw new ArgumentException( - $"Expression '{lambdaExpression}' must resolve to top-level member and not any child object's properties. Use a custom resolver on the child type or the AfterMap option instead.", - nameof(lambdaExpression)); - } - - MemberInfo member = memberExpression.Member; - - return member; - default: - done = true; - break; - } - } - - throw new AutoMapperConfigurationException( - "Custom configuration for members is only supported for top-level individual members on a type."); - } - - public static Type GetMemberType(this MemberInfo memberInfo) - { - if (memberInfo is MethodInfo) - return ((MethodInfo)memberInfo).ReturnType; - if (memberInfo is PropertyInfo) - return ((PropertyInfo)memberInfo).PropertyType; - if (memberInfo is FieldInfo) - return ((FieldInfo)memberInfo).FieldType; - return null; - } - - public static IMemberGetter ToMemberGetter(this MemberInfo accessorCandidate) - { - if (accessorCandidate?.DeclaringType.GetTypeInfo().ContainsGenericParameters ?? false) - return new NulloMemberGetter(); - - if (accessorCandidate is PropertyInfo) - return - Activator.CreateInstance( - typeof (PropertyAccessor<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberGetter; - - if (accessorCandidate is FieldInfo) - return - Activator.CreateInstance( - typeof (FieldGetter<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberGetter; - - if (accessorCandidate is MethodInfo) - return - Activator.CreateInstance( - typeof (MethodGetter<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberGetter; - - return null; - } - - public static IMemberAccessor ToMemberAccessor(this MemberInfo accessorCandidate) - { - if (accessorCandidate.DeclaringType.GetTypeInfo().ContainsGenericParameters) - return new NulloMemberAccessor(); - - var fieldInfo = accessorCandidate as FieldInfo; - if (fieldInfo != null) - return accessorCandidate.DeclaringType.IsValueType() - ? Activator.CreateInstance( - typeof(ValueTypeFieldAccessor<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberAccessor - : Activator.CreateInstance( - typeof (FieldAccessor<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberAccessor; - - var propertyInfo = accessorCandidate as PropertyInfo; - if (propertyInfo != null) - return accessorCandidate.DeclaringType.IsValueType() - ? Activator.CreateInstance( - typeof (ValueTypePropertyAccessor<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberAccessor - : Activator.CreateInstance( - typeof (PropertyAccessor<,>).MakeGenericType(accessorCandidate.DeclaringType, - accessorCandidate.GetMemberType()), accessorCandidate) as IMemberAccessor; - - return null; - } - - /// - /// if targetType is oldType, method will return newType - /// if targetType is not oldType, method will return targetType - /// if targetType is generic type with oldType arguments, method will replace all oldType arguments on newType - /// - /// - /// - /// - /// - public static Type ReplaceItemType(this Type targetType, Type oldType, Type newType) - { - if (targetType == oldType) - return newType; - - if (targetType.IsGenericType()) - { - var genSubArgs = targetType.GetTypeInfo().GenericTypeArguments; - var newGenSubArgs = new Type[genSubArgs.Length]; - for (int i = 0; i < genSubArgs.Length; i++) - newGenSubArgs[i] = ReplaceItemType(genSubArgs[i], oldType, newType); - return targetType.GetGenericTypeDefinition().MakeGenericType(newGenSubArgs); - } - - return targetType; - } - } -} diff --git a/src/AutoMapper/Execution/TypeDescription.cs b/src/AutoMapper/Execution/TypeDescription.cs new file mode 100644 index 0000000000..dded7e31bf --- /dev/null +++ b/src/AutoMapper/Execution/TypeDescription.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace AutoMapper.Execution +{ + public struct TypeDescription : IEquatable + { + public TypeDescription(Type type) : this(type, PropertyDescription.Empty) + { + } + + public TypeDescription(Type type, IEnumerable additionalProperties) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + if(additionalProperties == null) + { + throw new ArgumentNullException(nameof(additionalProperties)); + } + AdditionalProperties = additionalProperties.OrderBy(p => p.Name).ToArray(); + } + + public Type Type { get; } + + public PropertyDescription[] AdditionalProperties { get; } + + public override int GetHashCode() + { + var hashCode = Type.GetHashCode(); + foreach(var property in AdditionalProperties) + { + hashCode = HashCodeCombiner.CombineCodes(hashCode, property.GetHashCode()); + } + return hashCode; + } + + public override bool Equals(object other) => other is TypeDescription description && Equals(description); + + public bool Equals(TypeDescription other) => Type == other.Type && AdditionalProperties.SequenceEqual(other.AdditionalProperties); + + public static bool operator ==(TypeDescription left, TypeDescription right) => left.Equals(right); + + public static bool operator !=(TypeDescription left, TypeDescription right) => !left.Equals(right); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Execution/TypeMapPlanBuilder.cs b/src/AutoMapper/Execution/TypeMapPlanBuilder.cs index 5f5162466f..7ccb7da0b0 100644 --- a/src/AutoMapper/Execution/TypeMapPlanBuilder.cs +++ b/src/AutoMapper/Execution/TypeMapPlanBuilder.cs @@ -1,580 +1,633 @@ -namespace AutoMapper.Execution -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Configuration; - using Mappers; - using static System.Linq.Expressions.Expression; - using static ExpressionExtensions; - - public static class TypeMapPlanBuilder - { - private static readonly Expression> _passesDepthCheckExpression = - (ctxt, maxDepth) => PassesDepthCheck(ctxt, maxDepth); - - public static LambdaExpression BuildMapperFunc(TypeMap typeMap, IConfigurationProvider configurationProvider, TypeMapRegistry typeMapRegistry) - { - if (typeMap.SourceType.IsGenericTypeDefinition() || typeMap.DestinationType.IsGenericTypeDefinition()) - return null; - - var srcParam = Parameter(typeMap.SourceType, "src"); - var destParam = Parameter(typeMap.DestinationType, "dest"); - var ctxtParam = Parameter(typeof (ResolutionContext), "ctxt"); - - if (typeMap.Substitution != null) - { - return Lambda(typeMap.Substitution.ReplaceParameters(srcParam, destParam, ctxtParam), srcParam, - destParam, ctxtParam); - } - - if (typeMap.TypeConverterType != null) - { - Type type; - if (typeMap.TypeConverterType.IsGenericTypeDefinition()) - { - var genericTypeParam = typeMap.SourceType.IsGenericType() - ? typeMap.SourceType.GetTypeInfo().GenericTypeArguments[0] - : typeMap.DestinationType.GetTypeInfo().GenericTypeArguments[0]; - type = typeMap.TypeConverterType.MakeGenericType(genericTypeParam); - } - else type = typeMap.TypeConverterType; - - // (src, dest, ctxt) => ((ITypeConverter)ctxt.Options.CreateInstance()).Convert(src, ctxt); - var converterInterfaceType = typeof (ITypeConverter<,>).MakeGenericType(typeMap.SourceType, - typeMap.DestinationType); - return Lambda( - Call( - Convert( - Call( - MakeMemberAccess(ctxtParam, typeof (ResolutionContext).GetProperty("Options")), - typeof (MappingOperationOptions).GetMethod("CreateInstance") - .MakeGenericMethod(type) - ), - converterInterfaceType), - converterInterfaceType.GetMethod("Convert"), - srcParam, ctxtParam - ), - srcParam, destParam, ctxtParam); - } - - if (typeMap.CustomMapper != null) - { - return Lambda(typeMap.CustomMapper.ReplaceParameters(srcParam, destParam, ctxtParam), srcParam, - destParam, ctxtParam); - } - - if (typeMap.CustomProjection != null) - { - return Lambda(typeMap.CustomProjection.ReplaceParameters(srcParam), srcParam, destParam, ctxtParam); - } - - var destinationFunc = CreateDestinationFunc(typeMap, typeMapRegistry, srcParam, destParam, ctxtParam); - - var assignmentFunc = CreateAssignmentFunc(typeMap, configurationProvider, typeMapRegistry, srcParam, destParam, ctxtParam, - destinationFunc); - - var mapperFunc = CreateMapperFunc(typeMap, srcParam, destParam, ctxtParam, assignmentFunc); - - var lambdaExpr = Lambda(mapperFunc, srcParam, destParam, ctxtParam); - - return lambdaExpr; - } - - private static Expression CreateDestinationFunc( - TypeMap typeMap, - TypeMapRegistry typeMapRegistry, - ParameterExpression srcParam, - ParameterExpression destParam, - ParameterExpression ctxtParam) - { - var newDestFunc = ToType(CreateNewDestinationFunc(typeMap, typeMapRegistry, srcParam, ctxtParam), - typeMap.DestinationType); - - var getDest = typeMap.DestinationTypeToUse.GetTypeInfo().IsValueType - ? newDestFunc - : Coalesce(destParam, newDestFunc); - - Expression destinationFunc = Assign(destParam, getDest); - - if (typeMap.PreserveReferences) - { - var dest = Variable(typeof (object), "dest"); - - Expression valueBag = Property(ctxtParam, "InstanceCache"); - var set = Assign(Property(valueBag, "Item", srcParam), dest); - var setCache = - IfThen(NotEqual(srcParam, Constant(null)), set); - - destinationFunc = Block(new[] {dest}, Assign(dest, destinationFunc), setCache, dest); - } - return destinationFunc; - } - - private static Expression CreateAssignmentFunc( - TypeMap typeMap, - IConfigurationProvider configurationProvider, - TypeMapRegistry registry, - ParameterExpression srcParam, - ParameterExpression destParam, - ParameterExpression ctxtParam, - Expression destinationFunc) - { - var assignTypeMap = Assign(MakeMemberAccess(ctxtParam, typeof (ResolutionContext).GetProperty("TypeMap")), - Constant(typeMap)); - - var beforeMap = Call(ctxtParam, typeof (ResolutionContext).GetMethod("BeforeMap"), ToObject(destParam)); +namespace AutoMapper.Execution +{ + using AutoMapper.Internal; + using Configuration; + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + using System.Linq.Expressions; + using System.Reflection; + using static ExpressionBuilder; + using static Internal.ExpressionFactory; + using static System.Linq.Expressions.Expression; + public class TypeMapPlanBuilder + { + private static readonly Expression> CtorExpression = + () => new AutoMapperMappingException(null, null, default, null, null); - ParameterExpression propertyContext = null; - var typeMaps = typeMap.GetPropertyMaps() - .Where(pm => pm.CanResolveValue()) - .Select(pm => TryPropertyMap(pm, configurationProvider, registry, srcParam, destParam, ctxtParam, ref propertyContext)) - .ToList(); - - var afterMap = Call(ctxtParam, typeof (ResolutionContext).GetMethod("AfterMap"), ToObject(destParam)); - - var actions = typeMaps; - - foreach (var beforeMapAction in typeMap.BeforeMapActions) + private static readonly Expression> IncTypeDepthInfo = + ctxt => ctxt.IncrementTypeDepth(default); + + private static readonly Expression> ValidateMap = + ctxt => ctxt.ValidateMap(default); + + private static readonly Expression> DecTypeDepthInfo = + ctxt => ctxt.DecrementTypeDepth(default); + + private static readonly Expression> GetTypeDepthInfo = + ctxt => ctxt.GetTypeDepth(default); + + private readonly IConfigurationProvider _configurationProvider; + private readonly ParameterExpression _destination; + private readonly ParameterExpression _initialDestination; + private readonly TypeMap _typeMap; + + public TypeMapPlanBuilder(IConfigurationProvider configurationProvider, TypeMap typeMap) + { + _configurationProvider = configurationProvider; + _typeMap = typeMap; + Source = Parameter(typeMap.SourceType, "src"); + _initialDestination = Parameter(typeMap.DestinationTypeToUse, "dest"); + Context = Parameter(typeof(ResolutionContext), "ctxt"); + _destination = Variable(_initialDestination.Type, "typeMapDestination"); + } + + public ParameterExpression Source { get; } + + public ParameterExpression Context { get; } + + public LambdaExpression CreateMapperLambda(HashSet typeMapsPath) + { + var customExpression = TypeConverterMapper() ?? _typeMap.CustomMapFunction ?? _typeMap.CustomMapExpression; + if (customExpression != null) + { + return Lambda(customExpression.ReplaceParameters(Source, _initialDestination, Context), Source, _initialDestination, Context); + } + + CheckForCycles(typeMapsPath); + + if (typeMapsPath != null) + { + return null; + } + + var destinationFunc = CreateDestinationFunc(); + + var assignmentFunc = CreateAssignmentFunc(destinationFunc); + + var mapperFunc = CreateMapperFunc(assignmentFunc); + + var checkContext = CheckContext(_typeMap, Context); + var lambaBody = checkContext != null ? new[] { checkContext, mapperFunc } : new[] { mapperFunc }; + + return Lambda(Block(new[] { _destination }, lambaBody), Source, _initialDestination, Context); + } + + private void CheckForCycles(HashSet typeMapsPath) + { + var inlineWasChecked = _typeMap.WasInlineChecked; + _typeMap.WasInlineChecked = true; + if (typeMapsPath == null) + { + typeMapsPath = new HashSet(); + } + typeMapsPath.Add(_typeMap); + var members = + _typeMap.MemberMaps.Where(pm => pm.CanResolveValue) + .Select(pm => new { MemberTypeMap = ResolveMemberTypeMap(pm), MemberMap = pm }) + .Where(p => p.MemberTypeMap != null && !p.MemberTypeMap.PreserveReferences && p.MemberTypeMap.MapExpression == null); + foreach (var item in members) { - actions.Insert(0, beforeMapAction.ReplaceParameters(srcParam, destParam, ctxtParam)); - } - actions.Insert(0, beforeMap); - actions.Insert(0, destinationFunc); - actions.Insert(0, assignTypeMap); - ParameterExpression[] variables; - if(propertyContext != null) - { - var createPropertyContext = CreatePropertyContext(propertyContext, ctxtParam); - actions.Insert(0, createPropertyContext); - variables = new[] { propertyContext }; - } + var memberMap = item.MemberMap; + var memberTypeMap = item.MemberTypeMap; + if (!inlineWasChecked && typeMapsPath.Count % _configurationProvider.MaxExecutionPlanDepth == 0) + { + memberMap.Inline = false; + Debug.WriteLine($"Resetting Inline: {memberMap.DestinationName} in {_typeMap.SourceType} - {_typeMap.DestinationType}"); + } + if (typeMapsPath.Contains(memberTypeMap)) + { + if (memberTypeMap.SourceType.IsValueType()) + { + if (memberTypeMap.MaxDepth == 0) + { + memberTypeMap.MaxDepth = 10; + } + typeMapsPath.Remove(_typeMap); + return; + } + + SetPreserveReferences(memberTypeMap); + foreach (var derivedTypeMap in memberTypeMap.IncludedDerivedTypes.Select(ResolveTypeMap)) + { + SetPreserveReferences(derivedTypeMap); + } + } + memberTypeMap.CreateMapperLambda(_configurationProvider, typeMapsPath); + } + typeMapsPath.Remove(_typeMap); + return; + + void SetPreserveReferences(TypeMap memberTypeMap) + { + Debug.WriteLine($"Setting PreserveReferences: {_typeMap.SourceType} - {_typeMap.DestinationType} => {memberTypeMap.SourceType} - {memberTypeMap.DestinationType}"); + memberTypeMap.PreserveReferences = true; + } + + TypeMap ResolveMemberTypeMap(IMemberMap memberMap) + { + if (memberMap.SourceType == null) + { + return null; + } + var types = new TypePair(memberMap.SourceType, memberMap.DestinationType); + return ResolveTypeMap(types); + } + + TypeMap ResolveTypeMap(TypePair types) + { + var typeMap = _configurationProvider.ResolveTypeMap(types); + if (typeMap == null && _configurationProvider.FindMapper(types) is IObjectMapperInfo mapper) + { + typeMap = _configurationProvider.ResolveTypeMap(mapper.GetAssociatedTypes(types)); + } + return typeMap; + } + } + + private LambdaExpression TypeConverterMapper() + { + if (_typeMap.TypeConverterType == null) + return null; + Type type; + if (_typeMap.TypeConverterType.IsGenericTypeDefinition()) + { + var genericTypeParam = _typeMap.SourceType.IsGenericType() + ? _typeMap.SourceType.GetTypeInfo().GenericTypeArguments[0] + : _typeMap.DestinationTypeToUse.GetTypeInfo().GenericTypeArguments[0]; + type = _typeMap.TypeConverterType.MakeGenericType(genericTypeParam); + } else { - variables = new ParameterExpression[0]; - } - - actions.Add(afterMap); - - actions.AddRange( - typeMap.AfterMapActions.Select( - afterMapAction => afterMapAction.ReplaceParameters(srcParam, destParam, ctxtParam))); - - actions.Add(destParam); - - return Block(variables, actions); + type = _typeMap.TypeConverterType; + } + // (src, dest, ctxt) => ((ITypeConverter)ctxt.Options.CreateInstance()).ToType(src, ctxt); + var converterInterfaceType = + typeof(ITypeConverter<,>).MakeGenericType(_typeMap.SourceType, _typeMap.DestinationTypeToUse); + return Lambda( + Call( + ToType(CreateInstance(type), converterInterfaceType), + converterInterfaceType.GetDeclaredMethod("Convert"), + Source, _initialDestination, Context + ), + Source, _initialDestination, Context); } - public static Expression CreatePropertyContext(ParameterExpression propertyContext, ParameterExpression ctxtParam) + private Expression CreateDestinationFunc() { - var constructor = - (from c in typeof(ResolutionContext).GetDeclaredConstructors() - let parameters = c.GetParameters() - where parameters.Length == 1 && parameters[0].ParameterType == typeof(ResolutionContext) - select c).Single(); - return Assign(propertyContext, New(constructor, ctxtParam)); - } - - private static Expression CreateMapperFunc( - TypeMap typeMap, - ParameterExpression srcParam, - ParameterExpression destParam, - ParameterExpression ctxtParam, - Expression assignmentFunc) - { - var mapperFunc = assignmentFunc; - - if (typeMap.Condition != null) - { - mapperFunc = - Condition(Invoke(typeMap.Condition, ctxtParam), - mapperFunc, Default(typeMap.DestinationType)); - //mapperFunc = (source, context, destFunc) => _condition(context) ? inner(source, context, destFunc) : default(TDestination); - } - - if (typeMap.MaxDepth > 0) - { - mapperFunc = Condition(Invoke(_passesDepthCheckExpression, ctxtParam, Constant(typeMap.MaxDepth)), - mapperFunc, - Default(typeMap.DestinationType)); - //mapperFunc = (source, context, destFunc) => PassesDepthCheck(context, typeMap.MaxDepth) ? inner(source, context, destFunc) : default(TDestination); - } - - if (typeMap.Profile.AllowNullDestinationValues && typeMap.SourceType.IsClass()) - { - mapperFunc = - Condition(Equal(srcParam, Default(typeMap.SourceType)), - Default(typeMap.DestinationType), mapperFunc); - //mapperFunc = (source, context, destFunc) => source == default(TSource) ? default(TDestination) : inner(source, context, destFunc); - } - - if (typeMap.PreserveReferences) - { - var cache = Variable(typeMap.DestinationType, "cachedDestination"); - - var condition = Condition( - AndAlso( - NotEqual(srcParam, Constant(null)), - AndAlso( - Equal(destParam, Constant(null)), - Call(Property(ctxtParam, "InstanceCache"), - typeof (Dictionary).GetMethod("ContainsKey"), srcParam) - )), - Assign(cache, - ToType(Property(Property(ctxtParam, "InstanceCache"), "Item", srcParam), typeMap.DestinationType)), - Assign(cache, mapperFunc) - ); - - mapperFunc = Block(new[] {cache}, condition, cache); - } - return mapperFunc; - } - - private static Expression CreateNewDestinationFunc( - TypeMap typeMap, - TypeMapRegistry typeMapRegistry, - ParameterExpression srcParam, - ParameterExpression ctxtParam) - { - if (typeMap.DestinationCtor != null) - return typeMap.DestinationCtor.ReplaceParameters(srcParam, ctxtParam); - - if (typeMap.ConstructDestinationUsingServiceLocator) - return Call(MakeMemberAccess(ctxtParam, typeof (ResolutionContext).GetProperty("Options")), - typeof (MappingOperationOptions).GetMethod("CreateInstance") - .MakeGenericMethod(typeMap.DestinationType) - ); - - if (typeMap.ConstructorMap?.CanResolve == true) - return typeMap.ConstructorMap.BuildExpression(typeMapRegistry, srcParam, ctxtParam); - - if (typeMap.DestinationType.IsInterface()) - { -#if PORTABLE - Block(typeof (object), - Throw( - Constant( - new PlatformNotSupportedException("Mapping to interfaces through proxies not supported."))), - Constant(null)); -#else - var ctor = Call(Constant(ObjectCreator.DelegateFactory), typeof(DelegateFactory).GetMethod("CreateCtor", new[] { typeof(Type) }), Call(New(typeof(ProxyGenerator)), typeof(ProxyGenerator).GetMethod("GetProxyType"), Constant(typeMap.DestinationType))); - return Invoke(ctor); -#endif - } - - if (typeMap.DestinationType.IsAbstract()) - return Constant(null); - - if (typeMap.DestinationType.IsGenericTypeDefinition()) - return Constant(null); - - return DelegateFactory.GenerateConstructorExpression(typeMap.DestinationType); - } - - private static Expression TryPropertyMap( - PropertyMap pm, - IConfigurationProvider configurationProvider, - TypeMapRegistry registry, - ParameterExpression srcParam, - ParameterExpression destParam, - ParameterExpression ctxtParam, - ref ParameterExpression propertyContext) - { - var pmExpression = CreatePropertyMapFunc(pm, configurationProvider, registry, srcParam, destParam, ctxtParam, ref propertyContext); - - if (pmExpression == null) - return null; - - var autoMapException = Parameter(typeof (AutoMapperMappingException), "ex"); - var exception = Parameter(typeof (Exception), "ex"); - - var mappingExceptionCtor = - typeof (AutoMapperMappingException).GetTypeInfo() - .DeclaredConstructors.First(ci => ci.GetParameters().Length == 3); - - return TryCatch(Block(typeof (void), pmExpression), - MakeCatchBlock(typeof (AutoMapperMappingException), autoMapException, - Block(Assign(Property(autoMapException, "PropertyMap"), Constant(pm)), Rethrow()), null), - MakeCatchBlock(typeof (Exception), exception, - Throw(New(mappingExceptionCtor, ctxtParam, exception, Constant(pm))), null)); - } - - private static Expression CreatePropertyMapFunc( - PropertyMap propertyMap, - IConfigurationProvider configurationProvider, - TypeMapRegistry typeMapRegistry, - ParameterExpression srcParam, - ParameterExpression destParam, - ParameterExpression ctxtParam, - ref ParameterExpression propertyContext) - { - var valueResolverExpr = BuildValueResolverFunc(propertyMap, typeMapRegistry, srcParam, ctxtParam); - var destMember = MakeMemberAccess(destParam, propertyMap.DestinationProperty.MemberInfo); + var newDestFunc = ToType(CreateNewDestinationFunc(), _typeMap.DestinationTypeToUse); - Expression getter; - - var pi = propertyMap.DestinationProperty.MemberInfo as PropertyInfo; - if (pi != null && pi.GetGetMethod(true) == null) - { - getter = Default(propertyMap.DestinationPropertyType); - } - else - { - getter = destMember; - } - - var destValueExpr = propertyMap.UseDestinationValue - ? getter - : Default(propertyMap.TypeMap.DestinationType); - - if (propertyMap.SourceType != null && propertyMap.DestinationPropertyType != null) - { - var typePair = new TypePair(propertyMap.SourceType, propertyMap.DestinationPropertyType); - var typeMap = typeMapRegistry.GetTypeMap(typePair); - if (typeMap != null && (typeMap.TypeConverterType != null || typeMap.CustomMapper != null)) - { - if(!typeMap.Sealed) - typeMap.Seal(typeMapRegistry, configurationProvider); - valueResolverExpr = typeMap.MapExpression.ReplaceParameters(valueResolverExpr, destValueExpr, ctxtParam); - } - else - { - var match = configurationProvider.GetMappers().FirstOrDefault(m => m.IsMatch(typePair)); - var expressionMapper = match as IObjectMapExpression; - if (expressionMapper != null) - valueResolverExpr = expressionMapper.MapExpression(valueResolverExpr, destValueExpr, - ctxtParam); - else - valueResolverExpr = SetMap(propertyMap, valueResolverExpr, destValueExpr, ref propertyContext); - } - } - else - { - valueResolverExpr = SetMap(propertyMap, valueResolverExpr, destValueExpr, ref propertyContext); - } - - if (propertyMap.Condition != null) - { - valueResolverExpr = - Condition( - Invoke( - propertyMap.Condition, - srcParam, - destParam, - ToType(valueResolverExpr, propertyMap.Condition.Parameters[2].Type), - ToType(destValueExpr, propertyMap.Condition.Parameters[2].Type), - ctxtParam - ), - Convert(valueResolverExpr, propertyMap.DestinationPropertyType), - destValueExpr - ); - } - - Expression mapperExpr; - if (propertyMap.DestinationProperty.MemberInfo is FieldInfo) - { - mapperExpr = propertyMap.SourceType != propertyMap.DestinationPropertyType - ? Assign(destMember, Convert(valueResolverExpr, propertyMap.DestinationPropertyType)) - : Assign(getter, valueResolverExpr); - } - else - { - var setter = ((PropertyInfo) propertyMap.DestinationProperty.MemberInfo).GetSetMethod(true); - if (setter == null) - { - mapperExpr = valueResolverExpr; - } - else + if (!_typeMap.Profile.AllowNullDestinationValues && newDestFunc is NewExpression newExpression) + { + var bindings = new List(); + foreach (var item in _typeMap.ExcludeMaps.Where(x => !x.ExplicitExpansion && ReflectionHelper.CanBeSet(x.DestinationMember) && x.DestinationType == typeof(string)) + .OrderBy(x => x.DestinationName)) { - mapperExpr = Assign(destMember, propertyMap.SourceType != propertyMap.DestinationPropertyType - ? Convert(valueResolverExpr, propertyMap.DestinationPropertyType) - : valueResolverExpr); + bindings.Add(Bind(item.DestinationMember, Constant(string.Empty))); } - } - - if (propertyMap.PreCondition != null) - { - mapperExpr = IfThen( - Invoke(propertyMap.PreCondition, srcParam, ctxtParam), - mapperExpr - ); - } - - return mapperExpr; - } - - private static Expression SetMap(PropertyMap propertyMap, Expression valueResolverExpr, Expression destValueExpr, - ref ParameterExpression propertyContext) - { - return ContextMap(valueResolverExpr, destValueExpr, propertyMap.DestinationPropertyType, ref propertyContext); + if (bindings.Count > 0) + { + newDestFunc = MemberInit(newExpression, bindings); + } + } + + var getDest = _typeMap.DestinationTypeToUse.IsValueType() ? newDestFunc : Coalesce(_initialDestination, newDestFunc); + + Expression destinationFunc = Assign(_destination, getDest); + + if (_typeMap.PreserveReferences) + { + var dest = Variable(typeof(object), "dest"); + var setValue = Context.Type.GetDeclaredMethod("CacheDestination"); + var set = Call(Context, setValue, Source, Constant(_destination.Type), _destination); + var setCache = IfThen(NotEqual(Source, Constant(null)), set); + + destinationFunc = Block(new[] { dest }, Assign(dest, destinationFunc), setCache, dest); + } + return destinationFunc; } - public static Expression ContextMap(Expression valueResolverExpr, Expression destValueExpr, Type destinationType, ref ParameterExpression propertyContext) + private Expression CreateAssignmentFunc(Expression destinationFunc) { - if(propertyContext == null) - { - propertyContext = Variable(typeof(ResolutionContext), "propertyContext"); - } - var mapMethod = typeof(ResolutionContext).GetDeclaredMethods().Single(m => m.Name == "Map"); - var second = Call( - propertyContext, - mapMethod, - ToObject(valueResolverExpr), - ToObject(destValueExpr), - Constant(valueResolverExpr.Type), - Constant(destinationType) - ); - return Convert(second, destinationType); + var isConstructorMapping = _typeMap.IsConstructorMapping; + var actions = new List(); + foreach (var propertyMap in _typeMap.PropertyMaps.Where(pm => pm.CanResolveValue)) + { + var property = TryPropertyMap(propertyMap); + if (isConstructorMapping && _typeMap.ConstructorParameterMatches(propertyMap.DestinationName)) + property = _initialDestination.IfNullElse(Default(property.Type), property); + actions.Add(property); + } + foreach (var pathMap in _typeMap.PathMaps.Where(pm => !pm.Ignored)) + actions.Add(TryPathMap(pathMap)); + foreach (var beforeMapAction in _typeMap.BeforeMapActions) + actions.Insert(0, beforeMapAction.ReplaceParameters(Source, _destination, Context)); + actions.Insert(0, destinationFunc); + if (_typeMap.MaxDepth > 0) + { + actions.Insert(0, + Call(Context, ((MethodCallExpression)IncTypeDepthInfo.Body).Method, Constant(_typeMap.Types))); + } + if (_typeMap.IsConventionMap && _typeMap.Profile.ValidateInlineMaps) + { + actions.Insert(0, Call(Context, ((MethodCallExpression)ValidateMap.Body).Method, Constant(_typeMap))); + } + actions.AddRange( + _typeMap.AfterMapActions.Select( + afterMapAction => afterMapAction.ReplaceParameters(Source, _destination, Context))); + + if (_typeMap.MaxDepth > 0) + actions.Add(Call(Context, ((MethodCallExpression)DecTypeDepthInfo.Body).Method, + Constant(_typeMap.Types))); + + actions.Add(_destination); + + return Block(actions); + } + + private Expression TryPathMap(PathMap pathMap) + { + var destination = ((MemberExpression)pathMap.DestinationExpression.ConvertReplaceParameters(_destination)).Expression; + var createInnerObjects = CreateInnerObjects(destination); + var setFinalValue = CreatePropertyMapFunc(pathMap, destination, pathMap.MemberPath.Last); + + var pathMapExpression = Block(createInnerObjects, setFinalValue); + + return TryMemberMap(pathMap, pathMapExpression); + } + + private Expression CreateInnerObjects(Expression destination) => Block(destination.GetMembers() + .Select(NullCheck) + .Reverse() + .Concat(new[] { Empty() })); + + private Expression NullCheck(MemberExpression memberExpression) + { + var setter = GetSetter(memberExpression); + var ifNull = setter == null + ? (Expression) + Throw(Constant(new NullReferenceException( + $"{memberExpression} cannot be null because it's used by ForPath."))) + : Assign(setter, DelegateFactory.GenerateConstructorExpression(memberExpression.Type)); + return memberExpression.IfNullElse(ifNull); + } + + private Expression CreateMapperFunc(Expression assignmentFunc) + { + var mapperFunc = assignmentFunc; + + if (_typeMap.Condition != null) + mapperFunc = + Condition(_typeMap.Condition.Body, + mapperFunc, Default(_typeMap.DestinationTypeToUse)); + + if (_typeMap.MaxDepth > 0) + mapperFunc = Condition( + LessThanOrEqual( + Call(Context, ((MethodCallExpression)GetTypeDepthInfo.Body).Method, Constant(_typeMap.Types)), + Constant(_typeMap.MaxDepth) + ), + mapperFunc, + Default(_typeMap.DestinationTypeToUse)); + + if (_typeMap.Profile.AllowNullDestinationValues) + mapperFunc = Source.IfNullElse(Default(_typeMap.DestinationTypeToUse), mapperFunc); + + return CheckReferencesCache(mapperFunc); + } + + private Expression CheckReferencesCache(Expression valueBuilder) + { + if (!_typeMap.PreserveReferences) + { + return valueBuilder; + } + var cache = Variable(_typeMap.DestinationTypeToUse, "cachedDestination"); + var getDestination = Context.Type.GetDeclaredMethod("GetDestination"); + var assignCache = + Assign(cache, + ToType(Call(Context, getDestination, Source, Constant(_destination.Type)), _destination.Type)); + var condition = Condition( + AndAlso(NotEqual(Source, Constant(null)), NotEqual(assignCache, Constant(null))), + cache, + valueBuilder); + return Block(new[] { cache }, condition); } - private static Expression BuildValueResolverFunc(PropertyMap propertyMap, TypeMapRegistry typeMapRegistry, - ParameterExpression srcParam, - ParameterExpression ctxtParam) + private Expression CreateNewDestinationFunc() + { + if (_typeMap.CustomCtorExpression != null) + { + return _typeMap.CustomCtorExpression.ReplaceParameters(Source); + } + if (_typeMap.CustomCtorFunction != null) + { + return _typeMap.CustomCtorFunction.ReplaceParameters(Source, Context); + } + if (_typeMap.ConstructDestinationUsingServiceLocator) + { + return CreateInstance(_typeMap.DestinationTypeToUse); + } + if (_typeMap.ConstructorMap?.CanResolve == true) + { + return CreateNewDestinationExpression(_typeMap.ConstructorMap); + } + if (_typeMap.DestinationTypeToUse.IsInterface()) + { + var ctor = Call(null, + typeof(DelegateFactory).GetDeclaredMethod(nameof(DelegateFactory.CreateCtor), new[] { typeof(Type) }), + Call(null, + typeof(ProxyGenerator).GetDeclaredMethod(nameof(ProxyGenerator.GetProxyType)), + Constant(_typeMap.DestinationTypeToUse))); + // We're invoking a delegate here to make it have the right accessibility + return Invoke(ctor); + } + return DelegateFactory.GenerateConstructorExpression(_typeMap.DestinationTypeToUse); + } + + private Expression CreateNewDestinationExpression(ConstructorMap constructorMap) + { + var ctorArgs = constructorMap.CtorParams.Select(CreateConstructorParameterExpression); + var variables = constructorMap.Ctor.GetParameters().Select(parameter => Variable(parameter.ParameterType, parameter.Name)).ToArray(); + var body = variables.Zip(ctorArgs, + (variable, expression) => (Expression)Assign(variable, ToType(expression, variable.Type))) + .Concat(new[] { CheckReferencesCache(New(constructorMap.Ctor, variables)) }) + .ToArray(); + return Block(variables, body); + } + + private Expression ResolveSource(ConstructorParameterMap ctorParamMap) + { + if (ctorParamMap.CustomMapExpression != null) + return ctorParamMap.CustomMapExpression.ConvertReplaceParameters(Source) + .NullCheck(ctorParamMap.DestinationType); + if (ctorParamMap.CustomMapFunction != null) + return ctorParamMap.CustomMapFunction.ConvertReplaceParameters(Source, Context); + if (ctorParamMap.HasDefaultValue) + return Constant(ctorParamMap.Parameter.GetDefaultValue(), ctorParamMap.Parameter.ParameterType); + return Chain(ctorParamMap.SourceMembers, ctorParamMap.DestinationType); + } + + private Expression CreateConstructorParameterExpression(ConstructorParameterMap ctorParamMap) + { + var resolvedExpression = ResolveSource(ctorParamMap); + var resolvedValue = Variable(resolvedExpression.Type, "resolvedValue"); + var tryMap = Block(new[] { resolvedValue }, + Assign(resolvedValue, resolvedExpression), + MapExpression(_configurationProvider, _typeMap.Profile, new TypePair(resolvedExpression.Type, ctorParamMap.DestinationType), resolvedValue, Context)); + return TryMemberMap(ctorParamMap, tryMap); + } + + private Expression TryPropertyMap(PropertyMap propertyMap) { - Expression valueResolverFunc; - var valueResolverConfig = propertyMap.ValueResolverConfig; - var typeMap = propertyMap.TypeMap; - - if (valueResolverConfig != null) - { - Expression ctor; - Type resolverType; - if (valueResolverConfig.Instance != null) - { - ctor = Constant(valueResolverConfig.Instance); - resolverType = valueResolverConfig.Instance.GetType(); - } - else - { - ctor = Call(MakeMemberAccess(ctxtParam, typeof (ResolutionContext).GetProperty("Options")), - typeof (MappingOperationOptions).GetMethod("CreateInstance") - .MakeGenericMethod(valueResolverConfig.Type) - ); - resolverType = valueResolverConfig.Type; - } - - Expression sourceFunc; - if (valueResolverConfig.SourceMember != null) - { - sourceFunc = valueResolverConfig.SourceMember.ReplaceParameters(srcParam); - } - else if (valueResolverConfig.SourceMemberName != null) - { - sourceFunc = MakeMemberAccess(srcParam, - typeMap.SourceType.GetFieldOrProperty(valueResolverConfig.SourceMemberName)); - } - else - { - sourceFunc = srcParam; - } - - valueResolverFunc = - Convert(Call(ToType(ctor, resolverType), resolverType.GetMethod("Resolve"), sourceFunc, ctxtParam), - propertyMap.DestinationPropertyType); - } - else if (propertyMap.CustomValue != null) - { - valueResolverFunc = Constant(propertyMap.CustomValue); - } - else if (propertyMap.CustomResolver != null) - { - valueResolverFunc = propertyMap.CustomResolver.ReplaceParameters(srcParam, ctxtParam); - } - else if (propertyMap.CustomExpression != null) - { - valueResolverFunc = propertyMap.CustomExpression.ReplaceParameters(srcParam).IfNotNull(); - } - else if (propertyMap.SourceMembers.Any() - && propertyMap.SourceType != null - ) - { - var last = propertyMap.SourceMembers.Last(); - var pi = last.MemberInfo as PropertyInfo; - if (pi != null && pi.GetGetMethod(true) == null) - { - valueResolverFunc = Default(last.MemberType); - } - else - { - valueResolverFunc = propertyMap.SourceMembers.Aggregate( - (Expression) srcParam, - (inner, getter) => getter.MemberInfo is MethodInfo - ? getter.MemberInfo.IsStatic() - ? Call(null, (MethodInfo) getter.MemberInfo, inner) - : (Expression) Call(inner, (MethodInfo) getter.MemberInfo) - : MakeMemberAccess(getter.MemberInfo.IsStatic() ? null : inner, getter.MemberInfo) - ); - valueResolverFunc = valueResolverFunc.IfNotNull(); - } - } - else if (propertyMap.SourceMember != null) - { - valueResolverFunc = MakeMemberAccess(srcParam, propertyMap.SourceMember); - } - else - { - valueResolverFunc = Throw(Constant(new Exception("I done blowed up"))); - } - - if (propertyMap.DestinationPropertyType == typeof (string) && valueResolverFunc.Type != typeof (string) - && - typeMapRegistry.GetTypeMap(new TypePair(valueResolverFunc.Type, propertyMap.DestinationPropertyType)) == - null) - { - valueResolverFunc = Call(valueResolverFunc, valueResolverFunc.Type.GetMethod("ToString", new Type[0])); - } - - if (propertyMap.NullSubstitute != null) - { - Expression value = Constant(propertyMap.NullSubstitute); - if (propertyMap.NullSubstitute.GetType() != propertyMap.DestinationPropertyType) - value = Convert(value, propertyMap.DestinationPropertyType); - valueResolverFunc = MakeBinary(ExpressionType.Coalesce, valueResolverFunc, value); - } - else if (!typeMap.Profile.AllowNullDestinationValues) - { - var toCreate = propertyMap.SourceType ?? propertyMap.DestinationPropertyType; - if (!toCreate.GetTypeInfo().IsValueType) - { - valueResolverFunc = MakeBinary(ExpressionType.Coalesce, - valueResolverFunc, - Convert(Call( - typeof (ObjectCreator).GetMethod("CreateNonNullValue"), - Constant(toCreate) - ), propertyMap.SourceType)); - } - } - - return valueResolverFunc; - } + var pmExpression = CreatePropertyMapFunc(propertyMap, _destination, propertyMap.DestinationMember); + + if (pmExpression == null) + return null; + + return TryMemberMap(propertyMap, pmExpression); + } + + private static Expression TryMemberMap(IMemberMap memberMap, Expression memberMapExpression) + { + var exception = Parameter(typeof(Exception), "ex"); + + var mappingExceptionCtor = ((NewExpression)CtorExpression.Body).Constructor; + + return TryCatch(memberMapExpression, + MakeCatchBlock(typeof(Exception), exception, + Block( + Throw(New(mappingExceptionCtor, Constant("Error mapping types."), exception, + Constant(memberMap.TypeMap.Types), Constant(memberMap.TypeMap), Constant(memberMap))), + Default(memberMapExpression.Type)) + , null)); + } + + private Expression CreatePropertyMapFunc(IMemberMap memberMap, Expression destination, MemberInfo destinationMember) + { + var destMember = MakeMemberAccess(destination, destinationMember); + + Expression getter; + + if (destinationMember is PropertyInfo pi && pi.GetGetMethod(true) == null) + getter = Default(memberMap.DestinationType); + else + getter = destMember; + + Expression destValueExpr; + if (memberMap.UseDestinationValue) + { + destValueExpr = getter; + } + else + { + if (_initialDestination.Type.IsValueType()) + destValueExpr = Default(memberMap.DestinationType); + else + destValueExpr = Condition(Equal(_initialDestination, Constant(null)), + Default(memberMap.DestinationType), getter); + } + + var valueResolverExpr = BuildValueResolverFunc(memberMap, getter); + var resolvedValue = Variable(valueResolverExpr.Type, "resolvedValue"); + var setResolvedValue = Assign(resolvedValue, valueResolverExpr); + valueResolverExpr = resolvedValue; + + var typePair = new TypePair(valueResolverExpr.Type, memberMap.DestinationType); + valueResolverExpr = memberMap.Inline + ? MapExpression(_configurationProvider, _typeMap.Profile, typePair, valueResolverExpr, Context, + memberMap, destValueExpr) + : ContextMap(typePair, valueResolverExpr, Context, destValueExpr, memberMap); + + valueResolverExpr = memberMap.ValueTransformers + .Concat(_typeMap.ValueTransformers) + .Concat(_typeMap.Profile.ValueTransformers) + .Where(vt => vt.IsMatch(memberMap)) + .Aggregate(valueResolverExpr, (current, vtConfig) => ToType(ReplaceParameters(vtConfig.TransformerExpression, ToType(current, vtConfig.ValueType)), memberMap.DestinationType)); + + ParameterExpression propertyValue; + Expression setPropertyValue; + if (valueResolverExpr == resolvedValue) + { + propertyValue = resolvedValue; + setPropertyValue = setResolvedValue; + } + else + { + propertyValue = Variable(valueResolverExpr.Type, "propertyValue"); + setPropertyValue = Assign(propertyValue, valueResolverExpr); + } + + Expression mapperExpr; + if (destinationMember is FieldInfo) + { + mapperExpr = memberMap.SourceType != memberMap.DestinationType + ? Assign(destMember, ToType(propertyValue, memberMap.DestinationType)) + : Assign(getter, propertyValue); + } + else + { + var setter = ((PropertyInfo)destinationMember).GetSetMethod(true); + if (setter == null) + mapperExpr = propertyValue; + else + mapperExpr = Assign(destMember, ToType(propertyValue, memberMap.DestinationType)); + } + var source = GetCustomSource(memberMap); + if (memberMap.Condition != null) + mapperExpr = IfThen( + memberMap.Condition.ConvertReplaceParameters( + source, + _destination, + ToType(propertyValue, memberMap.Condition.Parameters[2].Type), + ToType(getter, memberMap.Condition.Parameters[2].Type), + Context + ), + mapperExpr + ); + + mapperExpr = Block(new[] { setResolvedValue, setPropertyValue, mapperExpr }.Distinct()); + + if (memberMap.PreCondition != null) + mapperExpr = IfThen( + memberMap.PreCondition.ConvertReplaceParameters( + source, + _destination, + Context + ), + mapperExpr + ); + + return Block(new[] { resolvedValue, propertyValue }.Distinct(), mapperExpr); + } + + private Expression BuildValueResolverFunc(IMemberMap memberMap, Expression destValueExpr) + { + Expression valueResolverFunc; + var destinationPropertyType = memberMap.DestinationType; + + if (memberMap.ValueConverterConfig != null) + { + valueResolverFunc = ToType(BuildConvertCall(memberMap), destinationPropertyType); + } + else if (memberMap.ValueResolverConfig != null) + { + valueResolverFunc = ToType(BuildResolveCall(destValueExpr, memberMap), destinationPropertyType); + } + else if (memberMap.CustomMapFunction != null) + { + valueResolverFunc = + memberMap.CustomMapFunction.ConvertReplaceParameters(GetCustomSource(memberMap), _destination, destValueExpr, Context); + } + else if (memberMap.CustomMapExpression != null) + { + var nullCheckedExpression = memberMap.CustomMapExpression.ReplaceParameters(Source) + .NullCheck(destinationPropertyType); + var destinationNullable = destinationPropertyType.IsNullableType(); + var returnType = destinationNullable && destinationPropertyType.GetTypeOfNullable() == + nullCheckedExpression.Type + ? destinationPropertyType + : nullCheckedExpression.Type; + valueResolverFunc = + TryCatch( + ToType(nullCheckedExpression, returnType), + Catch(typeof(NullReferenceException), Default(returnType)), + Catch(typeof(ArgumentNullException), Default(returnType)) + ); + } + else if (memberMap.SourceMembers.Any() && memberMap.SourceType != null) + { + var last = memberMap.SourceMembers.Last(); + if (last is PropertyInfo pi && pi.GetGetMethod(true) == null) + { + valueResolverFunc = Default(last.GetMemberType()); + } + else + { + valueResolverFunc = Chain(memberMap.SourceMembers, destinationPropertyType); + } + } + else + { + valueResolverFunc = Throw(Constant(new Exception("I done blowed up"))); + } + + if (memberMap.NullSubstitute != null) + { + var nullSubstitute = Constant(memberMap.NullSubstitute); + valueResolverFunc = Coalesce(valueResolverFunc, ToType(nullSubstitute, valueResolverFunc.Type)); + } + else if (!memberMap.TypeMap.Profile.AllowNullDestinationValues) + { + var toCreate = memberMap.SourceType ?? destinationPropertyType; + if (!toCreate.IsAbstract() && toCreate.IsClass()) + valueResolverFunc = Coalesce( + valueResolverFunc, + ToType(DelegateFactory.GenerateNonNullConstructorExpression(toCreate), memberMap.SourceType) + ); + } + + return valueResolverFunc; + } - private static bool PassesDepthCheck(ResolutionContext context, int maxDepth) + private Expression GetCustomSource(IMemberMap memberMap) => + memberMap.CustomSource?.ConvertReplaceParameters(Source) ?? Source; + + private Expression Chain(IEnumerable members, Type destinationType) => + members.MemberAccesses(Source).NullCheck(destinationType); + + private Expression CreateInstance(Type type) + => Call(Property(Context, nameof(ResolutionContext.Options)), + nameof(IMappingOperationOptions.CreateInstance), new[] { type }); + + private Expression BuildResolveCall(Expression destValueExpr, IMemberMap memberMap) { - if (context.InstanceCache.ContainsKey(context)) - { - // return true if we already mapped this value and it's in the cache - return true; - } - - var contextCopy = context; - - var currentDepth = 1; + var valueResolverConfig = memberMap.ValueResolverConfig; + var resolverInstance = valueResolverConfig.Instance != null + ? Constant(valueResolverConfig.Instance) + : CreateInstance(valueResolverConfig.ConcreteType); + var source = GetCustomSource(memberMap); + var sourceMember = valueResolverConfig.SourceMember?.ReplaceParameters(source) ?? + (valueResolverConfig.SourceMemberName != null + ? PropertyOrField(source, valueResolverConfig.SourceMemberName) + : null); + + var iResolverType = valueResolverConfig.InterfaceType; + var parameters = + new[] { source, _destination, sourceMember, destValueExpr }.Where(p => p != null) + .Zip(iResolverType.GetGenericArguments(), ToType) + .Concat(new[] { Context }); + return Call(ToType(resolverInstance, iResolverType), iResolverType.GetDeclaredMethod("Resolve"), parameters); + } - // walk parents to determine current depth - while (contextCopy.Parent != null) - { - if (contextCopy.SourceType == context.SourceType && - contextCopy.DestinationType == context.DestinationType) - { - // same source and destination types appear higher up in the hierarchy - currentDepth++; - } - contextCopy = contextCopy.Parent; - } - return currentDepth <= maxDepth; - } - } + private Expression BuildConvertCall(IMemberMap memberMap) + { + var valueConverterConfig = memberMap.ValueConverterConfig; + var iResolverType = valueConverterConfig.InterfaceType; + var iResolverTypeArgs = iResolverType.GetGenericArguments(); + + var resolverInstance = valueConverterConfig.Instance != null + ? Constant(valueConverterConfig.Instance) + : CreateInstance(valueConverterConfig.ConcreteType); + var source = GetCustomSource(memberMap); + var sourceMember = valueConverterConfig.SourceMember?.ReplaceParameters(source) ?? + (valueConverterConfig.SourceMemberName != null + ? PropertyOrField(source, valueConverterConfig.SourceMemberName) + : memberMap.SourceMembers.Any() + ? Chain(memberMap.SourceMembers, iResolverTypeArgs[1]) + : Block( + Throw(Constant(BuildExceptionMessage())), + Default(iResolverTypeArgs[0]) + ) + ); + + return Call(ToType(resolverInstance, iResolverType), iResolverType.GetDeclaredMethod("Convert"), + ToType(sourceMember, iResolverTypeArgs[0]), Context); + + AutoMapperConfigurationException BuildExceptionMessage() + => new AutoMapperConfigurationException($"Cannot find a source member to pass to the value converter of type {valueConverterConfig.ConcreteType.FullName}. Configure a source member to map from."); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/Execution/ValueTypeFieldAccessor.cs b/src/AutoMapper/Execution/ValueTypeFieldAccessor.cs deleted file mode 100644 index 81ca550bc4..0000000000 --- a/src/AutoMapper/Execution/ValueTypeFieldAccessor.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace AutoMapper.Execution -{ - using System.Reflection; - - public class ValueTypeFieldAccessor : FieldGetter, IMemberAccessor - { - private readonly FieldInfo _lateBoundFieldSet; - - public ValueTypeFieldAccessor(FieldInfo fieldInfo) - : base(fieldInfo) - { - _lateBoundFieldSet = fieldInfo; - } - - public void SetValue(object destination, object value) - { - _lateBoundFieldSet.SetValue(destination, value); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Execution/ValueTypePropertyAccessor.cs b/src/AutoMapper/Execution/ValueTypePropertyAccessor.cs deleted file mode 100644 index eb060205bb..0000000000 --- a/src/AutoMapper/Execution/ValueTypePropertyAccessor.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace AutoMapper.Execution -{ - using System.Reflection; - - public class ValueTypePropertyAccessor : PropertyGetter, IMemberAccessor - { - private readonly MethodInfo _lateBoundPropertySet; - - public ValueTypePropertyAccessor(PropertyInfo propertyInfo) - : base(propertyInfo) - { - var method = propertyInfo.GetSetMethod(true); - HasSetter = method != null; - if (HasSetter) - { - _lateBoundPropertySet = method; - } - } - - public bool HasSetter { get; } - - public void SetValue(object destination, object value) - { - _lateBoundPropertySet.Invoke(destination, new[] {value}); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/ExpressionExtensions.cs b/src/AutoMapper/ExpressionExtensions.cs index c3406fbea0..7623dcb95f 100644 --- a/src/AutoMapper/ExpressionExtensions.cs +++ b/src/AutoMapper/ExpressionExtensions.cs @@ -1,153 +1,69 @@ -namespace AutoMapper +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; + +namespace AutoMapper { - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Execution; - using static System.Linq.Expressions.Expression; + using static Expression; internal static class ExpressionExtensions { - public static Expression ToObject(Expression expression) + public static Expression MemberAccesses(this IEnumerable members, Expression obj) => + members + .Aggregate( + obj, + (inner, getter) => getter is MethodInfo method ? + (getter.IsStatic() ? Call(null, method, inner) : (Expression)Call(inner, method)) : + MakeMemberAccess(getter.IsStatic() ? null : inner, getter)); + + public static IEnumerable GetMembers(this Expression expression) { - return expression.Type == typeof(object) ? expression : Convert(expression, typeof(object)); - } - - public static Expression ToType(Expression expression, Type type) - { - return expression.Type == type ? expression : Convert(expression, type); - } - - public static Expression ConsoleWriteLine(string value, params Expression[] values) - { - return Call(typeof (Debug).GetMethod("WriteLine", new[] {typeof (string), typeof(object[])}), - Constant(value), - NewArrayInit(typeof(object), values.Select(ToObject).ToArray())); - } - - private static readonly ExpressionVisitor IfNullVisitor = new IfNotNullVisitor(); - - public static Expression ReplaceParameters(this LambdaExpression exp, params Expression[] replace) - { - var replaceExp = exp.Body; - for (var i = 0; i < Math.Min(replace.Count(), exp.Parameters.Count()); i++) - replaceExp = replaceExp.Replace(exp.Parameters[i], replace[i]); - return replaceExp; - } - - public static Expression ConvertReplaceParameters(this LambdaExpression exp, params ParameterExpression[] replace) - { - var replaceExp = exp.Body; - for (var i = 0; i < Math.Min(replace.Count(), exp.Parameters.Count()); i++) - replaceExp = new ConvertingVisitor(exp.Parameters[i], replace[i]).Visit(replaceExp); - return replaceExp; - } - - public static Expression Replace(this Expression exp, Expression old, Expression replace) => new ReplaceExpressionVisitor(old, replace).Visit(exp); - - public static LambdaExpression Concat(this LambdaExpression expr, LambdaExpression concat) => (LambdaExpression)new ExpressionConcatVisitor(expr).Visit(concat); - - public static Expression IfNotNull(this Expression expression) => IfNullVisitor.Visit(expression); - - public static Expression IfNullElse(this Expression expression, params Expression[] ifElse) - { - return ifElse.Any() - ? Condition(NotEqual(expression, Default(expression.Type)), expression, ifElse.First().IfNullElse(ifElse.Skip(1).ToArray())) - : expression; - } - - internal class IfNotNullVisitor : ExpressionVisitor - { - private readonly IList AllreadyUpdated = new List(); - protected override Expression VisitMember(MemberExpression node) + var memberExpression = expression as MemberExpression; + if(memberExpression == null) { - if (AllreadyUpdated.Contains(node)) - return base.VisitMember(node); - AllreadyUpdated.Add(node); - return Visit(DelegateFactory.IfNotNullExpression(node)); + return new MemberExpression[0]; } + return memberExpression.GetMembers(); } - internal class ConvertingVisitor : ExpressionVisitor + public static IEnumerable GetMembers(this MemberExpression expression) { - private readonly ParameterExpression _newParam; - private readonly ParameterExpression _oldParam; - - public ConvertingVisitor(ParameterExpression oldParam, ParameterExpression newParam) + while(expression != null) { - _newParam = newParam; - _oldParam = oldParam; - } - - protected override Expression VisitMember(MemberExpression node) - { - return node.Expression == _oldParam - ? MakeMemberAccess(Convert(_newParam, _oldParam.Type), node.Member) - : base.VisitMember(node); - } - - protected override Expression VisitParameter(ParameterExpression node) - { - return node == _oldParam ? _newParam : base.VisitParameter(node); - } - - protected override Expression VisitMethodCall(MethodCallExpression node) - { - return node.Object == _oldParam - ? Call(Convert(_newParam, _oldParam.Type), node.Method) - : base.VisitMethodCall(node); + yield return expression; + expression = expression.Expression as MemberExpression; } } - internal class ReplaceExpressionVisitor : ExpressionVisitor + public static void EnsureMemberPath(this LambdaExpression exp, string name) { - private readonly Expression _oldExpression; - private readonly Expression _newExpression; - - public ReplaceExpressionVisitor(Expression oldExpression, Expression newExpression) + if(!exp.IsMemberPath()) { - _oldExpression = oldExpression; - _newExpression = newExpression; - } - - public override Expression Visit(Expression node) - { - return _oldExpression == node ? _newExpression : base.Visit(node); + throw new ArgumentOutOfRangeException(name, "Only member accesses are allowed. "+exp); } } - internal class ExpressionConcatVisitor : ExpressionVisitor - { - private readonly LambdaExpression _overrideExpression; + public static bool IsMemberPath(this LambdaExpression exp) => exp.Body.GetMembers().LastOrDefault()?.Expression == exp.Parameters.First(); - public ExpressionConcatVisitor(LambdaExpression overrideExpression) - { - _overrideExpression = overrideExpression; - } + public static Expression ReplaceParameters(this LambdaExpression exp, params Expression[] replace) + => ExpressionFactory.ReplaceParameters(exp, replace); - public override Expression Visit(Expression node) - { - if (_overrideExpression == null) - return node; - if (node.NodeType != ExpressionType.Lambda && node.NodeType != ExpressionType.Parameter) - { - var expression = node; - if (node.Type == typeof(object)) - expression = Convert(node, _overrideExpression.Parameters[0].Type); + public static Expression ConvertReplaceParameters(this LambdaExpression exp, params Expression[] replace) + => ExpressionFactory.ConvertReplaceParameters(exp, replace); - return _overrideExpression.ReplaceParameters(expression); - } - return base.Visit(node); - } + public static Expression Replace(this Expression exp, Expression old, Expression replace) + => ExpressionFactory.Replace(exp, old, replace); - protected override Expression VisitLambda(Expression node) - { - return Lambda(Visit(node.Body), node.Parameters); - } - } + public static LambdaExpression Concat(this LambdaExpression expr, LambdaExpression concat) + => ExpressionFactory.Concat(expr, concat); + + public static Expression NullCheck(this Expression expression, Type destinationType) + => ExpressionFactory.NullCheck(expression, destinationType); + public static Expression IfNullElse(this Expression expression, Expression then, Expression @else = null) + => ExpressionFactory.IfNullElse(expression, then, @else); } } \ No newline at end of file diff --git a/src/AutoMapper/Features/FeatureExtensions.cs b/src/AutoMapper/Features/FeatureExtensions.cs new file mode 100644 index 0000000000..5af0dabf63 --- /dev/null +++ b/src/AutoMapper/Features/FeatureExtensions.cs @@ -0,0 +1,38 @@ +using AutoMapper.Configuration; + +namespace AutoMapper.Features +{ + public static class FeatureExtensions + { + public static IMapperConfigurationExpression SetFeature(this IMapperConfigurationExpression configuration, IGlobalFeature feature) + { + configuration.Features.Set(feature); + return configuration; + } + + public static IMappingExpression SetFeature(this IMappingExpression mapping, IMappingFeature feature) + { + mapping.Features.Set(feature); + return mapping; + } + + internal static void Configure(this Features features, MapperConfiguration mapperConfiguration) => features.ForAll(feature => feature.Configure(mapperConfiguration)); + + public static void ReverseTo(this Features features, Features reversedFeatures) => features.ForAll(feature => + { + var reverse = feature.Reverse(); + if (reverse != null) + { + reversedFeatures.Set(reverse); + } + }); + + internal static void Configure(this Features features, TypeMap typeMap) => features.ForAll(feature => feature.Configure(typeMap)); + + internal static void Seal(this Features features, IConfigurationProvider configurationProvider) + { + features.ForAll(feature => feature.Seal(configurationProvider)); + features.MakeReadOnly(); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Features/Features.cs b/src/AutoMapper/Features/Features.cs new file mode 100644 index 0000000000..b422e10a78 --- /dev/null +++ b/src/AutoMapper/Features/Features.cs @@ -0,0 +1,32 @@ +using AutoMapper.Configuration; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace AutoMapper.Features +{ + public class Features : IEnumerable + { + private IDictionary _features = new Dictionary(); + + /// + /// Gets the feature of type . + /// + /// The type of the feature. + /// The feature or null if feature not exists. + public TFeatureToFind Get() where TFeatureToFind : TFeature => (TFeatureToFind)_features.GetOrDefault(typeof(TFeatureToFind)); + + /// + /// Add or update the feature. Existing feature of the same type will be replaced. + /// + /// The feature. + public void Set(TFeature feature) => _features[feature.GetType()] = feature; + + public IEnumerator GetEnumerator() => _features.Values.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + internal void MakeReadOnly() => _features = new ReadOnlyDictionary(_features); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Features/IGlobalFeature.cs b/src/AutoMapper/Features/IGlobalFeature.cs new file mode 100644 index 0000000000..3c9e4ab8ff --- /dev/null +++ b/src/AutoMapper/Features/IGlobalFeature.cs @@ -0,0 +1,7 @@ +namespace AutoMapper.Features +{ + public interface IGlobalFeature + { + void Configure(IConfigurationProvider configurationProvider); + } +} diff --git a/src/AutoMapper/Features/IMappingFeature.cs b/src/AutoMapper/Features/IMappingFeature.cs new file mode 100644 index 0000000000..56b19c578c --- /dev/null +++ b/src/AutoMapper/Features/IMappingFeature.cs @@ -0,0 +1,8 @@ +namespace AutoMapper.Features +{ + public interface IMappingFeature + { + void Configure(TypeMap typeMap); + IMappingFeature Reverse(); + } +} diff --git a/src/AutoMapper/Features/IRuntimeFeature.cs b/src/AutoMapper/Features/IRuntimeFeature.cs new file mode 100644 index 0000000000..36dd09e994 --- /dev/null +++ b/src/AutoMapper/Features/IRuntimeFeature.cs @@ -0,0 +1,7 @@ +namespace AutoMapper.Features +{ + public interface IRuntimeFeature + { + void Seal(IConfigurationProvider configurationProvider); + } +} \ No newline at end of file diff --git a/src/AutoMapper/IConfiguration.cs b/src/AutoMapper/IConfiguration.cs deleted file mode 100644 index 3e12761a51..0000000000 --- a/src/AutoMapper/IConfiguration.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - - public interface IMapperConfigurationExpression : IProfileExpression, IConfiguration - { - Func ServiceCtor { get; } - IEnumerable Profiles { get; } - IEnumerable> AllTypeMapActions { get; } - } - - public interface IConfiguration - { - /// - /// Create missing type maps during mapping, if necessary - /// - bool CreateMissingTypeMaps { get; set; } - - /// - /// Add an existing profile - /// - /// Profile to add - void AddProfile(Profile profile); - - /// - /// Add an existing profile type. Profile will be instantiated and added to the configuration. - /// - /// Profile type - void AddProfile() where TProfile : Profile, new(); - - /// - /// Add an existing profile type. Profile will be instantiated and added to the configuration. - /// - /// Profile type - void AddProfile(Type profileType); - - /// - /// Supply a factory method callback for creating resolvers and type converters - /// - /// Factory method - void ConstructServicesUsing(Func constructor); - - /// - /// Create a named profile with the supplied configuration - /// - /// Profile name, must be unique - /// Profile configuration - void CreateProfile(string profileName, Action config); - } -} \ No newline at end of file diff --git a/src/AutoMapper/IConfigurationProvider.cs b/src/AutoMapper/IConfigurationProvider.cs index 5b8edda03b..50ce38afca 100644 --- a/src/AutoMapper/IConfigurationProvider.cs +++ b/src/AutoMapper/IConfigurationProvider.cs @@ -1,13 +1,16 @@ +using System; using System.Collections.Generic; -using AutoMapper.Mappers; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Features; +using AutoMapper.QueryableExtensions; namespace AutoMapper { - using System; - using QueryableExtensions; - public interface IConfigurationProvider { + void Validate(ValidationContext context); + /// /// Get all configured type maps created /// @@ -38,22 +41,29 @@ public interface IConfigurationProvider TypeMap FindTypeMapFor(); /// - /// Find the for the configured source and destination type, checking the source/destination object types too + /// Resolve the for the configured source and destination type, checking parent types /// - /// Source object - /// Destination object /// Configured source type /// Configured destination type /// Type map configuration - TypeMap ResolveTypeMap(object source, object destination, Type sourceType, Type destinationType); + TypeMap ResolveTypeMap(Type sourceType, Type destinationType); /// /// Resolve the for the configured source and destination type, checking parent types /// /// Configured source type /// Configured destination type + /// Inline type map configuration if exists /// Type map configuration - TypeMap ResolveTypeMap(Type sourceType, Type destinationType); + TypeMap ResolveTypeMap(Type sourceType, Type destinationType, ITypeMapConfiguration inlineConfiguration); + + /// + /// Resolve the for the configured type pair, checking parent types + /// + /// Type pair + /// Inline type map configuration if exists + /// Type map configuration + TypeMap ResolveTypeMap(TypePair typePair, ITypeMapConfiguration inlineConfiguration); /// /// Resolve the for the configured type pair, checking parent types @@ -92,26 +102,84 @@ public interface IConfigurationProvider IEnumerable GetMappers(); /// - /// Factory method to create formatters, resolvers and type converters + /// Gets the features collection. /// - Func ServiceCtor { get; } + /// The feature colection. + Features Features { get; } + + /// + /// Find a matching object mapper. + /// + /// the types to match + /// the matching mapper or null + IObjectMapper FindMapper(TypePair types); /// - /// Allow null destination values. If false, destination objects will be created for deep object graphs. + /// Factory method to create formatters, resolvers and type converters /// - bool AllowNullDestinationValues { get; } + Func ServiceCtor { get; } /// - /// Allow null destination collections. If true, null source collections result in null destination collections. + /// Allows to enable null-value propagation for query mapping. + /// Some providers (such as EntityFrameworkQueryVisitor) do not work with this feature enabled! /// - bool AllowNullCollections { get; } + bool EnableNullPropagationForQueryMapping { get; } + + int MaxExecutionPlanDepth { get; } IExpressionBuilder ExpressionBuilder { get; } + + IEnumerable ResultConverters { get; } + + IEnumerable Binders { get; } + + /// + /// Create a mapper instance based on this configuration. Mapper instances are lightweight and can be created as needed. + /// + /// The mapper instance IMapper CreateMapper(); + + /// + /// Create a mapper instance with the specified service constructor to be used for resolvers and type converters. + /// + /// Service factory to create services + /// The mapper instance IMapper CreateMapper(Func serviceCtor); - Func GetMapperFunc(TypePair types); + + Func GetMapperFunc(TypePair types, IMemberMap memberMap = null); + Func GetMapperFunc(MapRequest mapRequest); + + /// + /// Compile all underlying mapping expressions to cached delegates. + /// Use if you want AutoMapper to compile all mappings up front instead of deferring expression compilation for each first map. + /// + void CompileMappings(); + Delegate GetMapperFunc(MapRequest request); Func GetUntypedMapperFunc(MapRequest mapRequest); + + void RegisterTypeMap(TypeMap typeMap); + + IEnumerable GetIncludedTypeMaps(IEnumerable includedTypes); + + /// + /// Builds the execution plan used to map the source to destination. + /// Useful to understand what exactly is happening during mapping. + /// See the wiki for details. + /// + /// the runtime type of the source object + /// the runtime type of the destination object + /// the execution plan + LambdaExpression BuildExecutionPlan(Type sourceType, Type destinationType); + + /// + /// Builds the execution plan used to map the source to destination. + /// Useful to understand what exactly is happening during mapping. + /// See the wiki for details. + /// + /// The source/destination map request + /// the execution plan + LambdaExpression BuildExecutionPlan(MapRequest mapRequest); } -} \ No newline at end of file +} diff --git a/src/AutoMapper/ICtorParamConfigurationExpression.cs b/src/AutoMapper/ICtorParamConfigurationExpression.cs index 68f8a8c2f4..2fb764b260 100644 --- a/src/AutoMapper/ICtorParamConfigurationExpression.cs +++ b/src/AutoMapper/ICtorParamConfigurationExpression.cs @@ -1,60 +1,22 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - using System.Linq; - using Execution; - - public interface ICtorParamConfigurationExpression - { - /// - /// Map constructor parameter from member expression - /// - /// Member type - /// Member expression - void MapFrom(Expression> sourceMember); - - /// - /// Map constructor parameter from custom func - /// - /// Custom func - void ResolveUsing(Func resolver); - } - - public class CtorParamConfigurationExpression : ICtorParamConfigurationExpression - { - private readonly string _ctorParamName; - private readonly List> _ctorParamActions = new List>(); - - public CtorParamConfigurationExpression(string ctorParamName) - { - _ctorParamName = ctorParamName; - } - - public void MapFrom(Expression> sourceMember) - { - _ctorParamActions.Add(cpm => cpm.CustomExpression = sourceMember); - } - - public void ResolveUsing(Func resolver) - { - _ctorParamActions.Add(cpm => cpm.CustomValueResolver = (src, ctxt) => resolver((TSource)src)); - } - - public void Configure(TypeMap typeMap) - { - var parameter = typeMap.ConstructorMap.CtorParams.Single(p => p.Parameter.Name == _ctorParamName); - if(parameter == null) - { - throw new ArgumentOutOfRangeException(nameof(typeMap), $"There is no constructor parameter named {_ctorParamName}"); - } - parameter.CanResolve = true; - - foreach (var action in _ctorParamActions) - { - action(parameter); - } - } - } +using System; +using System.Linq.Expressions; + +namespace AutoMapper +{ + public interface ICtorParamConfigurationExpression + { + /// + /// Map constructor parameter from member expression + /// + /// Member type + /// Member expression + void MapFrom(Expression> sourceMember); + + /// + /// Map constructor parameter from custom func that has access to + /// + /// Not used for LINQ projection (ProjectTo) + /// Custom func + void MapFrom(Func resolver); + } } \ No newline at end of file diff --git a/src/AutoMapper/IMapper.cs b/src/AutoMapper/IMapper.cs index 1d2cea82fc..770cd39930 100644 --- a/src/AutoMapper/IMapper.cs +++ b/src/AutoMapper/IMapper.cs @@ -1,130 +1,150 @@ -namespace AutoMapper -{ - using System; - - public interface IMapper - { - /// - /// Execute a mapping from the source object to a new destination object. - /// The source type is inferred from the source object. - /// - /// Destination type to create - /// Source object to map from - /// Mapped destination object - TDestination Map(object source); - - /// - /// Execute a mapping from the source object to a new destination object with supplied mapping options. - /// - /// Destination type to create - /// Source object to map from - /// Mapping options - /// Mapped destination object - TDestination Map(object source, Action opts); - - /// - /// Execute a mapping from the source object to a new destination object. - /// - /// Source type to use, regardless of the runtime type - /// Destination type to create - /// Source object to map from - /// Mapped destination object - TDestination Map(TSource source); - - /// - /// Execute a mapping from the source object to a new destination object with supplied mapping options. - /// - /// Source type to use - /// Destination type to create - /// Source object to map from - /// Mapping options - /// Mapped destination object - TDestination Map(TSource source, - Action> opts); - - /// - /// Execute a mapping from the source object to the existing destination object. - /// - /// Source type to use - /// Dsetination type - /// Source object to map from - /// Destination object to map into - /// The mapped destination object, same instance as the object - TDestination Map(TSource source, TDestination destination); - - /// - /// Execute a mapping from the source object to the existing destination object with supplied mapping options. - /// - /// Source type to use - /// Destination type - /// Source object to map from - /// Destination object to map into - /// Mapping options - /// The mapped destination object, same instance as the object - TDestination Map(TSource source, TDestination destination, - Action> opts); - - /// - /// Execute a mapping from the source object to a new destination object with explicit objects - /// - /// Source object to map from - /// Source type to use - /// Destination type to create - /// Mapped destination object - object Map(object source, Type sourceType, Type destinationType); - - /// - /// Execute a mapping from the source object to a new destination object with explicit objects and supplied mapping options. - /// - /// Source object to map from - /// Source type to use - /// Destination type to create - /// Mapping options - /// Mapped destination object - object Map(object source, Type sourceType, Type destinationType, Action opts); - - /// - /// Execute a mapping from the source object to existing destination object with explicit objects - /// - /// Source object to map from - /// Destination object to map into - /// Source type to use - /// Destination type to use - /// Mapped destination object, same instance as the object - object Map(object source, object destination, Type sourceType, Type destinationType); - - /// - /// Execute a mapping from the source object to existing destination object with supplied mapping options and explicit objects - /// - /// Source object to map from - /// Destination object to map into - /// Source type to use - /// Destination type to use - /// Mapping options - /// Mapped destination object, same instance as the object - object Map(object source, object destination, Type sourceType, Type destinationType, - Action opts); - - - /// - /// Configuration provider for performing maps - /// - IConfigurationProvider ConfigurationProvider { get; } - - /// - /// Factory method for creating runtime instances of converters, resolvers etc. - /// - Func ServiceCtor { get; } - } - - public interface IRuntimeMapper : IMapper - { - object Map(ResolutionContext context); - object Map(object source, object destination, Type sourceType, Type destinationType, ResolutionContext parent); - TDestination Map(TSource source, TDestination destination, ResolutionContext parent); - bool ShouldMapSourceValueAsNull(ResolutionContext context); - bool ShouldMapSourceCollectionAsNull(ResolutionContext context); - object CreateObject(ResolutionContext context); - TDestination CreateObject(ResolutionContext context); - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; + +namespace AutoMapper +{ + public interface IMapper + { + /// + /// Execute a mapping from the source object to a new destination object. + /// The source type is inferred from the source object. + /// + /// Destination type to create + /// Source object to map from + /// Mapped destination object + TDestination Map(object source); + + /// + /// Execute a mapping from the source object to a new destination object with supplied mapping options. + /// + /// Destination type to create + /// Source object to map from + /// Mapping options + /// Mapped destination object + TDestination Map(object source, Action opts); + + /// + /// Execute a mapping from the source object to a new destination object. + /// + /// Source type to use, regardless of the runtime type + /// Destination type to create + /// Source object to map from + /// Mapped destination object + TDestination Map(TSource source); + + /// + /// Execute a mapping from the source object to a new destination object with supplied mapping options. + /// + /// Source type to use + /// Destination type to create + /// Source object to map from + /// Mapping options + /// Mapped destination object + TDestination Map(TSource source, + Action> opts); + + /// + /// Execute a mapping from the source object to the existing destination object. + /// + /// Source type to use + /// Destination type + /// Source object to map from + /// Destination object to map into + /// The mapped destination object, same instance as the object + TDestination Map(TSource source, TDestination destination); + + /// + /// Execute a mapping from the source object to the existing destination object with supplied mapping options. + /// + /// Source type to use + /// Destination type + /// Source object to map from + /// Destination object to map into + /// Mapping options + /// The mapped destination object, same instance as the object + TDestination Map(TSource source, TDestination destination, + Action> opts); + + /// + /// Execute a mapping from the source object to a new destination object with explicit objects + /// + /// Source object to map from + /// Source type to use + /// Destination type to create + /// Mapped destination object + object Map(object source, Type sourceType, Type destinationType); + + /// + /// Execute a mapping from the source object to a new destination object with explicit objects and supplied mapping options. + /// + /// Source object to map from + /// Source type to use + /// Destination type to create + /// Mapping options + /// Mapped destination object + object Map(object source, Type sourceType, Type destinationType, Action opts); + + /// + /// Execute a mapping from the source object to existing destination object with explicit objects + /// + /// Source object to map from + /// Destination object to map into + /// Source type to use + /// Destination type to use + /// Mapped destination object, same instance as the object + object Map(object source, object destination, Type sourceType, Type destinationType); + + /// + /// Execute a mapping from the source object to existing destination object with supplied mapping options and explicit objects + /// + /// Source object to map from + /// Destination object to map into + /// Source type to use + /// Destination type to use + /// Mapping options + /// Mapped destination object, same instance as the object + object Map(object source, object destination, Type sourceType, Type destinationType, + Action opts); + + + /// + /// Configuration provider for performing maps + /// + IConfigurationProvider ConfigurationProvider { get; } + + /// + /// Factory method for creating runtime instances of converters, resolvers etc. + /// + Func ServiceCtor { get; } + + /// + /// Project the input queryable. + /// + /// Projections are only calculated once and cached + /// Destination type + /// Queryable source + /// Optional parameter object for parameterized mapping expressions + /// Explicit members to expand + /// Queryable result, use queryable extension methods to project and execute result + IQueryable ProjectTo(IQueryable source, object parameters = null, params Expression>[] membersToExpand); + + /// + /// Project the input queryable. + /// + /// Destination type to map to + /// Queryable source + /// Optional parameter object for parameterized mapping expressions + /// Explicit members to expand + /// Queryable result, use queryable extension methods to project and execute result + IQueryable ProjectTo(IQueryable source, IDictionary parameters, params string[] membersToExpand); + } + + public interface IRuntimeMapper : IMapper + { + ResolutionContext DefaultContext { get; } + object Map(object source, object destination, Type sourceType, Type destinationType, ResolutionContext context, IMemberMap memberMap = null); + TDestination Map(TSource source, TDestination destination, ResolutionContext context, IMemberMap memberMap = null); + } } \ No newline at end of file diff --git a/src/AutoMapper/IMapperConfigurationExpression.cs b/src/AutoMapper/IMapperConfigurationExpression.cs new file mode 100644 index 0000000000..f365a4f362 --- /dev/null +++ b/src/AutoMapper/IMapperConfigurationExpression.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Features; + +namespace AutoMapper +{ + public interface IMapperConfigurationExpression : IProfileExpression + { + /// + /// Create missing type maps during mapping, if necessary + /// + bool? CreateMissingTypeMaps { get; set; } + + /// + /// Add an existing profile + /// + /// Profile to add + void AddProfile(Profile profile); + + /// + /// Add an existing profile type. Profile will be instantiated and added to the configuration. + /// + /// Profile type + void AddProfile() where TProfile : Profile, new(); + + /// + /// Add an existing profile type. Profile will be instantiated and added to the configuration. + /// + /// Profile type + void AddProfile(Type profileType); + + /// + /// Add profiles contained in assemblies + /// + /// Assemblies containing profiles + [Obsolete("Use AddMaps instead. Will be removed in 9.0")] + void AddProfiles(IEnumerable assembliesToScan); + + /// + /// Add profiles contained in assemblies + /// + /// Assemblies containing profiles + [Obsolete("Use AddMaps instead. Will be removed in 9.0")] + void AddProfiles(params Assembly[] assembliesToScan); + + /// + /// Add profiles contained in assemblies + /// + /// Assembly names to load and scan containing profiles + void AddProfiles(IEnumerable assemblyNamesToScan); + + /// + /// Add profiles contained in assemblies + /// + /// Assembly names to load and scan containing profiles + [Obsolete("Use AddMaps instead. Will be removed in 9.0")] + void AddProfiles(params string[] assemblyNamesToScan); + + /// + /// Add profiles contained in assemblies + /// + /// Types from assemblies containing profiles + [Obsolete("Use AddMaps instead. Will be removed in 9.0")] + void AddProfiles(IEnumerable typesFromAssembliesContainingProfiles); + + /// + /// Add profiles contained in assemblies + /// + /// Types from assemblies containing profiles + [Obsolete("Use AddMaps instead. Will be removed in 9.0")] + void AddProfiles(params Type[] typesFromAssembliesContainingProfiles); + + /// + /// Add profiles contained in an IEnumerable + /// + /// IEnumerable of Profile + void AddProfiles(IEnumerable enumerableOfProfiles); + + /// + /// Add mapping definitions contained in assemblies. + /// Looks for definitions and classes decorated with + /// + /// Assemblies containing mapping definitions + void AddMaps(IEnumerable assembliesToScan); + + /// + /// Add mapping definitions contained in assemblies. + /// Looks for definitions and classes decorated with + /// + /// Assemblies containing mapping definitions + void AddMaps(params Assembly[] assembliesToScan); + + /// + /// Add mapping definitions contained in assemblies. + /// Looks for definitions and classes decorated with + /// + /// Assembly names to load and scan containing mapping definitions + void AddMaps(IEnumerable assemblyNamesToScan); + + /// + /// Add mapping definitions contained in assemblies. + /// Looks for definitions and classes decorated with + /// + /// Assembly names to load and scan containing mapping definitions + void AddMaps(params string[] assemblyNamesToScan); + + /// + /// Add mapping definitions contained in assemblies. + /// Looks for definitions and classes decorated with + /// + /// Types from assemblies containing mapping definitions + void AddMaps(IEnumerable typesFromAssembliesContainingMappingDefinitions); + + /// + /// Add mapping definitions contained in assemblies. + /// Looks for definitions and classes decorated with + /// + /// Types from assemblies containing mapping definitions + void AddMaps(params Type[] typesFromAssembliesContainingMappingDefinitions); + + /// + /// Supply a factory method callback for creating resolvers and type converters + /// + /// Factory method + void ConstructServicesUsing(Func constructor); + + /// + /// Create a named profile with the supplied configuration + /// + /// Profile name, must be unique + /// Profile configuration + void CreateProfile(string profileName, Action config); + + /// + /// Get the features collection. + /// + Features Features { get; } + + /// + /// Object mappers + /// + IList Mappers { get; } + + /// + /// Advance Configuration + /// + AdvancedConfiguration Advanced { get; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/IMappingAction.cs b/src/AutoMapper/IMappingAction.cs index c8a9fefa52..6d0c76f634 100644 --- a/src/AutoMapper/IMappingAction.cs +++ b/src/AutoMapper/IMappingAction.cs @@ -5,7 +5,7 @@ namespace AutoMapper /// /// Source type /// Destination type - public interface IMappingAction + public interface IMappingAction { /// /// Implementors can modify both the source and destination objects diff --git a/src/AutoMapper/IMappingExpression.cs b/src/AutoMapper/IMappingExpression.cs index 1b07f43fcf..1f7a9d7074 100644 --- a/src/AutoMapper/IMappingExpression.cs +++ b/src/AutoMapper/IMappingExpression.cs @@ -1,423 +1,147 @@ -namespace AutoMapper -{ - using System; - using System.ComponentModel; - using System.Linq.Expressions; - - /// - /// Mapping configuration options for non-generic maps - /// - public interface IMappingExpression - { - /// - /// Preserve object identity. Useful for circular references. - /// - /// - IMappingExpression PreserveReferences(); - - /// - /// Customize configuration for individual constructor parameter - /// - /// Constructor parameter name - /// Options - /// Itself - IMappingExpression ForCtorParam(string ctorParamName, Action> paramOptions); - - /// - /// Create a type mapping from the destination to the source type, using the destination members as validation. - /// - /// Itself - IMappingExpression ReverseMap(); - - /// - /// Replace the original runtime instance with a new source instance. Useful when ORMs return proxy types with no relationships to runtime types. - /// The returned source object will be mapped instead of what was supplied in the original source object. - /// - /// Substitution function - /// New source object to map. - IMappingExpression Substitute(Func substituteFunc); - - /// - /// Construct the destination object using the service locator - /// - /// Itself - IMappingExpression ConstructUsingServiceLocator(); - - /// - /// For self-referential types, limit recurse depth. - /// Enables PreserveReferences. - /// - /// Number of levels to limit to - /// Itself - IMappingExpression MaxDepth(int depth); - - /// - /// Supply a custom instantiation expression for the destination type for LINQ projection - /// - /// Callback to create the destination type given the source object - /// Itself - IMappingExpression ConstructProjectionUsing(LambdaExpression ctor); - - /// - /// Supply a custom instantiation function for the destination type, based on the entire resolution context - /// - /// Callback to create the destination type given the source object and current resolution context - /// Itself - IMappingExpression ConstructUsing(Func ctor); - - /// - /// Supply a custom instantiation function for the destination type - /// - /// Callback to create the destination type given the source object - /// Itself - IMappingExpression ConstructUsing(Func ctor); - - /// - /// Skip member mapping and use a custom expression during LINQ projection - /// - /// Projection expression - void ProjectUsing(Expression> projectionExpression); - - /// - /// Customize configuration for all members - /// - /// Callback for member options - void ForAllMembers(Action memberOptions); - - /// - /// Customize configuration for members not previously configured - /// - /// Callback for member options - void ForAllOtherMembers(Action memberOptions); - - /// - /// Customize configuration for an individual source member - /// - /// Source member name - /// Callback for member configuration options - /// Itself - IMappingExpression ForSourceMember(string sourceMemberName, Action memberOptions); - - /// - /// Skip normal member mapping and convert using a instantiated during mapping - /// - /// Type converter type - void ConvertUsing(); - - /// - /// Skip normal member mapping and convert using a instantiated during mapping - /// Use this method if you need to specify the converter type at runtime - /// - /// Type converter type - void ConvertUsing(Type typeConverterType); - - /// - /// Override the destination type mapping for looking up configuration and instantiation - /// - /// - void As(Type typeOverride); - - /// - /// Customize individual members - /// - /// Name of the member - /// Callback for configuring member - /// Itself - IMappingExpression ForMember(string name, Action memberOptions); - - /// - /// Include this configuration in derived types' maps - /// - /// Derived source type - /// Derived destination type - /// Itself - IMappingExpression Include(Type derivedSourceType, Type derivedDestinationType); - - /// - /// Ignores all destination properties that have either a private or protected setter, forcing the mapper to respect encapsulation (note: order matters, so place this before explicit configuration of any properties with an inaccessible setter) - /// - /// Itself - IMappingExpression IgnoreAllPropertiesWithAnInaccessibleSetter(); - - /// - /// When using ReverseMap, ignores all source properties that have either a private or protected setter, keeping the reverse mapping consistent with the forward mapping (note: destination properties with an inaccessible setter may still be mapped unless IgnoreAllPropertiesWithAnInaccessibleSetter is also used) - /// - /// Itself - IMappingExpression IgnoreAllSourcePropertiesWithAnInaccessibleSetter(); - - /// - /// Include the base type map's configuration in this map - /// - /// Base source type - /// Base destination type - /// - IMappingExpression IncludeBase(Type sourceBase, Type destinationBase); - - /// - /// Execute a custom function to the source and/or destination types before member mapping - /// - /// Callback for the source/destination types - /// Itself - IMappingExpression BeforeMap(Action beforeFunction); - - /// - /// Execute a custom mapping action before member mapping - /// - /// Mapping action type instantiated during mapping - /// Itself - IMappingExpression BeforeMap() - where TMappingAction : IMappingAction; - - /// - /// Execute a custom function to the source and/or destination types after member mapping - /// - /// Callback for the source/destination types - /// Itself - IMappingExpression AfterMap(Action afterFunction); - - /// - /// Execute a custom mapping action after member mapping - /// - /// Mapping action type instantiated during mapping - /// Itself - IMappingExpression AfterMap() - where TMappingAction : IMappingAction; - } - - /// - /// Mapping configuration options - /// - /// Source type - /// Destination type - public interface IMappingExpression - { - /// - /// Preserve object identity. Useful for circular references. - /// - /// - IMappingExpression PreserveReferences(); - - /// - /// Customize configuration for members not previously configured - /// - /// Callback for member options - void ForAllOtherMembers(Action> memberOptions); - - /// - /// Customize configuration for individual member - /// - /// Expression to the top-level destination member. This must be a member on the TDestination type - /// Callback for member options - /// Itself - IMappingExpression ForMember(Expression> destinationMember, - Action> memberOptions); - - /// - /// Customize configuration for individual member. Used when the name isn't known at compile-time - /// - /// Destination member name - /// Callback for member options - /// - IMappingExpression ForMember(string name, - Action> memberOptions); - - /// - /// Customize configuration for all members - /// - /// Callback for member options - void ForAllMembers(Action> memberOptions); - - /// - /// Ignores all properties that have either a private or protected setter, forcing the mapper to respect encapsulation (note: order matters, so place this before explicit configuration of any properties with an inaccessible setter) - /// - /// Itself - IMappingExpression IgnoreAllPropertiesWithAnInaccessibleSetter(); - - /// - /// When using ReverseMap, ignores all properties that have either a private or protected setter, keeping the reverse mapping consistent with the forward mapping (note: properties with an inaccessible setter may still be mapped unless IgnoreAllPropertiesWithAnInaccessibleSetter is also used) - /// - /// Itself - IMappingExpression IgnoreAllSourcePropertiesWithAnInaccessibleSetter(); - - /// - /// Include this configuration in derived types' maps - /// - /// Derived source type - /// Derived destination type - /// Itself - IMappingExpression Include() - where TOtherSource : TSource - where TOtherDestination : TDestination; - - /// - /// Include the base type map's configuration in this map - /// - /// Base source type - /// Base destination type - /// Itself - IMappingExpression IncludeBase(); - - /// - /// Include this configuration in derived types' maps - /// - /// Derived source type - /// Derived destination type - /// Itself - IMappingExpression Include(Type derivedSourceType, Type derivedDestinationType); - - /// - /// Skip member mapping and use a custom expression during LINQ projection - /// - /// Projection expression - void ProjectUsing(Expression> projectionExpression); - - /// - /// Skip member mapping and use a custom function to convert to the destination type - /// - /// Callback to convert from source type to destination type - void ConvertUsing(Func mappingFunction); - - /// - /// Skip member mapping and use a custom function to convert to the destination type - /// - /// Callback to convert from source type to destination type - void ConvertUsing(Func mappingFunction); - - /// - /// Skip member mapping and use a custom type converter instance to convert to the destination type - /// - /// Type converter instance - void ConvertUsing(ITypeConverter converter); - - /// - /// Skip member mapping and use a custom type converter instance to convert to the destination type - /// - /// Type converter type - void ConvertUsing() where TTypeConverter : ITypeConverter; - - /// - /// Execute a custom function to the source and/or destination types before member mapping - /// - /// Callback for the source/destination types - /// Itself - IMappingExpression BeforeMap(Action beforeFunction); - - /// - /// Execute a custom function to the source and/or destination types before member mapping - /// - /// Callback for the source/destination types - /// Itself - IMappingExpression BeforeMap(Action beforeFunction); - - /// - /// Execute a custom mapping action before member mapping - /// - /// Mapping action type instantiated during mapping - /// Itself - IMappingExpression BeforeMap() - where TMappingAction : IMappingAction; - - /// - /// Execute a custom function to the source and/or destination types after member mapping - /// - /// Callback for the source/destination types - /// Itself - IMappingExpression AfterMap(Action afterFunction); - - /// - /// Execute a custom function to the source and/or destination types after member mapping - /// - /// Callback for the source/destination types - /// Itself - IMappingExpression AfterMap(Action afterFunction); - - /// - /// Execute a custom mapping action after member mapping - /// - /// Mapping action type instantiated during mapping - /// Itself - IMappingExpression AfterMap() - where TMappingAction : IMappingAction; - - /// - /// Supply a custom instantiation function for the destination type - /// - /// Callback to create the destination type given the source object - /// Itself - IMappingExpression ConstructUsing(Func ctor); - - /// - /// Supply a custom instantiation expression for the destination type for LINQ projection - /// - /// Callback to create the destination type given the source object - /// Itself - IMappingExpression ConstructProjectionUsing(Expression> ctor); - - /// - /// Supply a custom instantiation function for the destination type, based on the entire resolution context - /// - /// Callback to create the destination type given the current resolution context - /// Itself - IMappingExpression ConstructUsing(Func ctor); - - /// - /// Override the destination type mapping for looking up configuration and instantiation - /// - /// Destination type to use - void As(); - - /// - /// For self-referential types, limit recurse depth. - /// Enables PreserveReferences. - /// - /// Number of levels to limit to - /// Itself - IMappingExpression MaxDepth(int depth); - - /// - /// Construct the destination object using the service locator - /// - /// Itself - IMappingExpression ConstructUsingServiceLocator(); - - /// - /// Create a type mapping from the destination to the source type, using the members as validation - /// - /// Itself - IMappingExpression ReverseMap(); - - /// - /// Customize configuration for an individual source member - /// - /// Expression to source member. Must be a member of the type - /// Callback for member configuration options - /// Itself - IMappingExpression ForSourceMember(Expression> sourceMember, - Action memberOptions); - - /// - /// Customize configuration for an individual source member. Member name not known until runtime - /// - /// Expression to source member. Must be a member of the type - /// Callback for member configuration options - /// Itself - IMappingExpression ForSourceMember(string sourceMemberName, - Action memberOptions); - - /// - /// Replace the original runtime instance with a new source instance. Useful when ORMs return proxy types with no relationships to runtime types. - /// The returned source object will be mapped instead of what was supplied in the original source object. - /// - /// Substitution function - /// New source object to map. - IMappingExpression Substitute(Func substituteFunc); - - /// - /// Customize configuration for individual constructor parameter - /// - /// Constructor parameter name - /// Options - /// Itself - IMappingExpression ForCtorParam(string ctorParamName, Action> paramOptions); - } +using System; +using System.Linq.Expressions; + +namespace AutoMapper +{ + /// + /// Mapping configuration options for non-generic maps + /// + public interface IMappingExpression : IMappingExpressionBase + { + /// + /// Add extra configuration to the current map by also mapping the specified child objects to the destination object. + /// The maps from the child types to the destination need to be created explicitly. + /// + /// the names of child object properties to map to the destination + /// + IMappingExpression IncludeMembers(params string[] memberNames); + + /// + /// Create a type mapping from the destination to the source type, using the destination members as validation. + /// + /// Itself + IMappingExpression ReverseMap(); + + /// + /// Customize configuration for all members + /// + /// Callback for member options + void ForAllMembers(Action memberOptions); + + /// + /// Customize configuration for members not previously configured + /// + /// Callback for member options + void ForAllOtherMembers(Action memberOptions); + + /// + /// Customize individual members + /// + /// Name of the member + /// Callback for configuring member + /// Itself + IMappingExpression ForMember(string name, Action memberOptions); + } + + /// + /// Mapping configuration options + /// + /// Source type + /// Destination type + public interface IMappingExpression : IMappingExpressionBase> + { + /// + /// Add extra configuration to the current map by also mapping the specified child objects to the destination object. + /// The maps from the child types to the destination need to be created explicitly. + /// + /// the child objects to map to the destination + /// + IMappingExpression IncludeMembers(params Expression>[] memberExpressions); + + /// + /// Customize configuration for a path inside the destination object. + /// + /// Expression to the destination sub object + /// Callback for member options + /// Itself + IMappingExpression ForPath(Expression> destinationMember, + Action> memberOptions); + + /// + /// Customize configuration for members not previously configured + /// + /// Callback for member options + void ForAllOtherMembers(Action> memberOptions); + + /// + /// Customize configuration for individual member + /// + /// Expression to the top-level destination member. This must be a member on the TDestination type + /// Callback for member options + /// Itself + IMappingExpression ForMember(Expression> destinationMember, + Action> memberOptions); + + /// + /// Customize configuration for individual member. Used when the name isn't known at compile-time + /// + /// Destination member name + /// Callback for member options + /// Itself + IMappingExpression ForMember(string name, + Action> memberOptions); + + /// + /// Customize configuration for all members + /// + /// Callback for member options + void ForAllMembers(Action> memberOptions); + + /// + /// Include this configuration in derived types' maps + /// + /// Derived source type + /// Derived destination type + /// Itself + IMappingExpression Include() + where TOtherSource : TSource + where TOtherDestination : TDestination; + + /// + /// Include the base type map's configuration in this map + /// + /// Base source type + /// Base destination type + /// Itself + IMappingExpression IncludeBase(); + + /// + /// Override the destination type mapping for looking up configuration and instantiation + /// + /// Destination type to use + void As() where T : TDestination; + + /// + /// Customize configuration for an individual source member + /// + /// Expression to source member. Must be a member of the type + /// Callback for member configuration options + /// Itself + IMappingExpression ForSourceMember(Expression> sourceMember, + Action memberOptions); + + /// + /// Apply a transformation function after any resolved destination member value with the given type + /// + /// Value type to match and transform + /// Transformation expression + /// Itself + IMappingExpression AddTransform(Expression> transformer); + + /// + /// Create a type mapping from the destination to the source type, using the members as validation + /// + /// Itself + IMappingExpression ReverseMap(); + } } \ No newline at end of file diff --git a/src/AutoMapper/IMappingExpressionBase.cs b/src/AutoMapper/IMappingExpressionBase.cs new file mode 100644 index 0000000000..33fac5459b --- /dev/null +++ b/src/AutoMapper/IMappingExpressionBase.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Features; + +namespace AutoMapper +{ + /// + /// Common mapping configuration options between generic and non-generic mapping configuration + /// + /// Source type + /// Destination type + /// Concrete return type for fluent interface + public interface IMappingExpressionBase + where TMappingExpression : IMappingExpressionBase + { + Features Features { get; } + + /// + /// Construct the destination object using the service locator + /// + /// Itself + TMappingExpression ConstructUsingServiceLocator(); + + /// + /// For self-referential types, limit recurse depth. + /// Enables PreserveReferences. + /// + /// Number of levels to limit to + /// Itself + TMappingExpression MaxDepth(int depth); + + /// + /// Preserve object identity. Useful for circular references. + /// + /// Itself + TMappingExpression PreserveReferences(); + + /// + /// Disable constructor validation. During mapping this map is used against an existing destination object and never constructed itself. + /// + /// Itself + TMappingExpression DisableCtorValidation(); + + /// + /// Value transformers, typically configured through explicit or extenstion methods. + /// + IList ValueTransformers { get; } + + /// + /// Execute a custom function to the source and/or destination types before member mapping + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback for the source/destination types + /// Itself + TMappingExpression BeforeMap(Action beforeFunction); + + /// + /// Execute a custom function to the source and/or destination types before member mapping + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback for the source/destination types + /// Itself + TMappingExpression BeforeMap(Action beforeFunction); + + /// + /// Execute a custom mapping action before member mapping + /// + /// Not used for LINQ projection (ProjectTo) + /// Mapping action type instantiated during mapping + /// Itself + TMappingExpression BeforeMap() + where TMappingAction : IMappingAction; + + /// + /// Execute a custom function to the source and/or destination types after member mapping + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback for the source/destination types + /// Itself + TMappingExpression AfterMap(Action afterFunction); + + /// + /// Execute a custom function to the source and/or destination types after member mapping + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback for the source/destination types + /// Itself + TMappingExpression AfterMap(Action afterFunction); + + /// + /// Execute a custom mapping action after member mapping + /// + /// Not used for LINQ projection (ProjectTo) + /// Mapping action type instantiated during mapping + /// Itself + TMappingExpression AfterMap() + where TMappingAction : IMappingAction; + + /// + /// Specify which member list to validate + /// + /// Member list to validate + /// Itself + TMappingExpression ValidateMemberList(MemberList memberList); + + /// + /// Include this configuration in all derived types' maps. Works by scanning all type maps for matches during configuration. + /// + /// Itself + TMappingExpression IncludeAllDerived(); + + /// + /// Include this configuration in derived types' maps + /// + /// Derived source type + /// Derived destination type + /// Itself + TMappingExpression Include(Type derivedSourceType, Type derivedDestinationType); + + /// + /// Include the base type map's configuration in this map + /// + /// Base source type + /// Base destination type + /// + TMappingExpression IncludeBase(Type sourceBase, Type destinationBase); + + /// + /// Customize configuration for an individual source member. Member name not known until runtime + /// + /// Expression to source member. Must be a member of the type + /// Callback for member configuration options + /// Itself + TMappingExpression ForSourceMember(string sourceMemberName, Action memberOptions); + + /// + /// Ignores all properties that have either a private or protected setter, forcing the mapper to respect encapsulation (note: order matters, so place this before explicit configuration of any properties with an inaccessible setter) + /// + /// Itself + TMappingExpression IgnoreAllPropertiesWithAnInaccessibleSetter(); + + /// + /// When using ReverseMap, ignores all properties that have either a private or protected setter, keeping the reverse mapping consistent with the forward mapping (note: properties with an inaccessible setter may still be mapped unless IgnoreAllPropertiesWithAnInaccessibleSetter is also used) + /// + /// Itself + TMappingExpression IgnoreAllSourcePropertiesWithAnInaccessibleSetter(); + + /// + /// Supply a custom instantiation expression for the destination type + /// + /// Expression to create the destination type given the source object + /// Itself + TMappingExpression ConstructUsing(Expression> ctor); + + /// + /// Supply a custom instantiation function for the destination type, based on the entire resolution context + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback to create the destination type given the current resolution context + /// Itself + TMappingExpression ConstructUsing(Func ctor); + + /// + /// Customize configuration for individual constructor parameter + /// + /// Constructor parameter name + /// Options + /// Itself + TMappingExpression ForCtorParam(string ctorParamName, Action> paramOptions); + + /// + /// Override the destination type mapping for looking up configuration and instantiation + /// + /// + void As(Type typeOverride); + + /// + /// Skip normal member mapping and convert using a instantiated during mapping + /// Use this method if you need to specify the converter type at runtime + /// + /// Type converter type + void ConvertUsing(Type typeConverterType); + + /// + /// Skip member mapping and use a custom expression to convert to the destination type + /// + /// Callback to convert from source type to destination type + void ConvertUsing(Expression> mappingExpression); + + + /// + /// Skip member mapping and use a custom function to convert to the destination type + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback to convert from source type to destination type, including destination object + void ConvertUsing(Func mappingFunction); + + /// + /// Skip member mapping and use a custom function to convert to the destination type + /// + /// Not used for LINQ projection (ProjectTo) + /// Callback to convert from source type to destination type, with source, destination and context + void ConvertUsing(Func mappingFunction); + + /// + /// Skip member mapping and use a custom type converter instance to convert to the destination type + /// + /// Not used for LINQ projection (ProjectTo) + /// Type converter instance + void ConvertUsing(ITypeConverter converter); + + /// + /// Skip member mapping and use a custom type converter instance to convert to the destination type + /// + /// Not used for LINQ projection (ProjectTo) + /// Type converter type + void ConvertUsing() where TTypeConverter : ITypeConverter; + } +} \ No newline at end of file diff --git a/src/AutoMapper/IMappingOperationOptions.cs b/src/AutoMapper/IMappingOperationOptions.cs index 2890bfd3a8..051d33069a 100644 --- a/src/AutoMapper/IMappingOperationOptions.cs +++ b/src/AutoMapper/IMappingOperationOptions.cs @@ -1,13 +1,17 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; +using System; +using System.Collections.Generic; +namespace AutoMapper +{ /// /// Options for a single map operation /// public interface IMappingOperationOptions { + T CreateInstance(); + + Func ServiceCtor { get; } + /// /// Construct services using this callback. Use this for child/nested containers /// @@ -15,7 +19,7 @@ public interface IMappingOperationOptions void ConstructServicesUsing(Func constructor); /// - /// Add context items to be accessed at map time inside an or + /// Add context items to be accessed at map time inside an or /// IDictionary Items { get; } @@ -45,5 +49,18 @@ public interface IMappingOperationOptions : IMappingOpera /// /// Callback for the source/destination types void AfterMap(Action afterFunction); + + /// + /// Configure inline map + /// + /// Mapping configuration expression + IMappingExpression ConfigureMap(); + + /// + /// Configure inline map with member list to validate + /// + /// Member list to validate for the inline map + /// Mapping configuration expression + IMappingExpression ConfigureMap(MemberList memberList); } } \ No newline at end of file diff --git a/src/AutoMapper/IMemberAccessor.cs b/src/AutoMapper/IMemberAccessor.cs deleted file mode 100644 index f1e781ca9e..0000000000 --- a/src/AutoMapper/IMemberAccessor.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace AutoMapper -{ - public interface IMemberAccessor : IMemberGetter - { - void SetValue(object destination, object value); - } -} \ No newline at end of file diff --git a/src/AutoMapper/IMemberConfigurationExpression.cs b/src/AutoMapper/IMemberConfigurationExpression.cs index 0654ff5525..213e4aa440 100644 --- a/src/AutoMapper/IMemberConfigurationExpression.cs +++ b/src/AutoMapper/IMemberConfigurationExpression.cs @@ -1,198 +1,327 @@ -namespace AutoMapper -{ - using System; - using System.Linq.Expressions; - - /// - /// Member configuration options - /// - /// Source type for this member - /// Type for this member - /// Destination type for this map - public interface IMemberConfigurationExpression - { - /// - /// Substitute a custom value when the source member resolves as null - /// - /// Value to use - void NullSubstitute(TMember nullSubstitute); - - /// - /// Resolve destination member using a custom value resolver - /// - /// Value resolver type - /// Value resolver configuration options - void ResolveUsing() - where TValueResolver : IValueResolver; - - /// - /// Resolve destination member using a custom value resolver from a source member - /// - /// Value resolver type - /// Source member to supply - /// Value resolver configuration options - void ResolveUsing(Expression> sourceMember) - where TValueResolver : IValueResolver; - - /// - /// Resolve destination member using a custom value resolver from a source member - /// - /// Value resolver type - /// Source member to supply - /// Source member name - /// Value resolver configuration options - void ResolveUsing(string sourceMemberName) - where TValueResolver : IValueResolver; - - /// - /// Resolve destination member using a custom value resolver instance - /// - /// Value resolver instance to use - /// Resolution expression - void ResolveUsing(IValueResolver valueResolver); - - /// - /// Resolve destination member using a custom value resolver instance - /// - /// Value resolver instance to use - /// Source member to supply to value resolver - /// Resolution expression - void ResolveUsing(IValueResolver valueResolver, Expression> sourceMember); - - /// - /// Resolve destination member using a custom value resolver callback. Used instead of MapFrom when not simply redirecting a source member - /// This method cannot be used in conjunction with LINQ query projection - /// - /// Callback function to resolve against source type - void ResolveUsing(Func resolver); - - /// - /// Resolve destination member using a custom value resolver callback. Used instead of MapFrom when not simply redirecting a source member - /// Access both the source object and current resolution context for additional mapping, context items and parent objects - /// This method cannot be used in conjunction with LINQ query projection - /// - /// Callback function to resolve against source type - void ResolveUsing(Func resolver); - - /// - /// Specify the source member to map from. Can only reference a member on the type - /// This method can be used in mapping to LINQ query projections, while ResolveUsing cannot. - /// Any null reference exceptions in this expression will be ignored (similar to flattening behavior) - /// - /// Member type of the source member to use - /// Expression referencing the source member to map against - void MapFrom(Expression> sourceMember); - - /// - /// Specify the source member to map from. Can only reference a member on the type - /// This method can be used in mapping to LINQ query projections, while ResolveUsing cannot. - /// Any null reference exceptions in this expression will be ignored (similar to flattening behavior) - /// - /// Propertyname referencing the source member to map against - void MapFrom(string property); - - /// - /// Ignore this member for configuration validation and skip during mapping - /// - void Ignore(); - +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper +{ + /// + /// Member configuration options + /// + /// Source type for this member + /// Type for this member + /// Destination type for this map + public interface IMemberConfigurationExpression + { /// - /// Supply a custom mapping order instead of what the .NET runtime returns - /// - /// Mapping order value - void SetMappingOrder(int mappingOrder); - - /// - /// Use the destination value instead of mapping from the source value or creating a new instance - /// - void UseDestinationValue(); - - /// - /// Do not use the destination value instead of mapping from the source value or creating a new instance - /// - void DoNotUseDestinationValue(); - - /// - /// Use a custom value - /// - /// Value type - /// Value to use - void UseValue(TValue value); - - /// - /// Conditionally map this member against the source, destination, source and destination members - /// - /// Condition to evaluate using the source object - void Condition(Func condition); - - /// - /// Conditionally map this member - /// - /// Condition to evaluate using the source object - void Condition(Func condition); - - /// - /// Conditionally map this member - /// - /// Condition to evaluate using the source object - void Condition(Func condition); - - /// - /// Conditionally map this member - /// - /// Condition to evaluate using the source object - void Condition(Func condition); - - /// - /// Conditionally map this member - /// - /// Condition to evaluate using the source object - void Condition(Func condition); - + /// Do not precompute the execution plan for this member, just map it at runtime. + /// Simplifies the execution plan by not inlining. + /// + void MapAtRuntime(); + + /// + /// Substitute a custom value when the source member resolves as null + /// + /// Value to use + void NullSubstitute(object nullSubstitute); + + /// + /// Map destination member using a custom value resolver + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver type + void MapFrom() + where TValueResolver : IValueResolver; + + /// + /// Map destination member using a custom member value resolver supplied with a source member + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver type + /// Source member to supply + void MapFrom(Expression> sourceMember) + where TValueResolver : IMemberValueResolver; + + /// + /// Map destination member using a custom member value resolver supplied from a source member name + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver type + /// Source member to supply + /// Source member name + void MapFrom(string sourceMemberName) + where TValueResolver : IMemberValueResolver; + + /// + /// Map destination member using a custom value resolver instance + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver instance to use + void MapFrom(IValueResolver valueResolver); + + /// + /// Map destination member using a custom value resolver instance + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver instance to use + /// Source member to supply to value resolver + void MapFrom(IMemberValueResolver valueResolver, Expression> sourceMember); + + /// + /// Map destination member using a custom function. Access both the source and destination object. + /// + /// Not used for LINQ projection (ProjectTo) + /// Function to map to destination member + void MapFrom(Func mappingFunction); + + /// + /// Map destination member using a custom function. Access the source, destination object, and destination member. + /// + /// Not used for LINQ projection (ProjectTo) + /// Function to map to destination member + void MapFrom(Func mappingFunction); + + /// + /// Map destination member using a custom function. Access the source, destination object, destination member, and context. + /// + /// Not used for LINQ projection (ProjectTo) + /// Function to map to destination member + void MapFrom(Func mappingFunction); + + /// + /// Map destination member using a custom expression. Used in LINQ projection (ProjectTo). + /// + /// Member type of the source member to use + /// Map expression + void MapFrom(Expression> mapExpression); + + /// + /// Specify the source member to map from. Can only reference a member on the type + /// + /// Property name referencing the source member to map against + void MapFrom(string sourceMemberName); + + /// + /// Ignore this member for configuration validation and skip during mapping + /// + void Ignore(); + + /// + /// Allow this member to be null. This prevents generating a check condition for it. + /// + void AllowNull(); + + /// + /// Supply a custom mapping order instead of what the .NET runtime returns + /// + /// Mapping order value + void SetMappingOrder(int mappingOrder); + + /// + /// Use the destination value instead of mapping from the source value or creating a new instance + /// + void UseDestinationValue(); + + /// + /// Conditionally map this member against the source, destination, source and destination members + /// + /// Condition to evaluate using the source object + void Condition(Func condition); + + /// + /// Conditionally map this member + /// + /// Condition to evaluate using the source object + void Condition(Func condition); + + /// + /// Conditionally map this member + /// + /// Condition to evaluate using the source object + void Condition(Func condition); + + /// + /// Conditionally map this member + /// + /// Condition to evaluate using the source object + void Condition(Func condition); + + /// + /// Conditionally map this member + /// + /// Condition to evaluate using the source object + void Condition(Func condition); + + /// + /// Conditionally map this member, evaluated before accessing the source value + /// + /// Condition to evaluate using the source object + void PreCondition(Func condition); + + /// + /// Conditionally map this member, evaluated before accessing the source value + /// + /// Condition to evaluate using the current resolution context + void PreCondition(Func condition); + + /// + /// Conditionally map this member, evaluated before accessing the source value + /// + /// Condition to evaluate using the source object and the current resolution context + void PreCondition(Func condition); + /// /// Conditionally map this member, evaluated before accessing the source value /// - /// Condition to evaluate using the source object - void PreCondition(Func condition); - + /// Condition to evaluate using the source object, the destination object, and the current resolution context + void PreCondition(Func condition); + + /// + /// Ignore this member for LINQ projections unless explicitly expanded during projection + /// + void ExplicitExpansion(); + + /// + /// The destination member being configured. + /// + MemberInfo DestinationMember { get; } + + /// + /// Apply a transformation function after any resolved destination member value with the given type + /// + /// Transformation expression + void AddTransform(Expression> transformer); + /// - /// Conditionally map this member, evaluated before accessing the source value - /// - /// Condition to evaluate using the current resolution context - void PreCondition(Func condition); + /// Specify a value converter to convert from the matching source member to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Value converter type + /// Source member type + void ConvertUsing() where TValueConverter : IValueConverter; + + /// + /// Specify a value converter to convert from the specified source member to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Value converter type + /// Source member type + /// Source member to supply to the value converter + void ConvertUsing(Expression> sourceMember) where TValueConverter : IValueConverter; + + /// + /// Specify a value converter to convert from the specified source member name to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Value converter type + /// Source member type + /// Source member name to supply to the value converter + void ConvertUsing(string sourceMemberName) where TValueConverter : IValueConverter; - /// - /// Ignore this member for LINQ projections unless explicitly expanded during projection - /// - void ExplicitExpansion(); - } + /// + /// Specify a value converter instance to convert from the matching source member to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Source member type + /// Value converter instance + void ConvertUsing(IValueConverter valueConverter); - /// - /// Configuration options for an individual member - /// - public interface IMemberConfigurationExpression : IMemberConfigurationExpression - { - /// - /// Resolve destination member using a custom value resolver. Used when the value resolver is not known at compile-time - /// - /// Value resolver type - /// Value resolver configuration options - void ResolveUsing(Type valueResolverType); + /// + /// Specify a value converter instance from the specified source member to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Source member type + /// Value converter instance + /// Source member to supply to the value converter + void ConvertUsing(IValueConverter valueConverter, Expression> sourceMember); - /// - /// Resolve destination member using a custom value resolver. Used when the value resolver is not known at compile-time - /// - /// Value resolver type - /// Member to supply to value resolver - /// Value resolver configuration options - void ResolveUsing(Type valueResolverType, string memberName); + /// + /// Specify a value converter instance to convert from the specified source member name to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Source member type + /// Value converter instance + /// Source member name to supply to the value converter + void ConvertUsing(IValueConverter valueConverter, string sourceMemberName); + } + + /// + /// Configuration options for an individual member + /// + public interface IMemberConfigurationExpression : IMemberConfigurationExpression + { + /// + /// Map destination member using a custom value resolver. Used when the value resolver is not known at compile-time + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver type + void MapFrom(Type valueResolverType); + + /// + /// Map destination member using a custom value resolver. Used when the value resolver is not known at compile-time + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver type + /// Member to supply to value resolver + void MapFrom(Type valueResolverType, string sourceMemberName); + + /// + /// Map destination member using a custom value resolver instance + /// + /// Not used for LINQ projection (ProjectTo) + /// Value resolver instance to use + /// Source member to supply to value resolver + void MapFrom(IMemberValueResolver valueResolver, string sourceMemberName); - /// - /// Resolve destination member using a custom value resolver instance - /// - /// Value resolver instance to use - /// Source member to supply to value resolver - /// Resolution expression - void ResolveUsing(IValueResolver valueResolver, string memberName); - } + /// + /// Specify a value converter type to convert from the matching source member to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Value converter type + void ConvertUsing(Type valueConverterType); + + /// + /// Specify a value converter type to convert from the specified source member name to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Value converter type + /// Source member name to supply to the value converter + void ConvertUsing(Type valueConverterType, string sourceMemberName); + + /// + /// Specify a value converter instance to convert from the specified source member name to the destination member + /// + /// + /// Value converters are similar to type converters, but scoped to a single member. Value resolvers receive the enclosed source/destination objects as parameters. + /// Value converters do not. This makes it possible to reuse value converters across multiple members and multiple maps. + /// + /// Source member type + /// Destination member type + /// Value converter instance + /// Source member name to supply to the value converter + void ConvertUsing(IValueConverter valueConverter, string sourceMemberName); + } } \ No newline at end of file diff --git a/src/AutoMapper/IMemberGetter.cs b/src/AutoMapper/IMemberGetter.cs deleted file mode 100644 index 29a97d9ae0..0000000000 --- a/src/AutoMapper/IMemberGetter.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace AutoMapper -{ - using System.Reflection; - - public interface IMemberGetter : IMemberResolver - { - MemberInfo MemberInfo { get; } - string Name { get; } - object GetValue(object source); - } -} \ No newline at end of file diff --git a/src/AutoMapper/IMemberMap.cs b/src/AutoMapper/IMemberMap.cs new file mode 100644 index 0000000000..304dfe0847 --- /dev/null +++ b/src/AutoMapper/IMemberMap.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper +{ + public interface IMemberMap + { + TypeMap TypeMap { get; } + Type SourceType { get; } + IEnumerable SourceMembers { get; } + LambdaExpression CustomSource { get; } + Type DestinationType { get; } + string DestinationName { get; } + TypePair Types { get; } + bool CanResolveValue { get; } + bool Ignored { get; } + bool Inline { get; set; } + bool UseDestinationValue { get; } + object NullSubstitute { get; } + LambdaExpression PreCondition { get; } + LambdaExpression Condition { get; } + LambdaExpression CustomMapExpression { get; } + LambdaExpression CustomMapFunction { get; } + ValueResolverConfiguration ValueResolverConfig { get; } + ValueConverterConfiguration ValueConverterConfig { get; } + IEnumerable ValueTransformers { get; } + MemberInfo SourceMember { get; } + bool IsMapped { get; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/IMemberResolver.cs b/src/AutoMapper/IMemberResolver.cs deleted file mode 100644 index 6d30b03fa5..0000000000 --- a/src/AutoMapper/IMemberResolver.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper -{ - using System; - - public interface IMemberResolver - { - LambdaExpression GetExpression { get; } - Type MemberType { get; } - } -} \ No newline at end of file diff --git a/src/AutoMapper/INamingConvention.cs b/src/AutoMapper/INamingConvention.cs index 8a180a17a6..66a01a24b8 100644 --- a/src/AutoMapper/INamingConvention.cs +++ b/src/AutoMapper/INamingConvention.cs @@ -5,15 +5,15 @@ namespace AutoMapper /// /// Defines a naming convention strategy /// - public interface INamingConvention - { + public interface INamingConvention + { /// /// Regular expression on how to tokenize a member /// - Regex SplittingExpression { get; } + Regex SplittingExpression { get; } string SeparatorCharacter { get; } string ReplaceValue(Match match); - } + } } \ No newline at end of file diff --git a/src/AutoMapper/IObjectMapper.cs b/src/AutoMapper/IObjectMapper.cs index b24f216d2f..fc4916e956 100644 --- a/src/AutoMapper/IObjectMapper.cs +++ b/src/AutoMapper/IObjectMapper.cs @@ -1,39 +1,76 @@ using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; namespace AutoMapper { + using System; + using static Expression; + using static ExpressionFactory; + /// /// Mapping execution strategy, as a chain of responsibility /// - public interface IObjectMapper - { - /// - /// Performs a map - /// - /// Resolution context - /// Mapped object - object Map(ResolutionContext context); - + public interface IObjectMapper + { /// /// When true, the mapping engine will use this mapper as the strategy /// /// Resolution context /// Is match bool IsMatch(TypePair context); - } - /// - /// Map expression strategy, based on base mapper - /// - public interface IObjectMapExpression : IObjectMapper - { /// /// Builds a mapping expression equivalent to the base Map method /// + /// + /// + /// /// Source parameter /// Destination parameter - /// ResulotionContext parameter + /// ResolutionContext parameter /// Map expression - Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression); + Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression); + } + + /// + /// Base class for simple object mappers that don't want to use expressions. + /// + /// type of the source + /// type of the destination + public abstract class ObjectMapper : IObjectMapper + { + private static readonly MethodInfo MapMethod = typeof(ObjectMapper).GetDeclaredMethod("Map"); + + /// + /// When true, the mapping engine will use this mapper as the strategy + /// + /// Resolution context + /// Is match + public abstract bool IsMatch(TypePair context); + + /// + /// Performs conversion from source to destination type + /// + /// Source object + /// Destination object + /// The compile time type of the source object + /// The compile time type of the destination object + /// Resolution context + /// Destination object + public abstract TDestination Map(TSource source, TDestination destination, Type sourceType, Type destinationType, ResolutionContext context); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call( + Constant(this), + MapMethod, + ToType(sourceExpression, typeof(TSource)), + ToType(destExpression, typeof(TDestination)), + Constant(sourceExpression.Type), + Constant(destExpression.Type), + contextExpression); } -} +} \ No newline at end of file diff --git a/src/AutoMapper/IObjectMapperInfo.cs b/src/AutoMapper/IObjectMapperInfo.cs new file mode 100644 index 0000000000..ee22239254 --- /dev/null +++ b/src/AutoMapper/IObjectMapperInfo.cs @@ -0,0 +1,7 @@ +namespace AutoMapper +{ + public interface IObjectMapperInfo : IObjectMapper + { + TypePair GetAssociatedTypes(TypePair initialTypes); + } +} \ No newline at end of file diff --git a/src/AutoMapper/IPathConfigurationExpression.cs b/src/AutoMapper/IPathConfigurationExpression.cs new file mode 100644 index 0000000000..3f4c006461 --- /dev/null +++ b/src/AutoMapper/IPathConfigurationExpression.cs @@ -0,0 +1,46 @@ +using System; +using System.Linq.Expressions; + +namespace AutoMapper +{ + /// + /// Member configuration options + /// + /// Source type for this member + /// Destination type for this map + /// Type for this member + public interface IPathConfigurationExpression + { + /// + /// Specify the source member to map from. Can only reference a member on the type + /// Any null reference exceptions in this expression will be ignored (similar to flattening behavior) + /// + /// Member type of the source member to use + /// Expression referencing the source member to map against + void MapFrom(Expression> sourceMember); + + /// + /// Ignore this member for configuration validation and skip during mapping + /// + void Ignore(); + + void Condition(Func, bool> condition); + } + + public struct ConditionParameters + { + public ConditionParameters(TSource source, TDestination destination, TMember sourceMember, TMember destinationMember, ResolutionContext context) + { + Source = source; + Destination = destination; + SourceMember = sourceMember; + DestinationMember = destinationMember; + Context = context; + } + public TSource Source { get; } + public TDestination Destination { get; } + public TMember SourceMember { get; } + public TMember DestinationMember { get; } + public ResolutionContext Context { get; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/IProfileConfiguration.cs b/src/AutoMapper/IProfileConfiguration.cs deleted file mode 100644 index ce9245dd38..0000000000 --- a/src/AutoMapper/IProfileConfiguration.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using AutoMapper.Mappers; - -namespace AutoMapper -{ - using Configuration.Conventions; - - /// - /// Contains profile-specific configuration - /// - public interface IProfileConfiguration - { - IEnumerable MemberConfigurations { get; } - IEnumerable TypeConfigurations { get; } - bool ConstructorMappingEnabled { get; } - bool AllowNullDestinationValues { get; } - bool AllowNullCollections { get; } - bool CreateMissingTypeMaps { get; } - - IMemberConfiguration DefaultMemberConfig { get; } - /// - /// Source extension methods included for search - /// - IEnumerable SourceExtensionMethods { get; } - - /// - /// Specify which properties should be mapped. - /// By default only public properties are mapped.e - /// - Func ShouldMapProperty { get; } - - /// - /// Specify which fields should be mapped. - /// By default only public fields are mapped. - /// - Func ShouldMapField { get; } - - string ProfileName { get; } - IEnumerable GlobalIgnores { get; } - - /// - /// Registers all defined type maps - /// - /// Type map registry - void Register(TypeMapRegistry typeMapRegistry); - - /// - /// Configured all defined type maps - /// - /// Type map registry - void Configure(TypeMapRegistry typeMapRegistry); - - /// - /// Created and configures a type map based on conventions if matching - /// - /// Type map registry - /// Types to match - /// Configured type map, or null if not a match - TypeMap ConfigureConventionTypeMap(TypeMapRegistry typeMapRegistry, TypePair conventionTypes); - - /// - /// Creates and configures a closed generic type map based on conventions if matching - /// - /// Type map registry - /// Closed types to create - /// The requested types - /// Configured type map, or null if not a match - TypeMap ConfigureClosedGenericTypeMap(TypeMapRegistry typeMapRegistry, TypePair closedTypes, TypePair requestedTypes); - } -} \ No newline at end of file diff --git a/src/AutoMapper/IProfileExpression.cs b/src/AutoMapper/IProfileExpression.cs index a5267d0046..7e3393df15 100644 --- a/src/AutoMapper/IProfileExpression.cs +++ b/src/AutoMapper/IProfileExpression.cs @@ -1,138 +1,171 @@ -namespace AutoMapper -{ - using System; - using System.Reflection; - using Configuration.Conventions; - using Mappers; - - /// - /// Configuration for profile-specific maps - /// - public interface IProfileExpression - { - /// - /// Disable constructor mapping. Use this if you don't intend to have AutoMapper try to map to constructors - /// - void DisableConstructorMapping(); - - /// - /// Creates a mapping configuration from the type to the type - /// - /// Source type - /// Destination type - /// Mapping expression for more configuration options - IMappingExpression CreateMap(); - - /// - /// Creates a mapping configuration from the type to the type. - /// Specify the member list to validate against during configuration validation. - /// - /// Source type - /// Destination type - /// Member list to validate - /// Mapping expression for more configuration options - IMappingExpression CreateMap(MemberList memberList); - - /// - /// Create a mapping configuration from the source type to the destination type. - /// Use this method when the source and destination type are known at runtime and not compile time. - /// - /// Source type - /// Destination type - /// Mapping expression for more configuration options - IMappingExpression CreateMap(Type sourceType, Type destinationType); - - /// - /// Creates a mapping configuration from the source type to the destination type. - /// Specify the member list to validate against during configuration validation. - /// - /// Source type - /// Destination type - /// Member list to validate - /// Mapping expression for more configuration options - IMappingExpression CreateMap(Type sourceType, Type destinationType, MemberList memberList); - - /// - /// Clear the list of recognized prefixes. - /// - void ClearPrefixes(); - - /// - /// Recognize a list of prefixes to be removed from source member names when matching - /// - /// List of prefixes - void RecognizePrefixes(params string[] prefixes); - - /// - /// Recognize a list of postfixes to be removed from source member names when matching - /// - /// List of postfixes - void RecognizePostfixes(params string[] postfixes); - - /// - /// Provide an alias for a member name when matching source member names - /// - /// Original member name - /// Alias to match against - void RecognizeAlias(string original, string alias); - - - /// - /// Provide a new value for a part of a members name - /// - /// Original member value - /// New member value - void ReplaceMemberName(string original, string newValue); - - /// - /// Recognize a list of prefixes to be removed from destination member names when matching - /// - /// List of prefixes - void RecognizeDestinationPrefixes(params string[] prefixes); - - /// - /// Recognize a list of postfixes to be removed from destination member names when matching - /// - /// List of postfixes - void RecognizeDestinationPostfixes(params string[] postfixes); - - /// - /// Add a property name to globally ignore. Matches against the beginning of the property names. - /// - /// Property name to match against - void AddGlobalIgnore(string propertyNameStartingWith); - - /// - /// Allow null destination values. If false, destination objects will be created for deep object graphs. Default true. - /// - bool AllowNullDestinationValues { get; set; } - - /// - /// Allow null destination collections. If true, null source collections result in null destination collections. Default false. - /// - bool AllowNullCollections { get; set; } - - /// - /// Naming convention for source members - /// - INamingConvention SourceMemberNamingConvention { get; set; } - - /// - /// Naming convention for destination members - /// - INamingConvention DestinationMemberNamingConvention { get; set; } - - /// - /// Specify common configuration for all type maps. - /// - /// configuration callback - void ForAllMaps(Action configuration); - - Func ShouldMapProperty { get; set; } - Func ShouldMapField { get; set; } - string ProfileName { get; } - IMemberConfiguration AddMemberConfiguration(); - IConditionalObjectMapper AddConditionalObjectMapper(); - void IncludeSourceExtensionMethods(Type type); - } +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration.Conventions; +using AutoMapper.Mappers; + +namespace AutoMapper +{ + /// + /// Configuration for profile-specific maps + /// + public interface IProfileExpression + { + /// + /// Disable constructor mapping. Use this if you don't intend to have AutoMapper try to map to constructors + /// + void DisableConstructorMapping(); + + /// + /// Creates a mapping configuration from the type to the type + /// + /// Source type + /// Destination type + /// Mapping expression for more configuration options + IMappingExpression CreateMap(); + + /// + /// Creates a mapping configuration from the type to the type. + /// Specify the member list to validate against during configuration validation. + /// + /// Source type + /// Destination type + /// Member list to validate + /// Mapping expression for more configuration options + IMappingExpression CreateMap(MemberList memberList); + + /// + /// Create a mapping configuration from the source type to the destination type. + /// Use this method when the source and destination type are known at runtime and not compile time. + /// + /// Source type + /// Destination type + /// Mapping expression for more configuration options + IMappingExpression CreateMap(Type sourceType, Type destinationType); + + /// + /// Creates a mapping configuration from the source type to the destination type. + /// Specify the member list to validate against during configuration validation. + /// + /// Source type + /// Destination type + /// Member list to validate + /// Mapping expression for more configuration options + IMappingExpression CreateMap(Type sourceType, Type destinationType, MemberList memberList); + + /// + /// Clear the list of recognized prefixes. + /// + void ClearPrefixes(); + + /// + /// Recognize a list of prefixes to be removed from source member names when matching + /// + /// List of prefixes + void RecognizePrefixes(params string[] prefixes); + + /// + /// Recognize a list of postfixes to be removed from source member names when matching + /// + /// List of postfixes + void RecognizePostfixes(params string[] postfixes); + + /// + /// Provide an alias for a member name when matching source member names + /// + /// Original member name + /// Alias to match against + void RecognizeAlias(string original, string alias); + + + /// + /// Provide a new value for a part of a members name + /// + /// Original member value + /// New member value + void ReplaceMemberName(string original, string newValue); + + /// + /// Recognize a list of prefixes to be removed from destination member names when matching + /// + /// List of prefixes + void RecognizeDestinationPrefixes(params string[] prefixes); + + /// + /// Recognize a list of postfixes to be removed from destination member names when matching + /// + /// List of postfixes + void RecognizeDestinationPostfixes(params string[] postfixes); + + /// + /// Add a property name to globally ignore. Matches against the beginning of the property names. + /// + /// Property name to match against + void AddGlobalIgnore(string propertyNameStartingWith); + + /// + /// Allow null destination values. If false, destination objects will be created for deep object graphs. Default true. + /// + bool? AllowNullDestinationValues { get; set; } + + /// + /// Allow null destination collections. If true, null source collections result in null destination collections. Default false. + /// + bool? AllowNullCollections { get; set; } + + /// + /// Allows to enable null-value propagation for query mapping. + /// Some providers (such as EntityFrameworkQueryVisitor) do not work with this feature enabled! + /// + bool? EnableNullPropagationForQueryMapping { get; set; } + + /// + /// Naming convention for source members + /// + INamingConvention SourceMemberNamingConvention { get; set; } + + /// + /// Naming convention for destination members + /// + INamingConvention DestinationMemberNamingConvention { get; set; } + + /// + /// Specify common configuration for all type maps. + /// + /// configuration callback + void ForAllMaps(Action configuration); + + /// + /// Customize configuration for all members across all maps + /// + /// Condition + /// Callback for member options. Use the property map for conditional maps. + void ForAllPropertyMaps(Func condition, Action memberOptions); + + Func ShouldMapProperty { get; set; } + Func ShouldMapField { get; set; } + Func ShouldMapMethod { get; set; } + Func ShouldUseConstructor { get; set; } + + string ProfileName { get; } + IMemberConfiguration AddMemberConfiguration(); + IConditionalObjectMapper AddConditionalObjectMapper(); + + /// + /// Include extension methods against source members for matching destination members to. Default source extension methods from + /// + /// Static type that contains extension methods + void IncludeSourceExtensionMethods(Type type); + + /// + /// Value transformers. Modify the list directly or use + /// + IList ValueTransformers { get; } + + /// + /// Validate maps created dynamically/inline on the first map. Defaults to true. + /// + bool? ValidateInlineMaps { get; set; } + } } \ No newline at end of file diff --git a/src/AutoMapper/IResolutionExpression.cs b/src/AutoMapper/IResolutionExpression.cs deleted file mode 100644 index 3dacdc3be2..0000000000 --- a/src/AutoMapper/IResolutionExpression.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace AutoMapper -{ - using System; - using System.Linq.Expressions; - - /// - /// Custom resolver options - /// - /// Source type - public interface IResolutionExpression : IResolutionExpression - { - /// - /// Use the specified member as the input to the resolver instead of the root object - /// - /// Expression for the source member - void FromMember(Expression> sourceMember); - } - - /// - /// Custom resolver options - /// - public interface IResolutionExpression - { - /// - /// Use the supplied member as the input to the resolver instead of the root source object - /// - /// Property name to use - void FromMember(string sourcePropertyName); - } -} \ No newline at end of file diff --git a/src/AutoMapper/IResolverConfigurationExpression.cs b/src/AutoMapper/IResolverConfigurationExpression.cs deleted file mode 100644 index 110206fdf3..0000000000 --- a/src/AutoMapper/IResolverConfigurationExpression.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace AutoMapper -{ - using System; - using System.Linq.Expressions; - - /// - /// Custom resolver options - /// - /// Source type - public interface IResolverConfigurationExpression - { - /// - /// Use the specified member as the input to the resolver instead of the root object - /// - /// Expression for the source member - /// Itself - void FromMember(Expression> sourceMember); - - /// - /// Use the specified member as the input to the resolver instead of the root object - /// - /// Name of the source member - /// Itself - void FromMember(string sourcePropertyName); - } -} \ No newline at end of file diff --git a/src/AutoMapper/ISourceMemberConfigurationExpression.cs b/src/AutoMapper/ISourceMemberConfigurationExpression.cs index 69623b5553..1c6e68da5d 100644 --- a/src/AutoMapper/ISourceMemberConfigurationExpression.cs +++ b/src/AutoMapper/ISourceMemberConfigurationExpression.cs @@ -1,13 +1,14 @@ -namespace AutoMapper -{ - /// - /// Source member configuration options - /// - public interface ISourceMemberConfigurationExpression - { - /// - /// Ignore this member for configuration validation and skip during mapping - /// - void Ignore(); - } +namespace AutoMapper +{ + /// + /// Source member configuration options + /// + public interface ISourceMemberConfigurationExpression + { + /// + /// Ignore this member when validating source members, MemberList.Source. + /// Does not affect validation for the default case, MemberList.Destination. + /// + void DoNotValidate(); + } } \ No newline at end of file diff --git a/src/AutoMapper/ITypeConverter.cs b/src/AutoMapper/ITypeConverter.cs index 3902dc363d..5194049679 100644 --- a/src/AutoMapper/ITypeConverter.cs +++ b/src/AutoMapper/ITypeConverter.cs @@ -5,14 +5,15 @@ namespace AutoMapper /// /// Source type /// Destination type - public interface ITypeConverter - { + public interface ITypeConverter + { /// /// Performs conversion from source to destination type /// /// Source object + /// Destination object /// Resolution context /// Destination object - TDestination Convert(TSource source, ResolutionContext context); - } + TDestination Convert(TSource source, TDestination destination, ResolutionContext context); + } } diff --git a/src/AutoMapper/IValueConverter.cs b/src/AutoMapper/IValueConverter.cs new file mode 100644 index 0000000000..e30799bdb3 --- /dev/null +++ b/src/AutoMapper/IValueConverter.cs @@ -0,0 +1,18 @@ +namespace AutoMapper +{ + /// + /// Converts a source member value to a destination member value + /// + /// Source member type + /// Destination member type + public interface IValueConverter + { + /// + /// Perform conversion from source member value to destination member value + /// + /// Source member object + /// Resolution context + /// Destination member value + TDestinationMember Convert(TSourceMember sourceMember, ResolutionContext context); + } +} \ No newline at end of file diff --git a/src/AutoMapper/IValueResolver.cs b/src/AutoMapper/IValueResolver.cs index b034dc5845..49ca4bf567 100644 --- a/src/AutoMapper/IValueResolver.cs +++ b/src/AutoMapper/IValueResolver.cs @@ -3,14 +3,33 @@ namespace AutoMapper /// /// Extension point to provide custom resolution for a destination value /// - public interface IValueResolver + public interface IValueResolver { /// /// Implementors use source object to provide a destination object. /// /// Source object + /// Destination object, if exists + /// Destination member /// The context of the mapping /// Result, typically build from the source resolution result - TMember Resolve(TSource source, ResolutionContext context); + TDestMember Resolve(TSource source, TDestination destination, TDestMember destMember, ResolutionContext context); + } + + /// + /// Extension point to provide custom resolution for a destination value + /// + public interface IMemberValueResolver + { + /// + /// Implementors use source object to provide a destination object. + /// + /// Source object + /// Destination object, if exists + /// Source member + /// Destination member + /// The context of the mapping + /// Result, typically build from the source resolution result + TDestMember Resolve(TSource source, TDestination destination, TSourceMember sourceMember, TDestMember destMember, ResolutionContext context); } } diff --git a/src/AutoMapper/IgnoreMapAttribute.cs b/src/AutoMapper/IgnoreMapAttribute.cs index 2888a005bf..66d7fff705 100644 --- a/src/AutoMapper/IgnoreMapAttribute.cs +++ b/src/AutoMapper/IgnoreMapAttribute.cs @@ -1,7 +1,7 @@ -namespace AutoMapper -{ - using System; +using System; +namespace AutoMapper +{ /// /// Ignore this member for validation and skip during mapping /// diff --git a/src/AutoMapper/Internal/ExpressionFactory.cs b/src/AutoMapper/Internal/ExpressionFactory.cs new file mode 100644 index 0000000000..97bdfbf8a9 --- /dev/null +++ b/src/AutoMapper/Internal/ExpressionFactory.cs @@ -0,0 +1,252 @@ +using System; +using System.Diagnostics; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; + +namespace AutoMapper.Internal +{ + using static Expression; + + public static class ExpressionFactory + { + public static LambdaExpression MemberAccessLambda(Type type, string propertyOrField) => + MemberAccessLambda(type.GetFieldOrProperty(propertyOrField)); + + public static LambdaExpression MemberAccessLambda(MemberInfo propertyOrField) + { + var source = Parameter(propertyOrField.DeclaringType, "source"); + return Lambda(MakeMemberAccess(source, propertyOrField), source); + } + + + public static MemberExpression MemberAccesses(string members, Expression obj) => + (MemberExpression) ReflectionHelper.GetMemberPath(obj.Type, members).MemberAccesses(obj); + + public static Expression GetSetter(MemberExpression memberExpression) + { + var propertyOrField = memberExpression.Member; + return ReflectionHelper.CanBeSet(propertyOrField) ? + MakeMemberAccess(memberExpression.Expression, propertyOrField) : + null; + } + + public static MethodInfo Method(Expression> expression) => GetExpressionBodyMethod(expression); + + public static MethodInfo Method(Expression> expression) => GetExpressionBodyMethod(expression); + + private static MethodInfo GetExpressionBodyMethod(LambdaExpression expression) => ((MethodCallExpression) expression.Body).Method; + + public static Expression ForEach(Expression collection, ParameterExpression loopVar, Expression loopContent) + { + if(collection.Type.IsArray) + { + return ForEachArrayItem(collection, arrayItem => Block(new[] { loopVar }, Assign(loopVar, arrayItem), loopContent)); + } + var getEnumerator = collection.Type.GetInheritedMethod("GetEnumerator"); + var getEnumeratorCall = Call(collection, getEnumerator); + var enumeratorType = getEnumeratorCall.Type; + var enumeratorVar = Variable(enumeratorType, "enumerator"); + var enumeratorAssign = Assign(enumeratorVar, getEnumeratorCall); + + var moveNext = enumeratorType.GetInheritedMethod("MoveNext"); + var moveNextCall = Call(enumeratorVar, moveNext); + + var breakLabel = Label("LoopBreak"); + + var loop = Block(new[] { enumeratorVar }, + enumeratorAssign, + Loop( + IfThenElse( + Equal(moveNextCall, Constant(true)), + Block(new[] { loopVar }, + Assign(loopVar, ToType(Property(enumeratorVar, "Current"), loopVar.Type)), + loopContent + ), + Break(breakLabel) + ), + breakLabel) + ); + + return loop; + } + + public static Expression ForEachArrayItem(Expression array, Func body) + { + var length = Property(array, "Length"); + return For(length, index => body(ArrayAccess(array, index))); + } + + public static Expression For(Expression count, Func body) + { + var breakLabel = Label("LoopBreak"); + var index = Variable(typeof(int), "sourceArrayIndex"); + var initialize = Assign(index, Constant(0, typeof(int))); + var loop = Block(new[] { index }, + initialize, + Loop( + IfThenElse( + LessThan(index, count), + Block(body(index), PostIncrementAssign(index)), + Break(breakLabel) + ), + breakLabel) + ); + return loop; + } + + public static Expression ToObject(Expression expression) => ToType(expression, typeof(object)); + + public static Expression ToType(Expression expression, Type type) => expression.Type == type ? expression : Convert(expression, type); + + public static Expression ReplaceParameters(LambdaExpression exp, params Expression[] replace) + { + var replaceExp = exp.Body; + for (var i = 0; i < Math.Min(replace.Length, exp.Parameters.Count); i++) + replaceExp = Replace(replaceExp, exp.Parameters[i], replace[i]); + return replaceExp; + } + + public static Expression ConvertReplaceParameters(LambdaExpression exp, params Expression[] replace) + { + var replaceExp = exp.Body; + for (var i = 0; i < Math.Min(replace.Length, exp.Parameters.Count); i++) + replaceExp = new ConvertingVisitor(exp.Parameters[i], replace[i]).Visit(replaceExp); + return replaceExp; + } + + public static Expression Replace(Expression exp, Expression old, Expression replace) => new ReplaceExpressionVisitor(old, replace).Visit(exp); + + public static LambdaExpression Concat(LambdaExpression expr, LambdaExpression concat) => (LambdaExpression)new ExpressionConcatVisitor(expr).Visit(concat); + + public static Expression NullCheck(Expression expression, Type destinationType) + { + var target = expression; + Expression nullConditions = Constant(false); + do + { + if(target is MemberExpression member) + { + target = member.Expression; + NullCheck(); + } + else if(target is MethodCallExpression method) + { + target = method.Method.IsStatic() ? method.Arguments.FirstOrDefault() : method.Object; + NullCheck(); + } + else if(target?.NodeType == ExpressionType.Parameter) + { + var returnType = Nullable.GetUnderlyingType(destinationType) == expression.Type ? destinationType : expression.Type; + var nullCheck = Condition(nullConditions, Default(returnType), ToType(expression, returnType)); + return nullCheck; + } + else + { + return expression; + } + } + while(true); + void NullCheck() + { + if(target == null || target.Type.IsValueType()) + { + return; + } + nullConditions = OrElse(Equal(target, Constant(null, target.Type)), nullConditions); + } + } + + public static Expression IfNullElse(Expression expression, Expression then, Expression @else = null) + { + var nonNullElse = ToType(@else ?? Default(then.Type), then.Type); + if(expression.Type.IsValueType() && !expression.Type.IsNullableType()) + { + return nonNullElse; + } + return Condition(Equal(expression, Constant(null)), then, nonNullElse); + } + + internal class ConvertingVisitor : ExpressionVisitor + { + private readonly Expression _newParam; + private readonly ParameterExpression _oldParam; + + public ConvertingVisitor(ParameterExpression oldParam, Expression newParam) + { + _newParam = newParam; + _oldParam = oldParam; + } + + protected override Expression VisitMember(MemberExpression node) + { + if (node.Expression == _oldParam) + { + node = MakeMemberAccess(ToType(_newParam, _oldParam.Type), node.Member); + } + + return base.VisitMember(node); + } + + protected override Expression VisitParameter(ParameterExpression node) => + node == _oldParam + ? ToType(_newParam, _oldParam.Type) + : base.VisitParameter(node); + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if (node.Object == _oldParam) + { + node = Call(ToType(_newParam, _oldParam.Type), node.Method, node.Arguments); + } + + return base.VisitMethodCall(node); + } + } + + internal class ReplaceExpressionVisitor : ExpressionVisitor + { + private readonly Expression _oldExpression; + private readonly Expression _newExpression; + + public ReplaceExpressionVisitor(Expression oldExpression, Expression newExpression) + { + _oldExpression = oldExpression; + _newExpression = newExpression; + } + + public override Expression Visit(Expression node) + { + if (_oldExpression == node) + node = _newExpression; + + return base.Visit(node); + } + } + + internal class ExpressionConcatVisitor : ExpressionVisitor + { + private readonly LambdaExpression _overrideExpression; + + public ExpressionConcatVisitor(LambdaExpression overrideExpression) => _overrideExpression = overrideExpression; + + public override Expression Visit(Expression node) + { + if (_overrideExpression == null) + return node; + if (node.NodeType != ExpressionType.Lambda && node.NodeType != ExpressionType.Parameter) + { + var expression = node; + if (node.Type == typeof(object)) + expression = Convert(node, _overrideExpression.Parameters[0].Type); + + return ReplaceParameters(_overrideExpression, expression); + } + return base.Visit(node); + } + + protected override Expression VisitLambda(Expression node) => Lambda(Visit(node.Body), node.Parameters); + } + } +} diff --git a/src/AutoMapper/Internal/MemberVisitor.cs b/src/AutoMapper/Internal/MemberVisitor.cs new file mode 100644 index 0000000000..e1deb53ac6 --- /dev/null +++ b/src/AutoMapper/Internal/MemberVisitor.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.Internal +{ + public class MemberVisitor : ExpressionVisitor + { + public static IEnumerable GetMemberPath(Expression expression) + { + var memberVisitor = new MemberVisitor(); + memberVisitor.Visit(expression); + return memberVisitor.MemberPath; + } + + protected override Expression VisitMember(MemberExpression node) + { + MemberPath = node.GetMembers().Select(e=>e.Member); + return node; + } + + public IEnumerable MemberPath { get; private set; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Internal/ReflectionHelper.cs b/src/AutoMapper/Internal/ReflectionHelper.cs new file mode 100644 index 0000000000..e4b33986a5 --- /dev/null +++ b/src/AutoMapper/Internal/ReflectionHelper.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Dynamic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.Internal +{ + using Configuration; + + public static class ReflectionHelper + { + public static bool CanBeSet(MemberInfo propertyOrField) + { + return propertyOrField is FieldInfo field ? + !field.IsInitOnly : + ((PropertyInfo)propertyOrField).CanWrite; + } + + public static object GetDefaultValue(ParameterInfo parameter) + { + if (parameter.DefaultValue == null && parameter.ParameterType.IsValueType()) + { + return Activator.CreateInstance(parameter.ParameterType); + } + return parameter.DefaultValue; + } + + public static object MapMember(ResolutionContext context, MemberInfo member, object value, object destination = null) + { + var memberType = GetMemberType(member); + var destValue = destination == null ? null : GetMemberValue(member, destination); + return context.Map(value, destValue, value?.GetType() ?? typeof(object), memberType, DefaultMemberMap.Instance); + } + + public static bool IsDynamic(object obj) => obj is IDynamicMetaObjectProvider; + + public static bool IsDynamic(Type type) => typeof(IDynamicMetaObjectProvider).IsAssignableFrom(type); + + public static void SetMemberValue(MemberInfo propertyOrField, object target, object value) + { + if (propertyOrField is PropertyInfo property) + { + property.SetValue(target, value, null); + return; + } + if (propertyOrField is FieldInfo field) + { + field.SetValue(target, value); + return; + } + throw Expected(propertyOrField); + } + + private static ArgumentOutOfRangeException Expected(MemberInfo propertyOrField) + => new ArgumentOutOfRangeException(nameof(propertyOrField), "Expected a property or field, not " + propertyOrField); + + public static object GetMemberValue(MemberInfo propertyOrField, object target) + { + if (propertyOrField is PropertyInfo property) + { + return property.GetValue(target, null); + } + if (propertyOrField is FieldInfo field) + { + return field.GetValue(target); + } + throw Expected(propertyOrField); + } + + public static IEnumerable GetMemberPath(Type type, string fullMemberName) + { + MemberInfo property = null; + foreach (var memberName in fullMemberName.Split('.')) + { + var currentType = GetCurrentType(property, type); + yield return property = currentType.GetFieldOrProperty(memberName); + } + } + + private static Type GetCurrentType(MemberInfo member, Type type) + { + var memberType = member?.GetMemberType() ?? type; + if (memberType.IsGenericType() && typeof(IEnumerable).IsAssignableFrom(memberType)) + { + memberType = memberType.GetTypeInfo().GenericTypeArguments[0]; + } + return memberType; + } + + public static MemberInfo GetFieldOrProperty(LambdaExpression expression) + { + var memberExpression = expression.Body as MemberExpression; + return memberExpression != null + ? memberExpression.Member + : throw new ArgumentOutOfRangeException(nameof(expression), "Expected a property/field access expression, not " + expression); + } + + public static MemberInfo FindProperty(LambdaExpression lambdaExpression) + { + Expression expressionToCheck = lambdaExpression; + + var done = false; + + while (!done) + { + switch (expressionToCheck.NodeType) + { + case ExpressionType.Convert: + expressionToCheck = ((UnaryExpression)expressionToCheck).Operand; + break; + case ExpressionType.Lambda: + expressionToCheck = ((LambdaExpression)expressionToCheck).Body; + break; + case ExpressionType.MemberAccess: + var memberExpression = ((MemberExpression)expressionToCheck); + + if (memberExpression.Expression.NodeType != ExpressionType.Parameter && + memberExpression.Expression.NodeType != ExpressionType.Convert) + { + throw new ArgumentException( + $"Expression '{lambdaExpression}' must resolve to top-level member and not any child object's properties. You can use ForPath, a custom resolver on the child type or the AfterMap option instead.", + nameof(lambdaExpression)); + } + + var member = memberExpression.Member; + + return member; + default: + done = true; + break; + } + } + + throw new AutoMapperConfigurationException( + "Custom configuration for members is only supported for top-level individual members on a type."); + } + + public static Type GetMemberType(MemberInfo memberInfo) + { + switch (memberInfo) + { + case MethodInfo mInfo: + return mInfo.ReturnType; + case PropertyInfo pInfo: + return pInfo.PropertyType; + case FieldInfo fInfo: + return fInfo.FieldType; + case null: + throw new ArgumentNullException(nameof(memberInfo)); + default: + throw new ArgumentOutOfRangeException(nameof(memberInfo)); + } + } + + /// + /// if targetType is oldType, method will return newType + /// if targetType is not oldType, method will return targetType + /// if targetType is generic type with oldType arguments, method will replace all oldType arguments on newType + /// + /// + /// + /// + /// + public static Type ReplaceItemType(Type targetType, Type oldType, Type newType) + { + if (targetType == oldType) + return newType; + + if (targetType.IsGenericType()) + { + var genSubArgs = targetType.GetTypeInfo().GenericTypeArguments; + var newGenSubArgs = new Type[genSubArgs.Length]; + for (var i = 0; i < genSubArgs.Length; i++) + newGenSubArgs[i] = ReplaceItemType(genSubArgs[i], oldType, newType); + return targetType.GetGenericTypeDefinition().MakeGenericType(newGenSubArgs); + } + + return targetType; + } + } +} diff --git a/src/AutoMapper/LockingConcurrentDictionary.cs b/src/AutoMapper/LockingConcurrentDictionary.cs new file mode 100644 index 0000000000..b7eb3a52d1 --- /dev/null +++ b/src/AutoMapper/LockingConcurrentDictionary.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; + +namespace AutoMapper +{ + internal struct LockingConcurrentDictionary + { + private readonly ConcurrentDictionary> _dictionary; + private readonly Func> _valueFactory; + + public LockingConcurrentDictionary(Func valueFactory) + { + _dictionary = new ConcurrentDictionary>(); + _valueFactory = key => new Lazy(() => valueFactory(key)); + } + + public TValue GetOrAdd(TKey key) => _dictionary.GetOrAdd(key, _valueFactory).Value; + public TValue GetOrAdd(TKey key, Func> valueFactory) => _dictionary.GetOrAdd(key, valueFactory).Value; + + public TValue this[TKey key] + { + get => _dictionary[key].Value; + set => _dictionary[key] = new Lazy(() => value); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (_dictionary.TryGetValue(key, out Lazy lazy)) + { + value = lazy.Value; + return true; + } + value = default; + return false; + } + + public bool ContainsKey(TKey key) => _dictionary.ContainsKey(key); + + public ICollection Keys => _dictionary.Keys; + } +} \ No newline at end of file diff --git a/src/AutoMapper/LowerUnderscoreNamingConvention.cs b/src/AutoMapper/LowerUnderscoreNamingConvention.cs index 9482dc4f78..bcbd56dbd6 100644 --- a/src/AutoMapper/LowerUnderscoreNamingConvention.cs +++ b/src/AutoMapper/LowerUnderscoreNamingConvention.cs @@ -1,16 +1,13 @@ +using System.Text.RegularExpressions; + namespace AutoMapper { - using System.Text.RegularExpressions; - public class LowerUnderscoreNamingConvention : INamingConvention { public Regex SplittingExpression { get; } = new Regex(@"[\p{Ll}\p{Lu}0-9]+(?=_?)"); public string SeparatorCharacter => "_"; - public string ReplaceValue(Match match) - { - return match.Value.ToLower(); - } + public string ReplaceValue(Match match) => match.Value.ToLower(); } } \ No newline at end of file diff --git a/src/AutoMapper/Mapper.cs b/src/AutoMapper/Mapper.cs index 97b519e6a2..33b086ce29 100644 --- a/src/AutoMapper/Mapper.cs +++ b/src/AutoMapper/Mapper.cs @@ -1,13 +1,19 @@ +using System; +using AutoMapper.Configuration; + namespace AutoMapper { - using System; + using System.Collections.Generic; using System.Linq; - using Configuration; - using Execution; - using Mappers; + using System.Linq.Expressions; + using ObjectMappingOperationOptions = MappingOperationOptions; + using QueryableExtensions; public class Mapper : IRuntimeMapper { + private const string InvalidOperationMessage = "Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance."; + private const string AlreadyInitialized = "Mapper already initialized. You must call Initialize once per application domain/process."; + #region Static API private static IConfigurationProvider _configuration; @@ -18,14 +24,8 @@ public class Mapper : IRuntimeMapper /// public static IConfigurationProvider Configuration { - get - { - if (_configuration == null) - throw new InvalidOperationException("Mapper not initialized. Call Initialize with appropriate configuration."); - - return _configuration; - } - private set { _configuration = value; } + get => _configuration ?? throw new InvalidOperationException(InvalidOperationMessage); + private set => _configuration = (_configuration == null) ? value : throw new InvalidOperationException(AlreadyInitialized); } /// @@ -33,14 +33,8 @@ public static IConfigurationProvider Configuration /// public static IMapper Instance { - get - { - if (_instance == null) - throw new InvalidOperationException("Mapper not initialized. Call Initialize with appropriate configuration."); - - return _instance; - } - private set { _instance = value; } + get => _instance ?? throw new InvalidOperationException(InvalidOperationMessage); + private set => _instance = value; } /// @@ -53,6 +47,25 @@ public static void Initialize(Action config) Instance = new Mapper(Configuration); } + /// + /// Initialize static configuration instance + /// + /// Configuration action + public static void Initialize(MapperConfigurationExpression config) + { + Configuration = new MapperConfiguration(config); + Instance = new Mapper(Configuration); + } + + /// + /// Resets the mapper configuration. Not intended for production use, but for testing scenarios. + /// + public static void Reset() + { + _configuration = null; + _instance = null; + } + /// /// Execute a mapping from the source object to a new destination object. /// The source type is inferred from the source object. @@ -160,11 +173,15 @@ public static object Map(object source, object destination, Type sourceType, Typ public static object Map(object source, object destination, Type sourceType, Type destinationType, Action opts) => Instance.Map(source, destination, sourceType, destinationType, opts); + /// + /// Dry run all configured type maps and throw for each problem + /// + public static void AssertConfigurationIsValid() => Configuration.AssertConfigurationIsValid(); + #endregion private readonly IConfigurationProvider _configurationProvider; private readonly Func _serviceCtor; - private readonly MappingOperationOptions _defaultMappingOptions; public Mapper(IConfigurationProvider configurationProvider) : this(configurationProvider, configurationProvider.ServiceCtor) @@ -173,11 +190,13 @@ public Mapper(IConfigurationProvider configurationProvider) public Mapper(IConfigurationProvider configurationProvider, Func serviceCtor) { - _configurationProvider = configurationProvider; - _serviceCtor = serviceCtor; - _defaultMappingOptions = new MappingOperationOptions(_serviceCtor); + _configurationProvider = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider)); + _serviceCtor = serviceCtor ?? throw new ArgumentNullException(nameof(serviceCtor)); + DefaultContext = new ResolutionContext(new ObjectMappingOperationOptions(serviceCtor), this); } + public ResolutionContext DefaultContext { get; } + Func IMapper.ServiceCtor => _serviceCtor; IConfigurationProvider IMapper.ConfigurationProvider => _configurationProvider; @@ -185,15 +204,13 @@ public Mapper(IConfigurationProvider configurationProvider, Func s TDestination IMapper.Map(object source) { if (source == null) - return default(TDestination); + return default; var types = new TypePair(source.GetType(), typeof(TDestination)); var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(types, types)); - var context = new ResolutionContext(source, null, types, _defaultMappingOptions, this); - - return (TDestination) func(source, null, context); + return (TDestination) func(source, null, DefaultContext); } TDestination IMapper.Map(object source, Action opts) @@ -211,32 +228,40 @@ TDestination IMapper.Map(object source, Action(TSource source) { - var types = TypePair.Create(source, null, typeof(TSource), typeof (TDestination)); + var types = TypePair.Create(source, typeof(TSource), typeof (TDestination)); var func = _configurationProvider.GetMapperFunc(types); var destination = default(TDestination); - var context = new ResolutionContext(source, destination, types, _defaultMappingOptions, this); - - return func(source, destination, context); + return func(source, destination, DefaultContext); } TDestination IMapper.Map(TSource source, Action> opts) { - var types = TypePair.Create(source, null, typeof(TSource), typeof(TDestination)); + var types = TypePair.Create(source, typeof(TSource), typeof(TDestination)); - var func = _configurationProvider.GetMapperFunc(types); - - var destination = default(TDestination); + var key = new TypePair(typeof(TSource), typeof(TDestination)); var typedOptions = new MappingOperationOptions(_serviceCtor); opts(typedOptions); - var context = new ResolutionContext(source, destination, types, typedOptions, this); + var mapRequest = new MapRequest(key, types, typedOptions.InlineConfiguration); - return func(source, destination, context); + var func = _configurationProvider.GetMapperFunc(mapRequest); + + var destination = default(TDestination); + + typedOptions.BeforeMapAction(source, destination); + + var context = new ResolutionContext(typedOptions, this); + + destination = func(source, destination, context); + + typedOptions.AfterMapAction(source, destination); + + return destination; } TDestination IMapper.Map(TSource source, TDestination destination) @@ -245,49 +270,61 @@ TDestination IMapper.Map(TSource source, TDestination des var func = _configurationProvider.GetMapperFunc(types); - var context = new ResolutionContext(source, destination, types, _defaultMappingOptions, this); - - return func(source, destination, context); + return func(source, destination, DefaultContext); } TDestination IMapper.Map(TSource source, TDestination destination, Action> opts) { var types = TypePair.Create(source, destination, typeof(TSource), typeof(TDestination)); - - var func = _configurationProvider.GetMapperFunc(types); + var key = new TypePair(typeof(TSource), typeof(TDestination)); var typedOptions = new MappingOperationOptions(_serviceCtor); opts(typedOptions); - var context = new ResolutionContext(source, destination, types, typedOptions, this); + var mapRequest = new MapRequest(key, types, typedOptions.InlineConfiguration); - return func(source, destination, context); + var func = _configurationProvider.GetMapperFunc(mapRequest); + + typedOptions.BeforeMapAction(source, destination); + + var context = new ResolutionContext(typedOptions, this); + + destination = func(source, destination, context); + + typedOptions.AfterMapAction(source, destination); + + return destination; } object IMapper.Map(object source, Type sourceType, Type destinationType) { - var types = TypePair.Create(source, null, sourceType, destinationType); + var types = TypePair.Create(source, sourceType, destinationType); var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types)); - var context = new ResolutionContext(source, null, types, _defaultMappingOptions, this); - - return func(source, null, context); + return func(source, null, DefaultContext); } object IMapper.Map(object source, Type sourceType, Type destinationType, Action opts) { - var types = TypePair.Create(source, null, sourceType, destinationType); + var types = TypePair.Create(source, sourceType, destinationType); - var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types)); + var options = new ObjectMappingOperationOptions(_serviceCtor); - var options = new MappingOperationOptions(_serviceCtor); opts(options); - var context = new ResolutionContext(source, null, types, options, this); + var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types, options.InlineConfiguration)); + + options.BeforeMapAction(source, null); - return func(source, null, context); + var context = new ResolutionContext(options, this); + + var destination = func(source, null, context); + + options.AfterMapAction(source, destination); + + return destination; } object IMapper.Map(object source, object destination, Type sourceType, Type destinationType) @@ -296,9 +333,7 @@ object IMapper.Map(object source, object destination, Type sourceType, Type dest var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types)); - var context = new ResolutionContext(source, destination, types, _defaultMappingOptions, this); - - return func(source, destination, context); + return func(source, destination, DefaultContext); } object IMapper.Map(object source, object destination, Type sourceType, Type destinationType, @@ -306,84 +341,47 @@ object IMapper.Map(object source, object destination, Type sourceType, Type dest { var types = TypePair.Create(source, destination, sourceType, destinationType); - var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types)); + var options = new ObjectMappingOperationOptions(_serviceCtor); - var options = new MappingOperationOptions(_serviceCtor); opts(options); - var context = new ResolutionContext(source, destination, types, options, this); + var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types, options.InlineConfiguration)); - return func(source, destination, context); - } + options.BeforeMapAction(source, destination); - object IRuntimeMapper.Map(ResolutionContext context) - { - var types = TypePair.Create(context.SourceValue, context.DestinationValue, context.SourceType, context.DestinationType); + var context = new ResolutionContext(options, this); - var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(context.SourceType, context.DestinationType), types)); + destination = func(source, destination, context); - return func(context.SourceValue, context.DestinationValue, context); + options.AfterMapAction(source, destination); + + return destination; } - object IRuntimeMapper.Map(object source, object destination, Type sourceType, Type destinationType, ResolutionContext parent) + object IRuntimeMapper.Map(object source, object destination, Type sourceType, Type destinationType, + ResolutionContext context, IMemberMap memberMap) { var types = TypePair.Create(source, destination, sourceType, destinationType); - var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types)); - - var context = new ResolutionContext(source, destination, types, parent); + var func = _configurationProvider.GetUntypedMapperFunc(new MapRequest(new TypePair(sourceType, destinationType), types, memberMap)); return func(source, destination, context); } - TDestination IRuntimeMapper.Map(TSource source, TDestination destination, ResolutionContext parent) + TDestination IRuntimeMapper.Map(TSource source, TDestination destination, + ResolutionContext context, IMemberMap memberMap) { var types = TypePair.Create(source, destination, typeof(TSource), typeof(TDestination)); - var func = _configurationProvider.GetMapperFunc(types); - - var context = new ResolutionContext(source, destination, types, parent); + var func = _configurationProvider.GetMapperFunc(types, memberMap); return func(source, destination, context); } - object IRuntimeMapper.CreateObject(ResolutionContext context) - { - if(context.DestinationValue != null) - { - return context.DestinationValue; - } - return !_configurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(context.DestinationType) - : ObjectCreator.CreateObject(context.DestinationType); - } - - TDestination IRuntimeMapper.CreateObject(ResolutionContext context) - { - if (context.DestinationValue != null) - { - return (TDestination) context.DestinationValue; - } - return (TDestination) (!_configurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TDestination)) - : ObjectCreator.CreateObject(typeof(TDestination))); - } - - bool IRuntimeMapper.ShouldMapSourceValueAsNull(ResolutionContext context) - { - if (context.DestinationType.IsValueType() && !context.DestinationType.IsNullableType()) - return false; + IQueryable IMapper.ProjectTo(IQueryable source, object parameters, params Expression>[] membersToExpand) + => source.ProjectTo(_configurationProvider, parameters, membersToExpand); - var typeMap = context.GetContextTypeMap(); - - return typeMap?.Profile.AllowNullDestinationValues ?? _configurationProvider.AllowNullDestinationValues; - } - - bool IRuntimeMapper.ShouldMapSourceCollectionAsNull(ResolutionContext context) - { - var typeMap = context.GetContextTypeMap(); - - return typeMap?.Profile.AllowNullCollections ?? _configurationProvider.AllowNullCollections; - } + IQueryable IMapper.ProjectTo(IQueryable source, IDictionary parameters, params string[] membersToExpand) + => source.ProjectTo(_configurationProvider, parameters, membersToExpand); } } \ No newline at end of file diff --git a/src/AutoMapper/MapperConfiguration.cs b/src/AutoMapper/MapperConfiguration.cs index 389aacb118..18d9572b0a 100644 --- a/src/AutoMapper/MapperConfiguration.cs +++ b/src/AutoMapper/MapperConfiguration.cs @@ -1,400 +1,566 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Collections.Concurrent; - using System.Linq; - using System.Linq.Expressions; - using Configuration; - using Mappers; - using QueryableExtensions; - using QueryableExtensions.Impl; - using static System.Linq.Expressions.Expression; - using static ExpressionExtensions; - using UntypedMapperFunc = System.Func; - - - public class MapperConfiguration : IConfigurationProvider - { - private readonly IEnumerable _mappers; - private readonly TypeMapRegistry _typeMapRegistry = new TypeMapRegistry(); - private readonly ConcurrentDictionary _typeMapPlanCache = new ConcurrentDictionary(); - private readonly ConcurrentDictionary _mapPlanCache = new ConcurrentDictionary(); - private readonly ConfigurationValidator _validator; - private readonly Func _getTypeMap; - private readonly Func _createMapperFuncs; - private readonly MapperConfigurationExpression _mapperConfigurationExpression; - - public MapperConfiguration(MapperConfigurationExpression configurationExpression) - : this(configurationExpression, MapperRegistry.Mappers) - { - - } - - public MapperConfiguration(MapperConfigurationExpression configurationExpression, IEnumerable mappers) - { - _mappers = mappers; - _getTypeMap = GetTypeMap; - _createMapperFuncs = CreateMapperFuncs; - - _validator = new ConfigurationValidator(this); - ExpressionBuilder = new ExpressionBuilder(this); - - _mapperConfigurationExpression = configurationExpression; - - Seal(_mapperConfigurationExpression); - } - - public MapperConfiguration(Action configure) : this(configure, MapperRegistry.Mappers) - { - } - - public MapperConfiguration(Action configure, IEnumerable mappers) - : this(Build(configure), mappers) - { - } - - public IExpressionBuilder ExpressionBuilder { get; } - - public Func ServiceCtor { get; private set; } - - public bool AllowNullDestinationValues { get; private set; } - - public bool AllowNullCollections { get; private set; } - - public Func GetMapperFunc(TypePair types) - { - var key = new TypePair(typeof(TSource), typeof(TDestination)); - var mapRequest = new MapRequest(key, types); - return (Func)GetMapperFunc(mapRequest); - } - - public Delegate GetMapperFunc(MapRequest mapRequest) - { - return _mapPlanCache.GetOrAdd(mapRequest, _createMapperFuncs).Typed; - } - - public UntypedMapperFunc GetUntypedMapperFunc(MapRequest mapRequest) - { - return _mapPlanCache.GetOrAdd(mapRequest, _createMapperFuncs).Untyped; - } - - private MapperFuncs CreateMapperFuncs(MapRequest mapRequest) - { - var typeMap = ResolveTypeMap(mapRequest.RuntimeTypes); - if (typeMap != null) - { - return new MapperFuncs(mapRequest, typeMap); - } - var mapperToUse = _mappers.FirstOrDefault(om => om.IsMatch(mapRequest.RuntimeTypes)); - return new MapperFuncs(mapRequest, mapperToUse); - } - - public TypeMap[] GetAllTypeMaps() => _typeMapRegistry.TypeMaps.ToArray(); - - public TypeMap FindTypeMapFor(Type sourceType, Type destinationType) => FindTypeMapFor(new TypePair(sourceType, destinationType)); - - public TypeMap FindTypeMapFor() => FindTypeMapFor(new TypePair(typeof(TSource), typeof(TDestination))); - - public TypeMap FindTypeMapFor(TypePair typePair) => _typeMapRegistry.GetTypeMap(typePair); - - public TypeMap ResolveTypeMap(Type sourceType, Type destinationType) - { - var typePair = new TypePair(sourceType, destinationType); - - return ResolveTypeMap(typePair); - } - - public TypeMap ResolveTypeMap(TypePair typePair) - { - var typeMap = _typeMapPlanCache.GetOrAdd(typePair, _getTypeMap); - return typeMap; - } - - private TypeMap GetTypeMap(TypePair pair) - { - foreach (var tp in pair.GetRelatedTypePairs()) - { - var typeMap = - _typeMapPlanCache.GetOrDefault(tp) ?? - FindTypeMapFor(tp) ?? - (!CoveredByObjectMap(pair) ? FindConventionTypeMapFor(tp) : null) ?? - FindClosedGenericTypeMapFor(tp, pair); - if (typeMap != null) - { - return typeMap; - } - } - return null; - } - - public TypeMap ResolveTypeMap(object source, object destination, Type sourceType, Type destinationType) - { - return ResolveTypeMap(source?.GetType() ?? sourceType, destination?.GetType() ?? destinationType) - ?? ResolveTypeMap(sourceType, destinationType); - } - - public void AssertConfigurationIsValid(TypeMap typeMap) - { - _validator.AssertConfigurationIsValid(Enumerable.Repeat(typeMap, 1)); - } - - public void AssertConfigurationIsValid(string profileName) - { - _validator.AssertConfigurationIsValid(_typeMapRegistry.TypeMaps.Where(typeMap => typeMap.Profile.ProfileName == profileName)); - } - - public void AssertConfigurationIsValid() - where TProfile : Profile, new() - { - AssertConfigurationIsValid(new TProfile().ProfileName); - } - - public void AssertConfigurationIsValid() - { - _validator.AssertConfigurationIsValid(_typeMapRegistry.TypeMaps.Where(tm => !tm.SourceType.IsGenericTypeDefinition() && !tm.DestinationType.IsGenericTypeDefinition())); - } - - public IMapper CreateMapper() => new Mapper(this); - - public IMapper CreateMapper(Func serviceCtor) => new Mapper(this, serviceCtor); - - public IEnumerable GetMappers() => _mappers; - - private static MapperConfigurationExpression Build(Action configure) - { - var expr = new MapperConfigurationExpression(); - configure(expr); - return expr; - } - - private void Seal(IMapperConfigurationExpression configuration) - { - ServiceCtor = configuration.ServiceCtor; - AllowNullDestinationValues = configuration.AllowNullDestinationValues; - AllowNullCollections = configuration.AllowNullCollections; - - var derivedMaps = new List>(); - var redirectedTypes = new List>(); - - foreach (var profile in configuration.Profiles.Cast()) - { - profile.Register(_typeMapRegistry); - } - - foreach (var action in configuration.AllTypeMapActions) - { - foreach (var typeMap in _typeMapRegistry.TypeMaps) - { - var expression = new MappingExpression(typeMap.Types, typeMap.ConfiguredMemberList); - - action(typeMap, expression); - - expression.Configure(typeMap.Profile, typeMap); - } - } - - foreach (var profile in configuration.Profiles.Cast()) - { - profile.Configure(_typeMapRegistry); - } - - foreach (var typeMap in _typeMapRegistry.TypeMaps) - { - _typeMapPlanCache[typeMap.Types] = typeMap; - - if (typeMap.DestinationTypeOverride != null) - { - redirectedTypes.Add(Tuple.Create(typeMap.Types, new TypePair(typeMap.SourceType, typeMap.DestinationTypeOverride))); - } - if (typeMap.SourceType.IsNullableType()) - { - var nonNullableTypes = new TypePair(Nullable.GetUnderlyingType(typeMap.SourceType), typeMap.DestinationType); - redirectedTypes.Add(Tuple.Create(nonNullableTypes, typeMap.Types)); - } - derivedMaps.AddRange(GetDerivedTypeMaps(typeMap).Select(derivedMap => Tuple.Create(new TypePair(derivedMap.SourceType, typeMap.DestinationType), derivedMap))); - } - foreach (var redirectedType in redirectedTypes) - { - var derivedMap = FindTypeMapFor(redirectedType.Item2); - if (derivedMap != null) - { - _typeMapPlanCache[redirectedType.Item1] = derivedMap; - } - } - foreach (var derivedMap in derivedMaps.Where(derivedMap => !_typeMapPlanCache.ContainsKey(derivedMap.Item1))) - { - _typeMapPlanCache[derivedMap.Item1] = derivedMap.Item2; - } - - foreach (var typeMap in _typeMapRegistry.TypeMaps) - { - typeMap.Seal(_typeMapRegistry, this); - } - } - - - private IEnumerable GetDerivedTypeMaps(TypeMap typeMap) - { - foreach (var derivedTypes in typeMap.IncludedDerivedTypes) - { - var derivedMap = FindTypeMapFor(derivedTypes); - if (derivedMap == null) - { - throw QueryMapperHelper.MissingMapException(derivedTypes.SourceType, derivedTypes.DestinationType); - } - yield return derivedMap; - foreach (var derivedTypeMap in GetDerivedTypeMaps(derivedMap)) - { - yield return derivedTypeMap; - } - } - } - - private bool CoveredByObjectMap(TypePair typePair) - { - return GetMappers().FirstOrDefault(m => m.IsMatch(typePair)) != null; - } - - private TypeMap FindConventionTypeMapFor(TypePair typePair) - { - var typeMap = _mapperConfigurationExpression.Profiles - .Cast() - .Select(p => p.ConfigureConventionTypeMap(_typeMapRegistry, typePair)) - .FirstOrDefault(t => t != null); - - typeMap?.Seal(_typeMapRegistry, this); - - return typeMap; - } - - private TypeMap FindClosedGenericTypeMapFor(TypePair typePair, TypePair requestedTypes) - { - if (typePair.GetOpenGenericTypePair() == null) - return null; - - var typeMap = _mapperConfigurationExpression.Profiles - .Cast() - .Select(p => p.ConfigureClosedGenericTypeMap(_typeMapRegistry, typePair, requestedTypes)) - .FirstOrDefault(t => t != null); - - typeMap?.Seal(_typeMapRegistry, this); - - return typeMap; - } - - struct MapperFuncs - { - private Lazy _untyped; - - public Delegate Typed { get; } - - public UntypedMapperFunc Untyped => _untyped.Value; - - public MapperFuncs(MapRequest mapRequest, TypeMap typeMap) : this(mapRequest, GenerateTypeMapExpression(mapRequest, typeMap)) - { - } - - public MapperFuncs(MapRequest mapRequest, IObjectMapper mapperToUse) : this(mapRequest, GenerateObjectMapperExpression(mapRequest, mapperToUse)) - { - } - - public MapperFuncs(MapRequest mapRequest, LambdaExpression typedExpression) - { - Typed = typedExpression.Compile(); - _untyped = new Lazy(() => Wrap(mapRequest, typedExpression).Compile()); - } - - private static Expression Wrap(MapRequest mapRequest, LambdaExpression typedExpression) - { - var sourceParameter = Parameter(typeof(object), "src"); - var destinationParameter = Parameter(typeof(object), "dest"); - var contextParameter = Parameter(typeof(ResolutionContext), "ctxt"); - var requestedSourceType = mapRequest.RequestedTypes.SourceType; - var requestedDestinationType = mapRequest.RequestedTypes.DestinationType; - - var destination = requestedDestinationType.IsValueType() ? Coalesce(destinationParameter, New(requestedDestinationType)) : (Expression)destinationParameter; - return Lambda( - ToType( - Invoke(typedExpression, ToType(sourceParameter, requestedSourceType), ToType(destination, requestedDestinationType), contextParameter) - , typeof(object)), - sourceParameter, destinationParameter, contextParameter); - } - - private static LambdaExpression GenerateTypeMapExpression(MapRequest mapRequest, TypeMap typeMap) - { - var mapExpression = typeMap.MapExpression; - var typeMapSourceParameter = mapExpression.Parameters[0]; - var typeMapDestinationParameter = mapExpression.Parameters[1]; - var requestedSourceType = mapRequest.RequestedTypes.SourceType; - var requestedDestinationType = mapRequest.RequestedTypes.DestinationType; - - if (typeMapSourceParameter.Type != requestedSourceType || typeMapDestinationParameter.Type != requestedDestinationType) - { - var requestedSourceParameter = Parameter(requestedSourceType, "src"); - var requestedDestinationParameter = Parameter(requestedDestinationType, "dest"); - var contextParameter = Parameter(typeof(ResolutionContext), "ctxt"); - - mapExpression = Lambda(ToType(Invoke(typeMap.MapExpression, - ToType(requestedSourceParameter, typeMapSourceParameter.Type), - ToType(requestedDestinationParameter, typeMapDestinationParameter.Type), - contextParameter - ), mapRequest.RuntimeTypes.DestinationType), - requestedSourceParameter, requestedDestinationParameter, contextParameter); - } - - return mapExpression; - } - - private static LambdaExpression GenerateObjectMapperExpression(MapRequest mapRequest, IObjectMapper mapperToUse) - { - var destinationType = mapRequest.RequestedTypes.DestinationType; - - var source = Parameter(mapRequest.RequestedTypes.SourceType, "source"); - var destination = Parameter(destinationType, "destination"); - var context = Parameter(typeof(ResolutionContext), "context"); - - var ctor = (from c in typeof(AutoMapperMappingException).GetConstructors() - let parameters = c.GetParameters() - where parameters.Length == 2 && parameters[0].ParameterType == typeof(ResolutionContext) && parameters[1].ParameterType == typeof(string) - select c).Single(); - - LambdaExpression fullExpression; - if (mapperToUse == null) - { - var message = Constant("Missing type map configuration or unsupported mapping."); - fullExpression = Lambda(Block(Throw(New(ctor, context, message)), Default(destinationType)), source, destination, context); - } - else - { - var map = Call(Constant(mapperToUse), "Map", new Type[0], context); - var mapToDestination = Lambda(ToType(map, destinationType), context); - fullExpression = TryCatch(mapToDestination, source, destination, context); - } - return fullExpression; - } - - private static LambdaExpression TryCatch(LambdaExpression mapExpression, ParameterExpression source, ParameterExpression destination, ParameterExpression context) - { - var autoMapException = Parameter(typeof(AutoMapperMappingException), "ex"); - var exception = Parameter(typeof(Exception), "ex"); - - var mappingExceptionCtor = - (from c in typeof(AutoMapperMappingException).GetConstructors() - let parameters = c.GetParameters() - where parameters.Length == 2 && parameters[0].ParameterType == typeof(ResolutionContext) && parameters[1].ParameterType == typeof(Exception) - select c).Single(); - - return Lambda(Expression.TryCatch(mapExpression.Body, - MakeCatchBlock(typeof(AutoMapperMappingException), autoMapException, - Block(Assign(Property(autoMapException, "Context"), context), - Rethrow(), - Default(destination.Type)), null), - MakeCatchBlock(typeof(Exception), exception, Block( - Throw(New(mappingExceptionCtor, context, exception)), - Default(destination.Type)), null)), - source, destination, context); - } - } - } -} +using AutoMapper.Configuration; +using AutoMapper.Features; +using AutoMapper.Internal; +using AutoMapper.QueryableExtensions; +using AutoMapper.QueryableExtensions.Impl; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper +{ + using static Execution.ExpressionBuilder; + using static Expression; + using static ExpressionFactory; + using UntypedMapperFunc = Func; + using Validator = Action; + + public class MapperConfiguration : IConfigurationProvider + { + private static readonly Type[] ExcludedTypes = { typeof(object), typeof(ValueType), typeof(Enum) }; + private static readonly ConstructorInfo ExceptionConstructor = typeof(AutoMapperMappingException).GetDeclaredConstructors().Single(c => c.GetParameters().Length == 3); + + private readonly IEnumerable _mappers; + private readonly Dictionary _typeMapRegistry = new Dictionary(); + private LockingConcurrentDictionary _typeMapPlanCache; + private readonly LockingConcurrentDictionary _mapPlanCache; + private readonly ConfigurationValidator _validator; + private readonly MapperConfigurationExpressionValidator _expressionValidator; + + public MapperConfiguration(MapperConfigurationExpression configurationExpression) + { + _mappers = configurationExpression.Mappers.ToArray(); + _typeMapPlanCache = new LockingConcurrentDictionary(GetTypeMap); + _mapPlanCache = new LockingConcurrentDictionary(CreateMapperFuncs); + Validators = configurationExpression.Advanced.GetValidators(); + _validator = new ConfigurationValidator(this); + _expressionValidator = new MapperConfigurationExpressionValidator(configurationExpression); + ExpressionBuilder = new ExpressionBuilder(this); + + ServiceCtor = configurationExpression.ServiceCtor; + + EnableNullPropagationForQueryMapping = configurationExpression.EnableNullPropagationForQueryMapping ?? false; + + MaxExecutionPlanDepth = configurationExpression.Advanced.MaxExecutionPlanDepth + 1; + ResultConverters = configurationExpression.Advanced.QueryableResultConverters.ToArray(); + Binders = configurationExpression.Advanced.QueryableBinders.ToArray(); + + Configuration = new ProfileMap(configurationExpression); + Profiles = new[] { Configuration }.Concat(configurationExpression.Profiles.Select(p => new ProfileMap(p, configurationExpression))).ToArray(); + + configurationExpression.Features.Configure(this); + + foreach (var beforeSealAction in configurationExpression.Advanced.BeforeSealActions) + beforeSealAction?.Invoke(this); + Seal(); + } + + + public MapperConfiguration(Action configure) + : this(Build(configure)) + { + } + + + public void Validate(ValidationContext context) + { + foreach (var validator in Validators) + { + validator(context); + } + } + + private Validator[] Validators { get; } + + public IExpressionBuilder ExpressionBuilder { get; } + + public Func ServiceCtor { get; } + + public bool EnableNullPropagationForQueryMapping { get; } + + public int MaxExecutionPlanDepth { get; } + + private ProfileMap Configuration { get; } + + public IEnumerable Profiles { get; } + + public IEnumerable ResultConverters { get; } + + public IEnumerable Binders { get; } + + public Features Features { get; } = new Features(); + + public Func GetMapperFunc( + TypePair types, IMemberMap memberMap = null) + { + var key = new TypePair(typeof(TSource), typeof(TDestination)); + var mapRequest = new MapRequest(key, types, memberMap); + return GetMapperFunc(mapRequest); + } + + public Func GetMapperFunc(MapRequest mapRequest) + => (Func)GetMapperFunc(mapRequest); + + public void CompileMappings() + { + foreach (var request in _typeMapPlanCache.Keys.Where(t => !t.IsGenericTypeDefinition).Select(types => new MapRequest(types, types)).ToArray()) + { + GetMapperFunc(request); + } + } + + public Delegate GetMapperFunc(MapRequest mapRequest) => _mapPlanCache.GetOrAdd(mapRequest).Typed; + + public UntypedMapperFunc GetUntypedMapperFunc(MapRequest mapRequest) => _mapPlanCache.GetOrAdd(mapRequest).Untyped; + + private MapperFuncs CreateMapperFuncs(MapRequest mapRequest) => new MapperFuncs(mapRequest, BuildExecutionPlan(mapRequest)); + + public LambdaExpression BuildExecutionPlan(Type sourceType, Type destinationType) + { + var typePair = new TypePair(sourceType, destinationType); + return BuildExecutionPlan(new MapRequest(typePair, typePair)); + } + + public LambdaExpression BuildExecutionPlan(MapRequest mapRequest) + { + var typeMap = ResolveTypeMap(mapRequest.RuntimeTypes, mapRequest.InlineConfig) ?? ResolveTypeMap(mapRequest.RequestedTypes, mapRequest.InlineConfig); + if (typeMap != null) + { + return GenerateTypeMapExpression(mapRequest, typeMap); + } + var mapperToUse = FindMapper(mapRequest.RuntimeTypes); + return GenerateObjectMapperExpression(mapRequest, mapperToUse); + } + + private static LambdaExpression GenerateTypeMapExpression(MapRequest mapRequest, TypeMap typeMap) + { + var mapExpression = typeMap.MapExpression; + var typeMapSourceParameter = mapExpression.Parameters[0]; + var typeMapDestinationParameter = mapExpression.Parameters[1]; + var requestedSourceType = mapRequest.RequestedTypes.SourceType; + var requestedDestinationType = mapRequest.RequestedTypes.DestinationType; + + if (typeMapSourceParameter.Type != requestedSourceType || typeMapDestinationParameter.Type != requestedDestinationType) + { + var requestedSourceParameter = Parameter(requestedSourceType, "source"); + var requestedDestinationParameter = Parameter(requestedDestinationType, "typeMapDestination"); + var contextParameter = Parameter(typeof(ResolutionContext), "context"); + + mapExpression = Lambda(ToType(Invoke(typeMap.MapExpression, + ToType(requestedSourceParameter, typeMapSourceParameter.Type), + ToType(requestedDestinationParameter, typeMapDestinationParameter.Type), + contextParameter + ), mapRequest.RuntimeTypes.DestinationType), + requestedSourceParameter, requestedDestinationParameter, contextParameter); + } + + return mapExpression; + } + + private LambdaExpression GenerateObjectMapperExpression(MapRequest mapRequest, IObjectMapper mapperToUse) + { + var destinationType = mapRequest.RequestedTypes.DestinationType; + + var source = Parameter(mapRequest.RequestedTypes.SourceType, "source"); + var destination = Parameter(destinationType, "mapperDestination"); + var context = Parameter(typeof(ResolutionContext), "context"); + Expression fullExpression; + if (mapperToUse == null) + { + var message = Constant("Missing type map configuration or unsupported mapping."); + fullExpression = Block(Throw(New(ExceptionConstructor, message, Constant(null, typeof(Exception)), Constant(mapRequest.RequestedTypes))), Default(destinationType)); + } + else + { + var map = mapperToUse.MapExpression(this, Configuration, mapRequest.MemberMap, + ToType(source, mapRequest.RuntimeTypes.SourceType), + ToType(destination, mapRequest.RuntimeTypes.DestinationType), + context); + var exception = Parameter(typeof(Exception), "ex"); + fullExpression = + TryCatch(ToType(map, destinationType), + MakeCatchBlock(typeof(Exception), exception, Block( + Throw(New(ExceptionConstructor, Constant("Error mapping types."), exception, Constant(mapRequest.RequestedTypes))), + Default(destination.Type)), null)); + } + var profileMap = mapRequest.MemberMap?.TypeMap?.Profile ?? Configuration; + var nullCheckSource = NullCheckSource(profileMap, source, destination, fullExpression, mapRequest.MemberMap); + return Lambda(nullCheckSource, source, destination, context); + } + + public TypeMap[] GetAllTypeMaps() => _typeMapRegistry.Values.ToArray(); + + public TypeMap FindTypeMapFor(Type sourceType, Type destinationType) => FindTypeMapFor(new TypePair(sourceType, destinationType)); + + public TypeMap FindTypeMapFor() => FindTypeMapFor(new TypePair(typeof(TSource), typeof(TDestination))); + + public TypeMap FindTypeMapFor(TypePair typePair) => _typeMapRegistry.GetOrDefault(typePair); + + public TypeMap ResolveTypeMap(Type sourceType, Type destinationType) + { + var typePair = new TypePair(sourceType, destinationType); + + return ResolveTypeMap(typePair, new DefaultTypeMapConfig(typePair)); + } + + public TypeMap ResolveTypeMap(Type sourceType, Type destinationType, ITypeMapConfiguration inlineConfiguration) + { + var typePair = new TypePair(sourceType, destinationType); + + return ResolveTypeMap(typePair, inlineConfiguration); + } + + public TypeMap ResolveTypeMap(TypePair typePair) + => ResolveTypeMap(typePair, new DefaultTypeMapConfig(typePair)); + + public TypeMap ResolveTypeMap(TypePair typePair, ITypeMapConfiguration inlineConfiguration) + { + var typeMap = _typeMapPlanCache.GetOrAdd(typePair); + // if it's a dynamically created type map, we need to seal it outside GetTypeMap to handle recursion + if (typeMap != null && typeMap.MapExpression == null && _typeMapRegistry.GetOrDefault(typePair) == null) + { + lock (typeMap) + { + inlineConfiguration.Configure(typeMap); + typeMap.Seal(this); + if (typeMap.IsClosedGeneric) + { + AssertConfigurationIsValid(typeMap); + } + } + } + return typeMap; + } + + private TypeMap GetTypeMap(TypePair initialTypes) + { + var doesNotHaveMapper = FindMapper(initialTypes) == null; + + foreach (var types in initialTypes.GetRelatedTypePairs()) + { + var typeMap = GetCachedMap(initialTypes, types); + if (typeMap != null) + { + return typeMap; + } + typeMap = FindTypeMapFor(types); + if (typeMap != null) + { + return typeMap; + } + typeMap = FindClosedGenericTypeMapFor(initialTypes, types); + if (typeMap != null) + { + return typeMap; + } + if (doesNotHaveMapper) + { + typeMap = FindConventionTypeMapFor(types); + if (typeMap != null) + { + return typeMap; + } + } + } + + if (doesNotHaveMapper + && Configuration.CreateMissingTypeMaps + && !(initialTypes.SourceType.IsAbstract() && initialTypes.SourceType.IsClass()) + && !(initialTypes.DestinationType.IsAbstract() && initialTypes.DestinationType.IsClass()) + && !ExcludedTypes.Contains(initialTypes.SourceType) + && !ExcludedTypes.Contains(initialTypes.DestinationType)) + { + lock (this) + { + return Configuration.CreateInlineMap(initialTypes, this); + } + } + + return null; + } + + private TypeMap GetCachedMap(TypePair initialTypes, TypePair types) => (types != initialTypes && _typeMapPlanCache.TryGetValue(types, out var typeMap)) ? typeMap : null; + + public void AssertConfigurationIsValid(TypeMap typeMap) + { + _validator.AssertConfigurationIsValid(Enumerable.Repeat(typeMap, 1)); + } + + public void AssertConfigurationIsValid(string profileName) + { + if (Profiles.All(x => x.Name != profileName)) + { + throw new ArgumentOutOfRangeException(nameof(profileName), $"Cannot find any profiles with the name '{profileName}'."); + } + + _validator.AssertConfigurationIsValid(_typeMapRegistry.Values.Where(typeMap => typeMap.Profile.Name == profileName)); + } + + public void AssertConfigurationIsValid() + where TProfile : Profile, new() + { + AssertConfigurationIsValid(new TProfile().ProfileName); + } + + public void AssertConfigurationIsValid() + { + _expressionValidator.AssertConfigurationExpressionIsValid(); + + _validator.AssertConfigurationIsValid(_typeMapRegistry.Values); + } + + public IMapper CreateMapper() => new Mapper(this); + + public IMapper CreateMapper(Func serviceCtor) => new Mapper(this, serviceCtor); + + public IEnumerable GetMappers() => _mappers; + + private static MapperConfigurationExpression Build(Action configure) + { + var expr = new MapperConfigurationExpression(); + configure(expr); + return expr; + } + + private void Seal() + { + var derivedMaps = new List>(); + var redirectedTypes = new List>(); + + foreach (var profile in Profiles) + { + profile.Register(this); + } + + foreach (var typeMap in _typeMapRegistry.Values.Where(tm => tm.IncludeAllDerivedTypes)) + { + foreach (var derivedMap in _typeMapRegistry + .Where(tm => + typeMap.SourceType.IsAssignableFrom(tm.Key.SourceType) && + typeMap.DestinationType.IsAssignableFrom(tm.Key.DestinationType) && + typeMap != tm.Value) + .Select(tm => tm.Value)) + { + typeMap.IncludeDerivedTypes(derivedMap.SourceType, derivedMap.DestinationType); + } + } + + foreach (var profile in Profiles) + { + profile.Configure(this); + } + + foreach (var typeMap in _typeMapRegistry.Values) + { + _typeMapPlanCache[typeMap.Types] = typeMap; + + if (typeMap.DestinationTypeOverride != null) + { + redirectedTypes.Add(Tuple.Create(typeMap.Types, new TypePair(typeMap.SourceType, typeMap.DestinationTypeOverride))); + } + derivedMaps.AddRange(GetDerivedTypeMaps(typeMap).Select(derivedMap => Tuple.Create(new TypePair(derivedMap.SourceType, typeMap.DestinationType), derivedMap))); + } + foreach (var redirectedType in redirectedTypes) + { + var derivedMap = FindTypeMapFor(redirectedType.Item2); + if (derivedMap != null) + { + _typeMapPlanCache[redirectedType.Item1] = derivedMap; + } + } + foreach (var derivedMap in derivedMaps.Where(derivedMap => !_typeMapPlanCache.ContainsKey(derivedMap.Item1))) + { + _typeMapPlanCache[derivedMap.Item1] = derivedMap.Item2; + } + + foreach (var typeMap in _typeMapRegistry.Values) + { + typeMap.Seal(this); + } + + Features.Seal(this); + } + + private IEnumerable GetDerivedTypeMaps(TypeMap typeMap) + { + foreach (var derivedMap in GetIncludedTypeMaps(typeMap.IncludedDerivedTypes)) + { + yield return derivedMap; + foreach (var derivedTypeMap in GetDerivedTypeMaps(derivedMap)) + { + yield return derivedTypeMap; + } + } + } + + public IEnumerable GetIncludedTypeMaps(IEnumerable includedTypes) + { + foreach (var pair in includedTypes) + { + var typeMap = FindTypeMapFor(pair); + if (typeMap != null) + { + yield return typeMap; + } + else + { + typeMap = ResolveTypeMap(pair); + // we want the exact map the user included, but we could instantiate an open generic + if (typeMap == null || typeMap.Types != pair || typeMap.IsConventionMap) + { + throw QueryMapperHelper.MissingMapException(pair); + } + yield return typeMap; + } + } + } + + private TypeMap FindConventionTypeMapFor(TypePair typePair) + { + var profile = Profiles.FirstOrDefault(p => p.IsConventionMap(typePair)); + if (profile == null) + { + return null; + } + TypeMap typeMap; + lock (this) + { + typeMap = profile.CreateConventionTypeMap(typePair, this); + } + return typeMap; + } + + private TypeMap FindClosedGenericTypeMapFor(TypePair initialTypes, TypePair typePair) + { + var genericTypePair = typePair.GetOpenGenericTypePair(); + if (genericTypePair == null) + { + return null; + } + ITypeMapConfiguration genericMap; + ProfileMap profile; + TypeMap cachedMap = null; + var userMap = FindTypeMapFor(genericTypePair.Value); + if (userMap?.DestinationTypeOverride != null) + { + genericTypePair = new TypePair(genericTypePair.Value.SourceType, userMap.DestinationTypeOverride).GetOpenGenericTypePair(); + if (genericTypePair == null) + { + return null; + } + userMap = null; + } + if (userMap == null && (cachedMap = GetCachedMap(initialTypes, genericTypePair.Value)) != null) + { + if (!cachedMap.Types.IsGeneric) + { + return cachedMap; + } + + genericMap = cachedMap.Profile.GetGenericMap(cachedMap.Types); + profile = cachedMap.Profile; + typePair = cachedMap.Types.CloseGenericTypes(typePair); + } + else if (userMap == null) + { + var item = Profiles + .Select(p => new { GenericMap = p.GetGenericMap(typePair), Profile = p }) + .FirstOrDefault(p => p.GenericMap != null); + genericMap = item?.GenericMap; + profile = item?.Profile; + } + else + { + genericMap = userMap.Profile.GetGenericMap(typePair); + profile = userMap.Profile; + } + + if (genericMap == null) + { + return null; + } + TypeMap typeMap; + lock (this) + { + typeMap = profile.CreateClosedGenericTypeMap(genericMap, typePair, this); + } + cachedMap?.CopyInheritedMapsTo(typeMap); + return typeMap; + } + + public IObjectMapper FindMapper(TypePair types) => _mappers.FirstOrDefault(m => m.IsMatch(types)); + + public void RegisterTypeMap(TypeMap typeMap) => _typeMapRegistry[typeMap.Types] = typeMap; + + internal struct MapperFuncs + { + public Delegate Typed { get; } + public UntypedMapperFunc Untyped { get; } + + public MapperFuncs(MapRequest mapRequest, LambdaExpression typedExpression) + { + Typed = typedExpression.Compile(); + Untyped = Wrap(mapRequest, Typed).Compile(); + } + + private static Expression Wrap(MapRequest mapRequest, Delegate typedDelegate) + { + var sourceParameter = Parameter(typeof(object), "source"); + var destinationParameter = Parameter(typeof(object), "destination"); + var contextParameter = Parameter(typeof(ResolutionContext), "context"); + var requestedSourceType = mapRequest.RequestedTypes.SourceType; + var requestedDestinationType = mapRequest.RequestedTypes.DestinationType; + + var destination = requestedDestinationType.IsValueType() ? Coalesce(destinationParameter, New(requestedDestinationType)) : (Expression)destinationParameter; + // Invoking a delegate here + return Lambda( + ToType( + Invoke(Constant(typedDelegate), ToType(sourceParameter, requestedSourceType), ToType(destination, requestedDestinationType), contextParameter) + , typeof(object)), + sourceParameter, destinationParameter, contextParameter); + } + } + + internal class DefaultTypeMapConfig : ITypeMapConfiguration + { + public DefaultTypeMapConfig(TypePair types) + { + Types = types; + } + + public void Configure(TypeMap typeMap) { } + + public Type SourceType => Types.SourceType; + public Type DestinationType => Types.DestinationType; + public bool IsOpenGeneric => false; + public TypePair Types { get; } + public ITypeMapConfiguration ReverseTypeMap => null; + } + } + + public struct ValidationContext + { + public IObjectMapper ObjectMapper { get; } + public PropertyMap PropertyMap { get; } + public TypeMap TypeMap { get; } + public TypePair Types { get; } + + public ValidationContext(TypePair types, PropertyMap propertyMap, IObjectMapper objectMapper) : this(types, propertyMap, objectMapper, null) + { + } + + public ValidationContext(TypePair types, PropertyMap propertyMap, TypeMap typeMap) : this(types, propertyMap, null, typeMap) + { + } + + private ValidationContext(TypePair types, PropertyMap propertyMap, IObjectMapper objectMapper, TypeMap typeMap) + { + ObjectMapper = objectMapper; + TypeMap = typeMap; + Types = types; + PropertyMap = propertyMap; + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/MapperConfigurationExpressionValidator.cs b/src/AutoMapper/MapperConfigurationExpressionValidator.cs new file mode 100644 index 0000000000..01e5f2b0e3 --- /dev/null +++ b/src/AutoMapper/MapperConfigurationExpressionValidator.cs @@ -0,0 +1,34 @@ +using System.Linq; +using AutoMapper.Configuration; + +namespace AutoMapper +{ + public class MapperConfigurationExpressionValidator + { + private readonly MapperConfigurationExpression _expression; + + public MapperConfigurationExpressionValidator(MapperConfigurationExpression expression) + { + _expression = expression; + } + + public void AssertConfigurationExpressionIsValid() + { + if (_expression.Advanced.AllowAdditiveTypeMapCreation) + return; + + var duplicateTypeMapConfigs = Enumerable.Concat(new [] {_expression}, _expression.Profiles) + .SelectMany(p => p.TypeMapConfigs, (profile, typeMap) => new {profile, typeMap}) + .GroupBy(x => x.typeMap.Types) + .Where(g => g.Count() > 1) + .Select(g => new { TypePair = g.Key, ProfileNames = g.Select(tmc => tmc.profile.ProfileName).ToArray() }) + .Select(g => new DuplicateTypeMapConfigurationException.TypeMapConfigErrors(g.TypePair, g.ProfileNames)) + .ToArray(); + + if (duplicateTypeMapConfigs.Any()) + { + throw new DuplicateTypeMapConfigurationException(duplicateTypeMapConfigs); + } + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ArrayCopyMapper.cs b/src/AutoMapper/Mappers/ArrayCopyMapper.cs new file mode 100644 index 0000000000..c383784b10 --- /dev/null +++ b/src/AutoMapper/Mappers/ArrayCopyMapper.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static ExpressionFactory; + using static CollectionMapperExpressionFactory; + + public class ArrayCopyMapper : ArrayMapper + { + private static readonly Expression ArrayCopyExpression = () => Array.Copy(default, default, default(long)); + private static readonly Expression> ArrayLengthExpression = arr => arr.LongLength; + + private static readonly MethodInfo ArrayCopyMethod = ((MethodCallExpression)ArrayCopyExpression.Body).Method; + private static readonly PropertyInfo ArrayLengthProperty = (PropertyInfo) ((MemberExpression)ArrayLengthExpression.Body).Member; + + public override bool IsMatch(TypePair context) => + context.DestinationType.IsArray + && context.SourceType.IsArray + && ElementTypeHelper.GetElementType(context.DestinationType) == ElementTypeHelper.GetElementType(context.SourceType) + && ElementTypeHelper.GetElementType(context.SourceType).IsPrimitive(); + + public override Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + { + var destElementType = ElementTypeHelper.GetElementType(destExpression.Type); + var sourceElementType = ElementTypeHelper.GetElementType(sourceExpression.Type); + + if (configurationProvider.FindTypeMapFor(sourceElementType, destElementType) != null) + return base.MapExpression(configurationProvider, profileMap, memberMap, sourceExpression, destExpression, contextExpression); + + var valueIfNullExpr = profileMap.AllowNullCollections + ? (Expression) Constant(null, destExpression.Type) + : NewArrayBounds(destElementType, Constant(0)); + + var dest = Parameter(destExpression.Type, "destArray"); + var sourceLength = Parameter(ArrayLengthProperty.PropertyType, "sourceLength"); + var mapExpr = Block( + new[] {dest, sourceLength}, + Assign(sourceLength, Property(sourceExpression, ArrayLengthProperty)), + Assign(dest, NewArrayBounds(destElementType, sourceLength)), + Call(ArrayCopyMethod, sourceExpression, dest, sourceLength), + dest + ); + + return Condition(Equal(sourceExpression, Constant(null)), valueIfNullExpr, mapExpr); + + } + } +} diff --git a/src/AutoMapper/Mappers/ArrayMapper.cs b/src/AutoMapper/Mappers/ArrayMapper.cs index d76d0690eb..756e258915 100644 --- a/src/AutoMapper/Mappers/ArrayMapper.cs +++ b/src/AutoMapper/Mappers/ArrayMapper.cs @@ -1,66 +1,58 @@ -using System.Collections; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; namespace AutoMapper.Mappers { - using System; - using System.Reflection; - using Configuration; + using static Expression; + using static ExpressionFactory; + using static CollectionMapperExpressionFactory; - public class ArrayMapper : IObjectMapExpression + public class ArrayMapper : EnumerableMapperBase { - public static TDestination Map(TSource source, ResolutionContext context) - where TSource : IEnumerable - where TDestination : class - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; - - var destElementType = TypeHelper.GetElementType(typeof (TDestination)); - - if (!context.IsSourceValueNull && context.DestinationType.IsAssignableFrom(context.SourceType)) - { - var elementTypeMap = context.ConfigurationProvider.ResolveTypeMap(typeof(TSourceElement), destElementType); - if (elementTypeMap == null) - return source as TDestination; - } - - IEnumerable sourceList = source; - if (sourceList == null) - sourceList = typeof(TSource).GetTypeInfo().IsInterface ? - new List() : - (IEnumerable)(context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TSource)) - : ObjectCreator.CreateObject(typeof(TSource))); - - var sourceLength = sourceList.OfType().Count(); - Array array = ObjectCreator.CreateArray(destElementType, sourceLength); - int count = 0; - var itemContext = new ResolutionContext(context); - foreach(var item in sourceList) - { - array.SetValue(itemContext.Map(item, null, typeof(TSourceElement), destElementType), count++); - } - return array as TDestination; - } - - private static readonly MethodInfo MapMethodInfo = typeof(ArrayMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.DestinationType, context.SourceType, TypeHelper.GetElementType(context.SourceType, (IEnumerable)context.SourceValue)).Invoke(null, new [] { context.SourceValue, context }); - } - - public bool IsMatch(TypePair context) - { - return (context.DestinationType.IsArray) && (context.SourceType.IsEnumerableType()); - } + public override bool IsMatch(TypePair context) => context.DestinationType.IsArray && context.SourceType.IsEnumerableType(); - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) + public override Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(destExpression.Type, sourceExpression.Type, TypeHelper.GetElementType(sourceExpression.Type)), sourceExpression, contextExpression ); + var sourceElementType = ElementTypeHelper.GetElementType(sourceExpression.Type); + var destElementType = ElementTypeHelper.GetElementType(destExpression.Type); + + var itemExpr = MapItemExpr(configurationProvider, profileMap, sourceExpression.Type, destExpression.Type, contextExpression, out ParameterExpression itemParam); + + //var count = source.Count(); + //var array = new TDestination[count]; + + //int i = 0; + //foreach (var item in source) + // array[i++] = newItemFunc(item, context); + //return array; + + var countParam = Parameter(typeof(int), "count"); + var arrayParam = Parameter(destExpression.Type, "destinationArray"); + var indexParam = Parameter(typeof(int), "destinationArrayIndex"); + + var actions = new List(); + var parameters = new List { countParam, arrayParam, indexParam }; + + var countMethod = typeof(Enumerable) + .GetTypeInfo() + .DeclaredMethods + .Single(mi => mi.Name == "Count" && mi.GetParameters().Length == 1) + .MakeGenericMethod(sourceElementType); + actions.Add(Assign(countParam, Call(countMethod, sourceExpression))); + actions.Add(Assign(arrayParam, NewArrayBounds(destElementType, countParam))); + actions.Add(Assign(indexParam, Constant(0))); + actions.Add(ForEach(sourceExpression, itemParam, + Assign(ArrayAccess(arrayParam, PostIncrementAssign(indexParam)), itemExpr) + )); + actions.Add(arrayParam); + + return Block(parameters, actions); } } -} \ No newline at end of file +} diff --git a/src/AutoMapper/Mappers/AssignableMapper.cs b/src/AutoMapper/Mappers/AssignableMapper.cs index c90407bb2f..b67f66207b 100644 --- a/src/AutoMapper/Mappers/AssignableMapper.cs +++ b/src/AutoMapper/Mappers/AssignableMapper.cs @@ -1,27 +1,13 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - public class AssignableMapper : IObjectMapExpression - { - public object Map(ResolutionContext context) - { - if (context.SourceValue == null && !context.Mapper.ShouldMapSourceValueAsNull(context)) - { - return context.Mapper.CreateObject(context); - } - - return context.SourceValue; - } - - public bool IsMatch(TypePair context) - { - return context.DestinationType.IsAssignableFrom(context.SourceType); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return sourceExpression; - } - } +using System.Linq.Expressions; + +namespace AutoMapper.Mappers +{ + public class AssignableMapper : IObjectMapper + { + public bool IsMatch(TypePair context) => context.DestinationType.IsAssignableFrom(context.SourceType); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + => sourceExpression; + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/CollectionMapper.cs b/src/AutoMapper/Mappers/CollectionMapper.cs index a9d3bdc698..327e939ec5 100644 --- a/src/AutoMapper/Mappers/CollectionMapper.cs +++ b/src/AutoMapper/Mappers/CollectionMapper.cs @@ -1,58 +1,18 @@ -using System.Collections; -using System.Linq; +using System.Collections.Generic; using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; namespace AutoMapper.Mappers { - using System.Collections.Generic; - using System.Reflection; - using Configuration; + using static CollectionMapperExpressionFactory; - public class CollectionMapper : IObjectMapExpression + public class CollectionMapper : EnumerableMapperBase { - public static TDestination Map(TSource source, TDestination destination, ResolutionContext context) - where TSource : IEnumerable - where TDestination : class, ICollection - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; + public override bool IsMatch(TypePair context) => context.SourceType.IsEnumerableType() && context.DestinationType.IsCollectionType(); - TDestination list = destination ?? ( - typeof (TDestination).IsInterface() - ? new List() as TDestination - : (TDestination) (context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TDestination)) - : ObjectCreator.CreateObject(typeof(TDestination)))); - - list.Clear(); - var itemContext = new ResolutionContext(context); - foreach (var item in (IEnumerable) source ?? Enumerable.Empty()) - list.Add((TDestinationItem)itemContext.Map(item, default(TDestinationItem), typeof(TSourceItem), typeof(TDestinationItem))); - - return list; - } - - private static readonly MethodInfo MapMethodInfo = typeof(CollectionMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return - MapMethodInfo.MakeGenericMethod(context.SourceType, TypeHelper.GetElementType(context.SourceType), context.DestinationType, TypeHelper.GetElementType(context.DestinationType)) - .Invoke(null, new[] {context.SourceValue, context.DestinationValue, context}); - } - - public bool IsMatch(TypePair context) - { - var isMatch = context.SourceType.IsEnumerableType() && context.DestinationType.IsCollectionType(); - - return isMatch; - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, - MapMethodInfo.MakeGenericMethod(sourceExpression.Type, TypeHelper.GetElementType(sourceExpression.Type), destExpression.Type, TypeHelper.GetElementType(destExpression.Type)), - sourceExpression, destExpression, contextExpression); - } + public override Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + => MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, destExpression, contextExpression, typeof(List<>), MapItemExpr); } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ConvertMapper.cs b/src/AutoMapper/Mappers/ConvertMapper.cs index 180dfe20f9..0052e24cba 100644 --- a/src/AutoMapper/Mappers/ConvertMapper.cs +++ b/src/AutoMapper/Mappers/ConvertMapper.cs @@ -1,500 +1,51 @@ -using System.Linq; +using System; +using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; +using AutoMapper.Internal; namespace AutoMapper.Mappers { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; + using LazyExpression = Lazy; + using static Expression; + using static ExpressionFactory; - public class ConvertMapper : IObjectMapExpression + public class ConvertMapper : IObjectMapper { - private readonly IReadOnlyDictionary _converters = new ReadOnlyDictionary(new Dictionary - { - // bool - { new TypePair(typeof(bool), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(byte), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(char), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(DateTime), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(decimal), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(double), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(short), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(int), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(long), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(sbyte), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(float), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(string), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(ushort), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(uint), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(ulong), typeof(bool)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - // byte - { new TypePair(typeof(bool), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(byte), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(char), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(DateTime), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(decimal), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(double), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(short), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(int), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(long), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(sbyte), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(float), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(string), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(ushort), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(uint), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(ulong), typeof(byte)), (Expression>)(foo => Convert.ToByte(foo)) }, - // char - { new TypePair(typeof(bool), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(byte), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(char), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(DateTime), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(decimal), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(double), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(short), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(int), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(long), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(sbyte), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(float), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(string), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(ushort), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(uint), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(ulong), typeof(char)), (Expression>)(foo => Convert.ToChar(foo)) }, - // DateTime - { new TypePair(typeof(bool), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(byte), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(char), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(DateTime), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(decimal), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(double), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(short), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(int), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(long), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(sbyte), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(float), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(string), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(ushort), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(uint), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(ulong), typeof(DateTime)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - // DateTime - { new TypePair(typeof(bool), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(byte), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(char), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(DateTime), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(decimal), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(double), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(short), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(int), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(long), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(sbyte), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(float), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(string), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(ushort), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(uint), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(ulong), typeof(decimal)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - // Double - { new TypePair(typeof(bool), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(byte), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(char), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(DateTime), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(decimal), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(double), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(short), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(int), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(long), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(sbyte), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(float), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(string), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(ushort), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(uint), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(ulong), typeof(double)), (Expression>)(foo => Convert.ToDouble(foo)) }, - // Int16 - { new TypePair(typeof(bool), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(byte), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(char), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(DateTime), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(decimal), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(double), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(short), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(int), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(long), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(sbyte), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(float), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(string), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(ushort), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(uint), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(ulong), typeof(short)), (Expression>)(foo => Convert.ToInt16(foo)) }, - // Int32 - { new TypePair(typeof(bool), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(byte), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(char), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(DateTime), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(decimal), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(double), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(short), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(int), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(long), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(sbyte), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(float), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(string), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(ushort), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(uint), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(ulong), typeof(int)), (Expression>)(foo => Convert.ToInt32(foo)) }, - // Int64 - { new TypePair(typeof(bool), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(byte), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(char), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(DateTime), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(decimal), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(double), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(short), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(int), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(long), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(sbyte), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(float), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(string), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(ushort), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(uint), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(ulong), typeof(long)), (Expression>)(foo => Convert.ToInt64(foo)) }, - // sbyte - { new TypePair(typeof(bool), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(byte), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(char), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(DateTime), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(decimal), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(double), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(short), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(int), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(long), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(sbyte), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(float), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(string), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(ushort), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(uint), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(ulong), typeof(sbyte)), (Expression>)(foo => Convert.ToSByte(foo)) }, - // float - { new TypePair(typeof(bool), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(byte), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(char), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(DateTime), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(decimal), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(double), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(short), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(int), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(long), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(sbyte), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(float), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(string), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(ushort), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(uint), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(ulong), typeof(float)), (Expression>)(foo => Convert.ToSingle(foo)) }, - // string - { new TypePair(typeof(bool), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(byte), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(char), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(DateTime), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(decimal), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(double), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(short), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(int), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(long), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(sbyte), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(float), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(string), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(ushort), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(uint), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - { new TypePair(typeof(ulong), typeof(string)), (Expression>)(foo => Convert.ToString(foo)) }, - // ushort - { new TypePair(typeof(bool), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(byte), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(char), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(DateTime), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(decimal), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(double), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(short), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(int), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(long), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(sbyte), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(float), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(string), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(ushort), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(uint), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(ulong), typeof(ushort)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - // uint - { new TypePair(typeof(bool), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(byte), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(char), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(DateTime), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(decimal), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(double), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(short), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(int), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(long), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(sbyte), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(float), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(string), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(ushort), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(uint), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(ulong), typeof(uint)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - // ulong - { new TypePair(typeof(bool), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(byte), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(char), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(DateTime), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(decimal), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(double), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(short), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(int), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(long), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(sbyte), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(float), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(string), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(ushort), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(uint), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(ulong), typeof(ulong)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - // bool? - { new TypePair(typeof(bool), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(byte), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(char), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(DateTime), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(decimal), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(double), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(short), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(int), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(long), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(sbyte), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(float), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(string), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(ushort), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(uint), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - { new TypePair(typeof(ulong), typeof(bool?)), (Expression>)(foo => Convert.ToBoolean(foo)) }, - // byte? - { new TypePair(typeof(bool), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(byte), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(char), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(DateTime), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(decimal), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(double), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(short), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(int), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(long), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(sbyte), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(float), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(string), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(ushort), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(uint), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - { new TypePair(typeof(ulong), typeof(byte?)), (Expression>)(foo => Convert.ToByte(foo)) }, - // char? - { new TypePair(typeof(bool), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(byte), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(char), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(DateTime), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(decimal), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(double), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(short), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(int), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(long), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(sbyte), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(float), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(string), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(ushort), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(uint), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - { new TypePair(typeof(ulong), typeof(char?)), (Expression>)(foo => Convert.ToChar(foo)) }, - // DateTime? - { new TypePair(typeof(bool), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(byte), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(char), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(DateTime), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(decimal), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(double), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(short), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(int), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(long), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(sbyte), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(float), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(string), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(ushort), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(uint), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - { new TypePair(typeof(ulong), typeof(DateTime?)), (Expression>)(foo => Convert.ToDateTime(foo)) }, - // decimal? - { new TypePair(typeof(bool), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(byte), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(char), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(DateTime), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(decimal), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(double), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(short), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(int), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(long), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(sbyte), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(float), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(string), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(ushort), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(uint), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - { new TypePair(typeof(ulong), typeof(decimal?)), (Expression>)(foo => Convert.ToDecimal(foo)) }, - // Double? - { new TypePair(typeof(bool), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(byte), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(char), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(DateTime), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(decimal), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(double), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(short), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(int), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(long), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(sbyte), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(float), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(string), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(ushort), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(uint), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - { new TypePair(typeof(ulong), typeof(double?)), (Expression>)(foo => Convert.ToDouble(foo)) }, - // Int16? - { new TypePair(typeof(bool), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(byte), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(char), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(DateTime), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(decimal), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(double), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(short), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(int), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(long), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(sbyte), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(float), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(string), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(ushort), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(uint), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - { new TypePair(typeof(ulong), typeof(short?)), (Expression>)(foo => Convert.ToInt16(foo)) }, - // Int32? - { new TypePair(typeof(bool), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(byte), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(char), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(DateTime), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(decimal), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(double), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(short), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(int), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(long), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(sbyte), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(float), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(string), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(ushort), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(uint), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - { new TypePair(typeof(ulong), typeof(int?)), (Expression>)(foo => Convert.ToInt32(foo)) }, - // Int64? - { new TypePair(typeof(bool), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(byte), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(char), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(DateTime), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(decimal), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(double), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(short), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(int), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(long), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(sbyte), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(float), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(string), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(ushort), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(uint), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - { new TypePair(typeof(ulong), typeof(long?)), (Expression>)(foo => Convert.ToInt64(foo)) }, - // sbyte? - { new TypePair(typeof(bool), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(byte), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(char), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(DateTime), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(decimal), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(double), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(short), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(int), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(long), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(sbyte), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(float), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(string), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(ushort), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(uint), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - { new TypePair(typeof(ulong), typeof(sbyte?)), (Expression>)(foo => Convert.ToSByte(foo)) }, - // float? - { new TypePair(typeof(bool), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(byte), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(char), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(DateTime), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(decimal), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(double), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(short), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(int), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(long), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(sbyte), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(float), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(string), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(ushort), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(uint), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - { new TypePair(typeof(ulong), typeof(float?)), (Expression>)(foo => Convert.ToSingle(foo)) }, - // ushort? - { new TypePair(typeof(bool), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(byte), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(char), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(DateTime), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(decimal), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(double), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(short), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(int), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(long), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(sbyte), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(float), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(string), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(ushort), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(uint), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - { new TypePair(typeof(ulong), typeof(ushort?)), (Expression>)(foo => Convert.ToUInt16(foo)) }, - // uint? - { new TypePair(typeof(bool), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(byte), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(char), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(DateTime), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(decimal), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(double), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(short), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(int), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(long), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(sbyte), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(float), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(string), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(ushort), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(uint), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - { new TypePair(typeof(ulong), typeof(uint?)), (Expression>)(foo => Convert.ToUInt32(foo)) }, - // ulong? - { new TypePair(typeof(bool), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(byte), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(char), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(DateTime), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(decimal), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(double), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(short), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(int), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(long), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(sbyte), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(float), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(string), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(ushort), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(uint), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - { new TypePair(typeof(ulong), typeof(ulong?)), (Expression>)(foo => Convert.ToUInt64(foo)) }, - }); - - - private readonly IReadOnlyDictionary _converterFuncs; + private readonly Dictionary _converters = GetConverters(); - public ConvertMapper() + private static Dictionary GetConverters() { - _converterFuncs = _converters.ToDictionary(kp => kp.Key, kp => kp.Value.Compile()); + var primitiveTypes = new[] + { + typeof(string), typeof(bool), typeof(byte), typeof(short), typeof(int), typeof(long), typeof(float), + typeof(double), typeof(decimal), typeof(sbyte), typeof(ushort), typeof(uint), typeof(ulong) + }; + return + (from sourceType in primitiveTypes + from destinationType in primitiveTypes + select new + { + Key = new TypePair(sourceType, destinationType), + Value = new LazyExpression(() => ConvertExpression(sourceType, destinationType), isThreadSafe: false) + }) + .ToDictionary(i => i.Key, i => i.Value); } - public object Map(ResolutionContext context) => - context.SourceValue == null - ? context.Mapper.CreateObject(context) - : _converterFuncs[context.Types].DynamicInvoke(context.SourceValue); - + static LambdaExpression ConvertExpression(Type sourceType, Type destinationType) + { + var convertMethod = typeof(Convert).GetDeclaredMethod("To" + destinationType.Name, new[] { sourceType }); + var sourceParameter = Parameter(sourceType, "source"); + return Lambda(Call(convertMethod, sourceParameter), sourceParameter); + } + public bool IsMatch(TypePair types) => _converters.ContainsKey(types); - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) { var typeMap = new TypePair(sourceExpression.Type, destExpression.Type); - return _converters[typeMap].ReplaceParameters(sourceExpression); + return _converters[typeMap].Value.ReplaceParameters(sourceExpression); } } -} +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/CreateMapBasedOnCriteriaMapper.cs b/src/AutoMapper/Mappers/CreateMapBasedOnCriteriaMapper.cs index 96547fd46f..8f815c5268 100644 --- a/src/AutoMapper/Mappers/CreateMapBasedOnCriteriaMapper.cs +++ b/src/AutoMapper/Mappers/CreateMapBasedOnCriteriaMapper.cs @@ -8,7 +8,7 @@ namespace AutoMapper.Mappers public interface IConditionalObjectMapper { ICollection> Conventions { get; } - bool IsMatch(TypePair context); + bool IsMatch(TypePair context); } public class ConditionalObjectMapper : IConditionalObjectMapper diff --git a/src/AutoMapper/Mappers/DictionaryMapper.cs b/src/AutoMapper/Mappers/DictionaryMapper.cs index b07a4390da..7fad11c61e 100644 --- a/src/AutoMapper/Mappers/DictionaryMapper.cs +++ b/src/AutoMapper/Mappers/DictionaryMapper.cs @@ -1,72 +1,18 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Configuration; - - public class DictionaryMapper : IObjectMapExpression - { - public static TDestination Map(TSource source, TDestination destination, ResolutionContext context) - where TSource : IDictionary - where TDestination : class, IDictionary - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; - - TDestination list = destination ?? ( - typeof (TDestination).IsInterface() - ? new Dictionary() as TDestination - : (TDestination) (context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof (TDestination)) - : ObjectCreator.CreateObject(typeof (TDestination)))); - - list.Clear(); - var itemContext = new ResolutionContext(context); - foreach(var keyPair in (IEnumerable>)source ?? Enumerable.Empty>()) - { - list.Add((TDestinationKey)itemContext.Map(keyPair.Key, default(TDestinationKey), typeof(TSourceKey), typeof(TDestinationKey)), - (TDestinationValue)itemContext.Map(keyPair.Value, default(TDestinationValue), typeof(TSourceValue), typeof(TDestinationValue))); - } - return list; - } - - private static readonly MethodInfo MapMethodInfo = typeof(DictionaryMapper).GetAllMethods().First(_ => _.IsStatic); - - public bool IsMatch(TypePair context) - { - return (context.SourceType.IsDictionaryType() && context.DestinationType.IsDictionaryType()); - } - - public object Map(ResolutionContext context) - { - Type genericSourceDictType = context.SourceType.GetDictionaryType(); - Type sourceKeyType = genericSourceDictType.GetTypeInfo().GenericTypeArguments[0]; - Type sourceValueType = genericSourceDictType.GetTypeInfo().GenericTypeArguments[1]; - Type genericDestDictType = context.DestinationType.GetDictionaryType(); - Type destKeyType = genericDestDictType.GetTypeInfo().GenericTypeArguments[0]; - Type destValueType = genericDestDictType.GetTypeInfo().GenericTypeArguments[1]; - - return - MapMethodInfo.MakeGenericMethod(context.SourceType, sourceKeyType, sourceValueType, context.DestinationType, destKeyType, destValueType) - .Invoke(null, new[] { context.SourceValue, context.DestinationValue, context }); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - Type genericSourceDictType = sourceExpression.Type.GetDictionaryType(); - Type sourceKeyType = genericSourceDictType.GetTypeInfo().GenericTypeArguments[0]; - Type sourceValueType = genericSourceDictType.GetTypeInfo().GenericTypeArguments[1]; - Type genericDestDictType = destExpression.Type.GetDictionaryType(); - Type destKeyType = genericDestDictType.GetTypeInfo().GenericTypeArguments[0]; - Type destValueType = genericDestDictType.GetTypeInfo().GenericTypeArguments[1]; - - return Expression.Call(null, - MapMethodInfo.MakeGenericMethod(sourceExpression.Type, sourceKeyType, sourceValueType, destExpression.Type, destKeyType, destValueType), - sourceExpression, destExpression, contextExpression); - } - } +using System.Collections.Generic; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static CollectionMapperExpressionFactory; + + public class DictionaryMapper : IObjectMapper + { + public bool IsMatch(TypePair context) => context.SourceType.IsDictionaryType() && context.DestinationType.IsDictionaryType(); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + => MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, destExpression, contextExpression, typeof(Dictionary<,>), MapKeyPairValueExpr); + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/DynamicMappers.cs b/src/AutoMapper/Mappers/DynamicMappers.cs deleted file mode 100644 index 5c2397efb5..0000000000 --- a/src/AutoMapper/Mappers/DynamicMappers.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.CSharp.RuntimeBinder; -using Binder = Microsoft.CSharp.RuntimeBinder.Binder; - -namespace AutoMapper.Mappers -{ - using Execution; - - public class FromDynamicMapper : IObjectMapExpression - { - public static TDestination Map(TSource source, TDestination destination, ResolutionContext context) - where TSource : DynamicObject - { - if (destination == null) - destination = (TDestination) (!context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof (TDestination)) - : ObjectCreator.CreateObject(typeof (TDestination))); - var memberContext = new ResolutionContext(context); - foreach (var member in new TypeDetails(typeof(TDestination)).PublicWriteAccessors) - { - object sourceMemberValue; - try - { - sourceMemberValue = GetDynamically(member, source); - } - catch (RuntimeBinderException) - { - continue; - } - var destinationMemberValue = memberContext.Map(member, sourceMemberValue); - member.SetMemberValue(destination, destinationMemberValue); - } - return destination; - } - - private static object GetDynamically(MemberInfo member, object target) - { - var binder = Binder.GetMember(CSharpBinderFlags.None, member.Name, member.GetMemberType(), - new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) }); - var callsite = CallSite>.Create(binder); - return callsite.Target(callsite, target); - } - - private static readonly MethodInfo MapMethodInfo = typeof(FromDynamicMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new[] { context.SourceValue, context.DestinationValue, context }); - } - - public bool IsMatch(TypePair context) - { - return context.SourceType.IsDynamic() && !context.DestinationType.IsDynamic(); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression, destExpression, contextExpression); - } - } - - public class ToDynamicMapper : IObjectMapExpression - { - public static TDestination Map(TSource source, TDestination destination, ResolutionContext context) - where TDestination : DynamicObject - { - if (destination == null) - destination = (TDestination)(!context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TDestination)) - : ObjectCreator.CreateObject(typeof(TDestination))); - var memberContext = new ResolutionContext(context); - foreach (var member in new TypeDetails(typeof(TSource)).PublicWriteAccessors) - { - object sourceMemberValue; - try - { - sourceMemberValue = member.GetMemberValue(source); - } - catch (RuntimeBinderException) - { - continue; - } - var destinationMemberValue = memberContext.Map(member, sourceMemberValue); - SetDynamically(member, destination, destinationMemberValue); - } - return destination; - } - - private static void SetDynamically(MemberInfo member, object target, object value) - { - var binder = Binder.SetMember(CSharpBinderFlags.None, member.Name, member.GetMemberType(), - new[]{ - CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), - CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) - }); - var callsite = CallSite>.Create(binder); - callsite.Target(callsite, target, value); - } - - private static readonly MethodInfo MapMethodInfo = typeof(ToDynamicMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new[] { context.SourceValue, context.DestinationValue, context }); - } - - public bool IsMatch(TypePair context) - { - return context.DestinationType.IsDynamic() && !context.SourceType.IsDynamic(); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression, destExpression, contextExpression); - } - } -} diff --git a/src/AutoMapper/Mappers/EnumMapper.cs b/src/AutoMapper/Mappers/EnumMapper.cs deleted file mode 100644 index 78ec92920b..0000000000 --- a/src/AutoMapper/Mappers/EnumMapper.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System.ComponentModel; -using System.Linq.Expressions; -using static System.Linq.Expressions.Expression; - -namespace AutoMapper.Mappers -{ - using System; - using System.Reflection; - using System.Linq; - - public class StringToEnumMapper : IObjectMapExpression - { - public static TDestination Map(string source) - { - if (string.IsNullOrEmpty(source)) - return default(TDestination); - return (TDestination)Enum.Parse(typeof(TDestination), source, true); - } - - private static readonly MethodInfo MapMethodInfo = typeof(StringToEnumMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.DestinationType).Invoke(null, new[] { context.SourceValue }); - } - - public bool IsMatch(TypePair context) - { - var destEnumType = TypeHelper.GetEnumerationType(context.DestinationType); - return destEnumType != null && context.SourceType == typeof(string); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Call(null, MapMethodInfo.MakeGenericMethod(destExpression.Type), sourceExpression); - } - } - - public class EnumToEnumMapper : IObjectMapExpression - { - public static TDestination Map(TSource source) - { - if (source == null) - return default(TDestination); - - var sourceEnumType = TypeHelper.GetEnumerationType(typeof(TSource)); - var destEnumType = TypeHelper.GetEnumerationType(typeof(TDestination)); - - if (!Enum.IsDefined(sourceEnumType, source)) - { - return (TDestination)Enum.ToObject(destEnumType, source); - } - - if (!Enum.GetNames(destEnumType).Contains(source.ToString())) - { - Type underlyingSourceType = Enum.GetUnderlyingType(sourceEnumType); - var underlyingSourceValue = Convert.ChangeType(source, underlyingSourceType); - - return (TDestination)Enum.ToObject(destEnumType, underlyingSourceValue); - } - - return (TDestination)Enum.Parse(destEnumType, Enum.GetName(sourceEnumType, source), true); - } - - private static readonly MethodInfo MapMethodInfo = typeof(EnumToEnumMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new[] { context.SourceValue }); - } - - public bool IsMatch(TypePair context) - { - var sourceEnumType = TypeHelper.GetEnumerationType(context.SourceType); - var destEnumType = TypeHelper.GetEnumerationType(context.DestinationType); - return sourceEnumType != null && destEnumType != null; - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression); - } - } - - public class EnumToUnderlyingTypeMapper : IObjectMapExpression - { - public static TDestination Map(TSource source) - { - bool toEnum = false; - Type enumSourceType = TypeHelper.GetEnumerationType(typeof(TSource)); - Type enumDestinationType = TypeHelper.GetEnumerationType(typeof(TDestination)); - var typePair = new TypePair(typeof (TSource), typeof (TDestination)); - EnumToUnderlyingTypeMapping(typePair, ref toEnum); - - if (toEnum && source != null) - { - return (TDestination)Enum.Parse(enumDestinationType, source.ToString(), true); - } - - if (EnumToNullableTypeMapping(typePair)) - { - return ConvertEnumToNullableType(source); - } - - return (TDestination)Convert.ChangeType(source, typeof(TDestination), null); - } - - internal static bool EnumToNullableTypeMapping(TypePair context) - { - if (!context.DestinationType.IsGenericType()) - { - return false; - } - - var genericType = context.DestinationType.GetGenericTypeDefinition(); - - return genericType == typeof(Nullable<>); - } - - private static TDestination ConvertEnumToNullableType(TSource source) - { -#if !PORTABLE - var nullableConverter = new NullableConverter(typeof(TDestination)); - - if (source == null) - { - return (TDestination)nullableConverter.ConvertFrom(source); - } - - var destType = nullableConverter.UnderlyingType; - return (TDestination)Convert.ChangeType(source, destType, null); -#else - if (source == null) - { - return default(TDestination); - } - - var destType = Nullable.GetUnderlyingType(typeof(TDestination)); - - return (TDestination)Convert.ChangeType(source, destType, null); -#endif - } - - private static readonly MethodInfo MapMethodInfo = typeof(EnumToUnderlyingTypeMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new[] { context.SourceValue }); - } - - public bool IsMatch(TypePair context) - { - bool toEnum = false; - return EnumToUnderlyingTypeMapping(context, ref toEnum); - } - - private static bool EnumToUnderlyingTypeMapping(TypePair context, ref bool toEnum) - { - var sourceEnumType = TypeHelper.GetEnumerationType(context.SourceType); - var destEnumType = TypeHelper.GetEnumerationType(context.DestinationType); - - // Enum to underlying type - if (sourceEnumType != null) - { - return context.DestinationType.IsAssignableFrom(Enum.GetUnderlyingType(sourceEnumType)); - } - if (destEnumType != null) - { - toEnum = true; - return context.SourceType.IsAssignableFrom(Enum.GetUnderlyingType(destEnumType)); - } - return false; - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression); - } - } - -} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/EnumToEnumMapper.cs b/src/AutoMapper/Mappers/EnumToEnumMapper.cs new file mode 100644 index 0000000000..172cb68baf --- /dev/null +++ b/src/AutoMapper/Mappers/EnumToEnumMapper.cs @@ -0,0 +1,49 @@ +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Mappers.Internal; +using static System.Linq.Expressions.Expression; + +namespace AutoMapper.Mappers +{ + public class EnumToEnumMapper : IObjectMapper + { + public static TDestination Map(TSource source) + { + var sourceEnumType = ElementTypeHelper.GetEnumerationType(typeof(TSource)); + var destEnumType = ElementTypeHelper.GetEnumerationType(typeof(TDestination)); + + if (!Enum.IsDefined(sourceEnumType, source)) + { + return (TDestination)Enum.ToObject(destEnumType, source); + } + + if (!Enum.GetNames(destEnumType).Contains(source.ToString(), StringComparer.OrdinalIgnoreCase)) + { + var underlyingSourceType = Enum.GetUnderlyingType(sourceEnumType); + var underlyingSourceValue = System.Convert.ChangeType(source, underlyingSourceType); + + return (TDestination)Enum.ToObject(destEnumType, underlyingSourceValue); + } + + return (TDestination)Enum.Parse(destEnumType, Enum.GetName(sourceEnumType, source), true); + } + + private static readonly MethodInfo MapMethodInfo = typeof(EnumToEnumMapper).GetAllMethods().First(_ => _.IsStatic); + + public bool IsMatch(TypePair context) + { + var sourceEnumType = ElementTypeHelper.GetEnumerationType(context.SourceType); + var destEnumType = ElementTypeHelper.GetEnumerationType(context.DestinationType); + return sourceEnumType != null && destEnumType != null; + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call(null, + MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), + sourceExpression); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/EnumToStringMapper.cs b/src/AutoMapper/Mappers/EnumToStringMapper.cs new file mode 100644 index 0000000000..dcb7d6b5b4 --- /dev/null +++ b/src/AutoMapper/Mappers/EnumToStringMapper.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.Serialization; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + public class EnumToStringMapper : IObjectMapper + { + public bool IsMatch(TypePair context) => context.DestinationType == typeof(string) && + ElementTypeHelper.GetEnumerationType(context.SourceType) != null; + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) + { + var sourceType = sourceExpression.Type; + var sourceTypeEnum = ElementTypeHelper.GetEnumerationType(sourceType); + var toStringCall = Expression.Call(sourceExpression, typeof(object).GetDeclaredMethod("ToString")); + var switchCases = new List(); + var enumNames = sourceTypeEnum.GetDeclaredMembers(); + foreach (var memberInfo in enumNames.Where(x => x.IsStatic())) + { + var attribute = memberInfo.GetCustomAttribute(typeof(EnumMemberAttribute)) as EnumMemberAttribute; + if (attribute?.Value != null) + { + var switchCase = Expression.SwitchCase(Expression.Constant(attribute.Value), + Expression.Constant(Enum.ToObject(sourceTypeEnum, memberInfo.GetMemberValue(null)))); + switchCases.Add(switchCase); + } + } + return switchCases.Count > 0 + ? (Expression) Expression.Switch(sourceExpression, toStringCall, switchCases.ToArray()) + : toStringCall; + } + } +} diff --git a/src/AutoMapper/Mappers/EnumToUnderlyingTypeMapper.cs b/src/AutoMapper/Mappers/EnumToUnderlyingTypeMapper.cs new file mode 100644 index 0000000000..9fe8e077af --- /dev/null +++ b/src/AutoMapper/Mappers/EnumToUnderlyingTypeMapper.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; +using static System.Linq.Expressions.Expression; +using Convert = System.Convert; + +namespace AutoMapper.Mappers +{ + using static ExpressionFactory; + + public class EnumToUnderlyingTypeMapper : IObjectMapper + { + private static readonly MethodInfo ChangeTypeMethod = Method(() => Convert.ChangeType(null, typeof(object))); + + public bool IsMatch(TypePair context) + { + var sourceEnumType = ElementTypeHelper.GetEnumerationType(context.SourceType); + + return sourceEnumType != null && context.DestinationType.IsAssignableFrom(Enum.GetUnderlyingType(sourceEnumType)); + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + ToType( + Call(ChangeTypeMethod, ToObject(sourceExpression), + Constant(destExpression.Type)), + destExpression.Type + ); + } + +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/EnumerableMapper.cs b/src/AutoMapper/Mappers/EnumerableMapper.cs index 5b1c4d873b..c9f724e771 100644 --- a/src/AutoMapper/Mappers/EnumerableMapper.cs +++ b/src/AutoMapper/Mappers/EnumerableMapper.cs @@ -1,61 +1,31 @@ +using System; +using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; -namespace AutoMapper.Mappers +namespace AutoMapper.Mappers { - using System; - using System.Collections; - using System.Reflection; - using Configuration; - - public class EnumerableMapper : IObjectMapExpression - { - public static TDestination Map(TSource source, TDestination destination, ResolutionContext context) - where TSource : class, IEnumerable - where TDestination : class, IEnumerable - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; - - var sourceElementType = TypeHelper.GetElementType(typeof(TSource), source); - var destElementType = typeof (TDestinationElement); - source = source ?? (context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TSource)) - : ObjectCreator.CreateObject(typeof(TSource))) as TSource; - - TDestination destEnumeration = (destination is IList && !(destination is Array)) - ? destination - : (TDestination) ObjectCreator.CreateList(destElementType); - - var list = destEnumeration as IList; - list.Clear(); - var itemContext = new ResolutionContext(context); - foreach(var item in source) + using static Expression; + using static CollectionMapperExpressionFactory; + + public class EnumerableMapper : EnumerableMapperBase + { + public override bool IsMatch(TypePair context) => (context.DestinationType.IsInterface() && context.DestinationType.IsEnumerableType() || + context.DestinationType.IsListType()) + && context.SourceType.IsEnumerableType(); + + public override Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + { + if(destExpression.Type.IsInterface()) { - list.Add((TDestinationElement)itemContext.Map(item, null, sourceElementType, destElementType)); - } - return destEnumeration; - } - - private static readonly MethodInfo MapMethodInfo = typeof(EnumerableMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType, TypeHelper.GetElementType(context.DestinationType)).Invoke(null, new [] { context.SourceValue, context.DestinationValue, context }); - } - - public bool IsMatch(TypePair context) - { - // destination type must be IEnumerable interface or a class implementing at least IList - return ((context.DestinationType.IsInterface() && context.DestinationType.IsEnumerableType()) || - context.DestinationType.IsListType()) - && context.SourceType.IsEnumerableType(); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type, TypeHelper.GetElementType(destExpression.Type)), sourceExpression, destExpression, contextExpression); - } - } + var listType = typeof(IList<>).MakeGenericType(ElementTypeHelper.GetElementType(destExpression.Type)); + destExpression = Convert(destExpression, listType); + } + return MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, + destExpression, contextExpression, typeof(List<>), MapItemExpr); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/EnumerableMapperBase.cs b/src/AutoMapper/Mappers/EnumerableMapperBase.cs new file mode 100644 index 0000000000..e7e226d6d9 --- /dev/null +++ b/src/AutoMapper/Mappers/EnumerableMapperBase.cs @@ -0,0 +1,19 @@ +using System.Linq.Expressions; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + public abstract class EnumerableMapperBase : IObjectMapperInfo + { + public TypePair GetAssociatedTypes(TypePair initialTypes) + { + var sourceElementType = ElementTypeHelper.GetElementType(initialTypes.SourceType); + var destElementType = ElementTypeHelper.GetElementType(initialTypes.DestinationType); + return new TypePair(sourceElementType, destElementType); + } + + public abstract bool IsMatch(TypePair context); + public abstract Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/EnumerableToDictionaryMapper.cs b/src/AutoMapper/Mappers/EnumerableToDictionaryMapper.cs index 4529ceb8c1..ed7a50e22a 100644 --- a/src/AutoMapper/Mappers/EnumerableToDictionaryMapper.cs +++ b/src/AutoMapper/Mappers/EnumerableToDictionaryMapper.cs @@ -1,70 +1,22 @@ +using System.Collections.Generic; using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; namespace AutoMapper.Mappers { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Configuration; + using static CollectionMapperExpressionFactory; - public class EnumerableToDictionaryMapper : IObjectMapExpression + public class EnumerableToDictionaryMapper : IObjectMapper { - public static TDestination Map(TSource source, TDestination destination, ResolutionContext context) - where TSource : IEnumerable - where TDestination : class, IDictionary - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; - - TDestination list = destination ?? ( - typeof(TDestination).IsInterface() - ? new Dictionary() as TDestination - : (TDestination)(context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TDestination)) - : ObjectCreator.CreateObject(typeof(TDestination)))); - - list.Clear(); - - var itemContext = new ResolutionContext(context); - foreach(var item in (IEnumerable)source ?? Enumerable.Empty()) - { - list.Add((KeyValuePair)itemContext.Map(item, default(KeyValuePair), typeof(TSourceElement), typeof(KeyValuePair))); - } - return list; - } - - private static readonly MethodInfo MapMethodInfo = typeof(EnumerableToDictionaryMapper).GetAllMethods().First(_ => _.IsStatic); - - public bool IsMatch(TypePair context) - { - return (context.DestinationType.IsDictionaryType()) - && (context.SourceType.IsEnumerableType()) - && (!context.SourceType.IsDictionaryType()); - } - - public object Map(ResolutionContext context) - { - Type sourceElementType = TypeHelper.GetElementType(context.SourceType); - Type genericDestDictType = context.DestinationType.GetDictionaryType(); - Type destKeyType = genericDestDictType.GetTypeInfo().GenericTypeArguments[0]; - Type destValueType = genericDestDictType.GetTypeInfo().GenericTypeArguments[1]; - - return - MapMethodInfo.MakeGenericMethod(context.SourceType, sourceElementType, context.DestinationType, destKeyType, destValueType) - .Invoke(null, new[] { context.SourceValue, context.DestinationValue, context }); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - Type sourceElementType = TypeHelper.GetElementType(sourceExpression.Type); - Type genericDestDictType = destExpression.Type; - Type destKeyType = genericDestDictType.GetTypeInfo().GenericTypeArguments[0]; - Type destValueType = genericDestDictType.GetTypeInfo().GenericTypeArguments[1]; - - return Expression.Call(null, - MapMethodInfo.MakeGenericMethod(sourceExpression.Type, sourceElementType, genericDestDictType, destKeyType, destValueType), sourceExpression, destExpression, contextExpression); - } + public bool IsMatch(TypePair context) => context.DestinationType.IsDictionaryType() + && context.SourceType.IsEnumerableType() + && !context.SourceType.IsDictionaryType(); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + => + MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, destExpression, + contextExpression, typeof(Dictionary<,>), MapItemExpr); } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ExplicitConversionOperatorMapper.cs b/src/AutoMapper/Mappers/ExplicitConversionOperatorMapper.cs index b1575a990d..51b6e62e62 100644 --- a/src/AutoMapper/Mappers/ExplicitConversionOperatorMapper.cs +++ b/src/AutoMapper/Mappers/ExplicitConversionOperatorMapper.cs @@ -1,43 +1,36 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - using System.Linq; - using System.Reflection; - - public class ExplicitConversionOperatorMapper : IObjectMapExpression - { - public object Map(ResolutionContext context) - { - var implicitOperator = GetExplicitConversionOperator(context.Types); - - return implicitOperator.Invoke(null, new[] {context.SourceValue}); - } - - public bool IsMatch(TypePair context) - { - var methodInfo = GetExplicitConversionOperator(context); - - return methodInfo != null; - } - - private static MethodInfo GetExplicitConversionOperator(TypePair context) - { - var sourceTypeMethod = context.SourceType - .GetDeclaredMethods() - .Where(mi => mi.IsPublic && mi.IsStatic) - .Where(mi => mi.Name == "op_Explicit") - .FirstOrDefault(mi => mi.ReturnType == context.DestinationType); - - var destTypeMethod = context.DestinationType.GetMethod("op_Explicit", new[] {context.SourceType}); - - return sourceTypeMethod ?? destTypeMethod; - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - var implicitOperator = GetExplicitConversionOperator(new TypePair(sourceExpression.Type, destExpression.Type)); - return Expression.Call(null, implicitOperator, sourceExpression); - } - } +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.Mappers +{ + public class ExplicitConversionOperatorMapper : IObjectMapper + { + public bool IsMatch(TypePair context) + { + var methodInfo = GetExplicitConversionOperator(context); + + return methodInfo != null; + } + + private static MethodInfo GetExplicitConversionOperator(TypePair context) + { + var sourceTypeMethod = context.SourceType + .GetDeclaredMethods() + .Where(mi => mi.IsPublic && mi.IsStatic) + .Where(mi => mi.Name == "op_Explicit") + .FirstOrDefault(mi => mi.ReturnType == context.DestinationType); + + var destTypeMethod = context.DestinationType.GetDeclaredMethod("op_Explicit", new[] {context.SourceType}); + + return sourceTypeMethod ?? destTypeMethod; + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + { + var implicitOperator = GetExplicitConversionOperator(new TypePair(sourceExpression.Type, destExpression.Type)); + return Expression.Call(null, implicitOperator, sourceExpression); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ExpressionMapper.cs b/src/AutoMapper/Mappers/ExpressionMapper.cs deleted file mode 100644 index 638b137761..0000000000 --- a/src/AutoMapper/Mappers/ExpressionMapper.cs +++ /dev/null @@ -1,316 +0,0 @@ -using System.Collections; - -namespace AutoMapper.Mappers -{ - using System; - using System.Collections.Generic; - using QueryableExtensions.Impl; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Configuration; - using Execution; - - public class ExpressionMapper : IObjectMapExpression - { - public static TDestination Map(TSource expression, ResolutionContext context) - where TSource : LambdaExpression - where TDestination : LambdaExpression - { - var sourceDelegateType = typeof(TSource).GetTypeInfo().GenericTypeArguments[0]; - var destDelegateType = typeof(TDestination).GetTypeInfo().GenericTypeArguments[0]; - - if (sourceDelegateType.GetGenericTypeDefinition() != destDelegateType.GetGenericTypeDefinition()) - throw new AutoMapperMappingException("Source and destination expressions must be of the same type."); - - var destArgType = destDelegateType.GetTypeInfo().GenericTypeArguments[0]; - if (destArgType.IsGenericType()) - destArgType = destArgType.GetTypeInfo().GenericTypeArguments[0]; - var sourceArgType = sourceDelegateType.GetTypeInfo().GenericTypeArguments[0]; - if (sourceArgType.IsGenericType()) - sourceArgType = sourceArgType.GetTypeInfo().GenericTypeArguments[0]; - - var typeMap = context.ConfigurationProvider.ResolveTypeMap(destArgType, sourceArgType); - - var parentMasterVisitor = new MappingVisitor(context.ConfigurationProvider, - destDelegateType.GetTypeInfo().GenericTypeArguments); - var typeMapVisitor = new MappingVisitor(context.ConfigurationProvider, typeMap, expression.Parameters[0], - Expression.Parameter(destDelegateType.GetTypeInfo().GenericTypeArguments[0], expression.Parameters[0].Name), - parentMasterVisitor, destDelegateType.GetTypeInfo().GenericTypeArguments); - - // Map expression body and variable seperately - var parameters = expression.Parameters.Select(typeMapVisitor.Visit).OfType(); - var body = typeMapVisitor.Visit(expression.Body); - return (TDestination)Expression.Lambda(body, parameters); - } - - private static readonly MethodInfo MapMethodInfo = typeof(ExpressionMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new[] { context.SourceValue, context }); - } - - public bool IsMatch(TypePair context) - { - return typeof (LambdaExpression).IsAssignableFrom(context.SourceType) - && context.SourceType != typeof (LambdaExpression) - && typeof (LambdaExpression).IsAssignableFrom(context.DestinationType) - && context.DestinationType != typeof (LambdaExpression); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression, contextExpression); - } - - internal class MappingVisitor : ExpressionVisitor - { - private IList _destSubTypes = new Type[0]; - - private readonly IConfigurationProvider _configurationProvider; - private readonly TypeMap _typeMap; - private readonly Expression _oldParam; - private readonly Expression _newParam; - private readonly MappingVisitor _parentMappingVisitor; - - public MappingVisitor(IConfigurationProvider configurationProvider, IList destSubTypes) - : this(configurationProvider, null, Expression.Parameter(typeof(Nullable)), Expression.Parameter(typeof(Nullable)), null, destSubTypes) - { - } - - internal MappingVisitor(IConfigurationProvider configurationProvider, TypeMap typeMap, Expression oldParam, Expression newParam, MappingVisitor parentMappingVisitor = null, IList destSubTypes = null) - { - _configurationProvider = configurationProvider; - _typeMap = typeMap; - _oldParam = oldParam; - _newParam = newParam; - _parentMappingVisitor = parentMappingVisitor; - if(destSubTypes != null) - _destSubTypes = destSubTypes; - } - - protected override Expression VisitConstant(ConstantExpression node) - { - if (ReferenceEquals(node, _oldParam)) - return _newParam; - return node; - } - - protected override Expression VisitParameter(ParameterExpression node) - { - if (ReferenceEquals(node, _oldParam)) - return _newParam; - return node; - } - - protected override Expression VisitMethodCall(MethodCallExpression node) - { - return base.VisitMethodCall(GetConvertedMethodCall(node)); - } - - protected override Expression VisitExtension(Expression node) - { - if ((int)node.NodeType == 10000) - return node; - return base.VisitExtension(node); - } - - private MethodCallExpression GetConvertedMethodCall(MethodCallExpression node) - { - if (!node.Method.IsGenericMethod) - return node; - var convertedArguments = Visit(node.Arguments); - var convertedMethodArgumentTypes = node.Method.GetGenericArguments().Select(t => GetConvertingTypeIfExists(node.Arguments, t, convertedArguments)).ToArray(); - var convertedMethodCall = node.Method.GetGenericMethodDefinition().MakeGenericMethod(convertedMethodArgumentTypes); - return Expression.Call(convertedMethodCall, convertedArguments); - } - - private static Type GetConvertingTypeIfExists(IList args, Type t, IList arguments) - { - var matchingArgument = args.Where(a => !a.Type.IsGenericType()).FirstOrDefault(a => a.Type == t); - if (matchingArgument != null) - { - var index = args.IndexOf(matchingArgument); - if (index < 0) - return t; - return arguments[index].Type; - } - - var matchingEnumerableArgument = args.Where(a => a.Type.IsGenericType()).FirstOrDefault(a => a.Type.GetTypeInfo().GenericTypeArguments[0] == t); - var index2 = args.IndexOf(matchingEnumerableArgument); - if (index2 < 0) - return t; - return arguments[index2].Type.GetTypeInfo().GenericTypeArguments[0]; - } - - protected override Expression VisitBinary(BinaryExpression node) - { - var newLeft = base.Visit(node.Left); - var newRight = base.Visit(node.Right); - - CheckNullableToNonNullableChanges(node.Left, node.Right, ref newLeft, ref newRight); - CheckNullableToNonNullableChanges(node.Right, node.Left, ref newRight, ref newLeft); - return Expression.MakeBinary(node.NodeType, newLeft, newRight); - } - - private static void CheckNullableToNonNullableChanges(Expression left, Expression right, ref Expression newLeft, ref Expression newRight) - { - if (GoingFromNonNullableToNullable(left, newLeft)) - if (BothAreNonNullable(right, newRight)) - UpdateToNullableExpression(right, out newRight); - else if (BothAreNullable(right, newRight)) - UpdateToNonNullableExpression(right, out newRight); - - if (GoingFromNonNullableToNullable(newLeft, left)) - if (BothAreNonNullable(right, newRight)) - UpdateToNullableExpression(right, out newRight); - else if (BothAreNullable(right, newRight)) - UpdateToNonNullableExpression(right, out newRight); - } - - private static void UpdateToNullableExpression(Expression right, out Expression newRight) - { - if (right is ConstantExpression) - newRight = Expression.Constant((right as ConstantExpression).Value, - typeof (Nullable<>).MakeGenericType(right.Type)); - else - throw new AutoMapperMappingException( - "Mapping a BinaryExpression where one side is nullable and the other isn't"); - } - - private static void UpdateToNonNullableExpression(Expression right, out Expression newRight) - { - if (right is ConstantExpression) - newRight = Expression.Constant((right as ConstantExpression).Value, - typeof(Nullable<>).MakeGenericType(right.Type)); - else if (right is UnaryExpression) - newRight = (right as UnaryExpression).Operand; - else - throw new AutoMapperMappingException( - "Mapping a BinaryExpression where one side is nullable and the other isn't"); - } - - private static bool GoingFromNonNullableToNullable(Expression node, Expression newLeft) - { - return !node.Type.IsNullableType() && newLeft.Type.IsNullableType(); - } - - private static bool BothAreNullable(Expression node, Expression newLeft) - { - return node.Type.IsNullableType() && newLeft.Type.IsNullableType(); - } - - private static bool BothAreNonNullable(Expression node, Expression newLeft) - { - return !node.Type.IsNullableType() && !newLeft.Type.IsNullableType(); - } - - protected override Expression VisitLambda(Expression expression) - { - if (expression.Parameters.Any(b => b.Type == _oldParam.Type)) - return VisitLambdaExpression(expression); - return VisitAllParametersExpression(expression); - } - - private Expression VisitLambdaExpression(Expression expression) - { - var convertedBody = base.Visit(expression.Body); - var convertedArguments = expression.Parameters.Select(e => base.Visit(e) as ParameterExpression).ToList(); - return Expression.Lambda(convertedBody, convertedArguments); - } - - private Expression VisitAllParametersExpression(Expression expression) - { - var visitors = new List(); - for (var i = 0; i < expression.Parameters.Count; i++) - { - var sourceParamType = expression.Parameters[i].Type; - foreach (var destParamType in _destSubTypes.Where(dt => dt != sourceParamType)) - { - var a = destParamType.IsGenericType() ? destParamType.GetTypeInfo().GenericTypeArguments[0]: destParamType; - var typeMap = _configurationProvider.FindTypeMapFor(a, sourceParamType); - - if (typeMap == null) - continue; - - var oldParam = expression.Parameters[i]; - var newParam = Expression.Parameter(a, oldParam.Name); - visitors.Add(new MappingVisitor(_configurationProvider, typeMap, oldParam, newParam, this)); - } - } - return visitors.Aggregate(expression as Expression, (e, v) => v.Visit(e)); - } - - protected override Expression VisitMember(MemberExpression node) - { - if (node == _oldParam) - return _newParam; - var propertyMap = PropertyMap(node); - - if (propertyMap == null) - { - if (node.Expression is MemberExpression) - return GetConvertedSubMemberCall(node); - return node; - } - SetSorceSubTypes(propertyMap); - - var replacedExpression = Visit(node.Expression); - if (replacedExpression == node.Expression) - replacedExpression = _parentMappingVisitor.Visit(node.Expression); - - if (propertyMap.CustomExpression != null) - return propertyMap.CustomExpression.ReplaceParameters(replacedExpression); - - Func getExpression = (current, memberGetter) => Expression.MakeMemberAccess(current, memberGetter.MemberInfo); - - return propertyMap.SourceMembers - .Aggregate(replacedExpression, getExpression); - } - - private Expression GetConvertedSubMemberCall(MemberExpression node) - { - var baseExpression = Visit(node.Expression); - var propertyMap = FindPropertyMapOfExpression(node.Expression as MemberExpression); - if (propertyMap == null) - return node; - var sourceType = propertyMap.SourceMember.GetMemberType(); - var destType = propertyMap.DestinationPropertyType; - if (sourceType == destType) - return Expression.MakeMemberAccess(baseExpression, node.Member); - var typeMap = _configurationProvider.FindTypeMapFor(sourceType, destType); - var subVisitor = new MappingVisitor(_configurationProvider, typeMap, node.Expression, baseExpression, this); - var newExpression = subVisitor.Visit(node); - _destSubTypes = _destSubTypes.Concat(subVisitor._destSubTypes).ToArray(); - return newExpression; - } - - private PropertyMap FindPropertyMapOfExpression(MemberExpression expression) - { - var propertyMap = PropertyMap(expression); - if (propertyMap == null && expression.Expression is MemberExpression) - return FindPropertyMapOfExpression(expression.Expression as MemberExpression); - return propertyMap; - } - - private PropertyMap PropertyMap(MemberExpression node) - { - if (node.Member.IsStatic()) - return null; - - var memberAccessor = node.Member.ToMemberAccessor(); - var propertyMap = _typeMap.GetExistingPropertyMapFor(memberAccessor); - return propertyMap; - } - - private void SetSorceSubTypes(PropertyMap propertyMap) - { - if (propertyMap.SourceMember is PropertyInfo) - _destSubTypes = (propertyMap.SourceMember as PropertyInfo).PropertyType.GetTypeInfo().GenericTypeArguments.Concat(new []{ (propertyMap.SourceMember as PropertyInfo).PropertyType }).ToList(); - else if (propertyMap.SourceMember is FieldInfo) - _destSubTypes = (propertyMap.SourceMember as FieldInfo).FieldType.GetTypeInfo().GenericTypeArguments; - } - } - } -} diff --git a/src/AutoMapper/Mappers/FlagsEnumMapper.cs b/src/AutoMapper/Mappers/FlagsEnumMapper.cs index 7620c193f7..e695e22778 100644 --- a/src/AutoMapper/Mappers/FlagsEnumMapper.cs +++ b/src/AutoMapper/Mappers/FlagsEnumMapper.cs @@ -1,49 +1,40 @@ -using System.Linq.Expressions; -using System.Reflection; - -namespace AutoMapper.Mappers -{ - using System; - using System.Linq; - - public class FlagsEnumMapper : IObjectMapExpression - { - public static TDestination Map(TSource source, ResolutionContext context) - where TDestination : struct - { - Type enumDestType = TypeHelper.GetEnumerationType(typeof(TDestination)); - - if (source == null) - { - return (TDestination)(context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TDestination)) - : ObjectCreator.CreateObject(typeof(TDestination))); - } - - return (TDestination)Enum.Parse(enumDestType, source.ToString(), true); - } - - private static readonly MethodInfo MapMethodInfo = typeof(FlagsEnumMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new [] { context.SourceValue, context}); - } - - public bool IsMatch(TypePair context) - { - var sourceEnumType = TypeHelper.GetEnumerationType(context.SourceType); - var destEnumType = TypeHelper.GetEnumerationType(context.DestinationType); - - return sourceEnumType != null - && destEnumType != null - && sourceEnumType.GetCustomAttributes(typeof (FlagsAttribute), false).Any() - && destEnumType.GetCustomAttributes(typeof (FlagsAttribute), false).Any(); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression, contextExpression); - } - } +using System; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static ExpressionFactory; + + public class FlagsEnumMapper : IObjectMapper + { + private static readonly MethodInfo EnumParseMethod = Method(() => Enum.Parse(null, null, true)); + + public bool IsMatch(TypePair context) + { + var sourceEnumType = ElementTypeHelper.GetEnumerationType(context.SourceType); + var destEnumType = ElementTypeHelper.GetEnumerationType(context.DestinationType); + + return sourceEnumType != null + && destEnumType != null + && sourceEnumType.GetCustomAttributes(typeof (FlagsAttribute), false).Any() + && destEnumType.GetCustomAttributes(typeof (FlagsAttribute), false).Any(); + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + ToType( + Call(EnumParseMethod, + Constant(destExpression.Type), + Call(sourceExpression, sourceExpression.Type.GetDeclaredMethod("ToString")), + Constant(true) + ), + destExpression.Type + ); + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/FromDynamicMapper.cs b/src/AutoMapper/Mappers/FromDynamicMapper.cs new file mode 100644 index 0000000000..523088688e --- /dev/null +++ b/src/AutoMapper/Mappers/FromDynamicMapper.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.CompilerServices; +using AutoMapper.Execution; +using AutoMapper.Internal; +using Microsoft.CSharp.RuntimeBinder; +using Binder = Microsoft.CSharp.RuntimeBinder.Binder; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static ExpressionFactory; + + public class FromDynamicMapper : IObjectMapper + { + private static TDestination Map(TSource source, TDestination destination, ResolutionContext context, ProfileMap profileMap) + { + object boxedDestination = destination; + var destinationTypeDetails = profileMap.CreateTypeDetails(typeof(TDestination)); + foreach (var member in destinationTypeDetails.PublicWriteAccessors) + { + object sourceMemberValue; + try + { + sourceMemberValue = GetDynamically(member.Name, source); + } + catch (RuntimeBinderException) + { + continue; + } + var destinationMemberValue = context.MapMember(member, sourceMemberValue, boxedDestination); + member.SetMemberValue(boxedDestination, destinationMemberValue); + } + return (TDestination) boxedDestination; + } + + private static object GetDynamically(string memberName, object target) + { + var binder = Binder.GetMember(CSharpBinderFlags.None, memberName, null, + new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) }); + var callsite = CallSite>.Create(binder); + return callsite.Target(callsite, target); + } + + private static readonly MethodInfo MapMethodInfo = typeof(FromDynamicMapper).GetDeclaredMethod(nameof(Map)); + + public bool IsMatch(TypePair context) => context.SourceType.IsDynamic() && !context.DestinationType.IsDynamic(); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call(null, + MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), + sourceExpression, + ToType( + Coalesce(ToObject(destExpression), + DelegateFactory.GenerateConstructorExpression(destExpression.Type)), destExpression.Type), + contextExpression, + Constant(profileMap)); + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs b/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs new file mode 100644 index 0000000000..79df7712e0 --- /dev/null +++ b/src/AutoMapper/Mappers/FromStringDictionaryMapper.cs @@ -0,0 +1,48 @@ +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Execution; +using AutoMapper.Internal; +using static System.Linq.Expressions.Expression; +using StringDictionary = System.Collections.Generic.IDictionary; + +namespace AutoMapper.Mappers +{ + using static ExpressionFactory; + + public class FromStringDictionaryMapper : IObjectMapper + { + private static readonly MethodInfo MapMethodInfo = + typeof(FromStringDictionaryMapper).GetDeclaredMethod(nameof(Map)); + + public bool IsMatch(TypePair context) => typeof(StringDictionary).IsAssignableFrom(context.SourceType); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call(null, + MapMethodInfo.MakeGenericMethod(destExpression.Type), + sourceExpression, + Condition( + Equal(ToObject(destExpression), Constant(null)), + DelegateFactory.GenerateConstructorExpression(destExpression.Type), + destExpression), + contextExpression, + Constant(profileMap)); + + private static TDestination Map(StringDictionary source, TDestination destination, ResolutionContext context, ProfileMap profileMap) + { + var destTypeDetails = profileMap.CreateTypeDetails(typeof(TDestination)); + var members = from name in source.Keys + join member in destTypeDetails.PublicWriteAccessors on name equals member.Name + select member; + object boxedDestination = destination; + foreach (var member in members) + { + var value = context.MapMember(member, source[member.Name], boxedDestination); + member.SetMemberValue(boxedDestination, value); + } + return (TDestination) boxedDestination; + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/HashSetMapper.cs b/src/AutoMapper/Mappers/HashSetMapper.cs index adc973718f..48a1b8460f 100644 --- a/src/AutoMapper/Mappers/HashSetMapper.cs +++ b/src/AutoMapper/Mappers/HashSetMapper.cs @@ -1,73 +1,22 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - using System; - using System.Reflection; - using System.Collections.Generic; - using System.Linq; - using Configuration; - - public class HashSetMapper : IObjectMapExpression - { - public static ISet Map(IEnumerable source, ISet destination, ResolutionContext context) - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - { - return null; - } - - destination = destination ?? new HashSet(); - - destination.Clear(); - - var itemContext = new ResolutionContext(context); - foreach (var item in source ?? Enumerable.Empty()) - { - destination.Add((TDestination) itemContext.Map(item, default(TDestination), typeof(TSource), typeof(TDestination))); - } - - return destination; - } - - private static readonly MethodInfo MapMethodInfo = typeof(HashSetMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - var srcType = TypeHelper.GetElementType(context.SourceType); - var destType = TypeHelper.GetElementType(context.DestinationType); - - return MapMethodInfo.MakeGenericMethod(srcType, destType).Invoke(null, new [] { context.SourceValue, context.DestinationValue, context }); - } - - public bool IsMatch(TypePair context) - { - var isMatch = context.SourceType.IsEnumerableType() && IsSetType(context.DestinationType); - - return isMatch; - } - - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, - MapMethodInfo.MakeGenericMethod(TypeHelper.GetElementType(sourceExpression.Type), TypeHelper.GetElementType(destExpression.Type)), - sourceExpression, destExpression, contextExpression); - } - - private static bool IsSetType(Type type) - { - if (type.IsGenericType() && type.GetGenericTypeDefinition() == typeof (ISet<>)) - { - return true; - } - - IEnumerable genericInterfaces = type.GetTypeInfo().ImplementedInterfaces.Where(t => t.IsGenericType()); - IEnumerable baseDefinitions = genericInterfaces.Select(t => t.GetGenericTypeDefinition()); - - var isCollectionType = baseDefinitions.Any(t => t == typeof (ISet<>)); - - return isCollectionType; - } - } +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static CollectionMapperExpressionFactory; + + public class HashSetMapper : IObjectMapper + { + public bool IsMatch(TypePair context) + => context.SourceType.IsEnumerableType() && IsSetType(context.DestinationType); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + => MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, destExpression, contextExpression, typeof(HashSet<>), MapItemExpr); + + private static bool IsSetType(Type type) => type.IsSetType(); + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ImplicitConversionOperatorMapper.cs b/src/AutoMapper/Mappers/ImplicitConversionOperatorMapper.cs index c1b0ef264f..d60b22d899 100644 --- a/src/AutoMapper/Mappers/ImplicitConversionOperatorMapper.cs +++ b/src/AutoMapper/Mappers/ImplicitConversionOperatorMapper.cs @@ -1,46 +1,35 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - using System.Linq; - using System.Reflection; - using Configuration; - - public class ImplicitConversionOperatorMapper : IObjectMapExpression - { - public object Map(ResolutionContext context) - { - var implicitOperator = GetImplicitConversionOperator(context.Types); - - return implicitOperator.Invoke(null, new[] {context.SourceValue}); - } - - public bool IsMatch(TypePair context) - { - var methodInfo = GetImplicitConversionOperator(context); - - return methodInfo != null; - } - - private static MethodInfo GetImplicitConversionOperator(TypePair context) - { - var destinationType = context.DestinationType; - if(destinationType.IsNullableType()) - { - destinationType = destinationType.GetTypeOfNullable(); - } - var sourceTypeMethod = context.SourceType - .GetDeclaredMethods() - .FirstOrDefault(mi => mi.IsPublic && mi.IsStatic && mi.Name == "op_Implicit" && mi.ReturnType == destinationType); - - return sourceTypeMethod ?? destinationType.GetMethod("op_Implicit", new[] { context.SourceType }); - } - - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - var implicitOperator = GetImplicitConversionOperator(new TypePair(sourceExpression.Type, destExpression.Type)); - return Expression.Call(null, implicitOperator, sourceExpression); - } - } +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; + +namespace AutoMapper.Mappers +{ + public class ImplicitConversionOperatorMapper : IObjectMapper + { + public bool IsMatch(TypePair context) + { + var methodInfo = GetImplicitConversionOperator(context); + + return methodInfo != null; + } + + private static MethodInfo GetImplicitConversionOperator(TypePair context) + { + var destinationType = context.DestinationType; + var sourceTypeMethod = context.SourceType + .GetDeclaredMethods() + .FirstOrDefault(mi => mi.IsPublic && mi.IsStatic && mi.Name == "op_Implicit" && mi.ReturnType == destinationType); + + return sourceTypeMethod ?? destinationType.GetDeclaredMethod("op_Implicit", new[] { context.SourceType }); + } + + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + { + var implicitOperator = GetImplicitConversionOperator(new TypePair(sourceExpression.Type, destExpression.Type)); + return Expression.Call(null, implicitOperator, sourceExpression); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/Internal/CollectionMapperExpressionFactory.cs b/src/AutoMapper/Mappers/Internal/CollectionMapperExpressionFactory.cs new file mode 100644 index 0000000000..a75e477d9c --- /dev/null +++ b/src/AutoMapper/Mappers/Internal/CollectionMapperExpressionFactory.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper.Execution; +using AutoMapper.Internal; + +namespace AutoMapper.Mappers.Internal +{ + using static Expression; + using static ExpressionBuilder; + using static ExpressionFactory; + using static ElementTypeHelper; + + public static class CollectionMapperExpressionFactory + { + public delegate Expression MapItem(IConfigurationProvider configurationProvider, ProfileMap profileMap, + Type sourceType, Type destType, Expression contextParam, + out ParameterExpression itemParam); + + public static Expression MapCollectionExpression(IConfigurationProvider configurationProvider, + ProfileMap profileMap, IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression, Type ifInterfaceType, MapItem mapItem) + { + var passedDestination = Variable(destExpression.Type, "passedDestination"); + var newExpression = Variable(passedDestination.Type, "collectionDestination"); + var sourceElementType = GetElementType(sourceExpression.Type); + + var itemExpr = mapItem(configurationProvider, profileMap, sourceExpression.Type, passedDestination.Type, + contextExpression, out ParameterExpression itemParam); + + var destinationElementType = itemExpr.Type; + var destinationCollectionType = typeof(ICollection<>).MakeGenericType(destinationElementType); + if (!destinationCollectionType.IsAssignableFrom(destExpression.Type)) + destinationCollectionType = typeof(IList); + var addMethod = destinationCollectionType.GetDeclaredMethod("Add"); + + Expression destination, assignNewExpression; + + UseDestinationValue(); + + var addItems = ForEach(sourceExpression, itemParam, Call(destination, addMethod, itemExpr)); + var mapExpr = Block(addItems, destination); + + var clearMethod = destinationCollectionType.GetDeclaredMethod("Clear"); + var checkNull = + Block(new[] { newExpression, passedDestination }, + Assign(passedDestination, destExpression), + assignNewExpression, + Call(destination, clearMethod), + mapExpr + ); + if (memberMap != null) + return checkNull; + var elementTypeMap = configurationProvider.ResolveTypeMap(sourceElementType, destinationElementType); + if (elementTypeMap == null) + return checkNull; + var checkContext = CheckContext(elementTypeMap, contextExpression); + if (checkContext == null) + return checkNull; + return Block(checkContext, checkNull); + void UseDestinationValue() + { + if(memberMap?.UseDestinationValue == true) + { + destination = passedDestination; + assignNewExpression = Empty(); + } + else + { + destination = newExpression; + Expression createInstance = passedDestination.Type.NewExpr(ifInterfaceType); + var isReadOnly = Property(ToType(passedDestination, destinationCollectionType), "IsReadOnly"); + assignNewExpression = Assign(newExpression, + Condition(OrElse(Equal(passedDestination, Constant(null)), isReadOnly), ToType(createInstance, passedDestination.Type), passedDestination)); + } + } + } + + private static Expression NewExpr(this Type baseType, Type ifInterfaceType) + { + var newExpr = baseType.IsInterface() + ? New( + ifInterfaceType.MakeGenericType(GetElementTypes(baseType, + ElementTypeFlags.BreakKeyValuePair))) + : DelegateFactory.GenerateConstructorExpression(baseType); + return newExpr; + } + + public static Expression MapItemExpr(IConfigurationProvider configurationProvider, ProfileMap profileMap, Type sourceType, Type destType, Expression contextParam, out ParameterExpression itemParam) + { + var sourceElementType = GetElementType(sourceType); + var destElementType = GetElementType(destType); + itemParam = Parameter(sourceElementType, "item"); + + var typePair = new TypePair(sourceElementType, destElementType); + + var itemExpr = MapExpression(configurationProvider, profileMap, typePair, itemParam, contextParam); + return ToType(itemExpr, destElementType); + } + + public static Expression MapKeyPairValueExpr(IConfigurationProvider configurationProvider, ProfileMap profileMap, Type sourceType, Type destType, Expression contextParam, out ParameterExpression itemParam) + { + var sourceElementTypes = GetElementTypes(sourceType, ElementTypeFlags.BreakKeyValuePair); + var destElementTypes = GetElementTypes(destType, ElementTypeFlags.BreakKeyValuePair); + + var typePairKey = new TypePair(sourceElementTypes[0], destElementTypes[0]); + var typePairValue = new TypePair(sourceElementTypes[1], destElementTypes[1]); + + var sourceElementType = typeof(KeyValuePair<,>).MakeGenericType(sourceElementTypes); + itemParam = Parameter(sourceElementType, "item"); + var destElementType = typeof(KeyValuePair<,>).MakeGenericType(destElementTypes); + + var keyExpr = MapExpression(configurationProvider, profileMap, typePairKey, + Property(itemParam, "Key"), contextParam); + var valueExpr = MapExpression(configurationProvider, profileMap, typePairValue, + Property(itemParam, "Value"), contextParam); + var keyPair = New(destElementType.GetDeclaredConstructors().First(), keyExpr, valueExpr); + return keyPair; + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/Internal/ElementTypeHelper.cs b/src/AutoMapper/Mappers/Internal/ElementTypeHelper.cs new file mode 100644 index 0000000000..1568242927 --- /dev/null +++ b/src/AutoMapper/Mappers/Internal/ElementTypeHelper.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using AutoMapper.Configuration; + +namespace AutoMapper.Mappers.Internal +{ + public static class ElementTypeHelper + { + public static Type GetElementType(Type enumerableType) => GetElementTypes(enumerableType, null)[0]; + + public static Type[] GetElementTypes(Type enumerableType, ElementTypeFlags flags = ElementTypeFlags.None) => + GetElementTypes(enumerableType, null, flags); + + public static Type GetElementType(Type enumerableType, IEnumerable enumerable) => GetElementTypes(enumerableType, enumerable)[0]; + + public static Type[] GetElementTypes(Type enumerableType, IEnumerable enumerable, + ElementTypeFlags flags = ElementTypeFlags.None) + { + if (enumerableType.HasElementType) + { + return new[] {enumerableType.GetElementType()}; + } + + var iDictionaryType = enumerableType.GetDictionaryType(); + if (iDictionaryType != null && flags.HasFlag(ElementTypeFlags.BreakKeyValuePair)) + { + return iDictionaryType.GetTypeInfo().GenericTypeArguments; + } + + var iReadOnlyDictionaryType = enumerableType.GetReadOnlyDictionaryType(); + if (iReadOnlyDictionaryType != null && flags.HasFlag(ElementTypeFlags.BreakKeyValuePair)) + { + return iReadOnlyDictionaryType.GetTypeInfo().GenericTypeArguments; + } + + var iEnumerableType = enumerableType.GetIEnumerableType(); + if (iEnumerableType != null) + { + return iEnumerableType.GetTypeInfo().GenericTypeArguments; + } + + if (typeof(IEnumerable).IsAssignableFrom(enumerableType)) + { + var first = enumerable?.Cast().FirstOrDefault(); + + return new[] {first?.GetType() ?? typeof(object)}; + } + + throw new ArgumentException($"Unable to find the element type for type '{enumerableType}'.", + nameof(enumerableType)); + } + + public static Type GetEnumerationType(Type enumType) + { + return !enumType.IsEnum() ? null : enumType; + } + + internal static IEnumerable GetStaticMethods(this Type type) + { + return type.GetRuntimeMethods().Where(m => m.IsStatic); + } + } + + public enum ElementTypeFlags + { + None = 0, + BreakKeyValuePair = 1 + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/MapperRegistry.cs b/src/AutoMapper/Mappers/MapperRegistry.cs index 6218089840..581f318ddc 100644 --- a/src/AutoMapper/Mappers/MapperRegistry.cs +++ b/src/AutoMapper/Mappers/MapperRegistry.cs @@ -1,57 +1,40 @@ -using System.Collections.Generic; - -namespace AutoMapper.Mappers -{ - public static class MapperRegistry - { - private static readonly IObjectMapper[] _initialMappers = - { - new ExpressionMapper(), - new FlagsEnumMapper(), - new StringToEnumMapper(), - new EnumToEnumMapper(), - new EnumToUnderlyingTypeMapper(), - new MultidimensionalArrayMapper(), - new PrimitiveArrayMapper(), - new ArrayMapper(), - new EnumerableToDictionaryMapper(), -#if !PORTABLE - new NameValueCollectionMapper(), -#endif - new DictionaryMapper(), - new ReadOnlyCollectionMapper(), - new HashSetMapper(), - new CollectionMapper(), - new EnumerableMapper(), - new StringMapper(), - new AssignableMapper(), -#if !PORTABLE - new TypeConverterMapper(), -#endif - new NullableSourceMapper(), - new ImplicitConversionOperatorMapper(), - new ExplicitConversionOperatorMapper(), - new ConvertMapper(), - new FromStringDictionaryMapper(), - new ToStringDictionaryMapper(), - new FromDynamicMapper(), - new ToDynamicMapper() - }; - - private static readonly List _mappers = new List(_initialMappers); - - /// - /// Extension point for modifying list of object mappers - /// - public static IList Mappers => _mappers; - - /// - /// Reset mapper registry to built-in values - /// - public static void Reset() - { - _mappers.Clear(); - _mappers.AddRange(_initialMappers); - } - } +using System.Collections.Generic; + +namespace AutoMapper.Mappers +{ + internal static class MapperRegistry + { + public static IList Mappers() => new List + { + new NullableSourceMapper(), + new NullableDestinationMapper(), + new FlagsEnumMapper(), + new StringToEnumMapper(), + new EnumToStringMapper(), + new EnumToEnumMapper(), + new EnumToUnderlyingTypeMapper(), + new UnderlyingTypeToEnumMapper(), + new MultidimensionalArrayMapper(), + new ArrayCopyMapper(), + new ArrayMapper(), + new EnumerableToDictionaryMapper(), + new NameValueCollectionMapper(), + new ReadOnlyDictionaryMapper(), + new DictionaryMapper(), + new ReadOnlyCollectionMapper(), + new HashSetMapper(), + new CollectionMapper(), + new EnumerableMapper(), + new AssignableMapper(), + new ConvertMapper(), + new StringMapper(), + new TypeConverterMapper(), + new ImplicitConversionOperatorMapper(), + new ExplicitConversionOperatorMapper(), + new FromStringDictionaryMapper(), + new ToStringDictionaryMapper(), + new FromDynamicMapper(), + new ToDynamicMapper() + }; + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/MultidimensionalArrayMapper.cs b/src/AutoMapper/Mappers/MultidimensionalArrayMapper.cs index 61af352414..c5034ba0e3 100644 --- a/src/AutoMapper/Mappers/MultidimensionalArrayMapper.cs +++ b/src/AutoMapper/Mappers/MultidimensionalArrayMapper.cs @@ -1,114 +1,97 @@ +using System; +using System.Collections; using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; namespace AutoMapper.Mappers { - using System; - using System.Collections; - using System.Linq; - using Configuration; + using static Expression; - public class MultidimensionalArrayMapper : IObjectMapExpression + public class MultidimensionalArrayMapper : IObjectMapper { - static MultidimensionalArrayFiller filler; - - public static Array Map(TSource source, ResolutionContext context) + private static Array Map(TSource source, ResolutionContext context) where TSource : IEnumerable { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; - - var destElementType = TypeHelper.GetElementType(typeof(TDestination)); + var destElementType = ElementTypeHelper.GetElementType(typeof(TDestination)); - if (!context.IsSourceValueNull && context.DestinationType.IsAssignableFrom(context.SourceType)) + if (typeof(TDestination).IsAssignableFrom(typeof(TSource))) { var elementTypeMap = context.ConfigurationProvider.ResolveTypeMap(typeof(TSourceElement), destElementType); if (elementTypeMap == null) return source as Array; } - IEnumerable sourceList = source; - if (sourceList == null) - sourceList = typeof(TSource).GetTypeInfo().IsInterface ? - new List() : - (IEnumerable)(context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TSource)) - : ObjectCreator.CreateObject(typeof(TSource))); + var sourceList = (IEnumerable)source; + var sourceArray = source as Array; + var destinationArray = sourceArray == null + ? Array.CreateInstance(destElementType, sourceList.Cast().Count()) + : Array.CreateInstance(destElementType, Enumerable.Range(0, sourceArray.Rank).Select(sourceArray.GetLength).ToArray()); - var sourceLength = sourceList.OfType().Count(); - var sourceArray = context.SourceValue as Array; - Array destinationArray; - if (sourceArray == null) - { - destinationArray = ObjectCreator.CreateArray(destElementType, sourceLength); - } - else + var filler = new MultidimensionalArrayFiller(destinationArray); + foreach (var item in sourceList) { - destinationArray = ObjectCreator.CreateArray(destElementType, sourceArray); - filler = new MultidimensionalArrayFiller(destinationArray); - } - var itemContext = new ResolutionContext(context); - foreach(var item in sourceList) - { - filler.NewValue(itemContext.Map(item, null, typeof(TSourceElement), destElementType)); + filler.NewValue(context.Map(item, null, typeof(TSourceElement), destElementType, null)); } return destinationArray; } - private static readonly MethodInfo MapMethodInfo = typeof(MultidimensionalArrayMapper).GetAllMethods().First(_ => _.IsStatic); + private static readonly MethodInfo MapMethodInfo = typeof(MultidimensionalArrayMapper).GetDeclaredMethod(nameof(Map)); - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.DestinationType, context.SourceType, TypeHelper.GetElementType(context.SourceType, (IEnumerable)context.SourceValue)).Invoke(null, new[] { context.SourceValue, context }); - } + public bool IsMatch(TypePair context) => + context.DestinationType.IsArray + && context.DestinationType.GetArrayRank() > 1 + && context.SourceType.IsEnumerableType(); - public bool IsMatch(TypePair context) - { - return context.DestinationType.IsArray && context.DestinationType.GetArrayRank() > 1 && context.SourceType.IsEnumerableType(); - } + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call(null, + MapMethodInfo.MakeGenericMethod(destExpression.Type, sourceExpression.Type, + ElementTypeHelper.GetElementType(sourceExpression.Type)), + sourceExpression, + contextExpression); - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) + public class MultidimensionalArrayFiller { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(destExpression.Type, sourceExpression.Type, TypeHelper.GetElementType(sourceExpression.Type)), sourceExpression, contextExpression); - } - } - - public class MultidimensionalArrayFiller - { - int[] indices; - Array destination; + private readonly int[] _indices; + private readonly Array _destination; - public MultidimensionalArrayFiller(Array destination) - { - indices = new int[destination.Rank]; - this.destination = destination; - } + public MultidimensionalArrayFiller(Array destination) + { + _indices = new int[destination.Rank]; + _destination = destination; + } - public void NewValue(object value) - { - int dimension = destination.Rank - 1; - bool changedDimension = false; - while(indices[dimension] == destination.GetLength(dimension)) + public void NewValue(object value) { - indices[dimension] = 0; - dimension--; - if(dimension < 0) + var dimension = _destination.Rank - 1; + var changedDimension = false; + while (_indices[dimension] == _destination.GetLength(dimension)) { - throw new InvalidOperationException("Not enough room in destination array " + destination); + _indices[dimension] = 0; + dimension--; + if (dimension < 0) + { + throw new InvalidOperationException("Not enough room in destination array " + _destination); + } + _indices[dimension]++; + changedDimension = true; + } + _destination.SetValue(value, _indices); + if (changedDimension) + { + _indices[dimension + 1]++; + } + else + { + _indices[dimension]++; } - indices[dimension]++; - changedDimension = true; - } - destination.SetValue(value, indices); - if(changedDimension) - { - indices[dimension+1]++; - } - else - { - indices[dimension]++; } } } -} \ No newline at end of file + +} diff --git a/src/AutoMapper/Mappers/NameValueCollectionMapper.cs b/src/AutoMapper/Mappers/NameValueCollectionMapper.cs index 7ffb4d65c9..e35a79660e 100644 --- a/src/AutoMapper/Mappers/NameValueCollectionMapper.cs +++ b/src/AutoMapper/Mappers/NameValueCollectionMapper.cs @@ -1,20 +1,14 @@ -using System; -using System.Linq; +using System.Collections.Specialized; using System.Linq.Expressions; +using static System.Linq.Expressions.Expression; using System.Reflection; -#if !PORTABLE namespace AutoMapper.Mappers { - using System.Collections.Specialized; - - public class NameValueCollectionMapper : IObjectMapExpression + public class NameValueCollectionMapper : IObjectMapper { - public static NameValueCollection Map(NameValueCollection source) + private static NameValueCollection Map(NameValueCollection source) { - if (source == null) - return null; - var nvc = new NameValueCollection(); foreach (var s in source.AllKeys) nvc.Add(s, source[s]); @@ -22,24 +16,13 @@ public static NameValueCollection Map(NameValueCollection source) return nvc; } - private static readonly MethodInfo MapMethodInfo = typeof(NameValueCollectionMapper).GetAllMethods().First(_ => _.IsStatic); + private static readonly MethodInfo MapMethodInfo = typeof(NameValueCollectionMapper).GetDeclaredMethod(nameof(Map)); - public object Map(ResolutionContext context) - { - return MapMethodInfo.Invoke(null, new [] {context.SourceValue}); - } + public bool IsMatch(TypePair context) => context.SourceType == typeof (NameValueCollection) && + context.DestinationType == typeof (NameValueCollection); - public bool IsMatch(TypePair context) - { - return - context.SourceType == typeof (NameValueCollection) && - context.DestinationType == typeof (NameValueCollection); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo, sourceExpression); - } + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) => + Call(null, MapMethodInfo, sourceExpression); } } -#endif \ No newline at end of file diff --git a/src/AutoMapper/Mappers/NullableDestinationMapper.cs b/src/AutoMapper/Mappers/NullableDestinationMapper.cs new file mode 100644 index 0000000000..4c1029d74f --- /dev/null +++ b/src/AutoMapper/Mappers/NullableDestinationMapper.cs @@ -0,0 +1,27 @@ +using System; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Execution; + +namespace AutoMapper.Mappers +{ + public class NullableDestinationMapper : IObjectMapperInfo + { + public bool IsMatch(TypePair context) => context.DestinationType.IsNullableType(); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + ExpressionBuilder.MapExpression(configurationProvider, profileMap, + new TypePair(sourceExpression.Type, Nullable.GetUnderlyingType(destExpression.Type)), + sourceExpression, + contextExpression, + memberMap + ); + + public TypePair GetAssociatedTypes(TypePair initialTypes) + { + return new TypePair(initialTypes.SourceType, Nullable.GetUnderlyingType(initialTypes.DestinationType)); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/NullableMapper.cs b/src/AutoMapper/Mappers/NullableMapper.cs deleted file mode 100644 index a8f4f1acf6..0000000000 --- a/src/AutoMapper/Mappers/NullableMapper.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - using Configuration; - - public class NullableMapper : IObjectMapExpression - { - public object Map(ResolutionContext context) - { - return context.SourceValue; - } - - public bool IsMatch(TypePair context) - { - return context.DestinationType.IsNullableType(); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return sourceExpression; - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/NullableSourceMapper.cs b/src/AutoMapper/Mappers/NullableSourceMapper.cs index 42d22c856f..520272990f 100644 --- a/src/AutoMapper/Mappers/NullableSourceMapper.cs +++ b/src/AutoMapper/Mappers/NullableSourceMapper.cs @@ -1,34 +1,30 @@ -using System.Linq; +using System; using System.Linq.Expressions; -using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Execution; namespace AutoMapper.Mappers { - using Configuration; + using static Expression; - public class NullableSourceMapper : IObjectMapExpression + public class NullableSourceMapper : IObjectMapperInfo { - public static TDestination Map(TDestination? source) - where TDestination : struct - { - return source.GetValueOrDefault(); - } - - private static readonly MethodInfo MapMethodInfo = typeof(NullableSourceMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.DestinationType).Invoke(null, new [] {context.SourceValue}); - } + public bool IsMatch(TypePair context) => context.SourceType.IsNullableType(); - public bool IsMatch(TypePair context) - { - return context.SourceType.IsNullableType() && !context.DestinationType.IsNullableType() && context.DestinationType == context.SourceType.GetTypeOfNullable(); - } + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + ExpressionBuilder.MapExpression(configurationProvider, profileMap, + new TypePair(Nullable.GetUnderlyingType(sourceExpression.Type), destExpression.Type), + Property(sourceExpression, sourceExpression.Type.GetDeclaredProperty("Value")), + contextExpression, + memberMap, + destExpression + ); - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) + public TypePair GetAssociatedTypes(TypePair initialTypes) { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(destExpression.Type), sourceExpression); + return new TypePair(Nullable.GetUnderlyingType(initialTypes.SourceType), initialTypes.DestinationType); } } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ObjectCreator.cs b/src/AutoMapper/Mappers/ObjectCreator.cs deleted file mode 100644 index a1b7a1501c..0000000000 --- a/src/AutoMapper/Mappers/ObjectCreator.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace AutoMapper.Mappers -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Configuration; - using Execution; - - /// - /// Instantiates objects - /// - public static class ObjectCreator - { - public static readonly DelegateFactory DelegateFactory = new DelegateFactory(); - - public static Array CreateArray(Type elementType, int length) - { - return Array.CreateInstance(elementType, length); - } - - public static Array CreateArray(Type elementType, Array sourceArray) - { - return Array.CreateInstance(elementType, sourceArray.GetLengths()); - } - - public static IList CreateList(Type elementType) - { - Type destListType = typeof (List<>).MakeGenericType(elementType); - return (IList) CreateObject(destListType); - } - - public static object CreateDictionary(Type dictionaryType, Type keyType, Type valueType) - { - var type = dictionaryType.IsInterface() - ? typeof (Dictionary<,>).MakeGenericType(keyType, valueType) - : dictionaryType; - - return CreateObject(type); - } - - public static object CreateDictionary(Type dictionaryType) - { - Type keyType = dictionaryType.GetTypeInfo().GenericTypeArguments[0]; - Type valueType = dictionaryType.GetTypeInfo().GenericTypeArguments[1]; - var type = dictionaryType.IsInterface() - ? typeof (Dictionary<,>).MakeGenericType(keyType, valueType) - : dictionaryType; - - return DelegateFactory.CreateCtor(type)(); - } - - public static object CreateDefaultValue(Type type) - { - return type.IsValueType() ? CreateObject(type) : null; - } - - public static object CreateNonNullValue(Type type) - { - return type.IsValueType() - ? CreateObject(type) - : type == typeof (string) - ? string.Empty - : CreateObject(type); - } - - public static object CreateObject(Type type) - { - return type.IsArray - ? CreateArray(type.GetElementType(), 0) - : type == typeof (string) - ? null - : type.IsDictionaryType() - ? CreateDictionary(type) - : DelegateFactory.CreateCtor(type)(); - } - } - - internal static class ArrayExtensions - { - public static int[] GetLengths(this Array array) - { - return Enumerable.Range(0, array.Rank).Select(dimension => array.GetLength(dimension)).ToArray(); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/PrimitiveArrayMapper.cs b/src/AutoMapper/Mappers/PrimitiveArrayMapper.cs deleted file mode 100644 index eb596bcb68..0000000000 --- a/src/AutoMapper/Mappers/PrimitiveArrayMapper.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Linq; -using System.Linq.Expressions; - -namespace AutoMapper.Mappers -{ - using System; - using System.Reflection; - - public class PrimitiveArrayMapper : IObjectMapExpression - { - public static TDestElement[] Map(TSourceElement[] source, ResolutionContext context) - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - { - return null; - } - - if (source != null && typeof(TDestElement).IsAssignableFrom(typeof(TSourceElement))) - { - return source as TDestElement[]; - } - - var sourceArray = source ?? new TSourceElement[0]; - - int sourceLength = sourceArray.Length; - TDestElement[] destArray = new TDestElement[sourceLength]; - - Array.Copy(sourceArray, destArray, sourceLength); - - return destArray; - } - - private static readonly MethodInfo MapMethodInfo = typeof(PrimitiveArrayMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - Type sourceElementType = TypeHelper.GetElementType(context.SourceType); - Type destElementType = TypeHelper.GetElementType(context.SourceType); - - return - MapMethodInfo.MakeGenericMethod(sourceElementType, destElementType) - .Invoke(null, new[] { context.SourceValue, context }); - } - - private bool IsPrimitiveArrayType(Type type) - { - if (type.IsArray) - { - Type elementType = TypeHelper.GetElementType(type); - return elementType.IsPrimitive() || elementType.Equals(typeof (string)); - } - - return false; - } - - public bool IsMatch(TypePair context) - { - return IsPrimitiveArrayType(context.DestinationType) && - IsPrimitiveArrayType(context.SourceType) && - (TypeHelper.GetElementType(context.DestinationType) - .Equals(TypeHelper.GetElementType(context.SourceType))); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - Type sourceElementType = TypeHelper.GetElementType(sourceExpression.Type); - Type destElementType = TypeHelper.GetElementType(destExpression.Type); - - return Expression.Call(null, - MapMethodInfo.MakeGenericMethod(sourceElementType, destElementType), sourceExpression, contextExpression); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ReadOnlyCollectionMapper.cs b/src/AutoMapper/Mappers/ReadOnlyCollectionMapper.cs index e00643278f..0cea444981 100644 --- a/src/AutoMapper/Mappers/ReadOnlyCollectionMapper.cs +++ b/src/AutoMapper/Mappers/ReadOnlyCollectionMapper.cs @@ -1,42 +1,17 @@ -using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Linq.Expressions; -using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Mappers.Internal; namespace AutoMapper.Mappers { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using Configuration; + using static Expression; + using static CollectionMapperExpressionFactory; - public class ReadOnlyCollectionMapper : IObjectMapExpression + public class ReadOnlyCollectionMapper : IObjectMapper { - public static ReadOnlyCollection Map(TSource source, ResolutionContext context) - where TSource : IEnumerable - { - if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context)) - return null; - - IList list = new List(); - - var itemContext = new ResolutionContext(context); - foreach(var item in (IEnumerable)source ?? Enumerable.Empty()) - { - list.Add((TDestinationItem)itemContext.Map(item, default(TDestinationItem), typeof(TSourceItem), typeof(TDestinationItem))); - } - return new ReadOnlyCollection(list); - } - - private static readonly MethodInfo MapMethodInfo = typeof(ReadOnlyCollectionMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return - MapMethodInfo.MakeGenericMethod(context.SourceType, TypeHelper.GetElementType(context.SourceType), TypeHelper.GetElementType(context.DestinationType)) - .Invoke(null, new[] { context.SourceValue, context }); - } - public bool IsMatch(TypePair context) { if (!(context.SourceType.IsEnumerableType() && context.DestinationType.IsGenericType())) @@ -47,9 +22,21 @@ public bool IsMatch(TypePair context) return genericType == typeof (ReadOnlyCollection<>); } - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, TypeHelper.GetElementType(sourceExpression.Type), TypeHelper.GetElementType(destExpression.Type)), sourceExpression, contextExpression); + var listType = typeof(List<>).MakeGenericType(ElementTypeHelper.GetElementType(destExpression.Type)); + var list = MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, Default(listType), contextExpression, typeof(List<>), MapItemExpr); + var dest = Variable(listType, "dest"); + + var ctor = destExpression.Type.GetDeclaredConstructors() + .First(ci => ci.GetParameters().Length == 1 && ci.GetParameters()[0].ParameterType.IsAssignableFrom(dest.Type)); + + return Block(new[] { dest }, + Assign(dest, list), + Condition(NotEqual(dest, Default(listType)), + New(ctor, dest), + Default(destExpression.Type))); } } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ReadOnlyDictionaryMapper.cs b/src/AutoMapper/Mappers/ReadOnlyDictionaryMapper.cs new file mode 100644 index 0000000000..ac0bb92458 --- /dev/null +++ b/src/AutoMapper/Mappers/ReadOnlyDictionaryMapper.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static ExpressionFactory; + using static CollectionMapperExpressionFactory; + + public class ReadOnlyDictionaryMapper : IObjectMapper + { + public bool IsMatch(TypePair context) + { + if (!(context.SourceType.IsEnumerableType() && context.DestinationType.IsGenericType())) + return false; + + var genericType = context.DestinationType.GetGenericTypeDefinition(); + + return genericType == typeof(ReadOnlyDictionary<,>) || genericType == typeof(IReadOnlyDictionary<,>); + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + { + var dictionaryTypes = ElementTypeHelper.GetElementTypes(destExpression.Type, ElementTypeFlags.BreakKeyValuePair); + var dictType = typeof(Dictionary<,>).MakeGenericType(dictionaryTypes); + var dict = MapCollectionExpression(configurationProvider, profileMap, memberMap, sourceExpression, Default(dictType), contextExpression, typeof(Dictionary<,>), MapKeyPairValueExpr); + var dest = Variable(dictType, "dest"); + + var readOnlyDictType = destExpression.Type.IsInterface + ? typeof(ReadOnlyDictionary<,>).MakeGenericType(dictionaryTypes) + : destExpression.Type; + + var ctor = readOnlyDictType.GetDeclaredConstructors() + .First(ci => ci.GetParameters().Length == 1 && ci.GetParameters()[0].ParameterType.IsAssignableFrom(dest.Type)); + + return Block(new[] { dest }, + Assign(dest, dict), + Condition(NotEqual(dest, Default(dictType)), + ToType(New(ctor, dest), destExpression.Type), + Default(destExpression.Type))); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/StringDictionaryMapper.cs b/src/AutoMapper/Mappers/StringDictionaryMapper.cs deleted file mode 100644 index fd2db31514..0000000000 --- a/src/AutoMapper/Mappers/StringDictionaryMapper.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using StringDictionary = System.Collections.Generic.IDictionary; - -namespace AutoMapper.Mappers -{ - using System; - using Execution; - - public class ToStringDictionaryMapper : IObjectMapExpression - { - public static Dictionary MembersDictionary(ResolutionContext context) - { - var source = context.SourceValue; - var sourceTypeDetails = new TypeDetails(source.GetType(), _ => true, _ => true); - var membersDictionary = sourceTypeDetails.PublicReadAccessors.ToDictionary(p => p.Name, - p => p.GetMemberValue(source)); - return membersDictionary; - } - - private static readonly MethodInfo MapMethodInfo = typeof(DictionaryMapper).GetAllMethods().First(_ => _.IsStatic); - private static readonly MethodInfo MembersDictionaryMethodInfo = typeof(ToStringDictionaryMapper).GetAllMethods().First(_ => _.IsStatic); - - public bool IsMatch(TypePair context) - { - return typeof(StringDictionary).IsAssignableFrom(context.DestinationType); - } - - public object Map(ResolutionContext context) - { - var membersDictionary = MembersDictionary(context); - - return - MapMethodInfo.MakeGenericMethod(typeof(StringDictionary), typeof(string), typeof(object), context.DestinationType, typeof(string), typeof(object)) - .Invoke(null, new[] { membersDictionary, context.DestinationValue, context }); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - var membersDictionaryExpression = Expression.Call(null, MembersDictionaryMethodInfo, contextExpression); - - return Expression.Call(null, - MapMethodInfo.MakeGenericMethod(typeof(StringDictionary), typeof(string), typeof(object), destExpression.Type, typeof(string), typeof(object)), - membersDictionaryExpression, destExpression, contextExpression); - } - } - - public class FromStringDictionaryMapper : IObjectMapper, IObjectMapExpression - { - public bool IsMatch(TypePair context) - { - return typeof(StringDictionary).IsAssignableFrom(context.SourceType); - } - - private static TDestination Map(StringDictionary source, ResolutionContext context) - { - TDestination destination = context.Mapper.CreateObject(context); - var destTypeDetails = new TypeDetails(context.DestinationType, _ => true, _ => true); - var members = from name in source.Keys - join member in destTypeDetails.PublicWriteAccessors on name equals member.Name - select member; - var memberContext = new ResolutionContext(context); - foreach (var member in members) - { - object value = memberContext.Map(member, source[member.Name]); - member.SetMemberValue(destination, value); - } - return destination; - } - - private static readonly MethodInfo MapMethodInfo = typeof(FromStringDictionaryMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.DestinationType).Invoke(null, new []{context.SourceValue, context}); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(destExpression.Type), sourceExpression, contextExpression); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/StringMapper.cs b/src/AutoMapper/Mappers/StringMapper.cs index bfcae6808d..53edb9cd74 100644 --- a/src/AutoMapper/Mappers/StringMapper.cs +++ b/src/AutoMapper/Mappers/StringMapper.cs @@ -1,24 +1,17 @@ using System.Linq.Expressions; -namespace AutoMapper.Mappers -{ - public class StringMapper : IObjectMapExpression - { - public object Map(ResolutionContext context) - { - return context.SourceValue?.ToString(); - } - - public bool IsMatch(TypePair context) - { - return context.DestinationType == typeof(string) && context.SourceType != typeof(string); - } +namespace AutoMapper.Mappers +{ + using static Expression; + + public class StringMapper : IObjectMapper + { + public bool IsMatch(TypePair context) => context.DestinationType == typeof(string) && context.SourceType != typeof(string); - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) { - return Expression.Condition(Expression.Equal(sourceExpression, Expression.Default(sourceExpression.Type)), - Expression.Constant(null, typeof (string)), - Expression.Call(sourceExpression, typeof (object).GetMethod("ToString"))); - } - } + return Call(sourceExpression, typeof(object).GetDeclaredMethod("ToString")); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/Mappers/StringToEnumMapper.cs b/src/AutoMapper/Mappers/StringToEnumMapper.cs new file mode 100644 index 0000000000..52c662f039 --- /dev/null +++ b/src/AutoMapper/Mappers/StringToEnumMapper.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.Serialization; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static ExpressionFactory; + + public class StringToEnumMapper : IObjectMapper + { + public bool IsMatch(TypePair context) => context.SourceType == typeof(string) && + ElementTypeHelper.GetEnumerationType(context.DestinationType) != null; + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) + { + var destinationType = destExpression.Type; + var destinationEnumType = ElementTypeHelper.GetEnumerationType(destinationType); + var enumParse = Expression.Call(typeof(Enum), "Parse", null, Expression.Constant(destinationEnumType), + sourceExpression, Expression.Constant(true)); + var switchCases = new List(); + var enumNames = destinationEnumType.GetDeclaredMembers(); + foreach (var memberInfo in enumNames.Where(x => x.IsStatic())) + { + var attribute = memberInfo.GetCustomAttribute(typeof(EnumMemberAttribute)) as EnumMemberAttribute; + if (attribute?.Value != null) + { + var switchCase = Expression.SwitchCase( + ToType(Expression.Constant(Enum.ToObject(destinationEnumType, memberInfo.GetMemberValue(null))), + destinationType), Expression.Constant(attribute.Value)); + switchCases.Add(switchCase); + } + } + var equalsMethodInfo = Method(() => StringCompareOrdinalIgnoreCase(null, null)); + var switchTable = switchCases.Count > 0 + ? Expression.Switch(sourceExpression, ToType(enumParse, destinationType), equalsMethodInfo, switchCases) + : ToType(enumParse, destinationType); + var isNullOrEmpty = Expression.Call(typeof(string), "IsNullOrEmpty", null, sourceExpression); + return Expression.Condition(isNullOrEmpty, Expression.Default(destinationType), switchTable); + } + + private static bool StringCompareOrdinalIgnoreCase(string x, string y) + { + return StringComparer.OrdinalIgnoreCase.Equals(x, y); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/ToDynamicMapper.cs b/src/AutoMapper/Mappers/ToDynamicMapper.cs new file mode 100644 index 0000000000..1c4da18d6f --- /dev/null +++ b/src/AutoMapper/Mappers/ToDynamicMapper.cs @@ -0,0 +1,64 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.CompilerServices; +using AutoMapper.Execution; +using AutoMapper.Internal; +using Microsoft.CSharp.RuntimeBinder; +using Binder = Microsoft.CSharp.RuntimeBinder.Binder; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static ExpressionFactory; + + public class ToDynamicMapper : IObjectMapper + { + public static TDestination Map(TSource source, TDestination destination, ResolutionContext context, ProfileMap profileMap) + { + var sourceTypeDetails = profileMap.CreateTypeDetails(typeof(TSource)); + foreach (var member in sourceTypeDetails.PublicReadAccessors) + { + object sourceMemberValue; + try + { + sourceMemberValue = member.GetMemberValue(source); + } + catch (RuntimeBinderException) + { + continue; + } + var destinationMemberValue = context.MapMember(member, sourceMemberValue); + SetDynamically(member.Name, destination, destinationMemberValue); + } + return destination; + } + + private static void SetDynamically(string memberName, object target, object value) + { + var binder = Binder.SetMember(CSharpBinderFlags.None, memberName, null, + new[]{ + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) + }); + var callsite = CallSite>.Create(binder); + callsite.Target(callsite, target, value); + } + + private static readonly MethodInfo MapMethodInfo = typeof(ToDynamicMapper).GetDeclaredMethod(nameof(Map)); + + public bool IsMatch(TypePair context) => context.DestinationType.IsDynamic() && !context.SourceType.IsDynamic(); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call(null, + MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), + sourceExpression, + ToType( + Coalesce(ToObject(destExpression), + DelegateFactory.GenerateConstructorExpression(destExpression.Type)), destExpression.Type), + contextExpression, + Constant(profileMap)); + } +} diff --git a/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs b/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs new file mode 100644 index 0000000000..b81bf3827c --- /dev/null +++ b/src/AutoMapper/Mappers/ToStringDictionaryMapper.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static CollectionMapperExpressionFactory; + + public class ToStringDictionaryMapper : IObjectMapper + { + private static readonly MethodInfo MembersDictionaryMethodInfo = + typeof(ToStringDictionaryMapper).GetDeclaredMethod(nameof(MembersDictionary)); + + public bool IsMatch(TypePair context) => typeof(IDictionary).IsAssignableFrom(context.DestinationType); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, Expression contextExpression) + => MapCollectionExpression(configurationProvider, profileMap, memberMap, + Call(MembersDictionaryMethodInfo, sourceExpression, Constant(profileMap)), destExpression, contextExpression, typeof(Dictionary<,>), + MapKeyPairValueExpr); + + private static Dictionary MembersDictionary(object source, ProfileMap profileMap) + { + var sourceTypeDetails = profileMap.CreateTypeDetails(source.GetType()); + var membersDictionary = sourceTypeDetails.PublicReadAccessors.ToDictionary(p => p.Name, p => p.GetMemberValue(source)); + return membersDictionary; + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/TypeConverterMapper.cs b/src/AutoMapper/Mappers/TypeConverterMapper.cs index 311101ca7e..6e43c49390 100644 --- a/src/AutoMapper/Mappers/TypeConverterMapper.cs +++ b/src/AutoMapper/Mappers/TypeConverterMapper.cs @@ -1,70 +1,49 @@ -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; - -#if !PORTABLE -namespace AutoMapper.Mappers -{ - using System; - using System.ComponentModel; - using Configuration; - - public class TypeConverterMapper : IObjectMapExpression - { - private static TDestination Map(TSource source, ResolutionContext context) - { - if (source == null) - { - return (TDestination)(context.ConfigurationProvider.AllowNullDestinationValues - ? ObjectCreator.CreateNonNullValue(typeof(TDestination)) - : ObjectCreator.CreateObject(typeof(TDestination))); - } - return GetConverter(source); - } - - private static TDestination GetConverter(TSource source) - { - TypeConverter typeConverter = GetTypeConverter(typeof(TSource)); - if (typeConverter.CanConvertTo(typeof(TDestination))) - return (TDestination)typeConverter.ConvertTo(source, typeof(TDestination)); - if (typeof(TDestination).IsNullableType() && - typeConverter.CanConvertTo(Nullable.GetUnderlyingType(typeof(TDestination)))) - return (TDestination)typeConverter.ConvertTo(source, Nullable.GetUnderlyingType(typeof(TDestination))); - - typeConverter = GetTypeConverter(typeof(TDestination)); - if (typeConverter.CanConvertFrom(typeof(TSource))) - return (TDestination)typeConverter.ConvertFrom(source); - - return default(TDestination); - } - - private static readonly MethodInfo MapMethodInfo = typeof(TypeConverterMapper).GetAllMethods().First(_ => _.IsStatic); - - public object Map(ResolutionContext context) - { - return MapMethodInfo.MakeGenericMethod(context.SourceType, context.DestinationType).Invoke(null, new[] { context.SourceValue, context }); - } - - public bool IsMatch(TypePair context) - { - var sourceTypeConverter = GetTypeConverter(context.SourceType); - var destTypeConverter = GetTypeConverter(context.DestinationType); - - return sourceTypeConverter.CanConvertTo(context.DestinationType) || - (context.DestinationType.IsNullableType() && - sourceTypeConverter.CanConvertTo(Nullable.GetUnderlyingType(context.DestinationType)) || - destTypeConverter.CanConvertFrom(context.SourceType)); - } - - public Expression MapExpression(Expression sourceExpression, Expression destExpression, Expression contextExpression) - { - return Expression.Call(null, MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), sourceExpression, contextExpression); - } - - private static TypeConverter GetTypeConverter(Type type) - { - return TypeDescriptor.GetConverter(type); - } - } -} -#endif \ No newline at end of file +using System; +using System.ComponentModel; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; +using static System.Linq.Expressions.Expression; + +namespace AutoMapper.Mappers +{ + public class TypeConverterMapper : IObjectMapper + { + private static TDestination Map(TSource source) + { + var typeConverter = GetTypeConverter(typeof(TSource)); + + if (typeConverter.CanConvertTo(typeof(TDestination))) + { + return (TDestination)typeConverter.ConvertTo(source, typeof(TDestination)); + } + + typeConverter = GetTypeConverter(typeof(TDestination)); + if (typeConverter.CanConvertFrom(typeof(TSource))) + { + return (TDestination)typeConverter.ConvertFrom(source); + } + + return default; + } + + private static readonly MethodInfo MapMethodInfo = typeof(TypeConverterMapper).GetDeclaredMethod(nameof(Map)); + + public bool IsMatch(TypePair context) + { + var sourceTypeConverter = GetTypeConverter(context.SourceType); + var destTypeConverter = GetTypeConverter(context.DestinationType); + + return sourceTypeConverter.CanConvertTo(context.DestinationType) || destTypeConverter.CanConvertFrom(context.SourceType); + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + Call(null, + MapMethodInfo.MakeGenericMethod(sourceExpression.Type, destExpression.Type), + sourceExpression); + + private static TypeConverter GetTypeConverter(Type type) => TypeDescriptor.GetConverter(type); + } +} diff --git a/src/AutoMapper/Mappers/TypeHelper.cs b/src/AutoMapper/Mappers/TypeHelper.cs deleted file mode 100644 index 83abfb39a9..0000000000 --- a/src/AutoMapper/Mappers/TypeHelper.cs +++ /dev/null @@ -1,74 +0,0 @@ -namespace AutoMapper.Mappers -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Configuration; - - public static class TypeHelper - { - public static Type GetElementType(Type enumerableType) - { - return GetElementType(enumerableType, null); - } - - public static Type GetElementType(Type enumerableType, IEnumerable enumerable) - { - if (enumerableType.HasElementType) - { - return enumerableType.GetElementType(); - } - - if (enumerableType.IsGenericType() && - enumerableType.GetGenericTypeDefinition() == typeof (IEnumerable<>)) - { - return enumerableType.GetTypeInfo().GenericTypeArguments[0]; - } - - Type ienumerableType = GetIEnumerableType(enumerableType); - if (ienumerableType != null) - { - return ienumerableType.GetTypeInfo().GenericTypeArguments[0]; - } - - if (typeof (IEnumerable).IsAssignableFrom(enumerableType)) - { - var first = enumerable?.Cast().FirstOrDefault(); - - return first?.GetType() ?? typeof (object); - } - - throw new ArgumentException($"Unable to find the element type for type '{enumerableType}'.", nameof(enumerableType)); - } - - public static Type GetEnumerationType(Type enumType) - { - if (enumType.IsNullableType()) - { - enumType = enumType.GetTypeInfo().GenericTypeArguments[0]; - } - - if (!enumType.IsEnum()) - return null; - - return enumType; - } - - private static Type GetIEnumerableType(Type enumerableType) - { - try - { - return enumerableType.GetTypeInfo().ImplementedInterfaces.FirstOrDefault(t => t.Name == "IEnumerable`1"); - } - catch (AmbiguousMatchException) - { - if (enumerableType.BaseType() != typeof (object)) - return GetIEnumerableType(enumerableType.BaseType()); - - return null; - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/Mappers/UnderlyingTypeToEnumMapper.cs b/src/AutoMapper/Mappers/UnderlyingTypeToEnumMapper.cs new file mode 100644 index 0000000000..173f7d5ae8 --- /dev/null +++ b/src/AutoMapper/Mappers/UnderlyingTypeToEnumMapper.cs @@ -0,0 +1,32 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.Mappers +{ + using static Expression; + using static ExpressionFactory; + + public class UnderlyingTypeToEnumMapper : IObjectMapper + { + private static readonly MethodInfo EnumToObject = Method(() => Enum.ToObject(typeof(object), null)); + + public bool IsMatch(TypePair context) + { + var destEnumType = ElementTypeHelper.GetEnumerationType(context.DestinationType); + + return destEnumType != null && context.SourceType.IsAssignableFrom(Enum.GetUnderlyingType(destEnumType)); + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, Expression sourceExpression, Expression destExpression, + Expression contextExpression) => + ToType( + Call(EnumToObject, Constant(destExpression.Type), + ToObject(sourceExpression)), + destExpression.Type + ); + } +} \ No newline at end of file diff --git a/src/AutoMapper/MappingOperationOptions.cs b/src/AutoMapper/MappingOperationOptions.cs index 262eb39fa7..e82d8d5ace 100644 --- a/src/AutoMapper/MappingOperationOptions.cs +++ b/src/AutoMapper/MappingOperationOptions.cs @@ -1,60 +1,62 @@ -using System; -using System.Collections.Generic; - -namespace AutoMapper -{ - using StringDictionary = Dictionary; - - public class MappingOperationOptions : MappingOperationOptions, - IMappingOperationOptions - { - public MappingOperationOptions(Func serviceCtor) : base(serviceCtor) - { - } - - public void BeforeMap(Action beforeFunction) - { - BeforeMapAction = (src, dest) => beforeFunction((TSource) src, (TDestination) dest); - } - - public void AfterMap(Action afterFunction) - { - AfterMapAction = (src, dest) => afterFunction((TSource) src, (TDestination) dest); - } - } - - public class MappingOperationOptions : IMappingOperationOptions - { - private StringDictionary _items; - private static readonly Action Empty = (_, __) => { }; - - public MappingOperationOptions(Func serviceCtor) - { - BeforeMapAction = AfterMapAction = Empty; - ServiceCtor = serviceCtor; - } - - public Func ServiceCtor { get; private set; } - public IDictionary Items => _items ?? (_items = new StringDictionary()); - public Action BeforeMapAction { get; protected set; } - public Action AfterMapAction { get; protected set; } - - public void BeforeMap(Action beforeFunction) - { - BeforeMapAction = beforeFunction; - } - - public void AfterMap(Action afterFunction) - { - AfterMapAction = afterFunction; - } - - public T CreateInstance() => (T) ServiceCtor(typeof (T)); - - void IMappingOperationOptions.ConstructServicesUsing(Func constructor) - { - var ctor = ServiceCtor; - ServiceCtor = t => constructor(t) ?? ctor(t); - } - } +using System; +using System.Collections.Generic; +using AutoMapper.Configuration; + +namespace AutoMapper +{ + using StringDictionary = Dictionary; + + public class MappingOperationOptions : IMappingOperationOptions + { + private StringDictionary _items; + private static readonly Action Empty = (_, __) => { }; + + public MappingOperationOptions(Func serviceCtor) + { + BeforeMapAction = AfterMapAction = Empty; + ServiceCtor = serviceCtor; + } + + public Func ServiceCtor { get; private set; } + public IDictionary Items => _items ?? (_items = new StringDictionary()); + public Action BeforeMapAction { get; protected set; } + public Action AfterMapAction { get; protected set; } + public ITypeMapConfiguration InlineConfiguration { get; protected set; } = new MappingExpression(MemberList.Destination); + + public void BeforeMap(Action beforeFunction) => BeforeMapAction = beforeFunction; + + public void AfterMap(Action afterFunction) => AfterMapAction = afterFunction; + + public IMappingExpression ConfigureMap() + => ConfigureMap(MemberList.Destination); + + public IMappingExpression ConfigureMap(MemberList memberList) + { + var typeMapConfiguration = new MappingExpression(memberList); + + InlineConfiguration = typeMapConfiguration; + + return typeMapConfiguration; + } + + public T CreateInstance() + { + var service = ServiceCtor(typeof(T)); + if(service == null) + { + throw new AutoMapperMappingException("Cannot create an instance of type " + typeof(T)); + } + return (T) service; + } + + public void ConstructServicesUsing(Func constructor) + { + var ctor = ServiceCtor; + ServiceCtor = t => constructor(t) ?? ctor(t); + } + + void IMappingOperationOptions.BeforeMap(Action beforeFunction) => BeforeMapAction = (s, d) => beforeFunction(s, d); + + void IMappingOperationOptions.AfterMap(Action afterFunction) => AfterMapAction = (s, d) => afterFunction(s, d); + } } \ No newline at end of file diff --git a/src/AutoMapper/MemberFinderVisitor.cs b/src/AutoMapper/MemberFinderVisitor.cs new file mode 100644 index 0000000000..fd8d86a060 --- /dev/null +++ b/src/AutoMapper/MemberFinderVisitor.cs @@ -0,0 +1,15 @@ +using System.Linq.Expressions; + +namespace AutoMapper +{ + public class MemberFinderVisitor : ExpressionVisitor + { + public MemberExpression Member { get; private set; } + + protected override Expression VisitMember(MemberExpression node) + { + Member = node; + return base.VisitMember(node); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/MemberList.cs b/src/AutoMapper/MemberList.cs index 3b64efa2dc..3d42418353 100644 --- a/src/AutoMapper/MemberList.cs +++ b/src/AutoMapper/MemberList.cs @@ -13,6 +13,11 @@ public enum MemberList /// /// Check that all source members are mapped /// - Source = 1 + Source = 1, + + /// + /// Check neither source nor destination members, skipping validation + /// + None = 2 } } diff --git a/src/AutoMapper/PascalCaseNamingConvention.cs b/src/AutoMapper/PascalCaseNamingConvention.cs index 31a10f933e..4ccf09ad40 100644 --- a/src/AutoMapper/PascalCaseNamingConvention.cs +++ b/src/AutoMapper/PascalCaseNamingConvention.cs @@ -1,15 +1,12 @@ +using System.Text.RegularExpressions; + namespace AutoMapper { - using System.Text.RegularExpressions; - public class PascalCaseNamingConvention : INamingConvention { public Regex SplittingExpression { get; } = new Regex(@"(\p{Lu}+(?=$|\p{Lu}[\p{Ll}0-9])|\p{Lu}?[\p{Ll}0-9]+)"); public string SeparatorCharacter => string.Empty; - public string ReplaceValue(Match match) - { - return match.Value[0].ToString().ToUpper() + match.Value.Substring(1); - } + public string ReplaceValue(Match match) => match.Value[0].ToString().ToUpper() + match.Value.Substring(1); } } \ No newline at end of file diff --git a/src/AutoMapper/PathMap.cs b/src/AutoMapper/PathMap.cs new file mode 100644 index 0000000000..f7aeb91318 --- /dev/null +++ b/src/AutoMapper/PathMap.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper +{ + using Internal; + + [DebuggerDisplay("{DestinationExpression}")] + public class PathMap : DefaultMemberMap + { + public PathMap(PathMap pathMap, TypeMap typeMap, LambdaExpression customSource) : this(pathMap.DestinationExpression, pathMap.MemberPath, typeMap) + { + CustomSource = customSource; + CustomMapExpression = pathMap.CustomMapExpression; + Condition = pathMap.Condition; + Ignored = pathMap.Ignored; + } + + public PathMap(LambdaExpression destinationExpression, MemberPath memberPath, TypeMap typeMap) + { + MemberPath = memberPath; + TypeMap = typeMap; + DestinationExpression = destinationExpression; + } + + public override TypeMap TypeMap { get; } + + public override Type SourceType => CustomMapExpression.ReturnType; + public override LambdaExpression CustomSource { get; set; } + public LambdaExpression DestinationExpression { get; } + public override LambdaExpression CustomMapExpression { get; set; } + public MemberPath MemberPath { get; } + public override Type DestinationType => MemberPath.Last.GetMemberType(); + public override string DestinationName => MemberPath.ToString(); + + public override bool CanResolveValue => !Ignored; + + public override bool Ignored { get; set; } + public override LambdaExpression Condition { get; set; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/Profile.cs b/src/AutoMapper/Profile.cs index 30b8af6664..7d40471e0d 100644 --- a/src/AutoMapper/Profile.cs +++ b/src/AutoMapper/Profile.cs @@ -1,331 +1,202 @@ -using System.Linq; -using System.Runtime.CompilerServices; -using AutoMapper.Mappers; - -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Reflection; - using Configuration; - using Configuration.Conventions; - using IMemberConfiguration = Configuration.Conventions.IMemberConfiguration; - - /// - /// Provides a named configuration for maps. Naming conventions become scoped per profile. - /// - public abstract class Profile : IProfileExpression, IProfileConfiguration - { - private readonly ConditionalObjectMapper _mapMissingTypes = new ConditionalObjectMapper {Conventions = {tp => true}}; - private readonly List _globalIgnore = new List(); - private readonly List> _allTypeMapActions = new List>(); - private readonly List _typeMapConfigs = new List(); - private readonly TypeMapFactory _typeMapFactory = new TypeMapFactory(); - - protected Profile(string profileName) - :this() - { - ProfileName = profileName; - } - - protected Profile() - { - ProfileName = GetType().FullName; - IncludeSourceExtensionMethods(typeof(Enumerable)); - _memberConfigurations.Add(new MemberConfiguration().AddMember().AddName(_ => _.AddStrings(p => p.Prefixes, "Get"))); - } - - [Obsolete("Use the constructor instead. Will be removed in 6.0")] - protected virtual void Configure() { } - -#pragma warning disable 618 - internal void Initialize() => Configure(); -#pragma warning restore 618 - - public virtual string ProfileName { get; } - - public void DisableConstructorMapping() - { - ConstructorMappingEnabled = false; - } - - public bool AllowNullDestinationValues { get; set; } = true; - - public bool AllowNullCollections { get; set; } - - public IEnumerable GlobalIgnores => _globalIgnore; - - public INamingConvention SourceMemberNamingConvention - { - get - { - INamingConvention convention = null; - DefaultMemberConfig.AddMember(_ => convention = _.SourceMemberNamingConvention); - return convention; - } - set { DefaultMemberConfig.AddMember(_ => _.SourceMemberNamingConvention = value); } - } - - public INamingConvention DestinationMemberNamingConvention - { - get - { - INamingConvention convention = null; - DefaultMemberConfig.AddMember(_ => convention = _.DestinationMemberNamingConvention); - return convention; - } - set { DefaultMemberConfig.AddMember(_ => _.DestinationMemberNamingConvention = value); } - } - - - public bool CreateMissingTypeMaps - { - get - { - return _createMissingTypeMaps; - } - set - { - _createMissingTypeMaps = value; - if (value) - _typeConfigurations.Add(_mapMissingTypes); - else - _typeConfigurations.Remove(_mapMissingTypes); - } - } - - public void ForAllMaps(Action configuration) - { - _allTypeMapActions.Add(configuration); - } - - public IMappingExpression CreateMap() - { - return CreateMap(MemberList.Destination); - } - - public IMappingExpression CreateMap(MemberList memberList) - { - return CreateMappingExpression(memberList); - } - - public IMappingExpression CreateMap(Type sourceType, Type destinationType) - { - return CreateMap(sourceType, destinationType, MemberList.Destination); - } - - public IMappingExpression CreateMap(Type sourceType, Type destinationType, MemberList memberList) - { - var map = new MappingExpression(new TypePair(sourceType, destinationType), memberList); - - _typeMapConfigs.Add(map); - - return map; - } - - private IMappingExpression CreateMappingExpression(MemberList memberList) - { - var mappingExp = new MappingExpression(memberList); - - _typeMapConfigs.Add(mappingExp); - - return mappingExp; - } - - public void ClearPrefixes() - { - DefaultMemberConfig.AddName(_ => _.Prefixes.Clear()); - } - - public void RecognizeAlias(string original, string alias) - { - DefaultMemberConfig.AddName(_ => _.AddReplace(original, alias)); - } - - public void ReplaceMemberName(string original, string newValue) - { - DefaultMemberConfig.AddName(_ => _.AddReplace(original, newValue)); - } - - public void RecognizePrefixes(params string[] prefixes) - { - DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.Prefixes, prefixes)); - } - - public void RecognizePostfixes(params string[] postfixes) - { - DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.Postfixes, postfixes)); - } - - public void RecognizeDestinationPrefixes(params string[] prefixes) - { - DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.DestinationPrefixes, prefixes)); - } - - public void RecognizeDestinationPostfixes(params string[] postfixes) - { - DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.DestinationPostfixes, postfixes)); - } - - public void AddGlobalIgnore(string propertyNameStartingWith) - { - _globalIgnore.Add(propertyNameStartingWith); - } - - private readonly List _sourceExtensionMethods = new List(); - - private readonly IList _memberConfigurations = new List(); - - public IMemberConfiguration DefaultMemberConfig => _memberConfigurations.First(); - - public IEnumerable MemberConfigurations => _memberConfigurations; - - public IMemberConfiguration AddMemberConfiguration() - { - var condition = new MemberConfiguration(); - _memberConfigurations.Add(condition); - return condition; - } - private readonly IList _typeConfigurations = new List(); - - private bool _createMissingTypeMaps; - - public IEnumerable TypeConfigurations => _typeConfigurations; - - public IConditionalObjectMapper AddConditionalObjectMapper() - { - var condition = new ConditionalObjectMapper(); - - _typeConfigurations.Add(condition); - - return condition; - } - - public bool ConstructorMappingEnabled { get; private set; } = true; - - public IEnumerable SourceExtensionMethods => _sourceExtensionMethods; - - public Func ShouldMapProperty { get; set; } = p => p.IsPublic(); - - public Func ShouldMapField { get; set; } = f => f.IsPublic(); - - public void IncludeSourceExtensionMethods(Type type) - { - _sourceExtensionMethods.AddRange(type.GetDeclaredMethods().Where(m => m.IsStatic && m.IsDefined(typeof(ExtensionAttribute), false) && m.GetParameters().Length == 1)); - } - - void IProfileConfiguration.Register(TypeMapRegistry typeMapRegistry) - { - foreach (var config in _typeMapConfigs) - { - BuildTypeMap(typeMapRegistry, config); - - if (config.ReverseTypeMap != null) - { - BuildTypeMap(typeMapRegistry, config.ReverseTypeMap); - } - } - } - - void IProfileConfiguration.Configure(TypeMapRegistry typeMapRegistry) - { - foreach (var typeMap in _typeMapConfigs.Select(config => typeMapRegistry.GetTypeMap(config.Types))) - { - Configure(typeMapRegistry, typeMap); - } - } - - TypeMap IProfileConfiguration.ConfigureConventionTypeMap(TypeMapRegistry typeMapRegistry, TypePair types) - { - if (! TypeConfigurations.Any(c => c.IsMatch(types))) - return null; - - var typeMap = _typeMapFactory.CreateTypeMap(types.SourceType, types.DestinationType, this, MemberList.Destination); - - var config = new MappingExpression(typeMap.Types, typeMap.ConfiguredMemberList); - - config.Configure(this, typeMap); - - Configure(typeMapRegistry, typeMap); - - return typeMap; - } - - TypeMap IProfileConfiguration.ConfigureClosedGenericTypeMap(TypeMapRegistry typeMapRegistry, TypePair closedTypes, TypePair requestedTypes) - { - var openMapConfig = _typeMapConfigs - .Where(tm => - tm.Types.SourceType.GetGenericTypeDefinitionIfGeneric() == closedTypes.SourceType.GetGenericTypeDefinitionIfGeneric() && - tm.Types.DestinationType.GetGenericTypeDefinitionIfGeneric() == closedTypes.DestinationType.GetGenericTypeDefinitionIfGeneric()) - .OrderByDescending(tm => tm.DestinationType == closedTypes.DestinationType) // Favor more specific destination matches, - .ThenByDescending(tm => tm.SourceType == closedTypes.SourceType) // then more specific source matches - .FirstOrDefault(); - - if (openMapConfig == null) - return null; - - var closedMap = _typeMapFactory.CreateTypeMap(requestedTypes.SourceType, requestedTypes.DestinationType, this, openMapConfig.MemberList); - - openMapConfig.Configure(this, closedMap); - - Configure(typeMapRegistry, closedMap); - - if (closedMap.TypeConverterType != null) - { - var typeParams = - (openMapConfig.SourceType.IsGenericTypeDefinition() ? closedTypes.SourceType.GetGenericArguments() : new Type[0]) - .Concat - (openMapConfig.DestinationType.IsGenericTypeDefinition() ? closedTypes.DestinationType.GetGenericArguments() : new Type[0]); - - var neededParameters = closedMap.TypeConverterType.GetGenericParameters().Length; - closedMap.TypeConverterType = closedMap.TypeConverterType.MakeGenericType(typeParams.Take(neededParameters).ToArray()); - - } - - return closedMap; - } - - private void Configure(TypeMapRegistry typeMapRegistry, TypeMap typeMap) - { - foreach(var action in _allTypeMapActions) - { - var expression = new MappingExpression(typeMap.Types, typeMap.ConfiguredMemberList); - - action(typeMap, expression); - - expression.Configure(this, typeMap); - } - - ApplyBaseMaps(typeMapRegistry, typeMap, typeMap); - ApplyDerivedMaps(typeMapRegistry, typeMap, typeMap); - } - - private static void ApplyBaseMaps(TypeMapRegistry typeMapRegistry, TypeMap derivedMap, TypeMap currentMap) - { - foreach(var baseMap in currentMap.IncludedBaseTypes.Select(typeMapRegistry.GetTypeMap).Where(baseMap => baseMap != null)) - { - baseMap.IncludeDerivedTypes(currentMap.SourceType, currentMap.DestinationType); - derivedMap.ApplyInheritedMap(baseMap); - ApplyBaseMaps(typeMapRegistry, derivedMap, baseMap); - } - } - - private void ApplyDerivedMaps(TypeMapRegistry typeMapRegistry, TypeMap baseMap, TypeMap typeMap) - { - foreach (var inheritedTypeMap in typeMap.IncludedDerivedTypes.Select(typeMapRegistry.GetTypeMap).Where(map => map != null)) - { - inheritedTypeMap.ApplyInheritedMap(baseMap); - ApplyDerivedMaps(typeMapRegistry, baseMap, inheritedTypeMap); - } - } - - private void BuildTypeMap(TypeMapRegistry typeMapRegistry, ITypeMapConfiguration config) - { - var typeMap = _typeMapFactory.CreateTypeMap(config.SourceType, config.DestinationType, this, config.MemberList); - - config.Configure(this, typeMap); - - typeMapRegistry.RegisterTypeMap(typeMap); - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.CompilerServices; +using AutoMapper.Configuration; +using AutoMapper.Configuration.Conventions; +using AutoMapper.Mappers; + +namespace AutoMapper +{ + /// + /// Provides a named configuration for maps. Naming conventions become scoped per profile. + /// + public abstract class Profile : IProfileExpression, IProfileConfiguration + { + private readonly List> _allPropertyMapActions = + new List>(); + + private readonly List> _allTypeMapActions = + new List>(); + + private readonly List _globalIgnore = new List(); + private readonly IList _memberConfigurations = new List(); + private readonly List _openTypeMapConfigs = new List(); + private readonly List _sourceExtensionMethods = new List(); + private readonly IList _typeConfigurations = new List(); + private readonly List _typeMapConfigs = new List(); + private readonly List _valueTransformerConfigs = new List(); + + protected Profile(string profileName) + : this() => ProfileName = profileName; + + protected Profile() + { + ProfileName = GetType().FullName; + + AddMemberConfiguration() + .AddMember() + .AddName(_ => _.AddStrings(p => p.Prefixes, "Get")); + + SourceMemberNamingConvention = new PascalCaseNamingConvention(); + DestinationMemberNamingConvention = new PascalCaseNamingConvention(); + } + + protected Profile(string profileName, Action configurationAction) + : this(profileName) + { + configurationAction(this); + } + + public IMemberConfiguration DefaultMemberConfig => _memberConfigurations.First(); + public bool? ConstructorMappingEnabled { get; private set; } + [Obsolete("This has no effect and will be removed. Set CreateMissingTypeMaps on the global configuration.")] + public bool? CreateMissingTypeMaps { get; set; } + public bool? ValidateInlineMaps { get; set; } + + IEnumerable> IProfileConfiguration.AllPropertyMapActions + => _allPropertyMapActions; + + IEnumerable> IProfileConfiguration.AllTypeMapActions => _allTypeMapActions; + IEnumerable IProfileConfiguration.GlobalIgnores => _globalIgnore; + IEnumerable IProfileConfiguration.MemberConfigurations => _memberConfigurations; + IEnumerable IProfileConfiguration.SourceExtensionMethods => _sourceExtensionMethods; + IEnumerable IProfileConfiguration.TypeConfigurations => _typeConfigurations; + IEnumerable IProfileConfiguration.TypeMapConfigs => _typeMapConfigs; + IEnumerable IProfileConfiguration.OpenTypeMapConfigs => _openTypeMapConfigs; + IEnumerable IProfileConfiguration.ValueTransformers => _valueTransformerConfigs; + + public virtual string ProfileName { get; } + + public bool? AllowNullDestinationValues { get; set; } + public bool? AllowNullCollections { get; set; } + public bool? EnableNullPropagationForQueryMapping { get; set; } + public Func ShouldMapProperty { get; set; } + public Func ShouldMapField { get; set; } + public Func ShouldMapMethod { get; set; } + public Func ShouldUseConstructor { get; set; } + + public INamingConvention SourceMemberNamingConvention { get; set; } + public INamingConvention DestinationMemberNamingConvention { get; set; } + + public IList ValueTransformers => _valueTransformerConfigs; + + public void DisableConstructorMapping() + { + ConstructorMappingEnabled = false; + } + + public void ForAllMaps(Action configuration) + { + _allTypeMapActions.Add(configuration); + } + + public void ForAllPropertyMaps(Func condition, + Action configuration) + { + _allPropertyMapActions.Add((pm, cfg) => + { + if (condition(pm)) configuration(pm, cfg); + }); + } + + public IMappingExpression CreateMap() => + CreateMap(MemberList.Destination); + + public IMappingExpression CreateMap(MemberList memberList) => + CreateMappingExpression(memberList); + + public IMappingExpression CreateMap(Type sourceType, Type destinationType) => + CreateMap(sourceType, destinationType, MemberList.Destination); + + public IMappingExpression CreateMap(Type sourceType, Type destinationType, MemberList memberList) + { + var map = new MappingExpression(new TypePair(sourceType, destinationType), memberList); + + _typeMapConfigs.Add(map); + + if (sourceType.IsGenericTypeDefinition() || destinationType.IsGenericTypeDefinition()) + _openTypeMapConfigs.Add(map); + + return map; + } + + public void ClearPrefixes() + { + DefaultMemberConfig.AddName(_ => _.Prefixes.Clear()); + } + + public void RecognizeAlias(string original, string alias) + { + DefaultMemberConfig.AddName(_ => _.AddReplace(original, alias)); + } + + public void ReplaceMemberName(string original, string newValue) + { + DefaultMemberConfig.AddName(_ => _.AddReplace(original, newValue)); + } + + public void RecognizePrefixes(params string[] prefixes) + { + DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.Prefixes, prefixes)); + } + + public void RecognizePostfixes(params string[] postfixes) + { + DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.Postfixes, postfixes)); + } + + public void RecognizeDestinationPrefixes(params string[] prefixes) + { + DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.DestinationPrefixes, prefixes)); + } + + public void RecognizeDestinationPostfixes(params string[] postfixes) + { + DefaultMemberConfig.AddName(_ => _.AddStrings(p => p.DestinationPostfixes, postfixes)); + } + + public void AddGlobalIgnore(string propertyNameStartingWith) + { + _globalIgnore.Add(propertyNameStartingWith); + } + + public IMemberConfiguration AddMemberConfiguration() + { + var condition = new MemberConfiguration(); + _memberConfigurations.Add(condition); + return condition; + } + + public IConditionalObjectMapper AddConditionalObjectMapper() + { + var condition = new ConditionalObjectMapper(); + + _typeConfigurations.Add(condition); + + return condition; + } + + public void IncludeSourceExtensionMethods(Type type) + { + _sourceExtensionMethods.AddRange( + type.GetDeclaredMethods() + .Where( + m => + m.IsStatic && m.IsDefined(typeof(ExtensionAttribute), false) && + m.GetParameters().Length == 1)); + } + + private IMappingExpression CreateMappingExpression( + MemberList memberList) + { + var mappingExp = new MappingExpression(memberList); + + _typeMapConfigs.Add(mappingExp); + + return mappingExp; + } + } } \ No newline at end of file diff --git a/src/AutoMapper/ProfileMap.cs b/src/AutoMapper/ProfileMap.cs new file mode 100644 index 0000000000..2f13afe4d4 --- /dev/null +++ b/src/AutoMapper/ProfileMap.cs @@ -0,0 +1,284 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Configuration.Conventions; +using AutoMapper.Mappers; +using AutoMapper.QueryableExtensions.Impl; + +namespace AutoMapper +{ + [DebuggerDisplay("{Name}")] + public class ProfileMap + { + private readonly TypeMapFactory _typeMapFactory = new TypeMapFactory(); + private readonly IEnumerable _typeMapConfigs; + private readonly IEnumerable _openTypeMapConfigs; + private readonly LockingConcurrentDictionary _typeDetails; + + public ProfileMap(IProfileConfiguration profile) + : this(profile, null) + { + } + + public ProfileMap(IProfileConfiguration profile, IConfiguration configuration) + { + _typeDetails = new LockingConcurrentDictionary(TypeDetailsFactory); + + Name = profile.ProfileName; + AllowNullCollections = profile.AllowNullCollections ?? configuration?.AllowNullCollections ?? false; + AllowNullDestinationValues = profile.AllowNullDestinationValues ?? configuration?.AllowNullDestinationValues ?? true; + EnableNullPropagationForQueryMapping = profile.EnableNullPropagationForQueryMapping ?? configuration?.EnableNullPropagationForQueryMapping ?? false; + ConstructorMappingEnabled = profile.ConstructorMappingEnabled ?? configuration?.ConstructorMappingEnabled ?? true; + ShouldMapField = profile.ShouldMapField ?? configuration?.ShouldMapField ?? (p => p.IsPublic()); + ShouldMapProperty = profile.ShouldMapProperty ?? configuration?.ShouldMapProperty ?? (p => p.IsPublic()); + ShouldMapMethod = profile.ShouldMapMethod ?? configuration?.ShouldMapMethod ?? (p => true); + ShouldUseConstructor = profile.ShouldUseConstructor ?? configuration?.ShouldUseConstructor ?? (c => true); + CreateMissingTypeMaps = profile.CreateMissingTypeMaps ?? configuration?.CreateMissingTypeMaps ?? true; + ValidateInlineMaps = profile.ValidateInlineMaps ?? configuration?.ValidateInlineMaps ?? true; + + TypeConfigurations = profile.TypeConfigurations + .Concat(configuration?.TypeConfigurations ?? Enumerable.Empty()) + .ToArray(); + + ValueTransformers = profile.ValueTransformers.Concat(configuration?.ValueTransformers ?? Enumerable.Empty()).ToArray(); + + MemberConfigurations = profile.MemberConfigurations.ToArray(); + + MemberConfigurations.FirstOrDefault()?.AddMember(_ => _.SourceMemberNamingConvention = profile.SourceMemberNamingConvention); + MemberConfigurations.FirstOrDefault()?.AddMember(_ => _.DestinationMemberNamingConvention = profile.DestinationMemberNamingConvention); + + GlobalIgnores = profile.GlobalIgnores.Concat(configuration?.GlobalIgnores ?? Enumerable.Empty()).ToArray(); + SourceExtensionMethods = profile.SourceExtensionMethods.Concat(configuration?.SourceExtensionMethods ?? Enumerable.Empty()).ToArray(); + AllPropertyMapActions = profile.AllPropertyMapActions.Concat(configuration?.AllPropertyMapActions ?? Enumerable.Empty>()).ToArray(); + AllTypeMapActions = profile.AllTypeMapActions.Concat(configuration?.AllTypeMapActions ?? Enumerable.Empty>()).ToArray(); + + Prefixes = + profile.MemberConfigurations + .Select(m => m.NameMapper) + .SelectMany(m => m.NamedMappers) + .OfType() + .SelectMany(m => m.Prefixes) + .ToArray(); + + Postfixes = + profile.MemberConfigurations + .Select(m => m.NameMapper) + .SelectMany(m => m.NamedMappers) + .OfType() + .SelectMany(m => m.Postfixes) + .ToArray(); + + _typeMapConfigs = profile.TypeMapConfigs.ToArray(); + _openTypeMapConfigs = profile.OpenTypeMapConfigs.ToArray(); + } + + + public bool AllowNullCollections { get; } + public bool AllowNullDestinationValues { get; } + public bool ConstructorMappingEnabled { get; } + public bool CreateMissingTypeMaps { get; } + public bool ValidateInlineMaps { get; } + public bool EnableNullPropagationForQueryMapping { get; } + public string Name { get; } + public Func ShouldMapField { get; } + public Func ShouldMapProperty { get; } + public Func ShouldMapMethod { get; } + public Func ShouldUseConstructor { get; } + + public IEnumerable> AllPropertyMapActions { get; } + public IEnumerable> AllTypeMapActions { get; } + public IEnumerable GlobalIgnores { get; } + public IEnumerable MemberConfigurations { get; } + public IEnumerable SourceExtensionMethods { get; } + public IEnumerable TypeConfigurations { get; } + public IEnumerable Prefixes { get; } + public IEnumerable Postfixes { get; } + public IEnumerable ValueTransformers { get; } + + public TypeDetails CreateTypeDetails(Type type) => _typeDetails.GetOrAdd(type); + + private TypeDetails TypeDetailsFactory(Type type) => new TypeDetails(type, this); + + public void Register(IConfigurationProvider configurationProvider) + { + foreach (var config in _typeMapConfigs) + { + BuildTypeMap(configurationProvider, config); + + if (config.ReverseTypeMap != null) + { + BuildTypeMap(configurationProvider, config.ReverseTypeMap); + } + } + } + + public void Configure(IConfigurationProvider configurationProvider) + { + foreach (var typeMapConfiguration in _typeMapConfigs) + { + Configure(typeMapConfiguration, configurationProvider); + if (typeMapConfiguration.ReverseTypeMap != null) + { + Configure(typeMapConfiguration.ReverseTypeMap, configurationProvider); + } + } + } + + private void BuildTypeMap(IConfigurationProvider configurationProvider, ITypeMapConfiguration config) + { + var typeMap = _typeMapFactory.CreateTypeMap(config.SourceType, config.DestinationType, this); + + config.Configure(typeMap); + + configurationProvider.RegisterTypeMap(typeMap); + } + + private void Configure(ITypeMapConfiguration typeMapConfiguration, IConfigurationProvider configurationProvider) + { + var typeMap = configurationProvider.FindTypeMapFor(typeMapConfiguration.Types); + Configure(typeMap, configurationProvider); + } + + private void Configure(TypeMap typeMap, IConfigurationProvider configurationProvider) + { + foreach (var action in AllTypeMapActions) + { + var expression = new MappingExpression(typeMap.Types, typeMap.ConfiguredMemberList); + + action(typeMap, expression); + + expression.Configure(typeMap); + } + + foreach (var action in AllPropertyMapActions) + { + foreach (var propertyMap in typeMap.PropertyMaps) + { + var memberExpression = new MappingExpression.MemberConfigurationExpression(propertyMap.DestinationMember, typeMap.SourceType); + + action(propertyMap, memberExpression); + + memberExpression.Configure(typeMap); + } + } + + ApplyBaseMaps(typeMap, typeMap, configurationProvider); + ApplyDerivedMaps(typeMap, typeMap, configurationProvider); + ApplyMemberMaps(typeMap, configurationProvider); + } + + public bool IsConventionMap(TypePair types) => TypeConfigurations.Any(c => c.IsMatch(types)); + + public TypeMap CreateConventionTypeMap(TypePair types, IConfigurationProvider configurationProvider) + { + var typeMap = _typeMapFactory.CreateTypeMap(types.SourceType, types.DestinationType, this); + + typeMap.IsConventionMap = true; + + var config = new MappingExpression(typeMap.Types, typeMap.ConfiguredMemberList); + + config.Configure(typeMap); + + Configure(typeMap, configurationProvider); + + return typeMap; + } + + public TypeMap CreateInlineMap(TypePair types, IConfigurationProvider configurationProvider) + { + var typeMap = _typeMapFactory.CreateTypeMap(types.SourceType, types.DestinationType, this); + + typeMap.IsConventionMap = true; + + Configure(typeMap, configurationProvider); + + return typeMap; + } + + public TypeMap CreateClosedGenericTypeMap(ITypeMapConfiguration openMapConfig, TypePair closedTypes, IConfigurationProvider configurationProvider) + { + var closedMap = _typeMapFactory.CreateTypeMap(closedTypes.SourceType, closedTypes.DestinationType, this); + closedMap.IsClosedGeneric = true; + openMapConfig.Configure(closedMap); + + Configure(closedMap, configurationProvider); + + if(closedMap.TypeConverterType != null) + { + var typeParams = + (openMapConfig.SourceType.IsGenericTypeDefinition() ? closedTypes.SourceType.GetGenericArguments() : new Type[0]) + .Concat + (openMapConfig.DestinationType.IsGenericTypeDefinition() ? closedTypes.DestinationType.GetGenericArguments() : new Type[0]); + + var neededParameters = closedMap.TypeConverterType.GetGenericParameters().Length; + closedMap.TypeConverterType = closedMap.TypeConverterType.MakeGenericType(typeParams.Take(neededParameters).ToArray()); + } + if(closedMap.DestinationTypeOverride?.IsGenericTypeDefinition() == true) + { + var neededParameters = closedMap.DestinationTypeOverride.GetGenericParameters().Length; + closedMap.DestinationTypeOverride = closedMap.DestinationTypeOverride.MakeGenericType(closedTypes.DestinationType.GetGenericArguments().Take(neededParameters).ToArray()); + } + return closedMap; + } + + public ITypeMapConfiguration GetGenericMap(TypePair closedTypes) + { + return _openTypeMapConfigs + .SelectMany(tm => tm.ReverseTypeMap == null ? new[] { tm } : new[] { tm, tm.ReverseTypeMap }) + .Where(tm => + tm.Types.SourceType.GetGenericTypeDefinitionIfGeneric() == closedTypes.SourceType.GetGenericTypeDefinitionIfGeneric() && + tm.Types.DestinationType.GetGenericTypeDefinitionIfGeneric() == closedTypes.DestinationType.GetGenericTypeDefinitionIfGeneric()) + .OrderByDescending(tm => tm.DestinationType == closedTypes.DestinationType) // Favor more specific destination matches, + .ThenByDescending(tm => tm.SourceType == closedTypes.SourceType) // then more specific source matches + .FirstOrDefault(); + } + + private void ApplyBaseMaps(TypeMap derivedMap, TypeMap currentMap, IConfigurationProvider configurationProvider) + { + foreach (var baseMap in configurationProvider.GetIncludedTypeMaps(currentMap.IncludedBaseTypes)) + { + baseMap.IncludeDerivedTypes(currentMap.SourceType, currentMap.DestinationType); + derivedMap.AddInheritedMap(baseMap); + ApplyBaseMaps(derivedMap, baseMap, configurationProvider); + } + } + + private void ApplyMemberMaps(TypeMap mainMap, IConfigurationProvider configurationProvider) + { + AddMemberMaps(mainMap.IncludedMembers, mainMap, configurationProvider); + AddMemberMaps(mainMap.GetUntypedIncludedMembers(), mainMap, configurationProvider); + } + + private void AddMemberMaps(LambdaExpression[] includedMembers, TypeMap mainMap, IConfigurationProvider configurationProvider) + { + foreach(var includedMember in configurationProvider.GetIncludedTypeMaps(includedMembers.Select(m => new TypePair(m.Body.Type, mainMap.DestinationType))).Zip(includedMembers, (memberMap, expression) => new IncludedMember(memberMap, expression))) + { + mainMap.AddMemberMap(includedMember); + } + } + + private void ApplyDerivedMaps(TypeMap baseMap, TypeMap typeMap, IConfigurationProvider configurationProvider) + { + foreach (var inheritedTypeMap in configurationProvider.GetIncludedTypeMaps(typeMap.IncludedDerivedTypes)) + { + inheritedTypeMap.IncludeBaseTypes(typeMap.SourceType, typeMap.DestinationType); + ApplyDerivedMaps(baseMap, inheritedTypeMap, configurationProvider); + } + } + } + + public readonly struct IncludedMember + { + public IncludedMember(TypeMap typeMap, LambdaExpression memberExpression) + { + TypeMap = typeMap; + MemberExpression = memberExpression; + } + public TypeMap TypeMap { get; } + public LambdaExpression MemberExpression { get; } + } +} \ No newline at end of file diff --git a/src/AutoMapper/PropertyMap.cs b/src/AutoMapper/PropertyMap.cs index e986b294de..d45291544b 100644 --- a/src/AutoMapper/PropertyMap.cs +++ b/src/AutoMapper/PropertyMap.cs @@ -1,145 +1,131 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Execution; - - [DebuggerDisplay("{DestinationProperty.Name}")] - public class PropertyMap - { - private readonly List _memberChain = new List(); - - public PropertyMap(IMemberAccessor destinationProperty, TypeMap typeMap) - { - TypeMap = typeMap; - UseDestinationValue = true; - DestinationProperty = destinationProperty; - } - - public PropertyMap(PropertyMap inheritedMappedProperty, TypeMap typeMap) - : this(inheritedMappedProperty.DestinationProperty, typeMap) - { - ApplyInheritedPropertyMap(inheritedMappedProperty); - } - - public TypeMap TypeMap { get; } - public IMemberAccessor DestinationProperty { get; } - - public Type DestinationPropertyType => DestinationProperty.MemberType; - - public IEnumerable SourceMembers => _memberChain; - - public bool Ignored { get; set; } - public int? MappingOrder { get; set; } - public LambdaExpression CustomResolver { get; set; } - public LambdaExpression Condition { get; set; } - public LambdaExpression PreCondition { get; set; } - public LambdaExpression CustomExpression { get; private set; } - public MemberInfo CustomSourceMember { get; set; } - public bool UseDestinationValue { get; set; } - public bool ExplicitExpansion { get; set; } - public object CustomValue { get; set; } - public object NullSubstitute { get; set; } - public ValueResolverConfiguration ValueResolverConfig { get; set; } - - public MemberInfo SourceMember - { - get - { - if (CustomSourceMember != null) - return CustomSourceMember; - - if (CustomExpression != null) - { - var finder = new MemberFinderVisitor(); - finder.Visit(CustomExpression); - - if (finder.Member != null) - { - return finder.Member.Member; - } - } - - return _memberChain.LastOrDefault()?.MemberInfo; - } - } - - public Type SourceType - { - get - { - if (CustomExpression != null) - return CustomExpression.ReturnType; - if (CustomResolver != null) - return CustomResolver.ReturnType; - return SourceMember?.GetMemberType(); - } - } - - public void ChainMembers(IEnumerable members) - { - var getters = members as IList ?? members.ToList(); - _memberChain.AddRange(getters); - } - - public void ApplyInheritedPropertyMap(PropertyMap inheritedMappedProperty) - { - if (!CanResolveValue() && inheritedMappedProperty.Ignored) - { - Ignored = true; - } - CustomExpression = CustomExpression ?? inheritedMappedProperty.CustomExpression; - CustomResolver = CustomResolver ?? inheritedMappedProperty.CustomResolver; - Condition = Condition ?? inheritedMappedProperty.Condition; - PreCondition = PreCondition ?? inheritedMappedProperty.PreCondition; - NullSubstitute = NullSubstitute ?? inheritedMappedProperty.NullSubstitute; - MappingOrder = MappingOrder ?? inheritedMappedProperty.MappingOrder; - CustomValue = CustomValue ?? inheritedMappedProperty.CustomValue; - CustomSourceMember = CustomSourceMember ?? inheritedMappedProperty.CustomSourceMember; - } - - public bool IsMapped() - { - return _memberChain.Count > 0 - || ValueResolverConfig != null - || CustomResolver != null - || SourceMember != null - || CustomValue != null - || CustomExpression != null - || Ignored; - } - - public bool CanResolveValue() - { - return (_memberChain.Count > 0 - || ValueResolverConfig != null - || CustomResolver != null - || SourceMember != null - || CustomValue != null - || CustomExpression != null) && !Ignored; - } - - public void SetCustomValueResolverExpression(Expression> sourceMember) - { - CustomExpression = sourceMember; - - Ignored = false; - } - - private class MemberFinderVisitor : ExpressionVisitor - { - public MemberExpression Member { get; private set; } - - protected override Expression VisitMember(MemberExpression node) - { - Member = node; - - return base.VisitMember(node); - } - } - } +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; + +namespace AutoMapper +{ + using static Internal.ExpressionFactory; + using static Expression; + + [DebuggerDisplay("{DestinationMember.Name}")] + public class PropertyMap : DefaultMemberMap + { + private readonly List _memberChain = new List(); + private readonly List _valueTransformerConfigs = new List(); + + public PropertyMap(MemberInfo destinationMember, TypeMap typeMap) + { + TypeMap = typeMap; + DestinationMember = destinationMember; + } + + public PropertyMap(PropertyMap inheritedMappedProperty, TypeMap typeMap) + : this(inheritedMappedProperty.DestinationMember, typeMap) => ApplyInheritedPropertyMap(inheritedMappedProperty); + + public PropertyMap(PropertyMap includedMemberMap, TypeMap typeMap, LambdaExpression expression) + : this(includedMemberMap, typeMap) => ApplyIncludedMemberMap(includedMemberMap, expression); + + private void ApplyIncludedMemberMap(PropertyMap includedMemberMap, LambdaExpression expression) + { + CustomSource = expression; + if(includedMemberMap._memberChain.Count > 0) + { + ChainMembers(expression.Body.GetMembers().Select(e => e.Member).Concat(includedMemberMap._memberChain)); + } + CustomMapExpression = CheckCustomSource(CustomMapExpression); + } + + private LambdaExpression CheckCustomSource(LambdaExpression lambda) => CheckCustomSource(lambda, CustomSource); + + public static LambdaExpression CheckCustomSource(LambdaExpression lambda, LambdaExpression customSource) => + (lambda == null || customSource == null) ? + lambda : + Lambda(lambda.ReplaceParameters(customSource.Body), customSource.Parameters.Concat(lambda.Parameters.Skip(1))); + + public override TypeMap TypeMap { get; } + public MemberInfo DestinationMember { get; } + public override string DestinationName => DestinationMember.Name; + + public override Type DestinationType => DestinationMember.GetMemberType(); + + public override IEnumerable SourceMembers => _memberChain; + public override LambdaExpression CustomSource { get; set; } + public override bool Inline { get; set; } = true; + public override bool Ignored { get; set; } + public bool AllowNull { get; set; } + public int? MappingOrder { get; set; } + public override LambdaExpression CustomMapFunction { get; set; } + public override LambdaExpression Condition { get; set; } + public override LambdaExpression PreCondition { get; set; } + public override LambdaExpression CustomMapExpression { get; set; } + public override bool UseDestinationValue { get; set; } + public bool ExplicitExpansion { get; set; } + public override object NullSubstitute { get; set; } + public override ValueResolverConfiguration ValueResolverConfig { get; set; } + public override ValueConverterConfiguration ValueConverterConfig { get; set; } + public override IEnumerable ValueTransformers => _valueTransformerConfigs; + + public override Type SourceType => ValueConverterConfig?.SourceMember?.ReturnType + ?? ValueResolverConfig?.SourceMember?.ReturnType + ?? CustomMapFunction?.ReturnType + ?? CustomMapExpression?.ReturnType + ?? SourceMember?.GetMemberType(); + + public void ChainMembers(IEnumerable members) => + _memberChain.AddRange(members as IList ?? members.ToList()); + + public void ApplyInheritedPropertyMap(PropertyMap inheritedMappedProperty) + { + if(inheritedMappedProperty.Ignored && !IsResolveConfigured) + { + Ignored = true; + } + CustomMapExpression = CustomMapExpression ?? inheritedMappedProperty.CustomMapExpression; + CustomMapFunction = CustomMapFunction ?? inheritedMappedProperty.CustomMapFunction; + Condition = Condition ?? inheritedMappedProperty.Condition; + PreCondition = PreCondition ?? inheritedMappedProperty.PreCondition; + NullSubstitute = NullSubstitute ?? inheritedMappedProperty.NullSubstitute; + MappingOrder = MappingOrder ?? inheritedMappedProperty.MappingOrder; + ValueResolverConfig = ValueResolverConfig ?? inheritedMappedProperty.ValueResolverConfig; + ValueConverterConfig = ValueConverterConfig ?? inheritedMappedProperty.ValueConverterConfig; + _valueTransformerConfigs.InsertRange(0, inheritedMappedProperty._valueTransformerConfigs); + } + + public override bool CanResolveValue => HasSource && !Ignored; + + public bool HasSource => _memberChain.Count > 0 || IsResolveConfigured; + + public bool IsResolveConfigured => ValueResolverConfig != null || CustomMapFunction != null || + CustomMapExpression != null || ValueConverterConfig != null; + + public void MapFrom(LambdaExpression sourceMember) + { + CustomMapExpression = sourceMember; + Ignored = false; + } + + public void MapFrom(string propertyOrField) + { + var mapExpression = TypeMap.SourceType.IsGenericTypeDefinition() ? + // just a placeholder so the member is mapped + Lambda(Constant(null)) : + MemberAccessLambda(TypeMap.SourceType, propertyOrField); + MapFrom(mapExpression); + } + + public void AddValueTransformation(ValueTransformerConfiguration valueTransformerConfiguration) => + _valueTransformerConfigs.Add(valueTransformerConfiguration); + + internal void CheckMappedReadonly() + { + if(IsResolveConfigured && !ReflectionHelper.CanBeSet(DestinationMember)) + { + UseDestinationValue = true; + } + } + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/ExpressionBuilder.cs b/src/AutoMapper/QueryableExtensions/ExpressionBuilder.cs index e1dbd13290..af98b0eeca 100644 --- a/src/AutoMapper/QueryableExtensions/ExpressionBuilder.cs +++ b/src/AutoMapper/QueryableExtensions/ExpressionBuilder.cs @@ -1,273 +1,549 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using AutoMapper.QueryableExtensions.Impl; -using static System.Linq.Expressions.Expression; - -namespace AutoMapper.QueryableExtensions -{ - using Configuration; - using Execution; - - public interface IExpressionBuilder - { - Expression CreateMapExpression(Type sourceType, Type destinationType, IDictionary parameters = null, params MemberInfo[] membersToExpand); - Expression> CreateMapExpression(IDictionary parameters = null, params MemberInfo[] membersToExpand); - LambdaExpression CreateMapExpression(ExpressionRequest request, ConcurrentDictionary typePairCount); - Expression CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary typePairCount); - } - - public class ExpressionBuilder : IExpressionBuilder - { - private static readonly IExpressionResultConverter[] ExpressionResultConverters = - { - new ExplicitValueExpressionResultConverter(), - new MemberResolverExpressionResultConverter(), - new MemberGetterExpressionResultConverter(), - }; - - private static readonly IExpressionBinder[] Binders = - { - new NullableExpressionBinder(), - new EnumerableExpressionBinder(), - new MappedTypeExpressionBinder(), - new CustomProjectionExpressionBinder(), - new AssignableExpressionBinder(), - new StringExpressionBinder() - }; - - private readonly ConcurrentDictionary _expressionCache = new ConcurrentDictionary(); - private readonly IConfigurationProvider _configurationProvider; - - public ExpressionBuilder(IConfigurationProvider configurationProvider) - { - _configurationProvider = configurationProvider; - } - - public Expression CreateMapExpression(Type sourceType, Type destinationType, IDictionary parameters = null, params MemberInfo[] membersToExpand) - { - parameters = parameters ?? new Dictionary(); - - var cachedExpression = - _expressionCache.GetOrAdd(new ExpressionRequest(sourceType, destinationType, membersToExpand), - tp => CreateMapExpression(tp, new ConcurrentDictionary())); - - if (!parameters.Any()) - return cachedExpression; - - var visitor = new ConstantExpressionReplacementVisitor(parameters); - - return visitor.Visit(cachedExpression); - } - - public Expression> CreateMapExpression(IDictionary parameters = null, - params MemberInfo[] membersToExpand) - { - return (Expression>) CreateMapExpression(typeof(TSource), typeof(TDestination), parameters, membersToExpand); - } - - - public LambdaExpression CreateMapExpression(ExpressionRequest request, ConcurrentDictionary typePairCount) - { - // this is the input parameter of this expression with name - var instanceParameter = Expression.Parameter(request.SourceType, "dto"); - var total = CreateMapExpression(request, instanceParameter, typePairCount); - var delegateType = typeof(Func<,>).MakeGenericType(request.SourceType, request.DestinationType); - return Expression.Lambda(delegateType, total, instanceParameter); - } - - public Expression CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary typePairCount) - { - var typeMap = _configurationProvider.ResolveTypeMap(request.SourceType, - request.DestinationType); - - if (typeMap == null) - { - throw QueryMapperHelper.MissingMapException(request.SourceType, request.DestinationType); - } - - if (typeMap.CustomProjection != null) - { - return typeMap.CustomProjection.ReplaceParameters(instanceParameter); - } - - var bindings = new List(); - var visitCount = typePairCount.AddOrUpdate(request, 0, (tp, i) => i + 1); - if (typeMap.MaxDepth > 0 && visitCount >= typeMap.MaxDepth) - { - if (_configurationProvider.AllowNullDestinationValues) - { - return null; - } - } - else - { - bindings = CreateMemberBindings(request, typeMap, instanceParameter, typePairCount); - } - Expression constructorExpression = DestinationConstructorExpression(typeMap, instanceParameter); - if (instanceParameter is ParameterExpression) - constructorExpression = ((LambdaExpression) constructorExpression).ReplaceParameters(instanceParameter); - var visitor = new NewFinderVisitor(); - visitor.Visit(constructorExpression); - - var expression = Expression.MemberInit( - visitor.NewExpression, - bindings.ToArray() - ); - return expression; - } - - private LambdaExpression DestinationConstructorExpression(TypeMap typeMap, Expression instanceParameter) - { - var ctorExpr = typeMap.ConstructExpression; - if (ctorExpr != null) - { - return ctorExpr; - } - var newExpression = typeMap.ConstructorMap?.CanResolve == true - ? typeMap.ConstructorMap.NewExpression(instanceParameter) - : New(typeMap.DestinationTypeOverride ?? typeMap.DestinationType); - - return Lambda(newExpression); - } - - - private class NewFinderVisitor : ExpressionVisitor - { - public NewExpression NewExpression { get; private set; } - - protected override Expression VisitNew(NewExpression node) - { - NewExpression = node; - return base.VisitNew(node); - } - } - - private List CreateMemberBindings(ExpressionRequest request, - TypeMap typeMap, - Expression instanceParameter, ConcurrentDictionary typePairCount) - { - var bindings = new List(); - - foreach (var propertyMap in typeMap.GetPropertyMaps().Where(pm => pm.CanResolveValue())) - { - var result = ResolveExpression(propertyMap, request.SourceType, instanceParameter); - - if (propertyMap.ExplicitExpansion && - !request.MembersToExpand.Contains(propertyMap.DestinationProperty.MemberInfo)) - continue; - - var propertyTypeMap = _configurationProvider.ResolveTypeMap(result.Type, - propertyMap.DestinationPropertyType); - var propertyRequest = new ExpressionRequest(result.Type, propertyMap.DestinationPropertyType, request.MembersToExpand); - - var binder = Binders.FirstOrDefault(b => b.IsMatch(propertyMap, propertyTypeMap, result)); - - if (binder == null) - { - var message = - $"Unable to create a map expression from {propertyMap.SourceMember?.DeclaringType?.Name}.{propertyMap.SourceMember?.Name} ({result.Type}) to {propertyMap.DestinationProperty.MemberInfo.DeclaringType?.Name}.{propertyMap.DestinationProperty.Name} ({propertyMap.DestinationPropertyType})"; - - throw new AutoMapperMappingException(message); - } - - var bindExpression = binder.Build(_configurationProvider, propertyMap, propertyTypeMap, propertyRequest, result, typePairCount); - - if (bindExpression != null) - { - bindings.Add(bindExpression); - } - } - return bindings; - } - - private static ExpressionResolutionResult ResolveExpression(PropertyMap propertyMap, Type currentType, - Expression instanceParameter) - { - var result = new ExpressionResolutionResult(instanceParameter, currentType); - - var matchingExpressionConverter = - ExpressionResultConverters.FirstOrDefault(c => c.CanGetExpressionResolutionResult(result, propertyMap)); - if (matchingExpressionConverter == null) - throw new Exception("Can't resolve this to Queryable Expression"); - result = matchingExpressionConverter.GetExpressionResolutionResult(result, propertyMap); - - if (propertyMap.NullSubstitute != null && result.Type.IsNullableType()) - { - Expression currentChild = result.ResolutionExpression; - Type currentChildType = result.Type; - var nullSubstitute = propertyMap.NullSubstitute; - - var newParameter = result.ResolutionExpression; - var converter = new NullSubstitutionConversionVisitor(newParameter, nullSubstitute); - - currentChild = converter.Visit(currentChild); - currentChildType = currentChildType.GetTypeOfNullable(); - - return new ExpressionResolutionResult(currentChild, currentChildType); - } - - return result; - } - - private class NullSubstitutionConversionVisitor : ExpressionVisitor - { - private readonly Expression newParameter; - private readonly object _nullSubstitute; - - public NullSubstitutionConversionVisitor(Expression newParameter, object nullSubstitute) - { - this.newParameter = newParameter; - _nullSubstitute = nullSubstitute; - } - - protected override Expression VisitMember(MemberExpression node) - { - if (node == newParameter) - { - var equalsNull = Expression.Property(newParameter, "HasValue"); - var nullConst = Expression.Condition(equalsNull, Expression.Property(newParameter, "Value"), - Expression.Constant(_nullSubstitute), node.Type.GetTypeOfNullable()); - return nullConst; - } - return node; - } - - protected override Expression VisitConditional(ConditionalExpression node) - { - var equalsNull = Expression.Property(node.IfFalse, "HasValue"); - var nullConst = Expression.Condition(equalsNull, Expression.Property(node.IfFalse, "Value"), - Expression.Constant(_nullSubstitute), node.Type.GetTypeOfNullable()); - - return Expression.Condition(node.Test, Expression.Constant(_nullSubstitute), nullConst); - } - } - - private class ConstantExpressionReplacementVisitor : ExpressionVisitor - { - private readonly IDictionary _paramValues; - - public ConstantExpressionReplacementVisitor( - IDictionary paramValues) - { - _paramValues = paramValues; - } - - protected override Expression VisitMember(MemberExpression node) - { - if (!node.Member.DeclaringType.Name.Contains("<>")) - return base.VisitMember(node); - - if (!_paramValues.ContainsKey(node.Member.Name)) - return base.VisitMember(node); - - return Expression.Convert( - Expression.Constant(_paramValues[node.Member.Name]), - node.Member.GetMemberType()); - } - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.CompilerServices; +using AutoMapper.Configuration; +using AutoMapper.Execution; +using AutoMapper.Internal; +using AutoMapper.QueryableExtensions.Impl; +using static System.Linq.Expressions.Expression; + +namespace AutoMapper.QueryableExtensions +{ + using static ExpressionFactory; + using ParameterBag = IDictionary; + using TypePairCount = IDictionary; + + public interface IExpressionBuilder + { + LambdaExpression[] GetMapExpression(Type sourceType, Type destinationType, object parameters, MemberInfo[] membersToExpand); + LambdaExpression[] CreateMapExpression(ExpressionRequest request, TypePairCount typePairCount, LetPropertyMaps letPropertyMaps); + Expression CreateMapExpression(ExpressionRequest request, Expression instanceParameter, TypePairCount typePairCount, LetPropertyMaps letPropertyMaps); + } + + public class ExpressionBuilder : IExpressionBuilder + { + internal static List DefaultResultConverters() => + new List + { + new MemberResolverExpressionResultConverter(), + new MemberGetterExpressionResultConverter() + }; + + internal static List DefaultBinders() => + new List + { + new CustomProjectionExpressionBinder(), + new NullableDestinationExpressionBinder(), + new NullableSourceExpressionBinder(), + new AssignableExpressionBinder(), + new EnumerableExpressionBinder(), + new MappedTypeExpressionBinder(), + new StringExpressionBinder() + }; + + private readonly LockingConcurrentDictionary _expressionCache; + private readonly IConfigurationProvider _configurationProvider; + + public ExpressionBuilder(IConfigurationProvider configurationProvider) + { + _configurationProvider = configurationProvider; + _expressionCache = new LockingConcurrentDictionary(CreateMapExpression); + } + + public LambdaExpression[] GetMapExpression(Type sourceType, Type destinationType, object parameters, + MemberInfo[] membersToExpand) + { + if (sourceType == null) + { + throw new ArgumentNullException(nameof(sourceType)); + } + if (destinationType == null) + { + throw new ArgumentNullException(nameof(destinationType)); + } + if (membersToExpand == null) + { + throw new ArgumentNullException(nameof(membersToExpand)); + } + + var cachedExpressions = _expressionCache.GetOrAdd(new ExpressionRequest(sourceType, destinationType, membersToExpand, null)); + + return cachedExpressions.Select(e => Prepare(e, parameters)).Cast().ToArray(); + } + + private Expression Prepare(Expression cachedExpression, object parameters) + { + Expression result; + if(parameters != null) + { + var visitor = ParameterExpressionVisitor.Create(parameters); + result = visitor.Visit(cachedExpression); + } + else + { + result = cachedExpression; + } + // perform null-propagation if this feature is enabled. + if(_configurationProvider.EnableNullPropagationForQueryMapping) + { + var nullVisitor = new NullsafeQueryRewriter(); + return nullVisitor.Visit(result); + } + return result; + } + + private LambdaExpression[] CreateMapExpression(ExpressionRequest request) => CreateMapExpression(request, new Dictionary(), + new FirstPassLetPropertyMaps(_configurationProvider) + ); + + public LambdaExpression[] CreateMapExpression(ExpressionRequest request, TypePairCount typePairCount, LetPropertyMaps letPropertyMaps) + { + // this is the input parameter of this expression with name + var instanceParameter = Parameter(request.SourceType, "dto"+ request.SourceType.Name); + var expressions = new QueryExpressions(CreateMapExpressionCore(request, instanceParameter, typePairCount, letPropertyMaps, out var typeMap)); + if(letPropertyMaps.Count > 0) + { + expressions = letPropertyMaps.GetSubQueryExpression(this, expressions.First, typeMap, request, instanceParameter, typePairCount); + } + if(expressions.First == null) + { + return null; + } + var firstLambda = Lambda(expressions.First, instanceParameter); + if(expressions.Second == null) + { + return new[] { firstLambda }; + } + return new[] { firstLambda, Lambda(expressions.Second, expressions.SecondParameter) }; + } + + public Expression CreateMapExpression(ExpressionRequest request, Expression instanceParameter, TypePairCount typePairCount, LetPropertyMaps letPropertyMaps) + { + return CreateMapExpressionCore(request, instanceParameter, typePairCount, letPropertyMaps, out var _); + } + + private Expression CreateMapExpressionCore(ExpressionRequest request, Expression instanceParameter, TypePairCount typePairCount, LetPropertyMaps letPropertyMaps, out TypeMap typeMap) + { + typeMap = _configurationProvider.ResolveTypeMap(request.SourceType, request.DestinationType); + + if(typeMap == null) + { + throw QueryMapperHelper.MissingMapException(request.SourceType, request.DestinationType); + } + + if(typeMap.CustomMapExpression != null) + { + return typeMap.CustomMapExpression.ReplaceParameters(instanceParameter); + } + return CreateMapExpressionCore(request, instanceParameter, typePairCount, typeMap, letPropertyMaps); + } + + private Expression CreateMapExpressionCore(ExpressionRequest request, Expression instanceParameter, TypePairCount typePairCount, TypeMap typeMap, LetPropertyMaps letPropertyMaps) + { + var bindings = new List(); + var depth = GetDepth(request, typePairCount); + if(typeMap.MaxDepth > 0 && depth >= typeMap.MaxDepth) + { + if(typeMap.Profile.AllowNullDestinationValues) + { + return null; + } + } + else + { + bindings = CreateMemberBindings(request, typeMap, instanceParameter, typePairCount, letPropertyMaps); + } + Expression constructorExpression = DestinationConstructorExpression(typeMap, instanceParameter); + if(instanceParameter is ParameterExpression) + constructorExpression = ((LambdaExpression)constructorExpression).ReplaceParameters(instanceParameter); + var visitor = new NewFinderVisitor(); + visitor.Visit(constructorExpression); + + var expression = MemberInit( + visitor.NewExpression, + bindings.ToArray() + ); + return expression; + } + + private static int GetDepth(ExpressionRequest request, TypePairCount typePairCount) + { + if (typePairCount.TryGetValue(request, out int visitCount)) + { + visitCount = visitCount + 1; + } + typePairCount[request] = visitCount; + return visitCount; + } + + private LambdaExpression DestinationConstructorExpression(TypeMap typeMap, Expression instanceParameter) + { + var ctorExpr = typeMap.CustomCtorExpression; + if (ctorExpr != null) + { + return ctorExpr; + } + var newExpression = typeMap.ConstructorMap?.CanResolve == true + ? typeMap.ConstructorMap.NewExpression(instanceParameter) + : New(typeMap.DestinationTypeToUse); + + return Lambda(newExpression); + } + + private class NewFinderVisitor : ExpressionVisitor + { + public NewExpression NewExpression { get; private set; } + + protected override Expression VisitNew(NewExpression node) + { + NewExpression = node; + return base.VisitNew(node); + } + } + + private List CreateMemberBindings(ExpressionRequest request, TypeMap typeMap, Expression instanceParameter, TypePairCount typePairCount, LetPropertyMaps letPropertyMaps) + { + var bindings = new List(); + foreach (var propertyMap in typeMap.PropertyMaps + .Where(pm => (!pm.ExplicitExpansion || request.MembersToExpand.Contains(pm.DestinationMember)) && + pm.CanResolveValue && ReflectionHelper.CanBeSet(pm.DestinationMember)) + .OrderBy(pm => pm.DestinationName)) + { + var propertyExpression = new PropertyExpression(propertyMap); + letPropertyMaps.Push(propertyExpression); + + CreateMemberBinding(propertyExpression); + + letPropertyMaps.Pop(); + } + return bindings; + void CreateMemberBinding(PropertyExpression propertyExpression) + { + var propertyMap = propertyExpression.PropertyMap; + var result = ResolveExpression(propertyMap, request.SourceType, instanceParameter, letPropertyMaps); + propertyExpression.Expression = result.ResolutionExpression; + var propertyTypeMap = _configurationProvider.ResolveTypeMap(result.Type, propertyMap.DestinationType); + var propertyRequest = new ExpressionRequest(result.Type, propertyMap.DestinationType, request.MembersToExpand, request); + if(propertyRequest.AlreadyExists) + { + return; + } + var binder = _configurationProvider.Binders.FirstOrDefault(b => b.IsMatch(propertyMap, propertyTypeMap, result)); + if(binder == null) + { + var message = + $"Unable to create a map expression from {propertyMap.SourceMember?.DeclaringType?.Name}.{propertyMap.SourceMember?.Name} ({result.Type}) to {propertyMap.DestinationMember.DeclaringType?.Name}.{propertyMap.DestinationName} ({propertyMap.DestinationType})"; + throw new AutoMapperMappingException(message, null, typeMap.Types, typeMap, propertyMap); + } + var bindExpression = binder.Build(_configurationProvider, propertyMap, propertyTypeMap, propertyRequest, result, typePairCount, letPropertyMaps); + if(bindExpression == null) + { + return; + } + var rhs = propertyMap.ValueTransformers + .Concat(typeMap.ValueTransformers) + .Concat(typeMap.Profile.ValueTransformers) + .Where(vt => vt.IsMatch(propertyMap)) + .Aggregate(bindExpression.Expression, (current, vtConfig) => ToType(ReplaceParameters(vtConfig.TransformerExpression, ToType(current, vtConfig.ValueType)), propertyMap.DestinationType)); + + bindExpression = bindExpression.Update(rhs); + + bindings.Add(bindExpression); + } + } + + private ExpressionResolutionResult ResolveExpression(PropertyMap propertyMap, Type currentType, Expression instanceParameter, LetPropertyMaps letPropertyMaps) + { + var result = new ExpressionResolutionResult(instanceParameter, currentType); + + var matchingExpressionConverter = _configurationProvider.ResultConverters.FirstOrDefault(c => c.CanGetExpressionResolutionResult(result, propertyMap)); + result = matchingExpressionConverter?.GetExpressionResolutionResult(result, propertyMap, letPropertyMaps) + ?? throw new Exception("Can't resolve this to Queryable Expression"); + + if(propertyMap.NullSubstitute != null && result.Type.IsNullableType()) + { + var currentChild = result.ResolutionExpression; + var currentChildType = result.Type; + var nullSubstitute = propertyMap.NullSubstitute; + + var newParameter = result.ResolutionExpression; + var converter = new NullSubstitutionConversionVisitor(newParameter, nullSubstitute); + + currentChild = converter.Visit(currentChild); + currentChildType = currentChildType.GetTypeOfNullable(); + + return new ExpressionResolutionResult(currentChild, currentChildType); + } + + return result; + } + + private class NullSubstitutionConversionVisitor : ExpressionVisitor + { + private readonly Expression _newParameter; + private readonly object _nullSubstitute; + + public NullSubstitutionConversionVisitor(Expression newParameter, object nullSubstitute) + { + _newParameter = newParameter; + _nullSubstitute = nullSubstitute; + } + + protected override Expression VisitMember(MemberExpression node) => node == _newParameter ? NullCheck(node) : node; + + private Expression NullCheck(Expression input) + { + var underlyingType = input.Type.GetTypeOfNullable(); + var nullSubstitute = ToType(Constant(_nullSubstitute), underlyingType); + return Condition(Property(input, "HasValue"), Property(input, "Value"), nullSubstitute, underlyingType); + } + } + + private abstract class ParameterExpressionVisitor : ExpressionVisitor + { + public static ParameterExpressionVisitor Create(object parameters) => + parameters is ParameterBag dictionary ? (ParameterExpressionVisitor) new ConstantExpressionReplacementVisitor(dictionary) : new ObjectParameterExpressionReplacementVisitor(parameters); + + protected abstract Expression GetValue(string name); + + protected override Expression VisitMember(MemberExpression node) + { + if(!node.Member.DeclaringType.Has()) + { + return base.VisitMember(node); + } + var parameterName = node.Member.Name; + var parameterValue = GetValue(parameterName); + if(parameterValue == null) + { + const string vbPrefix = "$VB$Local_"; + if(!parameterName.StartsWith(vbPrefix, StringComparison.Ordinal) || (parameterValue = GetValue(parameterName.Substring(vbPrefix.Length))) == null) + { + return base.VisitMember(node); + } + } + return ToType(parameterValue, node.Member.GetMemberType()); + } + + private class ObjectParameterExpressionReplacementVisitor : ParameterExpressionVisitor + { + private readonly object _parameters; + + public ObjectParameterExpressionReplacementVisitor(object parameters) => _parameters = parameters; + + protected override Expression GetValue(string name) + { + var matchingMember = _parameters.GetType().GetDeclaredProperty(name); + return matchingMember != null ? Property(Constant(_parameters), matchingMember) : null; + } + } + private class ConstantExpressionReplacementVisitor : ParameterExpressionVisitor + { + private readonly ParameterBag _paramValues; + + public ConstantExpressionReplacementVisitor(ParameterBag paramValues) => _paramValues = paramValues; + + protected override Expression GetValue(string name) => + _paramValues.TryGetValue(name, out object parameterValue) ? Constant(parameterValue) : null; + } + } + + public class FirstPassLetPropertyMaps : LetPropertyMaps + { + Stack _currentPath = new Stack(); + List _savedPaths = new List(); + IConfigurationProvider _configurationProvider; + + public FirstPassLetPropertyMaps(IConfigurationProvider configurationProvider) => + _configurationProvider = configurationProvider; + + public override Expression GetSubQueryMarker() + { + var propertyMap = _currentPath.Peek().PropertyMap; + var mapFrom = propertyMap.CustomMapExpression; + if(!IsSubQuery() || _configurationProvider.ResolveTypeMap(propertyMap.SourceType, propertyMap.DestinationType) == null) + { + return null; + } + var type = mapFrom.Body.Type; + var marker = Constant(null, type); + _savedPaths.Add(new PropertyPath(_currentPath.Reverse().ToArray(), marker)); + return marker; + bool IsSubQuery() + { + if(!(mapFrom.Body is MethodCallExpression methodCall)) + { + return false; + } + var method = methodCall.Method; + return method.IsStatic && method.DeclaringType == typeof(Enumerable); + } + } + + public override void Push(PropertyExpression propertyExpression) => _currentPath.Push(propertyExpression); + + public override void Pop() => _currentPath.Pop(); + + public override int Count => _savedPaths.Count; + + public override LetPropertyMaps New() => new FirstPassLetPropertyMaps(_configurationProvider); + + public override QueryExpressions GetSubQueryExpression(ExpressionBuilder builder, Expression projection, TypeMap typeMap, ExpressionRequest request, Expression instanceParameter, TypePairCount typePairCount) + { + var letMapInfos = _savedPaths.Select(path => + new { + MapFrom = path.Last.CustomMapExpression, + MapFromSource = path.GetSourceExpression(instanceParameter), + Property = path.GetPropertyDescription(), + path.Marker + }).ToArray(); + + var properties = letMapInfos.Select(m => m.Property).Concat(GetMemberAccessesVisitor.Retrieve(projection, instanceParameter)); + + var letType = ProxyGenerator.GetSimilarType(typeof(object), properties); + var typeMapFactory = new TypeMapFactory(); + TypeMap firstTypeMap; + lock(_configurationProvider) + { + firstTypeMap = typeMapFactory.CreateTypeMap(request.SourceType, letType, typeMap.Profile); + } + var secondParameter = Parameter(letType, "dtoLet"); + + ReplaceSubQueries(); + + var firstExpression = builder.CreateMapExpressionCore(request, instanceParameter, typePairCount, firstTypeMap, Default); + return new QueryExpressions(firstExpression, projection, secondParameter); + + void ReplaceSubQueries() + { + foreach(var letMapInfo in letMapInfos) + { + var letProperty = letType.GetDeclaredProperty(letMapInfo.Property.Name); + var letPropertyMap = firstTypeMap.FindOrCreatePropertyMapFor(letProperty); + letPropertyMap.CustomMapExpression = + Lambda(letMapInfo.MapFrom.ReplaceParameters(letMapInfo.MapFromSource), (ParameterExpression)instanceParameter); + projection = projection.Replace(letMapInfo.Marker, MakeMemberAccess(secondParameter, letProperty)); + } + projection = new ReplaceMemberAccessesVisitor(instanceParameter, secondParameter).Visit(projection); + } + } + + class GetMemberAccessesVisitor : ExpressionVisitor + { + private readonly Expression _target; + + public List Members { get; } = new List(); + + public GetMemberAccessesVisitor(Expression target) + { + _target = target; + } + + protected override Expression VisitMember(MemberExpression node) + { + if(node.Expression == _target) + { + Members.Add(node.Member); + } + return base.VisitMember(node); + } + + public static IEnumerable Retrieve(Expression expression, Expression target) + { + var visitor = new GetMemberAccessesVisitor(target); + visitor.Visit(expression); + return visitor.Members.Select(member => new PropertyDescription(member.Name, member.GetMemberType())); + } + } + + class ReplaceMemberAccessesVisitor : ExpressionVisitor + { + private readonly Expression _oldObject, _newObject; + + public ReplaceMemberAccessesVisitor(Expression oldObject, Expression newObject) + { + _oldObject = oldObject; + _newObject = newObject; + } + + protected override Expression VisitMember(MemberExpression node) + { + if(node.Expression != _oldObject) + { + return base.VisitMember(node); + } + return MakeMemberAccess(_newObject, _newObject.Type.GetFieldOrProperty(node.Member.Name)); + } + } + } + } + + public class LetPropertyMaps + { + public static readonly LetPropertyMaps Default = new LetPropertyMaps(); + + protected LetPropertyMaps() { } + + public virtual Expression GetSubQueryMarker() => null; + + public virtual void Push(PropertyExpression propertyExpression) {} + + public virtual void Pop() {} + + public virtual int Count => 0; + + public virtual LetPropertyMaps New() => Default; + + public virtual QueryExpressions GetSubQueryExpression(ExpressionBuilder builder, Expression projection, TypeMap typeMap, ExpressionRequest request, Expression instanceParameter, TypePairCount typePairCount) + => new QueryExpressions(projection); + + public struct PropertyPath + { + private readonly PropertyExpression[] _properties; + + public PropertyPath(PropertyExpression[] properties, Expression marker) + { + _properties = properties; + Marker = marker; + } + public Expression Marker { get; } + public PropertyMap Last => _properties[_properties.Length - 1].PropertyMap; + public Expression GetSourceExpression(Expression parameter) => + _properties.Take(_properties.Length - 1).SelectMany(p=>new MemberPath(p.Expression).Members).MemberAccesses(parameter); + public PropertyDescription GetPropertyDescription() => new PropertyDescription("__" + string.Join("#", _properties.Select(p => p.PropertyMap.DestinationName)), Last.SourceType); + } + } + + public struct QueryExpressions + { + public QueryExpressions(Expression first, Expression second = null, ParameterExpression secondParameter = null) + { + First = first; + Second = second; + SecondParameter = secondParameter; + } + public Expression First { get; } + public Expression Second { get; } + public ParameterExpression SecondParameter { get; } + } + + public static class ExpressionBuilderExtensions + { + public static Expression> GetMapExpression( + this IExpressionBuilder expressionBuilder) + { + return (Expression>) expressionBuilder.GetMapExpression(typeof(TSource), + typeof(TDestination), null, new MemberInfo[0])[0]; + } + } + + public class PropertyExpression + { + public PropertyExpression(PropertyMap propertyMap) => PropertyMap = propertyMap; + public Expression Expression { get; set; } + public PropertyMap PropertyMap { get; } + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/ExpressionRequest.cs b/src/AutoMapper/QueryableExtensions/ExpressionRequest.cs index d6466c0c9f..30c7aee084 100644 --- a/src/AutoMapper/QueryableExtensions/ExpressionRequest.cs +++ b/src/AutoMapper/QueryableExtensions/ExpressionRequest.cs @@ -1,58 +1,67 @@ -namespace AutoMapper.QueryableExtensions -{ - using System; - using System.Linq; - using System.Reflection; - - public class ExpressionRequest : IEquatable - { - public Type SourceType { get; } - - public Type DestinationType { get; } - - public MemberInfo[] MembersToExpand { get; } - - public ExpressionRequest(Type sourceType, Type destinationType, params MemberInfo[] membersToExpand) - { - SourceType = sourceType; - DestinationType = destinationType; - MembersToExpand = membersToExpand.OrderBy(p=>p.Name).ToArray(); - } - - public bool Equals(ExpressionRequest other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return MembersToExpand.SequenceEqual(other.MembersToExpand) && - SourceType == other.SourceType && DestinationType == other.DestinationType; - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != GetType()) return false; - return Equals((ExpressionRequest) obj); - } - - public override int GetHashCode() - { - unchecked + + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; + +namespace AutoMapper.QueryableExtensions +{ + [DebuggerDisplay("{SourceType.Name}, {DestinationType.Name}")] + public class ExpressionRequest : IEquatable + { + public Type SourceType { get; } + + public Type DestinationType { get; } + + public MemberInfo[] MembersToExpand { get; } + + internal ICollection PreviousRequests { get; } + + internal IEnumerable GetPreviousRequestsAndSelf() => PreviousRequests.Concat(new[] { this }); + + internal bool AlreadyExists => PreviousRequests.Contains(this); + + public ExpressionRequest(Type sourceType, Type destinationType, MemberInfo[] membersToExpand, ExpressionRequest parentRequest) + { + SourceType = sourceType; + DestinationType = destinationType; + MembersToExpand = membersToExpand.OrderBy(p => p.Name).ToArray(); + + PreviousRequests = parentRequest == null + ? new HashSet() + : new HashSet(parentRequest.GetPreviousRequestsAndSelf()); + } + + public bool Equals(ExpressionRequest other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return MembersToExpand.SequenceEqual(other.MembersToExpand) && + SourceType == other.SourceType && DestinationType == other.DestinationType; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + return Equals((ExpressionRequest) obj); + } + + public override int GetHashCode() + { + var hashCode = HashCodeCombiner.Combine(SourceType, DestinationType); + foreach(var member in MembersToExpand) { - var hashCode = SourceType.GetHashCode(); - hashCode = (hashCode*397) ^ DestinationType.GetHashCode(); - return MembersToExpand.Aggregate(hashCode, (currentHash, p) => (currentHash * 397) ^ p.GetHashCode()); - } - } - - public static bool operator ==(ExpressionRequest left, ExpressionRequest right) - { - return Equals(left, right); - } - - public static bool operator !=(ExpressionRequest left, ExpressionRequest right) - { - return !Equals(left, right); - } - } + hashCode = HashCodeCombiner.CombineCodes(hashCode, member.GetHashCode()); + } + return hashCode; + } + + public static bool operator ==(ExpressionRequest left, ExpressionRequest right) => Equals(left, right); + + public static bool operator !=(ExpressionRequest left, ExpressionRequest right) => !Equals(left, right); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/ExpressionResolutionResult.cs b/src/AutoMapper/QueryableExtensions/ExpressionResolutionResult.cs index e2e227cb59..c51fb9ca44 100644 --- a/src/AutoMapper/QueryableExtensions/ExpressionResolutionResult.cs +++ b/src/AutoMapper/QueryableExtensions/ExpressionResolutionResult.cs @@ -1,17 +1,17 @@ -namespace AutoMapper.QueryableExtensions -{ - using System; - using System.Linq.Expressions; - - public class ExpressionResolutionResult - { - public Expression ResolutionExpression { get; private set; } - public Type Type { get; private set; } - - public ExpressionResolutionResult(Expression resolutionExpression, Type type) - { - ResolutionExpression = resolutionExpression; - Type = type; - } - } +using System; +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions +{ + public class ExpressionResolutionResult + { + public Expression ResolutionExpression { get; } + public Type Type { get; } + + public ExpressionResolutionResult(Expression resolutionExpression, Type type) + { + ResolutionExpression = resolutionExpression; + Type = type; + } + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Extensions.cs b/src/AutoMapper/QueryableExtensions/Extensions.cs index 209c115794..4962b11d6b 100644 --- a/src/AutoMapper/QueryableExtensions/Extensions.cs +++ b/src/AutoMapper/QueryableExtensions/Extensions.cs @@ -1,131 +1,116 @@ -namespace AutoMapper.QueryableExtensions -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Impl; - - /// - /// Queryable extensions for AutoMapper - /// - public static class Extensions - { - /// - /// Maps a queryable expression of a source type to a queryable expression of a destination type - /// - /// Source type - /// Destination type - /// Source queryable - /// Destination queryable - /// Mapped destination queryable - public static IQueryable Map(this IQueryable sourceQuery, IQueryable destQuery) - => sourceQuery.Map(destQuery, Mapper.Configuration); - - /// - /// Maps a queryable expression of a source type to a queryable expression of a destination type - /// - /// Source type - /// Destination type - /// Source queryable - /// Destination queryable - /// - /// Mapped destination queryable - public static IQueryable Map(this IQueryable sourceQuery, IQueryable destQuery, IConfigurationProvider config) - { - return QueryMapperVisitor.Map(sourceQuery, destQuery, config); - } - - public static IQueryDataSourceInjection UseAsDataSource(this IQueryable dataSource) - => dataSource.UseAsDataSource(Mapper.Instance); - - public static IQueryDataSourceInjection UseAsDataSource(this IQueryable dataSource, IMapper mapper) - { - return new QueryDataSourceInjection(dataSource, mapper); - } - - /// - /// Extension method to project from a queryable using the provided mapping engine - /// - /// Projections are only calculated once and cached - /// Destination type - /// Queryable source - /// Optional parameter object for parameterized mapping expressions - /// Explicit members to expand - /// Expression to project into - public static IQueryable ProjectTo(this IQueryable source, object parameters, params Expression>[] membersToExpand) - => source.ProjectTo(Mapper.Configuration, parameters, membersToExpand); - - /// - /// Extension method to project from a queryable using the provided mapping engine - /// - /// Projections are only calculated once and cached - /// Destination type - /// Queryable source - /// Mapper configuration - /// Optional parameter object for parameterized mapping expressions - /// Explicit members to expand - /// Expression to project into - public static IQueryable ProjectTo(this IQueryable source, IConfigurationProvider configuration, object parameters, params Expression>[] membersToExpand) - { - return new ProjectionExpression(source, configuration.ExpressionBuilder).To(parameters, membersToExpand); - } - - /// - /// Extension method to project from a queryable using the provided mapping engine - /// - /// Projections are only calculated once and cached - /// Destination type - /// Queryable source - /// Mapper configuration - /// Explicit members to expand - /// Expression to project into - public static IQueryable ProjectTo( - this IQueryable source, - IConfigurationProvider configuration, - params Expression>[] membersToExpand - ) - => source.ProjectTo(configuration, null, membersToExpand); - - /// - /// Extension method to project from a queryable using the provided mapping engine - /// - /// Projections are only calculated once and cached - /// Destination type - /// Queryable source - /// Explicit members to expand - /// Expression to project into - public static IQueryable ProjectTo( - this IQueryable source, - params Expression>[] membersToExpand - ) - => source.ProjectTo(Mapper.Configuration, null, membersToExpand); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// Queryable source - /// Optional parameter object for parameterized mapping expressions - /// Explicit members to expand - /// Queryable result, use queryable extension methods to project and execute result - public static IQueryable ProjectTo(this IQueryable source, - IDictionary parameters, params string[] membersToExpand) - => source.ProjectTo(Mapper.Configuration, parameters, membersToExpand); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// Queryable source - /// Mapper configuration - /// Optional parameter object for parameterized mapping expressions - /// Explicit members to expand - /// Queryable result, use queryable extension methods to project and execute result - public static IQueryable ProjectTo(this IQueryable source, IConfigurationProvider configuration, IDictionary parameters, params string[] membersToExpand) - { - return new ProjectionExpression(source, configuration.ExpressionBuilder).To(parameters, membersToExpand); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper.QueryableExtensions.Impl; + +namespace AutoMapper.QueryableExtensions +{ + /// + /// Queryable extensions for AutoMapper + /// + public static class Extensions + { + /// + /// Maps a queryable expression of a source type to a queryable expression of a destination type + /// + /// Source type + /// Destination type + /// Source queryable + /// Destination queryable + /// Mapped destination queryable + public static IQueryable Map(this IQueryable sourceQuery, IQueryable destQuery) + => sourceQuery.Map(destQuery, Mapper.Configuration); + + /// + /// Maps a queryable expression of a source type to a queryable expression of a destination type + /// + /// Source type + /// Destination type + /// Source queryable + /// Destination queryable + /// + /// Mapped destination queryable + public static IQueryable Map(this IQueryable sourceQuery, IQueryable destQuery, IConfigurationProvider config) + => QueryMapperVisitor.Map(sourceQuery, destQuery, config); + + /// + /// Extension method to project from a queryable using the provided mapping engine + /// + /// Projections are only calculated once and cached + /// Destination type + /// Queryable source + /// Optional parameter object for parameterized mapping expressions + /// Explicit members to expand + /// Expression to project into + public static IQueryable ProjectTo(this IQueryable source, object parameters, params Expression>[] membersToExpand) + => source.ProjectTo(Mapper.Configuration, parameters, membersToExpand); + + /// + /// Extension method to project from a queryable using the provided mapping engine + /// + /// Projections are only calculated once and cached + /// Destination type + /// Queryable source + /// Mapper configuration + /// Optional parameter object for parameterized mapping expressions + /// Explicit members to expand + /// Expression to project into + public static IQueryable ProjectTo(this IQueryable source, IConfigurationProvider configuration, object parameters, params Expression>[] membersToExpand) + => new ProjectionExpression(source, configuration.ExpressionBuilder).To(parameters, membersToExpand); + + /// + /// Extension method to project from a queryable using the provided mapping engine + /// + /// Projections are only calculated once and cached + /// Destination type + /// Queryable source + /// Mapper configuration + /// Explicit members to expand + /// Expression to project into + public static IQueryable ProjectTo( + this IQueryable source, + IConfigurationProvider configuration, + params Expression>[] membersToExpand + ) + => source.ProjectTo(configuration, null, membersToExpand); + + /// + /// Extension method to project from a queryable using the provided mapping engine + /// + /// Projections are only calculated once and cached + /// Destination type + /// Queryable source + /// Explicit members to expand + /// Expression to project into + public static IQueryable ProjectTo( + this IQueryable source, + params Expression>[] membersToExpand + ) + => source.ProjectTo(Mapper.Configuration, null, membersToExpand); + + /// + /// Projects the source type to the destination type given the mapping configuration + /// + /// Destination type to map to + /// Queryable source + /// Optional parameter object for parameterized mapping expressions + /// Explicit members to expand + /// Queryable result, use queryable extension methods to project and execute result + public static IQueryable ProjectTo(this IQueryable source, + IDictionary parameters, params string[] membersToExpand) + => source.ProjectTo(Mapper.Configuration, parameters, membersToExpand); + + /// + /// Projects the source type to the destination type given the mapping configuration + /// + /// Destination type to map to + /// Queryable source + /// Mapper configuration + /// Optional parameter object for parameterized mapping expressions + /// Explicit members to expand + /// Queryable result, use queryable extension methods to project and execute result + public static IQueryable ProjectTo(this IQueryable source, IConfigurationProvider configuration, IDictionary parameters, params string[] membersToExpand) + => new ProjectionExpression(source, configuration.ExpressionBuilder).To(parameters, membersToExpand); + } +} diff --git a/src/AutoMapper/QueryableExtensions/IExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/IExpressionBinder.cs index 6bc861f146..0bedbf1bed 100644 --- a/src/AutoMapper/QueryableExtensions/IExpressionBinder.cs +++ b/src/AutoMapper/QueryableExtensions/IExpressionBinder.cs @@ -1,12 +1,12 @@ -namespace AutoMapper.QueryableExtensions -{ - using System.Linq.Expressions; - using System.Collections.Concurrent; - - public interface IExpressionBinder - { - bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result); - - MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount); - } +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions +{ + public interface IExpressionBinder + { + bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result); + + MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/IExpressionResultConverter.cs b/src/AutoMapper/QueryableExtensions/IExpressionResultConverter.cs index 6540e5ecf0..4b2956b14f 100644 --- a/src/AutoMapper/QueryableExtensions/IExpressionResultConverter.cs +++ b/src/AutoMapper/QueryableExtensions/IExpressionResultConverter.cs @@ -1,10 +1,10 @@ -namespace AutoMapper.QueryableExtensions -{ - public interface IExpressionResultConverter - { - ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap); - ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap); - bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap); - bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap); - } +namespace AutoMapper.QueryableExtensions +{ + public interface IExpressionResultConverter + { + ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap, LetPropertyMaps letPropertyMaps); + ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap); + bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap); + bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/IProjectionExpression.cs b/src/AutoMapper/QueryableExtensions/IProjectionExpression.cs deleted file mode 100644 index 3abdc2687b..0000000000 --- a/src/AutoMapper/QueryableExtensions/IProjectionExpression.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace AutoMapper.QueryableExtensions -{ - using System; - using System.Linq; - using System.Linq.Expressions; - - /// - /// Continuation to execute projection - /// - public interface IProjectionExpression - { - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// Optional parameter object for parameterized mapping expressions - /// Queryable result, use queryable extension methods to project and execute result - IQueryable To(object parameters = null); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// Optional parameter object for parameterized mapping expressions - /// Queryable result, use queryable extension methods to project and execute result - IQueryable To(System.Collections.Generic.IDictionary parameters); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// Optional parameter object for parameterized mapping expressions - /// Explicit members to expand - /// Queryable result, use queryable extension methods to project and execute result - IQueryable To(object parameters = null, params string[] membersToExpand); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// Parameters for parameterized mapping expressions - /// Explicit members to expand - /// Queryable result, use queryable extension methods to project and execute result - IQueryable To(System.Collections.Generic.IDictionary parameters, params string[] membersToExpand); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// >Explicit members to expand - /// Optional parameter object for parameterized mapping expressions - /// Queryable result, use queryable extension methods to project and execute result - IQueryable To(object parameters = null, params Expression>[] membersToExpand); - - /// - /// Projects the source type to the destination type given the mapping configuration - /// - /// Destination type to map to - /// >Explicit members to expand - /// Parameters for parameterized mapping expressions - /// Queryable result, use queryable extension methods to project and execute result - IQueryable To(System.Collections.Generic.IDictionary parameters, params Expression>[] membersToExpand); - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/AssignableExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/AssignableExpressionBinder.cs index 6d81f619a8..d0c9eb0f29 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/AssignableExpressionBinder.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/AssignableExpressionBinder.cs @@ -1,25 +1,17 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Linq.Expressions; - using System.Collections.Concurrent; - using System.Reflection; - - public class AssignableExpressionBinder : IExpressionBinder - { - public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return propertyMap.DestinationPropertyType.IsAssignableFrom(result.Type); - } - - public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - return BindAssignableExpression(propertyMap, result); - } - - private static MemberAssignment BindAssignableExpression(PropertyMap propertyMap, - ExpressionResolutionResult result) - { - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, result.ResolutionExpression); - } - } +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class AssignableExpressionBinder : IExpressionBinder + { + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) + => propertyMap.DestinationType.IsAssignableFrom(result.Type) && propertyTypeMap == null; + + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + => BindAssignableExpression(propertyMap, result); + + private static MemberAssignment BindAssignableExpression(PropertyMap propertyMap, ExpressionResolutionResult result) + => Expression.Bind(propertyMap.DestinationMember, result.ResolutionExpression); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/CustomProjectionExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/CustomProjectionExpressionBinder.cs index 3d2c32d2bd..0f869454bd 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/CustomProjectionExpressionBinder.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/CustomProjectionExpressionBinder.cs @@ -1,25 +1,17 @@ -using System.Linq; - -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Collections.Concurrent; - using System.Linq.Expressions; - - public class CustomProjectionExpressionBinder : IExpressionBinder - { - public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return propertyTypeMap?.CustomProjection != null; - } - - public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - return BindCustomProjectionExpression(propertyMap, propertyTypeMap, result); - } - - private static MemberAssignment BindCustomProjectionExpression(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, propertyTypeMap.CustomProjection.ReplaceParameters(result.ResolutionExpression)); - } - } +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class CustomProjectionExpressionBinder : IExpressionBinder + { + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) + => propertyTypeMap?.CustomMapExpression != null; + + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + => BindCustomProjectionExpression(propertyMap, propertyTypeMap, result); + + private static MemberAssignment BindCustomProjectionExpression(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) + => Expression.Bind(propertyMap.DestinationMember, propertyTypeMap.CustomMapExpression.ReplaceParameters(result.ResolutionExpression)); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/DelegateBasedResolverResolutConverter.cs b/src/AutoMapper/QueryableExtensions/Impl/DelegateBasedResolverResolutConverter.cs deleted file mode 100644 index 883718bc2d..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/DelegateBasedResolverResolutConverter.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - - //public class ExpressionBasedResolverResultConverter : IExpressionResultConverter - //{ - // public ExpressionResolutionResult GetExpressionResolutionResult( - // ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) - // { - // return ExpressionResolutionResult(expressionResolutionResult, ((IMemberResolver) valueResolver).GetExpression); - // } - - // private static ExpressionResolutionResult ExpressionResolutionResult( - // ExpressionResolutionResult expressionResolutionResult, LambdaExpression lambdaExpression) - // { - // var oldParameter = lambdaExpression.Parameters.Single(); - // var newParameter = expressionResolutionResult.ResolutionExpression; - // var converter = new ParameterConversionVisitor(newParameter, oldParameter); - - // Expression currentChild = converter.Visit(lambdaExpression.Body); - // Type currentChildType = currentChild.Type; - - // return new ExpressionResolutionResult(currentChild, currentChildType); - // } - - // public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - // ConstructorParameterMap propertyMap, IValueResolver valueResolver) - // { - // return ExpressionResolutionResult(expressionResolutionResult, null); - // } - - // public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - // IValueResolver valueResolver) - // { - // return valueResolver is IMemberResolver; - // } - //} -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/EnumerableExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/EnumerableExpressionBinder.cs index bc293e83fe..63613ee6c9 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/EnumerableExpressionBinder.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/EnumerableExpressionBinder.cs @@ -1,98 +1,45 @@ -using System.Collections.Concurrent; - -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Collections.Generic; - using System.Reflection; - using System.Linq; - using System.Linq.Expressions; - - public class EnumerableExpressionBinder : IExpressionBinder - { - public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return propertyMap.DestinationPropertyType.GetTypeInfo().ImplementedInterfaces.Any(t => t.Name == "IEnumerable") && - propertyMap.DestinationPropertyType != typeof (string); - } - - public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - return BindEnumerableExpression(configuration, propertyMap, request, result, typePairCount); - } - - private static MemberAssignment BindEnumerableExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - var destinationListType = GetDestinationListTypeFor(propertyMap); - - var sourceListType = result.Type.IsArray ? result.Type.GetElementType() : result.Type.GetTypeInfo().GenericTypeArguments.First(); - var listTypePair = new ExpressionRequest(sourceListType, destinationListType, request.MembersToExpand); - - Expression exp = result.ResolutionExpression; - - if (sourceListType != destinationListType) - { - var transformedExpression = configuration.ExpressionBuilder.CreateMapExpression(listTypePair, typePairCount); - if(transformedExpression == null) - { - return null; - } - exp = Expression.Call( - typeof (Enumerable), - "Select", - new[] {sourceListType, destinationListType}, - result.ResolutionExpression, - transformedExpression); - } - - - if (typeof (IList<>).MakeGenericType(destinationListType) - .GetTypeInfo().IsAssignableFrom(propertyMap.DestinationPropertyType.GetTypeInfo()) - || - typeof (ICollection<>).MakeGenericType(destinationListType) - .GetTypeInfo().IsAssignableFrom(propertyMap.DestinationPropertyType.GetTypeInfo())) - { - // Call .ToList() on IEnumerable - exp = GetToListCallExpression(propertyMap, destinationListType, exp); - } - else if (propertyMap.DestinationPropertyType.IsArray) - { - // Call .ToArray() on IEnumerable - exp = Expression.Call( - typeof (Enumerable), - "ToArray", - new[] {destinationListType}, - exp); - } - - if(configuration.AllowNullCollections) { - exp = Expression.Condition( - Expression.NotEqual( - Expression.TypeAs(result.ResolutionExpression, typeof(object)), - Expression.Constant(null)), - exp, - Expression.Constant(null, propertyMap.DestinationPropertyType)); - } - - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, exp); - } - - private static Type GetDestinationListTypeFor(PropertyMap propertyMap) - { - var destinationListType = propertyMap.DestinationPropertyType.IsArray - ? propertyMap.DestinationPropertyType.GetElementType() - : propertyMap.DestinationPropertyType.GetTypeInfo().GenericTypeArguments.First(); - return destinationListType; - } - - private static MethodCallExpression GetToListCallExpression(PropertyMap propertyMap, Type destinationListType, - Expression selectExpression) - { - return Expression.Call( - typeof (Enumerable), - propertyMap.DestinationPropertyType.IsArray ? "ToArray" : "ToList", - new[] {destinationListType}, - selectExpression); - } - } +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper.Configuration; +using AutoMapper.Mappers; +using AutoMapper.Mappers.Internal; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class EnumerableExpressionBinder : IExpressionBinder + { + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) => + propertyMap.DestinationType.IsEnumerableType() && propertyMap.SourceType.IsEnumerableType(); + + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + => BindEnumerableExpression(configuration, propertyMap, request, result, typePairCount, letPropertyMaps); + + private static MemberAssignment BindEnumerableExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + { + var destinationListType = ElementTypeHelper.GetElementType(propertyMap.DestinationType); + var sourceListType = ElementTypeHelper.GetElementType(propertyMap.SourceType); + var expression = result.ResolutionExpression; + + if (sourceListType != destinationListType) + { + var listTypePair = new ExpressionRequest(sourceListType, destinationListType, request.MembersToExpand, request); + var transformedExpressions = configuration.ExpressionBuilder.CreateMapExpression(listTypePair, typePairCount, letPropertyMaps.New()); + if(transformedExpressions == null) + { + return null; + } + expression = transformedExpressions.Aggregate(expression, (source, lambda) => Select(source, lambda)); + } + + expression = Expression.Call(typeof(Enumerable), propertyMap.DestinationType.IsArray ? "ToArray" : "ToList", new[] { destinationListType }, expression); + + return Expression.Bind(propertyMap.DestinationMember, expression); + } + + private static Expression Select(Expression source, LambdaExpression lambda) + { + return Expression.Call(typeof(Enumerable), "Select", new[] { lambda.Parameters[0].Type, lambda.ReturnType }, source, lambda); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/MappedTypeExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/MappedTypeExpressionBinder.cs index b1569db659..0bd3c2369a 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/MappedTypeExpressionBinder.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/MappedTypeExpressionBinder.cs @@ -1,39 +1,34 @@ -using System.Collections.Concurrent; - -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Linq.Expressions; - - public class MappedTypeExpressionBinder : IExpressionBinder - { - public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return propertyTypeMap != null && propertyTypeMap.CustomProjection == null; - } - - public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - return BindMappedTypeExpression(configuration, propertyMap, request, result, typePairCount); - } - - private static MemberAssignment BindMappedTypeExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - var transformedExpression = configuration.ExpressionBuilder.CreateMapExpression(request, result.ResolutionExpression, typePairCount); - if(transformedExpression == null) - { - return null; - } - // Handles null source property so it will not create an object with possible non-nullable propeerties - // which would result in an exception. - if (configuration.AllowNullDestinationValues) - { - var expressionNull = Expression.Constant(null, propertyMap.DestinationPropertyType); - transformedExpression = - Expression.Condition(Expression.NotEqual(result.ResolutionExpression, Expression.Constant(null)), - transformedExpression, expressionNull); - } - - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, transformedExpression); - } - } +using AutoMapper.Configuration; +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions.Impl +{ + using static Expression; + + public class MappedTypeExpressionBinder : IExpressionBinder + { + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) => + propertyTypeMap != null && propertyTypeMap.CustomMapExpression == null; + + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + => BindMappedTypeExpression(configuration, propertyMap, request, result, typePairCount, letPropertyMaps); + + private static MemberAssignment BindMappedTypeExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + { + var transformedExpression = configuration.ExpressionBuilder.CreateMapExpression(request, result.ResolutionExpression, typePairCount, letPropertyMaps); + if(transformedExpression == null) + { + return null; + } + // Handles null source property so it will not create an object with possible non-nullable properties + // which would result in an exception. + if (propertyMap.TypeMap.Profile.AllowNullDestinationValues && !propertyMap.AllowNull && !(result.ResolutionExpression is ParameterExpression) && !result.ResolutionExpression.Type.IsCollectionType()) + { + transformedExpression = result.ResolutionExpression.IfNullElse(Constant(null, transformedExpression.Type), transformedExpression); + } + + return Bind(propertyMap.DestinationMember, transformedExpression); + } + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/MemberAccessQueryMapperVisitor.cs b/src/AutoMapper/QueryableExtensions/Impl/MemberAccessQueryMapperVisitor.cs index 8e4cf8037d..b80b85dccb 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/MemberAccessQueryMapperVisitor.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/MemberAccessQueryMapperVisitor.cs @@ -1,31 +1,31 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Linq.Expressions; - - public class MemberAccessQueryMapperVisitor : ExpressionVisitor - { - private readonly ExpressionVisitor _rootVisitor; - private readonly IConfigurationProvider _config; - - public MemberAccessQueryMapperVisitor(ExpressionVisitor rootVisitor, IConfigurationProvider config) - { - _rootVisitor = rootVisitor; - _config = config; - } - - protected override Expression VisitMember(MemberExpression node) - { - Expression parentExpr = _rootVisitor.Visit(node.Expression); - if (parentExpr != null) - { - var propertyMap = _config.GetPropertyMap(node.Member, parentExpr.Type); - - var newMember = Expression.MakeMemberAccess(parentExpr, propertyMap.DestinationProperty.MemberInfo); - - return newMember; - } - return node; - } - - } +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class MemberAccessQueryMapperVisitor : ExpressionVisitor + { + private readonly ExpressionVisitor _rootVisitor; + private readonly IConfigurationProvider _config; + + public MemberAccessQueryMapperVisitor(ExpressionVisitor rootVisitor, IConfigurationProvider config) + { + _rootVisitor = rootVisitor; + _config = config; + } + + protected override Expression VisitMember(MemberExpression node) + { + var parentExpr = _rootVisitor.Visit(node.Expression); + if (parentExpr != null) + { + var propertyMap = _config.GetPropertyMap(node.Member, parentExpr.Type); + + var newMember = Expression.MakeMemberAccess(parentExpr, propertyMap.DestinationMember); + + return newMember; + } + return node; + } + + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/MemberGetterExpressionResultConverter.cs b/src/AutoMapper/QueryableExtensions/Impl/MemberGetterExpressionResultConverter.cs index 6e7745c2c1..b323f34bd8 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/MemberGetterExpressionResultConverter.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/MemberGetterExpressionResultConverter.cs @@ -1,57 +1,36 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - - public class MemberGetterExpressionResultConverter : IExpressionResultConverter - { - public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) - { - return ExpressionResolutionResult(expressionResolutionResult, propertyMap.SourceMembers); - } - - public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - ConstructorParameterMap propertyMap) - { - return ExpressionResolutionResult(expressionResolutionResult, propertyMap.SourceMembers); - } - - private static ExpressionResolutionResult ExpressionResolutionResult( - ExpressionResolutionResult expressionResolutionResult, IEnumerable sourceMembers) - { - return sourceMembers.Aggregate(expressionResolutionResult, ExpressionResolutionResult); - } - - private static ExpressionResolutionResult ExpressionResolutionResult( - ExpressionResolutionResult expressionResolutionResult, IMemberGetter getter) - { - Expression currentChild = expressionResolutionResult.ResolutionExpression; - Type currentChildType; - var memberInfo = getter.MemberInfo; - - var propertyInfo = memberInfo as PropertyInfo; - if (propertyInfo != null) - { - currentChild = Expression.Property(currentChild, propertyInfo); - currentChildType = propertyInfo.PropertyType; - } - else - currentChildType = currentChild.Type; - - return new ExpressionResolutionResult(currentChild, currentChildType); - } - - public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) - { - return propertyMap.SourceMembers.Any(); - } - - public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap) - { - return propertyMap.SourceMembers.Any(); - } - } +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class MemberGetterExpressionResultConverter : IExpressionResultConverter + { + public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap, LetPropertyMaps letPropertyMaps) + => ExpressionResolutionResult(expressionResolutionResult, propertyMap.SourceMembers); + + public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, + ConstructorParameterMap propertyMap) + => ExpressionResolutionResult(expressionResolutionResult, propertyMap.SourceMembers); + + private static ExpressionResolutionResult ExpressionResolutionResult( + ExpressionResolutionResult expressionResolutionResult, IEnumerable sourceMembers) + => sourceMembers.Aggregate(expressionResolutionResult, ExpressionResolutionResult); + + private static ExpressionResolutionResult ExpressionResolutionResult( + ExpressionResolutionResult expressionResolutionResult, MemberInfo getter) + { + var member = (getter is MethodInfo method) + ? (Expression)Expression.Call(method, expressionResolutionResult.ResolutionExpression) + : Expression.MakeMemberAccess(expressionResolutionResult.ResolutionExpression, getter); + return new ExpressionResolutionResult(member, member.Type); + } + + public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) + => propertyMap.SourceMembers.Any(); + + public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap) + => propertyMap.SourceMembers.Any(); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/MemberResolverExpressionResultConverter.cs b/src/AutoMapper/QueryableExtensions/Impl/MemberResolverExpressionResultConverter.cs index 28f73f57ae..f624e9625a 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/MemberResolverExpressionResultConverter.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/MemberResolverExpressionResultConverter.cs @@ -1,71 +1,36 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - - public class MemberResolverExpressionResultConverter : IExpressionResultConverter - { - public ExpressionResolutionResult GetExpressionResolutionResult( - ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) - { - return ExpressionResolutionResult(expressionResolutionResult, propertyMap.CustomExpression); - } - - private static ExpressionResolutionResult ExpressionResolutionResult( - ExpressionResolutionResult expressionResolutionResult, LambdaExpression lambdaExpression) - { - Expression currentChild = lambdaExpression.ReplaceParameters(expressionResolutionResult.ResolutionExpression); - Type currentChildType = currentChild.Type; - - return new ExpressionResolutionResult(currentChild, currentChildType); - } - - public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - ConstructorParameterMap propertyMap) - { - return ExpressionResolutionResult(expressionResolutionResult, null); - } - - public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - PropertyMap propertyMap) - { - return propertyMap.CustomExpression != null; - } - - public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - ConstructorParameterMap propertyMap) - { - return false; - } - } - - internal class ParameterConversionVisitor : ExpressionVisitor - { - private readonly Expression newParameter; - private readonly ParameterExpression oldParameter; - - public ParameterConversionVisitor(Expression newParameter, ParameterExpression oldParameter) - { - this.newParameter = newParameter; - this.oldParameter = oldParameter; - } - - protected override Expression VisitParameter(ParameterExpression node) - { - // replace all old param references with new ones - return node == oldParameter ? newParameter : node; - } - - protected override Expression VisitMember(MemberExpression node) - { - if (node.Expression != oldParameter) // if instance is not old parameter - do nothing - return base.VisitMember(node); - - var newObj = Visit(node.Expression); - var newMember = newParameter.Type.GetMember(node.Member.Name).First(); - return Expression.MakeMemberAccess(newObj, newMember); - } - } +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class MemberResolverExpressionResultConverter : IExpressionResultConverter + { + public ExpressionResolutionResult GetExpressionResolutionResult( + ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap, LetPropertyMaps letPropertyMaps) + { + Expression subQueryMarker; + if((subQueryMarker = letPropertyMaps.GetSubQueryMarker()) != null) + { + return new ExpressionResolutionResult(subQueryMarker, subQueryMarker.Type); + } + return ExpressionResolutionResult(expressionResolutionResult, propertyMap.CustomMapExpression); + } + + private static ExpressionResolutionResult ExpressionResolutionResult( + ExpressionResolutionResult expressionResolutionResult, LambdaExpression lambdaExpression) + { + var currentChild = lambdaExpression.ReplaceParameters(expressionResolutionResult.ResolutionExpression); + var currentChildType = currentChild.Type; + + return new ExpressionResolutionResult(currentChild, currentChildType); + } + + public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, + ConstructorParameterMap propertyMap) => ExpressionResolutionResult(expressionResolutionResult, null); + + public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, + PropertyMap propertyMap) => propertyMap.CustomMapExpression != null; + + public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, + ConstructorParameterMap propertyMap) => false; + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/NullSubstitutionExpressionResultConverter.cs b/src/AutoMapper/QueryableExtensions/Impl/NullSubstitutionExpressionResultConverter.cs deleted file mode 100644 index e256a549e5..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/NullSubstitutionExpressionResultConverter.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Linq.Expressions; - using Configuration; - using Execution; - - public class ExplicitValueExpressionResultConverter : IExpressionResultConverter - { - public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - PropertyMap propertyMap) - { - return new ExpressionResolutionResult(Expression.Constant(propertyMap.CustomValue), propertyMap.CustomValue.GetType()); - } - - public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - ConstructorParameterMap propertyMap) - { - throw new NotImplementedException(); - } - - public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) - { - return propertyMap.CustomValue != null; - } - - public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, - ConstructorParameterMap propertyMap) - { - return false; - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/NullableDestinationExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/NullableDestinationExpressionBinder.cs new file mode 100644 index 0000000000..f50234d522 --- /dev/null +++ b/src/AutoMapper/QueryableExtensions/Impl/NullableDestinationExpressionBinder.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using static System.Linq.Expressions.Expression; +using AutoMapper.Configuration; +using AutoMapper.Internal; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class NullableDestinationExpressionBinder : IExpressionBinder + { + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) => + propertyMap.DestinationType.IsNullableType() && !result.Type.IsNullableType(); + + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + => BindNullableExpression(propertyMap, result); + + private static MemberAssignment BindNullableExpression(PropertyMap propertyMap, + ExpressionResolutionResult result) + { + var destinationType = propertyMap.DestinationType; + var expressionToBind = + result.ResolutionExpression.GetMembers().Aggregate( + ExpressionFactory.ToType(result.ResolutionExpression, destinationType), + (accumulator, current) => current.IfNullElse(Constant(null, destinationType), accumulator)); + return Bind(propertyMap.DestinationMember, expressionToBind); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/NullableExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/NullableExpressionBinder.cs deleted file mode 100644 index 7364fb508a..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/NullableExpressionBinder.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Concurrent; - -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Linq.Expressions; - using Configuration; - - public class NullableExpressionBinder : IExpressionBinder - { - public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return propertyMap.DestinationPropertyType.IsNullableType() - && !result.Type.IsNullableType(); - } - - public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - return BindNullableExpression(propertyMap, result); - } - - private static MemberAssignment BindNullableExpression(PropertyMap propertyMap, - ExpressionResolutionResult result) - { - if (result.ResolutionExpression.NodeType == ExpressionType.MemberAccess) - { - var memberExpr = (MemberExpression) result.ResolutionExpression; - if (memberExpr.Expression != null && memberExpr.Expression.NodeType == ExpressionType.MemberAccess) - { - var destType = propertyMap.DestinationPropertyType; - var parentExpr = memberExpr.Expression; - Expression expressionToBind = Expression.Convert(memberExpr, destType); - var nullExpression = Expression.Convert(Expression.Constant(null), destType); - while (parentExpr.NodeType != ExpressionType.Parameter) - { - memberExpr = (MemberExpression) memberExpr.Expression; - parentExpr = memberExpr.Expression; - expressionToBind = Expression.Condition( - Expression.Equal(memberExpr, Expression.Constant(null)), - nullExpression, - expressionToBind - ); - } - - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, expressionToBind); - } - } - - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, - Expression.Convert(result.ResolutionExpression, propertyMap.DestinationPropertyType)); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/NullableSourceExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/NullableSourceExpressionBinder.cs new file mode 100644 index 0000000000..2e55de35e3 --- /dev/null +++ b/src/AutoMapper/QueryableExtensions/Impl/NullableSourceExpressionBinder.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using AutoMapper.Configuration; + +namespace AutoMapper.QueryableExtensions +{ + using static Expression; + + internal class NullableSourceExpressionBinder : IExpressionBinder + { + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + { + var defaultDestination = Activator.CreateInstance(propertyMap.DestinationType); + return Bind(propertyMap.DestinationMember, Coalesce(result.ResolutionExpression, Constant(defaultDestination))); + } + + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) => + result.Type.IsNullableType() && !propertyMap.DestinationType.IsNullableType() && propertyMap.DestinationType.IsValueType(); + } +} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/ParameterReplacementVisitor.cs b/src/AutoMapper/QueryableExtensions/Impl/ParameterReplacementVisitor.cs deleted file mode 100644 index 3fc7856a52..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/ParameterReplacementVisitor.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Linq.Expressions; - - public class ParameterReplacementVisitor : ExpressionVisitor - { - private readonly Expression _memberExpression; - - public ParameterReplacementVisitor(Expression memberExpression) - { - _memberExpression = memberExpression; - } - - protected override Expression VisitParameter(ParameterExpression node) - { - return _memberExpression; - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/QueryDataSourceInjection.cs b/src/AutoMapper/QueryableExtensions/Impl/QueryDataSourceInjection.cs deleted file mode 100644 index 5e5db4fb93..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/QueryDataSourceInjection.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Linq; - -namespace AutoMapper.QueryableExtensions.Impl -{ - public interface IQueryDataSourceInjection - { - IQueryable For(SourceInjectedQueryInspector inspector = null); - } - - public class QueryDataSourceInjection : IQueryDataSourceInjection - { - private readonly IQueryable _dataSource; - private readonly IMapper _mapper; - - public QueryDataSourceInjection(IQueryable dataSource, IMapper mapper) - { - _dataSource = dataSource; - _mapper = mapper; - } - - public IQueryable For(SourceInjectedQueryInspector inspector = null) - { - return new SourceInjectedQuery(_dataSource, - new TDestination[0].AsQueryable(), _mapper, inspector); - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/QueryMapperHelper.cs b/src/AutoMapper/QueryableExtensions/Impl/QueryMapperHelper.cs index 6643e96ed7..35e566c288 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/QueryMapperHelper.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/QueryMapperHelper.cs @@ -1,42 +1,51 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Linq; - using System.Reflection; - - internal static class QueryMapperHelper - { - public static PropertyMap GetPropertyMap(this IConfigurationProvider config, MemberInfo sourceMemberInfo, Type destinationMemberType) - { - var typeMap = config.CheckIfMapExists(sourceMemberInfo.DeclaringType, destinationMemberType); - - var propertyMap = typeMap.GetPropertyMaps() - .FirstOrDefault(pm => pm.CanResolveValue() && - pm.SourceMember != null && pm.SourceMember.Name == sourceMemberInfo.Name); - - if (propertyMap == null) - { - var message = $"Missing property map from {sourceMemberInfo.DeclaringType.Name} to {destinationMemberType.Name} for {sourceMemberInfo.Name} property. Create using Mapper.CreateMap<{sourceMemberInfo.DeclaringType.Name}, {destinationMemberType.Name}>."; - throw new InvalidOperationException(message); - } - return propertyMap; - } - - public static TypeMap CheckIfMapExists(this IConfigurationProvider config, Type sourceType, Type destinationType) - { - var typeMap = config.FindTypeMapFor(sourceType, destinationType); - if(typeMap == null) - { - throw MissingMapException(sourceType, destinationType); - } - return typeMap; - } - - public static Exception MissingMapException(Type sourceType, Type destinationType) - { - var source = sourceType.Name; - var destination = destinationType.Name; - throw new InvalidOperationException($"Missing map from {source} to {destination}. Create using Mapper.CreateMap<{source}, {destination}>."); - } - } -} \ No newline at end of file +using System; +using System.Linq; +using System.Reflection; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public static class QueryMapperHelper + { + public static PropertyMap GetPropertyMap(this IConfigurationProvider config, MemberInfo sourceMemberInfo, Type destinationMemberType) + { + var typeMap = config.CheckIfMapExists(sourceMemberInfo.DeclaringType, destinationMemberType); + + var propertyMap = typeMap.PropertyMaps + .FirstOrDefault(pm => pm.CanResolveValue && + pm.SourceMember != null && pm.SourceMember.Name == sourceMemberInfo.Name); + + if (propertyMap == null) + throw PropertyConfigurationException(typeMap, sourceMemberInfo.Name); + + return propertyMap; + } + + public static PropertyMap GetPropertyMapByDestinationProperty(this TypeMap typeMap, string destinationPropertyName) + { + var propertyMap = typeMap.PropertyMaps.SingleOrDefault(item => item.DestinationName == destinationPropertyName); + if (propertyMap == null) + throw PropertyConfigurationException(typeMap, destinationPropertyName); + + return propertyMap; + } + + public static TypeMap CheckIfMapExists(this IConfigurationProvider config, Type sourceType, Type destinationType) + { + var typeMap = config.ResolveTypeMap(sourceType, destinationType); + if(typeMap == null) + { + throw MissingMapException(sourceType, destinationType); + } + return typeMap; + } + + public static Exception PropertyConfigurationException(TypeMap typeMap, params string[] unmappedPropertyNames) + => new AutoMapperConfigurationException(new[] { new AutoMapperConfigurationException.TypeMapConfigErrors(typeMap, unmappedPropertyNames, true) }); + + public static Exception MissingMapException(TypePair types) + => MissingMapException(types.SourceType, types.DestinationType); + + public static Exception MissingMapException(Type sourceType, Type destinationType) + => new InvalidOperationException($"Missing map from {sourceType} to {destinationType}. Create using Mapper.CreateMap<{sourceType.Name}, {destinationType.Name}>."); + } +} diff --git a/src/AutoMapper/QueryableExtensions/Impl/QueryMapperVisitor.cs b/src/AutoMapper/QueryableExtensions/Impl/QueryMapperVisitor.cs index 5a1527b494..e5b5d22e8e 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/QueryMapperVisitor.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/QueryMapperVisitor.cs @@ -1,162 +1,165 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using System.Threading; - using Execution; - - public class QueryMapperVisitor : ExpressionVisitor - { - private readonly IQueryable _destQuery; - private readonly ParameterExpression _instanceParameter; - private readonly Type _sourceType; - private readonly Type _destinationType; - private readonly Stack _tree = new Stack(); - private readonly Stack _newTree = new Stack(); - private readonly MemberAccessQueryMapperVisitor _memberVisitor; - - - internal QueryMapperVisitor(Type sourceType, Type destinationType, IQueryable destQuery, IConfigurationProvider config) - { - _sourceType = sourceType; - _destinationType = destinationType; - _destQuery = destQuery; - _instanceParameter = Expression.Parameter(destinationType, "dto"); - _memberVisitor = new MemberAccessQueryMapperVisitor(this, config); - } - - public static IQueryable Map(IQueryable sourceQuery, IQueryable destQuery, IConfigurationProvider config) - { - var visitor = new QueryMapperVisitor(typeof(TSource), typeof(TDestination), destQuery, config); - var expr = visitor.Visit(sourceQuery.Expression); - - var newDestQuery = destQuery.Provider.CreateQuery(expr); - return newDestQuery; - } - - public override Expression Visit(Expression node) - { - _tree.Push(node); - // OData Client DataServiceQuery initial expression node type - if (node != null && (int)node.NodeType == 10000) - { - return node; - } - var newNode = base.Visit(node); - _newTree.Push(newNode); - return newNode; - } - - protected override Expression VisitParameter(ParameterExpression node) - { - return _instanceParameter; - } - - protected override Expression VisitConstant(ConstantExpression node) - { - var query = node.Value as IQueryable; - // It is data source of queryable object instance - if (query != null && query.ElementType == _sourceType) - return _destQuery.Expression; - return node; - } - - protected override Expression VisitBinary(BinaryExpression node) - { - var left = Visit(node.Left); - var right = Visit(node.Right); - - // Convert Right expression value to left expr type - // It is needed when PropertyMap is changing type of property - if (left.Type != right.Type && right.NodeType == ExpressionType.Constant) - { - var value = Convert.ChangeType(((ConstantExpression)right).Value, left.Type, System.Globalization.CultureInfo.CurrentCulture); - - right = Expression.Constant(value, left.Type); - } - - return Expression.MakeBinary(node.NodeType, left, right); - } - - protected override Expression VisitLambda(Expression node) - { - var newBody = Visit(node.Body); - var newParams = node.Parameters.Select(p => (ParameterExpression)Visit(p)); - - var delegateType = ChangeLambdaArgTypeFormSourceToDest(node.Type, newBody.Type); - - var newLambda = Expression.Lambda(delegateType, newBody, newParams); - return newLambda; - } - - protected override Expression VisitMethodCall(MethodCallExpression node) - { - if (node.Method.Name == "OrderBy" || node.Method.Name == "OrderByDescending" || - node.Method.Name == "ThenBy" || node.Method.Name == "ThenByDescending") - { - return VisitOrderBy(node); - } - - var args = node.Arguments.Select(Visit).ToList(); - var newObject = Visit(node.Object); - var method = ChangeMethodArgTypeFormSourceToDest(node.Method); - - var newMethodCall = Expression.Call(newObject, method, args); - return newMethodCall; - } - - private Expression VisitOrderBy(MethodCallExpression node) - { - var query = node.Arguments[0]; - var orderByExpr = node.Arguments[1]; - - var newQuery = Visit(query); - var newOrderByExpr = Visit(orderByExpr); - var newObject = Visit(node.Object); - - - var genericMethod = node.Method.GetGenericMethodDefinition(); - var methodArgs = node.Method.GetGenericArguments(); - methodArgs[0] = methodArgs[0].ReplaceItemType(_sourceType, _destinationType); - methodArgs[1] = methodArgs[1].ReplaceItemType(typeof(string), typeof(int)); - var orderByMethod = genericMethod.MakeGenericMethod(methodArgs); - - return Expression.Call(newObject, orderByMethod, newQuery, newOrderByExpr); - } - - protected override Expression VisitMember(MemberExpression node) - { - return _memberVisitor.Visit(node); - } - - private MethodInfo ChangeMethodArgTypeFormSourceToDest(MethodInfo mi) - { - if (!mi.IsGenericMethod) - return mi; - var genericMethod = mi.GetGenericMethodDefinition(); - var methodArgs = mi.GetGenericArguments(); - methodArgs = methodArgs.Select(t => t.ReplaceItemType(_sourceType, _destinationType)).ToArray(); - return genericMethod.MakeGenericMethod(methodArgs); - - } - - private Type ChangeLambdaArgTypeFormSourceToDest(Type lambdaType, Type returnType) - { - if (lambdaType.IsGenericType()) - { - var genArgs = lambdaType.GetTypeInfo().GenericTypeArguments; - var newGenArgs = genArgs.Select(t => t.ReplaceItemType(_sourceType, _destinationType)).ToArray(); - var genericTypeDef = lambdaType.GetGenericTypeDefinition(); - if (genericTypeDef.FullName.StartsWith("System.Func")) - { - newGenArgs[newGenArgs.Length - 1] = returnType; - } - return genericTypeDef.MakeGenericType(newGenArgs); - } - return lambdaType; - } - } -} +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class QueryMapperVisitor : ExpressionVisitor + { + private readonly IQueryable _destQuery; + private readonly ParameterExpression _instanceParameter; + private readonly Type _sourceType; + private readonly Type _destinationType; + private readonly Stack _tree = new Stack(); + private readonly Stack _newTree = new Stack(); + private readonly MemberAccessQueryMapperVisitor _memberVisitor; + + + internal QueryMapperVisitor(Type sourceType, Type destinationType, IQueryable destQuery, IConfigurationProvider config) + { + _sourceType = sourceType; + _destinationType = destinationType; + _destQuery = destQuery; + _instanceParameter = Expression.Parameter(destinationType, "dto"); + _memberVisitor = new MemberAccessQueryMapperVisitor(this, config); + } + + public static IQueryable Map(IQueryable sourceQuery, IQueryable destQuery, IConfigurationProvider config) + { + var visitor = new QueryMapperVisitor(typeof(TSource), typeof(TDestination), destQuery, config); + var expr = visitor.Visit(sourceQuery.Expression); + + var newDestQuery = destQuery.Provider.CreateQuery(expr); + return newDestQuery; + } + + public override Expression Visit(Expression node) + { + _tree.Push(node); + // OData Client DataServiceQuery initial expression node type + if (node != null && (int)node.NodeType == 10000) + { + return node; + } + var newNode = base.Visit(node); + _newTree.Push(newNode); + return newNode; + } + + protected override Expression VisitParameter(ParameterExpression node) => _instanceParameter; + + protected override Expression VisitConstant(ConstantExpression node) + { + // It is data source of queryable object instance + if (node.Value is IQueryable query && query.ElementType == _sourceType) + return _destQuery.Expression; + return node; + } + + protected override Expression VisitBinary(BinaryExpression node) + { + var left = Visit(node.Left); + var right = Visit(node.Right); + + // Convert Right expression value to left expr type + // It is needed when PropertyMap is changing type of property + if (left.Type != right.Type && right.NodeType == ExpressionType.Constant) + { + var value = Convert.ChangeType(((ConstantExpression)right).Value, left.Type, CultureInfo.CurrentCulture); + + right = Expression.Constant(value, left.Type); + } + + return Expression.MakeBinary(node.NodeType, left, right); + } + + protected override Expression VisitLambda(Expression node) + { + var newBody = Visit(node.Body); + var newParams = node.Parameters.Select(p => (ParameterExpression)Visit(p)); + + var delegateType = ChangeLambdaArgTypeFormSourceToDest(node.Type, newBody.Type); + + var newLambda = Expression.Lambda(delegateType, newBody, newParams); + return newLambda; + } + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if (node.Method.Name == "OrderBy" || node.Method.Name == "OrderByDescending" || + node.Method.Name == "ThenBy" || node.Method.Name == "ThenByDescending") + { + return VisitOrderBy(node); + } + + var args = node.Arguments.Select(Visit).ToList(); + var newObject = Visit(node.Object); + var method = ChangeMethodArgTypeFormSourceToDest(node.Method); + + var newMethodCall = Expression.Call(newObject, method, args); + return newMethodCall; + } + + private Expression VisitOrderBy(MethodCallExpression node) + { + var query = node.Arguments[0]; + var orderByExpr = node.Arguments[1]; + + var newQuery = Visit(query); + var newOrderByExpr = Visit(orderByExpr); + var newObject = Visit(node.Object); + + + + var genericMethod = node.Method.GetGenericMethodDefinition(); + var methodArgs = node.Method.GetGenericArguments(); + methodArgs[0] = methodArgs[0].ReplaceItemType(_sourceType, _destinationType); + + // for typical orderby expression, a unaryexpression is used that contains a + // func which in turn defines the type of the field that has to be used for ordering/sorting + if (newOrderByExpr is UnaryExpression unary && unary.Operand.Type.IsGenericType()) + { + methodArgs[1] = methodArgs[1].ReplaceItemType(typeof(string), unary.Operand.Type.GetGenericArguments().Last()); + } + else + { + methodArgs[1] = methodArgs[1].ReplaceItemType(typeof(string), typeof(int)); + } + var orderByMethod = genericMethod.MakeGenericMethod(methodArgs); + + return Expression.Call(newObject, orderByMethod, newQuery, newOrderByExpr); + } + + protected override Expression VisitMember(MemberExpression node) => _memberVisitor.Visit(node); + + private MethodInfo ChangeMethodArgTypeFormSourceToDest(MethodInfo mi) + { + if (!mi.IsGenericMethod) + return mi; + var genericMethod = mi.GetGenericMethodDefinition(); + var methodArgs = mi.GetGenericArguments(); + methodArgs = methodArgs.Select(t => t.ReplaceItemType(_sourceType, _destinationType)).ToArray(); + return genericMethod.MakeGenericMethod(methodArgs); + + } + + private Type ChangeLambdaArgTypeFormSourceToDest(Type lambdaType, Type returnType) + { + if (lambdaType.IsGenericType()) + { + var genArgs = lambdaType.GetTypeInfo().GenericTypeArguments; + var newGenArgs = genArgs.Select(t => t.ReplaceItemType(_sourceType, _destinationType)).ToArray(); + var genericTypeDef = lambdaType.GetGenericTypeDefinition(); + if (genericTypeDef.FullName.StartsWith("System.Func")) + { + newGenArgs[newGenArgs.Length - 1] = returnType; + } + return genericTypeDef.MakeGenericType(newGenArgs); + } + return lambdaType; + } + } +} diff --git a/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQuery.cs b/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQuery.cs deleted file mode 100644 index 916c83f6e5..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQuery.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - - public class SourceInjectedQuery : IOrderedQueryable - { - public SourceInjectedQuery(IQueryable dataSource, IQueryable destQuery, IMapper mapper, SourceInjectedQueryInspector inspector = null) - { - Expression = destQuery.Expression; - ElementType = typeof(TDestination); - Provider = new SourceInjectedQueryProvider(mapper, dataSource, destQuery) - { - Inspector = inspector ?? new SourceInjectedQueryInspector() - }; - } - - internal SourceInjectedQuery(IQueryProvider provider, Expression expression) - { - Provider = provider; - Expression = expression; - ElementType = typeof(TDestination); - } - - public IEnumerator GetEnumerator() - { - return Provider.Execute>(Expression).GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public Type ElementType { get; } - public Expression Expression { get; } - public IQueryProvider Provider { get; } - } - - -} diff --git a/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQueryInspector.cs b/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQueryInspector.cs deleted file mode 100644 index 5dc97bdc51..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQueryInspector.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Linq.Expressions; - - public class SourceInjectedQueryInspector - { - public SourceInjectedQueryInspector() - { - SourceResult = (e,o) => { }; - DestResult = o => { }; - StartQueryExecuteInterceptor = (t, e) => { }; - } - public Action SourceResult { get; set; } - public Action DestResult { get; set; } - public Action StartQueryExecuteInterceptor { get; set; } - - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQueryProvider.cs b/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQueryProvider.cs deleted file mode 100644 index a51ec13170..0000000000 --- a/src/AutoMapper/QueryableExtensions/Impl/SourceInjectedQueryProvider.cs +++ /dev/null @@ -1,97 +0,0 @@ -namespace AutoMapper.QueryableExtensions.Impl -{ - using System; - using System.Linq; - using System.Linq.Expressions; - using Configuration; - using Execution; - using Mappers; - - public class SourceInjectedQueryProvider : IQueryProvider - { - private readonly IMapper _mapper; - private readonly IQueryable _dataSource; - private readonly IQueryable _destQuery; - - public SourceInjectedQueryProvider(IMapper mapper, IQueryable dataSource, IQueryable destQuery) - { - _mapper = mapper; - _dataSource = dataSource; - _destQuery = destQuery; - } - - public SourceInjectedQueryInspector Inspector { get; set; } - - public IQueryable CreateQuery(Expression expression) - { - return new SourceInjectedQuery(this, expression); - } - - public IQueryable CreateQuery(Expression expression) - { - return new SourceInjectedQuery(this, expression); - } - - public object Execute(Expression expression) - { - Inspector.StartQueryExecuteInterceptor(null, expression); - - var sourceExpression = ConvertDestinationExpressionToSourceExpression(expression); - var sourceResult = InvokeSourceQuery(null, sourceExpression); - - Inspector.SourceResult(sourceExpression, sourceResult); - return sourceResult; - } - - public TResult Execute(Expression expression) - { - var resultType = typeof (TResult); - Inspector.StartQueryExecuteInterceptor(resultType, expression); - - var sourceExpression = ConvertDestinationExpressionToSourceExpression(expression); - - var destResultType = typeof(TResult); - var sourceResultType = CreateSourceResultType(destResultType); - - var sourceResult = InvokeSourceQuery(sourceResultType, sourceExpression); - - Inspector.SourceResult(sourceExpression, sourceResult); - - var destResult = IsProjection(resultType) - ? new ProjectionExpression(sourceResult as IQueryable, _mapper.ConfigurationProvider.ExpressionBuilder).To() - : _mapper.Map(sourceResult, sourceResultType, destResultType); - - Inspector.DestResult(sourceResult); - - return (TResult)destResult; - } - - private object InvokeSourceQuery(Type sourceResultType, Expression sourceExpression) - { - var result = IsProjection(sourceResultType) - ? _dataSource.Provider.CreateQuery(sourceExpression) - : _dataSource.Provider.Execute(sourceExpression); - return result; - } - - private static bool IsProjection(Type resultType) - { - return resultType.IsEnumerableType() && !resultType.IsQueryableType() && resultType != typeof(string) && resultType.GetGenericElementType() == typeof(T); - } - - private static Type CreateSourceResultType(Type destResultType) - { - var sourceResultType = destResultType.ReplaceItemType(typeof(TDestination), typeof(TSource)); - return sourceResultType; - } - - private Expression ConvertDestinationExpressionToSourceExpression(Expression expression) - { - var typeMap = _mapper.ConfigurationProvider.FindTypeMapFor(typeof (TDestination), typeof (TSource)); - var visitor = new ExpressionMapper.MappingVisitor(_mapper.ConfigurationProvider, typeMap, _destQuery.Expression, _dataSource.Expression, null, - new[] {typeof (TSource)}); - var sourceExpression = visitor.Visit(expression); - return sourceExpression; - } - } -} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/Impl/StringExpressionBinder.cs b/src/AutoMapper/QueryableExtensions/Impl/StringExpressionBinder.cs index 7ae8da50fa..bb73995632 100644 --- a/src/AutoMapper/QueryableExtensions/Impl/StringExpressionBinder.cs +++ b/src/AutoMapper/QueryableExtensions/Impl/StringExpressionBinder.cs @@ -1,24 +1,17 @@ -using System.Collections.Concurrent; - -namespace AutoMapper.QueryableExtensions.Impl -{ - using System.Linq.Expressions; - - public class StringExpressionBinder : IExpressionBinder - { - public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) - { - return propertyMap.DestinationPropertyType == typeof(string); - } - - public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary typePairCount) - { - return BindStringExpression(propertyMap, result); - } - - private static MemberAssignment BindStringExpression(PropertyMap propertyMap, ExpressionResolutionResult result) - { - return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, Expression.Call(result.ResolutionExpression, "ToString", null, null)); - } - } +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace AutoMapper.QueryableExtensions.Impl +{ + public class StringExpressionBinder : IExpressionBinder + { + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) + => propertyMap.DestinationType == typeof(string); + + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) + => BindStringExpression(propertyMap, result); + + private static MemberAssignment BindStringExpression(PropertyMap propertyMap, ExpressionResolutionResult result) + => Expression.Bind(propertyMap.DestinationMember, Expression.Call(result.ResolutionExpression, "ToString", null, null)); + } } \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/NullsafeQueryRewriter.cs b/src/AutoMapper/QueryableExtensions/NullsafeQueryRewriter.cs new file mode 100644 index 0000000000..87b99dafa7 --- /dev/null +++ b/src/AutoMapper/QueryableExtensions/NullsafeQueryRewriter.cs @@ -0,0 +1,163 @@ +/* +The MIT License (MIT) + +Copyright (c) 2014-2018 Axel Heer + +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. +*/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace AutoMapper.QueryableExtensions +{ + /// + /// Expression visitor for making member access null-safe. + /// + /// + /// NullSafeQueryRewriter is copied from the NeinLinq project, licensed under the MIT license. + /// Copyright (c) 2014-2018 Axel Heer. + /// See https://github.com/axelheer/nein-linq/blob/master/src/NeinLinq/NullsafeQueryRewriter.cs + /// + internal class NullsafeQueryRewriter : ExpressionVisitor + { + static readonly LockingConcurrentDictionary Cache = new LockingConcurrentDictionary(Fallback); + + /// + protected override Expression VisitMember(MemberExpression node) + { + if (node == null) + throw new ArgumentNullException(nameof(node)); + + var target = Visit(node.Expression); + + if (!IsSafe(target)) + { + // insert null-check before accessing property or field + return BeSafe(target, node, node.Update); + } + + return node.Update(target); + } + + /// + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if (node == null) + throw new ArgumentNullException(nameof(node)); + + var target = Visit(node.Object); + + if (!IsSafe(target)) + { + // insert null-check before invoking instance method + return BeSafe(target, node, fallback => node.Update(fallback, node.Arguments)); + } + + var arguments = Visit(node.Arguments); + + if (IsExtensionMethod(node.Method) && !IsSafe(arguments[0])) + { + // insert null-check before invoking extension method + return BeSafe(arguments[0], node.Update(null, arguments), fallback => + { + var args = new Expression[arguments.Count]; + arguments.CopyTo(args, 0); + args[0] = fallback; + + return node.Update(null, args); + }); + } + + return node.Update(target, arguments); + } + + static Expression BeSafe(Expression target, Expression expression, Func update) + { + var fallback = Cache.GetOrAdd(target.Type); + + if (fallback != null) + { + // coalesce instead, a bit intrusive but fast... + return update(Expression.Coalesce(target, fallback)); + } + + // target can be null, which is why we are actually here... + var targetFallback = Expression.Constant(null, target.Type); + + // expression can be default or null, which is basically the same... + var expressionFallback = !IsNullableOrReferenceType(expression.Type) + ? (Expression)Expression.Default(expression.Type) : Expression.Constant(null, expression.Type); + + return Expression.Condition(Expression.Equal(target, targetFallback), expressionFallback, expression); + } + + static bool IsSafe(Expression expression) + { + // in method call results and constant values we trust to avoid too much conditions... + return expression == null + || expression.NodeType == ExpressionType.Call + || expression.NodeType == ExpressionType.Constant + || !IsNullableOrReferenceType(expression.Type); + } + + static Expression Fallback(Type type) + { + // default values for generic collections + if (type.GetIsConstructedGenericType() && type.GetTypeInfo().GenericTypeArguments.Length == 1) + { + return CollectionFallback(typeof(List<>), type) + ?? CollectionFallback(typeof(HashSet<>), type); + } + + // default value for arrays + if (type.IsArray) + { + return Expression.NewArrayInit(type.GetElementType()); + } + + return null; + } + + static Expression CollectionFallback(Type definition, Type type) + { + var collection = definition.MakeGenericType(type.GetTypeInfo().GenericTypeArguments); + + // try if an instance of this collection would suffice + if (type.GetTypeInfo().IsAssignableFrom(collection.GetTypeInfo())) + { + return Expression.Convert(Expression.New(collection), type); + } + + return null; + } + + static bool IsExtensionMethod(MethodInfo element) + { + return element.IsDefined(typeof(ExtensionAttribute), false); + } + + static bool IsNullableOrReferenceType(Type type) + { + return !type.GetTypeInfo().IsValueType || Nullable.GetUnderlyingType(type) != null; + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/QueryableExtensions/ProjectionExpression.cs b/src/AutoMapper/QueryableExtensions/ProjectionExpression.cs index 624230e5c9..44b9ba4e3e 100644 --- a/src/AutoMapper/QueryableExtensions/ProjectionExpression.cs +++ b/src/AutoMapper/QueryableExtensions/ProjectionExpression.cs @@ -1,132 +1,53 @@ -using System; -using IObjectDictionary = System.Collections.Generic.IDictionary; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Collections.Generic; - -namespace AutoMapper.QueryableExtensions -{ - using Execution; - using MemberPaths = IEnumerable>; - - public class ProjectionExpression : IProjectionExpression - { - private static readonly MethodInfo QueryableSelectMethod = FindQueryableSelectMethod(); - - private readonly IQueryable _source; - private readonly IExpressionBuilder _builder; - - public ProjectionExpression(IQueryable source, IExpressionBuilder builder) - { - _source = source; - _builder = builder; - } - - private static MethodInfo FindQueryableSelectMethod() - { - Expression>> select = () => Queryable.Select(default(IQueryable), default(Expression>)); - MethodInfo method = ((MethodCallExpression)select.Body).Method.GetGenericMethodDefinition(); - return method; - } - - public IQueryable To(object parameters = null) - { - return To(parameters, new string[0]); - } - - public IQueryable To(object parameters = null, params string[] membersToExpand) - { - var paramValues = GetParameters(parameters); - return To(paramValues, membersToExpand); - } - - private static IObjectDictionary GetParameters(object parameters) - { - return (parameters ?? new object()).GetType() - .GetDeclaredProperties() - .ToDictionary(pi => pi.Name, pi => pi.GetValue(parameters, null)); - } - - public IQueryable To(IObjectDictionary parameters) - { - return To(parameters, new string[0]); - } - - public IQueryable To(IObjectDictionary parameters, params string[] membersToExpand) - { - var members = GetMemberPaths(typeof(TResult), membersToExpand); - return To(parameters, members); - } - - public IQueryable To(object parameters = null, params Expression>[] membersToExpand) - { - return To(GetParameters(parameters), GetMemberPaths(membersToExpand)); - } - - private MemberPaths GetMemberPaths(Type type, string[] membersToExpand) - { - return membersToExpand.Select(m=>ReflectionHelper.GetMemberPath(type, m)); - } - - private MemberPaths GetMemberPaths(Expression>[] membersToExpand) - { - return membersToExpand.Select(expr => - { - var visitor = new MemberVisitor(); - visitor.Visit(expr); - return visitor.MemberPath; - }); - } - - public IQueryable To(IObjectDictionary parameters, params Expression>[] membersToExpand) - { - var members = GetMemberPaths(membersToExpand); - return To(parameters, members); - } - - private IQueryable To(IObjectDictionary parameters, MemberPaths memberPathsToExpand) - { - var membersToExpand = memberPathsToExpand.SelectMany(m => m).Distinct().ToArray(); - - var mapExpression = _builder.CreateMapExpression(_source.ElementType, typeof(TResult), parameters, membersToExpand); - - return _source.Provider.CreateQuery( - Expression.Call( - null, - QueryableSelectMethod.MakeGenericMethod(_source.ElementType, typeof(TResult)), - new[] { _source.Expression, Expression.Quote(mapExpression) } - ) - ); - } - - private class MemberVisitor : ExpressionVisitor - { - protected override Expression VisitLambda(Expression node) - { - var memberExpression = node.Body as MemberExpression; - if(memberExpression != null) - { - if(MemberPath != null) - { - throw new InvalidOperationException("There are more than one lambda member expressions."); - } - MemberPath = GetMemberPath(memberExpression); - } - return base.VisitLambda(node); - } - - private IEnumerable GetMemberPath(MemberExpression memberExpression) - { - var expression = memberExpression; - while(expression != null) - { - yield return expression.Member; - expression = expression.Expression as MemberExpression; - } - } - - public IEnumerable MemberPath { get; private set; } - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; + +namespace AutoMapper.QueryableExtensions +{ + using MemberPaths = IEnumerable>; + using ParameterBag = IDictionary; + + public class ProjectionExpression + { + private static readonly MethodInfo QueryableSelectMethod = FindQueryableSelectMethod(); + + private readonly IQueryable _source; + private readonly IExpressionBuilder _builder; + + public ProjectionExpression(IQueryable source, IExpressionBuilder builder) + { + _source = source; + _builder = builder; + } + + public IQueryable To(ParameterBag parameters, string[] membersToExpand) => + ToCore(parameters, membersToExpand.Select(memberName => ReflectionHelper.GetMemberPath(typeof(TResult), memberName))); + + public IQueryable To(object parameters, Expression>[] membersToExpand) => + ToCore(parameters, membersToExpand.Select(MemberVisitor.GetMemberPath)); + + private IQueryable ToCore(object parameters, MemberPaths memberPathsToExpand) + { + var members = memberPathsToExpand.SelectMany(m => m).Distinct().ToArray(); + return (IQueryable)_builder.GetMapExpression(_source.ElementType, typeof(TResult), parameters, members).Aggregate(_source, Select); + } + + private static IQueryable Select(IQueryable source, LambdaExpression lambda) => source.Provider.CreateQuery( + Expression.Call( + null, + QueryableSelectMethod.MakeGenericMethod(source.ElementType, lambda.ReturnType), + new[] { source.Expression, Expression.Quote(lambda) } + ) + ); + + private static MethodInfo FindQueryableSelectMethod() + { + Expression>> select = () => default(IQueryable).Select(default(Expression>)); + var method = ((MethodCallExpression)select.Body).Method.GetGenericMethodDefinition(); + return method; + } + } } \ No newline at end of file diff --git a/src/AutoMapper/ReflectionExtensions.cs b/src/AutoMapper/ReflectionExtensions.cs new file mode 100644 index 0000000000..ea5c8a96bb --- /dev/null +++ b/src/AutoMapper/ReflectionExtensions.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Internal; + +namespace AutoMapper +{ + internal static class ReflectionExtensions + { + public static object GetDefaultValue(this ParameterInfo parameter) + => ReflectionHelper.GetDefaultValue(parameter); + + public static object MapMember(this ResolutionContext context, MemberInfo member, object value, object destination = null) + => ReflectionHelper.MapMember(context, member, value, destination); + + public static bool IsDynamic(this object obj) + => ReflectionHelper.IsDynamic(obj); + + public static bool IsDynamic(this Type type) + => ReflectionHelper.IsDynamic(type); + + public static void SetMemberValue(this MemberInfo propertyOrField, object target, object value) + => ReflectionHelper.SetMemberValue(propertyOrField, target, value); + + public static object GetMemberValue(this MemberInfo propertyOrField, object target) + => ReflectionHelper.GetMemberValue(propertyOrField, target); + + public static IEnumerable GetMemberPath(Type type, string fullMemberName) + => ReflectionHelper.GetMemberPath(type, fullMemberName); + + public static MemberInfo GetFieldOrProperty(this LambdaExpression expression) + => ReflectionHelper.GetFieldOrProperty(expression); + + public static MemberInfo FindProperty(LambdaExpression lambdaExpression) + => ReflectionHelper.FindProperty(lambdaExpression); + + public static Type GetMemberType(this MemberInfo memberInfo) + => ReflectionHelper.GetMemberType(memberInfo); + + /// + /// if targetType is oldType, method will return newType + /// if targetType is not oldType, method will return targetType + /// if targetType is generic type with oldType arguments, method will replace all oldType arguments on newType + /// + /// + /// + /// + /// + public static Type ReplaceItemType(this Type targetType, Type oldType, Type newType) + => ReflectionHelper.ReplaceItemType(targetType, oldType, newType); + + public static IEnumerable GetDefinedTypes(this Assembly assembly) => + assembly.DefinedTypes; + + public static bool GetIsConstructedGenericType(this Type type) => + type.IsConstructedGenericType; + } +} diff --git a/src/AutoMapper/ResolutionContext.cs b/src/AutoMapper/ResolutionContext.cs index 5286caadd7..41ed15f7c1 100644 --- a/src/AutoMapper/ResolutionContext.cs +++ b/src/AutoMapper/ResolutionContext.cs @@ -1,173 +1,232 @@ -namespace AutoMapper -{ - using System; - using System.Linq; - using System.Collections.Generic; - using Configuration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper.Execution; + +namespace AutoMapper +{ + /// + /// Context information regarding resolution of a destination value + /// + public class ResolutionContext : IRuntimeMapper + { + private Dictionary _instanceCache; + private Dictionary _typeDepth; + private readonly IRuntimeMapper _inner; + + public ResolutionContext(IMappingOperationOptions options, IRuntimeMapper mapper) + { + Options = options; + _inner = mapper; + } + + /// + /// Mapping operation options + /// + public IMappingOperationOptions Options { get; } + + /// + /// Context items from + /// + public IDictionary Items => Options.Items; + + /// + /// Current mapper + /// + public IRuntimeMapper Mapper => this; + + public IConfigurationProvider ConfigurationProvider => _inner.ConfigurationProvider; + + Func IMapper.ServiceCtor => _inner.ServiceCtor; + + ResolutionContext IRuntimeMapper.DefaultContext => _inner.DefaultContext; + + /// + /// Instance cache for resolving circular references + /// + public Dictionary InstanceCache + { + get + { + CheckDefault(); + if(_instanceCache != null) + { + return _instanceCache; + } + _instanceCache = new Dictionary(); + return _instanceCache; + } + } + + /// + /// Instance cache for resolving keeping track of depth + /// + private Dictionary TypeDepth + { + get + { + CheckDefault(); + if(_typeDepth != null) + { + return _typeDepth; + } + _typeDepth = new Dictionary(); + return _typeDepth; + } + } + + TDestination IMapper.Map(object source) + => (TDestination)_inner.Map(source, null, source.GetType(), typeof(TDestination), this); + + TDestination IMapper.Map(object source, Action opts) + { + opts(Options); + + return ((IMapper)this).Map(source); + } + + TDestination IMapper.Map(TSource source) + => _inner.Map(source, default(TDestination), this); + + TDestination IMapper.Map(TSource source, Action> opts) + { + var typedOptions = new MappingOperationOptions(_inner.ServiceCtor); + + opts(typedOptions); + + var destination = default(TDestination); + + typedOptions.BeforeMapAction(source, destination); + + destination = _inner.Map(source, destination, this); + + typedOptions.AfterMapAction(source, destination); + + return destination; + } + + TDestination IMapper.Map(TSource source, TDestination destination) + => _inner.Map(source, destination, this); + + TDestination IMapper.Map(TSource source, TDestination destination, Action> opts) + { + var typedOptions = new MappingOperationOptions(_inner.ServiceCtor); + + opts(typedOptions); + + typedOptions.BeforeMapAction(source, destination); + + destination = _inner.Map(source, destination, this); + + typedOptions.AfterMapAction(source, destination); + + return destination; + } + + object IMapper.Map(object source, Type sourceType, Type destinationType) + => _inner.Map(source, null, sourceType, destinationType, this); + + object IMapper.Map(object source, Type sourceType, Type destinationType, Action opts) + { + opts(Options); + + return ((IMapper)this).Map(source, sourceType, destinationType); + } + + object IMapper.Map(object source, object destination, Type sourceType, Type destinationType) + => _inner.Map(source, destination, sourceType, destinationType, this); + + object IMapper.Map(object source, object destination, Type sourceType, Type destinationType, Action opts) + { + opts(Options); + + return ((IMapper)this).Map(source, destination, sourceType, destinationType); + } + + object IRuntimeMapper.Map(object source, object destination, Type sourceType, Type destinationType, ResolutionContext context, + IMemberMap memberMap) + => _inner.Map(source, destination, sourceType, destinationType, context, memberMap); + + TDestination IRuntimeMapper.Map(TSource source, TDestination destination, ResolutionContext context, + IMemberMap memberMap) + => _inner.Map(source, destination, context, memberMap); + + IQueryable IMapper.ProjectTo(IQueryable source, object parameters, params Expression>[] membersToExpand) + => _inner.ProjectTo(source, parameters, membersToExpand); + + IQueryable IMapper.ProjectTo(IQueryable source, IDictionary parameters, params string[] membersToExpand) + => _inner.ProjectTo(source, parameters, membersToExpand); + + internal object GetDestination(object source, Type destinationType) + { + InstanceCache.TryGetValue(new ContextCacheKey(source, destinationType), out object destination); + return destination; + } + + internal void CacheDestination(object source, Type destinationType, object destination) + { + InstanceCache[new ContextCacheKey(source, destinationType)] = destination; + } + + internal void IncrementTypeDepth(TypePair types) + { + TypeDepth[types]++; + } + + internal void DecrementTypeDepth(TypePair types) + { + TypeDepth[types]--; + } + + internal int GetTypeDepth(TypePair types) + { + if (!TypeDepth.ContainsKey(types)) + TypeDepth[types] = 1; + + return TypeDepth[types]; + } + + internal void ValidateMap(TypeMap typeMap) + => ConfigurationProvider.AssertConfigurationIsValid(typeMap); + + internal bool IsDefault => this == _inner.DefaultContext; + + internal TDestination Map(TSource source, TDestination destination, IMemberMap memberMap) + => _inner.Map(source, destination, this, memberMap); + + internal object Map(object source, object destination, Type sourceType, Type destinationType, IMemberMap memberMap) + => _inner.Map(source, destination, sourceType, destinationType, this, memberMap); + + private void CheckDefault() + { + if (IsDefault) + { + throw new InvalidOperationException(); + } + } + } - /// - /// Context information regarding resolution of a destination value - /// - public class ResolutionContext + public struct ContextCacheKey : IEquatable { - private Dictionary _instanceCache; - - /// - /// Mapping operation options - /// - public MappingOperationOptions Options { get; } - - /// - /// Current source type - /// - public Type SourceType => Types.SourceType; - - /// - /// Current attempted destination type - /// - public Type DestinationType => Types.DestinationType; - - /// - /// Source value - /// - public object SourceValue { get; private set; } - - /// - /// Destination value - /// - public object DestinationValue { get; private set; } + public static bool operator ==(ContextCacheKey left, ContextCacheKey right) => left.Equals(right); + public static bool operator !=(ContextCacheKey left, ContextCacheKey right) => !left.Equals(right); - /// - /// Parent resolution context - /// - public ResolutionContext Parent { get; } + private readonly object _source; + private readonly Type _destinationType; - /// - /// Instance cache for resolving circular references - /// - public Dictionary InstanceCache + public ContextCacheKey(object source, Type destinationType) { - get - { - if (_instanceCache != null) - { - return _instanceCache; - } - _instanceCache = new Dictionary(); - return _instanceCache; - } + _source = source; + _destinationType = destinationType; } - /// - /// Current mapper - /// - public IRuntimeMapper Mapper { get; } + public override int GetHashCode() => HashCodeCombiner.Combine(_source, _destinationType); - /// - /// Current configuration - /// - public IConfigurationProvider ConfigurationProvider => Mapper.ConfigurationProvider; + public bool Equals(ContextCacheKey other) => + _source == other._source && _destinationType == other._destinationType; - /// - /// Current type map - /// - public TypeMap TypeMap { get; set; } - - /// - /// Source and destination type pair - /// - public TypePair Types { get; private set; } - - public bool IsSourceValueNull => Equals(null, SourceValue); - - /// - /// Context items from - /// - public IDictionary Items => Options.Items; - - public ResolutionContext(object source, object destination, TypePair types, ResolutionContext parent) : this(parent) - { - SourceValue = source; - DestinationValue = destination; - Types = types; - } - - public ResolutionContext(object source, object destination, TypePair types, MappingOperationOptions options, IRuntimeMapper mapper) - { - SourceValue = source; - DestinationValue = destination; - Options = options; - Mapper = mapper; - Types = types; - } - - internal ResolutionContext(ResolutionContext parent) - { - Parent = parent; - Options = parent.Options; - Mapper = parent.Mapper; - _instanceCache = parent.InstanceCache; - } - - public override string ToString() => $"Trying to map {SourceType.Name} to {DestinationType.Name}."; - - public TypeMap GetContextTypeMap() - { - TypeMap typeMap = TypeMap; - ResolutionContext parent = Parent; - while ((typeMap == null) && (parent != null)) - { - typeMap = parent.TypeMap; - parent = parent.Parent; - } - return typeMap; - } - - public ResolutionContext[] GetContexts() - { - return GetContextsCore().Reverse().Distinct().ToArray(); - } - - protected IEnumerable GetContextsCore() - { - var context = this; - while (context.Parent != null) - { - yield return context; - context = context.Parent; - } - yield return context; - } - - public void BeforeMap(object destination) - { - if (Parent == null) - { - Options.BeforeMapAction(SourceValue, destination); - } - } - - public void AfterMap(object destination) - { - if (Parent == null) - { - Options.AfterMapAction(SourceValue, destination); - } - } - - internal object Map(object source, object destination, Type sourceType, Type destinationType) - { - var typeMap = ConfigurationProvider.ResolveTypeMap(source, destination, sourceType, destinationType); - Fill(source, destination, sourceType, destinationType, typeMap); - return Mapper.Map(this); - } - - private void Fill(object source, object destination, Type sourceType, Type destinationType, TypeMap typeMap) - { - Types = new TypePair(sourceType ?? typeMap?.SourceType ?? Parent.SourceType, destinationType ?? typeMap?.DestinationType ?? Parent.DestinationType); - SourceValue = source; - DestinationValue = destination; - TypeMap = typeMap; - } - } + public override bool Equals(object other) => + other is ContextCacheKey && Equals((ContextCacheKey)other); + } } \ No newline at end of file diff --git a/src/AutoMapper/TypeDetails.cs b/src/AutoMapper/TypeDetails.cs index e3c5725624..68aff98d5f 100644 --- a/src/AutoMapper/TypeDetails.cs +++ b/src/AutoMapper/TypeDetails.cs @@ -1,194 +1,223 @@ -namespace AutoMapper -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - using System.Reflection; - using Configuration; - - /// - /// Contains cached reflection information for easy retrieval - /// - [DebuggerDisplay("{Type}")] - public class TypeDetails - { - - public TypeDetails(Type type) - : this(type, _ => true, _ => true, new MethodInfo[0]) - { - } - public TypeDetails(Type type, Func shouldMapProperty, Func shouldMapField) - : this(type, shouldMapProperty, shouldMapField, new MethodInfo[0]) - { - } - public TypeDetails(Type type, IProfileConfiguration config) - : this(type, config.ShouldMapProperty, config.ShouldMapField, config.SourceExtensionMethods) - { - } - - public TypeDetails(Type type, Func shouldMapProperty, Func shouldMapField, IEnumerable sourceExtensionMethodSearch) - { - Type = type; - var membersToMap = MembersToMap(shouldMapProperty, shouldMapField); - var publicReadableMembers = GetAllPublicReadableMembers(membersToMap); - var publicWritableMembers = GetAllPublicWritableMembers(membersToMap); - PublicReadAccessors = BuildPublicReadAccessors(publicReadableMembers); - PublicWriteAccessors = BuildPublicAccessors(publicWritableMembers); - PublicNoArgMethods = BuildPublicNoArgMethods(); - Constructors = type.GetDeclaredConstructors().Where(ci => !ci.IsStatic).ToArray(); - PublicNoArgExtensionMethods = BuildPublicNoArgExtensionMethods(sourceExtensionMethodSearch); - } - - private Func MembersToMap(Func shouldMapProperty, Func shouldMapField) - { - return m => - { - var property = m as PropertyInfo; - if(property != null) - { - return !property.IsStatic() && shouldMapProperty(property); - } - var field = (FieldInfo)m; - return !field.IsStatic && shouldMapField(field); - }; - } - - public Type Type { get; } - - public IEnumerable Constructors { get; } - - public IEnumerable PublicReadAccessors { get; } - - public IEnumerable PublicWriteAccessors { get; } - - public IEnumerable PublicNoArgMethods { get; } - - public IEnumerable PublicNoArgExtensionMethods { get; } - - private IList BuildPublicNoArgExtensionMethods(IEnumerable sourceExtensionMethodSearch) - { - var sourceExtensionMethodSearchArray = sourceExtensionMethodSearch.ToArray(); - - var explicitExtensionMethods = sourceExtensionMethodSearchArray - .Where(method => method.GetParameters()[0].ParameterType == Type) - .ToList(); - - var genericInterfaces = Type.GetTypeInfo().ImplementedInterfaces.Where(t => t.IsGenericType()).ToList(); - - if (Type.IsInterface() && Type.IsGenericType()) - genericInterfaces.Add(Type); - - explicitExtensionMethods.AddRange( - from genericMethod in sourceExtensionMethodSearchArray - where genericMethod.IsGenericMethodDefinition - from genericInterface in genericInterfaces - let genericInterfaceArguments = genericInterface.GetTypeInfo().GenericTypeArguments - where genericMethod.GetGenericArguments().Length == genericInterfaceArguments.Length - let methodMatch = genericMethod.MakeGenericMethod(genericInterfaceArguments) - where methodMatch.GetParameters()[0].ParameterType.GetTypeInfo().IsAssignableFrom(genericInterface.GetTypeInfo()) - select methodMatch); - - return explicitExtensionMethods; - } - - private static MemberInfo[] BuildPublicReadAccessors(IEnumerable allMembers) - { - // Multiple types may define the same property (e.g. the class and multiple interfaces) - filter this to one of those properties - var filteredMembers = allMembers - .OfType() - .GroupBy(x => x.Name) // group properties of the same name together - .Select(x => x.First()) - .OfType() // cast back to MemberInfo so we can add back FieldInfo objects - .Concat(allMembers.Where(x => x is FieldInfo)); // add FieldInfo objects back - - return filteredMembers.ToArray(); - } - - private static MemberInfo[] BuildPublicAccessors(IEnumerable allMembers) - { - // Multiple types may define the same property (e.g. the class and multiple interfaces) - filter this to one of those properties - var filteredMembers = allMembers - .OfType() - .GroupBy(x => x.Name) // group properties of the same name together - .Select(x => - x.Any(y => y.CanWrite && y.CanRead) - ? // favor the first property that can both read & write - otherwise pick the first one - x.First(y => y.CanWrite && y.CanRead) - : x.First()) - .Where(pi => pi.CanWrite || pi.PropertyType.IsListOrDictionaryType()) - .OfType() // cast back to MemberInfo so we can add back FieldInfo objects - .Concat(allMembers.Where(x => x is FieldInfo)); // add FieldInfo objects back - - return filteredMembers.ToArray(); - } - - private IEnumerable GetAllPublicReadableMembers(Func membersToMap) - { - return GetAllPublicMembers(PropertyReadable, FieldReadable, membersToMap); - } - - private IEnumerable GetAllPublicWritableMembers(Func membersToMap) - { - return GetAllPublicMembers(PropertyWritable, FieldWritable, membersToMap); - } - - private static bool PropertyReadable(PropertyInfo propertyInfo) - { - return propertyInfo.CanRead; - } - - private bool FieldReadable(FieldInfo fieldInfo) - { - return true; - } - - private static bool PropertyWritable(PropertyInfo propertyInfo) - { - bool propertyIsEnumerable = (typeof (string) != propertyInfo.PropertyType) - && typeof (IEnumerable).GetTypeInfo().IsAssignableFrom(propertyInfo.PropertyType.GetTypeInfo()); - - return propertyInfo.CanWrite || propertyIsEnumerable; - } - - private bool FieldWritable(FieldInfo fieldInfo) - { - return !fieldInfo.IsInitOnly; - } - - private IEnumerable GetAllPublicMembers( - Func propertyAvailableFor, - Func fieldAvailableFor, - Func memberAvailableFor) - { - var typesToScan = new List(); - for (var t = Type; t != null; t = t.BaseType()) - typesToScan.Add(t); - - if (Type.IsInterface()) - typesToScan.AddRange(Type.GetTypeInfo().ImplementedInterfaces); - - // Scan all types for public properties and fields - return typesToScan - .Where(x => x != null) // filter out null types (e.g. type.BaseType == null) - .SelectMany(x => x.GetDeclaredMembers() - .Where(mi => mi.DeclaringType != null && mi.DeclaringType == x) - .Where( - m => - (m is FieldInfo && fieldAvailableFor((FieldInfo) m)) || - (m is PropertyInfo && propertyAvailableFor((PropertyInfo) m) && - !((PropertyInfo) m).GetIndexParameters().Any())) - .Where(memberAvailableFor) - ); - } - - private MethodInfo[] BuildPublicNoArgMethods() - { - return Type.GetAllMethods() - .Where(mi => mi.IsPublic && !mi.IsStatic && mi.DeclaringType != typeof(object)) - .Where(m => (m.ReturnType != typeof (void)) && (m.GetParameters().Length == 0)) - .ToArray(); - } - } -} +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using AutoMapper.Configuration; + +namespace AutoMapper +{ + /// + /// Contains cached reflection information for easy retrieval + /// + [DebuggerDisplay("{Type}")] + public class TypeDetails + { + public TypeDetails(Type type, ProfileMap config) + { + Type = type; + var membersToMap = MembersToMap(config.ShouldMapProperty, config.ShouldMapField); + var publicReadableMembers = GetAllPublicReadableMembers(membersToMap); + var publicWritableMembers = GetAllPublicWritableMembers(membersToMap); + PublicReadAccessors = BuildPublicReadAccessors(publicReadableMembers); + PublicWriteAccessors = BuildPublicAccessors(publicWritableMembers); + PublicNoArgMethods = BuildPublicNoArgMethods(config.ShouldMapMethod); + Constructors = GetAllConstructors(config.ShouldUseConstructor); + PublicNoArgExtensionMethods = BuildPublicNoArgExtensionMethods(config.SourceExtensionMethods.Where(config.ShouldMapMethod)); + AllMembers = PublicReadAccessors.Concat(PublicNoArgMethods).Concat(PublicNoArgExtensionMethods).ToList(); + DestinationMemberNames = AllMembers.Select(mi => new DestinationMemberName { Member = mi, Possibles = PossibleNames(mi.Name, config.Prefixes, config.Postfixes).ToArray() }); + } + + private IEnumerable PossibleNames(string memberName, IEnumerable prefixes, IEnumerable postfixes) + { + yield return memberName; + + if (!postfixes.Any()) + { + foreach (var withoutPrefix in prefixes.Where(prefix => memberName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).Select(prefix => memberName.Substring(prefix.Length))) + { + yield return withoutPrefix; + } + yield break; + } + + foreach (var withoutPrefix in prefixes.Where(prefix => memberName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).Select(prefix => memberName.Substring(prefix.Length))) + { + yield return withoutPrefix; + foreach (var s in PostFixes(postfixes, withoutPrefix)) + yield return s; + } + foreach (var s in PostFixes(postfixes, memberName)) + yield return s; + } + + private static IEnumerable PostFixes(IEnumerable postfixes, string name) + { + return + postfixes.Where(postfix => name.EndsWith(postfix, StringComparison.OrdinalIgnoreCase)) + .Select(postfix => name.Remove(name.Length - postfix.Length)); + } + + private static Func MembersToMap( + Func shouldMapProperty, + Func shouldMapField) + { + return m => + { + switch (m) + { + case PropertyInfo property: + return !property.IsStatic() && shouldMapProperty(property); + case FieldInfo field: + return !field.IsStatic && shouldMapField(field); + default: + throw new ArgumentException("Should be a field or a property."); + } + }; + } + + public struct DestinationMemberName + { + public MemberInfo Member { get; set; } + public string[] Possibles { get; set; } + } + + public Type Type { get; } + + public IEnumerable Constructors { get; } + + public IEnumerable PublicReadAccessors { get; } + + public IEnumerable PublicWriteAccessors { get; } + + public IEnumerable PublicNoArgMethods { get; } + + public IEnumerable PublicNoArgExtensionMethods { get; } + + public IEnumerable AllMembers { get; } + + public IEnumerable DestinationMemberNames { get; set; } + + private IEnumerable BuildPublicNoArgExtensionMethods(IEnumerable sourceExtensionMethodSearch) + { + var explicitExtensionMethods = sourceExtensionMethodSearch.Where(method => method.GetParameters()[0].ParameterType == Type); + + var genericInterfaces = Type.GetTypeInfo().ImplementedInterfaces.Where(t => t.IsGenericType()); + + if (Type.IsInterface() && Type.IsGenericType()) + { + genericInterfaces = genericInterfaces.Union(new[] { Type }); + } + + return explicitExtensionMethods.Union + ( + from genericInterface in genericInterfaces + let genericInterfaceArguments = genericInterface.GetTypeInfo().GenericTypeArguments + let matchedMethods = ( + from extensionMethod in sourceExtensionMethodSearch + where !extensionMethod.IsGenericMethodDefinition + select extensionMethod + ).Concat( + from extensionMethod in sourceExtensionMethodSearch + where extensionMethod.IsGenericMethodDefinition + && extensionMethod.GetGenericArguments().Length == genericInterfaceArguments.Length + select extensionMethod.MakeGenericMethod(genericInterfaceArguments) + ) + from methodMatch in matchedMethods + where methodMatch.GetParameters()[0].ParameterType.GetTypeInfo().IsAssignableFrom(genericInterface.GetTypeInfo()) + select methodMatch + ).ToArray(); + } + + private static MemberInfo[] BuildPublicReadAccessors(IEnumerable allMembers) + { + // Multiple types may define the same property (e.g. the class and multiple interfaces) - filter this to one of those properties + var filteredMembers = allMembers + .OfType() + .GroupBy(x => x.Name) // group properties of the same name together + .Select(x => x.First()) + .Concat(allMembers.Where(x => x is FieldInfo)); // add FieldInfo objects back + + return filteredMembers.ToArray(); + } + + private static MemberInfo[] BuildPublicAccessors(IEnumerable allMembers) + { + // Multiple types may define the same property (e.g. the class and multiple interfaces) - filter this to one of those properties + var filteredMembers = allMembers + .OfType() + .GroupBy(x => x.Name) // group properties of the same name together + .Select(x => + x.Any(y => y.CanWrite && y.CanRead) + ? // favor the first property that can both read & write - otherwise pick the first one + x.First(y => y.CanWrite && y.CanRead) + : x.First()) + .Where(pi => pi.CanWrite || pi.PropertyType.IsListOrDictionaryType()) + //.OfType() // cast back to MemberInfo so we can add back FieldInfo objects + .Concat(allMembers.Where(x => x is FieldInfo)); // add FieldInfo objects back + + return filteredMembers.ToArray(); + } + + private IEnumerable GetAllPublicReadableMembers(Func membersToMap) + => GetAllPublicMembers(PropertyReadable, FieldReadable, membersToMap); + + private IEnumerable GetAllPublicWritableMembers(Func membersToMap) + => GetAllPublicMembers(PropertyWritable, FieldWritable, membersToMap); + + private IEnumerable GetAllConstructors(Func shouldUseConstructor) + { + return Type.GetDeclaredConstructors().Where(shouldUseConstructor).ToArray(); + } + + private static bool PropertyReadable(PropertyInfo propertyInfo) => propertyInfo.CanRead; + + private static bool FieldReadable(FieldInfo fieldInfo) => true; + + private static bool PropertyWritable(PropertyInfo propertyInfo) + { + var propertyIsEnumerable = (typeof(string) != propertyInfo.PropertyType) + && typeof(IEnumerable).GetTypeInfo().IsAssignableFrom(propertyInfo.PropertyType.GetTypeInfo()); + + return propertyInfo.CanWrite || propertyIsEnumerable; + } + + private static bool FieldWritable(FieldInfo fieldInfo) => !fieldInfo.IsInitOnly; + + private IEnumerable GetAllPublicMembers( + Func propertyAvailableFor, + Func fieldAvailableFor, + Func memberAvailableFor) + { + var typesToScan = new List(); + for (var t = Type; t != null; t = t.BaseType()) + typesToScan.Add(t); + + if (Type.IsInterface()) + typesToScan.AddRange(Type.GetTypeInfo().ImplementedInterfaces); + + // Scan all types for public properties and fields + return typesToScan + .Where(x => x != null) // filter out null types (e.g. type.BaseType == null) + .SelectMany(x => x.GetDeclaredMembers() + .Where(mi => mi.DeclaringType != null && mi.DeclaringType == x) + .Where( + m => + m is FieldInfo && fieldAvailableFor((FieldInfo)m) || + m is PropertyInfo && propertyAvailableFor((PropertyInfo)m) && + !((PropertyInfo)m).GetIndexParameters().Any()) + .Where(memberAvailableFor) + ); + } + + private MethodInfo[] BuildPublicNoArgMethods(Func shouldMapMethod) + { + return Type.GetAllMethods() + .Where(shouldMapMethod) + .Where(mi => mi.IsPublic && !mi.IsStatic && mi.DeclaringType != typeof(object)) + .Where(m => (m.ReturnType != typeof(void)) && (m.GetParameters().Length == 0)) + .ToArray(); + } + } +} diff --git a/src/AutoMapper/TypeExtensions.cs b/src/AutoMapper/TypeExtensions.cs index 403a4ebcfe..ae48f4c122 100644 --- a/src/AutoMapper/TypeExtensions.cs +++ b/src/AutoMapper/TypeExtensions.cs @@ -1,217 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; + namespace AutoMapper { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; -#if !PORTABLE - using System.Reflection.Emit; -#endif internal static class TypeExtensions { - /// The type to construct. - /// - /// For generic interfaces, the only way to reliably determine the implementing type's generic type arguments - /// is to know the closed type of the desired interface implementation since there may be multiple implementations - /// of the same generic interface on this type. - /// - public static Func BuildCtor(this Type type, Func getClosedGenericInterfaceType = null) - { - return context => - { - // Warning: do not mutate the parameter @type. It's in a shared closure and will be remembered in subsequent calls to this function. - // Otherwise all ctors for the same generic type definition will return whatever closed type then first one calculates. - var concreteType = type; - - if (type.IsGenericTypeDefinition()) - { - if (getClosedGenericInterfaceType == null) throw new ArgumentNullException(nameof(getClosedGenericInterfaceType), "For generic interfaces, the desired closed interface type must be known."); - var closedInterfaceType = getClosedGenericInterfaceType.Invoke(context); - var implementationTypeArguments = type.GetImplementedInterface(closedInterfaceType.GetGenericTypeDefinition(), closedInterfaceType.GenericTypeArguments).GenericTypeArguments; - - var genericParameters = type.GetTypeInfo().GenericTypeParameters; - var deducedTypeArguments = new Type[genericParameters.Length]; - DeduceGenericArguments(genericParameters, deducedTypeArguments, implementationTypeArguments[0], context.SourceType); - DeduceGenericArguments(genericParameters, deducedTypeArguments, implementationTypeArguments[1], context.DestinationType); - - if (deducedTypeArguments.Any(_ => _ == null)) throw new InvalidOperationException($"One or more type arguments to {type.Name} cannot be determined."); - concreteType = type.MakeGenericType(deducedTypeArguments); - } - - var obj = context.Options.ServiceCtor.Invoke(concreteType); - - return (TServiceType)obj; - }; - } - - private static void DeduceGenericArguments(Type[] genericParameters, Type[] deducedGenericArguments, Type typeUsingParameters, Type typeUsingArguments) - { - if (typeUsingParameters.IsByRef) - { - DeduceGenericArguments(genericParameters, deducedGenericArguments, typeUsingParameters.GetElementType(), typeUsingArguments.GetElementType()); - return; - } - - var index = Array.IndexOf(genericParameters, typeUsingParameters); - if (index != -1) - { - if (deducedGenericArguments[index] == null) - deducedGenericArguments[index] = typeUsingArguments; - else if (deducedGenericArguments[index] != typeUsingArguments) - throw new NotImplementedException("Generic variance is not implemented."); - } - else if (typeUsingParameters.IsGenericType() && typeUsingArguments.IsGenericType()) - { - var childArgumentsUsingParameters = typeUsingParameters.GenericTypeArguments; - var childArgumentsUsingArguments = typeUsingArguments.GenericTypeArguments; - for (var i = 0; i < childArgumentsUsingParameters.Length; i++) - DeduceGenericArguments(genericParameters, deducedGenericArguments, childArgumentsUsingParameters[i], childArgumentsUsingArguments[i]); - } - } - - private static Type GetImplementedInterface(this Type implementation, Type interfaceDefinition, params Type[] interfaceGenericArguments) - { - return implementation.GetTypeInfo().ImplementedInterfaces.Single(implementedInterface => - { - if (implementedInterface.GetGenericTypeDefinition() != interfaceDefinition) return false; + public static bool Has(this Type type) where TAttribute : Attribute => type.GetTypeInfo().IsDefined(typeof(TAttribute), inherit: false); - var implementedInterfaceArguments = implementedInterface.GenericTypeArguments; - for (var i = 0; i < interfaceGenericArguments.Length; i++) - { - // This assumes the interface type parameters are not covariant or contravariant - if (implementedInterfaceArguments[i].GetGenericTypeDefinitionIfGeneric() != interfaceGenericArguments[i].GetGenericTypeDefinitionIfGeneric()) return false; - } + public static Type GetGenericTypeDefinitionIfGeneric(this Type type) => type.IsGenericType() ? type.GetGenericTypeDefinition() : type; - return true; - }); - } + public static Type[] GetGenericArguments(this Type type) => type.GetTypeInfo().GenericTypeArguments; - public static Type GetGenericTypeDefinitionIfGeneric(this Type type) - { - return type.IsGenericType() ? type.GetGenericTypeDefinition() : type; - } - - public static Type[] GetGenericArguments(this Type type) - { - return type.GetTypeInfo().GenericTypeArguments; - } + public static Type[] GetGenericParameters(this Type type) => type.GetGenericTypeDefinition().GetTypeInfo().GenericTypeParameters; - public static Type[] GetGenericParameters(this Type type) - { - return type.GetGenericTypeDefinition().GetTypeInfo().GenericTypeParameters; - } + public static IEnumerable GetDeclaredConstructors(this Type type) => type.GetTypeInfo().DeclaredConstructors; - public static IEnumerable GetDeclaredConstructors(this Type type) - { - return type.GetTypeInfo().DeclaredConstructors; - } + public static Type CreateType(this TypeBuilder type) => type.CreateTypeInfo().AsType(); -#if !PORTABLE - public static Type CreateType(this TypeBuilder type) - { - return type.CreateTypeInfo().AsType(); - } -#endif + public static IEnumerable GetDeclaredMembers(this Type type) => type.GetTypeInfo().DeclaredMembers; - public static IEnumerable GetDeclaredMembers(this Type type) + public static IEnumerable GetTypeInheritance(this Type type) { - return type.GetTypeInfo().DeclaredMembers; - } + yield return type; -#if PORTABLE - public static IEnumerable GetAllMembers(this Type type) - { - while (true) + var baseType = type.BaseType(); + while(baseType != null) { - foreach (var memberInfo in type.GetTypeInfo().DeclaredMembers) - { - yield return memberInfo; - } - - type = type.BaseType(); - - if (type == null) - { - yield break; - } + yield return baseType; + baseType = baseType.BaseType(); } } - public static MemberInfo[] GetMember(this Type type, string name) - { - return type.GetAllMembers().Where(mi => mi.Name == name).ToArray(); - } -#endif + public static IEnumerable GetDeclaredMethods(this Type type) => type.GetTypeInfo().DeclaredMethods; - public static IEnumerable GetDeclaredMethods(this Type type) - { - return type.GetTypeInfo().DeclaredMethods; - } + public static MethodInfo GetDeclaredMethod(this Type type, string name) => type.GetAllMethods().FirstOrDefault(mi => mi.Name == name); -#if PORTABLE - public static MethodInfo GetMethod(this Type type, string name) - { - return type.GetAllMethods().FirstOrDefault(mi => mi.Name == name); - } + public static MethodInfo GetDeclaredMethod(this Type type, string name, Type[] parameters) => + type.GetAllMethods().Where(mi => mi.Name == name).MatchParameters(parameters); - public static MethodInfo GetMethod(this Type type, string name, Type[] parameters) - { - return type - .GetAllMethods() - .Where(mi => mi.Name == name) - .Where(mi => mi.GetParameters().Length == parameters.Length) - .FirstOrDefault(mi => mi.GetParameters().Select(pi => pi.ParameterType).SequenceEqual(parameters)); - } -#endif + public static ConstructorInfo GetDeclaredConstructor(this Type type, Type[] parameters) => + type.GetDeclaredConstructors().MatchParameters(parameters); - public static IEnumerable GetAllMethods(this Type type) - { - return type.GetRuntimeMethods(); - } + private static TMethod MatchParameters(this IEnumerable methods, Type[] parameters) where TMethod : MethodBase => + methods.FirstOrDefault(mi => mi.GetParameters().Select(pi => pi.ParameterType).SequenceEqual(parameters)); - public static IEnumerable GetDeclaredProperties(this Type type) - { - return type.GetTypeInfo().DeclaredProperties; - } + public static IEnumerable GetAllMethods(this Type type) => type.GetRuntimeMethods(); -#if PORTABLE - public static PropertyInfo GetProperty(this Type type, string name) - { - return type.GetTypeInfo().DeclaredProperties.FirstOrDefault(mi => mi.Name == name); - } -#endif + public static IEnumerable GetDeclaredProperties(this Type type) => type.GetTypeInfo().DeclaredProperties; - public static object[] GetCustomAttributes(this Type type, Type attributeType, bool inherit) - { - return type.GetTypeInfo().GetCustomAttributes(attributeType, inherit).ToArray(); - } + public static PropertyInfo GetDeclaredProperty(this Type type, string name) + => type.GetTypeInfo().GetDeclaredProperty(name); - public static bool IsStatic(this FieldInfo fieldInfo) - { - return fieldInfo?.IsStatic ?? false; - } + public static object[] GetCustomAttributes(this Type type, Type attributeType, bool inherit) + => type.GetTypeInfo().GetCustomAttributes(attributeType, inherit).Cast().ToArray(); - public static bool IsStatic(this PropertyInfo propertyInfo) - { - return propertyInfo?.GetGetMethod(true)?.IsStatic - ?? propertyInfo?.GetSetMethod(true)?.IsStatic - ?? false; - } + public static bool IsStatic(this FieldInfo fieldInfo) => fieldInfo?.IsStatic ?? false; - public static bool IsStatic(this MemberInfo memberInfo) - { - return (memberInfo as FieldInfo).IsStatic() - || (memberInfo as PropertyInfo).IsStatic() - || ((memberInfo as MethodInfo)?.IsStatic - ?? false); - } + public static bool IsStatic(this PropertyInfo propertyInfo) => propertyInfo?.GetGetMethod(true)?.IsStatic + ?? propertyInfo?.GetSetMethod(true)?.IsStatic + ?? false; + + public static bool IsStatic(this MemberInfo memberInfo) => (memberInfo as FieldInfo).IsStatic() + || (memberInfo as PropertyInfo).IsStatic() + || ((memberInfo as MethodInfo)?.IsStatic + ?? false); - public static bool IsPublic(this PropertyInfo propertyInfo) + public static bool IsPublic(this PropertyInfo propertyInfo) => (propertyInfo?.GetGetMethod(true)?.IsPublic ?? false) + || (propertyInfo?.GetSetMethod(true)?.IsPublic ?? false); + + public static IEnumerable PropertiesWithAnInaccessibleSetter(this Type type) { - return (propertyInfo?.GetGetMethod(true)?.IsPublic ?? false) - || (propertyInfo?.GetSetMethod(true)?.IsPublic ?? false); + return type.GetRuntimeProperties().Where(pm => pm.HasAnInaccessibleSetter()); } public static bool HasAnInaccessibleSetter(this PropertyInfo property) @@ -220,104 +83,51 @@ public static bool HasAnInaccessibleSetter(this PropertyInfo property) return setMethod == null || setMethod.IsPrivate || setMethod.IsFamily; } - public static bool IsPublic(this MemberInfo memberInfo) - { - return (memberInfo as FieldInfo)?.IsPublic ?? (memberInfo as PropertyInfo).IsPublic(); - } + public static bool IsPublic(this MemberInfo memberInfo) => (memberInfo as FieldInfo)?.IsPublic ?? (memberInfo as PropertyInfo).IsPublic(); - public static bool IsNotPublic(this ConstructorInfo constructorInfo) - { - return constructorInfo.IsPrivate - || constructorInfo.IsFamilyAndAssembly - || constructorInfo.IsFamilyOrAssembly - || constructorInfo.IsFamily; - } + public static bool IsNotPublic(this ConstructorInfo constructorInfo) => constructorInfo.IsPrivate + || constructorInfo.IsFamilyAndAssembly + || constructorInfo.IsFamilyOrAssembly + || constructorInfo.IsFamily; - public static Assembly Assembly(this Type type) - { - return type.GetTypeInfo().Assembly; - } + public static Assembly Assembly(this Type type) => type.GetTypeInfo().Assembly; - public static Type BaseType(this Type type) - { - return type.GetTypeInfo().BaseType; - } + public static Type BaseType(this Type type) => type.GetTypeInfo().BaseType; -#if PORTABLE - public static bool IsAssignableFrom(this Type type, Type other) - { - return type.GetTypeInfo().IsAssignableFrom(other.GetTypeInfo()); - } -#endif + public static bool IsAssignableFrom(this Type type, Type other) => type.GetTypeInfo().IsAssignableFrom(other.GetTypeInfo()); - public static bool IsAbstract(this Type type) - { - return type.GetTypeInfo().IsAbstract; - } + public static bool IsAbstract(this Type type) => type.GetTypeInfo().IsAbstract; - public static bool IsClass(this Type type) - { - return type.GetTypeInfo().IsClass; - } + public static bool IsClass(this Type type) => type.GetTypeInfo().IsClass; - public static bool IsEnum(this Type type) - { - return type.GetTypeInfo().IsEnum; - } + public static bool IsEnum(this Type type) => type.GetTypeInfo().IsEnum; - public static bool IsGenericType(this Type type) - { - return type.GetTypeInfo().IsGenericType; - } + public static bool IsGenericType(this Type type) => type.GetTypeInfo().IsGenericType; - public static bool IsGenericTypeDefinition(this Type type) - { - return type.GetTypeInfo().IsGenericTypeDefinition; - } + public static bool IsGenericTypeDefinition(this Type type) => type.GetTypeInfo().IsGenericTypeDefinition; - public static bool IsInterface(this Type type) - { - return type.GetTypeInfo().IsInterface; - } + public static bool IsInterface(this Type type) => type.GetTypeInfo().IsInterface; - public static bool IsPrimitive(this Type type) - { - return type.GetTypeInfo().IsPrimitive; - } + public static bool IsPrimitive(this Type type) => type.GetTypeInfo().IsPrimitive; - public static bool IsSealed(this Type type) - { - return type.GetTypeInfo().IsSealed; - } + public static bool IsSealed(this Type type) => type.GetTypeInfo().IsSealed; - public static bool IsValueType(this Type type) - { - return type.GetTypeInfo().IsValueType; - } + public static bool IsValueType(this Type type) => type.GetTypeInfo().IsValueType; - public static bool IsInstanceOfType(this Type type, object o) - { - return o != null && type.IsAssignableFrom(o.GetType()); - } + public static bool IsLiteralType(this Type type) => type == typeof(string) || type.GetTypeInfo().IsValueType; - public static ConstructorInfo[] GetConstructors(this Type type) - { - return type.GetTypeInfo().DeclaredConstructors.ToArray(); - } + public static bool IsInstanceOfType(this Type type, object o) => o != null && type.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo()); - public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo, bool ignored) - { - return propertyInfo.GetMethod; - } + public static PropertyInfo[] GetProperties(this Type type) => type.GetRuntimeProperties().ToArray(); - public static MethodInfo GetSetMethod(this PropertyInfo propertyInfo, bool ignored) - { - return propertyInfo.SetMethod; - } + public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo, bool ignored) => propertyInfo.GetMethod; - public static FieldInfo GetField(this Type type, string name) - { - return type.GetRuntimeField(name); - } + public static MethodInfo GetSetMethod(this PropertyInfo propertyInfo, bool ignored) => propertyInfo.SetMethod; + + public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo) => propertyInfo.GetMethod; + + public static MethodInfo GetSetMethod(this PropertyInfo propertyInfo) => propertyInfo.SetMethod; + + public static FieldInfo GetField(this Type type, string name) => type.GetRuntimeField(name); } } diff --git a/src/AutoMapper/TypeMap.cs b/src/AutoMapper/TypeMap.cs index 8e86d1e578..e648357563 100644 --- a/src/AutoMapper/TypeMap.cs +++ b/src/AutoMapper/TypeMap.cs @@ -1,326 +1,399 @@ - -namespace AutoMapper -{ - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - using System.Linq.Expressions; - using System.Reflection; - using Configuration; - using Execution; - - /// - /// Main configuration object holding all mapping configuration for a source and destination type - /// - [DebuggerDisplay("{SourceType.Name} -> {DestinationType.Name}")] - public class TypeMap - { - private readonly List _afterMapActions = new List(); - private readonly List _beforeMapActions = new List(); - private readonly HashSet _includedDerivedTypes = new HashSet(); - private readonly HashSet _includedBaseTypes = new HashSet(); - private readonly ConcurrentBag _propertyMaps = new ConcurrentBag(); - private readonly ConcurrentBag _sourceMemberConfigs = new ConcurrentBag(); - - private readonly IList _inheritedMaps = new List(); - private PropertyMap[] _orderedPropertyMaps; - private bool _sealed; - public bool Sealed => _sealed; - private readonly IList _inheritedTypeMaps = new List(); - - public TypeMap(TypeDetails sourceType, TypeDetails destinationType, MemberList memberList, IProfileConfiguration profile) - { - SourceTypeDetails = sourceType; - DestinationTypeDetails = destinationType; - Types = new TypePair(sourceType.Type, destinationType.Type); - Profile = profile; - ConfiguredMemberList = memberList; - IgnorePropertiesStartingWith = profile.GlobalIgnores; - } - - public LambdaExpression MapExpression { get; private set; } - - public TypePair Types { get; } - - public ConstructorMap ConstructorMap { get; set; } - - public TypeDetails SourceTypeDetails { get; } - public TypeDetails DestinationTypeDetails { get; } - - public Type SourceType => SourceTypeDetails.Type; - public Type DestinationType => DestinationTypeDetails.Type; - - public IProfileConfiguration Profile { get; } - - public LambdaExpression CustomMapper { get; set; } - public LambdaExpression CustomProjection { get; set; } - public LambdaExpression DestinationCtor { get; set; } - - public IEnumerable IgnorePropertiesStartingWith { get; set; } - - public Type DestinationTypeOverride { get; set; } - public Type DestinationTypeToUse => DestinationTypeOverride ?? DestinationType; - - public bool ConstructDestinationUsingServiceLocator { get; set; } - - public MemberList ConfiguredMemberList { get; } - - public IEnumerable IncludedDerivedTypes => _includedDerivedTypes; - public IEnumerable IncludedBaseTypes => _includedBaseTypes; - - public IEnumerable BeforeMapActions => _beforeMapActions; - public IEnumerable AfterMapActions => _afterMapActions; - - public bool PreserveReferences { get; set; } - public LambdaExpression Condition { get; set; } - - public int MaxDepth { get; set; } - - public LambdaExpression Substitution { get; set; } - public LambdaExpression ConstructExpression { get; set; } - public Type TypeConverterType { get; set; } - - public PropertyMap[] GetPropertyMaps() - { - return _orderedPropertyMaps ?? _propertyMaps.Concat(_inheritedMaps).ToArray(); - } - - public void AddPropertyMap(IMemberAccessor destProperty, IEnumerable resolvers) - { - var propertyMap = new PropertyMap(destProperty, this); - - propertyMap.ChainMembers(resolvers); - - _propertyMaps.Add(propertyMap); - } - - public string[] GetUnmappedPropertyNames() - { - Func getFunc = - pm => - ConfiguredMemberList == MemberList.Destination - ? pm.DestinationProperty.Name - : pm.CustomExpression == null && pm.SourceMember != null - ? pm.SourceMember.Name - : pm.DestinationProperty.Name; - var autoMappedProperties = _propertyMaps.Where(pm => pm.IsMapped()) - .Select(getFunc).ToList(); - var inheritedProperties = _inheritedMaps.Where(pm => pm.IsMapped()) - .Select(getFunc).ToList(); - - IEnumerable properties; - - if (ConfiguredMemberList == MemberList.Destination) - { - properties = DestinationTypeDetails.PublicWriteAccessors - .Select(p => p.Name) - .Except(autoMappedProperties) - .Except(inheritedProperties); - } - else - { - var redirectedSourceMembers = _propertyMaps - .Where(pm => pm.IsMapped() && pm.SourceMember != null && pm.SourceMember.Name != pm.DestinationProperty.Name) - .Select(pm => pm.SourceMember.Name); - - var ignoredSourceMembers = _sourceMemberConfigs - .Where(smc => smc.IsIgnored()) - .Select(pm => pm.SourceMember.Name).ToList(); - - properties = SourceTypeDetails.PublicReadAccessors - .Select(p => p.Name) - .Except(autoMappedProperties) - .Except(inheritedProperties) - .Except(redirectedSourceMembers) - .Except(ignoredSourceMembers); - } - - return properties.Where(memberName => !IgnorePropertiesStartingWith.Any(memberName.StartsWith)).ToArray(); - } - - public PropertyMap FindOrCreatePropertyMapFor(IMemberAccessor destinationProperty) - { - var propertyMap = GetExistingPropertyMapFor(destinationProperty); - - if (propertyMap != null) return propertyMap; - - propertyMap = new PropertyMap(destinationProperty, this); - - _propertyMaps.Add(propertyMap); - - return propertyMap; - } - - public void IncludeDerivedTypes(Type derivedSourceType, Type derivedDestinationType) - { - var derivedTypes = new TypePair(derivedSourceType, derivedDestinationType); - if (derivedTypes.Equals(Types)) - { - throw new InvalidOperationException("You cannot include a type map into itself."); - } - _includedDerivedTypes.Add(derivedTypes); - } - - public void IncludeBaseTypes(Type baseSourceType, Type baseDestinationType) - { - var baseTypes = new TypePair(baseSourceType, baseDestinationType); - if (baseTypes.Equals(Types)) - { - throw new InvalidOperationException("You cannot include a type map into itself."); - } - _includedBaseTypes.Add(baseTypes); - } - - public Type GetDerivedTypeFor(Type derivedSourceType) - { - if (DestinationTypeOverride != null) - { - return DestinationTypeOverride; - } - // This might need to be fixed for multiple derived source types to different dest types - var match = _includedDerivedTypes.FirstOrDefault(tp => tp.SourceType == derivedSourceType); - - return match.DestinationType ?? DestinationType; - } - - public bool TypeHasBeenIncluded(TypePair derivedTypes) - { - return _includedDerivedTypes.Contains(derivedTypes); - } - - public bool HasDerivedTypesToInclude() - { - return _includedDerivedTypes.Any() || DestinationTypeOverride != null; - } - - public void AddBeforeMapAction(LambdaExpression beforeMap) - { - _beforeMapActions.Add(beforeMap); - } - - public void AddAfterMapAction(LambdaExpression afterMap) - { - _afterMapActions.Add(afterMap); - } - - public void Seal(TypeMapRegistry typeMapRegistry, IConfigurationProvider configurationProvider) - { - if (_sealed) - return; - - foreach (var inheritedTypeMap in _inheritedTypeMaps) - { - ApplyInheritedTypeMap(inheritedTypeMap); - } - - _orderedPropertyMaps = - _propertyMaps - .Union(_inheritedMaps) - .OrderBy(map => map.MappingOrder).ToArray(); - - MapExpression = TypeMapPlanBuilder.BuildMapperFunc(this, configurationProvider, typeMapRegistry); - - _sealed = true; - } - - public PropertyMap GetExistingPropertyMapFor(IMemberAccessor destinationProperty) - { - var propertyMap = - _propertyMaps.FirstOrDefault(pm => pm.DestinationProperty.Name.Equals(destinationProperty.Name)); - - if (propertyMap != null) - return propertyMap; - - propertyMap = - _inheritedMaps.FirstOrDefault(pm => pm.DestinationProperty.Name.Equals(destinationProperty.Name)); - - if (propertyMap == null) - return null; - - var propertyInfo = propertyMap.DestinationProperty.MemberInfo as PropertyInfo; - - if (propertyInfo == null) - return propertyMap; - - var baseAccessor = propertyInfo.GetMethod; - - if (baseAccessor.IsAbstract || baseAccessor.IsVirtual) - return propertyMap; - - var accessor = ((PropertyInfo)destinationProperty.MemberInfo).GetMethod; - - if (baseAccessor.DeclaringType == accessor.DeclaringType) - return propertyMap; - - return null; - } - - public void InheritTypes(TypeMap inheritedTypeMap) - { - foreach (var includedDerivedType in inheritedTypeMap._includedDerivedTypes - .Where(includedDerivedType => !_includedDerivedTypes.Contains(includedDerivedType))) - { - _includedDerivedTypes.Add(includedDerivedType); - } - } - - public SourceMemberConfig FindOrCreateSourceMemberConfigFor(MemberInfo sourceMember) - { - var config = _sourceMemberConfigs.FirstOrDefault(smc => Equals(smc.SourceMember, sourceMember)); - - if (config != null) return config; - - config = new SourceMemberConfig(sourceMember); - _sourceMemberConfigs.Add(config); - - return config; - } - - public void ApplyInheritedMap(TypeMap inheritedTypeMap) - { - _inheritedTypeMaps.Add(inheritedTypeMap); - } - - public bool ShouldCheckForValid() - { - return CustomMapper == null - && CustomProjection == null - && TypeConverterType == null - && DestinationTypeOverride == null; - } - - private void ApplyInheritedTypeMap(TypeMap inheritedTypeMap) - { - foreach (var inheritedMappedProperty in inheritedTypeMap.GetPropertyMaps().Where(m => m.IsMapped())) - { - var conventionPropertyMap = GetPropertyMaps() - .SingleOrDefault(m => - m.DestinationProperty.Name == inheritedMappedProperty.DestinationProperty.Name); - - if (conventionPropertyMap != null) - { - conventionPropertyMap.ApplyInheritedPropertyMap(inheritedMappedProperty); - } - else - { - var propertyMap = new PropertyMap(inheritedMappedProperty, this); - - _inheritedMaps.Add(propertyMap); - } - } - - //Include BeforeMap - foreach (var beforeMapAction in inheritedTypeMap._beforeMapActions) - { - AddBeforeMapAction(beforeMapAction); - } - //Include AfterMap - foreach (var afterMapAction in inheritedTypeMap._afterMapActions) - { - AddAfterMapAction(afterMapAction); - } - } - } -} +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using AutoMapper.Configuration; +using AutoMapper.Execution; + +namespace AutoMapper +{ + using AutoMapper.Features; + using Internal; + using static Expression; + + /// + /// Main configuration object holding all mapping configuration for a source and destination type + /// + [DebuggerDisplay("{SourceType.Name} -> {DestinationType.Name}")] + public class TypeMap + { + private readonly HashSet _afterMapActions = new HashSet(); + private readonly HashSet _beforeMapActions = new HashSet(); + private readonly HashSet _includedDerivedTypes = new HashSet(); + private readonly HashSet _includedBaseTypes = new HashSet(); + private readonly Dictionary _propertyMaps = new Dictionary(); + private readonly Dictionary _excludeMaps = new Dictionary(); + private readonly Dictionary _pathMaps = new Dictionary(); + private readonly Dictionary _sourceMemberConfigs = new Dictionary(); + private PropertyMap[] _orderedPropertyMaps; + private bool _sealed; + private readonly HashSet _inheritedTypeMaps = new HashSet(); + private readonly List _includedMembersTypeMaps = new List(); + private readonly List _valueTransformerConfigs = new List(); + + public TypeMap(TypeDetails sourceType, TypeDetails destinationType, ProfileMap profile) + { + SourceTypeDetails = sourceType; + DestinationTypeDetails = destinationType; + Types = new TypePair(sourceType.Type, destinationType.Type); + Profile = profile; + } + + private IEnumerable SourceMemberConfigs => _sourceMemberConfigs.Values; + + public PathMap FindOrCreatePathMapFor(LambdaExpression destinationExpression, MemberPath path, TypeMap typeMap) + { + var pathMap = _pathMaps.GetOrDefault(path); + if(pathMap == null) + { + pathMap = new PathMap(destinationExpression, path, typeMap); + AddPathMap(pathMap); + } + return pathMap; + } + + private void AddPathMap(PathMap pathMap) => _pathMaps.Add(pathMap.MemberPath, pathMap); + + public Features Features { get; } = new Features(); + + public PathMap FindPathMapByDestinationPath(string destinationFullPath) => + PathMaps.SingleOrDefault(item => string.Join(".", item.MemberPath.Members.Select(m => m.Name)) == destinationFullPath); + + public LambdaExpression MapExpression { get; private set; } + + public TypePair Types { get; } + + public ConstructorMap ConstructorMap { get; set; } + + public TypeDetails SourceTypeDetails { get; } + public TypeDetails DestinationTypeDetails { get; } + + public Type SourceType => SourceTypeDetails.Type; + public Type DestinationType => DestinationTypeDetails.Type; + + public ProfileMap Profile { get; } + + public LambdaExpression CustomMapFunction { get; set; } + public LambdaExpression CustomMapExpression { get; set; } + public LambdaExpression CustomCtorFunction { get; set; } + public LambdaExpression CustomCtorExpression { get; set; } + + public Type DestinationTypeOverride { get; set; } + public Type DestinationTypeToUse => DestinationTypeOverride ?? DestinationType; + + public bool ConstructDestinationUsingServiceLocator { get; set; } + + public bool IncludeAllDerivedTypes { get; set; } + + public MemberList ConfiguredMemberList { get; set; } + + public IEnumerable IncludedDerivedTypes => _includedDerivedTypes; + public IEnumerable IncludedBaseTypes => _includedBaseTypes; + + public IEnumerable BeforeMapActions => _beforeMapActions; + public IEnumerable AfterMapActions => _afterMapActions; + public IEnumerable ValueTransformers => _valueTransformerConfigs; + + public bool PreserveReferences { get; set; } + public LambdaExpression Condition { get; set; } + + public int MaxDepth { get; set; } + + public Type TypeConverterType { get; set; } + public bool DisableConstructorValidation { get; set; } + + public IEnumerable PropertyMaps => _orderedPropertyMaps ?? (IEnumerable)_propertyMaps.Values; + + public IEnumerable ExcludeMaps => _excludeMaps.Values; + + public IEnumerable PathMaps => _pathMaps.Values; + public IEnumerable MemberMaps => PropertyMaps.Cast().Concat(PathMaps).Concat(GetConstructorMemberMaps()); + + public bool IsConventionMap { get; set; } + public bool? IsValid { get; set; } + internal bool WasInlineChecked { get; set; } + + public bool PassesCtorValidation => + DisableConstructorValidation + || CustomCtorExpression != null + || CustomCtorFunction != null + || ConstructDestinationUsingServiceLocator + || ConstructorMap?.CanResolve == true + || DestinationTypeToUse.IsInterface() + || DestinationTypeToUse.IsAbstract() + || DestinationTypeToUse.IsGenericTypeDefinition() + || DestinationTypeToUse.IsValueType() + || DestinationTypeDetails.Constructors.FirstOrDefault(c => c.GetParameters().All(p => p.IsOptional)) != null; + + public bool IsConstructorMapping => + CustomCtorExpression == null + && CustomCtorFunction == null + && !ConstructDestinationUsingServiceLocator + && (ConstructorMap?.CanResolve ?? false); + + public bool ShouldCheckForValid => + CustomMapFunction == null + && CustomMapExpression == null + && TypeConverterType == null + && DestinationTypeOverride == null + && ConfiguredMemberList != MemberList.None + && !(IsValid ?? false); + + public bool IsClosedGeneric { get; internal set; } + public LambdaExpression[] IncludedMembers { get; internal set; } = Array.Empty(); + public string[] IncludedMembersNames { get; internal set; } = Array.Empty(); + + public LambdaExpression[] GetUntypedIncludedMembers() => + SourceType.IsGenericTypeDefinition ? + Array.Empty() : + IncludedMembersNames.Select(name => ExpressionFactory.MemberAccessLambda(SourceType, name)).ToArray(); + + public bool ConstructorParameterMatches(string destinationPropertyName) => + ConstructorMap?.CtorParams.Any(c => !c.HasDefaultValue && string.Equals(c.Parameter.Name, destinationPropertyName, StringComparison.OrdinalIgnoreCase)) == true; + + public void AddPropertyMap(MemberInfo destProperty, IEnumerable resolvers) + { + var propertyMap = new PropertyMap(destProperty, this); + + propertyMap.ChainMembers(resolvers); + + AddPropertyMap(propertyMap); + } + + public void AddExcludeMap(MemberInfo destProperty, IEnumerable resolvers) + { + var propertyMap = new PropertyMap(destProperty, this); + + propertyMap.ChainMembers(resolvers); + + AddExcludeMap(propertyMap); + } + + private void AddPropertyMap(PropertyMap propertyMap) => _propertyMaps.Add(propertyMap.DestinationName, propertyMap); + + private void AddExcludeMap(PropertyMap propertyMap) => _excludeMaps.Add(propertyMap.DestinationName, propertyMap); + + public string[] GetUnmappedPropertyNames() + { + var autoMappedProperties = GetPropertyNames(PropertyMaps); + + IEnumerable properties; + + if(ConfiguredMemberList == MemberList.Destination) + { + properties = DestinationTypeDetails.PublicWriteAccessors + .Select(p => p.Name) + .Except(autoMappedProperties) + .Except(PathMaps.Select(p => p.MemberPath.First.Name)); + } + else + { + var redirectedSourceMembers = MemberMaps + .Where(pm => pm.IsMapped && pm.SourceMember != null && pm.SourceMember.Name != pm.DestinationName) + .Select(pm => pm.SourceMember.Name); + + var ignoredSourceMembers = SourceMemberConfigs + .Where(smc => smc.IsIgnored()) + .Select(pm => pm.SourceMember.Name); + + properties = SourceTypeDetails.PublicReadAccessors + .Select(p => p.Name) + .Except(autoMappedProperties) + .Except(redirectedSourceMembers) + .Except(ignoredSourceMembers); + } + + return properties.Where(memberName => !Profile.GlobalIgnores.Any(memberName.StartsWith)).ToArray(); + string GetPropertyName(PropertyMap pm) => ConfiguredMemberList == MemberList.Destination + ? pm.DestinationName + : pm.SourceMember != null + ? pm.SourceMember.Name + : pm.DestinationName; + string[] GetPropertyNames(IEnumerable propertyMaps) => propertyMaps.Where(pm => pm.IsMapped).Select(GetPropertyName).ToArray(); + } + + public PropertyMap FindOrCreatePropertyMapFor(MemberInfo destinationProperty) + { + var propertyMap = GetPropertyMap(destinationProperty.Name); + + if (propertyMap != null) return propertyMap; + + propertyMap = new PropertyMap(destinationProperty, this); + + AddPropertyMap(propertyMap); + + return propertyMap; + } + + public void IncludeDerivedTypes(Type derivedSourceType, Type derivedDestinationType) + { + var derivedTypes = new TypePair(derivedSourceType, derivedDestinationType); + if (derivedTypes.Equals(Types)) + { + throw new InvalidOperationException("You cannot include a type map into itself."); + } + _includedDerivedTypes.Add(derivedTypes); + } + + public void IncludeBaseTypes(Type baseSourceType, Type baseDestinationType) + { + var baseTypes = new TypePair(baseSourceType, baseDestinationType); + if (baseTypes.Equals(Types)) + { + throw new InvalidOperationException("You cannot include a type map into itself."); + } + _includedBaseTypes.Add(baseTypes); + } + + internal void IgnorePaths(MemberInfo destinationMember) + { + foreach(var pathMap in PathMaps.Where(pm => pm.MemberPath.First == destinationMember)) + { + pathMap.Ignored = true; + } + } + + public Type GetDerivedTypeFor(Type derivedSourceType) + { + if (DestinationTypeOverride != null) + { + return DestinationTypeOverride; + } + // This might need to be fixed for multiple derived source types to different dest types + var match = _includedDerivedTypes.FirstOrDefault(tp => tp.SourceType == derivedSourceType); + + return match.DestinationType ?? DestinationType; + } + + public bool HasDerivedTypesToInclude() => _includedDerivedTypes.Any() || DestinationTypeOverride != null; + + public void AddBeforeMapAction(LambdaExpression beforeMap) => _beforeMapActions.Add(beforeMap); + + public void AddAfterMapAction(LambdaExpression afterMap) => _afterMapActions.Add(afterMap); + + public void AddValueTransformation(ValueTransformerConfiguration valueTransformerConfiguration) + { + _valueTransformerConfigs.Add(valueTransformerConfiguration); + } + + public void Seal(IConfigurationProvider configurationProvider) + { + if(_sealed) + { + return; + } + _sealed = true; + + foreach (var inheritedTypeMap in _inheritedTypeMaps) + { + ApplyInheritedTypeMap(inheritedTypeMap); + } + foreach(var includedMemberTypeMap in _includedMembersTypeMaps) + { + ApplyIncludedMemberTypeMap(includedMemberTypeMap); + } + + _orderedPropertyMaps = PropertyMaps.OrderBy(map => map.MappingOrder).ToArray(); + _propertyMaps.Clear(); + + MapExpression = CreateMapperLambda(configurationProvider, null); + + Features.Seal(configurationProvider); + } + + internal LambdaExpression CreateMapperLambda(IConfigurationProvider configurationProvider, HashSet typeMapsPath) => + Types.IsGenericTypeDefinition ? null : new TypeMapPlanBuilder(configurationProvider, this).CreateMapperLambda(typeMapsPath); + + private PropertyMap GetPropertyMap(string name) => _propertyMaps.GetOrDefault(name); + + private PropertyMap GetPropertyMap(PropertyMap propertyMap) => GetPropertyMap(propertyMap.DestinationName); + + public void AddMemberMap(IncludedMember includedMember) => _includedMembersTypeMaps.Add(includedMember); + + public SourceMemberConfig FindOrCreateSourceMemberConfigFor(MemberInfo sourceMember) + { + var config = _sourceMemberConfigs.GetOrDefault(sourceMember); + + if(config != null) return config; + + config = new SourceMemberConfig(sourceMember); + AddSourceMemberConfig(config); + return config; + } + + private void AddSourceMemberConfig(SourceMemberConfig config) => _sourceMemberConfigs.Add(config.SourceMember, config); + + public bool AddInheritedMap(TypeMap inheritedTypeMap) => _inheritedTypeMaps.Add(inheritedTypeMap); + + private void ApplyIncludedMemberTypeMap(IncludedMember includedMember) + { + var typeMap = includedMember.TypeMap; + var expression = includedMember.MemberExpression; + var memberMaps = typeMap.PropertyMaps. + Where(m => m.CanResolveValue && GetPropertyMap(m)==null) + .Select(p => new PropertyMap(p, this, expression)) + .ToList(); + var notOverridenPathMaps = NotOverridenPathMaps(typeMap); + if(memberMaps.Count == 0 && notOverridenPathMaps.Count == 0) + { + return; + } + memberMaps.ForEach(p=> + { + AddPropertyMap(p); + foreach(var transformer in typeMap.ValueTransformers) + { + p.AddValueTransformation(transformer); + } + }); + _beforeMapActions.UnionWith(typeMap._beforeMapActions.Select(CheckCustomSource)); + _afterMapActions.UnionWith(typeMap._afterMapActions.Select(CheckCustomSource)); + notOverridenPathMaps.ForEach(p=>AddPathMap(new PathMap(p, this, expression) { CustomMapExpression = CheckCustomSource(p.CustomMapExpression) })); + return; + LambdaExpression CheckCustomSource(LambdaExpression lambda) => PropertyMap.CheckCustomSource(lambda, expression); + } + + private void ApplyInheritedTypeMap(TypeMap inheritedTypeMap) + { + foreach(var inheritedMappedProperty in inheritedTypeMap.PropertyMaps.Where(m => m.IsMapped)) + { + var conventionPropertyMap = GetPropertyMap(inheritedMappedProperty); + + if(conventionPropertyMap != null) + { + conventionPropertyMap.ApplyInheritedPropertyMap(inheritedMappedProperty); + } + else + { + AddPropertyMap(new PropertyMap(inheritedMappedProperty, this)); + } + } + _beforeMapActions.UnionWith(inheritedTypeMap._beforeMapActions); + _afterMapActions.UnionWith(inheritedTypeMap._afterMapActions); + var notOverridenSourceConfigs = + inheritedTypeMap.SourceMemberConfigs.Where( + baseConfig => SourceMemberConfigs.All(derivedConfig => derivedConfig.SourceMember != baseConfig.SourceMember)).ToList(); + notOverridenSourceConfigs.ForEach(AddSourceMemberConfig); + var notOverridenPathMaps = NotOverridenPathMaps(inheritedTypeMap); + notOverridenPathMaps.ForEach(AddPathMap); + _valueTransformerConfigs.InsertRange(0, inheritedTypeMap._valueTransformerConfigs); + } + + private List NotOverridenPathMaps(TypeMap inheritedTypeMap) => + inheritedTypeMap.PathMaps.Where( + baseConfig => PathMaps.All(derivedConfig => derivedConfig.MemberPath != baseConfig.MemberPath)).ToList(); + + internal void CopyInheritedMapsTo(TypeMap typeMap) => typeMap._inheritedTypeMaps.UnionWith(_inheritedTypeMaps); + + private IEnumerable GetConstructorMemberMaps() + => CustomCtorExpression != null + || CustomCtorFunction != null + || ConstructDestinationUsingServiceLocator + || ConstructorMap?.CanResolve != true + ? Enumerable.Empty() + : ConstructorMap?.CtorParams ?? Enumerable.Empty(); + + } +} \ No newline at end of file diff --git a/src/AutoMapper/TypeMapFactory.cs b/src/AutoMapper/TypeMapFactory.cs index 1880e58c00..bf6a7c110f 100644 --- a/src/AutoMapper/TypeMapFactory.cs +++ b/src/AutoMapper/TypeMapFactory.cs @@ -1,75 +1,79 @@ - -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Execution; - - public class TypeMapFactory - { - public TypeMap CreateTypeMap(Type sourceType, Type destinationType, IProfileConfiguration options, MemberList memberList) - { - var sourceTypeInfo = new TypeDetails(sourceType, options); - var destTypeInfo = new TypeDetails(destinationType, options); - - var typeMap = new TypeMap(sourceTypeInfo, destTypeInfo, memberList, options); - - foreach (var destProperty in destTypeInfo.PublicWriteAccessors) - { - var resolvers = new LinkedList(); - - if (MapDestinationPropertyToSource(options, sourceTypeInfo, destProperty.DeclaringType, destProperty.GetMemberType(), destProperty.Name, resolvers)) - { - var destPropertyAccessor = destProperty.ToMemberAccessor(); - - typeMap.AddPropertyMap(destPropertyAccessor, resolvers); - } - } - if (!destinationType.IsAbstract() && destinationType.IsClass()) - { - foreach (var destCtor in destTypeInfo.Constructors.OrderByDescending(ci => ci.GetParameters().Length)) - { - if (MapDestinationCtorToSource(typeMap, destCtor, sourceTypeInfo, options)) - { - break; - } - } - } - return typeMap; - } - - private bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceTypeInfo, Type destType, Type destMemberType, string destMemberInfo, LinkedList members) - { - return options.MemberConfigurations.Any(_ => _.MapDestinationPropertyToSource(options, sourceTypeInfo, destType, destMemberType, destMemberInfo, members)); - } - - private bool MapDestinationCtorToSource(TypeMap typeMap, ConstructorInfo destCtor, TypeDetails sourceTypeInfo, IProfileConfiguration options) - { - var ctorParameters = destCtor.GetParameters(); - - if (ctorParameters.Length == 0 || !options.ConstructorMappingEnabled) - return false; - - var ctorMap = new ConstructorMap(destCtor, typeMap); - - foreach (var parameter in ctorParameters) - { - var resolvers = new LinkedList(); - - var canResolve = MapDestinationPropertyToSource(options, sourceTypeInfo, destCtor.DeclaringType, parameter.GetType(), parameter.Name, resolvers); - if(!canResolve && parameter.HasDefaultValue) - { - canResolve = true; - } - - ctorMap.AddParameter(parameter, resolvers.ToArray(), canResolve); - } - - typeMap.ConstructorMap = ctorMap; - - return true; - } - } + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace AutoMapper +{ + public class TypeMapFactory + { + public TypeMap CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options) + { + var sourceTypeInfo = options.CreateTypeDetails(sourceType); + var destTypeInfo = options.CreateTypeDetails(destinationType); + + var typeMap = new TypeMap(sourceTypeInfo, destTypeInfo, options); + + foreach (var destProperty in destTypeInfo.PublicWriteAccessors) + { + var resolvers = new LinkedList(); + + if (MapDestinationPropertyToSource(options, sourceTypeInfo, destProperty.DeclaringType, destProperty.GetMemberType(), destProperty.Name, resolvers)) + { + typeMap.AddPropertyMap(destProperty, resolvers); + } + else + { + typeMap.AddExcludeMap(destProperty, resolvers); + } + } + if (!destinationType.IsAbstract()) + { + foreach (var destCtor in destTypeInfo.Constructors.OrderByDescending(ci => ci.GetParameters().Length)) + { + if (MapDestinationCtorToSource(typeMap, destCtor, sourceTypeInfo, options)) + { + break; + } + } + } + return typeMap; + } + + private bool MapDestinationPropertyToSource(ProfileMap options, TypeDetails sourceTypeInfo, Type destType, Type destMemberType, string destMemberInfo, LinkedList members) + { + if(string.IsNullOrEmpty(destMemberInfo)) + { + return false; + } + return options.MemberConfigurations.Any(_ => _.MapDestinationPropertyToSource(options, sourceTypeInfo, destType, destMemberType, destMemberInfo, members)); + } + + private bool MapDestinationCtorToSource(TypeMap typeMap, ConstructorInfo destCtor, TypeDetails sourceTypeInfo, ProfileMap options) + { + var ctorParameters = destCtor.GetParameters(); + + if (ctorParameters.Length == 0 || !options.ConstructorMappingEnabled) + return false; + + var ctorMap = new ConstructorMap(destCtor, typeMap); + + foreach (var parameter in ctorParameters) + { + var resolvers = new LinkedList(); + + var canResolve = MapDestinationPropertyToSource(options, sourceTypeInfo, destCtor.DeclaringType, parameter.GetType(), parameter.Name, resolvers); + if(!canResolve && parameter.IsOptional) + { + canResolve = true; + } + ctorMap.AddParameter(parameter, resolvers.ToArray(), canResolve); + } + + typeMap.ConstructorMap = ctorMap; + + return ctorMap.CanResolve; + } + } } \ No newline at end of file diff --git a/src/AutoMapper/TypeMapRegistry.cs b/src/AutoMapper/TypeMapRegistry.cs deleted file mode 100644 index 3f7c9ae0e7..0000000000 --- a/src/AutoMapper/TypeMapRegistry.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace AutoMapper -{ - using System.Collections.Concurrent; - using System.Collections.Generic; - using Configuration; - - public class TypeMapRegistry - { - private readonly IDictionary _typeMaps = new Dictionary(); - - public IEnumerable TypeMaps => _typeMaps.Values; - - public void RegisterTypeMap(TypeMap typeMap) => _typeMaps[typeMap.Types] = typeMap; - - public TypeMap GetTypeMap(TypePair typePair) => _typeMaps.GetOrDefault(typePair); - } -} \ No newline at end of file diff --git a/src/AutoMapper/TypePair.cs b/src/AutoMapper/TypePair.cs index c0539bb0f3..d0ceb6d823 100644 --- a/src/AutoMapper/TypePair.cs +++ b/src/AutoMapper/TypePair.cs @@ -1,184 +1,208 @@ -namespace AutoMapper -{ - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.Linq; - using System.Reflection; - using Configuration; - - [DebuggerDisplay("{RequestedTypes.SourceType.Name}, {RequestedTypes.DestinationType.Name} : {RuntimeTypes.SourceType.Name}, {RuntimeTypes.DestinationType.Name}")] - public struct MapRequest : IEquatable - { - private readonly int _hashcode; - public TypePair RequestedTypes { get; } - public TypePair RuntimeTypes { get; } - - public MapRequest(TypePair requestedTypes, TypePair runtimeTypes) - { - RequestedTypes = requestedTypes; - RuntimeTypes = runtimeTypes; - _hashcode = unchecked(RequestedTypes.GetHashCode() * 397) ^ RuntimeTypes.GetHashCode(); - } - - public bool Equals(MapRequest other) - { - return RequestedTypes.Equals(other.RequestedTypes) && RuntimeTypes.Equals(other.RuntimeTypes); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - return obj is MapRequest && Equals((MapRequest) obj); - } - - public override int GetHashCode() => _hashcode; - - public static bool operator ==(MapRequest left, MapRequest right) - { - return left.Equals(right); - } - - public static bool operator !=(MapRequest left, MapRequest right) - { - return !left.Equals(right); - } - } - - [DebuggerDisplay("{SourceType.Name}, {DestinationType.Name}")] - public struct TypePair : IEquatable - { - public static bool operator ==(TypePair left, TypePair right) => Equals(left, right); - - public static bool operator !=(TypePair left, TypePair right) => !Equals(left, right); - - public TypePair(Type sourceType, Type destinationType) +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using AutoMapper.Configuration; + +namespace AutoMapper +{ + [DebuggerDisplay("{RequestedTypes.SourceType.Name}, {RequestedTypes.DestinationType.Name} : {RuntimeTypes.SourceType.Name}, {RuntimeTypes.DestinationType.Name}")] + public struct MapRequest : IEquatable + { + public TypePair RequestedTypes { get; } + public TypePair RuntimeTypes { get; } + public ITypeMapConfiguration InlineConfig { get; } + public IMemberMap MemberMap { get; } + + public MapRequest(TypePair requestedTypes, TypePair runtimeTypes, IMemberMap memberMap = null) + : this(requestedTypes, runtimeTypes, new MapperConfiguration.DefaultTypeMapConfig(requestedTypes), memberMap) + { + } + + public MapRequest(TypePair requestedTypes, TypePair runtimeTypes, ITypeMapConfiguration inlineConfig, IMemberMap memberMap = null) + { + RequestedTypes = requestedTypes; + RuntimeTypes = runtimeTypes; + InlineConfig = inlineConfig; + MemberMap = memberMap; + } + + public bool Equals(MapRequest other) => + RequestedTypes.Equals(other.RequestedTypes) && RuntimeTypes.Equals(other.RuntimeTypes) && Equals(MemberMap, other.MemberMap); + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + return obj is MapRequest && Equals((MapRequest) obj); + } + + public override int GetHashCode() { - SourceType = sourceType; - DestinationType = destinationType; - _hashcode = unchecked(SourceType.GetHashCode() * 397) ^ DestinationType.GetHashCode(); - } - - public static TypePair Create(object source, object destination, Type sourceType, Type destinationType) - { - if (source != null && !sourceType.IsNullableType()) - { - sourceType = source.GetType(); - } - if (destination != null && !destinationType.IsNullableType()) - { - destinationType = destination.GetType(); - } - - return new TypePair(sourceType, destinationType); - } - - private readonly int _hashcode; - - public Type SourceType { get; } - - public Type DestinationType { get; } - - public bool Equals(TypePair other) => SourceType == other.SourceType && DestinationType == other.DestinationType; - - public override bool Equals(object obj) => !ReferenceEquals(null, obj) && - (ReferenceEquals(this, obj) || obj.GetType() == GetType() && Equals((TypePair)obj)); - - public override int GetHashCode() => _hashcode; - - public TypePair? GetOpenGenericTypePair() - { - var isGeneric = SourceType.IsGenericType() || DestinationType.IsGenericType(); - if (!isGeneric) + var hashCode = HashCodeCombiner.Combine(RequestedTypes, RuntimeTypes); + if(MemberMap != null) + { + hashCode = HashCodeCombiner.Combine(hashCode, MemberMap.GetHashCode()); + } + return hashCode; + } + + public static bool operator ==(MapRequest left, MapRequest right) => left.Equals(right); + + public static bool operator !=(MapRequest left, MapRequest right) => !left.Equals(right); + } + + [DebuggerDisplay("{SourceType.Name}, {DestinationType.Name}")] + public struct TypePair : IEquatable + { + public static bool operator ==(TypePair left, TypePair right) => left.Equals(right); + public static bool operator !=(TypePair left, TypePair right) => !left.Equals(right); + + public TypePair(Type sourceType, Type destinationType) + { + SourceType = sourceType; + DestinationType = destinationType; + } + + public static TypePair Create(TSource source, Type sourceType, Type destinationType) + { + if(source != null) + { + sourceType = source.GetType(); + } + return new TypePair(sourceType, destinationType); + } + + public static TypePair Create(TSource source, TDestination destination, Type sourceType, Type destinationType) + { + if(source != null) + { + sourceType = source.GetType(); + } + if(destination != null) + { + destinationType = destination.GetType(); + } + return new TypePair(sourceType, destinationType); + } + + public Type SourceType { get; } + + public Type DestinationType { get; } + + public bool Equals(TypePair other) => SourceType == other.SourceType && DestinationType == other.DestinationType; + + public override bool Equals(object other) => other is TypePair && Equals((TypePair)other); + + public override int GetHashCode() => HashCodeCombiner.Combine(SourceType, DestinationType); + + public bool IsGeneric => SourceType.IsGenericType || DestinationType.IsGenericType; + + public bool IsGenericTypeDefinition => SourceType.IsGenericTypeDefinition || DestinationType.IsGenericTypeDefinition; + + public TypePair? GetOpenGenericTypePair() + { + if(!IsGeneric) + { return null; - - var sourceGenericDefinition = SourceType.IsGenericType() ? SourceType.GetGenericTypeDefinition() : SourceType; - var destGenericDefinition = DestinationType.IsGenericType() ? DestinationType.GetGenericTypeDefinition() : DestinationType; - - var genericTypePair = new TypePair(sourceGenericDefinition, destGenericDefinition); - - return genericTypePair; + } + var sourceGenericDefinition = SourceType.IsGenericType() ? SourceType.GetGenericTypeDefinition() : SourceType; + var destinationGenericDefinition = DestinationType.IsGenericType() ? DestinationType.GetGenericTypeDefinition() : DestinationType; + + return new TypePair(sourceGenericDefinition, destinationGenericDefinition); } - public IEnumerable GetRelatedTypePairs() - { - var @this = this; - var subTypePairs = - from destinationType in GetAllTypes(DestinationType) - from sourceType in @this.GetAllTypes(@this.SourceType) - select new TypePair(sourceType, destinationType); - return subTypePairs; - } - - private IEnumerable GetAllTypes(Type type) - { - var typeInheritance = GetTypeInheritance(type); - foreach (var item in typeInheritance) - yield return item; - - var interfaceComparer = new InterfaceComparer(type); - var allInterfaces = type.GetTypeInfo().ImplementedInterfaces.OrderByDescending(t => t, interfaceComparer); - - foreach (var interfaceType in allInterfaces) - { - yield return interfaceType; - } - } - - private static IEnumerable GetTypeInheritance(Type type) - { - yield return type; - - Type baseType = type.BaseType(); - while (baseType != null) - { - yield return baseType; - baseType = baseType.BaseType(); - } - } - - private class InterfaceComparer : IComparer - { - private readonly List _typeInheritance; - - public InterfaceComparer(Type target) - { - _typeInheritance = GetTypeInheritance(target).Select(type => type.GetTypeInfo()).Reverse().ToList(); - } - - public int Compare(Type x, Type y) - { - var xLessOrEqualY = x.IsAssignableFrom(y); - var yLessOrEqualX = y.IsAssignableFrom(x); - - if (xLessOrEqualY & !yLessOrEqualX) - { - return -1; - } - if (!xLessOrEqualY & yLessOrEqualX) - { - return 1; - } - if (xLessOrEqualY & yLessOrEqualX) - { - return 0; - } - - var xFirstIntroduceTypeIndex = _typeInheritance.FindIndex(type => type.ImplementedInterfaces.Contains(x)); - var yFirstIntroduceTypeIndex = _typeInheritance.FindIndex(type => type.ImplementedInterfaces.Contains(y)); - - if (xFirstIntroduceTypeIndex < yFirstIntroduceTypeIndex) - { - return -1; - } - if (yFirstIntroduceTypeIndex > xFirstIntroduceTypeIndex) - { - return 1; - } - - return 0; - } - } + public TypePair CloseGenericTypes(TypePair closedTypes) + { + var sourceArguments = closedTypes.SourceType.GetGenericArguments(); + var destinationArguments = closedTypes.DestinationType.GetGenericArguments(); + if(sourceArguments.Length == 0) + { + sourceArguments = destinationArguments; + } + else if(destinationArguments.Length == 0) + { + destinationArguments = sourceArguments; + } + var closedSourceType = SourceType.IsGenericTypeDefinition() ? SourceType.MakeGenericType(sourceArguments) : SourceType; + var closedDestinationType = DestinationType.IsGenericTypeDefinition() ? DestinationType.MakeGenericType(destinationArguments) : DestinationType; + return new TypePair(closedSourceType, closedDestinationType); + } + + public IEnumerable GetRelatedTypePairs() + { + var @this = this; + var subTypePairs = + from destinationType in GetAllTypes(DestinationType) + from sourceType in GetAllTypes(@this.SourceType) + select new TypePair(sourceType, destinationType); + return subTypePairs; + } + + private static IEnumerable GetAllTypes(Type type) + { + var typeInheritance = type.GetTypeInheritance(); + foreach(var item in typeInheritance) + { + yield return item; + } + var interfaceComparer = new InterfaceComparer(type); + var allInterfaces = type.GetTypeInfo().ImplementedInterfaces.OrderByDescending(t => t, interfaceComparer); + foreach(var interfaceType in allInterfaces) + { + yield return interfaceType; + } + } + + private class InterfaceComparer : IComparer + { + private readonly List _typeInheritance; + + public InterfaceComparer(Type target) + { + _typeInheritance = target.GetTypeInheritance().Select(type => type.GetTypeInfo()).Reverse().ToList(); + } + + public int Compare(Type x, Type y) + { + var xLessOrEqualY = x.IsAssignableFrom(y); + var yLessOrEqualX = y.IsAssignableFrom(x); + + if (xLessOrEqualY & !yLessOrEqualX) + { + return -1; + } + if (!xLessOrEqualY & yLessOrEqualX) + { + return 1; + } + if (xLessOrEqualY & yLessOrEqualX) + { + return 0; + } + + var xFirstIntroduceTypeIndex = _typeInheritance.FindIndex(type => type.ImplementedInterfaces.Contains(x)); + var yFirstIntroduceTypeIndex = _typeInheritance.FindIndex(type => type.ImplementedInterfaces.Contains(y)); + + if (xFirstIntroduceTypeIndex < yFirstIntroduceTypeIndex) + { + return -1; + } + if (yFirstIntroduceTypeIndex > xFirstIntroduceTypeIndex) + { + return 1; + } + + return 0; + } + } + } + + public static class HashCodeCombiner + { + public static int Combine(T1 obj1, T2 obj2) => + CombineCodes(obj1.GetHashCode(), obj2.GetHashCode()); - } -} + public static int CombineCodes(int h1, int h2) => ((h1 << 5) + h1) ^ h2; + } +} diff --git a/src/AutoMapper/ValueConverterConfiguration.cs b/src/AutoMapper/ValueConverterConfiguration.cs new file mode 100644 index 0000000000..cf2fd910b6 --- /dev/null +++ b/src/AutoMapper/ValueConverterConfiguration.cs @@ -0,0 +1,27 @@ +using System; +using System.Linq.Expressions; + +namespace AutoMapper +{ + public class ValueConverterConfiguration + { + public object Instance { get; } + public Type ConcreteType { get; } + public Type InterfaceType { get; } + public LambdaExpression SourceMember { get; set; } + public string SourceMemberName { get; set; } + + public ValueConverterConfiguration(Type concreteType, Type interfaceType) + { + ConcreteType = concreteType; + InterfaceType = interfaceType; + } + + public ValueConverterConfiguration(object instance, Type interfaceType) + { + Instance = instance; + ConcreteType = instance.GetType(); + InterfaceType = interfaceType; + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/ValueResolverConfiguration.cs b/src/AutoMapper/ValueResolverConfiguration.cs index 5c6f978c11..7fc255d1b1 100644 --- a/src/AutoMapper/ValueResolverConfiguration.cs +++ b/src/AutoMapper/ValueResolverConfiguration.cs @@ -1,23 +1,26 @@ +using System; +using System.Linq.Expressions; + namespace AutoMapper { - using System; - using System.Linq.Expressions; - public class ValueResolverConfiguration { public object Instance { get; } - public Type Type { get; } + public Type ConcreteType { get; } + public Type InterfaceType { get; } public LambdaExpression SourceMember { get; set; } public string SourceMemberName { get; set; } - public ValueResolverConfiguration(Type type) + public ValueResolverConfiguration(Type concreteType, Type interfaceType) { - Type = type; + ConcreteType = concreteType; + InterfaceType = interfaceType; } - public ValueResolverConfiguration(object instance) + public ValueResolverConfiguration(object instance, Type interfaceType) { Instance = instance; + InterfaceType = interfaceType; } } } \ No newline at end of file diff --git a/src/AutoMapper/ValueTransformerConfiguration.cs b/src/AutoMapper/ValueTransformerConfiguration.cs new file mode 100644 index 0000000000..a68cec01a6 --- /dev/null +++ b/src/AutoMapper/ValueTransformerConfiguration.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace AutoMapper +{ + public struct ValueTransformerConfiguration + { + public ValueTransformerConfiguration(Type valueType, LambdaExpression transformerExpression) + { + ValueType = valueType; + TransformerExpression = transformerExpression; + } + + public Type ValueType { get; } + public LambdaExpression TransformerExpression { get; } + + public bool IsMatch(IMemberMap memberMap) + => memberMap.DestinationType.IsAssignableFrom(ValueType); + } + + public static class ValueTransformerConfigurationExtensions + { + /// + /// Apply a transformation function after any resolved destination member value with the given type + /// + /// Value type to match and transform + /// Value transformer list + /// Transformation expression + public static void Add(this IList valueTransformers, + Expression> transformer) + { + var config = new ValueTransformerConfiguration(typeof(TValue), transformer); + + valueTransformers.Add(config); + } + } +} \ No newline at end of file diff --git a/src/AutoMapper/project.json b/src/AutoMapper/project.json deleted file mode 100644 index 420d23e732..0000000000 --- a/src/AutoMapper/project.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "version": "5.0.0-beta-*", - "authors": [ "Jimmy Bogard" ], - "owners": [ "Jimmy Bogard" ], - "licenseUrl": "https://github.com/AutoMapper/AutoMapper/blob/master/LICENSE.txt", - "projectUrl": "http://automapper.org", - "iconUrl": "https://s3.amazonaws.com/automapper/icon.png", - "requireLicenseAcceptance": false, - "summary": "A convention-based object-object mapper", - "copyright": "Copyright Jimmy Bogard", - "description": "A convention-based object-object mapper. AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is designed for model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.", - "compilationOptions": { "keyFile": "..\\AutoMapper.snk" }, - "frameworks": { - "net45": { - "compilationOptions": { "define": [ "NET45" ] } - }, - "netstandard1.1": { - "compilationOptions": { "define": [ "PORTABLE" ] }, - "dependencies": { - "Microsoft.CSharp": "4.0.1-rc2-24027", - "NETStandard.Library": "1.5.0-rc2-24027", - "System.Linq.Expressions": "4.0.11-rc2-24027", - "System.Linq.Queryable": "4.0.1-rc2-24027", - "System.Dynamic.Runtime": "4.0.11-rc2-24027" - } - } - } -} diff --git a/src/AutoMapperSamples/AdvancedMappers/Interfaces.cs b/src/AutoMapperSamples/AdvancedMappers/Interfaces.cs deleted file mode 100644 index 3c2c51a401..0000000000 --- a/src/AutoMapperSamples/AdvancedMappers/Interfaces.cs +++ /dev/null @@ -1,50 +0,0 @@ -using AutoMapper; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples -{ - namespace Interfaces - { - [TestFixture] - public class MappingToInterfaces - { - public class OrderForm - { - public Customer Customer { get; set; } - } - - public class Customer - { - public string Name { get; set; } - } - - public interface ICreateOrderMessage - { - string CustomerName { get; set; } - } - - [Test] - public void Example() - { - var mapperConfig = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - mapperConfig.AssertConfigurationIsValid(); - - var mapper = mapperConfig.CreateMapper(); - - var order = new OrderForm - { - Customer = new Customer {Name = "Bob Smith"} - }; - - var message = mapper.Map(order); - - message.CustomerName.ShouldEqual("Bob Smith"); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/AdvancedMappers/MapToExistingObjects.cs b/src/AutoMapperSamples/AdvancedMappers/MapToExistingObjects.cs deleted file mode 100644 index d6e20cdaf8..0000000000 --- a/src/AutoMapperSamples/AdvancedMappers/MapToExistingObjects.cs +++ /dev/null @@ -1,46 +0,0 @@ -using AutoMapper; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples -{ - namespace MapToExistingObjects - { - [TestFixture] - public class ExistingDestinationObjects - { - public class OrderDto - { - public decimal Amount { get; set; } - } - - public class Order - { - public int Id { get; set; } - public decimal Amount { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Id, opt => opt.Ignore()); - }); - - config.AssertConfigurationIsValid(); - - var orderDto = new OrderDto {Amount = 50m}; - - var order = new Order {Id = 4}; - - var mapper = config.CreateMapper(); - - mapper.Map(orderDto, order); - - order.Amount.ShouldEqual(50m); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/AutoMapperSamples.csproj b/src/AutoMapperSamples/AutoMapperSamples.csproj deleted file mode 100644 index abfdc8958d..0000000000 --- a/src/AutoMapperSamples/AutoMapperSamples.csproj +++ /dev/null @@ -1,132 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {277C689D-B1C1-43EA-B20D-C1155C4B2EA7} - Library - Properties - AutoMapperSamples - AutoMapperSamples - v4.5 - 512 - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - false - - - - ..\..\lib\nunit.framework.dll - - - ..\..\lib\Should.dll - - - False - ..\..\lib\StructureMap\StructureMap.dll - - - - 3.5 - - - - - - - - - - - - - - Code - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - {8c955148-fa96-4f0d-880d-abb6770f54e9} - AutoMapper.Net4 - - - - - \ No newline at end of file diff --git a/src/AutoMapperSamples/CommonBaseClassConfiguration.cs b/src/AutoMapperSamples/CommonBaseClassConfiguration.cs deleted file mode 100644 index 98c6b1215b..0000000000 --- a/src/AutoMapperSamples/CommonBaseClassConfiguration.cs +++ /dev/null @@ -1,77 +0,0 @@ -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples -{ - namespace CommonBaseClassConfiguration - { - public class RootDest - { - public int Value1 { get; set; } - public int Value2 { get; set; } - public int Value3 { get; set; } - public int Value4 { get; set; } - public int Value5 { get; set; } - } - - [TestFixture] - public class ProvidingCommonBaseClassConfiguration - { - public class SubDest1 : RootDest - { - public string SomeValue { get; set; } - } - - public class SubDest2 : RootDest - { - public string SomeOtherValue { get; set; } - } - - public class Source1 - { - public string SomeValue { get; set; } - } - - public class Source2 - { - public string SomeOtherValue { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap().FixRootDest(); - cfg.CreateMap().FixRootDest(); - }); - - config.AssertConfigurationIsValid(); - - var mapper = config.CreateMapper(); - - var subDest1 = mapper.Map(new Source1 {SomeValue = "Value1"}); - var subDest2 = mapper.Map(new Source2 {SomeOtherValue = "Value2"}); - - subDest1.SomeValue.ShouldEqual("Value1"); - subDest2.SomeOtherValue.ShouldEqual("Value2"); - } - } - - public static class MappingExpressionExtensions - { - public static IMappingExpression FixRootDest(this IMappingExpression mappingExpression) - where TDestination : RootDest - { - mappingExpression.ForMember(dest => dest.Value1, opt => opt.Ignore()); - mappingExpression.ForMember(dest => dest.Value2, opt => opt.Ignore()); - mappingExpression.ForMember(dest => dest.Value3, opt => opt.Ignore()); - mappingExpression.ForMember(dest => dest.Value4, opt => opt.Ignore()); - mappingExpression.ForMember(dest => dest.Value5, opt => opt.Ignore()); - - return mappingExpression; - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Configuration/Initialization.cs b/src/AutoMapperSamples/Configuration/Initialization.cs deleted file mode 100644 index f20997a8b5..0000000000 --- a/src/AutoMapperSamples/Configuration/Initialization.cs +++ /dev/null @@ -1,37 +0,0 @@ -using AutoMapper; -using NUnit.Framework; -using StructureMap; - -namespace AutoMapperSamples.Configuration -{ - namespace Initialization - { - [TestFixture] - public class InitializationExample - { - public class Order - { - public decimal Amount { get; set; } - } - - public class OrderListViewModel - { - public string Amount { get; set; } - } - - public class OrderEditViewModel - { - public string Amount { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.ConstructServicesUsing(ObjectFactory.GetInstance); - }); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Configuration/Profiles.cs b/src/AutoMapperSamples/Configuration/Profiles.cs deleted file mode 100644 index 2df8891a8e..0000000000 --- a/src/AutoMapperSamples/Configuration/Profiles.cs +++ /dev/null @@ -1,57 +0,0 @@ -using AutoMapper; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples.Configuration -{ - namespace Profiles - { - [TestFixture] - public class SimpleExample - { - public class Order - { - public decimal Amount { get; set; } - } - - public class OrderListViewModel - { - public string Amount { get; set; } - } - - public class OrderEditViewModel - { - public string Amount { get; set; } - } - - public class ViewModelProfile : Profile - { - protected override void Configure() - { - CreateMap(); - - CreateMap().ConvertUsing(value => value.ToString("c")); - } - } - - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.AddProfile(); - cfg.CreateMap(); - }); - - var order = new Order {Amount = 50m}; - - var listViewModel = config.CreateMapper().Map(order); - var editViewModel = config.CreateMapper().Map(order); - - listViewModel.Amount.ShouldEqual(order.Amount.ToString("c")); - editViewModel.Amount.ShouldEqual("50"); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/ConfigurationValidation.cs b/src/AutoMapperSamples/ConfigurationValidation.cs deleted file mode 100644 index 4683892f7d..0000000000 --- a/src/AutoMapperSamples/ConfigurationValidation.cs +++ /dev/null @@ -1,40 +0,0 @@ -using AutoMapper; -using NUnit.Framework; - -namespace AutoMapperSamples -{ - namespace ConfigurationValidation - { - [TestFixture] - public class BadConfigurationThrowing - { - public class Source - { - public int SomeValue { get; set; } - } - - public class Destination - { - public int SomeValuefff { get; set; } - } - - [Test, ExpectedException(typeof(AutoMapperConfigurationException))] - public void Example() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - config.AssertConfigurationIsValid(); // Throws an exception - } - - [Test] - public void ExampleIgnoring() - { - var config = new MapperConfiguration(cfg => - cfg.CreateMap().ForMember(m => m.SomeValuefff, opt => opt.Ignore()) - ); - - config.AssertConfigurationIsValid(); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/CustomValueResolvers.cs b/src/AutoMapperSamples/CustomValueResolvers.cs deleted file mode 100644 index dd2b14fa53..0000000000 --- a/src/AutoMapperSamples/CustomValueResolvers.cs +++ /dev/null @@ -1,69 +0,0 @@ -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples -{ - namespace CustomValueResolvers - { - [TestFixture] - public class CustomResolutionClass - { - public class Source - { - public int Value1 { get; set; } - public int Value2 { get; set; } - } - - public class Destination - { - public int Total { get; set; } - } - - public class CustomResolver : IValueResolver - { - public int Resolve(Source source, ResolutionContext context) - { - return source.Value1 + source.Value2; - } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dest => dest.Total, opt => opt.ResolveUsing())); - config.AssertConfigurationIsValid(); - - var source = new Source - { - Value1 = 5, - Value2 = 7 - }; - - var result = config.CreateMapper().Map(source); - - result.Total.ShouldEqual(12); - } - - [Test] - public void ConstructedExample() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dest => dest.Total, opt => opt.ResolveUsing(new CustomResolver()) - )); - config.AssertConfigurationIsValid(); - - var source = new Source - { - Value1 = 5, - Value2 = 7 - }; - - var result = config.CreateMapper().Map(source); - - result.Total.ShouldEqual(12); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Flattening.cs b/src/AutoMapperSamples/Flattening.cs deleted file mode 100644 index eb9b8f435d..0000000000 --- a/src/AutoMapperSamples/Flattening.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples -{ - namespace Flattening - { - public class Order - { - private readonly IList _orderLineItems = new List(); - - public Customer Customer { get; set; } - - public OrderLineItem[] GetOrderLineItems() - { - return _orderLineItems.ToArray(); - } - - public void AddOrderLineItem(Product product, int quantity) - { - _orderLineItems.Add(new OrderLineItem(product, quantity)); - } - - public decimal GetTotal() - { - return _orderLineItems.Sum(li => li.GetTotal()); - } - } - - public class Product - { - public decimal Price { get; set; } - public string Name { get; set; } - } - - public class OrderLineItem - { - public OrderLineItem(Product product, int quantity) - { - Product = product; - Quantity = quantity; - } - - public Product Product { get; private set; } - public int Quantity { get; private set; } - - public decimal GetTotal() - { - return Quantity * Product.Price; - } - } - - public class Customer - { - public string Name { get; set; } - } - - public class OrderDto - { - public string CustomerName { get; set; } - public decimal Total { get; set; } - } - - [TestFixture] - public class Flattening - { - [Test] - public void Example() - { - // Complex model - var customer = new Customer - { - Name = "George Costanza" - }; - var order = new Order - { - Customer = customer - }; - var bosco = new Product - { - Name = "Bosco", - Price = 4.99m - }; - order.AddOrderLineItem(bosco, 15); - - // Configure AutoMapper - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - // Perform mapping - var mapper = config.CreateMapper(); - OrderDto dto = mapper.Map(order); - - dto.CustomerName.ShouldEqual("George Costanza"); - dto.Total.ShouldEqual(74.85m); - } - } - } - -} \ No newline at end of file diff --git a/src/AutoMapperSamples/GlobalTypeConverters.cs b/src/AutoMapperSamples/GlobalTypeConverters.cs deleted file mode 100644 index 5b360dbb05..0000000000 --- a/src/AutoMapperSamples/GlobalTypeConverters.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Linq.Expressions; -using System.Reflection; -using AutoMapper; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples -{ - namespace GlobalTypeConverters - { - [TestFixture] - public class GlobalTypeConverters - { - public class Source - { - public string Value1 { get; set; } - public string Value2 { get; set; } - public string Value3 { get; set; } - } - - public class Destination - { - public int Value1 { get; set; } - public DateTime Value2 { get; set; } - public Type Value3 { get; set; } - } - - public class DateTimeTypeConverter : ITypeConverter - { - public DateTime Convert(string source, ResolutionContext context) - { - return System.Convert.ToDateTime(source); - } - } - - public class TypeTypeConverter : ITypeConverter - { - public Type Convert(string source, ResolutionContext context) - { - Type type = Assembly.GetExecutingAssembly().GetType(source); - return type; - } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap().ConvertUsing((string s) => Convert.ToInt32(s)); - cfg.CreateMap().ConvertUsing(new DateTimeTypeConverter()); - cfg.CreateMap().ConvertUsing(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - - var source = new Source - { - Value1 = "5", - Value2 = "01/01/2000", - Value3 = "AutoMapperSamples.GlobalTypeConverters.GlobalTypeConverters+Destination" - }; - - var mapper = config.CreateMapper(); - Destination result = mapper.Map(source); - result.Value3.ShouldEqual(typeof(Destination)); - - Expression> func = x => x.Value1; - - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/InversionOfControl.cs b/src/AutoMapperSamples/InversionOfControl.cs deleted file mode 100644 index 9f7556701d..0000000000 --- a/src/AutoMapperSamples/InversionOfControl.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using NUnit.Framework; -using StructureMap; -using StructureMap.Attributes; -using Should; -using StructureMap.Configuration.DSL; - -namespace AutoMapperSamples -{ - namespace InversionOfControl - { - [TestFixture] - public class InversionOfControl - { - private class Source - { - public int Value { get; set; } - } - - private class Destination - { - public int Value { get; set; } - } - - [Test] - public void Example2() - { - ObjectFactory.Initialize(init => - { - init.AddRegistry(); - }); - - var engine = ObjectFactory.GetInstance(); - - var destination = engine.Map(new Source {Value = 15}); - - destination.Value.ShouldEqual(15); - } - - public class ConfigurationRegistry : Registry - { - public ConfigurationRegistry() - { - var configuration = new MapperConfiguration(cfg => cfg.CreateMap()); - - ForRequestedType().TheDefault.Is.ConstructedBy(() => configuration.CreateMapper()); - } - } - } - - - } -} diff --git a/src/AutoMapperSamples/Mappers/Arrays.cs b/src/AutoMapperSamples/Mappers/Arrays.cs deleted file mode 100644 index cbaffa5bcd..0000000000 --- a/src/AutoMapperSamples/Mappers/Arrays.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples.Mappers -{ - namespace Arrays - { - [TestFixture] - public class MappingElementTypes - { - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - var sourceArray = new[] - { - new Source { Value = 5 }, - new Source { Value = 10 }, - new Source { Value = 15 } - }; - - var destArray = config.CreateMapper().Map(sourceArray); - - destArray.Length.ShouldEqual(3); - destArray[0].Value.ShouldEqual(5); - destArray[1].Value.ShouldEqual(10); - destArray[2].Value.ShouldEqual(15); - } - } - - [TestFixture] - public class MappingArrayMemberTypes - { - public class Order - { - private IList _lineItems = new List(); - - public OrderLine[] LineItems { get { return _lineItems.ToArray(); } } - - public void AddLineItem(OrderLine orderLine) - { - _lineItems.Add(orderLine); - } - } - - public class OrderLine - { - public int Quantity { get; set; } - } - - public class OrderDto - { - public OrderLineDto[] LineItems { get; set; } - } - - public class OrderLineDto - { - public int Quantity { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - var order = new Order(); - order.AddLineItem(new OrderLine { Quantity = 5 }); - order.AddLineItem(new OrderLine { Quantity = 15 }); - order.AddLineItem(new OrderLine { Quantity = 25 }); - - var orderDto = config.CreateMapper().Map(order); - - orderDto.LineItems.Length.ShouldEqual(3); - orderDto.LineItems[0].Quantity.ShouldEqual(5); - orderDto.LineItems[1].Quantity.ShouldEqual(15); - orderDto.LineItems[2].Quantity.ShouldEqual(25); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Mappers/AssignableTypes.cs b/src/AutoMapperSamples/Mappers/AssignableTypes.cs deleted file mode 100644 index a0868e9f68..0000000000 --- a/src/AutoMapperSamples/Mappers/AssignableTypes.cs +++ /dev/null @@ -1,45 +0,0 @@ -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples.Mappers -{ - namespace AssignableTypes - { - [TestFixture] - public class Examples - { - public class Foo - { - public int Value { get; set; } - } - - public class Bar : Foo - { - - } - - [Test] - public void SimpleTypeExample() - { - // No configuration needed - var config = new MapperConfiguration(cfg => { }); - var mapper = config.CreateMapper(); - mapper.Map(5).ShouldEqual(5); - mapper.Map("foo").ShouldEqual("foo"); - } - - [Test] - public void ComplexTypeExample() - { - var source = new Bar { Value = 5 }; - - var config = new MapperConfiguration(cfg => { }); - var mapper = config.CreateMapper(); - var dest = mapper.Map(source); - - dest.Value.ShouldEqual(5); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Mappers/Dictionaries.cs b/src/AutoMapperSamples/Mappers/Dictionaries.cs deleted file mode 100644 index 8eb1b8a02a..0000000000 --- a/src/AutoMapperSamples/Mappers/Dictionaries.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples.Mappers -{ - namespace Dictionaries - { - [TestFixture] - public class SimpleExample - { - public class SourceValue - { - public int Value { get; set; } - } - - public class DestValue - { - public int Value { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - var sourceDict = new Dictionary - { - {"First", new SourceValue {Value = 5}}, - {"Second", new SourceValue {Value = 10}}, - {"Third", new SourceValue {Value = 15}} - }; - - var destDict = config.CreateMapper().Map, IDictionary>(sourceDict); - - destDict.Count.ShouldEqual(3); - destDict["First"].Value.ShouldEqual(5); - destDict["Second"].Value.ShouldEqual(10); - destDict["Third"].Value.ShouldEqual(15); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Mappers/Enumerations.cs b/src/AutoMapperSamples/Mappers/Enumerations.cs deleted file mode 100644 index 14adc26b95..0000000000 --- a/src/AutoMapperSamples/Mappers/Enumerations.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples.Mappers -{ - namespace Enumerations - { - [TestFixture] - public class SimpleExample - { - public enum OrderStatus : short - { - InProgress = 0, - Complete = 1 - } - - public enum OrderStatusDto - { - InProgress = 0, - Complete = 1 - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => { }); - var mapper = config.CreateMapper(); - mapper.Map(OrderStatus.InProgress).ShouldEqual(OrderStatusDto.InProgress); - mapper.Map(OrderStatus.Complete).ShouldEqual((short)1); - mapper.Map(OrderStatus.Complete).ShouldEqual("Complete"); - mapper.Map(1).ShouldEqual(OrderStatus.Complete); - mapper.Map("Complete").ShouldEqual(OrderStatus.Complete); - } - - [Test] - public void FlagsEnumerationExample() - { - var config = new MapperConfiguration(cfg => { }); - var mapper = config.CreateMapper(); - var targets = mapper.Map(AttributeTargets.Class | AttributeTargets.Interface); - - (targets & AttributeTargets.Class).ShouldEqual(AttributeTargets.Class); - (targets & AttributeTargets.Interface).ShouldEqual(AttributeTargets.Interface); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Mappers/IListSources.cs b/src/AutoMapperSamples/Mappers/IListSources.cs deleted file mode 100644 index 3b71283069..0000000000 --- a/src/AutoMapperSamples/Mappers/IListSources.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples.Mappers -{ - namespace IListSources - { - [TestFixture] - public class Example - { - private class CustomCollection : IListSource, IEnumerable - { - private List _customList = new List(); - - public IList GetList() - { - return _customList; - } - - public bool ContainsListCollection - { - get { return true; } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return _customList.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return _customList.GetEnumerator(); - } - } - - private class Source - { - public int[] Values { get; set; } - } - - private class Destination - { - public CustomCollection Values { get; set; } - } - - [Test] - public void Should_use_the_underlying_list_to_add_values() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - var destination = config.CreateMapper().Map(new Source { Values = new[] { 1, 2, 3 } }); - - destination.Values.Count().ShouldEqual(3); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Mappers/Lists.cs b/src/AutoMapperSamples/Mappers/Lists.cs deleted file mode 100644 index 235b1990db..0000000000 --- a/src/AutoMapperSamples/Mappers/Lists.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Should; -using NUnit.Framework; -using System.Linq; - -namespace AutoMapperSamples.Mappers -{ - namespace Lists - { - [TestFixture] - public class SimpleExample - { - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - var sources = new[] - { - new Source {Value = 5}, - new Source {Value = 6}, - new Source {Value = 7} - }; - - IEnumerable ienumerableDest = config.CreateMapper().Map>(sources); - ICollection icollectionDest = config.CreateMapper().Map>(sources); - IList ilistDest = config.CreateMapper().Map>(sources); - List listDest = config.CreateMapper().Map>(sources); - - ienumerableDest.Count().ShouldEqual(3); - icollectionDest.Count().ShouldEqual(3); - ilistDest.Count().ShouldEqual(3); - listDest.Count().ShouldEqual(3); - } - } - - [TestFixture] - public class PolymorphicExample - { - public class ParentSource - { - public int Value1 { get; set; } - } - - public class ChildSource : ParentSource - { - public int Value2 { get; set; } - } - - public class ParentDestination - { - public int Value1 { get; set; } - } - - public class ChildDestination : ParentDestination - { - public int Value2 { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include(); - cfg.CreateMap(); - }); - - var sources = new[] - { - new ParentSource(), - new ChildSource(), - new ParentSource() - }; - - var destinations = config.CreateMapper().Map(sources); - - destinations[0].ShouldBeType(); - destinations[1].ShouldBeType(); - destinations[2].ShouldBeType(); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Mappers/Query.cs b/src/AutoMapperSamples/Mappers/Query.cs deleted file mode 100644 index 897b0ce0d8..0000000000 --- a/src/AutoMapperSamples/Mappers/Query.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using AutoMapper; -using AutoMapper.QueryableExtensions; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples.Mappers -{ - namespace Query - { - [TestFixture] - public class SimpleExample - { - readonly Destination[] _destinations = new[] - { - new Destination {DestValue = 5}, - new Destination {DestValue = 4}, - new Destination {DestValue = 7} - }; - - public class Source - { - public int SrcValue { get; set; } - } - - public class Destination - { - public int DestValue { get; set; } - } - - [Test] - public void Select_destinations_items_with_query_by_source_items() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.DestValue, opt => opt.MapFrom(s => s.SrcValue)); - }); - - - IQueryable detsResult = new Source[0] - .AsQueryable() - .Where(s => s.SrcValue > 6) - .Map(_destinations.AsQueryable(), config); - - detsResult.Count().ShouldEqual(1); - detsResult.First().GetType().ShouldEqual(typeof(Destination)); - } - - [Test] - public void Select_source_items_from_destinations() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.DestValue, opt => opt.MapFrom(s => s.SrcValue)) - .ReverseMap(); // reverse map added - }); - - IQueryable sourceResult = new Source[0] - .AsQueryable() - .Where(s => s.SrcValue > 6) - .Map(_destinations.AsQueryable(), config) - .ProjectTo(config); // projection added - - sourceResult.Count().ShouldEqual(1); - sourceResult.First().GetType().ShouldEqual(typeof(Source)); - } - } - } -} diff --git a/src/AutoMapperSamples/Mappers/QuerySourceInjection.cs b/src/AutoMapperSamples/Mappers/QuerySourceInjection.cs deleted file mode 100644 index e40ff5f907..0000000000 --- a/src/AutoMapperSamples/Mappers/QuerySourceInjection.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using AutoMapper; -using AutoMapper.QueryableExtensions; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples.Mappers -{ - namespace QuerySourceInjection - { - [TestFixture] - public class SimpleExample - { - readonly Source[] _source = new[] - { - new Source {SrcValue = 5}, - new Source {SrcValue = 4}, - new Source {SrcValue = 7} - }; - - public class Source - { - public int SrcValue { get; set; } - } - - public class Destination - { - public int DestValue { get; set; } - } - - [Test] - public void Select_source_items_from_destination() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.SrcValue, opt => opt.MapFrom(s => s.DestValue)) - .ReverseMap(); - }); - var mapper = config.CreateMapper(); - - IQueryable result = _source.AsQueryable() - .UseAsDataSource(mapper).For() - .Where(s => s.DestValue > 6); - - result.Count().ShouldEqual(1); - result.First().GetType().ShouldEqual(typeof(Destination)); - } - } - } -} diff --git a/src/AutoMapperSamples/Mappers/TypeConverters.cs b/src/AutoMapperSamples/Mappers/TypeConverters.cs deleted file mode 100644 index 1bfe21fde9..0000000000 --- a/src/AutoMapperSamples/Mappers/TypeConverters.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel; -using NUnit.Framework; - -namespace AutoMapperSamples.Mappers -{ - namespace TypeConverters - { - [TestFixture] - public class CustomTypeConvertersExample - { - public class CustomConverter : TypeConverter - { - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/NestedMappings.cs b/src/AutoMapperSamples/NestedMappings.cs deleted file mode 100644 index 743d367130..0000000000 --- a/src/AutoMapperSamples/NestedMappings.cs +++ /dev/null @@ -1,58 +0,0 @@ -using AutoMapper; -using NUnit.Framework; -using Should; - -namespace AutoMapperSamples -{ - namespace NestedMappings - { - [TestFixture] - public class Sample - { - public class OuterSource - { - public int Value { get; set; } - public InnerSource Inner { get; set; } - } - - public class InnerSource - { - public int OtherValue { get; set; } - } - - public class OuterDest - { - public int Value { get; set; } - public InnerDest Inner { get; set; } - } - - public class InnerDest - { - public int OtherValue { get; set; } - } - - [Test] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - - var source = new OuterSource - { - Value = 5, - Inner = new InnerSource {OtherValue = 15} - }; - - var dest = config.CreateMapper().Map(source); - - dest.Value.ShouldEqual(5); - dest.Inner.ShouldNotBeNull(); - dest.Inner.OtherValue.ShouldEqual(15); - } - } - } -} \ No newline at end of file diff --git a/src/AutoMapperSamples/Projection.cs b/src/AutoMapperSamples/Projection.cs deleted file mode 100644 index 2d4f1bba93..0000000000 --- a/src/AutoMapperSamples/Projection.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using AutoMapper; -using Should; -using NUnit.Framework; - -namespace AutoMapperSamples -{ - namespace Projection - { - public class CalendarEvent - { - public DateTime EventDate { get; set; } - public string Title { get; set; } - } - - public class CalendarEventForm - { - public DateTime EventDate { get; set; } - public int EventHour { get; set; } - public int EventMinute { get; set; } - public string Title { get; set; } - } - - [TestFixture] - public class Projection - { - [Test] - public void Example() - { - // Model - var calendarEvent = new CalendarEvent - { - EventDate = new DateTime(2008, 12, 15, 20, 30, 0), - Title = "Company Holiday Party" - }; - - var config = new MapperConfiguration(cfg => - { - // Configure AutoMapper - cfg.CreateMap() - .ForMember(dest => dest.EventDate, opt => opt.MapFrom(src => src.EventDate.Date)) - .ForMember(dest => dest.EventHour, opt => opt.MapFrom(src => src.EventDate.Hour)) - .ForMember(dest => dest.EventMinute, opt => opt.MapFrom(src => src.EventDate.Minute)); - }); - - // Perform mapping - var mapper = config.CreateMapper(); - CalendarEventForm form = mapper.Map(calendarEvent); - - form.EventDate.ShouldEqual(new DateTime(2008, 12, 15)); - form.EventHour.ShouldEqual(20); - form.EventMinute.ShouldEqual(30); - form.Title.ShouldEqual("Company Holiday Party"); - } - } - } -} \ No newline at end of file diff --git a/src/Benchmark/BenchEngine.cs b/src/Benchmark/BenchEngine.cs index fcd48b4c28..5d7d4d7a17 100644 --- a/src/Benchmark/BenchEngine.cs +++ b/src/Benchmark/BenchEngine.cs @@ -1,36 +1,34 @@ -using System; - -namespace Benchmark -{ - public class BenchEngine - { - private readonly IObjectToObjectMapper _mapper; - private readonly string _mode; - - public BenchEngine(IObjectToObjectMapper mapper, string mode) - { - _mapper = mapper; - _mode = mode; - } - - - public void Start() - { - var timer = new HiPerfTimer(); - - _mapper.Initialize(); - _mapper.Map(); - - timer.Start(); - - for (int i = 0; i < 1000000; i++) - { - _mapper.Map(); - } - - timer.Stop(); - - Console.WriteLine("{0}: - {1} - Mapping time: \t{2}s", _mapper.Name, _mode, timer.Duration); - } - } +using System; +using System.Diagnostics; + +namespace Benchmark +{ + public class BenchEngine + { + private readonly IObjectToObjectMapper _mapper; + private readonly string _mode; + + public BenchEngine(IObjectToObjectMapper mapper, string mode) + { + _mapper = mapper; + _mode = mode; + } + + public void Start() + { + _mapper.Initialize(); + _mapper.Map(); + + var timer = Stopwatch.StartNew(); + + for(int i = 0; i < 1000000; i++) + { + _mapper.Map(); + } + + timer.Stop(); + + Console.WriteLine("{0}: - {1} - Mapping time: \t{2}s", _mapper.Name, _mode, timer.Elapsed.TotalSeconds); + } + } } \ No newline at end of file diff --git a/src/Benchmark/Benchmark.csproj b/src/Benchmark/Benchmark.csproj index a02cd0a421..8d94ea726c 100644 --- a/src/Benchmark/Benchmark.csproj +++ b/src/Benchmark/Benchmark.csproj @@ -1,115 +1,12 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {B8051389-CB47-46FB-B234-9D49506704AA} + net461 Exe - Properties - Benchmark - Benchmark - v4.5 - 512 - false - ..\AutoMapper.snk - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - false - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - + - - {8c955148-fa96-4f0d-880d-abb6770f54e9} - AutoMapper.Net4 - + - - + \ No newline at end of file diff --git a/src/Benchmark/FlatteningMapper.cs b/src/Benchmark/FlatteningMapper.cs index 3ead65a3ea..462401185b 100644 --- a/src/Benchmark/FlatteningMapper.cs +++ b/src/Benchmark/FlatteningMapper.cs @@ -1,438 +1,633 @@ -using System; -using AutoMapper; - -namespace Benchmark.Flattening -{ - - public class CtorMapper : IObjectToObjectMapper - { - private Model11 _model; - private IMapper _mapper; - - public string Name => "CtorMapper"; - - public void Initialize() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - _mapper = config.CreateMapper(); - _model = new Model11 { Value = 5 }; - } - - public object Map() - { - return _mapper.Map(_model); - } - } - - public class ManualCtorMapper : IObjectToObjectMapper - { - private Model11 _model; - - public string Name => "ManualCtorMapper"; - - public void Initialize() - { - _model = new Model11 { Value = 5 }; - } - - public object Map() - { - return new Dto11(_model.Value); - } - } - - public class FlatteningMapper : IObjectToObjectMapper - { - private ModelObject _source; - private IMapper _mapper; - - public string Name - { - get { return "AutoMapper"; } - } - - public void Initialize() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - _source = new ModelObject - { - BaseDate = new DateTime(2007, 4, 5), - Sub = new ModelSubObject - { - ProperName = "Some name", - SubSub = new ModelSubSubObject - { - IAmACoolProperty = "Cool daddy-o" - } - }, - Sub2 = new ModelSubObject - { - ProperName = "Sub 2 name" - }, - SubWithExtraName = new ModelSubObject - { - ProperName = "Some other name" - }, - }; - _mapper = config.CreateMapper(); - } - - public object Map() - { - return _mapper.Map(_source); - } - } - - public class ManualMapper : IObjectToObjectMapper - { - private ModelObject _source; - - public string Name - { - get { return "Manual"; } - } - - public void Initialize() - { - _source = new ModelObject - { - BaseDate = new DateTime(2007, 4, 5), - Sub = new ModelSubObject - { - ProperName = "Some name", - SubSub = new ModelSubSubObject - { - IAmACoolProperty = "Cool daddy-o" - } - }, - Sub2 = new ModelSubObject - { - ProperName = "Sub 2 name" - }, - SubWithExtraName = new ModelSubObject - { - ProperName = "Some other name" - }, - }; - } - - public object Map() - { - return new ModelDto - { - BaseDate = _source.BaseDate, - Sub2ProperName = _source.Sub2.ProperName, - SubProperName = _source.Sub.ProperName, - SubSubSubIAmACoolProperty = _source.Sub.SubSub.IAmACoolProperty, - SubWithExtraNameProperName = _source.SubWithExtraName.ProperName - }; - } - } - - public class EquilvalentManualMapper : IObjectToObjectMapper - { - private object _source; - private PropertyMap _propertyMap = null; - private ResolutionContext _context; - - public string Name - { - get { return "Manual"; } - } - - public void Initialize() - { - _source = new ModelObject - { - BaseDate = new DateTime(2007, 4, 5), - Sub = new ModelSubObject - { - ProperName = "Some name", - SubSub = new ModelSubSubObject - { - IAmACoolProperty = "Cool daddy-o" - } - }, - Sub2 = new ModelSubObject - { - ProperName = "Sub 2 name" - }, - SubWithExtraName = new ModelSubObject - { - ProperName = "Some other name" - }, - }; - _context = new ResolutionContext(_source, null, new TypePair(typeof(ModelObject), typeof(ModelDto)), null, new Mapper(new MapperConfiguration(_ => { }))); - } - - public object Map() - { - if (_source == null) - { - return null; - } - else - { - ModelDto mapObj; - ModelObject mapFrom; - mapFrom = (ModelObject)_source; - mapObj = _context.DestinationValue != null ? (ModelDto)_context.DestinationValue : new ModelDto(); - - BeforeMap(mapObj); - - try - { - mapObj.BaseDate = mapFrom == null ? default(DateTime) : mapFrom.BaseDate; - } - catch (AutoMapperMappingException e) - { - e.PropertyMap = _propertyMap; - throw; - } - catch (Exception e) - { - throw new AutoMapperMappingException(_context, e, _propertyMap); - } - - try - { - mapObj.Sub2ProperName = mapFrom == null ? default(string) : mapFrom.Sub2 == null ? default(string) : mapFrom.Sub2.ProperName; - } - catch (AutoMapperMappingException e) - { - e.PropertyMap = _propertyMap; - throw; - } - catch (Exception e) - { - throw new AutoMapperMappingException(_context, e, _propertyMap); - } - - try - { - mapObj.SubProperName = mapFrom == null ? default(string) : mapFrom.Sub == null ? default(string) : mapFrom.Sub.ProperName; - } - catch (AutoMapperMappingException e) - { - e.PropertyMap = _propertyMap; - throw; - } - catch (Exception e) - { - throw new AutoMapperMappingException(_context, e, _propertyMap); - } - - try - { - mapObj.SubSubSubIAmACoolProperty = mapFrom == null ? default(string) - : mapFrom.Sub == null ? default(string) - : mapFrom.Sub.SubSub == null ? default(string) - : mapFrom.Sub.SubSub.IAmACoolProperty; - } - catch (AutoMapperMappingException e) - { - e.PropertyMap = _propertyMap; - throw; - } - catch (Exception e) - { - throw new AutoMapperMappingException(_context, e, _propertyMap); - } - - try - { - mapObj.SubWithExtraNameProperName = mapFrom == null ? default(string) - : mapFrom.SubWithExtraName == null ? default(string) - : mapFrom.SubWithExtraName.ProperName; - } - catch (AutoMapperMappingException e) - { - e.PropertyMap = _propertyMap; - throw; - } - catch (Exception e) - { - throw new AutoMapperMappingException(_context, e, _propertyMap); - } - - AfterMap(mapObj); - - return mapObj; - } - - - } - - public void BeforeMap(object obj) - { - - } - public void AfterMap(object obj) - { - - } - } - - public class Model1 - { - public int Value { get; set; } - } - - public class Model2 - { - public int Value { get; set; } - } - - public class Model3 - { - public int Value { get; set; } - } - - public class Model4 - { - public int Value { get; set; } - } - - public class Model5 - { - public int Value { get; set; } - } - - public class Model6 - { - public int Value { get; set; } - } - - public class Model7 - { - public int Value { get; set; } - } - - public class Model8 - { - public int Value { get; set; } - } - - public class Model9 - { - public int Value { get; set; } - } - - public class Model10 - { - public int Value { get; set; } - } - - public class Model11 - { - public int Value { get; set; } - } - - public class Dto1 - { - public int Value { get; set; } - } - - public class Dto2 - { - public int Value { get; set; } - } - - public class Dto3 - { - public int Value { get; set; } - } - - public class Dto4 - { - public int Value { get; set; } - } - - public class Dto5 - { - public int Value { get; set; } - } - - public class Dto6 - { - public int Value { get; set; } - } - - public class Dto7 - { - public int Value { get; set; } - } - - public class Dto8 - { - public int Value { get; set; } - } - - public class Dto9 - { - public int Value { get; set; } - } - - public class Dto10 - { - public int Value { get; set; } - } - - public class Dto11 - { - public Dto11(int value) - { - _value = value; - } - - private readonly int _value; - - public int Value - { - get { return _value; } - } - } - - public class ModelObject - { - public DateTime BaseDate { get; set; } - public ModelSubObject Sub { get; set; } - public ModelSubObject Sub2 { get; set; } - public ModelSubObject SubWithExtraName { get; set; } - } - - public class ModelSubObject - { - public string ProperName { get; set; } - public ModelSubSubObject SubSub { get; set; } - } - - public class ModelSubSubObject - { - public string IAmACoolProperty { get; set; } - } - - public class ModelDto - { - public DateTime BaseDate { get; set; } - public string SubProperName { get; set; } - public string Sub2ProperName { get; set; } - public string SubWithExtraNameProperName { get; set; } - public string SubSubSubIAmACoolProperty { get; set; } - } - +using System; +using AutoMapper; + + +namespace Benchmark.Flattening +{ + using System.Collections.Generic; + using System.Linq; + + public class DeepTypeMapper : IObjectToObjectMapper + { + private Customer _customer; + private IMapper _mapper; + public string Name { get; } = "Deep Types"; + public void Initialize() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + _mapper = config.CreateMapper(); + _customer = new Customer() + { + Address = new Address() { City = "istanbul", Country = "turkey", Id = 1, Street = "istiklal cad." }, + HomeAddress = new Address() { City = "istanbul", Country = "turkey", Id = 2, Street = "istiklal cad." }, + Id = 1, + Name = "Eduardo Najera", + Credit = 234.7m, + WorkAddresses = new List
() + { + new Address() {City = "istanbul", Country = "turkey", Id = 5, Street = "istiklal cad."}, + new Address() {City = "izmir", Country = "turkey", Id = 6, Street = "konak"} + }, + Addresses = new List
() + { + new Address() {City = "istanbul", Country = "turkey", Id = 3, Street = "istiklal cad."}, + new Address() {City = "izmir", Country = "turkey", Id = 4, Street = "konak"} + }.ToArray() + }; + } + + public object Map() + { + return _mapper.Map(_customer); + } + + public class Address + { + public int Id { get; set; } + public string Street { get; set; } + public string City { get; set; } + public string Country { get; set; } + } + + public class AddressDTO + { + public int Id { get; set; } + public string City { get; set; } + public string Country { get; set; } + } + + public class Customer + { + public int Id { get; set; } + public string Name { get; set; } + public decimal? Credit { get; set; } + public Address Address { get; set; } + public Address HomeAddress { get; set; } + public Address[] Addresses { get; set; } + public List
WorkAddresses { get; set; } + } + + public class CustomerDTO + { + public int Id { get; set; } + public string Name { get; set; } + public Address Address { get; set; } + public AddressDTO HomeAddress { get; set; } + public AddressDTO[] Addresses { get; set; } + public List WorkAddresses { get; set; } + public string AddressCity { get; set; } + } + + } + + public class ManualDeepTypeMapper : IObjectToObjectMapper + { + private Customer _customer; + public string Name { get; } = "Manual Deep Types"; + public void Initialize() + { + _customer = new Customer() + { + Address = new Address() { City = "istanbul", Country = "turkey", Id = 1, Street = "istiklal cad." }, + HomeAddress = new Address() { City = "istanbul", Country = "turkey", Id = 2, Street = "istiklal cad." }, + Id = 1, + Name = "Eduardo Najera", + Credit = 234.7m, + WorkAddresses = new List
() + { + new Address() {City = "istanbul", Country = "turkey", Id = 5, Street = "istiklal cad."}, + new Address() {City = "izmir", Country = "turkey", Id = 6, Street = "konak"} + }, + Addresses = new List
() + { + new Address() {City = "istanbul", Country = "turkey", Id = 3, Street = "istiklal cad."}, + new Address() {City = "izmir", Country = "turkey", Id = 4, Street = "konak"} + }.ToArray() + }; + } + + public object Map() + { + var dto = new CustomerDTO(); + + dto.Id = _customer.Id; + dto.Name = _customer.Name; + dto.AddressCity = _customer.Address.City; + + dto.Address = new Address() { Id = _customer.Address.Id, Street = _customer.Address.Street, Country = _customer.Address.Country, City = _customer.Address.City }; + + dto.HomeAddress = new AddressDTO() { Id = _customer.HomeAddress.Id, Country = _customer.HomeAddress.Country, City = _customer.HomeAddress.City }; + + dto.Addresses = new AddressDTO[_customer.Addresses.Length]; + for (int i = 0; i < _customer.Addresses.Length; i++) + { + dto.Addresses[i] = new AddressDTO() { Id = _customer.Addresses[i].Id, Country = _customer.Addresses[i].Country, City = _customer.Addresses[i].City }; + } + + dto.WorkAddresses = new List(); + foreach (var workAddress in _customer.WorkAddresses) + { + dto.WorkAddresses.Add(new AddressDTO() { Id = workAddress.Id, Country = workAddress.Country, City = workAddress.City }); + } + + return dto; + } + + public class Address + { + public int Id { get; set; } + public string Street { get; set; } + public string City { get; set; } + public string Country { get; set; } + } + + public class AddressDTO + { + public int Id { get; set; } + public string City { get; set; } + public string Country { get; set; } + } + + public class Customer + { + public int Id { get; set; } + public string Name { get; set; } + public decimal? Credit { get; set; } + public Address Address { get; set; } + public Address HomeAddress { get; set; } + public Address[] Addresses { get; set; } + public ICollection
WorkAddresses { get; set; } + } + + public class CustomerDTO + { + public int Id { get; set; } + public string Name { get; set; } + public Address Address { get; set; } + public AddressDTO HomeAddress { get; set; } + public AddressDTO[] Addresses { get; set; } + public List WorkAddresses { get; set; } + public string AddressCity { get; set; } + } + + } + + public class ComplexTypeMapper : IObjectToObjectMapper + { + private Foo _foo; + public string Name { get; } = "Complex Types"; + private IMapper _mapper; + + + public void Initialize() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + _mapper = config.CreateMapper(); + _foo = Foo.New(); + } + + public object Map() + { + var dest = _mapper.Map(_foo); + return dest; + } + } + + public class Foo + { + public static Foo New() => new Foo + { + Name = "foo", + Int32 = 12, + Int64 = 123123, + NullInt = 16, + DateTime = DateTime.Now, + Doublen = 2312112, + Foo1 = new InnerFoo { Name = "foo one" }, + Foos = new List + { + new InnerFoo {Name = "j1", Int64 = 123, NullInt = 321}, + new InnerFoo {Name = "j2", Int32 = 12345, NullInt = 54321}, + new InnerFoo {Name = "j3", Int32 = 12345, NullInt = 54321}, + }, + FooArr = new[] + { + new InnerFoo {Name = "a1"}, + new InnerFoo {Name = "a2"}, + new InnerFoo {Name = "a3"}, + }, + IntArr = new[] { 1, 2, 3, 4, 5 }, + Ints = new[] { 7, 8, 9 }, + }; + + public string Name { get; set; } + + public int Int32 { get; set; } + + public long Int64 { set; get; } + + public int? NullInt { get; set; } + + public float Floatn { get; set; } + + public double Doublen { get; set; } + + public DateTime DateTime { get; set; } + + public InnerFoo Foo1 { get; set; } + + public List Foos { get; set; } + + public InnerFoo[] FooArr { get; set; } + + public int[] IntArr { get; set; } + + public int[] Ints { get; set; } + } + + public class InnerFoo + { + public string Name { get; set; } + public int Int32 { get; set; } + public long Int64 { set; get; } + public int? NullInt { get; set; } + } + + public class InnerFooDest + { + public string Name { get; set; } + public int Int32 { get; set; } + public long Int64 { set; get; } + public int? NullInt { get; set; } + } + + public class FooDest + { + public string Name { get; set; } + + public int Int32 { get; set; } + + public long Int64 { set; get; } + + public int? NullInt { get; set; } + + public float Floatn { get; set; } + + public double Doublen { get; set; } + + public DateTime DateTime { get; set; } + + public InnerFooDest Foo1 { get; set; } + + public List Foos { get; set; } + + public InnerFooDest[] FooArr { get; set; } + + public int[] IntArr { get; set; } + + public int[] Ints { get; set; } + } + + public class ManualComplexTypeMapper : IObjectToObjectMapper + { + private Foo _foo; + public string Name { get; } = "Manual Complex Types"; + + public void Initialize() + { + _foo = Foo.New(); + } + + public object Map() + { + var dest = new FooDest + { + Name = _foo.Name, + Int32 = _foo.Int32, + Int64 = _foo.Int64, + NullInt = _foo.NullInt, + DateTime = _foo.DateTime, + Doublen = _foo.Doublen, + Foo1 = new InnerFooDest { Name = _foo.Foo1.Name }, + Foos = new List(_foo.Foos.Count), + FooArr = new InnerFooDest[_foo.Foos.Count], + IntArr = new int[_foo.IntArr.Length], + Ints = _foo.Ints.ToArray(), + }; + foreach(var foo in _foo.Foos) + { + dest.Foos.Add(new InnerFooDest { Name = foo.Name, Int64 = foo.Int64, NullInt = foo.NullInt }); + } + ; + for(int index = 0; index < _foo.Foos.Count; index++) + { + var foo = _foo.Foos[index]; + dest.FooArr[index] = new InnerFooDest { Name = foo.Name, Int64 = foo.Int64, NullInt = foo.NullInt }; + } + Array.Copy(_foo.IntArr, dest.IntArr, _foo.IntArr.Length); + return dest; + } + } + + + public class CtorMapper : IObjectToObjectMapper + { + private Model11 _model; + + public string Name => "CtorMapper"; + + private IMapper _mapper; + + public void Initialize() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + config.AssertConfigurationIsValid(); + _mapper = config.CreateMapper(); + _model = new Model11 { Value = 5 }; + } + + public object Map() + { + return _mapper.Map(_model); + } + } + + public class ManualCtorMapper : IObjectToObjectMapper + { + private Model11 _model; + + public string Name => "ManualCtorMapper"; + + public void Initialize() + { + _model = new Model11 { Value = 5 }; + } + + public object Map() + { + return new Dto11(_model.Value); + } + } + + public class FlatteningMapper : IObjectToObjectMapper + { + private ModelObject _source; + private IMapper _mapper; + + public string Name + { + get { return "AutoMapper"; } + } + + public void Initialize() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + _mapper = config.CreateMapper(); + _source = new ModelObject + { + BaseDate = new DateTime(2007, 4, 5), + Sub = new ModelSubObject + { + ProperName = "Some name", + SubSub = new ModelSubSubObject + { + IAmACoolProperty = "Cool daddy-o" + } + }, + Sub2 = new ModelSubObject + { + ProperName = "Sub 2 name" + }, + SubWithExtraName = new ModelSubObject + { + ProperName = "Some other name" + }, + }; + } + + public object Map() + { + return _mapper.Map(_source); + } + } + + public class ManualMapper : IObjectToObjectMapper + { + private ModelObject _source; + + public string Name + { + get { return "Manual"; } + } + + public void Initialize() + { + _source = new ModelObject + { + BaseDate = new DateTime(2007, 4, 5), + Sub = new ModelSubObject + { + ProperName = "Some name", + SubSub = new ModelSubSubObject + { + IAmACoolProperty = "Cool daddy-o" + } + }, + Sub2 = new ModelSubObject + { + ProperName = "Sub 2 name" + }, + SubWithExtraName = new ModelSubObject + { + ProperName = "Some other name" + }, + }; + } + + public object Map() + { + return new ModelDto + { + BaseDate = _source.BaseDate, + Sub2ProperName = _source.Sub2.ProperName, + SubProperName = _source.Sub.ProperName, + SubSubSubIAmACoolProperty = _source.Sub.SubSub.IAmACoolProperty, + SubWithExtraNameProperName = _source.SubWithExtraName.ProperName + }; + } + } + + public class Model1 + { + public int Value { get; set; } + } + + public class Model2 + { + public int Value { get; set; } + } + + public class Model3 + { + public int Value { get; set; } + } + + public class Model4 + { + public int Value { get; set; } + } + + public class Model5 + { + public int Value { get; set; } + } + + public class Model6 + { + public int Value { get; set; } + } + + public class Model7 + { + public int Value { get; set; } + } + + public class Model8 + { + public int Value { get; set; } + } + + public class Model9 + { + public int Value { get; set; } + } + + public class Model10 + { + public int Value { get; set; } + } + + public class Model11 + { + public int Value { get; set; } + } + + public class Dto1 + { + public int Value { get; set; } + } + + public class Dto2 + { + public int Value { get; set; } + } + + public class Dto3 + { + public int Value { get; set; } + } + + public class Dto4 + { + public int Value { get; set; } + } + + public class Dto5 + { + public int Value { get; set; } + } + + public class Dto6 + { + public int Value { get; set; } + } + + public class Dto7 + { + public int Value { get; set; } + } + + public class Dto8 + { + public int Value { get; set; } + } + + public class Dto9 + { + public int Value { get; set; } + } + + public class Dto10 + { + public int Value { get; set; } + } + + public class Dto11 + { + public Dto11(int value) + { + _value = value; + } + + private readonly int _value; + + public int Value + { + get { return _value; } + } + } + + public class ModelObject + { + public DateTime BaseDate { get; set; } + public ModelSubObject Sub { get; set; } + public ModelSubObject Sub2 { get; set; } + public ModelSubObject SubWithExtraName { get; set; } + } + + public class ModelSubObject + { + public string ProperName { get; set; } + public ModelSubSubObject SubSub { get; set; } + } + + public class ModelSubSubObject + { + public string IAmACoolProperty { get; set; } + } + + public class ModelDto + { + public DateTime BaseDate { get; set; } + public string SubProperName { get; set; } + public string Sub2ProperName { get; set; } + public string SubWithExtraNameProperName { get; set; } + public string SubSubSubIAmACoolProperty { get; set; } + } + } \ No newline at end of file diff --git a/src/Benchmark/HiPerfTimer.cs b/src/Benchmark/HiPerfTimer.cs index d5d2b5ce97..e179d07b09 100644 --- a/src/Benchmark/HiPerfTimer.cs +++ b/src/Benchmark/HiPerfTimer.cs @@ -1,58 +1,58 @@ -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Threading; - -namespace Benchmark -{ - public class HiPerfTimer - { - [DllImport("Kernel32.dll")] - private static extern bool QueryPerformanceCounter( - out long lpPerformanceCount); - - [DllImport("Kernel32.dll")] - private static extern bool QueryPerformanceFrequency( - out long lpFrequency); - - private long _startTime, _stopTime; - private long _freq; - - // Constructor - public HiPerfTimer() - { - _startTime = 0; - _stopTime = 0; - - if (QueryPerformanceFrequency(out _freq) == false) - { - // high-performance counter not supported - throw new Win32Exception(); - } - } - - // Start the timer - public void Start() - { - // lets do the waiting threads there work - Thread.Sleep(0); - - QueryPerformanceCounter(out _startTime); - } - - // Stop the timer - public void Stop() - { - QueryPerformanceCounter(out _stopTime); - } - - // Returns the duration of the timer (in seconds) - public double Duration - { - get - { - double d = (_stopTime - _startTime); - return d / _freq; - } - } - } +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Threading; + +namespace Benchmark +{ + public class HiPerfTimer + { + [DllImport("Kernel32.dll")] + private static extern bool QueryPerformanceCounter( + out long lpPerformanceCount); + + [DllImport("Kernel32.dll")] + private static extern bool QueryPerformanceFrequency( + out long lpFrequency); + + private long _startTime, _stopTime; + private long _freq; + + // Constructor + public HiPerfTimer() + { + _startTime = 0; + _stopTime = 0; + + if (QueryPerformanceFrequency(out _freq) == false) + { + // high-performance counter not supported + throw new Win32Exception(); + } + } + + // Start the timer + public void Start() + { + // lets do the waiting threads there work + Thread.Sleep(0); + + QueryPerformanceCounter(out _startTime); + } + + // Stop the timer + public void Stop() + { + QueryPerformanceCounter(out _stopTime); + } + + // Returns the duration of the timer (in seconds) + public double Duration + { + get + { + double d = (_stopTime - _startTime); + return d / _freq; + } + } + } } \ No newline at end of file diff --git a/src/Benchmark/IObjectToObjectMapper.cs b/src/Benchmark/IObjectToObjectMapper.cs index 9b5125af78..e276d52e45 100644 --- a/src/Benchmark/IObjectToObjectMapper.cs +++ b/src/Benchmark/IObjectToObjectMapper.cs @@ -1,11 +1,11 @@ -using System; - -namespace Benchmark -{ - public interface IObjectToObjectMapper - { - string Name { get; } - void Initialize(); - object Map(); - } +using System; + +namespace Benchmark +{ + public interface IObjectToObjectMapper + { + string Name { get; } + void Initialize(); + object Map(); + } } \ No newline at end of file diff --git a/src/Benchmark/Program.cs b/src/Benchmark/Program.cs index 91a29c57f2..be307931ab 100644 --- a/src/Benchmark/Program.cs +++ b/src/Benchmark/Program.cs @@ -1,31 +1,32 @@ -using System; -using System.Collections.Generic; -using Benchmark.Flattening; - -namespace Benchmark -{ - public class Program - { - public static void Main(string[] args) - { - var mappers = new Dictionary - { - { "Flattening", new IObjectToObjectMapper[] { new FlatteningMapper(), new ManualMapper(), new EquilvalentManualMapper(), } }, - { "Ctors", new IObjectToObjectMapper[] { new CtorMapper(), new ManualCtorMapper(), } } - }; - //var mappers = new Dictionary - //{ - // {"Flattening", new IObjectToObjectMapper[] {new FlatteningMapper()}}, - //}; - - - foreach (var pair in mappers) - { - foreach (var mapper in pair.Value) - { - new BenchEngine(mapper, pair.Key).Start(); - } - } - } - } -} +using System; +using System.Collections.Generic; +using System.Security; +using Benchmark.Flattening; + +[assembly: AllowPartiallyTrustedCallers] +//[assembly: SecurityTransparent] +//[assembly: SecurityRules(SecurityRuleSet.Level2, SkipVerificationInFullTrust = true)] + +namespace Benchmark +{ + public class Program + { + public static void Main(string[] args) + { + var mappers = new Dictionary + { + { "Flattening", new IObjectToObjectMapper[] { new FlatteningMapper() , new ManualMapper(), } }, + { "Ctors", new IObjectToObjectMapper[] { new CtorMapper(), new ManualCtorMapper(), } }, + { "Complex", new IObjectToObjectMapper[] { new ComplexTypeMapper(), new ManualComplexTypeMapper() } }, + { "Deep", new IObjectToObjectMapper[] { new DeepTypeMapper(), new ManualDeepTypeMapper() } } + }; + foreach(var pair in mappers) + { + foreach(var mapper in pair.Value) + { + new BenchEngine(mapper, pair.Key).Start(); + } + } + } + } +} diff --git a/src/Benchmark/Properties/AssemblyInfo.cs b/src/Benchmark/Properties/AssemblyInfo.cs deleted file mode 100644 index 5fd16e795d..0000000000 --- a/src/Benchmark/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Benchmark")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Benchmark")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2ddfeb26-68a9-4f6f-9d76-83f0b3e925a9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Benchmark/app.config b/src/Benchmark/app.config deleted file mode 100644 index b7a7ef1660..0000000000 --- a/src/Benchmark/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/CommonAssemblyInfo.cs b/src/CommonAssemblyInfo.cs deleted file mode 100644 index 72cbea0d77..0000000000 --- a/src/CommonAssemblyInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.4927 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -[assembly: CLSCompliant(true)] diff --git a/src/IntegrationTests.Net4/IntegrationTests.Net4.csproj b/src/IntegrationTests.Net4/IntegrationTests.Net4.csproj deleted file mode 100644 index 6922d81a4c..0000000000 --- a/src/IntegrationTests.Net4/IntegrationTests.Net4.csproj +++ /dev/null @@ -1,111 +0,0 @@ - - - - - Debug - AnyCPU - {906F2125-2AEC-44A3-A95F-CB79C0A745BB} - Library - Properties - AutoMapper.IntegrationTests.Net4 - AutoMapper.IntegrationTests.Net4 - v4.5 - 512 - ..\ - true - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll - True - - - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll - True - - - ..\packages\Fixie.1.0.0.41\lib\net45\Fixie.dll - True - - - ..\..\lib\Rhino.Mocks.dll - - - ..\..\lib\Should.dll - - - - - - - - - - - - - AutoMapperSpecBase.cs - - - XUnitConventions.cs - - - - - - - - - - - - - - - - - - - - - Designer - - - - - {8c955148-fa96-4f0d-880d-abb6770f54e9} - AutoMapper.Net4 - - - - - - - - - \ No newline at end of file diff --git a/src/IntegrationTests.Net4/ProjectToAbstractType.cs b/src/IntegrationTests.Net4/ProjectToAbstractType.cs deleted file mode 100644 index 809d863bcc..0000000000 --- a/src/IntegrationTests.Net4/ProjectToAbstractType.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Data.Entity; -using System.Linq; -using AutoMapper.QueryableExtensions; -using AutoMapper.UnitTests; -using Should; -using Xunit; - -namespace AutoMapper.IntegrationTests.Net4 -{ - public class ProjectToAbstractType : AutoMapperSpecBase - { - ITypeA[] _destinations; - - public interface ITypeA - { - int ID { get; set; } - string Name { get; set; } - } - - public class ConcreteTypeA : ITypeA - { - public int ID { get; set; } - public string Name { get; set; } - } - - public class DbEntityA - { - public int ID { get; set; } - public string Name { get; set; } - } - - public class DatabaseInitializer : CreateDatabaseIfNotExists - { - protected override void Seed(Context context) - { - context.EntityA.AddRange(new[] - { - new DbEntityA { ID = 1, Name = "Alain Brito"}, - new DbEntityA { ID = 2, Name = "Jimmy Bogard"}, - new DbEntityA { ID = 3, Name = "Bill Gates"} - }); - base.Seed(context); - } - } - public class Context : DbContext - { - public Context() - { - Database.SetInitializer(new DatabaseInitializer()); - } - - public DbSet EntityA { get; set; } - } - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap().As(); - cfg.CreateMap(); - }); - - [Fact] - public void Should_project_to_abstract_type() - { - using(var context = new Context()) - { - _destinations = context.EntityA.ProjectTo(Configuration).ToArray(); - } - _destinations.Length.ShouldEqual(3); - _destinations[2].Name.ShouldEqual("Bill Gates"); - } - } -} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/Properties/AssemblyInfo.cs b/src/IntegrationTests.Net4/Properties/AssemblyInfo.cs deleted file mode 100644 index f3c97d3d11..0000000000 --- a/src/IntegrationTests.Net4/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("IntegrationTests.Net4")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("IntegrationTests.Net4")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a5f3918b-6db7-4377-9b7e-bf9e6df2d68b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/IntegrationTests.Net4/TestDbConfiguration.cs b/src/IntegrationTests.Net4/TestDbConfiguration.cs deleted file mode 100644 index 7368c58e36..0000000000 --- a/src/IntegrationTests.Net4/TestDbConfiguration.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Data.Entity; -using System.Data.Entity.Infrastructure; - -namespace AutoMapper.IntegrationTests.Net4 -{ - public class TestDbConfiguration : DbConfiguration - { - public TestDbConfiguration() - { - var env = Environment.GetEnvironmentVariable("APPVEYOR"); - if (env != null) - { - SetDefaultConnectionFactory( - new SqlConnectionFactory(@"Server=(local)\SQL2014;Database=master;User ID=sa;Password=Password12!")); - } - else - { - SetDefaultConnectionFactory(new LocalDbConnectionFactory("v12.0")); - } - } - } -} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/packages.config b/src/IntegrationTests.Net4/packages.config deleted file mode 100644 index 4c28bff755..0000000000 --- a/src/IntegrationTests.Net4/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/IntegrationTests.Net4/App.config b/src/IntegrationTests/App.config similarity index 91% rename from src/IntegrationTests.Net4/App.config rename to src/IntegrationTests/App.config index fbde0c8dcb..b63cdc70ad 100644 --- a/src/IntegrationTests.Net4/App.config +++ b/src/IntegrationTests/App.config @@ -14,4 +14,7 @@ + + + \ No newline at end of file diff --git a/src/IntegrationTests/AutoMapper.IntegrationTests.csproj b/src/IntegrationTests/AutoMapper.IntegrationTests.csproj new file mode 100644 index 0000000000..a02bf4c7fd --- /dev/null +++ b/src/IntegrationTests/AutoMapper.IntegrationTests.csproj @@ -0,0 +1,43 @@ + + + + net461 + AutoMapper.IntegrationTests + AutoMapper.IntegrationTests + true + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/IntegrationTests/BuiltInTypes/ByteArray.cs b/src/IntegrationTests/BuiltInTypes/ByteArray.cs new file mode 100644 index 0000000000..4c1ad6b648 --- /dev/null +++ b/src/IntegrationTests/BuiltInTypes/ByteArray.cs @@ -0,0 +1,75 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + + public class ByteArrayColumns : AutoMapperSpecBase + { + public class Customer + { + [Key] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + + public byte[] RowVersion { get; set; } + } + + public class CustomerViewModel + { + public string FirstName { get; set; } + public string LastName { get; set; } + public byte[] RowVersion { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + RowVersion = new byte[] { 1, 2, 3 } + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + var customerVms = ProjectTo(context.Customers).ToList(); + customerVms.ForEach(x => + { + x.RowVersion.SequenceEqual(new byte[] { 1, 2, 3 }).ShouldBeTrue(); + }); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/BuiltInTypes/NullableToNonNullable.cs b/src/IntegrationTests/BuiltInTypes/NullableToNonNullable.cs new file mode 100644 index 0000000000..615a1f6520 --- /dev/null +++ b/src/IntegrationTests/BuiltInTypes/NullableToNonNullable.cs @@ -0,0 +1,131 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + + public class NullableLongToLong : AutoMapperSpecBase + { + public class Customer + { + [Key] + public long? Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class CustomerViewModel + { + public long Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + var model = ProjectTo(context.Customers).Single(); + model.Id.ShouldBe(1); + model.FirstName.ShouldBe("Bob"); + model.LastName.ShouldBe("Smith"); + } + } + } + + public class NullableIntToLong : AutoMapperSpecBase + { + public class Customer + { + [Key] + public int? Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class CustomerViewModel + { + public long Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Can_map_with_projection() + { + using(var context = new Context()) + { + var model = ProjectTo(context.Customers).Single(); + model.Id.ShouldBe(1); + model.FirstName.ShouldBe("Bob"); + model.LastName.ShouldBe("Smith"); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/BuiltInTypes/ProjectEnumerableOfIntToList.cs b/src/IntegrationTests/BuiltInTypes/ProjectEnumerableOfIntToList.cs new file mode 100644 index 0000000000..7c55fa6119 --- /dev/null +++ b/src/IntegrationTests/BuiltInTypes/ProjectEnumerableOfIntToList.cs @@ -0,0 +1,77 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + using System.Collections.Generic; + + public class ProjectEnumerableOfIntToList : AutoMapperSpecBase + { + public class Customer + { + [Key] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public List Items { get; set; } + } + + public class Item + { + public int Id { get; set; } + } + + public class CustomerViewModel + { + public string FirstName { get; set; } + public string LastName { get; set; } + public List ItemsIds { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + Items = new List(new[] { new Item { Id = 1 }, new Item { Id = 3 }, new Item { Id = 3 } }) + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d=>d.ItemsIds, o=>o.MapFrom(s=>s.Items.Select(i=>i.Id))); + }); + + [Fact] + public void Can_map_with_projection() + { + using(var context = new Context()) + { + var customer = ProjectTo(context.Customers).Single(); + customer.ItemsIds.SequenceEqual(new int[] { 1, 2, 3 }).ShouldBeTrue(); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/BuiltInTypes/ProjectUsing.cs b/src/IntegrationTests/BuiltInTypes/ProjectUsing.cs new file mode 100644 index 0000000000..5f1ae848a6 --- /dev/null +++ b/src/IntegrationTests/BuiltInTypes/ProjectUsing.cs @@ -0,0 +1,141 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Xunit; +using Shouldly; + +namespace AutoMapper.IntegrationTests.Net4 +{ + using UnitTests; + using QueryableExtensions; + + public class ProjectUsingWithNullables : AutoMapperSpecBase + { + public class MyProfile : Profile + { + public MyProfile() + { + CreateMap(); + CreateMap().ConvertUsing(x => (MyEnum)x); + CreateMap().ConvertUsing(x => x.HasValue ? (MyEnum)x.Value : MyEnum.Value1); + } + } + + public enum MyEnum + { + Value1 = 0, + Value2 = 1 + } + + public class MyTable + { + public int Id { get; set; } + public int EnumValue { get; set; } + public int? EnumValueNullable { get; set; } + } + + public class MyTableModel + { + public int Id { get; set; } + public MyEnum EnumValue { get; set; } + public MyEnum EnumValueNullable { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(TestContext context) + { + context.MyTable.AddRange(new[]{ + new MyTable { Id = 1, EnumValue = (int)MyEnum.Value2 }, + new MyTable { Id = 2, EnumValueNullable = (int?)MyEnum.Value1 }, + }); + base.Seed(context); + } + } + + public class TestContext : DbContext + { + public TestContext() + { + Database.SetInitializer(new DatabaseInitializer()); + } + public DbSet MyTable { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.AddProfile()); + + [Fact] + public void Should_project_ok() + { + using(var context = new TestContext()) + { + var results = ProjectTo(context.MyTable).ToList(); + results[0].Id.ShouldBe(1); + results[0].EnumValue.ShouldBe(MyEnum.Value2); + results[0].EnumValueNullable.ShouldBe(MyEnum.Value1); + results[1].Id.ShouldBe(2); + results[1].EnumValue.ShouldBe(MyEnum.Value1); + results[1].EnumValueNullable.ShouldBe(MyEnum.Value1); + } + } + } + + public class ProjectUsingBug : AutoMapperSpecBase + { + public class Parent + { + [Key] + public int ID { get; set; } + public string ParentTitle { get; set; } + + public ICollection Children { get; set; } + } + + public class Children + { + public int ID { get; set; } + public string ChildTitle { get; set; } + } + + public class ParentVM + { + [Key] + public int ID { get; set; } + public string ParentTitle { get; set; } + public List Children { get; set; } + } + + public partial class ApplicationDBContext : DbContext + { + public ApplicationDBContext() + { + Database.SetInitializer(new CreateDatabaseIfNotExists()); + } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + modelBuilder.Entity() + .HasMany(x => x.Children); + } + + public DbSet Parents { get; set; } + public DbSet Children { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ConvertUsing(c => c.ID); + }); + + [Fact] + public void can_map_with_projection() + { + using (var db = new ApplicationDBContext()) + { + var result = ProjectTo(db.Parents); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/ChildClassTests.cs b/src/IntegrationTests/ChildClassTests.cs similarity index 83% rename from src/IntegrationTests.Net4/ChildClassTests.cs rename to src/IntegrationTests/ChildClassTests.cs index 62e5992039..1854b34059 100644 --- a/src/IntegrationTests.Net4/ChildClassTests.cs +++ b/src/IntegrationTests/ChildClassTests.cs @@ -1,114 +1,114 @@ -using System.ComponentModel.DataAnnotations; -using System.Data.Entity; -using System.Linq; -using Xunit; -using Should; - -namespace AutoMapper.IntegrationTests.Net4 -{ - namespace ChildClassTests - { - using AutoMapper.UnitTests; - using QueryableExtensions; - - public class Base - { - public int BaseID { get; set; } - - [Required] - public string Base1 { get; set; } - - [Required] - public virtual Sub Sub { get; set; } - } - - public class BaseDTO - { - public int BaseID { get; set; } - public string Base1 { get; set; } - public virtual SubDTO Sub { get; set; } - } - - public class Sub - { - [Key] - public int BaseId { get; set; } - - [Required] - public string Sub1 { get; set; } - } - - public class SubDTO - { - public string Sub1 { get; set; } - } - - public class TestContext : DbContext - { - public TestContext() - : base() - { - Database.SetInitializer(new DatabaseInitializer()); - } - - public DbSet Bases { get; set; } - public DbSet Subs { get; set; } - - } - - public class DatabaseInitializer : DropCreateDatabaseAlways - { - protected override void Seed(TestContext testContext) - { - testContext.Bases.Add(new Base() { BaseID = 1, Base1 = "base1", Sub = new Sub() { BaseId = 1, Sub1 = "sub1" } }); - - base.Seed(testContext); - } - } - - - public class UnitTest : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - [Fact] - public void AutoMapperEFRelationsTest() - { - using (var context = new TestContext()) - { - var baseEntitiy = context.Bases.FirstOrDefault(); - baseEntitiy.ShouldNotBeNull(); - baseEntitiy.BaseID.ShouldEqual(1); - baseEntitiy.Sub.Sub1.ShouldEqual("sub1"); - } - - using (var context = new TestContext()) - { - var baseDTO = context.Bases.Select(b => new BaseDTO - { - Base1 = b.Base1, - BaseID = b.BaseID, - Sub = new SubDTO - { - Sub1 = b.Sub.Sub1, - } - }).FirstOrDefault(); - baseDTO.ShouldNotBeNull(); - baseDTO.BaseID.ShouldEqual(1); - baseDTO.Sub.Sub1.ShouldEqual("sub1"); - - - baseDTO = context.Bases.ProjectTo(Configuration).FirstOrDefault(); - baseDTO.ShouldNotBeNull(); - baseDTO.BaseID.ShouldEqual(1); - baseDTO.Sub.Sub1.ShouldEqual("sub1"); - } - } - } - - } +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Xunit; +using Shouldly; + +namespace AutoMapper.IntegrationTests.Net4 +{ + namespace ChildClassTests + { + using AutoMapper.UnitTests; + using QueryableExtensions; + + public class Base + { + public int BaseID { get; set; } + + [Required] + public string Base1 { get; set; } + + [Required] + public virtual Sub Sub { get; set; } + } + + public class BaseDTO + { + public int BaseID { get; set; } + public string Base1 { get; set; } + public virtual SubDTO Sub { get; set; } + } + + public class Sub + { + [Key] + public int BaseId { get; set; } + + [Required] + public string Sub1 { get; set; } + } + + public class SubDTO + { + public string Sub1 { get; set; } + } + + public class TestContext : DbContext + { + public TestContext() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Bases { get; set; } + public DbSet Subs { get; set; } + + } + + public class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(TestContext testContext) + { + testContext.Bases.Add(new Base() { BaseID = 1, Base1 = "base1", Sub = new Sub() { BaseId = 1, Sub1 = "sub1" } }); + + base.Seed(testContext); + } + } + + + public class UnitTest : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void AutoMapperEFRelationsTest() + { + using (var context = new TestContext()) + { + var baseEntitiy = context.Bases.FirstOrDefault(); + baseEntitiy.ShouldNotBeNull(); + baseEntitiy.BaseID.ShouldBe(1); + baseEntitiy.Sub.Sub1.ShouldBe("sub1"); + } + + using (var context = new TestContext()) + { + var baseDTO = context.Bases.Select(b => new BaseDTO + { + Base1 = b.Base1, + BaseID = b.BaseID, + Sub = new SubDTO + { + Sub1 = b.Sub.Sub1, + } + }).FirstOrDefault(); + baseDTO.ShouldNotBeNull(); + baseDTO.BaseID.ShouldBe(1); + baseDTO.Sub.Sub1.ShouldBe("sub1"); + + + baseDTO = ProjectTo(context.Bases).FirstOrDefault(); + baseDTO.ShouldNotBeNull(); + baseDTO.BaseID.ShouldBe(1); + baseDTO.Sub.Sub1.ShouldBe("sub1"); + } + } + } + + } } \ No newline at end of file diff --git a/src/IntegrationTests.Net4/CustomMapFromTest.cs b/src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs similarity index 92% rename from src/IntegrationTests.Net4/CustomMapFromTest.cs rename to src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs index afe932e739..bb0e575a45 100644 --- a/src/IntegrationTests.Net4/CustomMapFromTest.cs +++ b/src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs @@ -1,116 +1,115 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Data.Entity; -using System.Linq; -using Xunit; -using Assert = Should.Core.Assertions.Assert; -using Should; - -namespace AutoMapper.IntegrationTests.Net4 -{ - namespace CustomMapFromTest - { - using AutoMapper.UnitTests; - using QueryableExtensions; - - public class Customer - { - [Key] - public int Id { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - - public Address Address { get; set; } - } - - public class Address - { - [Key] - public int Id { get; set; } - public string Street { get; set; } - public string City { get; set; } - public string State { get; set; } - } - - public class CustomerViewModel - { - public string FirstName { get; set; } - public string LastName { get; set; } - - public string FullAddress { get; set; } - } - - public class Context : DbContext - { - public Context() - : base() - { - Database.SetInitializer(new DatabaseInitializer()); - } - - public DbSet Customers { get; set; } - public DbSet
Addresses { get; set; } - - } - - public class DatabaseInitializer : CreateDatabaseIfNotExists - { - protected override void Seed(Context context) - { - context.Customers.Add(new Customer - { - Id = 1, - FirstName = "Bob", - LastName = "Smith", - Address = new Address - { - Id = 1, - Street = "123 Anywhere", - City = "Austin", - State = "TX" - } - }); - - base.Seed(context); - } - } - - public class AutoMapperQueryableExtensionsThrowsNullReferenceExceptionSpec : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(x => x.FullAddress, - o => o.MapFrom(c => c.Address.Street + ", " + c.Address.City + " " + c.Address.State)); - }); - - [Fact] - public void can_map_with_projection() - { - using (var context = new Context()) - { - var customerVms = context.Customers.Select(c => new CustomerViewModel - { - FirstName = c.FirstName, - LastName = c.LastName, - FullAddress = c.Address.Street + ", " + c.Address.City + " " + c.Address.State - }).ToList(); - - customerVms.ForEach(x => - { - x.FullAddress.ShouldNotBeNull(); - x.FullAddress.ShouldNotBeEmpty(); - }); - - customerVms = context.Customers.ProjectTo(Configuration).ToList(); - customerVms.ForEach(x => - { - x.FullAddress.ShouldNotBeNull(); - x.FullAddress.ShouldNotBeEmpty(); - }); - } - } - } - } +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Xunit; +using Shouldly; + +namespace AutoMapper.IntegrationTests.Net4 +{ + namespace CustomMapFromTest + { + using AutoMapper.UnitTests; + using QueryableExtensions; + + public class Customer + { + [Key] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + + public Address Address { get; set; } + } + + public class Address + { + [Key] + public int Id { get; set; } + public string Street { get; set; } + public string City { get; set; } + public string State { get; set; } + } + + public class CustomerViewModel + { + public string FirstName { get; set; } + public string LastName { get; set; } + + public string FullAddress { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + public DbSet
Addresses { get; set; } + + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + Address = new Address + { + Id = 1, + Street = "123 Anywhere", + City = "Austin", + State = "TX" + } + }); + + base.Seed(context); + } + } + + public class AutoMapperQueryableExtensionsThrowsNullReferenceExceptionSpec : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(x => x.FullAddress, + o => o.MapFrom(c => c.Address.Street + ", " + c.Address.City + " " + c.Address.State)); + }); + + [Fact] + public void can_map_with_projection() + { + using (var context = new Context()) + { + var customerVms = context.Customers.Select(c => new CustomerViewModel + { + FirstName = c.FirstName, + LastName = c.LastName, + FullAddress = c.Address.Street + ", " + c.Address.City + " " + c.Address.State + }).ToList(); + + customerVms.ForEach(x => + { + x.FullAddress.ShouldNotBeNull(); + x.FullAddress.ShouldNotBeEmpty(); + }); + + customerVms = ProjectTo(context.Customers).ToList(); + customerVms.ForEach(x => + { + x.FullAddress.ShouldNotBeNull(); + x.FullAddress.ShouldNotBeEmpty(); + }); + } + } + } + } } \ No newline at end of file diff --git a/src/IntegrationTests/CustomMapFrom/MapObjectPropertyFromSubQuery.cs b/src/IntegrationTests/CustomMapFrom/MapObjectPropertyFromSubQuery.cs new file mode 100644 index 0000000000..5517bdde05 --- /dev/null +++ b/src/IntegrationTests/CustomMapFrom/MapObjectPropertyFromSubQuery.cs @@ -0,0 +1,847 @@ +using System; +using Shouldly; +using System.Linq; +using System.Collections.Generic; +using AutoMapper.UnitTests; +using System.Data.Entity; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; + using System.Linq.Expressions; + using QueryableExtensions; + + public class MapObjectPropertyFromSubQueryTypeNameMax : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Price, o => o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault())); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_cache_the_subquery() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.Products); + var counter = new FirstOrDefaultCounter(); + counter.Visit(projection.Expression); + counter.Count.ShouldBe(1); + var productModel = projection.First(); + productModel.Price.RegionId.ShouldBe((short)1); + productModel.Price.IsDefault.ShouldBeTrue(); + productModel.Price.Id.ShouldBe(1); + productModel.Id.ShouldBe(1); + } + } + + class FirstOrDefaultCounter : ExpressionVisitor + { + public int Count; + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if(node.Method.Name == "FirstOrDefault") + { + Count++; + } + return base.VisitMethodCall(node); + } + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + public int Value { get; } + [NotMapped] + public int NotMappedValue { get; set; } + public virtual List
OtherArticles { get; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName1 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName2 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName3 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName4 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName5 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName6 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName7 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName8 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName9 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName10 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName11 { get; set; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Price { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName1 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName2 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName3 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName4 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName5 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName6 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName7 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName8 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName9 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName10 { get; set; } + public int VeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnNameVeryLongColumnName11 { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 1 } } }); + } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Products { get; set; } + } + } + + public class MapObjectPropertyFromSubQueryExplicitExpansion : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Price, o => + { + o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault()); + o.ExplicitExpansion(); + }); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_map_ok() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.Products); + var counter = new FirstOrDefaultCounter(); + counter.Visit(projection.Expression); + counter.Count.ShouldBe(0); + var productModel = projection.First(); + productModel.Price.ShouldBeNull(); + productModel.Id.ShouldBe(1); + } + } + + class FirstOrDefaultCounter : ExpressionVisitor + { + public int Count; + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if(node.Method.Name == "FirstOrDefault") + { + Count++; + } + return base.VisitMethodCall(node); + } + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + public int Value { get; } + public virtual List
OtherArticles { get; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Price { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 1 } } }); + } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Products { get; set; } + } + } + + public class MapObjectPropertyFromSubQuery : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap() + .ForMember(d => d.Price, o => o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault())); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_cache_the_subquery() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.Products); + var counter = new FirstOrDefaultCounter(); + counter.Visit(projection.Expression); + counter.Count.ShouldBe(1); + var productModel = projection.First(); + productModel.Price.RegionId.ShouldBe((short)1); + productModel.Price.IsDefault.ShouldBeTrue(); + productModel.Price.Id.ShouldBe(1); + productModel.Id.ShouldBe(1); + } + } + + class FirstOrDefaultCounter : ExpressionVisitor + { + public int Count; + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if(node.Method.Name == "FirstOrDefault") + { + Count++; + } + return base.VisitMethodCall(node); + } + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + public int Value { get; } + [NotMapped] + public int NotMappedValue { get; set; } + public virtual List
OtherArticles { get; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Price { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 1 } } }); + } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Products { get; set; } + } + } + + public class MapObjectPropertyFromSubQueryWithInnerObject : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(d => d.Price, o => o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault())); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_cache_the_subquery() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.ProductArticles); + var counter = new FirstOrDefaultCounter(); + counter.Visit(projection.Expression); + counter.Count.ShouldBe(2); + var productArticleModel = projection.First(); + var productModel = productArticleModel.Product; + productModel.Price.RegionId.ShouldBe((short)1); + productModel.Price.IsDefault.ShouldBeTrue(); + productModel.Price.Id.ShouldBe(1); + productModel.Id.ShouldBe(1); + var otherProductModel = productArticleModel.OtherProduct; + otherProductModel.Price.RegionId.ShouldBe((short)1); + otherProductModel.Price.IsDefault.ShouldBeTrue(); + otherProductModel.Price.Id.ShouldBe(2); + otherProductModel.Id.ShouldBe(2); + } + } + + class FirstOrDefaultCounter : ExpressionVisitor + { + public int Count; + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if(node.Method.Name == "FirstOrDefault") + { + Count++; + } + return base.VisitMethodCall(node); + } + } + + public class ProductArticle + { + public int Id { get; set; } + public Product Product { get; set; } + public Product OtherProduct { get; set; } + } + + public class ProductArticleModel + { + public int Id { get; set; } + public ProductModel Product { get; set; } + public ProductModel OtherProduct { get; set; } + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Price { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var product1 = context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 1 } } }); + var product2 = context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 2 } } }); + context.ProductArticles.Add(new ProductArticle { Product = product1, OtherProduct = product2 }); + } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Products { get; set; } + public DbSet ProductArticles { get; set; } + } + } + + public class MapObjectPropertyFromSubQueryWithCollection : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(d => d.Price, o => o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault())); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_cache_the_subquery() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.ProductArticles); + var counter = new FirstOrDefaultCounter(); + counter.Visit(projection.Expression); + counter.Count.ShouldBe(1); + var productModel = projection.First().Products.First(); + productModel.Price.RegionId.ShouldBe((short)1); + productModel.Price.IsDefault.ShouldBeTrue(); + productModel.Price.Id.ShouldBe(1); + productModel.Id.ShouldBe(1); + } + } + + class FirstOrDefaultCounter : ExpressionVisitor + { + public int Count; + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if(node.Method.Name == "FirstOrDefault") + { + Count++; + } + return base.VisitMethodCall(node); + } + } + + public class ProductArticle + { + public int Id { get; set; } + public ICollection Products { get; set; } + } + + public class ProductArticleModel + { + public int Id { get; set; } + public ICollection Products { get; set; } + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Price { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var product = context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 1 } } }); + context.ProductArticles.Add(new ProductArticle { Products = new[] { product } }); + } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Products { get; set; } + public DbSet ProductArticles { get; set; } + } + } + + public class MapObjectPropertyFromSubQueryWithCollectionSameName : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(d=>d.ArticlesModel, o=>o.MapFrom(s=>s)) + .ForMember(d => d.Articles, o => o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault())); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_cache_the_subquery() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.ProductArticles); + var counter = new FirstOrDefaultCounter(); + counter.Visit(projection.Expression); + counter.Count.ShouldBe(1); + var productModel = projection.First().Products.First(); + Check(productModel.Articles); + productModel.Id.ShouldBe(1); + productModel.ArticlesCount.ShouldBe(1); + productModel.ArticlesModel.Articles.Count.ShouldBe(1); + Check(productModel.ArticlesModel.Articles.Single()); + } + } + + private static void Check(PriceModel priceModel) + { + priceModel.RegionId.ShouldBe((short)1); + priceModel.IsDefault.ShouldBeTrue(); + priceModel.Id.ShouldBe(1); + } + + class FirstOrDefaultCounter : ExpressionVisitor + { + public int Count; + + protected override Expression VisitMethodCall(MethodCallExpression node) + { + if(node.Method.Name == "FirstOrDefault") + { + Count++; + } + return base.VisitMethodCall(node); + } + } + + public class ProductArticle + { + public int Id { get; set; } + public ICollection Products { get; set; } + } + + public class ProductArticleModel + { + public int Id { get; set; } + public ICollection Products { get; set; } + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Articles { get; set; } + public int ArticlesCount { get; set; } + public ArticlesModel ArticlesModel { get; set; } + } + + public class ArticlesModel + { + public ICollection Articles { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var product = context.Products.Add(new Product { ECommercePublished = true, Articles = new[] { new Article { IsDefault = true, NationId = 1, ProductId = 1 } } }); + context.ProductArticles.Add(new ProductArticle { Products = new[] { product } }); + } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Products { get; set; } + public DbSet ProductArticles { get; set; } + } + } + + public class SubQueryWithMapFromNullable : AutoMapperSpecBase + { + // Source Types + public class Cable + { + public int CableId { get; set; } + public ICollection Ends { get; set; } = new List(); + } + + public class CableEnd + { + [ForeignKey(nameof(CrossConnectId))] + public virtual Cable CrossConnect { get; set; } + [Column(Order = 0), Key] + public int CrossConnectId { get; set; } + [Column(Order = 1), Key] + public string Name { get; set; } + [ForeignKey(nameof(RackId))] + public virtual Rack Rack { get; set; } + public int? RackId { get; set; } + } + + public class DataHall + { + public int DataHallId { get; set; } + public int DataCentreId { get; set; } + public ICollection Racks { get; set; } = new List(); + } + + public class Rack + { + public int RackId { get; set; } + [ForeignKey(nameof(DataHallId))] + public virtual DataHall DataHall { get; set; } + public int DataHallId { get; set; } + } + + // Dest Types + public class CableListModel + { + public int CableId { get; set; } + public CableEndModel AEnd { get; set; } + public CableEndModel AnotherEnd { get; set; } + } + + public class CableEndModel + { + public string Name { get; set; } + public int? DataHallId { get; set; } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + + public DbSet Cables { get; set; } + public DbSet CableEnds { get; set; } + public DbSet DataHalls { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var rack = new Rack(); + var dh = new DataHall { DataCentreId = 10, Racks = { rack } }; + context.DataHalls.Add(dh); + var cable = new Cable + { + Ends = new List() + { + new CableEnd { Name = "A", Rack = rack}, + new CableEnd { Name = "B" }, + } + }; + context.Cables.Add(cable); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(dest => dest.DataHallId, opt => opt.MapFrom(src => src.Rack.DataHall.DataCentreId)); + cfg.CreateMap() + .ForMember(dest => dest.AEnd, opt => opt.MapFrom(src => src.Ends.FirstOrDefault(x => x.Name == "A"))) + .ForMember(dest => dest.AnotherEnd, opt => opt.MapFrom(src => src.Ends.FirstOrDefault(x => x.Name == "B"))); + }); + + [Fact] + public void Should_project_ok() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.Cables); + var result = projection.Single(); + result.AEnd.DataHallId.ShouldBe(10); + result.AnotherEnd.DataHallId.ShouldBeNull(); + } + } + } + + public class MapObjectPropertyFromSubQueryCustomSource : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(dest => dest.Owner, opt => opt.MapFrom(src => src.Owners.FirstOrDefault())); + cfg.CreateMap() + .ForMember(dest => dest.Brand, opt => opt.MapFrom(src => src.Product.Brand)); + }); + + public class Owner + { + public int Id { get; set; } + public string Name { get; set; } + } + public class Brand + { + public int Id { get; set; } + public List Owners { get; set; } = new List(); + } + public class Product + { + public int Id { get; set; } + public Brand Brand { get; set; } + } + public class ProductReview + { + public int Id { get; set; } + public Product Product { get; set; } + } + /* Destination types */ + public class ProductReviewDto + { + public int Id { get; set; } + public BrandDto Brand { get; set; } + } + public class BrandDto + { + public int Id { get; set; } + public OwnerDto Owner { get; set; } + } + public class OwnerDto + { + public int Id { get; set; } + public string Name { get; set; } + } + + class ClientContext : DbContext + { + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + Database.SetInitializer(new Initializer()); + } + public DbSet Owners { get; set; } + public DbSet Products { get; set; } + public DbSet Brands { get; set; } + public DbSet ProductReviews { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + context.ProductReviews.AddRange(new[]{ + new ProductReview { Product = new Product { Brand = new Brand{ Owners = { new Owner{ Name = "Owner" } } } } }, + new ProductReview { Product = new Product { Brand = new Brand { } } }, + new ProductReview { Product = new Product { } } }); + } + } + + [Fact] + public void Should_project_ok() + { + using(var context = new ClientContext()) + { + var projection = ProjectTo(context.ProductReviews); + var results = projection.ToArray(); + results[0].Brand.Owner.Name.ShouldBe("Owner"); + results[1].Brand.Owner.ShouldBeNull(); + results[2].Brand.ShouldBeNull(); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/ExpandCollections.cs b/src/IntegrationTests/ExplicitExpansion/ExpandCollections.cs similarity index 89% rename from src/IntegrationTests.Net4/ExpandCollections.cs rename to src/IntegrationTests/ExplicitExpansion/ExpandCollections.cs index 600c987221..d7b1f64f3e 100644 --- a/src/IntegrationTests.Net4/ExpandCollections.cs +++ b/src/IntegrationTests/ExplicitExpansion/ExpandCollections.cs @@ -1,115 +1,115 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Data.Entity; -using System.Linq; -using AutoMapper.QueryableExtensions; -using AutoMapper.UnitTests; -using Xunit; -using Should; -using System.Diagnostics; - -namespace AutoMapper.IntegrationTests.Net4 -{ - public class ExpandCollections : AutoMapperSpecBase - { - TrainingCourseDto _course; - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap().ForMember(c => c.Category, o => o.ExplicitExpansion()); - }); - - protected override void Because_of() - { - using(var context = new ClientContext()) - { - context.Database.Log = s => Trace.WriteLine(s); - _course = context.TrainingCourses.ProjectTo(Configuration, c => c.Content.Select(co => co.Category)).FirstOrDefault(n => n.CourseName == "Course 1"); - } - } - - - [Fact] - public void Should_expand_collections_items() - { - _course.Content[0].Category.CategoryName.ShouldEqual("Category 1"); - } - - class Initializer : DropCreateDatabaseAlways - { - protected override void Seed(ClientContext context) - { - var category = new Category { CategoryName = "Category 1" }; - var course = new TrainingCourse { CourseName = "Course 1" }; - context.TrainingCourses.Add(course); - var content = new TrainingContent { ContentName = "Content 1", Category = category }; - context.TrainingContents.Add(content); - course.Content.Add(content); - } - } - - class ClientContext : DbContext - { - public ClientContext() - { - Database.SetInitializer(new Initializer()); - } - public DbSet Categories { get; set; } - public DbSet TrainingCourses { get; set; } - public DbSet TrainingContents { get; set; } - } - - public class TrainingCourse - { - [Key] - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual IList Content { get; set; } = new List(); - } - - public class TrainingContent - { - [Key] - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public Category Category { get; set; } - } - - public class Category - { - public int CategoryId { get; set; } - public string CategoryName { get; set; } - } - - - public class TrainingCourseDto - { - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual IList Content { get; set; } - } - - public class CategoryDto - { - public int CategoryId { get; set; } - public string CategoryName { get; set; } - } - - public class TrainingContentDto - { - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public CategoryDto Category { get; set; } - } - } +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Xunit; +using Shouldly; +using System.Diagnostics; + +namespace AutoMapper.IntegrationTests.Net4 +{ + public class ExpandCollections : AutoMapperSpecBase + { + TrainingCourseDto _course; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap().ForMember(c => c.Category, o => o.ExplicitExpansion()); + }); + + protected override void Because_of() + { + using(var context = new ClientContext()) + { + context.Database.Log = s => Trace.WriteLine(s); + _course = ProjectTo(context.TrainingCourses, null, c => c.Content.Select(co => co.Category)).FirstOrDefault(n => n.CourseName == "Course 1"); + } + } + + + [Fact] + public void Should_expand_collections_items() + { + _course.Content[0].Category.CategoryName.ShouldBe("Category 1"); + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var category = new Category { CategoryName = "Category 1" }; + var course = new TrainingCourse { CourseName = "Course 1" }; + context.TrainingCourses.Add(course); + var content = new TrainingContent { ContentName = "Content 1", Category = category }; + context.TrainingContents.Add(content); + course.Content.Add(content); + } + } + + class ClientContext : DbContext + { + public ClientContext() + { + Database.SetInitializer(new Initializer()); + } + public DbSet Categories { get; set; } + public DbSet TrainingCourses { get; set; } + public DbSet TrainingContents { get; set; } + } + + public class TrainingCourse + { + [Key] + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual IList Content { get; set; } = new List(); + } + + public class TrainingContent + { + [Key] + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public Category Category { get; set; } + } + + public class Category + { + public int CategoryId { get; set; } + public string CategoryName { get; set; } + } + + + public class TrainingCourseDto + { + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual IList Content { get; set; } + } + + public class CategoryDto + { + public int CategoryId { get; set; } + public string CategoryName { get; set; } + } + + public class TrainingContentDto + { + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public CategoryDto Category { get; set; } + } + } } \ No newline at end of file diff --git a/src/IntegrationTests.Net4/ExpandCollectionsWithStrings.cs b/src/IntegrationTests/ExplicitExpansion/ExpandCollectionsWithStrings.cs similarity index 89% rename from src/IntegrationTests.Net4/ExpandCollectionsWithStrings.cs rename to src/IntegrationTests/ExplicitExpansion/ExpandCollectionsWithStrings.cs index 160b16015d..4661aff3af 100644 --- a/src/IntegrationTests.Net4/ExpandCollectionsWithStrings.cs +++ b/src/IntegrationTests/ExplicitExpansion/ExpandCollectionsWithStrings.cs @@ -1,115 +1,115 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Data.Entity; -using System.Linq; -using AutoMapper.QueryableExtensions; -using AutoMapper.UnitTests; -using Xunit; -using Should; -using System.Diagnostics; - -namespace AutoMapper.IntegrationTests.Net4 -{ - public class ExpandCollectionsWithStrings : AutoMapperSpecBase - { - TrainingCourseDto _course; - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap().ForMember(c => c.Category, o => o.ExplicitExpansion()); - }); - - protected override void Because_of() - { - using(var context = new ClientContext()) - { - context.Database.Log = s => Trace.WriteLine(s); - _course = context.TrainingCourses.ProjectTo(Configuration, null, "Content.Category").FirstOrDefault(n => n.CourseName == "Course 1"); - } - } - - - [Fact] - public void Should_expand_collections_items_with_strings() - { - _course.Content[0].Category.CategoryName.ShouldEqual("Category 1"); - } - - class Initializer : DropCreateDatabaseAlways - { - protected override void Seed(ClientContext context) - { - var category = new Category { CategoryName = "Category 1" }; - var course = new TrainingCourse { CourseName = "Course 1" }; - context.TrainingCourses.Add(course); - var content = new TrainingContent { ContentName = "Content 1", Category = category }; - context.TrainingContents.Add(content); - course.Content.Add(content); - } - } - - class ClientContext : DbContext - { - public ClientContext() - { - Database.SetInitializer(new Initializer()); - } - public DbSet Categories { get; set; } - public DbSet TrainingCourses { get; set; } - public DbSet TrainingContents { get; set; } - } - - public class TrainingCourse - { - [Key] - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual IList Content { get; set; } = new List(); - } - - public class TrainingContent - { - [Key] - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public Category Category { get; set; } - } - - public class Category - { - public int CategoryId { get; set; } - public string CategoryName { get; set; } - } - - - public class TrainingCourseDto - { - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual IList Content { get; set; } - } - - public class CategoryDto - { - public int CategoryId { get; set; } - public string CategoryName { get; set; } - } - - public class TrainingContentDto - { - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public CategoryDto Category { get; set; } - } - } +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Xunit; +using Shouldly; +using System.Diagnostics; + +namespace AutoMapper.IntegrationTests.Net4 +{ + public class ExpandCollectionsWithStrings : AutoMapperSpecBase + { + TrainingCourseDto _course; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap().ForMember(c => c.Category, o => o.ExplicitExpansion()); + }); + + protected override void Because_of() + { + using(var context = new ClientContext()) + { + context.Database.Log = s => Trace.WriteLine(s); + _course = ProjectTo(context.TrainingCourses, null, "Content.Category").FirstOrDefault(n => n.CourseName == "Course 1"); + } + } + + + [Fact] + public void Should_expand_collections_items_with_strings() + { + _course.Content[0].Category.CategoryName.ShouldBe("Category 1"); + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var category = new Category { CategoryName = "Category 1" }; + var course = new TrainingCourse { CourseName = "Course 1" }; + context.TrainingCourses.Add(course); + var content = new TrainingContent { ContentName = "Content 1", Category = category }; + context.TrainingContents.Add(content); + course.Content.Add(content); + } + } + + class ClientContext : DbContext + { + public ClientContext() + { + Database.SetInitializer(new Initializer()); + } + public DbSet Categories { get; set; } + public DbSet TrainingCourses { get; set; } + public DbSet TrainingContents { get; set; } + } + + public class TrainingCourse + { + [Key] + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual IList Content { get; set; } = new List(); + } + + public class TrainingContent + { + [Key] + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public Category Category { get; set; } + } + + public class Category + { + public int CategoryId { get; set; } + public string CategoryName { get; set; } + } + + + public class TrainingCourseDto + { + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual IList Content { get; set; } + } + + public class CategoryDto + { + public int CategoryId { get; set; } + public string CategoryName { get; set; } + } + + public class TrainingContentDto + { + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public CategoryDto Category { get; set; } + } + } } \ No newline at end of file diff --git a/src/IntegrationTests.Net4/ExpandMembersPath.cs b/src/IntegrationTests/ExplicitExpansion/ExpandMembersPath.cs similarity index 87% rename from src/IntegrationTests.Net4/ExpandMembersPath.cs rename to src/IntegrationTests/ExplicitExpansion/ExpandMembersPath.cs index 320e7f17c0..75c75e114b 100644 --- a/src/IntegrationTests.Net4/ExpandMembersPath.cs +++ b/src/IntegrationTests/ExplicitExpansion/ExpandMembersPath.cs @@ -1,156 +1,156 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Data.Entity; -using System.Diagnostics; -using System.Linq; -using AutoMapper.QueryableExtensions; -using AutoMapper.UnitTests; -using Should; -using Xunit; - -namespace AutoMapper.IntegrationTests.Net4 -{ - public class ExpandMembersPath : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - var mappingClass1 = cfg.CreateMap(); - mappingClass1.ForMember(dest => dest.IdDTO, opt => opt.MapFrom(src => src.Id)); - mappingClass1.ForMember(dest => dest.NameDTO, opt => opt.MapFrom(src => src.Name)); - mappingClass1.ForMember(dest => dest.Class2DTO, opt => - { - opt.MapFrom(src => src.Class2); - opt.ExplicitExpansion(); - }); - - var mappingClass2 = cfg.CreateMap(); - mappingClass2.ForMember(dest => dest.IdDTO, opt => opt.MapFrom(src => src.Id)); - mappingClass2.ForMember(dest => dest.NameDTO, opt => opt.MapFrom(src => src.Name)); - mappingClass2.ForMember(dest => dest.Class3DTO, opt => - { - opt.MapFrom(src => src.Class3); - opt.ExplicitExpansion(); - }); - - var mappingClass3 = cfg.CreateMap(); - mappingClass3.ForMember(dest => dest.IdDTO, opt => opt.MapFrom(src => src.Id)); - mappingClass3.ForMember(dest => dest.NameDTO, opt => opt.MapFrom(src => src.Name)); - - //This is the trouble mapping - mappingClass3.ForMember(dest => dest.Class2DTO, opt => - { - opt.MapFrom(src => src.Class2); - opt.ExplicitExpansion(); - }); - }); - - [Fact] - public void Should_expand_all_members_in_path() - { - Class1DTO[] dtos; - using(TestContext context = new TestContext()) - { - context.Database.Log = s => Debug.WriteLine(s); - dtos = context.Class1Set.ProjectTo(Configuration, r => r.Class2DTO.Class3DTO).ToArray(); - } - Check(dtos); - } - - [Fact] - public void Should_expand_all_members_in_path_with_strings() - { - Class1DTO[] dtos; - using(TestContext context = new TestContext()) - { - context.Database.Log = s => Debug.WriteLine(s); - dtos = context.Class1Set.ProjectTo(Configuration, null, "Class2DTO.Class3DTO").ToArray(); - } - Check(dtos); - } - - public void Check(Class1DTO[] dtos) - { - dtos.Length.ShouldEqual(3); - dtos.Select(d => d.IdDTO).ToArray().ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.IdDTO).ToArray().ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.Class3DTO.IdDTO).ToArray().ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.Class3DTO.Class2DTO).ToArray().ShouldEqual(new Class2DTO[] { null, null, null }); - } - - public class TestContext : System.Data.Entity.DbContext - { - public TestContext() - { - Database.SetInitializer(new DatabaseInitializer()); - } - public DbSet Class1Set { get; set; } - public DbSet Class2Set { get; set; } - public DbSet Class3Set { get; set; } - } - - public class DatabaseInitializer : CreateDatabaseIfNotExists - { - protected override void Seed(TestContext context) - { - context.Class1Set.AddRange(new[] - { - new Class1 { Class2 = new Class2 { Class3 = new Class3 { Name = "SomeValue" }}, Name = "Alain Brito"}, - new Class1 { Class2 = new Class2 { Class3 = new Class3 { Name = "OtherValue" }}, Name = "Jimmy Bogard"}, - new Class1 { Class2 = new Class2 { Class3 = new Class3 { Name = "SomeValue" }}, Name = "Bill Gates"} - }); - base.Seed(context); - } - } - - public class Class1DTO - { - public int IdDTO { get; set; } - public string NameDTO { get; set; } - - public Class2DTO Class2DTO { get; set; } - } - - public class Class2DTO - { - public int IdDTO { get; set; } - public string NameDTO { get; set; } - - public Class3DTO Class3DTO { get; set; } - } - - public class Class3DTO - { - public int IdDTO { get; set; } - public string NameDTO { get; set; } - - public Class2DTO Class2DTO { get; set; } - } - - public class Class1 - { - [Key] - public int Id { get; set; } - public string Name { get; set; } - - public Class2 Class2 { get; set; } - } - - public class Class2 - { - [Key] - public int Id { get; set; } - public string Name { get; set; } - - public Class3 Class3 { get; set; } - } - - public class Class3 - { - [Key, ForeignKeyAttribute("Class2")] - public int Id { get; set; } - public string Name { get; set; } - - public Class2 Class2 { get; set; } - } - } +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Data.Entity; +using System.Diagnostics; +using System.Linq; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests.Net4 +{ + public class ExpandMembersPath : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + var mappingClass1 = cfg.CreateMap(); + mappingClass1.ForMember(dest => dest.IdDTO, opt => opt.MapFrom(src => src.Id)); + mappingClass1.ForMember(dest => dest.NameDTO, opt => opt.MapFrom(src => src.Name)); + mappingClass1.ForMember(dest => dest.Class2DTO, opt => + { + opt.MapFrom(src => src.Class2); + opt.ExplicitExpansion(); + }); + + var mappingClass2 = cfg.CreateMap(); + mappingClass2.ForMember(dest => dest.IdDTO, opt => opt.MapFrom(src => src.Id)); + mappingClass2.ForMember(dest => dest.NameDTO, opt => opt.MapFrom(src => src.Name)); + mappingClass2.ForMember(dest => dest.Class3DTO, opt => + { + opt.MapFrom(src => src.Class3); + opt.ExplicitExpansion(); + }); + + var mappingClass3 = cfg.CreateMap(); + mappingClass3.ForMember(dest => dest.IdDTO, opt => opt.MapFrom(src => src.Id)); + mappingClass3.ForMember(dest => dest.NameDTO, opt => opt.MapFrom(src => src.Name)); + + //This is the trouble mapping + mappingClass3.ForMember(dest => dest.Class2DTO, opt => + { + opt.MapFrom(src => src.Class2); + opt.ExplicitExpansion(); + }); + }); + + [Fact] + public void Should_expand_all_members_in_path() + { + Class1DTO[] dtos; + using(TestContext context = new TestContext()) + { + context.Database.Log = s => Debug.WriteLine(s); + dtos = ProjectTo(context.Class1Set, null, r => r.Class2DTO.Class3DTO).ToArray(); + } + Check(dtos); + } + + [Fact] + public void Should_expand_all_members_in_path_with_strings() + { + Class1DTO[] dtos; + using(TestContext context = new TestContext()) + { + context.Database.Log = s => Debug.WriteLine(s); + dtos = ProjectTo(context.Class1Set, null, "Class2DTO.Class3DTO").ToArray(); + } + Check(dtos); + } + + private void Check(Class1DTO[] dtos) + { + dtos.Length.ShouldBe(3); + dtos.Select(d => d.IdDTO).ToArray().ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.IdDTO).ToArray().ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.Class3DTO.IdDTO).ToArray().ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.Class3DTO.Class2DTO).ToArray().ShouldBe(new Class2DTO[] { null, null, null }); + } + + public class TestContext : System.Data.Entity.DbContext + { + public TestContext() + { + Database.SetInitializer(new DatabaseInitializer()); + } + public DbSet Class1Set { get; set; } + public DbSet Class2Set { get; set; } + public DbSet Class3Set { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(TestContext context) + { + context.Class1Set.AddRange(new[] + { + new Class1 { Class2 = new Class2 { Class3 = new Class3 { Name = "SomeValue" }}, Name = "Alain Brito"}, + new Class1 { Class2 = new Class2 { Class3 = new Class3 { Name = "OtherValue" }}, Name = "Jimmy Bogard"}, + new Class1 { Class2 = new Class2 { Class3 = new Class3 { Name = "SomeValue" }}, Name = "Bill Gates"} + }); + base.Seed(context); + } + } + + public class Class1DTO + { + public int IdDTO { get; set; } + public string NameDTO { get; set; } + + public Class2DTO Class2DTO { get; set; } + } + + public class Class2DTO + { + public int IdDTO { get; set; } + public string NameDTO { get; set; } + + public Class3DTO Class3DTO { get; set; } + } + + public class Class3DTO + { + public int IdDTO { get; set; } + public string NameDTO { get; set; } + + public Class2DTO Class2DTO { get; set; } + } + + public class Class1 + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + + public Class2 Class2 { get; set; } + } + + public class Class2 + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + + public Class3 Class3 { get; set; } + } + + public class Class3 + { + [Key, ForeignKeyAttribute("Class2")] + public int Id { get; set; } + public string Name { get; set; } + + public Class2 Class2 { get; set; } + } + } } \ No newline at end of file diff --git a/src/IntegrationTests.Net4/NestedExplicitExpand.cs b/src/IntegrationTests/ExplicitExpansion/NestedExplicitExpand.cs similarity index 89% rename from src/IntegrationTests.Net4/NestedExplicitExpand.cs rename to src/IntegrationTests/ExplicitExpansion/NestedExplicitExpand.cs index c1d7d0f88e..9d3f81042a 100644 --- a/src/IntegrationTests.Net4/NestedExplicitExpand.cs +++ b/src/IntegrationTests/ExplicitExpansion/NestedExplicitExpand.cs @@ -6,7 +6,7 @@ using System.Linq.Expressions; using AutoMapper.QueryableExtensions; using AutoMapper.UnitTests; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.IntegrationTests.Net4 @@ -52,7 +52,7 @@ public void Should_handle_nested_explicit_expand_with_expressions() using(TestContext context = new TestContext()) { context.Database.Log = s => Debug.WriteLine(s); - dtos = context.Class1Set.ProjectTo(Configuration, r => r.Class2DTO, r => r.Class2DTO.Class3DTO).ToArray(); + dtos = ProjectTo(context.Class1Set, null, r => r.Class2DTO, r => r.Class2DTO.Class3DTO).ToArray(); } Check(dtos); } @@ -64,18 +64,18 @@ public void Should_handle_nested_explicit_expand_with_strings() using(TestContext context = new TestContext()) { context.Database.Log = s => Debug.WriteLine(s); - dtos = context.Class1Set.ProjectTo(Configuration, null, "Class2DTO", "Class2DTO.Class3DTO").ToArray(); + dtos = ProjectTo(context.Class1Set, null, "Class2DTO", "Class2DTO.Class3DTO").ToArray(); } Check(dtos); } - public void Check(Class1DTO[] dtos) + private void Check(Class1DTO[] dtos) { - dtos.Length.ShouldEqual(3); - dtos.Select(d => d.IdDTO).ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.IdDTO).ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.Class3DTO.IdDTO).ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.Class3DTO.Class2DTO).ShouldEqual(new Class2DTO[] { null, null, null }); + dtos.Length.ShouldBe(3); + dtos.Select(d => d.IdDTO).ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.IdDTO).ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.Class3DTO.IdDTO).ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.Class3DTO.Class2DTO).ShouldBe(new Class2DTO[] { null, null, null }); } public class TestContext : System.Data.Entity.DbContext diff --git a/src/IntegrationTests.Net4/NestedExplicitExpandWithFields.cs b/src/IntegrationTests/ExplicitExpansion/NestedExplicitExpandWithFields.cs similarity index 89% rename from src/IntegrationTests.Net4/NestedExplicitExpandWithFields.cs rename to src/IntegrationTests/ExplicitExpansion/NestedExplicitExpandWithFields.cs index be577818b9..280262cd2d 100644 --- a/src/IntegrationTests.Net4/NestedExplicitExpandWithFields.cs +++ b/src/IntegrationTests/ExplicitExpansion/NestedExplicitExpandWithFields.cs @@ -6,7 +6,7 @@ using System.Linq.Expressions; using AutoMapper.QueryableExtensions; using AutoMapper.UnitTests; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.IntegrationTests.Net4 @@ -52,7 +52,7 @@ public void Should_handle_nested_explicit_expand_with_expressions() using(TestContext context = new TestContext()) { context.Database.Log = s => Debug.WriteLine(s); - dtos = context.Class1Set.ProjectTo(Configuration, r => r.Class2DTO, r => r.Class2DTO.Class3DTO).ToArray(); + dtos = ProjectTo(context.Class1Set, null, r => r.Class2DTO, r => r.Class2DTO.Class3DTO).ToArray(); } Check(dtos); } @@ -64,18 +64,18 @@ public void Should_handle_nested_explicit_expand_with_strings() using(TestContext context = new TestContext()) { context.Database.Log = s => Debug.WriteLine(s); - dtos = context.Class1Set.ProjectTo(Configuration, null, "Class2DTO", "Class2DTO.Class3DTO").ToArray(); + dtos = ProjectTo(context.Class1Set, null, "Class2DTO", "Class2DTO.Class3DTO").ToArray(); } Check(dtos); } - public void Check(Class1DTO[] dtos) + private void Check(Class1DTO[] dtos) { - dtos.Length.ShouldEqual(3); - dtos.Select(d => d.IdDTO).ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.IdDTO).ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.Class3DTO.IdDTO).ShouldEqual(new[] { 1, 2, 3 }); - dtos.Select(d => d.Class2DTO.Class3DTO.Class2DTO).ShouldEqual(new Class2DTO[] { null, null, null }); + dtos.Length.ShouldBe(3); + dtos.Select(d => d.IdDTO).ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.IdDTO).ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.Class3DTO.IdDTO).ShouldBe(new[] { 1, 2, 3 }); + dtos.Select(d => d.Class2DTO.Class3DTO.Class2DTO).ShouldBe(new Class2DTO[] { null, null, null }); } public class TestContext : System.Data.Entity.DbContext diff --git a/src/IntegrationTests/ExplicitExpansion/ProjectAndAllowNullCollections.cs b/src/IntegrationTests/ExplicitExpansion/ProjectAndAllowNullCollections.cs new file mode 100644 index 0000000000..8e5ac0be10 --- /dev/null +++ b/src/IntegrationTests/ExplicitExpansion/ProjectAndAllowNullCollections.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Xunit; +using Shouldly; + +namespace AutoMapper.IntegrationTests.Net4 +{ + using UnitTests; + using QueryableExtensions; + using System.Data.Entity.ModelConfiguration; + + public class ProjectAndAllowNullCollections : AutoMapperSpecBase + { + public class Foo + { + public virtual int ID { get; set; } + + public virtual ISet Bars { get; } = new HashSet(); + + public virtual ISet Bazs { get; } = new HashSet(); + } + + public class Bar + { + public virtual int ID { get; set; } + + public virtual string Value { get; set; } + } + + public class Baz + { + public virtual int ID { get; set; } + + public virtual string Value { get; set; } + } + + public class FooDto + { + public int ID { get; set; } + + public List Bars { get; set; } + + public List Bazs { get; set; } + } + + public class BarDto + { + public int ID { get; set; } + + public string Value { get; set; } + } + + public class BazDto + { + public int ID { get; set; } + + public string Value { get; set; } + } + + public class MyContextInitializer : DropCreateDatabaseAlways + { + public override void InitializeDatabase(MyContext context) + { + base.InitializeDatabase(context); + + var foo1 = new Foo(); + var foo2 = new Foo(); // { Bars = new List() }; + var foo3 = new Foo(); // { Bars = new List() }; + + context.Foos.Add(foo1); + context.Foos.Add(foo2); + context.Foos.Add(foo3); + + context.SaveChanges(); + + var bar1 = new Bar { Value = "bar1" }; + var bar2 = new Bar { Value = "bar2" }; + + foo2.Bars.Add(bar1); + + foo3.Bars.Add(bar1); + foo3.Bars.Add(bar2); + + context.Bars.Add(bar1); + context.Bars.Add(bar2); + + context.SaveChanges(); + } + } + + public class MyContext : DbContext + { + public MyContext() : base("AutomapperNullCollections") + { + Database.SetInitializer(new MyContextInitializer()); + } + + public DbSet Foos { get; set; } + + public DbSet Bars { get; set; } + + public DbSet Bazs { get; set; } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.Configurations.AddFromAssembly(typeof(MyContext).Assembly); + } + } + + public class FooConfiguration : EntityTypeConfiguration + { + public FooConfiguration() + { + HasMany(m => m.Bars).WithMany(); + HasMany(m => m.Bazs).WithMany(); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.AllowNullCollections = true; + + c.CreateMap() + .ForMember(d => d.Bars, o => o.ExplicitExpansion()) + .ForMember(d => d.Bazs, o => o.ExplicitExpansion()); + + c.CreateMap(); + c.CreateMap(); + }); + + [Fact] + public void Should_work() + { + using(var context = new MyContext()) + { + var foos = ProjectTo(context.Foos.AsNoTracking(), null, m => m.Bars).ToList(); + + foos[0].Bars.ShouldNotBeNull(); + foos[0].Bazs.ShouldBeNull(); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs b/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs new file mode 100644 index 0000000000..7ed53bdc47 --- /dev/null +++ b/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs @@ -0,0 +1,234 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Data.Entity; +using System.Linq; +using System.Text.RegularExpressions; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests.ProjectionWithExplicitExpansionExtension +{ + public static class Ext + { + public static void SqlShouldSelectColumn (this string sqlSelect, string columnName)=> sqlSelect.ShouldContain($".[{columnName}] AS [{columnName}]"); + public static void SqlShouldNotSelectColumn(this string sqlSelect, string columnName)=> sqlSelect.ShouldNotContain(columnName); + public static void SqlFromShouldStartWith (this string sqlSelect, string tableName) + { + Regex regex = new Regex($@"FROM(\s+)\[dbo\]\.\[{tableName}\](\s+)AS"); + regex.Match(sqlSelect).Success.ShouldBeTrue(); + // sqlSelect.ShouldContain($"FROM [dbo].[{tableName}] AS"); + } + } +} +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + using ProjectionWithExplicitExpansionExtension; + + using NameSourceType = String; using NameDtoType = String ; // Example of Reference Type + using DescSourceType = Int32 ; using DescDtoType = Nullable; // Example of Value Type mapped to appropriate Nullable + + public class ProjectionWithExplicitExpansion : AutoMapperSpecBase + { + public class SourceDeepInner + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.None)] + public DescSourceType Dide { get; set; } + public DescSourceType Did1 { get; set; } + } + public class SourceInner + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.None)] + public DescSourceType Ides { get; set; } + public DescSourceType Ide1 { get; set; } + public SourceDeepInner Deep { get; set; } + } + public class Source + { [Key, DatabaseGenerated(DatabaseGeneratedOption.None)] + public DescSourceType Desc { get; set; } + public NameSourceType Name { get; set; } + public SourceInner Inner { get; set; } + } + public class Dto + { + public NameDtoType Name { get; set; } + public DescDtoType Desc { get; set; } + public DescDtoType InnerDescFlattened { get; set; } + public DescDtoType InnerFlattenedNonKey { get; set; } + public DescDtoType DeepFlattened { get; set; } + } + + public class Context : DbContext + { + public List Log = new List(); + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + Database.Log += s => Log.Add(s); + } + + public DbSet Sources { get; set; } + public DbSet SourceInners { get; set; } + public DbSet SourceDeepInners { get; set; } + + public string GetLastSelectSqlLogEntry() => Log.Last(_ => _.TrimStart().StartsWith("SELECT")); + } + + private static readonly IQueryable _iq = new List { + new Source() { Name = "Name1", Desc = -12, Inner = new SourceInner { + Ides = -25, Ide1 = -7, + Deep = new SourceDeepInner() { Dide = 28, Did1 = 38,} } }, + } .AsQueryable(); + + private static readonly Source _iqf = _iq.First(); + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(_iqf); + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dto => dto.Desc, conf => conf.ExplicitExpansion()) + .ForMember(dto => dto.Name, conf => conf.ExplicitExpansion()) + .ForMember(dto => dto.InnerDescFlattened, conf => { conf.ExplicitExpansion(); conf.MapFrom(_ => _.Inner.Ides); }) + .ForMember(dto => dto.InnerFlattenedNonKey, conf => { conf.ExplicitExpansion(); conf.MapFrom(_ => _.Inner.Ide1); }) + .ForMember(dto => dto.DeepFlattened, conf => { conf.ExplicitExpansion(); conf.MapFrom(_ => _.Inner.Deep.Dide); }) + ;}); + + [Fact] + public void NoExplicitExpansion() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources).ToList().First(); + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + sqlSelect.ShouldNotContain("JOIN"); + sqlSelect.ShouldNotContain(nameof(ctx.SourceInners)); dto.InnerDescFlattened.ShouldBeNull(); + + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Name)); dto.Name.ShouldBeNull(); + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Desc)); dto.Desc.ShouldBeNull(); + } + } + + [Fact] + public void ProjectReferenceType() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources, null, _ => _.Name).First(); + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + sqlSelect.ShouldNotContain("JOIN"); + sqlSelect.ShouldNotContain(nameof(ctx.SourceInners)); dto.InnerDescFlattened.ShouldBeNull(); + + dto.Name.ShouldBe(_iqf.Name); sqlSelect.SqlShouldSelectColumn (nameof(_iqf.Name)); + dto.Desc.ShouldBeNull() ; sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Desc)); + } + } + [Fact] + public void ProjectValueType() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources, null, _ => _.Desc).First(); + + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + sqlSelect.ShouldNotContain("JOIN"); + sqlSelect.ShouldNotContain(nameof(ctx.SourceInners)); dto.InnerDescFlattened.ShouldBeNull(); + + dto.Desc.ShouldBe(_iqf.Desc); sqlSelect.ShouldContain (nameof(_iqf.Desc)); + dto.Name.ShouldBeNull() ; sqlSelect.ShouldNotContain(nameof(_iqf.Name)); + + } + } + [Fact] + public void ProjectBoth() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources, null, _ => _.Name, _ => _.Desc).First(); + + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + sqlSelect.ShouldNotContain("JOIN"); + sqlSelect.ShouldNotContain(nameof(ctx.SourceInners)); dto.InnerDescFlattened.ShouldBeNull(); + + sqlSelect.SqlShouldSelectColumn(nameof(_iqf.Name)); dto.Name.ShouldBe(_iqf.Name); + sqlSelect.SqlShouldSelectColumn(nameof(_iqf.Desc)); dto.Desc.ShouldBe(_iqf.Desc); + } + } + + [Fact] + public void ProjectInner() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources, null, _ => _.InnerDescFlattened).ToList().First(); + + dto.InnerDescFlattened.ShouldBe(_iqf.Inner.Ides); + dto.InnerFlattenedNonKey.ShouldBeNull(); + dto.DeepFlattened.ShouldBeNull(); + + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + sqlSelect.ShouldNotContain("JOIN"); // ??? + sqlSelect.ShouldNotContain(nameof(ctx.SourceInners)); // ??? + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Name)); dto.Name.ShouldBeNull(); + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Desc)); dto.Desc.ShouldBeNull(); + } + } + + [Fact] + public void ProjectInnerNonKey() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources, null, _ => _.InnerFlattenedNonKey).ToList().First(); + + dto.InnerFlattenedNonKey.ShouldBe(_iqf.Inner.Ide1); + dto.InnerDescFlattened.ShouldBeNull(); + dto.DeepFlattened.ShouldBeNull(); + + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + sqlSelect.ShouldContain("JOIN"); + sqlSelect.ShouldContain(nameof(ctx.SourceInners)); + sqlSelect.ShouldNotContain(nameof(ctx.SourceDeepInners)); + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Name)); dto.Name.ShouldBeNull(); + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Desc)); dto.Desc.ShouldBeNull(); + } + } + + [Fact] + public void ProjectDeepInner() + { + using (var ctx = new Context()) + { + var dto = ProjectTo(ctx.Sources, null, _ => _.DeepFlattened).ToList().First(); + var sqlSelect = ctx.GetLastSelectSqlLogEntry(); + sqlSelect.SqlFromShouldStartWith(nameof(ctx.Sources)); + + dto.DeepFlattened.ShouldBe(_iqf.Inner.Deep.Dide); + dto.InnerDescFlattened.ShouldBeNull(); + + sqlSelect.ShouldContain("JOIN"); + sqlSelect.ShouldContain(nameof(ctx.SourceInners)); + sqlSelect.ShouldContain("JOIN"); // ??? + sqlSelect.ShouldContain(nameof(ctx.SourceDeepInners)); // ??? + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Name)); dto.Name.ShouldBeNull(); + sqlSelect.SqlShouldNotSelectColumn(nameof(_iqf.Desc)); dto.Desc.ShouldBeNull(); + } + } + } +} diff --git a/src/IntegrationTests/ICollectionAggregateProjections.cs b/src/IntegrationTests/ICollectionAggregateProjections.cs new file mode 100644 index 0000000000..f66184689c --- /dev/null +++ b/src/IntegrationTests/ICollectionAggregateProjections.cs @@ -0,0 +1,83 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + using System.Collections.Generic; + + public class ICollectionAggregateProjections : AutoMapperSpecBase + { + public class Customer + { + [Key] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public ICollection Items { get; set; } + } + + public class Item + { + public int Id { get; set; } + public int Code { get; set; } + } + + public class CustomerViewModel + { + public int ItemCodesCount { get; set; } + public int ItemCodesMin { get; set; } + public int ItemCodesMax { get; set; } + public int ItemCodesSum { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + Items = new[] { new Item { Code = 1 }, new Item { Code = 3 }, new Item { Code = 5 } } + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(_ => { }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + var result = ProjectTo(context.Customers.Select(customer => new + { + ItemCodes = (ICollection)customer.Items.Select(item => item.Code).ToList() + })).Single(); + + result.ItemCodesCount.ShouldBe(3); + result.ItemCodesMin.ShouldBe(1); + result.ItemCodesMax.ShouldBe(5); + result.ItemCodesSum.ShouldBe(9); + } + } + } +} diff --git a/src/IntegrationTests/IEnumerableAggregateProjections.cs b/src/IntegrationTests/IEnumerableAggregateProjections.cs new file mode 100644 index 0000000000..d479536070 --- /dev/null +++ b/src/IntegrationTests/IEnumerableAggregateProjections.cs @@ -0,0 +1,83 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + using System.Collections.Generic; + + public class IEnumerableAggregateProjections : AutoMapperSpecBase + { + public class Customer + { + [Key] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public ICollection Items { get; set; } + } + + public class Item + { + public int Id { get; set; } + public int Code { get; set; } + } + + public class CustomerViewModel + { + public int ItemCodesCount { get; set; } + public int ItemCodesMin { get; set; } + public int ItemCodesMax { get; set; } + public int ItemCodesSum { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + Items = new[] { new Item { Code = 1 }, new Item { Code = 3 }, new Item { Code = 5 } } + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(_ => { }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + var result = ProjectTo(context.Customers.Select(customer => new + { + ItemCodes = customer.Items.Select(item => item.Code) + })).Single(); + + result.ItemCodesCount.ShouldBe(3); + result.ItemCodesMin.ShouldBe(1); + result.ItemCodesMax.ShouldBe(5); + result.ItemCodesSum.ShouldBe(9); + } + } + } +} diff --git a/src/IntegrationTests/IncludeMembers.cs b/src/IntegrationTests/IncludeMembers.cs new file mode 100644 index 0000000000..420f11d66c --- /dev/null +++ b/src/IntegrationTests/IncludeMembers.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AutoMapper.UnitTests; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + public class IncludeMembers : AutoMapperSpecBase + { + class Source + { + public int Id { get; set; } + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + context.Sources.Add(source); + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap().IncludeMembers(s=>s.InnerSource, s=>s.OtherInnerSource); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + using(var context = new Context()) + { + var result = ProjectTo(context.Sources).Single(); + result.Name.ShouldBe("name"); + result.Description.ShouldBe("description"); + result.Title.ShouldBe("title"); + } + } + } + + public class IncludeMembersWithMapFromExpression : AutoMapperSpecBase + { + class Source + { + public int Id { get; set; } + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public int Id { get; set; } + public string Name { get; set; } + public string Description1 { get; set; } + } + class OtherInnerSource + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string Title1 { get; set; } + } + class Destination + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description1 = "description" }, OtherInnerSource = new OtherInnerSource { Title1 = "title" } }; + context.Sources.Add(source); + base.Seed(context); + } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Description, o=>o.MapFrom(s=>s.Description1)); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Title, o=>o.MapFrom(s=>s.Title1)); + }); + [Fact] + public void Should_flatten_with_MapFrom() + { + using(var context = new Context()) + { + var result = ProjectTo(context.Sources).Single(); + result.Name.ShouldBe("name"); + result.Description.ShouldBe("description"); + result.Title.ShouldBe("title"); + } + } + } + + public class IncludeMembersWithNullSubstitute : AutoMapperSpecBase + { + class Source + { + public int Id { get; set; } + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public int Id { get; set; } + public string Name { get; set; } + public int? Code { get; set; } + } + class OtherInnerSource + { + public int Id { get; set; } + public string Name { get; set; } + public int? Code { get; set; } + public int? OtherCode { get; set; } + } + class Destination + { + public int Id { get; set; } + public string Name { get; set; } + public int Code { get; set; } + public int OtherCode { get; set; } + } + class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + var source = new Source { Name = "name" }; + context.Sources.Add(source); + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Code, o => o.NullSubstitute(5)); + cfg.CreateMap(MemberList.None).ForMember(d => d.OtherCode, o => o.NullSubstitute(7)); + }); + [Fact] + public void Should_flatten() + { + using(var context = new Context()) + { + var result = ProjectTo(context.Sources).Single(); + result.Name.ShouldBe("name"); + result.Code.ShouldBe(5); + result.OtherCode.ShouldBe(7); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/Infrastructure/TestDbConfiguration.cs b/src/IntegrationTests/Infrastructure/TestDbConfiguration.cs new file mode 100644 index 0000000000..d6eba06055 --- /dev/null +++ b/src/IntegrationTests/Infrastructure/TestDbConfiguration.cs @@ -0,0 +1,13 @@ +using System.Data.Entity; +using System.Data.Entity.Infrastructure; + +namespace AutoMapper.IntegrationTests.Net4 +{ + public class TestDbConfiguration : DbConfiguration + { + public TestDbConfiguration() + { + SetDefaultConnectionFactory(new LocalDbConnectionFactory("MSSQLLocalDB")); + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/Inheritance/DerivedComplexTypes.cs b/src/IntegrationTests/Inheritance/DerivedComplexTypes.cs new file mode 100644 index 0000000000..5311f5e077 --- /dev/null +++ b/src/IntegrationTests/Inheritance/DerivedComplexTypes.cs @@ -0,0 +1,88 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + using System.ComponentModel.DataAnnotations.Schema; + + public class DerivedComplexTypes : AutoMapperSpecBase + { + [ComplexType] + public class LocalizedString + { + public string Value { get; set; } + } + + [ComplexType] + public class DerivedLocalizedString : LocalizedString + { + } + + public class Customer + { + public Customer() + { + } + + [Key] + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public DerivedLocalizedString Address { get; set; } + } + + public class CustomerViewModel + { + public string FirstName { get; set; } + public string LastName { get; set; } + public string Address { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + Address = new DerivedLocalizedString { Value = "home" } + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap().ConvertUsing(v => v.Value); + }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + var customerVm = ProjectTo(context.Customers).First(); + customerVm.Address.ShouldBe("home"); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/OverrideDestinationMappingsTest.cs b/src/IntegrationTests/Inheritance/OverrideDestinationMappingsTest.cs similarity index 97% rename from src/IntegrationTests.Net4/OverrideDestinationMappingsTest.cs rename to src/IntegrationTests/Inheritance/OverrideDestinationMappingsTest.cs index 629554e4c7..9ae669973a 100644 --- a/src/IntegrationTests.Net4/OverrideDestinationMappingsTest.cs +++ b/src/IntegrationTests/Inheritance/OverrideDestinationMappingsTest.cs @@ -1,7 +1,7 @@ using AutoMapper; using Xunit; using System.Linq; -using Should; +using Shouldly; using System.Data.Entity; using AutoMapper.UnitTests; @@ -40,7 +40,7 @@ public void Map_WhenOverrideDestinationTypeAndSourceIsDerived_MustCreateOverridd var model = Mapper.Map(entity); - model.Child.ShouldBeType(); + model.Child.ShouldBeOfType(); } private static Entity LoadEntity() diff --git a/src/IntegrationTests/Inheritance/ProjectToAbstractType.cs b/src/IntegrationTests/Inheritance/ProjectToAbstractType.cs new file mode 100644 index 0000000000..e29cfbbf26 --- /dev/null +++ b/src/IntegrationTests/Inheritance/ProjectToAbstractType.cs @@ -0,0 +1,356 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data.Entity; +using System.Linq; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests.Net4 +{ + public class ProjectToAbstractType : AutoMapperSpecBase + { + ITypeA[] _destinations; + + public interface ITypeA + { + int ID { get; set; } + string Name { get; set; } + } + + public class ConcreteTypeA : ITypeA + { + public int ID { get; set; } + public string Name { get; set; } + } + + public class DbEntityA + { + public int ID { get; set; } + public string Name { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.EntityA.AddRange(new[] + { + new DbEntityA { ID = 1, Name = "Alain Brito"}, + new DbEntityA { ID = 2, Name = "Jimmy Bogard"}, + new DbEntityA { ID = 3, Name = "Bill Gates"} + }); + base.Seed(context); + } + } + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet EntityA { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().As(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_project_to_abstract_type() + { + using(var context = new Context()) + { + _destinations = ProjectTo(context.EntityA).ToArray(); + } + _destinations.Length.ShouldBe(3); + _destinations[2].Name.ShouldBe("Bill Gates"); + } + } + + public class ProjectToInterface : AutoMapperSpecBase + { + //Data Objects + public class DataLayer + { + public class BaseDbObject + { + public Guid Id { get; set; } + } + public class Calendar : BaseDbObject + { + public string Name { get; set; } + public Guid? ReferenceId { get; set; } + public Guid BusinessUnitId { get; set; } + public DateTime? ValidFrom { get; set; } + public DateTime? ValidTo { get; set; } + + public virtual Calendar Reference { get; set; } + public virtual ICollection Days { get; set; } + } + public class CalendarDay : BaseDbObject + { + public DateTime Date { get; set; } + public Guid DayTypeId { get; set; } + public Guid CalendarId { get; set; } + public bool Cancel { get; set; } + public bool Deleted { get; set; } + + public virtual ValidityDayType DayType { get; set; } + public virtual Calendar Calendar { get; set; } + } + + public class ValidityDayType : BaseDbObject + { + public string Name { get; set; } + public string Acronym { get; set; } + + public virtual ICollection Days { get; set; } + // public virtual ICollection Signs { get; set; } + } + } + + public interface ICalendar + { + Guid Id { get; } + string Name { get; } + Guid BusinessUnitId { get; } + + ICalendar Reference { get; } + DateTime? ValidFrom { get; } + DateTime? ValidTo { get; } + + ICollection Days { get; set; } + } + + public interface ICalendarDay + { + Guid Id { get; } + DateTime Date { get; } + IValidityDayType DayType { get; } + ICalendar Calendar { get; } + bool Cancel { get; } + bool Deleted { get; } + } + + public interface IValidityDayType + { + Guid Id { get; } + + string Name { get; } + + string Acronym { get; } + + // ICollection Signs { get; internal set; } = ImmutableList.Empty; + + ICollection Days { get; } + } + + //Domain Models + public class Calendar : ICalendar + { + public Guid Id { get; internal set; } + public string Name { get; internal set; } + public Guid BusinessUnitId { get; internal set; } + + public ICalendar Reference { get; internal set; } + public DateTime? ValidFrom { get; internal set; } + public DateTime? ValidTo { get; internal set; } + + public virtual ICollection Days { get; set; } + + internal Calendar() + { + + } + + public Calendar(string name, Guid businessUnitId, ICalendar reference, DateTime? validFrom, DateTime? validTo) + { + if(businessUnitId == Guid.Empty) throw new ArgumentException(); + + Name = name; + BusinessUnitId = businessUnitId; + Reference = reference; + ValidFrom = validFrom; + ValidTo = validTo; + } + } + + public class CalendarDay : ICalendarDay + { + public Guid Id { get; internal set; } + public DateTime Date { get; internal set; } + public IValidityDayType DayType { get; internal set; } + public ICalendar Calendar { get; internal set; } + public bool Cancel { get; private set; } + public bool Deleted { get; private set; } + + internal CalendarDay() + { + + } + + public CalendarDay(DateTime date, IValidityDayType dayType, ICalendar calendar) + { + DayType = dayType ?? throw new ArgumentNullException(); + Calendar = calendar ?? throw new ArgumentNullException(); + Date = date; + } + + public void SetDeleted() + { + Deleted = true; + } + + public void SetCancel() + { + Cancel = true; + } + } + + public class ValidityDayType : IValidityDayType + { + public Guid Id { get; internal set; } + + public string Name { get; internal set; } + + public string Acronym { get; internal set; } + + public ICollection Days { get; internal set; } = new List(); + + internal ValidityDayType() + { + + } + + public ValidityDayType(string name, string acronym) + { + Name = name; + Acronym = acronym; + } + + public ICalendarDay ApplyToDay(DateTime date, ICalendar calendar) + { + var day = new CalendarDay(date, this, calendar); + return day; + } + + public IEnumerable GetCalendarDays(ICalendar calendar) + { + if(calendar == null) + throw new ArgumentNullException(); + + return Days.Where(d => d.Calendar == calendar); + } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Calendars.AddRange(CreateCalendarList()); + } + + private static List CreateCalendarList() + { + var dayType = new DataLayer.ValidityDayType() + { + Name = "WorkDays", + Acronym = "WD", + }; + + var day = new DataLayer.CalendarDay() + { + Id = new Guid(), + Cancel = true, + Deleted = false, + DayType = dayType, + Date = DateTime.Parse("2018-03-31") + }; + + var cal1 = new DataLayer.Calendar() + { + Id = Guid.NewGuid(), + Name = "Regional 2018", + BusinessUnitId = Guid.NewGuid(), + ValidFrom = DateTime.Parse("2018-01-01"), + ValidTo = null, + Days = new Collection() + { + day + } + }; + + var cal2 = new DataLayer.Calendar() + { + Id = Guid.NewGuid(), + Name = "City 2018", + ReferenceId = cal1.Id, + Reference = cal1, + BusinessUnitId = Guid.NewGuid(), + ValidFrom = DateTime.Parse("2018-01-01"), + ValidTo = null, + Days = new Collection() + }; + + var dataCalendars = new List() + { + cal1, cal2 + }; + return dataCalendars; + } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Calendars { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.AddProfile()); + + [Fact] + public void Should_project_to_abstract_type() + { + using(var context = new Context()) + { + var domainCalendars = ProjectTo(context.Calendars).ToList(); + domainCalendars.Count.ShouldBe(2); + } + } + + public class MyProfile : Profile + { + public MyProfile() + { + DisableConstructorMapping(); + + CreateMap().As(); + CreateMap(); + + CreateMap().As(); + CreateMap(); + //.ForMember(d => d.DayType, opt => opt.Ignore()); + + //Include to mapping -> this causes the exception! + CreateMap().As(); + CreateMap(); + + CreateMap(); + + CreateMap(); + + CreateMap(); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/ProxyTests.cs b/src/IntegrationTests/Inheritance/ProxyTests.cs similarity index 96% rename from src/IntegrationTests.Net4/ProxyTests.cs rename to src/IntegrationTests/Inheritance/ProxyTests.cs index 873f7d739a..c46cd0fedf 100644 --- a/src/IntegrationTests.Net4/ProxyTests.cs +++ b/src/IntegrationTests/Inheritance/ProxyTests.cs @@ -1,114 +1,114 @@ -namespace AutoMapper.IntegrationTests.Net4 -{ - using System.Collections.Generic; - using System.ComponentModel.DataAnnotations; - using System.Data.Entity; - using System.Linq; - using Xunit; - - public class ProxyTests - { - [Fact] - public void Test() - { - Database.SetInitializer(new Initializer()); - - var config = new MapperConfiguration(cfg => { - cfg.CreateMap().Include(); - cfg.CreateMap(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - - var context = new ClientContext(); - var course = context.TrainingCourses.FirstOrDefault(n => n.CourseName == "Course 1"); - var mapper = config.CreateMapper(); - var dto = mapper.Map(course); - } - - class Initializer : DropCreateDatabaseAlways - { - protected override void Seed(ClientContext context) - { - var course = new TrainingCourse { CourseName = "Course 1" }; - context.TrainingCourses.Add(course); - var content = new TrainingContent { ContentName = "Content 1", Course = course }; - context.TrainingContents.Add(content); - course.Content.Add(content); - } - } - - class ClientContext : DbContext - { - public ClientContext() - { - } - - public DbSet TrainingCourses { get; set; } - public DbSet TrainingContents { get; set; } - } - - public class TrainingCourse - { - public TrainingCourse() - { - Content = new List(); - } - - public TrainingCourse(TrainingCourse entity, IMapper mapper) - { - mapper.Map(entity, this); - } - - [Key] - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual ICollection Content { get; set; } - } - - public class TrainingContent - { - public TrainingContent() - { - } - - [Key] - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public virtual TrainingCourse Course { get; set; } - - // public int CourseId { get; set; } - - } - - public class TrainingCourseDto - { - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual ICollection Content { get; set; } - } - - public class ParentTrainingCourseDto : TrainingCourseDto - { - [IgnoreMap] - public override ICollection Content { get; set; } - } - - public class TrainingContentDto - { - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public ParentTrainingCourseDto Course { get; set; } - - // public int CourseId { get; set; } - } - } +namespace AutoMapper.IntegrationTests.Net4 +{ + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.Data.Entity; + using System.Linq; + using Xunit; + + public class ProxyTests + { + [Fact] + public void Test() + { + Database.SetInitializer(new Initializer()); + + var config = new MapperConfiguration(cfg => { + cfg.CreateMap().Include(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + + var context = new ClientContext(); + var course = context.TrainingCourses.FirstOrDefault(n => n.CourseName == "Course 1"); + var mapper = config.CreateMapper(); + var dto = mapper.Map(course); + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var course = new TrainingCourse { CourseName = "Course 1" }; + context.TrainingCourses.Add(course); + var content = new TrainingContent { ContentName = "Content 1", Course = course }; + context.TrainingContents.Add(content); + course.Content.Add(content); + } + } + + class ClientContext : DbContext + { + public ClientContext() + { + } + + public DbSet TrainingCourses { get; set; } + public DbSet TrainingContents { get; set; } + } + + public class TrainingCourse + { + public TrainingCourse() + { + Content = new List(); + } + + public TrainingCourse(TrainingCourse entity, IMapper mapper) + { + mapper.Map(entity, this); + } + + [Key] + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual ICollection Content { get; set; } + } + + public class TrainingContent + { + public TrainingContent() + { + } + + [Key] + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public virtual TrainingCourse Course { get; set; } + + // public int CourseId { get; set; } + + } + + public class TrainingCourseDto + { + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual ICollection Content { get; set; } + } + + public class ParentTrainingCourseDto : TrainingCourseDto + { + [IgnoreMap] + public override ICollection Content { get; set; } + } + + public class TrainingContentDto + { + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public ParentTrainingCourseDto Course { get; set; } + + // public int CourseId { get; set; } + } + } } \ No newline at end of file diff --git a/src/IntegrationTests.Net4/QueryableInterfaceInheritanceIssue.cs b/src/IntegrationTests/Inheritance/QueryableInterfaceInheritanceIssue.cs similarity index 90% rename from src/IntegrationTests.Net4/QueryableInterfaceInheritanceIssue.cs rename to src/IntegrationTests/Inheritance/QueryableInterfaceInheritanceIssue.cs index d2fe42df6d..b0c8d6f281 100644 --- a/src/IntegrationTests.Net4/QueryableInterfaceInheritanceIssue.cs +++ b/src/IntegrationTests/Inheritance/QueryableInterfaceInheritanceIssue.cs @@ -1,58 +1,59 @@ using System.Collections.Generic; -using System.Data.Entity; +using System.Data.Entity; using System.Linq; using AutoMapper.QueryableExtensions; -using Should; +using AutoMapper.UnitTests; +using Shouldly; using Xunit; -namespace AutoMapper.UnitTests.Projection +namespace AutoMapper.IntegrationTests { public class QueryableInterfaceInheritanceIssue : AutoMapperSpecBase - { - QueryableDto[] _result; - - public interface IBaseQueryableInterface - { - string Id { get; set; } - } - - public interface IQueryableInterface : IBaseQueryableInterface - { - } - - public class QueryableInterfaceImpl : IQueryableInterface - { - public string Id { get; set; } - } - - public class QueryableDto - { - public string Id { get; set; } - } - - class Initializer : DropCreateDatabaseAlways - { - protected override void Seed(ClientContext context) - { - context.Entities.AddRange(new[] { new QueryableInterfaceImpl { Id = "One" }, new QueryableInterfaceImpl { Id = "Two" }}); - } - } - - class ClientContext : DbContext - { - public ClientContext() - { - Database.SetInitializer(new Initializer()); - } - public DbSet Entities { get; set; } - } - - protected override void Because_of() - { - using(var context = new ClientContext()) - { - _result = context.Entities.ProjectTo(ConfigProvider).ToArray(); - } + { + QueryableDto[] _result; + + public interface IBaseQueryableInterface + { + string Id { get; set; } + } + + public interface IQueryableInterface : IBaseQueryableInterface + { + } + + public class QueryableInterfaceImpl : IQueryableInterface + { + public string Id { get; set; } + } + + public class QueryableDto + { + public string Id { get; set; } + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + context.Entities.AddRange(new[] { new QueryableInterfaceImpl { Id = "One" }, new QueryableInterfaceImpl { Id = "Two" }}); + } + } + + class ClientContext : DbContext + { + public ClientContext() + { + Database.SetInitializer(new Initializer()); + } + public DbSet Entities { get; set; } + } + + protected override void Because_of() + { + using(var context = new ClientContext()) + { + _result = ProjectTo(context.Entities).ToArray(); + } } [Fact] diff --git a/src/IntegrationTests.Net4/MaxDepthWithCollections.cs b/src/IntegrationTests/MaxDepth/MaxDepthWithCollections.cs similarity index 88% rename from src/IntegrationTests.Net4/MaxDepthWithCollections.cs rename to src/IntegrationTests/MaxDepth/MaxDepthWithCollections.cs index ed903fb052..8e229779ef 100644 --- a/src/IntegrationTests.Net4/MaxDepthWithCollections.cs +++ b/src/IntegrationTests/MaxDepth/MaxDepthWithCollections.cs @@ -1,100 +1,100 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Data.Entity; -using System.Linq; -using AutoMapper.QueryableExtensions; -using AutoMapper.UnitTests; -using Xunit; -using Should; - -namespace AutoMapper.IntegrationTests.Net4 -{ - public class MaxDepthWithCollections : AutoMapperSpecBase - { - TrainingCourseDto _course; - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - //cfg.AllowNullDestinationValues = false; - cfg.CreateMap().MaxDepth(1); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - using(var context = new ClientContext()) - { - _course = context.TrainingCourses.ProjectTo(Configuration).FirstOrDefault(n => n.CourseName == "Course 1"); - } - } - - [Fact] - public void Should_project_with_MaxDepth() - { - _course.CourseName.ShouldEqual("Course 1"); - var content = _course.Content[0]; - content.ContentName.ShouldEqual("Content 1"); - content.Course.ShouldBeNull(); - } - - class Initializer : DropCreateDatabaseAlways - { - protected override void Seed(ClientContext context) - { - var course = new TrainingCourse { CourseName = "Course 1" }; - context.TrainingCourses.Add(course); - var content = new TrainingContent { ContentName = "Content 1", Course = course }; - context.TrainingContents.Add(content); - course.Content.Add(content); - } - } - - class ClientContext : DbContext - { - public ClientContext() - { - Database.SetInitializer(new Initializer()); - } - public DbSet TrainingCourses { get; set; } - public DbSet TrainingContents { get; set; } - } - - public class TrainingCourse - { - [Key] - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual IList Content { get; set; } = new List(); - } - - public class TrainingContent - { - [Key] - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public virtual TrainingCourse Course { get; set; } - } - - public class TrainingCourseDto - { - public int CourseId { get; set; } - - public string CourseName { get; set; } - - public virtual IList Content { get; set; } - } - - public class TrainingContentDto - { - public int ContentId { get; set; } - - public string ContentName { get; set; } - - public TrainingCourseDto Course { get; set; } - } - } +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Xunit; +using Shouldly; + +namespace AutoMapper.IntegrationTests.Net4 +{ + public class MaxDepthWithCollections : AutoMapperSpecBase + { + TrainingCourseDto _course; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + //cfg.AllowNullDestinationValues = false; + cfg.CreateMap().MaxDepth(1); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + using(var context = new ClientContext()) + { + _course = ProjectTo(context.TrainingCourses).FirstOrDefault(n => n.CourseName == "Course 1"); + } + } + + [Fact] + public void Should_project_with_MaxDepth() + { + _course.CourseName.ShouldBe("Course 1"); + var content = _course.Content[0]; + content.ContentName.ShouldBe("Content 1"); + content.Course.ShouldBeNull(); + } + + class Initializer : DropCreateDatabaseAlways + { + protected override void Seed(ClientContext context) + { + var course = new TrainingCourse { CourseName = "Course 1" }; + context.TrainingCourses.Add(course); + var content = new TrainingContent { ContentName = "Content 1", Course = course }; + context.TrainingContents.Add(content); + course.Content.Add(content); + } + } + + class ClientContext : DbContext + { + public ClientContext() + { + Database.SetInitializer(new Initializer()); + } + public DbSet TrainingCourses { get; set; } + public DbSet TrainingContents { get; set; } + } + + public class TrainingCourse + { + [Key] + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual IList Content { get; set; } = new List(); + } + + public class TrainingContent + { + [Key] + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public virtual TrainingCourse Course { get; set; } + } + + public class TrainingCourseDto + { + public int CourseId { get; set; } + + public string CourseName { get; set; } + + public virtual IList Content { get; set; } + } + + public class TrainingContentDto + { + public int ContentId { get; set; } + + public string ContentName { get; set; } + + public TrainingCourseDto Course { get; set; } + } + } } \ No newline at end of file diff --git a/src/IntegrationTests/MaxDepth/NavigationPropertySO.cs b/src/IntegrationTests/MaxDepth/NavigationPropertySO.cs new file mode 100644 index 0000000000..6d93752954 --- /dev/null +++ b/src/IntegrationTests/MaxDepth/NavigationPropertySO.cs @@ -0,0 +1,109 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests.Net4 +{ + using QueryableExtensions; + using UnitTests; + + + public class NavigationPropertySO : AutoMapperSpecBase + { + CustomerDTO _destination; + + public class Cust + { + + [Key] + public int CustomerID { get; set; } + + public string CustomerNumber { get; set; } + public bool Status { get; set; } + public virtual ICollection Customers { get; set; } + } + + public class Customer + { + [Key] + public int Id { get; set; } + + [ForeignKey("Cust")] + public int CustomerId { get; set; } + public virtual Cust Cust { get; set; } + public bool Status { get; set; } + public string Name1 { get; set; } + } + + public class CustDTO + { + public int CustomerID { get; set; } + public string CustomerNumber { get; set; } + public bool Status { get; set; } + + public virtual ICollection Customers { get; set; } + } + + public class CustomerDTO + { + public int Id { get; set; } + + public int CustomerId { get; set; } + public virtual CustDTO Cust { get; set; } + public bool Status { get; set; } + public string Name1 { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + public DbSet Custs { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + var cust = new Cust { CustomerID = 1 }; + context.Custs.Add(cust); + var customer = new Customer + { + Id = 1, + Name1 = "Bob", + CustomerId = 1, + Cust = cust, + }; + context.Customers.Add(customer); + cust.Customers.Add(customer); + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().MaxDepth(1); + cfg.CreateMap(); + }); + + [Fact] + public void Can_map_with_projection() + { + using(var context = new Context()) + { + _destination = ProjectTo(context.Customers).Single(); + _destination.Id.ShouldBe(1); + _destination.Name1.SequenceEqual("Bob"); + _destination.Cust.CustomerID.ShouldBe(1); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests.Net4/NestedDtos.cs b/src/IntegrationTests/MaxDepth/NestedDtos.cs similarity index 85% rename from src/IntegrationTests.Net4/NestedDtos.cs rename to src/IntegrationTests/MaxDepth/NestedDtos.cs index ca2413c903..9738ddfe64 100644 --- a/src/IntegrationTests.Net4/NestedDtos.cs +++ b/src/IntegrationTests/MaxDepth/NestedDtos.cs @@ -2,7 +2,7 @@ using System.Data.Entity; using System.Linq; using Xunit; -using Should; +using Shouldly; using AutoMapper.QueryableExtensions; using AutoMapper.UnitTests; using System.ComponentModel.DataAnnotations.Schema; @@ -73,23 +73,23 @@ protected override void Seed(TestContext context) protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => { - cfg.CreateMap().MaxDepth(1).ConstructProjectionUsing(s => new SemDto()); - cfg.CreateMap().MaxDepth(1).ConstructProjectionUsing(s => new ArtDto()); + cfg.CreateMap().MaxDepth(1).ConstructUsing(s => new SemDto()); + cfg.CreateMap().MaxDepth(1).ConstructUsing(s => new ArtDto()); }); protected override void Because_of() { using(var context = new TestContext()) { - _destination = context.Arts.ProjectTo(Configuration).FirstOrDefault(); + _destination = ProjectTo(context.Arts).FirstOrDefault(); } } [Fact] public void Should_project_nested_dto() { - _destination.AName.ShouldEqual("art1"); - _destination.Sem.Name.ShouldEqual("sem1"); + _destination.AName.ShouldBe("art1"); + _destination.Sem.Name.ShouldBe("sem1"); } } } \ No newline at end of file diff --git a/src/IntegrationTests/NullCheckCollections.cs b/src/IntegrationTests/NullCheckCollections.cs new file mode 100644 index 0000000000..a83b09e7f2 --- /dev/null +++ b/src/IntegrationTests/NullCheckCollections.cs @@ -0,0 +1,77 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; +using System.ComponentModel.DataAnnotations.Schema; +using System.Collections.Generic; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + + public class NullCheckCollections : AutoMapperSpecBase + { + public class Student + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public string Name { get; set; } + public virtual ICollection ScoreRecords { get; set; } + } + public class ScoreRecord + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public int StudentId { get; set; } + public virtual Student Student { get; set; } + public string Subject { get; set; } + public int Score { get; set; } + } + public class ScoreModel + { + public int? MinScore { get; set; } + public int? MaxScore { get; set; } + } + public class StudentViewModel + { + public int Id { get; set; } + public string Name { get; set; } + public ScoreModel Score { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + public DbSet Students { get; set; } + } + + public class DatabaseInitializer : DropCreateDatabaseAlways + { + protected override void Seed(Context context) + { + context.Students.Add(new Student{ Name = "Bob" }); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.Score, opts => opts.MapFrom(m => m.ScoreRecords)); + cfg.CreateMap, ScoreModel>() + .ForMember(d => d.MinScore, opts => opts.MapFrom(m => m.Min(s => s.Score))) + .ForMember(d => d.MaxScore, opts => opts.MapFrom(m => m.Max(s => s.Score))); + }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + ProjectTo(context.Students).Single().Name.ShouldBe("Bob"); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/NullSubstitute.cs b/src/IntegrationTests/NullSubstitute.cs new file mode 100644 index 0000000000..b3ae6a51b6 --- /dev/null +++ b/src/IntegrationTests/NullSubstitute.cs @@ -0,0 +1,70 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests +{ + using UnitTests; + using QueryableExtensions; + + public class NullSubstitute : AutoMapperSpecBase + { + public class Customer + { + [Key] + public int Id { get; set; } + + public double? Value { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class CustomerViewModel + { + public double Value { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class Context : DbContext + { + public Context() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Customers { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Customers.Add(new Customer + { + Id = 1, + FirstName = "Bob", + LastName = "Smith", + }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.Value, o => o.NullSubstitute(5)); + }); + + [Fact] + public void Can_map_with_projection() + { + using (var context = new Context()) + { + ProjectTo(context.Customers).ToList()[0].Value.ShouldBe(5); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/Parameterization/ParameterizedQueries.cs b/src/IntegrationTests/Parameterization/ParameterizedQueries.cs new file mode 100644 index 0000000000..0f8451b6b5 --- /dev/null +++ b/src/IntegrationTests/Parameterization/ParameterizedQueries.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests.Parameterization +{ + public class ParameterizedQueries : AutoMapperSpecBase + { + public class Entity + { + public int Id { get; set; } + public string Value { get; set; } + } + + public class EntityDto + { + public int Id { get; set; } + public string Value { get; set; } + public string UserName { get; set; } + } + + private class ClientContext : DbContext + { + static ClientContext() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Entities { get; set; } + } + + private class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(ClientContext context) + { + context.Entities.AddRange(new[] + { + new Entity {Value = "Value1"}, + new Entity {Value = "Value2"} + }); + base.Seed(context); + } + } + + + protected override MapperConfiguration Configuration { get; } = + new MapperConfiguration(cfg => + { + string username = null; + cfg.CreateMap() + .ForMember(d => d.UserName, opt => opt.MapFrom(s => username)); + }); + + [Fact] + public async Task Should_parameterize_value() + { + List dtos; + string username; + using (var db = new ClientContext()) + { + username = "Mary"; + var query = ProjectTo(db.Entities, new { username }); + dtos = await query.ToListAsync(); + var constantVisitor = new ConstantVisitor(); + constantVisitor.Visit(query.Expression); + constantVisitor.HasConstant.ShouldBeFalse(); + dtos.All(dto => dto.UserName == username).ShouldBeTrue(); + + username = "Joe"; + query = ProjectTo(db.Entities, new Dictionary { { "username", username }}); + dtos = await query.ToListAsync(); + constantVisitor = new ConstantVisitor(); + constantVisitor.Visit(query.Expression); + constantVisitor.HasConstant.ShouldBeTrue(); + dtos.All(dto => dto.UserName == username).ShouldBeTrue(); + + username = "Jane"; + query = db.Entities.Select(e => new EntityDto + { + Id = e.Id, + Value = e.Value, + UserName = username + }); + dtos = await query.ToListAsync(); + dtos.All(dto => dto.UserName == username).ShouldBeTrue(); + constantVisitor = new ConstantVisitor(); + constantVisitor.Visit(query.Expression); + constantVisitor.HasConstant.ShouldBeFalse(); + } + } + + private class ConstantVisitor : ExpressionVisitor + { + public bool HasConstant { get; private set; } + + protected override Expression VisitConstant(ConstantExpression node) + { + if (node.Type == typeof(string)) + HasConstant = true; + return base.VisitConstant(node); + } + } + } +} \ No newline at end of file diff --git a/src/IntegrationTests/ProjectionOrder/ProjectionOrderTest.cs b/src/IntegrationTests/ProjectionOrder/ProjectionOrderTest.cs new file mode 100644 index 0000000000..aa23064f4f --- /dev/null +++ b/src/IntegrationTests/ProjectionOrder/ProjectionOrderTest.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Xunit; + +namespace AutoMapper.IntegrationTests.ProjectionOrder +{ + public class ProjectionOrderTest : AutoMapperSpecBase + { + public class Destination + { + public int Count { get; set; } + public DateTime Date { get; set; } + } + + public class ChildDestination + { + public string String { get; set; } + } + + public abstract class BaseEntity + { + public int Id { get; set; } + } + + + public class Source1 : BaseEntity + { + public DateTime Date { get; set; } + public virtual List Items { get; set; } + } + + public class Source2 : BaseEntity + { + public virtual List Items { get; set; } + } + + public class ChildSource : BaseEntity + { + public string String { get; set; } + } + + private class ClientContext : DbContext + { + static ClientContext() + { + Database.SetInitializer(new DropCreateDatabaseAlways()); + } + + public DbSet Source1 { get; set; } + + public DbSet Source2 { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Count, opt => opt.MapFrom(src => src.Items.Count())) + .ForMember(dest => dest.Date, opt => opt.MapFrom(src => src.Date)); + + cfg.CreateMap() + .ForMember(dest => dest.Count, opt => opt.MapFrom(src => src.Items.Count())) + .ForMember(dest => dest.Date, opt => opt.MapFrom(src => DateTime.MinValue)); + }); + + [Fact] + public void Should_Not_Throw_NotSupportedException_On_Union() + { + using (var context = new ClientContext()) + { + ProjectTo(context.Source1).Union(ProjectTo(context.Source2)).ToString(); + } + } + } +} diff --git a/src/IntegrationTests/ValueTransformers/ValueTransformerTests.cs b/src/IntegrationTests/ValueTransformers/ValueTransformerTests.cs new file mode 100644 index 0000000000..d879237ca7 --- /dev/null +++ b/src/IntegrationTests/ValueTransformers/ValueTransformerTests.cs @@ -0,0 +1,404 @@ +using System.ComponentModel.DataAnnotations; +using System.Data.Entity; +using System.Threading.Tasks; +using AutoMapper.QueryableExtensions; +using AutoMapper.UnitTests; +using Shouldly; +using Xunit; + +namespace AutoMapper.IntegrationTests.ValueTransformers +{ + namespace ValueTransformerTests + { + public class BasicTransforming : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = "Jimmy" }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + + [Fact] + public async Task Should_transform_value() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe("Jimmy is straight up dope"); + } + } + } + + public class StackingTransformers : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = "Jimmy" }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ValueTransformers.Add(dest => dest + " is straight up dope"); + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + }); + + [Fact] + public async Task Should_stack_transformers_in_order() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe("Jimmy is straight up dope! No joke!"); + } + } + } + + public class DifferentProfiles : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ValueTransformers.Add(dest => dest + " is straight up dope"); + cfg.CreateProfile("Other", p => p.ValueTransformers.Add(dest => dest + "! No joke!")); + }); + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = "Jimmy" }); + + base.Seed(context); + } + } + + [Fact] + public async Task Should_not_apply_other_transform() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe("Jimmy is straight up dope"); + } + } + } + + public class StackingRootConfigAndProfileTransform : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = "Jimmy" }); + + base.Seed(context); + } + } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + cfg.CreateProfile("Other", p => + { + p.CreateMap(); + p.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + }); + + [Fact] + public async Task ShouldApplyProfileFirstThenRoot() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe("Jimmy is straight up dope! No joke!"); + } + } + } + + public class TransformingValueTypes : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = 5 }); + + base.Seed(context); + } + } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest * 2); + cfg.CreateProfile("Other", p => + { + p.CreateMap(); + p.ValueTransformers.Add(dest => dest + 3); + }); + }); + + [Fact] + public async Task ShouldApplyProfileFirstThenRoot() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe((5 + 3) * 2); + } + } + } + + public class StackingRootAndProfileAndMemberConfig : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = "Jimmy" }); + + base.Seed(context); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + cfg.CreateProfile("Other", p => + { + p.CreateMap() + .ValueTransformers.Add(dest => dest + ", for real,"); + p.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + }); + + [Fact] + public async Task ShouldApplyTypeMapThenProfileThenRoot() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe("Jimmy, for real, is straight up dope! No joke!"); + } + } + } + + public class StackingTypeMapAndRootAndProfileAndMemberConfig : AutoMapperSpecBase + { + public class Source + { + [Key] + public int Id { get; set; } + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + public class Context : DbContext + { + public Context() + : base() + { + Database.SetInitializer(new DatabaseInitializer()); + } + + public DbSet Sources { get; set; } + } + + public class DatabaseInitializer : CreateDatabaseIfNotExists + { + protected override void Seed(Context context) + { + context.Sources.Add(new Source { Value = "Jimmy" }); + + base.Seed(context); + } + } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + cfg.CreateProfile("Other", p => + { + p.CreateMap() + .AddTransform(dest => dest + ", for real,") + .ForMember(d => d.Value, opt => opt.AddTransform(d => d + ", seriously")); + p.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + }); + + [Fact] + public async Task ShouldApplyTypeMapThenProfileThenRoot() + { + using (var context = new Context()) + { + var dest = await ProjectTo(context.Sources).SingleAsync(); + + dest.Value.ShouldBe("Jimmy, seriously, for real, is straight up dope! No joke!"); + } + } + } + + + } +} \ No newline at end of file diff --git a/src/NDependOut/InfoWarnings.xml b/src/NDependOut/InfoWarnings.xml deleted file mode 100644 index 1de32c70f9..0000000000 --- a/src/NDependOut/InfoWarnings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - Begin full analysis with NDepend v6.2.1.8630 - No Baseline for Comparison loaded. - Concurrent mode - .NET Assembly loaded from {C:\dev\AutoMapper\src\UnitTests\bin\Debug} - AutoMapper.dll v0.0.0.0 - .NET Assemblies loaded from {C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319} - mscorlib.dll v4.0.0.0 - System.Core.dll v4.0.0.0 - System.dll v4.0.0.0 - Microsoft.CSharp.dll v4.0.0.0 - No application or third party assembly found in directory {C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\WPF} - 113 source files parsed ; all source files found ; all source files in-sync with PDB - 0 code rule has been extracted from code. - No dependency cycle detected in assemblies referencement graph. - Do merge code generated by compiler into application code. - Log trend metrics values. - NDepend analysis done. Duration: 00:06 - \ No newline at end of file diff --git a/src/NDependOut/NDependAnalysisResult_AutoMapper_2016Feb22_19h41.ndar b/src/NDependOut/NDependAnalysisResult_AutoMapper_2016Feb22_19h41.ndar deleted file mode 100644 index be762a61c6..0000000000 Binary files a/src/NDependOut/NDependAnalysisResult_AutoMapper_2016Feb22_19h41.ndar and /dev/null differ diff --git a/src/NDependOut/TrendMetrics/NDependTrendData2016.xml b/src/NDependOut/TrendMetrics/NDependTrendData2016.xml deleted file mode 100644 index 6bd159115d..0000000000 --- a/src/NDependOut/TrendMetrics/NDependTrendData2016.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/NuGet.config b/src/NuGet.config deleted file mode 100644 index 3ddb098d10..0000000000 --- a/src/NuGet.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/UnitTests.Portable/UnitTests.Portable.csproj b/src/UnitTests.Portable/UnitTests.Portable.csproj deleted file mode 100644 index 3413954bcd..0000000000 --- a/src/UnitTests.Portable/UnitTests.Portable.csproj +++ /dev/null @@ -1,83 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {273A9243-2FFD-485E-9645-312A10A75BF9} - Library - Properties - AutoMapper.UnitTests.Portable - AutoMapper.UnitTests.Portable - v4.5 - 512 - false - - - - ..\ - true - 67828423 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;PORTABLE - prompt - 4 - AllRules.ruleset - false - - - pdbonly - false - bin\Release\ - TRACE;PORTABLE - prompt - 4 - AllRules.ruleset - false - - - - ..\packages\Fixie.1.0.0.41\lib\net45\Fixie.dll - True - - - - ..\..\lib\Rhino.Mocks.dll - - - - 3.5 - - - - - - - TypeExtensions.cs - - - - - %(RecursiveDir)%(Filename)%(Extension) - - - - - {7ff22411-6e09-4504-bfe6-f1489c927e61} - AutoMapper.Portable - - - - - - - - - - \ No newline at end of file diff --git a/src/UnitTests.Portable/packages.config b/src/UnitTests.Portable/packages.config deleted file mode 100644 index decf303bd7..0000000000 --- a/src/UnitTests.Portable/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/UnitTests/AddProfiles.cs b/src/UnitTests/AddProfiles.cs new file mode 100644 index 0000000000..d2b6784a63 --- /dev/null +++ b/src/UnitTests/AddProfiles.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class AddProfiles : SpecBase + { + public class Source { } + public class Dest { } + + public class ForwardProfile : Profile + { + public ForwardProfile() + { + CreateMap(); + } + } + + public class ReverseProfile : Profile + { + public ReverseProfile() + { + CreateMap(); + } + } + + [Fact] + public void Should_not_throw_when_loading_multiple_profiles() + { + IEnumerable profiles = new Profile[] { new ForwardProfile(), new ReverseProfile() }; + var config = new MapperConfiguration(cfg => cfg.AddProfiles(profiles)); + + config.AssertConfigurationIsValid(); + int result = config.Profiles.Count(); + result.ShouldBe(3); // default plus two specifically added. + } + + } +} \ No newline at end of file diff --git a/src/UnitTests/App.config b/src/UnitTests/App.config index 98d1423eb0..9b07a3cb9f 100644 --- a/src/UnitTests/App.config +++ b/src/UnitTests/App.config @@ -8,4 +8,8 @@ - + + + + + diff --git a/src/UnitTests/ArraysAndLists.cs b/src/UnitTests/ArraysAndLists.cs index 05a81987d1..7f66d335fc 100644 --- a/src/UnitTests/ArraysAndLists.cs +++ b/src/UnitTests/ArraysAndLists.cs @@ -4,558 +4,783 @@ using System.Collections.ObjectModel; using System.ComponentModel; using Xunit; -using Should; +using Shouldly; using System.Linq; using System.Dynamic; +using System.Linq.Expressions; -namespace AutoMapper.UnitTests +namespace AutoMapper.UnitTests.ArraysAndLists { - namespace ArraysAndLists - { - public class When_mapping_collections : AutoMapperSpecBase + public class When_mapping_to_an_array_as_ICollection_with_MapAtRuntime : AutoMapperSpecBase + { + Destination _destination; + SourceItem[] _sourceItems = new [] { new SourceItem { Value = "1" }, new SourceItem { Value = "2" }, new SourceItem { Value = "3" } }; + + public class Source { - Author mappedAuthor; + public ICollection Items { get; set; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(delegate{}); + public class Destination + { + public ICollection Items { get; set; } + } - protected override void Because_of() - { - dynamic authorDynamic = new ExpandoObject(); - authorDynamic.Name = "Charles Dickens"; - dynamic book1 = new ExpandoObject(); - book1.Name = "Great Expectations"; - dynamic book2 = new ExpandoObject(); - book2.Name = "Oliver Twist"; - authorDynamic.Books = new List { book1, book2 }; - mappedAuthor = Mapper.Map(authorDynamic); - } + public class SourceItem + { + public string Value { get; set; } + } - [Fact] - public void Should_map_by_item_type() - { - mappedAuthor.Name.ShouldEqual("Charles Dickens"); - mappedAuthor.Books[0].Name.ShouldEqual("Great Expectations"); - mappedAuthor.Books[1].Name.ShouldEqual("Oliver Twist"); - } + public class DestinationItem + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap().ForMember(d=>d.Items, o=>o.MapAtRuntime()); + c.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source { Items = _sourceItems }; + _destination = Mapper.Map(source, new Destination { Items = new[] { new DestinationItem { Value = "4" } } }); + } + + [Fact] + public void Should_map_ok() + { + _destination.Items.Select(i => i.Value).SequenceEqual(_sourceItems.Select(i => i.Value)).ShouldBeTrue(); + } + } + + public class When_mapping_an_array : AutoMapperSpecBase + { + decimal[] _source = Enumerable.Range(1, 10).Select(i=>(decimal)i).ToArray(); + decimal[] _destination; + + protected override MapperConfiguration Configuration => new MapperConfiguration(c =>{}); + + protected override void Because_of() + { + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_return_a_copy() + { + _destination.ShouldNotBeSameAs(_source); + } + } + + public class When_mapping_a_primitive_array : AutoMapperSpecBase + { + int[] _source = Enumerable.Range(1, 10).ToArray(); + long[] _destination; + + protected override MapperConfiguration Configuration => new MapperConfiguration(c =>{}); + + protected override void Because_of() + { + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_return_a_copy() + { + var source = new int[] {1, 2, 3, 4}; + var dest = new long[4]; + Array.Copy(source, dest, 4); + dest[3].ShouldBe(4L); + + var plan = Configuration.BuildExecutionPlan(typeof(int[]), typeof(long[])); + _destination.ShouldNotBeSameAs(_source); + } + } + + public class When_mapping_a_primitive_array_with_custom_mapping_function : AutoMapperSpecBase + { + int[] _source = Enumerable.Range(1, 10).ToArray(); + int[] _destination; + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => c.CreateMap().ConstructUsing(i => i * 1000)); - public class Author + protected override void Because_of() + { + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_map_each_item() + { + for (var i = 0; i < _source.Length; i++) { - public string Name { get; set; } - public Book[] Books { get; set; } + _destination[i].ShouldBe((i+1) * 1000); } + } + } + + public class When_mapping_a_primitive_array_with_custom_object_mapper : AutoMapperSpecBase + { + int[] _source = Enumerable.Range(1, 10).ToArray(); + int[] _destination; + + private class IntToIntMapper : IObjectMapper + { + public bool IsMatch(TypePair context) + => context.SourceType == typeof(int) && context.DestinationType == typeof(int); + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, + Expression sourceExpression, Expression destExpression, Expression contextExpression) + => Expression.Multiply(Expression.Convert(sourceExpression, typeof(int)), Expression.Constant(1000)); + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => c.Mappers.Insert(0, new IntToIntMapper())); - public class Book + protected override void Because_of() + { + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_not_use_custom_mapper_but_probably_should() + { + for (var i = 0; i < _source.Length; i++) { - public string Name { get; set; } + _destination[i].ShouldBe(i + 1); } } + } + + public class When_mapping_null_list_to_array: AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public List Items { get; set; } + } + + class Destination + { + public DestinationItem[] Items { get; set; } + } + + class SourceItem + { + public int Value { get; set; } + } + + class DestinationItem + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Items.Length.ShouldBe(0); + } + } + + public class When_mapping_null_array_to_list : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public SourceItem[] Items { get; set; } + } + + class Destination + { + public List Items { get; set; } + } + + class SourceItem + { + public int Value { get; set; } + } + + class DestinationItem + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Items.Count.ShouldBe(0); + } + } + + public class When_mapping_collections : AutoMapperSpecBase + { + Author mappedAuthor; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(delegate{}); + + protected override void Because_of() + { + dynamic authorDynamic = new ExpandoObject(); + authorDynamic.Name = "Charles Dickens"; + dynamic book1 = new ExpandoObject(); + book1.Name = "Great Expectations"; + dynamic book2 = new ExpandoObject(); + book2.Name = "Oliver Twist"; + authorDynamic.Books = new List { book1, book2 }; + mappedAuthor = Mapper.Map(authorDynamic); + } + + [Fact] + public void Should_map_by_item_type() + { + mappedAuthor.Name.ShouldBe("Charles Dickens"); + mappedAuthor.Books[0].Name.ShouldBe("Great Expectations"); + mappedAuthor.Books[1].Name.ShouldBe("Oliver Twist"); + } + + public class Author + { + public string Name { get; set; } + public Book[] Books { get; set; } + } + + public class Book + { + public string Name { get; set; } + } + } + + public class When_mapping_to_an_existing_array_typed_as_IEnumerable : AutoMapperSpecBase + { + private Destination _destination = new Destination(); + + public class Source + { + public int[] IntCollection { get; set; } = new int[0]; + } + + public class Destination + { + public IEnumerable IntCollection { get; set; } = new[] { 1, 2, 3, 4, 5 }; + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source(), _destination); + } + + [Fact] + public void Should_create_destination_array_the_same_size_as_the_source() + { + _destination.IntCollection.Count().ShouldBe(0); + } + } + + public class When_mapping_to_a_concrete_non_generic_ienumerable : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int[] Values { get; set; } + public List Values2 { get; set; } + } + + public class Destination + { + public IEnumerable Values { get; set; } + public IEnumerable Values2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 }, Values2 = new List { 9, 8, 7, 6 } }); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain(1); + _destination.Values.ShouldContain(2); + _destination.Values.ShouldContain(3); + _destination.Values.ShouldContain(4); + } + + [Fact] + public void Should_map_from_the_generic_list_of_values() + { + _destination.Values2.ShouldNotBeNull(); + _destination.Values2.ShouldContain(9); + _destination.Values2.ShouldContain(8); + _destination.Values2.ShouldContain(7); + _destination.Values2.ShouldContain(6); + } + } + + public class When_mapping_to_a_concrete_generic_ienumerable : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int[] Values { get; set; } + public List Values2 { get; set; } + } + + public class Destination + { + public IEnumerable Values { get; set; } + public IEnumerable Values2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 }, Values2 = new List { 9, 8, 7, 6 } }); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain(1); + _destination.Values.ShouldContain(2); + _destination.Values.ShouldContain(3); + _destination.Values.ShouldContain(4); + } + + [Fact] + public void Should_map_from_the_generic_list_of_values_with_formatting() + { + _destination.Values2.ShouldNotBeNull(); + _destination.Values2.ShouldContain("9"); + _destination.Values2.ShouldContain("8"); + _destination.Values2.ShouldContain("7"); + _destination.Values2.ShouldContain("6"); + } + } + + public class When_mapping_to_a_concrete_non_generic_icollection : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int[] Values { get; set; } + public List Values2 { get; set; } + } + + public class Destination + { + public ICollection Values { get; set; } + public ICollection Values2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 }, Values2 = new List { 9, 8, 7, 6 } }); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain(1); + _destination.Values.ShouldContain(2); + _destination.Values.ShouldContain(3); + _destination.Values.ShouldContain(4); + } + + [Fact] + public void Should_map_from_a_non_array_source() + { + _destination.Values2.ShouldNotBeNull(); + _destination.Values2.ShouldContain(9); + _destination.Values2.ShouldContain(8); + _destination.Values2.ShouldContain(7); + _destination.Values2.ShouldContain(6); + } + } + + public class When_mapping_to_a_concrete_generic_icollection : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int[] Values { get; set; } + } + + public class Destination + { + public ICollection Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 } }); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain("1"); + _destination.Values.ShouldContain("2"); + _destination.Values.ShouldContain("3"); + _destination.Values.ShouldContain("4"); + } + } + + public class When_mapping_to_a_concrete_ilist : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int[] Values { get; set; } + } + + public class Destination + { + public IList Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 } }); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain(1); + _destination.Values.ShouldContain(2); + _destination.Values.ShouldContain(3); + _destination.Values.ShouldContain(4); + } + } + + public class When_mapping_to_a_concrete_generic_ilist : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int[] Values { get; set; } + } + + public class Destination + { + public IList Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 } }); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain("1"); + _destination.Values.ShouldContain("2"); + _destination.Values.ShouldContain("3"); + _destination.Values.ShouldContain("4"); + } + } + + public class When_mapping_to_a_custom_list_with_the_same_type : AutoMapperSpecBase + { + private Destination _destination; + private Source _source; + + public class ValueCollection : Collection + { + } + + public class Source + { + public ValueCollection Values { get; set; } + } + + public class Destination + { + public ValueCollection Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Source { Values = new ValueCollection { 1, 2, 3, 4 } }; + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_assign_the_value_directly() + { + _source.Values.ShouldBe(_destination.Values); + } + } + + public class When_mapping_to_a_custom_collection_with_the_same_type_not_implementing_IList : AutoMapperSpecBase + { + private Source _source; - public class When_mapping_to_an_existing_array_typed_as_IEnumerable : AutoMapperSpecBase + private Destination _destination; + + public class ValueCollection : IEnumerable { - private Destination _destination = new Destination(); + private List implementation = new List(); - public class Source + public ValueCollection(IEnumerable items) { - public int[] IntCollection { get; set; } = new int[0]; + implementation = items.ToList(); } - public class Destination + public IEnumerator GetEnumerator() { - public IEnumerable IntCollection { get; set; } = new[] { 1, 2, 3, 4, 5 }; + return implementation.GetEnumerator(); } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + IEnumerator IEnumerable.GetEnumerator() { - cfg.CreateMap(); - }); + return ((IEnumerable)implementation).GetEnumerator(); + } + } + + public class Source + { + public ValueCollection Values { get; set; } + } + + public class Destination + { + public ValueCollection Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Establish_context() + { + _source = new Source { Values = new ValueCollection(new[] { 1, 2, 3, 4 }) }; + } + + protected override void Because_of() + { + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_map_the_list_of_source_items() + { + // here not the EnumerableMapper is used, but just the AssignableMapper! + _destination.Values.ShouldBeSameAs(_source.Values); + _destination.Values.ShouldNotBeNull(); + _destination.Values.ShouldContain(1); + _destination.Values.ShouldContain(2); + _destination.Values.ShouldContain(3); + _destination.Values.ShouldContain(4); + } + } + + public class When_mapping_to_a_collection_with_instantiation_managed_by_the_destination : AutoMapperSpecBase + { + private Destination _destination; + private Source _source; + + public class SourceItem + { + public int Value { get; set; } + } + + public class DestItem + { + public int Value { get; set; } + } + + public class Source + { + public List Values { get; set; } + } + + public class Destination + { + private List _values = new List(); - protected override void Because_of() + public List Values { - _destination = Mapper.Map(new Source(), _destination); + get { return _values; } } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Values, opt => opt.UseDestinationValue()); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Source { Values = new List { new SourceItem { Value = 5 }, new SourceItem { Value = 10 } } }; + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_assign_the_value_directly() + { + _destination.Values.Count.ShouldBe(2); + _destination.Values[0].Value.ShouldBe(5); + _destination.Values[1].Value.ShouldBe(10); + } + } + + public class When_mapping_to_an_existing_list_with_existing_items : AutoMapperSpecBase + { + private Destination _destination; + private Source _source; + + public class SourceItem + { + public int Value { get; set; } + } + + public class DestItem + { + public int Value { get; set; } + } + + public class Source + { + public List Values { get; set; } + } - [Fact] - public void Should_create_destination_array_the_same_size_as_the_source() + public class Destination + { + private List _values = new List(); + + public List Values { - _destination.IntCollection.Count().ShouldEqual(0); + get { return _values; } } } - public class When_mapping_to_a_concrete_non_generic_ienumerable : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int[] Values { get; set; } - public List Values2 { get; set; } - } - - public class Destination - { - public IEnumerable Values { get; set; } - public IEnumerable Values2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 }, Values2 = new List { 9, 8, 7, 6 } }); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain(1); - _destination.Values.ShouldContain(2); - _destination.Values.ShouldContain(3); - _destination.Values.ShouldContain(4); - } - - [Fact] - public void Should_map_from_the_generic_list_of_values() - { - _destination.Values2.ShouldNotBeNull(); - _destination.Values2.ShouldContain(9); - _destination.Values2.ShouldContain(8); - _destination.Values2.ShouldContain(7); - _destination.Values2.ShouldContain(6); - } - } - - public class When_mapping_to_a_concrete_generic_ienumerable : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int[] Values { get; set; } - public List Values2 { get; set; } - } - - public class Destination - { - public IEnumerable Values { get; set; } - public IEnumerable Values2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 }, Values2 = new List { 9, 8, 7, 6 } }); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain(1); - _destination.Values.ShouldContain(2); - _destination.Values.ShouldContain(3); - _destination.Values.ShouldContain(4); - } - - [Fact] - public void Should_map_from_the_generic_list_of_values_with_formatting() - { - _destination.Values2.ShouldNotBeNull(); - _destination.Values2.ShouldContain("9"); - _destination.Values2.ShouldContain("8"); - _destination.Values2.ShouldContain("7"); - _destination.Values2.ShouldContain("6"); - } - } - - public class When_mapping_to_a_concrete_non_generic_icollection : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int[] Values { get; set; } - public List Values2 { get; set; } - } - - public class Destination - { - public ICollection Values { get; set; } - public ICollection Values2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 }, Values2 = new List { 9, 8, 7, 6 } }); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain(1); - _destination.Values.ShouldContain(2); - _destination.Values.ShouldContain(3); - _destination.Values.ShouldContain(4); - } - - [Fact] - public void Should_map_from_a_non_array_source() - { - _destination.Values2.ShouldNotBeNull(); - _destination.Values2.ShouldContain(9); - _destination.Values2.ShouldContain(8); - _destination.Values2.ShouldContain(7); - _destination.Values2.ShouldContain(6); - } - } - - public class When_mapping_to_a_concrete_generic_icollection : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int[] Values { get; set; } - } - - public class Destination - { - public ICollection Values { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 } }); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain("1"); - _destination.Values.ShouldContain("2"); - _destination.Values.ShouldContain("3"); - _destination.Values.ShouldContain("4"); - } - } - - public class When_mapping_to_a_concrete_ilist : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int[] Values { get; set; } - } - - public class Destination - { - public IList Values { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 } }); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain(1); - _destination.Values.ShouldContain(2); - _destination.Values.ShouldContain(3); - _destination.Values.ShouldContain(4); - } - } - - public class When_mapping_to_a_concrete_generic_ilist : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int[] Values { get; set; } - } - - public class Destination - { - public IList Values { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Values = new[] { 1, 2, 3, 4 } }); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain("1"); - _destination.Values.ShouldContain("2"); - _destination.Values.ShouldContain("3"); - _destination.Values.ShouldContain("4"); - } - } - - public class When_mapping_to_a_custom_list_with_the_same_type : AutoMapperSpecBase - { - private Destination _destination; - private Source _source; - - public class ValueCollection : Collection - { - } - - public class Source - { - public ValueCollection Values { get; set; } - } - - public class Destination - { - public ValueCollection Values { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _source = new Source { Values = new ValueCollection { 1, 2, 3, 4 } }; - _destination = Mapper.Map(_source); - } - - [Fact] - public void Should_assign_the_value_directly() - { - _source.Values.ShouldEqual(_destination.Values); - } - } - - public class When_mapping_to_a_custom_collection_with_the_same_type_not_implementing_IList : AutoMapperSpecBase - { - private Source _source; - - private Destination _destination; - - public class ValueCollection : IEnumerable - { - private List implementation = new List(); - - public ValueCollection(IEnumerable items) - { - implementation = items.ToList(); - } - - public IEnumerator GetEnumerator() - { - return implementation.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return ((IEnumerable)implementation).GetEnumerator(); - } - } - - public class Source - { - public ValueCollection Values { get; set; } - } - - public class Destination - { - public ValueCollection Values { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Establish_context() - { - _source = new Source { Values = new ValueCollection(new[] { 1, 2, 3, 4 }) }; - } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Values, opt => opt.UseDestinationValue()); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Source { Values = new List { new SourceItem { Value = 5 }, new SourceItem { Value = 10 } } }; + _destination = new Destination(); + _destination.Values.Add(new DestItem()); + Mapper.Map(_source, _destination); + } + + [Fact] + public void Should_clear_the_list_before_mapping() + { + _destination.Values.Count.ShouldBe(2); + } + } - protected override void Because_of() - { - _destination = Mapper.Map(_source); - } - - [Fact] - public void Should_map_the_list_of_source_items() - { - // here not the EnumerableMapper is used, but just the AssignableMapper! - _destination.Values.ShouldBeSameAs(_source.Values); - _destination.Values.ShouldNotBeNull(); - _destination.Values.ShouldContain(1); - _destination.Values.ShouldContain(2); - _destination.Values.ShouldContain(3); - _destination.Values.ShouldContain(4); - } - } - - public class When_mapping_to_a_collection_with_instantiation_managed_by_the_destination : AutoMapperSpecBase - { - private Destination _destination; - private Source _source; - - public class SourceItem - { - public int Value { get; set; } - } - - public class DestItem - { - public int Value { get; set; } - } - - public class Source - { - public List Values { get; set; } - } - - public class Destination - { - private List _values = new List(); - - public List Values - { - get { return _values; } - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Values, opt => opt.UseDestinationValue()); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _source = new Source { Values = new List { new SourceItem { Value = 5 }, new SourceItem { Value = 10 } } }; - _destination = Mapper.Map(_source); - } - - [Fact] - public void Should_assign_the_value_directly() - { - _destination.Values.Count.ShouldEqual(2); - _destination.Values[0].Value.ShouldEqual(5); - _destination.Values[1].Value.ShouldEqual(10); - } - } - - public class When_mapping_to_an_existing_list_with_existing_items : AutoMapperSpecBase - { - private Destination _destination; - private Source _source; - - public class SourceItem - { - public int Value { get; set; } - } - - public class DestItem - { - public int Value { get; set; } - } - - public class Source - { - public List Values { get; set; } - } - - public class Destination - { - private List _values = new List(); - - public List Values - { - get { return _values; } - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Values, opt => opt.UseDestinationValue()); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _source = new Source { Values = new List { new SourceItem { Value = 5 }, new SourceItem { Value = 10 } } }; - _destination = new Destination(); - _destination.Values.Add(new DestItem()); - Mapper.Map(_source, _destination); - } - - [Fact] - public void Should_clear_the_list_before_mapping() - { - _destination.Values.Count.ShouldEqual(2); - } - } - - public class When_mapping_a_collection_with_null_members : AutoMapperSpecBase - { - const string FirstString = null; - - private IEnumerable _strings = new List { FirstString }; - private List _mappedStrings = new List(); - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = true; - }); - - protected override void Because_of() - { - _mappedStrings = Mapper.Map, List>(_strings); - } - - [Fact] - public void Should_map_correctly() - { - _mappedStrings.ShouldNotBeNull(); - _mappedStrings.Count.ShouldEqual(1); - _mappedStrings[0].ShouldBeNull(); - } - } - } + public class When_mapping_a_collection_with_null_members : AutoMapperSpecBase + { + const string FirstString = null; + + private IEnumerable _strings = new List { FirstString }; + private List _mappedStrings = new List(); + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = true; + }); + + protected override void Because_of() + { + _mappedStrings = Mapper.Map, List>(_strings); + } + + [Fact] + public void Should_map_correctly() + { + _mappedStrings.ShouldNotBeNull(); + _mappedStrings.Count.ShouldBe(1); + _mappedStrings[0].ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/AssemblyScanning.cs b/src/UnitTests/AssemblyScanning.cs new file mode 100644 index 0000000000..8a3afba729 --- /dev/null +++ b/src/UnitTests/AssemblyScanning.cs @@ -0,0 +1,67 @@ +using System.Linq; + +namespace AutoMapper.UnitTests +{ + namespace AssemblyScanning + { + using Shouldly; + using Xunit; + + public class When_scanning_by_assembly : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AddMaps(new[] { typeof(When_scanning_by_assembly).Assembly(), typeof(Mapper).Assembly }); + }); + + [Fact] + public void Should_load_profiles() + { + Configuration.GetAllTypeMaps().Length.ShouldBeGreaterThan(0); + } + + [Fact] + public void Should_load_internal_profiles() + { + Configuration.Profiles.Where(t => t.Name == InternalProfile.Name).ShouldNotBeEmpty(); + } + } + + internal class InternalProfile : Profile + { + public const string Name = "InternalProfile"; + + public InternalProfile() : base(Name) + { + } + } + + public class When_scanning_by_type : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AddMaps(new[] { typeof(When_scanning_by_assembly) }); + }); + + [Fact] + public void Should_load_profiles() + { + Configuration.GetAllTypeMaps().Length.ShouldBeGreaterThan(0); + } + } + + public class When_scanning_by_name : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AddMaps(new[] { typeof(When_scanning_by_name).Assembly().FullName }); + }); + + [Fact] + public void Should_load_profiles() + { + Configuration.GetAllTypeMaps().Length.ShouldBeGreaterThan(0); + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/AssertionExtensions.cs b/src/UnitTests/AssertionExtensions.cs index a33aa38255..60511b32c2 100644 --- a/src/UnitTests/AssertionExtensions.cs +++ b/src/UnitTests/AssertionExtensions.cs @@ -1,57 +1,37 @@ -using System; -using System.Collections; -using System.Linq; -using System.Reflection; -using Should.Core.Exceptions; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - public delegate void ThrowingAction(); - - public static class AssertionExtensions - { - public static void ShouldNotBeThrownBy(this Type exception, Action action) - { - try - { - action(); - } - catch (Exception ex) - { - if (exception.IsInstanceOfType(ex)) - { - throw new AssertException(string.Format("Expected no exception of type {0} to be thrown.", exception), ex); - } - } - } - - public static void ShouldContain(this IEnumerable items, object item) - { - CollectionAssertExtensions.ShouldContain(items.Cast(), item); - } - - public static void ShouldBeThrownBy(this Type exceptionType, ThrowingAction action) - { - Exception e = null; - - try - { - action.Invoke(); - } - catch (Exception ex) - { - e = ex; - } - - e.ShouldNotBeNull(); - e.ShouldBeType(exceptionType); - } - - public static void ShouldNotBeInstanceOf(this object actual) - { - actual.ShouldNotBeType(); - } - } +using System; +using System.Collections; +using System.Linq; +using Shouldly; + +namespace AutoMapper.UnitTests +{ + public static class AssertionExtensions + { + public static void ShouldContain(this IEnumerable items, object item) + => ShouldBeEnumerableTestExtensions.ShouldContain(items.Cast(), item); + + public static void ShouldBeEmpty(this IEnumerable items) + => ShouldBeEnumerableTestExtensions.ShouldBeEmpty(items.Cast()); + + public static void ShouldBeThrownBy(this Type exceptionType, Action action) + => action.ShouldThrow(exceptionType); + + public static void ShouldThrowException(this Action action, Action customAssertion) where T : Exception + { + bool throws = false; + try + { + action(); + } + catch (T e) + { + throws = true; + customAssertion(e); + } + throws.ShouldBeTrue(); + } + + public static void ShouldNotBeThrownBy(this Type exceptionType, Action action) + => action.ShouldNotThrow(); + } } \ No newline at end of file diff --git a/src/UnitTests/AttributeBasedMaps.cs b/src/UnitTests/AttributeBasedMaps.cs new file mode 100644 index 0000000000..b9027425c7 --- /dev/null +++ b/src/UnitTests/AttributeBasedMaps.cs @@ -0,0 +1,857 @@ +using AutoMapper.Configuration.Annotations; +using Shouldly; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace AutoMapper.UnitTests +{ + namespace AttributeBasedMaps + { + public class When_specifying_map_with_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_map_with_attribute)); + }); + + [Fact] + public void Should_map() + { + var source = new Source {Value = 5}; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe(5); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_map_and_reverse_map_with_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source), ReverseMap = true)] + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_map_and_reverse_map_with_attribute)); + }); + + [Fact] + public void Should_reverse_map() + { + var dest = new Dest {Value = 5}; + var source = Mapper.Map(dest); + + source.Value.ShouldBe(5); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_duplicating_map_configuration_with_code_and_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_map_and_reverse_map_with_attribute)); + cfg.CreateMap(); + }); + + [Fact] + public void Should_not_validate_successfully() + { + typeof(DuplicateTypeMapConfigurationException).ShouldBeThrownBy(() => Configuration.AssertConfigurationIsValid()); + + } + } + + public class When_specifying_source_member_name_via_attributes : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [SourceMember("Value")] + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_source_member_name_via_attributes)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 5 + }; + + var dest = Mapper.Map(source); + + dest.OtherValue.ShouldBe(source.Value); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_source_member_name_via_attributes_using_nameof_operator : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [SourceMember(nameof(Source.Value))] + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_source_member_name_via_attributes)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 5 + }; + + var dest = Mapper.Map(source); + + dest.OtherValue.ShouldBe(source.Value); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_null_substitute_via_attribute : NonValidatingSpecBase + { + public class Source + { + public string Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [NullSubstitute("Value")] + [SourceMember(nameof(Source.Value))] + public string OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_source_member_name_via_attributes)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = null + }; + + var dest = Mapper.Map(source); + + dest.OtherValue.ShouldBe("Value"); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_value_resolver_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [ValueResolver(typeof(MyValueResolver))] + public int OtherValue { get; set; } + } + + public class MyValueResolver : IValueResolver + { + public int Resolve(Source source, Dest destination, int destMember, ResolutionContext context) + { + return source.Value + 5; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_source_member_name_via_attributes)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 6 + }; + + var dest = Mapper.Map(source); + + dest.OtherValue.ShouldBe(11); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_member_value_resolver_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [ValueResolver(typeof(MyMemberValueResolver))] + [SourceMember(nameof(Source.Value))] + public int Value { get; set; } + } + + public class MyMemberValueResolver : IMemberValueResolver + { + public int Resolve(Source source, Dest destination, int sourceMember, int destMember, ResolutionContext context) + { + return sourceMember + 5; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_value_converter_via_attribute)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 6 + }; + + var dest = Mapper.Map(source); + + dest.Value.ShouldBe(11); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_value_converter_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [ValueConverter(typeof(MyValueConverter))] + public int Value { get; set; } + } + + public class MyValueConverter : IValueConverter + { + public int Convert(int sourceMember, ResolutionContext context) + { + return sourceMember + 5; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_value_converter_via_attribute)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 6 + }; + + var dest = Mapper.Map(source); + + dest.Value.ShouldBe(11); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_value_converter_with_different_member_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [ValueConverter(typeof(MyValueConverter))] + [SourceMember(nameof(Source.Value))] + public int OtherValue { get; set; } + } + + public class MyValueConverter : IValueConverter + { + public int Convert(int sourceMember, ResolutionContext context) + { + return sourceMember + 5; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_value_converter_via_attribute)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 6 + }; + + var dest = Mapper.Map(source); + + dest.OtherValue.ShouldBe(11); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_ignoring_members_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source))] + public class Dest + { + [Ignore] + public int Value { get; set; } + + [Ignore] + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_value_converter_via_attribute)); + }); + + [Fact] + public void Should_map_attribute_value() + { + var source = new Source + { + Value = 6 + }; + + var dest = Mapper.Map(source); + + dest.Value.ShouldBe(default); + dest.OtherValue.ShouldBe(default); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_using_existing_value_via_attribute : NonValidatingSpecBase + { + private Source _source; + private Destination _originalDest; + private Destination _dest; + + public class Source + { + public int Value { get; set; } + public ChildSource Child { get; set; } + } + + [AutoMap(typeof(Source))] + public class Destination + { + public int Value { get; set; } + [Ignore] + public string Name { get; set; } + [UseExistingValue] + public ChildDestination Child { get; set; } + } + + public class ChildSource + { + public int Value { get; set; } + } + + [AutoMap(typeof(ChildSource))] + public class ChildDestination + { + public int Value { get; set; } + [Ignore] + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_value_converter_via_attribute)); + }); + + protected override void Because_of() + { + _source = new Source + { + Value = 10, + Child = new ChildSource + { + Value = 20 + } + }; + _originalDest = new Destination + { + Value = 1111, + Name = "foo", + Child = new ChildDestination + { + Name = "bar" + } + }; + _dest = Mapper.Map(_source, _originalDest); + } + + [Fact] + public void Should_do_the_translation() + { + _dest.Value.ShouldBe(10); + _dest.Child.Value.ShouldBe(20); + } + + [Fact] + public void Should_return_the_destination_object_that_was_passed_in() + { + _dest.Name.ShouldBe("foo"); + _dest.Child.Name.ShouldBe("bar"); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_a_mapping_order_with_attributes : NonValidatingSpecBase + { + private Destination _result; + + public class Source + { + private int _startValue; + + public Source(int startValue) + { + _startValue = startValue; + } + + public int GetValue1() + { + _startValue += 10; + return _startValue; + } + + public int GetValue2() + { + _startValue += 5; + return _startValue; + } + } + + [AutoMap(typeof(Source))] + public class Destination + { + [MappingOrder(2)] + public int Value1 { get; set; } + [MappingOrder(1)] + public int Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_value_converter_via_attribute)); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source(10)); + } + + [Fact] + public void Should_perform_the_mapping_in_the_order_specified() + { + _result.Value2.ShouldBe(15); + _result.Value1.ShouldBe(25); + } + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid(nameof(AutoMapAttribute))); + } + } + + public class When_specifying_to_construct_using_service_locator_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source), ConstructUsingServiceLocator = true)] + public class Dest + { + private int _value; + private readonly int _addend; + + public int Value + { + get { return _value + _addend; } + set { _value = value; } + } + + public Dest(int addend) + { + _addend = addend; + } + + public Dest() : this(0) + { + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_to_construct_using_service_locator_via_attribute)); + cfg.ConstructServicesUsing(t => new Dest(10)); + }); + + [Fact] + public void Should_map_with_the_custom_constructor() + { + var source = new Source { Value = 6 }; + var dest = Mapper.Map(source); + dest.Value.ShouldBe(16); + } + } + + public class When_specifying_max_depth_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Level { get; set; } + public IList Children { get; set; } + public Source Parent { get; set; } + + public Source(int level) + { + Children = new List(); + Level = level; + } + + public void AddChild(Source child) + { + Children.Add(child); + child.Parent = this; + } + } + + [AutoMap(typeof(Source), MaxDepth = 2)] + public class Dest + { + public int Level { get; set; } + public IList Children { get; set; } + public Dest Parent { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_max_depth_via_attribute)); + }); + + [Fact] + public void Third_level_children_are_null_with_max_depth_2() + { + var source = new Source(1); + source.AddChild(new Source(2)); + source.AddChild(new Source(3)); + source.Children[0].AddChild(new Source(4)); + source.Children[1].AddChild(new Source(5)); + + var dest = Mapper.Map(source); + dest.Level.ShouldBe(1); + dest.Children[0].Level.ShouldBe(2); + dest.Children[0].Children.ShouldAllBe(d => d == null); + dest.Children[1].Level.ShouldBe(3); + dest.Children[1].Children.ShouldAllBe(d => d == null); + } + } + + public class When_specifying_to_preserve_references_via_attribute : NonValidatingSpecBase + { + public class Parent + { + public int Id { get; set; } + } + + public class Child + { + public int Id { get; set; } + public Parent Parent { get; set; } + } + + [AutoMap(typeof(Parent), PreserveReferences = true)] + public class ParentDto + { + public int Id { get; set; } + + [SourceMember(nameof(Parent.Id))] + public List Children { get; set; } + } + + [AutoMap(typeof(Child))] + public class ChildDto + { + public int Id { get; set; } + + public ParentDto Parent { get; set; } + } + + public class ParentIdToChildDtoListConverter : ITypeConverter> + { + private readonly IList _childModels; + + public ParentIdToChildDtoListConverter(IList childModels) + { + _childModels = childModels; + } + + public List Convert(int source, List destination, ResolutionContext resolutionContext) + { + var childModels = _childModels.Where(x => x.Parent.Id == source).ToList(); + return (List)resolutionContext.Mapper.Map(childModels, destination, typeof(List), typeof(List), resolutionContext); + } + } + + protected override MapperConfiguration Configuration { get; } + + private static Parent _parent; + + public When_specifying_to_preserve_references_via_attribute() + { + _parent = new Parent + { + Id = 2 + }; + + var childModels = new List + { + new Child + { + Id = 1, + Parent = _parent + } + }; + + Configuration = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_to_preserve_references_via_attribute)); + cfg.CreateMap>().ConvertUsing(new ParentIdToChildDtoListConverter(childModels)); + }); + } + + [Fact] + public void Should_preserve_parent_relationship() + { + var dto = Mapper.Map(_parent); + dto.Children[0].Parent.ShouldBe(dto); + } + } + + public class When_specifying_to_include_all_derived_via_attribute : NonValidatingSpecBase + { + public class Foo { } + public class FooBar : Foo { } + + [AutoMap(typeof(Foo), IncludeAllDerived = true)] + public class FooDto { } + + [AutoMap(typeof(FooBar))] + public class FooBarDto : FooDto { } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_to_include_all_derived_via_attribute)); + }); + + [Fact] + public void Should_convert_to_derived_correctly() + { + var source = new FooBar(); + var dest = Mapper.Map(source, source.GetType(), typeof(FooDto)); + dest.ShouldBeOfType(); + } + } + + public class When_specifying_type_of_converter_via_attribute : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + [AutoMap(typeof(Source), TypeConverter = typeof(CustomConverter))] + public class Dest + { + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.AddMaps(typeof(When_specifying_type_of_converter_via_attribute)); + }); + + public class CustomConverter : ITypeConverter + { + public Dest Convert(Source source, Dest destination, ResolutionContext context) + { + return new Dest + { + OtherValue = source.Value + 10 + }; + } + } + + [Fact] + public void Should_convert_using_custom_converter() + { + var source = new Source { Value = 15 }; + var dest = Mapper.Map(source); + dest.OtherValue.ShouldBe(25); + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/AutoMapper.UnitTests.csproj b/src/UnitTests/AutoMapper.UnitTests.csproj new file mode 100644 index 0000000000..6e8971a4bd --- /dev/null +++ b/src/UnitTests/AutoMapper.UnitTests.csproj @@ -0,0 +1,38 @@ + + + + net461;netcoreapp2.0; + AutoMapper.UnitTests + AutoMapper.UnitTests + $(NoWarn);0649 + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/UnitTests/AutoMapperSpecBase.cs b/src/UnitTests/AutoMapperSpecBase.cs index 13ac7cf9ec..ea52c8b205 100644 --- a/src/UnitTests/AutoMapperSpecBase.cs +++ b/src/UnitTests/AutoMapperSpecBase.cs @@ -1,81 +1,77 @@ -using System; -using Should; -using Xunit; -using Rhino.Mocks; - -namespace AutoMapper.UnitTests -{ - using QueryableExtensions; - - public abstract class AutoMapperSpecBase : NonValidatingSpecBase - { - [Fact] - public void Should_have_valid_configuration() - { - Configuration.AssertConfigurationIsValid(); - } - - } - - public abstract class NonValidatingSpecBase : SpecBase - { - private IMapper mapper; - - protected abstract MapperConfiguration Configuration { get; } - protected IConfigurationProvider ConfigProvider => Configuration; - - protected IMapper Mapper => mapper ?? (mapper = Configuration.CreateMapper()); - } - - public abstract class SpecBaseBase - { - public virtual void MainSetup() - { - Establish_context(); - Because_of(); - } - - public virtual void MainTeardown() - { - Cleanup(); - } - - protected virtual void Establish_context() - { - } - - protected virtual void Because_of() - { - } - - protected virtual void Cleanup() - { - } - - - protected TType CreateDependency() - where TType : class - { - return MockRepository.GenerateMock(); - } - - protected TType CreateStub() where TType : class - { - return MockRepository.GenerateStub(); - } - } - public abstract class SpecBase : SpecBaseBase, IDisposable - { - protected SpecBase() - { - MainSetup(); - } - - public void Dispose() - { - MainTeardown(); - } - } - -} - +using System; +using Xunit; + +namespace AutoMapper.UnitTests +{ + using QueryableExtensions; + using System.Collections.Generic; + using System.Linq; + using System.Linq.Expressions; + + public abstract class AutoMapperSpecBase : NonValidatingSpecBase + { + [Fact] + public void Should_have_valid_configuration() + { + Configuration.AssertConfigurationIsValid(); + } + + } + + public abstract class NonValidatingSpecBase : SpecBase + { + private IMapper mapper; + + protected abstract MapperConfiguration Configuration { get; } + protected IConfigurationProvider ConfigProvider => Configuration; + + protected IMapper Mapper => mapper ?? (mapper = Configuration.CreateMapper()); + + protected IQueryable ProjectTo(IQueryable source, object parameters = null, params Expression>[] membersToExpand) => + Mapper.ProjectTo(source, parameters, membersToExpand); + + protected IQueryable ProjectTo(IQueryable source, IDictionary parameters, params string[] membersToExpand) => + Mapper.ProjectTo(source, parameters, membersToExpand); + } + + public abstract class SpecBaseBase + { + protected virtual void MainSetup() + { + Establish_context(); + Because_of(); + } + + protected virtual void MainTeardown() + { + Cleanup(); + } + + protected virtual void Establish_context() + { + } + + protected virtual void Because_of() + { + } + + protected virtual void Cleanup() + { + } + } + public abstract class SpecBase : SpecBaseBase, IDisposable + { + protected SpecBase() + { + Establish_context(); + Because_of(); + } + + public void Dispose() + { + Cleanup(); + } + } + +} + diff --git a/src/UnitTests/AutoMapperTester.cs b/src/UnitTests/AutoMapperTester.cs index 1203ca11b9..0abf96770f 100644 --- a/src/UnitTests/AutoMapperTester.cs +++ b/src/UnitTests/AutoMapperTester.cs @@ -1,41 +1,41 @@ -using System; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - public class AutoMapperTester : IDisposable - { - [Fact] - public void Should_be_able_to_handle_derived_proxy_types() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - var source = new[] { new DerivedModelType { TheProperty = "Foo" }, new DerivedModelType { TheProperty = "Bar" } }; - - var mapper = config.CreateMapper(); - var destination = (DtoType[])mapper.Map(source, typeof(ModelType[]), typeof(DtoType[])); - - destination[0].TheProperty.ShouldEqual("Foo"); - destination[1].TheProperty.ShouldEqual("Bar"); - } - - public void Dispose() - { - - } - - public class ModelType - { - public string TheProperty { get; set; } - } - - public class DerivedModelType : ModelType - { - } - - public class DtoType - { - public string TheProperty { get; set; } - } - } +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class AutoMapperTester : IDisposable + { + [Fact] + public void Should_be_able_to_handle_derived_proxy_types() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + var source = new[] { new DerivedModelType { TheProperty = "Foo" }, new DerivedModelType { TheProperty = "Bar" } }; + + var mapper = config.CreateMapper(); + var destination = (DtoType[])mapper.Map(source, typeof(ModelType[]), typeof(DtoType[])); + + destination[0].TheProperty.ShouldBe("Foo"); + destination[1].TheProperty.ShouldBe("Bar"); + } + + public void Dispose() + { + + } + + public class ModelType + { + public string TheProperty { get; set; } + } + + public class DerivedModelType : ModelType + { + } + + public class DtoType + { + public string TheProperty { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/BasicFlattening.cs b/src/UnitTests/BasicFlattening.cs index 07a71cf5eb..6cc1763fd8 100644 --- a/src/UnitTests/BasicFlattening.cs +++ b/src/UnitTests/BasicFlattening.cs @@ -1,57 +1,209 @@ -namespace AutoMapper.UnitTests -{ - using System.Collections.Generic; - using Xunit; - - public class BasicFlattening : AutoMapperSpecBase - { - public class Address - { - public int Id { get; set; } - public string Street { get; set; } - public string City { get; set; } - public string Country { get; set; } - } - - public class AddressDTO - { - public int Id { get; set; } - public string City { get; set; } - public string Country { get; set; } - } - - public class Customer - { - public int Id { get; set; } - public string Name { get; set; } - public decimal? Credit { get; set; } - public Address Address { get; set; } - public Address HomeAddress { get; set; } - public Address[] Addresses { get; set; } - public ICollection
WorkAddresses { get; set; } - } - - public class CustomerDTO - { - public int Id { get; set; } - public string Name { get; set; } - public Address Address { get; set; } - public AddressDTO HomeAddress { get; set; } - public AddressDTO[] Addresses { get; set; } - public List WorkAddresses { get; set; } - public string AddressCity { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - [Fact] - public void Should_map() - { - Mapper.Map(new Customer()); - } - } +using System; +using System.Collections.Generic; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests +{ + public class BasicFlattening : AutoMapperSpecBase + { + public class Address + { + public int Id { get; set; } + public string Street { get; set; } + public string City { get; set; } + public string Country { get; set; } + } + + public class AddressDTO + { + public int Id { get; set; } + public string City { get; set; } + public string Country { get; set; } + } + + public class Customer + { + public int Id { get; set; } + public string Name { get; set; } + public decimal? Credit { get; set; } + public Address Address { get; set; } + public Address HomeAddress { get; set; } + public Address[] Addresses { get; set; } + public ICollection
WorkAddresses { get; set; } + } + + public class CustomerDTO + { + public int Id { get; set; } + public string Name { get; set; } + public Address Address { get; set; } + public AddressDTO HomeAddress { get; set; } + public AddressDTO[] Addresses { get; set; } + public List WorkAddresses { get; set; } + public string AddressCity { get; set; } + } + + public class Foo + { + public string Name { get; set; } + + public int Int32 { get; set; } + + public long Int64 { set; get; } + + public int? NullInt { get; set; } + + public float Floatn { get; set; } + + public double Doublen { get; set; } + + public DateTime DateTime { get; set; } + + public Foo Foo1 { get; set; } + + public IEnumerable Foos { get; set; } + + public Foo[] FooArr { get; set; } + + public int[] IntArr { get; set; } + + public IEnumerable Ints { get; set; } + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_map() + { + Mapper.Map(new Customer()); + } + + [Fact] + public void Should_map_foo() + { + Mapper.Map(new Foo + { + Name = "foo", + Int32 = 12, + Int64 = 123123, + NullInt = 16, + DateTime = DateTime.Now, + Doublen = 2312112, + Foo1 = new Foo { Name = "foo one" }, + Foos = new List + { + new Foo {Name = "j1", Int64 = 123, NullInt = 321}, + new Foo {Name = "j2", Int32 = 12345, NullInt = 54321}, + new Foo {Name = "j3", Int32 = 12345, NullInt = 54321}, + }, + FooArr = new[] + { + new Foo {Name = "a1"}, + new Foo {Name = "a2"}, + new Foo {Name = "a3"}, + }, + IntArr = new[] { 1, 2, 3, 4, 5 }, + Ints = new[] { 7, 8, 9 }, + }); + } + } + + public class NullFlattening : AutoMapperSpecBase + { + Destination _destination; + + public class Source + { + public Source Parent { get; set; } + public Data Data { get; set; } + } + public class Data + { + public int? Value { get; set; } + } + public class Destination + { + public int? ParentDataValue { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_handle_inner_nulls() + { + _destination.ParentDataValue.ShouldBeNull(); + } + } + + public class NullTypeMapFlattening : AutoMapperSpecBase + { + private OrderDTO _dto; + + public class OrderModel + { + public VendorModel Vendor { get; set; } + public string Number { get; set; } + } + + public class VendorModel + { + public string Name { get; set; } + public CurrencyModel Currency { get; set; } + } + + public class CurrencyModel + { + public string Name { get; set; } + } + + + public class OrderDTO + { + public CurrencyDTO VendorCurrency { get; set; } + public string VendorName { get; set; } + public string Number { get; set; } + } + + public class CurrencyDTO + { + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var orderModel = new OrderModel() + { + Number = "1", + Vendor = null + }; + _dto = Mapper.Map(orderModel); + } + + [Fact] + public void Should_handle_inner_nulls() + { + _dto.VendorCurrency.ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/BeforeAfterMapping.cs b/src/UnitTests/BeforeAfterMapping.cs index 2337a94375..3c431c54df 100644 --- a/src/UnitTests/BeforeAfterMapping.cs +++ b/src/UnitTests/BeforeAfterMapping.cs @@ -1,209 +1,259 @@ -using System; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.BeforeAfterMapping -{ - using Bug; - - public class When_configuring_before_and_after_methods - { - public class Source - { - } - public class Destination - { - } - - [Fact] - public void Before_and_After_should_be_called() - { - var beforeMapCalled = false; - var afterMapCalled = false; - - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .BeforeMap((src, dest) => beforeMapCalled = true) - .AfterMap((src, dest) => afterMapCalled = true)); - - var mapper = config.CreateMapper(); - - mapper.Map(new Source()); - - beforeMapCalled.ShouldBeTrue(); - afterMapCalled.ShouldBeTrue(); - } - - } - - public class When_configuring_before_and_after_methods_multiple_times - { - public class Source - { - } - public class Destination - { - } - - [Fact] - public void Before_and_After_should_be_called() - { - var beforeMapCount = 0; - var afterMapCount = 0; - - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .BeforeMap((src, dest) => beforeMapCount++) - .BeforeMap((src, dest) => beforeMapCount++) - .AfterMap((src, dest) => afterMapCount++) - .AfterMap((src, dest) => afterMapCount++); - }); - - var mapper = config.CreateMapper(); - - mapper.Map(new Source()); - - beforeMapCount.ShouldEqual(2); - afterMapCount.ShouldEqual(2); - } - - } - - public class When_using_a_class_to_do_before_after_mappings : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - public class BeforeMapAction : IMappingAction - { - private readonly int _decrement; - - public BeforeMapAction(int decrement) - { - _decrement = decrement; - } - - public void Process(Source source, Destination destination) - { - source.Value -= _decrement * 2; - } - } - - public class AfterMapAction : IMappingAction - { - private readonly int _increment; - - public AfterMapAction(int increment) - { - _increment = increment; - } - - public void Process(Source source, Destination destination) - { - destination.Value += _increment * 5; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.ConstructServicesUsing(t => Activator.CreateInstance(t, 2)); - - cfg.CreateMap() - .BeforeMap() - .AfterMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Value = 4}); - } - - [Fact] - public void Should_use_global_constructor_for_building_mapping_actions() - { - _destination.Value.ShouldEqual(10); - } - } - - public class MappingSpecificBeforeMapping : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .BeforeMap((src, dest) => src.Value += 10); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source - { - Value = 5 - }, opt => opt.BeforeMap((src, dest) => src.Value += 10)); - } - - [Fact] - public void Should_execute_typemap_and_scoped_beforemap() - { - _dest.Value.ShouldEqual(25); - } - } - - public class MappingSpecificAfterMapping : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .AfterMap((src, dest) => dest.Value += 10); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source - { - Value = 5 - }, opt => opt.AfterMap((src, dest) => dest.Value += 10)); - } - - [Fact] - public void Should_execute_typemap_and_scoped_aftermap() - { - _dest.Value.ShouldEqual(25); - } - } - -} +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.BeforeAfterMapping +{ + using Bug; + + public class When_configuring_before_and_after_methods + { + public class Source + { + } + public class Destination + { + } + + [Fact] + public void Before_and_After_should_be_called() + { + var beforeMapCalled = false; + var afterMapCalled = false; + + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .BeforeMap((src, dest) => beforeMapCalled = true) + .AfterMap((src, dest) => afterMapCalled = true)); + + var mapper = config.CreateMapper(); + + mapper.Map(new Source()); + + beforeMapCalled.ShouldBeTrue(); + afterMapCalled.ShouldBeTrue(); + } + + [Fact] + public void Before_and_After_overrides_should_be_called() + { + var beforeMapCalled = false; + var afterMapCalled = false; + + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ForAllMaps((map, expression) => + { + expression.BeforeMap((src, dest, context) => beforeMapCalled = true); + expression.AfterMap((src, dest, context) => afterMapCalled = true); + }); + }); + + var mapper = config.CreateMapper(); + + mapper.Map(new Source()); + + beforeMapCalled.ShouldBeTrue(); + afterMapCalled.ShouldBeTrue(); + } + + } + + public class When_configuring_before_and_after_methods_multiple_times + { + public class Source + { + } + public class Destination + { + } + + [Fact] + public void Before_and_After_should_be_called() + { + var beforeMapCount = 0; + var afterMapCount = 0; + + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .BeforeMap((src, dest) => beforeMapCount++) + .BeforeMap((src, dest) => beforeMapCount++) + .AfterMap((src, dest) => afterMapCount++) + .AfterMap((src, dest) => afterMapCount++); + }); + + var mapper = config.CreateMapper(); + + mapper.Map(new Source()); + + beforeMapCount.ShouldBe(2); + afterMapCount.ShouldBe(2); + } + + [Fact] + public void Before_and_After_overrides_should_be_called() + { + var beforeMapCount = 0; + var afterMapCount = 0; + + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ForAllMaps((map, expression) => + { + expression.BeforeMap((src, dest, context) => beforeMapCount++) + .BeforeMap((src, dest, context) => beforeMapCount++); + expression.AfterMap((src, dest, context) => afterMapCount++) + .AfterMap((src, dest, context) => afterMapCount++); + }); + }); + + var mapper = config.CreateMapper(); + + mapper.Map(new Source()); + + beforeMapCount.ShouldBe(2); + afterMapCount.ShouldBe(2); + } + + } + + public class When_using_a_class_to_do_before_after_mappings : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + public class BeforeMapAction : IMappingAction + { + private readonly int _decrement; + + public BeforeMapAction(int decrement) + { + _decrement = decrement; + } + + public void Process(Source source, Destination destination) + { + source.Value -= _decrement * 2; + } + } + + public class AfterMapAction : IMappingAction + { + private readonly int _increment; + + public AfterMapAction(int increment) + { + _increment = increment; + } + + public void Process(Source source, Destination destination) + { + destination.Value += _increment * 5; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ConstructServicesUsing(t => Activator.CreateInstance(t, 2)); + + cfg.CreateMap() + .BeforeMap() + .AfterMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Value = 4}); + } + + [Fact] + public void Should_use_global_constructor_for_building_mapping_actions() + { + _destination.Value.ShouldBe(10); + } + } + + public class MappingSpecificBeforeMapping : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .BeforeMap((src, dest) => src.Value += 10); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source + { + Value = 5 + }, opt => opt.BeforeMap((src, dest) => src.Value += 10)); + } + + [Fact] + public void Should_execute_typemap_and_scoped_beforemap() + { + _dest.Value.ShouldBe(25); + } + } + + public class MappingSpecificAfterMapping : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .AfterMap((src, dest) => dest.Value += 10); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source + { + Value = 5 + }, opt => opt.AfterMap((src, dest) => dest.Value += 10)); + } + + [Fact] + public void Should_execute_typemap_and_scoped_aftermap() + { + _dest.Value.ShouldBe(25); + } + } + +} diff --git a/src/UnitTests/BidirectionalRelationships.cs b/src/UnitTests/BidirectionalRelationships.cs index 95ccb8649f..6b4b327b06 100644 --- a/src/UnitTests/BidirectionalRelationships.cs +++ b/src/UnitTests/BidirectionalRelationships.cs @@ -1,512 +1,727 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Should; - -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace BidirectionalRelationships - { - public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship : AutoMapperSpecBase - { - private ParentDto _dto; - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap().PreserveReferences(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var parent = new ParentModel { ID = "PARENT_ONE" }; - - parent.AddChild(new ChildModel { ID = "CHILD_ONE" }); - - parent.AddChild(new ChildModel { ID = "CHILD_TWO" }); - - _dto = Mapper.Map(parent); - } - - [Fact] - public void Should_preserve_the_parent_child_relationship_on_the_destination() - { - _dto.Children[0].Parent.ShouldBeSameAs(_dto); - _dto.Children[1].Parent.ShouldBeSameAs(_dto); - } - - public class ParentModel - { - public ParentModel() - { - Children = new List(); - } - - public string ID { get; set; } - - public IList Children { get; private set; } - - public void AddChild(ChildModel child) - { - child.Parent = this; - Children.Add(child); - } - } - - public class ChildModel - { - public string ID { get; set; } - public ParentModel Parent { get; set; } - } - - public class ParentDto - { - public string ID { get; set; } - public IList Children { get; set; } - } - - public class ChildDto - { - public string ID { get; set; } - public ParentDto Parent { get; set; } - } - } - - - //public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship_using_CustomMapper_StackOverflow : AutoMapperSpecBase - //{ - // private ParentDto _dto; - // private ParentModel _parent; - - // protected override void Establish_context() - // { - // _parent = new ParentModel - // { - // ID = 2 - // }; - - // List childModels = new List - // { - // new ChildModel - // { - // ID = 1, - // Parent = _parent - // } - // }; - - // Dictionary parents = childModels.ToDictionary(x => x.ID, x => x.Parent); - - // Mapper.CreateMap().ConvertUsing(new ChildIdToParentDtoConverter(parents)); - // Mapper.CreateMap>().ConvertUsing(new ParentIdToChildDtoListConverter(childModels)); - - // Mapper.CreateMap() - // .ForMember(dest => dest.Children, opt => opt.MapFrom(src => src.ID)); - // Mapper.CreateMap(); - - // config.AssertConfigurationIsValid(); - // } - - // protected override void Because_of() - // { - // _dto = Mapper.Map(_parent); - // } - - // [Fact(Skip = "This test breaks the Test Runner")] - // public void Should_preserve_the_parent_child_relationship_on_the_destination() - // { - // _dto.Children[0].Parent.ID.ShouldEqual(_dto.ID); - // } - - // public class ChildIdToParentDtoConverter : ITypeConverter - // { - // private readonly Dictionary _parentModels; - - // public ChildIdToParentDtoConverter(Dictionary parentModels) - // { - // _parentModels = parentModels; - // } - - // public ParentDto Convert(int childId) - // { - // ParentModel parentModel = _parentModels[childId]; - // MappingEngine mappingEngine = (MappingEngine)Mapper.Engine; - // return mappingEngine.Map(parentModel); - // } - // } - - // public class ParentIdToChildDtoListConverter : ITypeConverter> - // { - // private readonly IList _childModels; - - // public ParentIdToChildDtoListConverter(IList childModels) - // { - // _childModels = childModels; - // } - - // protected override List ConvertCore(int childId) - // { - // List childModels = _childModels.Where(x => x.Parent.ID == childId).ToList(); - // MappingEngine mappingEngine = (MappingEngine)Mapper.Engine; - // return mappingEngine.Map, List>(childModels); - // } - // } - - // public class ParentModel - // { - // public int ID { get; set; } - // } - - // public class ChildModel - // { - // public int ID { get; set; } - // public ParentModel Parent { get; set; } - // } - - // public class ParentDto - // { - // public int ID { get; set; } - // public List Children { get; set; } - // } - - // public class ChildDto - // { - // public int ID { get; set; } - // public ParentDto Parent { get; set; } - // } - //} - - public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship_using_CustomMapper_with_context : AutoMapperSpecBase - { - private ParentDto _dto; - private static ParentModel _parent; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - _parent = new ParentModel - { - ID = 2 - }; - - List childModels = new List - { - new ChildModel - { - ID = 1, - Parent = _parent - } - }; - - Dictionary parents = childModels.ToDictionary(x => x.ID, x => x.Parent); - - cfg.CreateMap().ConvertUsing(new ChildIdToParentDtoConverter(parents)); - cfg.CreateMap>().ConvertUsing(new ParentIdToChildDtoListConverter(childModels)); - - cfg.CreateMap() - .PreserveReferences() - .ForMember(dest => dest.Children, opt => opt.MapFrom(src => src.ID)); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _dto = Mapper.Map(_parent); - } - - [Fact] - public void Should_preserve_the_parent_child_relationship_on_the_destination() - { - _dto.Children[0].Parent.ID.ShouldEqual(_dto.ID); - } - - public class ChildIdToParentDtoConverter : ITypeConverter - { - private readonly Dictionary _parentModels; - - public ChildIdToParentDtoConverter(Dictionary parentModels) - { - _parentModels = parentModels; - } - - public ParentDto Convert(int source, ResolutionContext resolutionContext) - { - ParentModel parentModel = _parentModels[source]; - return (ParentDto) resolutionContext.Mapper.Map(parentModel, null, typeof(ParentModel), typeof(ParentDto), resolutionContext); - } - } - - public class ParentIdToChildDtoListConverter : ITypeConverter> - { - private readonly IList _childModels; - - public ParentIdToChildDtoListConverter(IList childModels) - { - _childModels = childModels; - } - - public List Convert(int source, ResolutionContext resolutionContext) - { - List childModels = _childModels.Where(x => x.Parent.ID == source).ToList(); - return (List)resolutionContext.Mapper.Map(childModels, null, typeof(List), typeof(List), resolutionContext); - } - } - - public class ParentModel - { - public int ID { get; set; } - } - - public class ChildModel - { - public int ID { get; set; } - public ParentModel Parent { get; set; } - } - - public class ParentDto - { - public int ID { get; set; } - public List Children { get; set; } - } - - public class ChildDto - { - public int ID { get; set; } - public ParentDto Parent { get; set; } - } - } - - public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_one_child_relationship : AutoMapperSpecBase - { - private FooDto _dto; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().PreserveReferences(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var foo = new Foo - { - Bar = new Bar - { - Value = "something" - } - }; - foo.Bar.Foo = foo; - _dto = Mapper.Map(foo); - } - - [Fact] - public void Should_preserve_the_parent_child_relationship_on_the_destination() - { - _dto.Bar.Foo.ShouldBeSameAs(_dto); - } - - public class Foo - { - public Bar Bar { get; set; } - } - - public class Bar - { - public Foo Foo { get; set; } - public string Value { get; set; } - } - - public class FooDto - { - public BarDto Bar { get; set; } - } - - public class BarDto - { - public FooDto Foo { get; set; } - public string Value { get; set; } - } - } - - public class When_mapping_to_a_destination_containing_two_dtos_mapped_from_the_same_source : AutoMapperSpecBase - { - private FooContainerModel _dto; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap() - .PreserveReferences() - .ForMember(dest => dest.Input, opt => opt.MapFrom(src => src)) - .ForMember(dest => dest.Screen, opt => opt.MapFrom(src => src)); - }); - - protected override void Because_of() - { - var model = new FooModel { Id = 3 }; - _dto = Mapper.Map(model); - } - - [Fact] - public void Should_not_preserve_identity_when_destinations_are_incompatible() - { - _dto.ShouldBeType(); - _dto.Input.ShouldBeType(); - _dto.Screen.ShouldBeType(); - _dto.Input.Id.ShouldEqual(3); - _dto.Screen.Id.ShouldEqual("3"); - } - - public class FooContainerModel - { - public FooInputModel Input { get; set; } - public FooScreenModel Screen { get; set; } - } - - public class FooScreenModel - { - public string Id { get; set; } - } - - public class FooInputModel - { - public long Id { get; set; } - } - - public class FooModel - { - public long Id { get; set; } - } - } - - public class When_mapping_with_a_bidirectional_relationship_that_includes_arrays : AutoMapperSpecBase - - { - private ParentDto _dtoParent; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().PreserveReferences(); - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var parent1 = new Parent { Name = "Parent 1" }; - var child1 = new Child { Name = "Child 1" }; - - parent1.Children.Add(child1); - child1.Parents.Add(parent1); - - _dtoParent = Mapper.Map(parent1); - } - - [Fact] - public void Should_map_successfully() - { - object.ReferenceEquals(_dtoParent.Children[0].Parents[0], _dtoParent).ShouldBeTrue(); - } - - public class Parent - { - public Guid Id { get; private set; } - - public string Name { get; set; } - - public List Children { get; set; } - - public Parent() - { - Id = Guid.NewGuid(); - Children = new List(); - } - - public bool Equals(Parent other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return other.Id.Equals(Id); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (Parent)) return false; - return Equals((Parent) obj); - } - - public override int GetHashCode() - { - return Id.GetHashCode(); - } - } - - public class Child - { - public Guid Id { get; private set; } - - public string Name { get; set; } - - public List Parents { get; set; } - - public Child() - { - Id = Guid.NewGuid(); - Parents = new List(); - } - - public bool Equals(Child other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return other.Id.Equals(Id); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != typeof (Child)) return false; - return Equals((Child) obj); - } - - public override int GetHashCode() - { - return Id.GetHashCode(); - } - } - - public class ParentDto - { - public Guid Id { get; set; } - - public string Name { get; set; } - - public List Children { get; set; } - - public ParentDto() - { - Children = new List(); - } - } - - public class ChildDto - { - public Guid Id { get; set; } - - public string Name { get; set; } - - public List Parents { get; set; } - - public ChildDto() - { - Parents = new List(); - } - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; + +using Shouldly; + +using Xunit; + +namespace AutoMapper.UnitTests. BidirectionalRelationships +{ + public class RecursiveMappingWithStruct : AutoMapperSpecBase + { + private ParentDto _dto; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_work() + { + var parent = new ParentModel { ID = "PARENT_ONE" }; + parent.ChildrenStruct = new ChildrenStructModel { Children = new List() }; + + parent.AddChild(new ChildModel { ID = "CHILD_ONE" }); + + parent.AddChild(new ChildModel { ID = "CHILD_TWO" }); + + _dto = Mapper.Map(parent); + + _dto.ID.ShouldBe("PARENT_ONE"); + _dto.ChildrenStruct.Children[0].ID.ShouldBe("CHILD_ONE"); + _dto.ChildrenStruct.Children[1].ID.ShouldBe("CHILD_TWO"); + } + + public struct ParentModel + { + public string ID { get; set; } + + public ChildrenStructModel ChildrenStruct { get; set; } + + public void AddChild(ChildModel child) + { + child.Parent = this; + ChildrenStruct.Children.Add(child); + } + } + + public struct ChildrenStructModel + { + public IList Children { get; set; } + } + + public struct ChildModel + { + public string ID { get; set; } + public ParentModel Parent { get; set; } + } + + public struct ParentDto + { + public string ID { get; set; } + public ChildrenStructDto ChildrenStruct { get; set; } + } + + public struct ChildrenStructDto + { + public IList Children { get; set; } + } + + public struct ChildDto + { + public string ID { get; set; } + public ParentDto Parent { get; set; } + } + } + + public class RecursiveDynamicMappingWithAnonymousType : AutoMapperSpecBase + { + public class Book + { + public int BookId { get; set; } + public string Name { get; set; } + public List BookAuthors { get; set; } + } + public class Author + { + public int AuthorId { get; set; } + public string AuthorName { get; set; } + public List BookAuthors { get; set; } + } + public class BookAuthor + { + public int BookId { get; set; } + public Book Book { get; set; } + + public int AuthorId { get; set; } + public Author Author { get; set; } + } + public class BookViewModel + { + public int BookId { get; set; } + public string Name { get; set; } + public virtual List Authors { get; set; } + } + public class AuthorViewModel + { + public int AuthorId { get; set; } + public string AuthorName { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap() + .ForMember(b => b.Authors, opt => opt.MapFrom(b => b.BookAuthors.Select(ba => ba.Author))) + .ReverseMap() + .ForMember(b => b.BookAuthors, opt => opt.MapFrom(b => b.Authors.Select(a => new { b.BookId, Book = b, a.AuthorId, Author = a }))) ; + cfg.CreateMap().ReverseMap(); + }); + + [Fact] + public void Should_preserve_references() + { + var source = GetBook(); + var bookModel = Mapper.Map(source); + var book2 = Mapper.Map(bookModel); + } + + Book GetBook() + { + var book = new Book + { + BookId = 1, + Name = "B1", + }; + book.BookAuthors = new List + { + new BookAuthor + { + BookId = book.BookId, + Book = book, + AuthorId = 1, + Author = new Author + { + AuthorId = 1, + AuthorName = "A1" + } + }, + new BookAuthor + { + BookId = book.BookId, + Book = book, + AuthorId = 2, + Author = new Author + { + AuthorId = 2, + AuthorName = "A2" + } + }, + }; + return book; + } + } + + public class RecursiveDynamicMapping : AutoMapperSpecBase + { + private ParentDto _dto; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => { }); + + protected override void Because_of() + { + var parent = new ParentModel { ID = "PARENT_ONE" }; + + parent.AddChild(new ChildModel { ID = "CHILD_ONE" }); + + parent.AddChild(new ChildModel { ID = "CHILD_TWO" }); + + _dto = Mapper.Map(parent); + } + + [Fact] + public void Should_preserve_the_parent_child_relationship_on_the_destination() + { + _dto.Children[0].Parent.ShouldBeSameAs(_dto); + _dto.Children[1].Parent.ShouldBeSameAs(_dto); + } + + public class ParentModel + { + public ParentModel() + { + Children = new List(); + } + + public string ID { get; set; } + + public IList Children { get; private set; } + + public void AddChild(ChildModel child) + { + child.Parent = this; + Children.Add(child); + } + } + + public class ChildModel + { + public string ID { get; set; } + public ParentModel Parent { get; set; } + } + + public class ParentDto + { + public string ID { get; set; } + public IList Children { get; set; } + } + + public class ChildDto + { + public string ID { get; set; } + public ParentDto Parent { get; set; } + } + } + + public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship : AutoMapperSpecBase + { + private ParentDto _dto; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().PreserveReferences(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var parent = new ParentModel { ID = "PARENT_ONE" }; + + parent.AddChild(new ChildModel { ID = "CHILD_ONE" }); + + parent.AddChild(new ChildModel { ID = "CHILD_TWO" }); + + _dto = Mapper.Map(parent); + } + + [Fact] + public void Should_preserve_the_parent_child_relationship_on_the_destination() + { + _dto.Children[0].Parent.ShouldBeSameAs(_dto); + _dto.Children[1].Parent.ShouldBeSameAs(_dto); + } + + public class ParentModel + { + public ParentModel() + { + Children = new List(); + } + + public string ID { get; set; } + + public IList Children { get; private set; } + + public void AddChild(ChildModel child) + { + child.Parent = this; + Children.Add(child); + } + } + + public class ChildModel + { + public string ID { get; set; } + public ParentModel Parent { get; set; } + } + + public class ParentDto + { + public string ID { get; set; } + public IList Children { get; set; } + } + + public class ChildDto + { + public string ID { get; set; } + public ParentDto Parent { get; set; } + } + } + + + //public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship_using_CustomMapper_StackOverflow : AutoMapperSpecBase + //{ + // private ParentDto _dto; + // private ParentModel _parent; + + // protected override void Establish_context() + // { + // _parent = new ParentModel + // { + // ID = 2 + // }; + + // List childModels = new List + // { + // new ChildModel + // { + // ID = 1, + // Parent = _parent + // } + // }; + + // Dictionary parents = childModels.ToDictionary(x => x.ID, x => x.Parent); + + // Mapper.CreateMap().ConvertUsing(new ChildIdToParentDtoConverter(parents)); + // Mapper.CreateMap>().ConvertUsing(new ParentIdToChildDtoListConverter(childModels)); + + // Mapper.CreateMap() + // .ForMember(dest => dest.Children, opt => opt.MapFrom(src => src.ID)); + // Mapper.CreateMap(); + + // config.AssertConfigurationIsValid(); + // } + + // protected override void Because_of() + // { + // _dto = Mapper.Map(_parent); + // } + + // [Fact(Skip = "This test breaks the Test Runner")] + // public void Should_preserve_the_parent_child_relationship_on_the_destination() + // { + // _dto.Children[0].Parent.ID.ShouldBe(_dto.ID); + // } + + // public class ChildIdToParentDtoConverter : ITypeConverter + // { + // private readonly Dictionary _parentModels; + + // public ChildIdToParentDtoConverter(Dictionary parentModels) + // { + // _parentModels = parentModels; + // } + + // public ParentDto Convert(int childId) + // { + // ParentModel parentModel = _parentModels[childId]; + // MappingEngine mappingEngine = (MappingEngine)Mapper.Engine; + // return mappingEngine.Map(parentModel); + // } + // } + + // public class ParentIdToChildDtoListConverter : ITypeConverter> + // { + // private readonly IList _childModels; + + // public ParentIdToChildDtoListConverter(IList childModels) + // { + // _childModels = childModels; + // } + + // protected override List ConvertCore(int childId) + // { + // List childModels = _childModels.Where(x => x.Parent.ID == childId).ToList(); + // MappingEngine mappingEngine = (MappingEngine)Mapper.Engine; + // return mappingEngine.Map, List>(childModels); + // } + // } + + // public class ParentModel + // { + // public int ID { get; set; } + // } + + // public class ChildModel + // { + // public int ID { get; set; } + // public ParentModel Parent { get; set; } + // } + + // public class ParentDto + // { + // public int ID { get; set; } + // public List Children { get; set; } + // } + + // public class ChildDto + // { + // public int ID { get; set; } + // public ParentDto Parent { get; set; } + // } + //} + + public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship_using_CustomMapper_with_context : AutoMapperSpecBase + { + private ParentDto _dto; + private static ParentModel _parent; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + _parent = new ParentModel + { + ID = 2 + }; + + List childModels = new List + { + new ChildModel + { + ID = 1, + Parent = _parent + } + }; + + Dictionary parents = childModels.ToDictionary(x => x.ID, x => x.Parent); + + cfg.CreateMap().ConvertUsing(new ChildIdToParentDtoConverter(parents)); + cfg.CreateMap>().ConvertUsing(new ParentIdToChildDtoListConverter(childModels)); + + cfg.CreateMap() + .PreserveReferences() + .ForMember(dest => dest.Children, opt => opt.MapFrom(src => src.ID)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _dto = Mapper.Map(_parent); + } + + [Fact] + public void Should_preserve_the_parent_child_relationship_on_the_destination() + { + _dto.Children[0].Parent.ID.ShouldBe(_dto.ID); + } + + public class ChildIdToParentDtoConverter : ITypeConverter + { + private readonly Dictionary _parentModels; + + public ChildIdToParentDtoConverter(Dictionary parentModels) + { + _parentModels = parentModels; + } + + public ParentDto Convert(int source, ParentDto destination, ResolutionContext resolutionContext) + { + ParentModel parentModel = _parentModels[source]; + return (ParentDto) resolutionContext.Mapper.Map(parentModel, destination, typeof(ParentModel), typeof(ParentDto), resolutionContext); + } + } + + public class ParentIdToChildDtoListConverter : ITypeConverter> + { + private readonly IList _childModels; + + public ParentIdToChildDtoListConverter(IList childModels) + { + _childModels = childModels; + } + + public List Convert(int source, List destination, ResolutionContext resolutionContext) + { + List childModels = _childModels.Where(x => x.Parent.ID == source).ToList(); + return (List)resolutionContext.Mapper.Map(childModels, destination, typeof(List), typeof(List), resolutionContext); + } + } + + public class ParentModel + { + public int ID { get; set; } + } + + public class ChildModel + { + public int ID { get; set; } + public ParentModel Parent { get; set; } + } + + public class ParentDto + { + public int ID { get; set; } + public List Children { get; set; } + } + + public class ChildDto + { + public int ID { get; set; } + public ParentDto Parent { get; set; } + } + } + + public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_one_child_relationship : AutoMapperSpecBase + { + private FooDto _dto; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().PreserveReferences(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var foo = new Foo + { + Bar = new Bar + { + Value = "something" + } + }; + foo.Bar.Foo = foo; + _dto = Mapper.Map(foo); + } + + [Fact] + public void Should_preserve_the_parent_child_relationship_on_the_destination() + { + _dto.Bar.Foo.ShouldBeSameAs(_dto); + } + + public class Foo + { + public Bar Bar { get; set; } + } + + public class Bar + { + public Foo Foo { get; set; } + public string Value { get; set; } + } + + public class FooDto + { + public BarDto Bar { get; set; } + } + + public class BarDto + { + public FooDto Foo { get; set; } + public string Value { get; set; } + } + } + + public class When_mapping_to_a_destination_containing_two_dtos_mapped_from_the_same_source : AutoMapperSpecBase + { + private FooContainerModel _dto; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap() + .PreserveReferences() + .ForMember(dest => dest.Input, opt => opt.MapFrom(src => src)) + .ForMember(dest => dest.Screen, opt => opt.MapFrom(src => src)); + }); + + protected override void Because_of() + { + var model = new FooModel { Id = 3 }; + _dto = Mapper.Map(model); + } + + [Fact] + public void Should_not_preserve_identity_when_destinations_are_incompatible() + { + _dto.ShouldBeOfType(); + _dto.Input.ShouldBeOfType(); + _dto.Screen.ShouldBeOfType(); + _dto.Input.Id.ShouldBe(3); + _dto.Screen.Id.ShouldBe("3"); + } + + public class FooContainerModel + { + public FooInputModel Input { get; set; } + public FooScreenModel Screen { get; set; } + } + + public class FooScreenModel + { + public string Id { get; set; } + } + + public class FooInputModel + { + public long Id { get; set; } + } + + public class FooModel + { + public long Id { get; set; } + } + } + + public class When_mapping_with_a_bidirectional_relationship_that_includes_arrays : AutoMapperSpecBase + + { + private ParentDto _dtoParent; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().PreserveReferences(); + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var parent1 = new Parent { Name = "Parent 1" }; + var child1 = new Child { Name = "Child 1" }; + + parent1.Children.Add(child1); + child1.Parents.Add(parent1); + + _dtoParent = Mapper.Map(parent1); + } + + [Fact] + public void Should_map_successfully() + { + object.ReferenceEquals(_dtoParent.Children[0].Parents[0], _dtoParent).ShouldBeTrue(); + } + + public class Parent + { + public Guid Id { get; private set; } + + public string Name { get; set; } + + public List Children { get; set; } + + public Parent() + { + Id = Guid.NewGuid(); + Children = new List(); + } + + public bool Equals(Parent other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return other.Id.Equals(Id); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (Parent)) return false; + return Equals((Parent) obj); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + public class Child + { + public Guid Id { get; private set; } + + public string Name { get; set; } + + public List Parents { get; set; } + + public Child() + { + Id = Guid.NewGuid(); + Parents = new List(); + } + + public bool Equals(Child other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return other.Id.Equals(Id); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (Child)) return false; + return Equals((Child) obj); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + public class ParentDto + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public List Children { get; set; } + + public ParentDto() + { + Children = new List(); + } + } + + public class ChildDto + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public List Parents { get; set; } + + public ChildDto() + { + Parents = new List(); + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/BidirectionalRelationshipsWithoutPR.cs b/src/UnitTests/BidirectionalRelationshipsWithoutPR.cs new file mode 100644 index 0000000000..a5713a5f79 --- /dev/null +++ b/src/UnitTests/BidirectionalRelationshipsWithoutPR.cs @@ -0,0 +1,641 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Shouldly; + +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class When_the_same_map_is_used_again : AutoMapperSpecBase + { + class Source + { + public InnerSource Inner; + public OtherInnerSource OtherInner; + public Item Value1; + public Item Value2; + } + + class InnerSource + { + public Item Value; + } + + class OtherInnerSource + { + public Item Value; + } + + class InnerDestination + { + public Item Value; + } + + class OtherInnerDestination + { + public Item Value; + } + + class Destination + { + public InnerDestination Inner; + public OtherInnerDestination OtherInner; + public Item Value1; + public Item Value2; + } + + class Item + { + public int Value; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_not_set_preserve_references() + { + Configuration.ResolveTypeMap(typeof(Item), typeof(Item)).PreserveReferences.ShouldBeFalse(); + } + } + + public class When_the_source_has_cyclical_references : AutoMapperSpecBase + { + public class Article + { + public int Id { get; set; } + + public virtual Supplier Supplier { get; set; } + } + + public class Supplier + { + public int Id { get; set; } + + public virtual ICollection Contacts { get; set; } + } + + public class Contact + { + public int Id { get; set; } + + public virtual ICollection Suppliers { get; set; } + } + + public class ArticleViewModel + { + public int Id { get; set; } + + public SupplierViewModel Supplier { get; set; } + } + + public class SupplierViewModel + { + public int Id { get; set; } + + public List Contacts { get; set; } + + } + + public class ContactViewModel + { + public int Id { get; set; } + + public List Suppliers { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_ok() + { + var article = new Article { Supplier = new Supplier() }; + article.Supplier.Contacts = new List { new Contact { Suppliers = new List { article.Supplier } } }; + var supplier = Mapper.Map(article).Supplier; + supplier.ShouldBe(supplier.Contacts[0].Suppliers[0]); + } + } + + public class When_the_source_has_cyclical_references_with_ForPath : AutoMapperSpecBase + { + public class Article + { + public int Id { get; set; } + + public virtual Supplier Supplier { get; set; } + } + + public class Supplier + { + public int Id { get; set; } + + public virtual ICollection Contacts { get; set; } + } + + public class Contact + { + public int Id { get; set; } + + public virtual ICollection Suppliers { get; set; } + } + + public class ArticleViewModel + { + public int Id { get; set; } + + public SupplierViewModel Supplier { get; set; } + } + + public class SupplierViewModel + { + public int Id { get; set; } + + public List Contacts { get; set; } + + } + + public class ContactViewModel + { + public int Id { get; set; } + + public List Suppliers1 { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap().ForPath(d=>d.Suppliers1, o=>o.MapFrom(s=>s.Suppliers)); + }); + + [Fact] + public void Should_map_ok() + { + var article = new Article { Supplier = new Supplier() }; + article.Supplier.Contacts = new List { new Contact { Suppliers = new List { article.Supplier } } }; + var supplier = Mapper.Map(article).Supplier; + supplier.ShouldBe(supplier.Contacts[0].Suppliers1[0]); + } + } + + public class When_the_source_has_cyclical_references_with_ignored_ForPath : AutoMapperSpecBase + { + public class Supplier + { + public int Id { get; set; } + + public virtual Contact Contact { get; set; } + } + + public class Contact + { + public int Id { get; set; } + + public Supplier Supplier { get; set; } + } + + public class SupplierViewModel + { + public int Id { get; set; } + + public ContactViewModel Contact { get; set; } + + } + + public class ContactViewModel + { + public int Id { get; set; } + + public SupplierViewModel Supplier1 { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForPath(d=>d.Contact.Supplier1, o=> + { + o.MapFrom(s => s.Contact.Supplier); + o.Ignore(); + }); + }); + + [Fact] + public void Should_map_ok() + { + var supplier = new Supplier(); + supplier.Contact = new Contact { Supplier = supplier }; + Mapper.Map(supplier); + ConfigProvider.GetAllTypeMaps().All(tm => tm.PreserveReferences).ShouldBeFalse(); + } + } + + public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship : AutoMapperSpecBase + { + private ParentDto _dto; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var parent = new ParentModel { ID = "PARENT_ONE" }; + + parent.AddChild(new ChildModel { ID = "CHILD_ONE" }); + + parent.AddChild(new ChildModel { ID = "CHILD_TWO" }); + + _dto = Mapper.Map(parent); + } + + [Fact] + public void Should_preserve_the_parent_child_relationship_on_the_destination() + { + _dto.Children[0].Parent.ShouldBeSameAs(_dto); + _dto.Children[1].Parent.ShouldBeSameAs(_dto); + } + + public class ParentModel + { + public ParentModel() + { + Children = new List(); + } + + public string ID { get; set; } + + public IList Children { get; private set; } + + public void AddChild(ChildModel child) + { + child.Parent = this; + Children.Add(child); + } + } + + public class ChildModel + { + public string ID { get; set; } + public ParentModel Parent { get; set; } + } + + public class ParentDto + { + public string ID { get; set; } + public IList Children { get; set; } + } + + public class ChildDto + { + public string ID { get; set; } + public ParentDto Parent { get; set; } + } + } + + + //public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_many_child_relationship_using_CustomMapper_StackOverflow : AutoMapperSpecBase + //{ + // private ParentDto _dto; + // private ParentModel _parent; + + // protected override void Establish_context() + // { + // _parent = new ParentModel + // { + // ID = 2 + // }; + + // List childModels = new List + // { + // new ChildModel + // { + // ID = 1, + // Parent = _parent + // } + // }; + + // Dictionary parents = childModels.ToDictionary(x => x.ID, x => x.Parent); + + // Mapper.CreateMap().ConvertUsing(new ChildIdToParentDtoConverter(parents)); + // Mapper.CreateMap>().ConvertUsing(new ParentIdToChildDtoListConverter(childModels)); + + // Mapper.CreateMap() + // .ForMember(dest => dest.Children, opt => opt.MapFrom(src => src.ID)); + // Mapper.CreateMap(); + + // config.AssertConfigurationIsValid(); + // } + + // protected override void Because_of() + // { + // _dto = Mapper.Map(_parent); + // } + + // [Fact(Skip = "This test breaks the Test Runner")] + // public void Should_preserve_the_parent_child_relationship_on_the_destination() + // { + // _dto.Children[0].Parent.ID.ShouldBe(_dto.ID); + // } + + // public class ChildIdToParentDtoConverter : ITypeConverter + // { + // private readonly Dictionary _parentModels; + + // public ChildIdToParentDtoConverter(Dictionary parentModels) + // { + // _parentModels = parentModels; + // } + + // public ParentDto Convert(int childId) + // { + // ParentModel parentModel = _parentModels[childId]; + // MappingEngine mappingEngine = (MappingEngine)Mapper.Engine; + // return mappingEngine.Map(parentModel); + // } + // } + + // public class ParentIdToChildDtoListConverter : ITypeConverter> + // { + // private readonly IList _childModels; + + // public ParentIdToChildDtoListConverter(IList childModels) + // { + // _childModels = childModels; + // } + + // protected override List ConvertCore(int childId) + // { + // List childModels = _childModels.Where(x => x.Parent.ID == childId).ToList(); + // MappingEngine mappingEngine = (MappingEngine)Mapper.Engine; + // return mappingEngine.Map, List>(childModels); + // } + // } + + // public class ParentModel + // { + // public int ID { get; set; } + // } + + // public class ChildModel + // { + // public int ID { get; set; } + // public ParentModel Parent { get; set; } + // } + + // public class ParentDto + // { + // public int ID { get; set; } + // public List Children { get; set; } + // } + + // public class ChildDto + // { + // public int ID { get; set; } + // public ParentDto Parent { get; set; } + // } + //} + + public class When_mapping_to_a_destination_with_a_bidirectional_parent_one_to_one_child_relationship : AutoMapperSpecBase + { + private FooDto _dto; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var foo = new Foo + { + Bar = new Bar + { + Value = "something" + } + }; + foo.Bar.Foo = foo; + _dto = Mapper.Map(foo); + } + + [Fact] + public void Should_preserve_the_parent_child_relationship_on_the_destination() + { + _dto.Bar.Foo.ShouldBeSameAs(_dto); + } + + public class Foo + { + public Bar Bar { get; set; } + } + + public class Bar + { + public Foo Foo { get; set; } + public string Value { get; set; } + } + + public class FooDto + { + public BarDto Bar { get; set; } + } + + public class BarDto + { + public FooDto Foo { get; set; } + public string Value { get; set; } + } + } + + public class When_mapping_to_a_destination_containing_two_dtos_mapped_from_the_same_source : AutoMapperSpecBase + { + private FooContainerModel _dto; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(dest => dest.Input, opt => opt.MapFrom(src => src)) + .ForMember(dest => dest.Screen, opt => opt.MapFrom(src => src)); + }); + + protected override void Because_of() + { + var model = new FooModel { Id = 3 }; + _dto = Mapper.Map(model); + } + + [Fact] + public void Should_not_preserve_identity_when_destinations_are_incompatible() + { + _dto.ShouldBeOfType(); + _dto.Input.ShouldBeOfType(); + _dto.Screen.ShouldBeOfType(); + _dto.Input.Id.ShouldBe(3); + _dto.Screen.Id.ShouldBe("3"); + } + + public class FooContainerModel + { + public FooInputModel Input { get; set; } + public FooScreenModel Screen { get; set; } + } + + public class FooScreenModel + { + public string Id { get; set; } + } + + public class FooInputModel + { + public long Id { get; set; } + } + + public class FooModel + { + public long Id { get; set; } + } + } + + public class When_mapping_with_a_bidirectional_relationship_that_includes_arrays : AutoMapperSpecBase + + { + private ParentDto _dtoParent; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var parent1 = new Parent { Name = "Parent 1" }; + var child1 = new Child { Name = "Child 1" }; + + parent1.Children.Add(child1); + child1.Parents.Add(parent1); + + _dtoParent = Mapper.Map(parent1); + } + + [Fact] + public void Should_map_successfully() + { + object.ReferenceEquals(_dtoParent.Children[0].Parents[0], _dtoParent).ShouldBeTrue(); + } + + public class Parent + { + public Guid Id { get; private set; } + + public string Name { get; set; } + + public List Children { get; set; } + + public Parent() + { + Id = Guid.NewGuid(); + Children = new List(); + } + + public bool Equals(Parent other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return other.Id.Equals(Id); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (Parent)) return false; + return Equals((Parent) obj); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + public class Child + { + public Guid Id { get; private set; } + + public string Name { get; set; } + + public List Parents { get; set; } + + public Child() + { + Id = Guid.NewGuid(); + Parents = new List(); + } + + public bool Equals(Child other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return other.Id.Equals(Id); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (Child)) return false; + return Equals((Child) obj); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + public class ParentDto + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public List Children { get; set; } + + public ParentDto() + { + Children = new List(); + } + } + + public class ChildDto + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public List Parents { get; set; } + + public ChildDto() + { + Parents = new List(); + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/AddingConfigurationForNonMatchingDestinationMemberBug.cs b/src/UnitTests/Bug/AddingConfigurationForNonMatchingDestinationMemberBug.cs index 1d5d34921f..2c0ba4d3de 100644 --- a/src/UnitTests/Bug/AddingConfigurationForNonMatchingDestinationMemberBug.cs +++ b/src/UnitTests/Bug/AddingConfigurationForNonMatchingDestinationMemberBug.cs @@ -1,5 +1,5 @@ using System; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug diff --git a/src/UnitTests/Bug/AfterMapNestedObjects.cs b/src/UnitTests/Bug/AfterMapNestedObjects.cs index 47547c4dd3..ed2a687271 100644 --- a/src/UnitTests/Bug/AfterMapNestedObjects.cs +++ b/src/UnitTests/Bug/AfterMapNestedObjects.cs @@ -1,4 +1,4 @@ -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug diff --git a/src/UnitTests/Bug/AllMembersNullSubstitute.cs b/src/UnitTests/Bug/AllMembersNullSubstitute.cs deleted file mode 100644 index fb23c77387..0000000000 --- a/src/UnitTests/Bug/AllMembersNullSubstitute.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class AllMembersNullSubstituteBug - { - public class Source - { - public int? Value1 { get; set; } - public int? Value2 { get; set; } - public int? Value3 { get; set; } - } - - public class Destination - { - public string Value1 { get; set; } - public string Value2 { get; set; } - public string Value3 { get; set; } - } - - [Fact] - public void Should_map_all_null_values_to_its_substitute() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForAllMembers(opt => opt.NullSubstitute(string.Empty))); - - var src = new Source - { - Value1 = 5 - }; - - var dest = config.CreateMapper().Map(src); - - dest.Value1.ShouldEqual("5"); - dest.Value2.ShouldEqual(string.Empty); - dest.Value3.ShouldEqual(string.Empty); - } - } -} diff --git a/src/UnitTests/Bug/AllowNullCollectionsAssignableArray.cs b/src/UnitTests/Bug/AllowNullCollectionsAssignableArray.cs index 356563c577..4afb7ffa75 100644 --- a/src/UnitTests/Bug/AllowNullCollectionsAssignableArray.cs +++ b/src/UnitTests/Bug/AllowNullCollectionsAssignableArray.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using System.Collections.Generic; diff --git a/src/UnitTests/Bug/AllowNullDestinationValuesBugs.cs b/src/UnitTests/Bug/AllowNullDestinationValuesBugs.cs index e2770b6cb1..ddfdaf94ea 100644 --- a/src/UnitTests/Bug/AllowNullDestinationValuesBugs.cs +++ b/src/UnitTests/Bug/AllowNullDestinationValuesBugs.cs @@ -1,50 +1,50 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - namespace AllowNullDestinationValuesBugs - { - public class When_mapping_to_an_assignable_object_with_nullable_off : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public Inner Property { get; set; } - } - - public class Destination - { - public Inner SomeOtherProperty { get; set; } - } - - public class Inner - { - public string Name { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => - { - config.AllowNullDestinationValues = false; - config.CreateMap(); - config.CreateMap() - .ForMember(dest => dest.SomeOtherProperty, opt => opt.MapFrom(src => src.Property)); - }); - - protected override void Because_of() - { - Source source = new Source(); - - _destination = Mapper.Map(source); - } - - [Fact] - public void Should_create_the_assingable_member() - { - _destination.ShouldNotBeNull(); - _destination.SomeOtherProperty.ShouldNotBeNull(); - } - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + namespace AllowNullDestinationValuesBugs + { + public class When_mapping_to_an_assignable_object_with_nullable_off : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public Inner Property { get; set; } + } + + public class Destination + { + public Inner SomeOtherProperty { get; set; } + } + + public class Inner + { + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => + { + config.AllowNullDestinationValues = false; + config.CreateMap(); + config.CreateMap() + .ForMember(dest => dest.SomeOtherProperty, opt => opt.MapFrom(src => src.Property)); + }); + + protected override void Because_of() + { + Source source = new Source(); + + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_create_the_assingable_member() + { + _destination.ShouldNotBeNull(); + _destination.SomeOtherProperty.ShouldNotBeNull(); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/AssertConfigurationIsValidNullables.cs b/src/UnitTests/Bug/AssertConfigurationIsValidNullables.cs index 719977716f..3f675f5427 100644 --- a/src/UnitTests/Bug/AssertConfigurationIsValidNullables.cs +++ b/src/UnitTests/Bug/AssertConfigurationIsValidNullables.cs @@ -1,23 +1,23 @@ -using Xunit; -using Should; -using System; - -namespace AutoMapper.UnitTests.Bug -{ - public class AssertConfigurationIsValidNullables : AutoMapperSpecBase - { - class Source - { - public int? Number { get; set; } - } - class Destination - { - public decimal? Number { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - } +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests.Bug +{ + public class AssertConfigurationIsValidNullables : AutoMapperSpecBase + { + class Source + { + public int? Number { get; set; } + } + class Destination + { + public decimal? Number { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/AssignableCollectionBug.cs b/src/UnitTests/Bug/AssignableCollectionBug.cs index 8b5594714b..66ef8b02ba 100644 --- a/src/UnitTests/Bug/AssignableCollectionBug.cs +++ b/src/UnitTests/Bug/AssignableCollectionBug.cs @@ -1,78 +1,78 @@ -using System.Collections.Generic; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - namespace ByteArrayBug - { - public class When_mapping_byte_arrays : AutoMapperSpecBase - { - private Picture _source; - private PictureDto _dest; - - public class Picture - { - public int Id { get; set; } - public string Description { get; set; } - public byte[] ImageData { get; set; } - } - - public class PictureDto - { - public string Description { get; set; } - public byte[] ImageData { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _source = new Picture {ImageData = new byte[100]}; - _dest = Mapper.Map(_source); - } - - [Fact] - public void Should_copy_array() - { - _dest.ImageData.ShouldBeSameAs(_source.ImageData); - } - } - } - - namespace AssignableLists - { - public class AutoMapperTests - { - [Fact] - public void ListShouldNotMapAsReference() - { - // arrange - - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - var source = new A { Images = new List() }; - - // act - var destination = config.CreateMapper().Map(source); - destination.Images.Add("test"); - - // assert - destination.Images.Count.ShouldEqual(1); - source.Images.Count.ShouldEqual(0); // in 3.1.0 source.Images.Count is 1 - } - } - - public class A - { - public IList Images { get; set; } - } - - public class B - { - public IList Images { get; set; } - } - } -} +using System.Collections.Generic; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + namespace ByteArrayBug + { + public class When_mapping_byte_arrays : AutoMapperSpecBase + { + private Picture _source; + private PictureDto _dest; + + public class Picture + { + public int Id { get; set; } + public string Description { get; set; } + public byte[] ImageData { get; set; } + } + + public class PictureDto + { + public string Description { get; set; } + public byte[] ImageData { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Picture {ImageData = new byte[100_000]}; + _dest = Mapper.Map(_source); + } + + [Fact] + public void Should_copy_array() + { + _dest.ImageData.ShouldBe(_source.ImageData); + } + } + } + + namespace AssignableLists + { + public class AutoMapperTests + { + [Fact] + public void ListShouldNotMapAsReference() + { + // arrange + + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + var source = new A { Images = new List() }; + + // act + var destination = config.CreateMapper().Map(source); + destination.Images.Add("test"); + + // assert + destination.Images.Count.ShouldBe(1); + source.Images.Count.ShouldBe(0); // in 3.1.0 source.Images.Count is 1 + } + } + + public class A + { + public IList Images { get; set; } + } + + public class B + { + public IList Images { get; set; } + } + } +} diff --git a/src/UnitTests/Bug/AutoMapperInheritanceProblemDemo.cs b/src/UnitTests/Bug/AutoMapperInheritanceProblemDemo.cs index da0db9406f..c62cffa7ba 100644 --- a/src/UnitTests/Bug/AutoMapperInheritanceProblemDemo.cs +++ b/src/UnitTests/Bug/AutoMapperInheritanceProblemDemo.cs @@ -1,107 +1,107 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class SettersInBaseClasses : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - }); - - [Fact] - public void PublicSetterInParentWorks() - { - var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; - var target = Mapper.Map(source); - target.ParentProperty.ShouldEqual(source.ParentProperty); - target.ChildProperty.ShouldEqual(source.ChildProperty); - } - - - [Fact] - public void PublicSetterInGrandparentWorks() - { - var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; - var target = Mapper.Map(source); - target.ParentProperty.ShouldEqual(source.ParentProperty); - target.ChildProperty.ShouldEqual(source.ChildProperty); - } - - [Fact] - public void PublicSetterInGrandGrandparentWorks() - { - var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; - var target = Mapper.Map(source); - target.ParentProperty.ShouldEqual(source.ParentProperty); - target.ChildProperty.ShouldEqual(source.ChildProperty); - } - - [Fact] - public void PrivateSetterInParentWorks() - { - var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; - var target = Mapper.Map(source); - target.ParentProperty.ShouldEqual(source.ParentProperty); - target.ChildProperty.ShouldEqual(source.ChildProperty); - } - - [Fact] - public void PrivateSetterInGrandparentWorks() - { - var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; - var target = Mapper.Map(source); - target.ParentProperty.ShouldEqual(source.ParentProperty); - target.ChildProperty.ShouldEqual(source.ChildProperty); - } - - [Fact] - public void PrivateSetterInGrandGrandparentWorks() - { - var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; - var target = Mapper.Map(source); - target.ParentProperty.ShouldEqual(source.ParentProperty); - target.ChildProperty.ShouldEqual(source.ChildProperty); - } - } - - public class Source - { - public string ParentProperty { get; set; } - public int ChildProperty{get; set;} - } - - public class Parent { - public string ParentProperty{get; set;} - } - - public class Child : Parent { - public int ChildProperty {get; set;} - } - - public class GrandChild : Child { - } - - public class GrandGrandChild : GrandChild { - } - - public class ParentPrivate { - public string ParentProperty{get; private set;} - } - - public class ChildPrivate : ParentPrivate { - public int ChildProperty {get;private set;} - } - - public class GrandChildPrivate : ChildPrivate { - } - - public class GrandGrandChildPrivate : GrandChildPrivate { - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class SettersInBaseClasses : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void PublicSetterInParentWorks() + { + var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; + var target = Mapper.Map(source); + target.ParentProperty.ShouldBe(source.ParentProperty); + target.ChildProperty.ShouldBe(source.ChildProperty); + } + + + [Fact] + public void PublicSetterInGrandparentWorks() + { + var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; + var target = Mapper.Map(source); + target.ParentProperty.ShouldBe(source.ParentProperty); + target.ChildProperty.ShouldBe(source.ChildProperty); + } + + [Fact] + public void PublicSetterInGrandGrandparentWorks() + { + var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; + var target = Mapper.Map(source); + target.ParentProperty.ShouldBe(source.ParentProperty); + target.ChildProperty.ShouldBe(source.ChildProperty); + } + + [Fact] + public void PrivateSetterInParentWorks() + { + var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; + var target = Mapper.Map(source); + target.ParentProperty.ShouldBe(source.ParentProperty); + target.ChildProperty.ShouldBe(source.ChildProperty); + } + + [Fact] + public void PrivateSetterInGrandparentWorks() + { + var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; + var target = Mapper.Map(source); + target.ParentProperty.ShouldBe(source.ParentProperty); + target.ChildProperty.ShouldBe(source.ChildProperty); + } + + [Fact] + public void PrivateSetterInGrandGrandparentWorks() + { + var source = new Source {ParentProperty = "ParentProperty", ChildProperty = 1}; + var target = Mapper.Map(source); + target.ParentProperty.ShouldBe(source.ParentProperty); + target.ChildProperty.ShouldBe(source.ChildProperty); + } + } + + public class Source + { + public string ParentProperty { get; set; } + public int ChildProperty{get; set;} + } + + public class Parent { + public string ParentProperty{get; set;} + } + + public class Child : Parent { + public int ChildProperty {get; set;} + } + + public class GrandChild : Child { + } + + public class GrandGrandChild : GrandChild { + } + + public class ParentPrivate { + public string ParentProperty{get; private set;} + } + + public class ChildPrivate : ParentPrivate { + public int ChildProperty {get;private set;} + } + + public class GrandChildPrivate : ChildPrivate { + } + + public class GrandGrandChildPrivate : GrandChildPrivate { + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/BaseMapWithIncludesAndUnincludedMappings.cs b/src/UnitTests/Bug/BaseMapWithIncludesAndUnincludedMappings.cs index 569435d896..e8b7626e99 100644 --- a/src/UnitTests/Bug/BaseMapWithIncludesAndUnincludedMappings.cs +++ b/src/UnitTests/Bug/BaseMapWithIncludesAndUnincludedMappings.cs @@ -1,5 +1,4 @@ -using Should.Core.Assertions; -using Xunit; +using Xunit; namespace AutoMapper.UnitTests.Bug { @@ -52,12 +51,12 @@ public class Container2 { public BaseB Item { get; set; } } - public class BaseA + public abstract class BaseA { public string Name { get; set; } } - public class BaseB + public abstract class BaseB { public string Name { get; set; } } @@ -85,7 +84,8 @@ public void TestInitialiserProxyOfSub() cfg.CreateMap(); }); - var mapped = config.CreateMapper().Map(new Container() { Item = new ProxyOfSubA() { Name = "Martin", Description = "Hello" } }); + var mapped = config.CreateMapper() + .Map(new Container() { Item = new ProxyOfSubA() { Name = "Martin", Description = "Hello" } }); Assert.IsType(mapped.Item); } diff --git a/src/UnitTests/Bug/CannotConvertEnumToNullable.cs b/src/UnitTests/Bug/CannotConvertEnumToNullable.cs index d3fbc39313..fbcd17bd04 100644 --- a/src/UnitTests/Bug/CannotConvertEnumToNullable.cs +++ b/src/UnitTests/Bug/CannotConvertEnumToNullable.cs @@ -1,36 +1,36 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class CannotConvertEnumToNullable - { - public enum DummyTypes : int - { - Foo = 1, - Bar = 2 - } - - public class DummySource - { - public DummyTypes Dummy { get; set; } - } - - public class DummyDestination - { - public int? Dummy { get; set; } - } - - [Fact] - public void Should_map_enum_to_nullable() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - config.AssertConfigurationIsValid(); - DummySource src = new DummySource() { Dummy = DummyTypes.Bar }; - - var destination = config.CreateMapper().Map(src); - - destination.Dummy.ShouldEqual((int)DummyTypes.Bar); - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class CannotConvertEnumToNullable + { + public enum DummyTypes : int + { + Foo = 1, + Bar = 2 + } + + public class DummySource + { + public DummyTypes Dummy { get; set; } + } + + public class DummyDestination + { + public int? Dummy { get; set; } + } + + [Fact] + public void Should_map_enum_to_nullable() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + config.AssertConfigurationIsValid(); + DummySource src = new DummySource() { Dummy = DummyTypes.Bar }; + + var destination = config.CreateMapper().Map(src); + + destination.Dummy.ShouldBe((int)DummyTypes.Bar); + } + } +} diff --git a/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs b/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs new file mode 100644 index 0000000000..c7642c5ecc --- /dev/null +++ b/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs @@ -0,0 +1,53 @@ +using Shouldly; +using Xunit; +using System.Linq; +using AutoMapper.QueryableExtensions; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class CannotMapICollectionToAggregateSumDestination + { + class DummySource + { + public ICollection DummyCollection { get; set; } + } + + class DummyDestination + { + public int DummyCollectionSum { get; set; } + } + + [Fact] + public void Should_map_icollection_to_aggregate_sum_destination() + { + // arrange + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + // act + // do nothing + + // assert + config.AssertConfigurationIsValid(); + } + + [Fact] + public void Should_project_icollection_to_aggregate_sum_destination() + { + // arrange + var config = new MapperConfiguration(_ => { }); + var source = new DummySource() { DummyCollection = new[] { 1, 4, 5 } }; + + // act + var destination = new[] { source }.AsQueryable() + .ProjectTo(config) + .Single(); + + // assert + destination.DummyCollectionSum.ShouldBe(10); + } + } +} diff --git a/src/UnitTests/Bug/CannotProjectIEnumerableToAggregateDestinations.cs b/src/UnitTests/Bug/CannotProjectIEnumerableToAggregateDestinations.cs new file mode 100644 index 0000000000..60629e1c97 --- /dev/null +++ b/src/UnitTests/Bug/CannotProjectIEnumerableToAggregateDestinations.cs @@ -0,0 +1,43 @@ +using Shouldly; +using Xunit; +using System.Linq; +using AutoMapper.QueryableExtensions; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class CannotProjectIEnumerableToAggregateDestinations + { + class DummySource + { + public IEnumerable DummyEnumerable { get; set; } + } + + class DummyDestination + { + public int DummyEnumerableCount { get; set; } + public int DummyEnumerableSum { get; set; } + public int DummyEnumerableMin { get; set; } + public int DummyEnumerableMax { get; set; } + } + + [Fact] + public void Should_project_ienumerable_to_aggregate_destinations() + { + // arrange + var config = new MapperConfiguration(_ => { }); + var source = new DummySource() { DummyEnumerable = new[] { 1, 4, 5 } }; + + // act + var destination = new[] { source }.AsQueryable() + .ProjectTo(config) + .Single(); + + // assert + destination.DummyEnumerableCount.ShouldBe(3); + destination.DummyEnumerableSum.ShouldBe(10); + destination.DummyEnumerableMin.ShouldBe(1); + destination.DummyEnumerableMax.ShouldBe(5); + } + } +} diff --git a/src/UnitTests/Bug/CannotProjectStringToNullableEnum.cs b/src/UnitTests/Bug/CannotProjectStringToNullableEnum.cs new file mode 100644 index 0000000000..6aa0b08def --- /dev/null +++ b/src/UnitTests/Bug/CannotProjectStringToNullableEnum.cs @@ -0,0 +1,45 @@ +using Shouldly; +using Xunit; +using System.Linq; +using AutoMapper; +using AutoMapper.QueryableExtensions; + +namespace AutoMapper.UnitTests.Bug +{ + public class CannotProjectStringToNullableEnum + { + public enum DummyTypes : int + { + Foo = 1, + Bar = 2 + } + + public class DummySource + { + public string Dummy { get; set; } + } + + public class DummyDestination + { + public DummyTypes? Dummy { get; set; } + } + + [Fact] + public void Should_project_string_to_nullable_enum() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing(s => (DummyTypes)System.Enum.Parse(typeof(DummyTypes),s)); + cfg.CreateMap(); + }); + + config.AssertConfigurationIsValid(); + + var src = new DummySource[] { new DummySource { Dummy = "Foo" } }; + + var destination = src.AsQueryable().ProjectTo(config).First(); + + destination.Dummy.ShouldBe(DummyTypes.Foo); + } + } +} diff --git a/src/UnitTests/Bug/CaseSensitivityBug.cs b/src/UnitTests/Bug/CaseSensitivityBug.cs index 80c5905504..1c9d9a2d47 100644 --- a/src/UnitTests/Bug/CaseSensitivityBug.cs +++ b/src/UnitTests/Bug/CaseSensitivityBug.cs @@ -1,28 +1,28 @@ -namespace AutoMapper.UnitTests.Bug -{ - using Xunit; - - public class CaseSensitivityBug : NonValidatingSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void TestMethod1() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - - public class Foo - { - public int ID { get; set; } - } - - public class Bar - { - public int id { get; set; } - } - } +namespace AutoMapper.UnitTests.Bug +{ + using Xunit; + + public class CaseSensitivityBug : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void TestMethod1() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + + public class Foo + { + public int ID { get; set; } + } + + public class Bar + { + public int id { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/CollectionBaseClassGetConvention.cs b/src/UnitTests/Bug/CollectionBaseClassGetConvention.cs index b58cc2dbab..75134d40a0 100644 --- a/src/UnitTests/Bug/CollectionBaseClassGetConvention.cs +++ b/src/UnitTests/Bug/CollectionBaseClassGetConvention.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Should; +using Shouldly; using AutoMapper; using Xunit; diff --git a/src/UnitTests/Bug/CollectionWhere.cs b/src/UnitTests/Bug/CollectionWhere.cs index f755744b2f..9dbf73e312 100644 --- a/src/UnitTests/Bug/CollectionWhere.cs +++ b/src/UnitTests/Bug/CollectionWhere.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using System.Linq; using System.Collections.Generic; diff --git a/src/UnitTests/Bug/CollectionsNullability.cs b/src/UnitTests/Bug/CollectionsNullability.cs index 88f481d97c..ddac575d1c 100644 --- a/src/UnitTests/Bug/CollectionsNullability.cs +++ b/src/UnitTests/Bug/CollectionsNullability.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using System.Collections.Generic; diff --git a/src/UnitTests/Bug/ConditionBug.cs b/src/UnitTests/Bug/ConditionBug.cs index b8eec545dd..21bd44d51f 100644 --- a/src/UnitTests/Bug/ConditionBug.cs +++ b/src/UnitTests/Bug/ConditionBug.cs @@ -1,241 +1,325 @@ -namespace AutoMapper.UnitTests.Bug -{ - namespace ConditionBug - { - using System.Collections.Generic; - using Should; - using Xunit; - - public class Example : AutoMapperSpecBase - { - public class SubSource - { - public string SubValue { get; set; } - } - - public class Source - { - public Source() - { - Value = new List(); - } - - public List Value { get; set; } - } - - public class Destination - { - public string Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => - { - opt.PreCondition(src => src.Value.Count > 1); - opt.ResolveUsing(src => src.Value[1].SubValue); - }); - }); - - [Fact] - public void Should_skip_the_mapping_when_the_condition_is_false() - { - var src = new Source(); - src.Value.Add(new SubSource {SubValue = "x"}); - var destination = Mapper.Map(src); - - destination.Value.ShouldBeNull(); - } - - [Fact] - public void Should_execute_the_mapping_when_the_condition_is_true() - { - var src = new Source(); - src.Value.Add(new SubSource {SubValue = "x"}); - src.Value.Add(new SubSource {SubValue = "x"}); - var destination = Mapper.Map(src); - - destination.Value.ShouldEqual("x"); - } - } - - public class PrimitiveExample : AutoMapperSpecBase - { - public class Source - { - public int? Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - cfg.CreateMap() - .ForMember(d => d.Value, opt => - { - opt.PreCondition(src => src.Value.HasValue); - opt.MapFrom(src => src.Value.Value + 10); - })); - - - [Fact] - public void Should_skip_when_condition_not_met() - { - var dest = Mapper.Map(new Source()); - - dest.Value.ShouldEqual(0); - } - } - } - - namespace ConditionPropertyBug - { - using System; - using Should; - using Xunit; - - public class Example : AutoMapperSpecBase - { - public class Source - { - private int basePrice; - public bool HasBasePrice { get; set; } - public int BasePrice - { - get - { - if (!HasBasePrice) - throw new InvalidOperationException("Has no base price"); - - return basePrice; - } - set - { - basePrice = value; - HasBasePrice = true; - } - } - } - - public class Destination - { - public int BasePrice { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - cfg.CreateMap() - .ForMember(itemDTO => itemDTO.BasePrice, - config => - { - config.PreCondition(item => item.HasBasePrice); - config.MapFrom(item => item.BasePrice); - })); - - [Fact] - public void Should_skip_the_mapping_when_the_condition_property_is_false() - { - var src = new Source(); - var dest = Mapper.Map(src); - - dest.BasePrice.ShouldEqual(0); - } - - [Fact] - public void Should_execute_the_mapping_when_the_condition_property_is_true() - { - var src = new Source {BasePrice = 15}; - var dest = Mapper.Map(src); - - dest.BasePrice.ShouldEqual(src.BasePrice); - } - } - } - - - namespace SourceValueConditionPropertyBug - { - using Should; - using Xunit; - - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int? Value { get; set; } - } - - public class ConditionTests : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Value, opt => opt.Condition((src, dest, srcVal, destVal) => destVal == null)); - }); - - [Fact] - public void Should_map_value_when_null() - { - var destination = new Dest(); - Mapper.Map(new Source {Value = 5}, destination); - destination.Value.ShouldEqual(5); - } - - [Fact] - public void Should_not_map_value_when_not_null() - { - var destination = new Dest { Value = 6}; - Mapper.Map(new Source {Value = 5}, destination); - destination.Value.ShouldEqual(6); - } - } - } - - namespace SourceValueExceptionConditionPropertyBug - { - using System; - using Should; - using Xunit; - - public class Source - { - public bool Accessed = false; - public int Value - { - get - { - Accessed = true; - return 5; - } - } - } - - public class Dest - { - public int Value { get; set; } - } - - public class ConditionTests : NonValidatingSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Value, opt => opt.PreCondition((ResolutionContext rc) => false)); - }); - - [Fact] - public void Should_not_map() - { - var source = new Source(); - Mapper.Map(source); - source.Accessed.ShouldBeFalse(); - } - } - } - -} +namespace AutoMapper.UnitTests.Bug +{ + namespace ConditionBug + { + using System.Collections.Generic; + using Shouldly; + using Xunit; + + public class Example : AutoMapperSpecBase + { + public class SubSource + { + public string SubValue { get; set; } + } + + public class Source + { + public Source() + { + Value = new List(); + } + + public List Value { get; set; } + } + + public class Destination + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => + { + opt.PreCondition(src => src.Value.Count > 1); + opt.MapFrom(src => src.Value[1].SubValue); + }); + }); + + [Fact] + public void Should_skip_the_mapping_when_the_condition_is_false() + { + var src = new Source(); + src.Value.Add(new SubSource {SubValue = "x"}); + var destination = Mapper.Map(src); + + destination.Value.ShouldBeNull(); + } + + [Fact] + public void Should_execute_the_mapping_when_the_condition_is_true() + { + var src = new Source(); + src.Value.Add(new SubSource {SubValue = "x"}); + src.Value.Add(new SubSource {SubValue = "x"}); + var destination = Mapper.Map(src); + + destination.Value.ShouldBe("x"); + } + } + + public class PrimitiveExample : AutoMapperSpecBase + { + public class Source + { + public int? Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(d => d.Value, opt => + { + opt.PreCondition(src => src.Value.HasValue); + opt.MapFrom(src => src.Value.Value + 10); + })); + + + [Fact] + public void Should_skip_when_condition_not_met() + { + var dest = Mapper.Map(new Source()); + + dest.Value.ShouldBe(0); + } + } + } + + namespace ConditionPropertyBug + { + using System; + using Shouldly; + using Xunit; + + public class Example : AutoMapperSpecBase + { + public class Source + { + private int basePrice; + public bool HasBasePrice { get; set; } + public int BasePrice + { + get + { + if (!HasBasePrice) + throw new InvalidOperationException("Has no base price"); + + return basePrice; + } + set + { + basePrice = value; + HasBasePrice = true; + } + } + } + + public class Destination + { + public int BasePrice { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(itemDTO => itemDTO.BasePrice, + config => + { + config.PreCondition(item => item.HasBasePrice); + config.MapFrom(item => item.BasePrice); + })); + + [Fact] + public void Should_skip_the_mapping_when_the_condition_property_is_false() + { + var src = new Source(); + var dest = Mapper.Map(src); + + dest.BasePrice.ShouldBe(0); + } + + [Fact] + public void Should_execute_the_mapping_when_the_condition_property_is_true() + { + var src = new Source {BasePrice = 15}; + var dest = Mapper.Map(src); + + dest.BasePrice.ShouldBe(src.BasePrice); + } + } + } + + + namespace SourceValueConditionPropertyBug + { + using Shouldly; + using Xunit; + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int? Value { get; set; } + } + + public class ConditionTests : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value, opt => opt.Condition((src, dest, srcVal, destVal) => destVal == null)); + }); + + [Fact] + public void Should_map_value_when_null() + { + var destination = new Dest(); + Mapper.Map(new Source {Value = 5}, destination); + destination.Value.ShouldBe(5); + } + + [Fact] + public void Should_not_map_value_when_not_null() + { + var destination = new Dest { Value = 6}; + Mapper.Map(new Source {Value = 5}, destination); + destination.Value.ShouldBe(6); + } + } + } + + namespace SourceValueExceptionConditionPropertyBug + { + using System; + using System.Collections.Generic; + using Shouldly; + using Xunit; + + public enum Property + { + Value1 = 0, + Value2 = 1, + Value3 = 2, + Value4 = 3 + } + + public class Source + { + public Dictionary Accessed = new Dictionary + { + {Property.Value1, false}, + {Property.Value2, false}, + {Property.Value3, false}, + {Property.Value4, false} + }; + + public int Value1 + { + get + { + Accessed[Property.Value1] = true; + return 5; + } + } + + public int Value2 + { + get + { + Accessed[Property.Value2] = true; + return 10; + } + } + + public int Value3 + { + get + { + Accessed[Property.Value3] = true; + return 15; + } + } + + public int Value4 + { + get + { + Accessed[Property.Value4] = true; + return 20; + } + } + } + + public class Dest + { + public int Value1 { get; set; } + + public int Value2 { get; set; } + + public int Value3 { get; set; } + + public int Value4 { get; set; } + + public bool MarkerBool { get; set; } + } + + public class ConditionTests : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value1, opt => opt.PreCondition((Source src) => false)) + .ForMember(d => d.Value2, opt => opt.PreCondition((ResolutionContext rc) => false)) + .ForMember(d => d.Value3, opt => opt.PreCondition((src, rc) => false))//; + .ForMember(d => d.Value4, opt => opt.PreCondition((src, dest, rc) => + { + dest.MarkerBool = true; + return false; + })); + }); + + [Fact] + public void Should_not_map_when_precondition_with_source_parameter_is_false() + { + var source = new Source(); + Mapper.Map(source); + source.Accessed[Property.Value1].ShouldBeFalse(); + } + + [Fact] + public void Should_not_map_when_precondition_with_resolutioncontext_parameter_is_false() + { + var source = new Source(); + Mapper.Map(source); + source.Accessed[Property.Value2].ShouldBeFalse(); + } + + [Fact] + public void Should_not_map_when_precondition_with_source_and_resolutioncontext_parameters_is_false() + { + var source = new Source(); + Mapper.Map(source); + source.Accessed[Property.Value3].ShouldBeFalse(); + } + + [Fact] + public void Should_not_map_and_should_produce_sideeffect_when_precondition_with_source_and_desc_parameters_is_false() + { + var source = new Source(); + var dest = Mapper.Map(source); + source.Accessed[Property.Value4].ShouldBeFalse(); + dest.MarkerBool.ShouldBeTrue(); + } + + } + } + +} diff --git a/src/UnitTests/Bug/ConstructUsingReturnsNull.cs b/src/UnitTests/Bug/ConstructUsingReturnsNull.cs index 4f2e880a1b..17d561f091 100644 --- a/src/UnitTests/Bug/ConstructUsingReturnsNull.cs +++ b/src/UnitTests/Bug/ConstructUsingReturnsNull.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -20,11 +20,11 @@ class Destination cfg.CreateMap().ConstructUsing((Source source) => null); }); - [Fact(Skip = "It throws a NRE. Invalid Operation is annoying.")] + [Fact] public void Should_throw_when_construct_using_returns_null() { new Action(() => Mapper.Map(new Source())) - .ShouldThrow(ex=>ex.InnerException.ShouldBeType()); + .ShouldThrowException(ex=>ex.InnerException.ShouldBeOfType()); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ConstructorParameterNamedType.cs b/src/UnitTests/Bug/ConstructorParameterNamedType.cs index 3453307728..06afd07f89 100644 --- a/src/UnitTests/Bug/ConstructorParameterNamedType.cs +++ b/src/UnitTests/Bug/ConstructorParameterNamedType.cs @@ -1,5 +1,5 @@ using System; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -24,7 +24,7 @@ public DestinationClass(int type) public void Should_handle_constructor_parameter_named_type() { var config = new MapperConfiguration(c => c.CreateMap()); - new Action(config.AssertConfigurationIsValid).ShouldThrow(ex=>ex.Errors[0].UnmappedPropertyNames[0].ShouldEqual("Type")); + new Action(config.AssertConfigurationIsValid).ShouldThrowException(ex=>ex.Errors[0].UnmappedPropertyNames[0].ShouldBe("Type")); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ContextValuesIncorrect.cs b/src/UnitTests/Bug/ContextValuesIncorrect.cs index d5b78965d9..c0c4104f72 100644 --- a/src/UnitTests/Bug/ContextValuesIncorrect.cs +++ b/src/UnitTests/Bug/ContextValuesIncorrect.cs @@ -1,58 +1,58 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - namespace ContextValuesIncorrect - { - public class Foo - { - public int? Value { get; set; } - public int? Value2 { get; set; } - } - - public class FooDto - { - public int? Value { get; set; } - public int? Value2 { get; set; } - } - - public class When_conditionally_skipping_null_destination_values : AutoMapperSpecBase - { - private FooDto _destination; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForAllMembers(opt => opt.Condition((src, p, srvVal, destVal) => destVal == null)); - }); - - protected override void Because_of() - { - var source = new Foo - { - Value = 3, - Value2 = 4 - }; - _destination = new FooDto - { - Value = 5 - }; - - Mapper.Map(source, _destination); - } - - [Fact] - public void Should_map_the_null_value() - { - _destination.Value2.ShouldEqual(4); - } - - [Fact] - public void Should_leave_the_non_null_value_alone() - { - _destination.Value.ShouldEqual(5); - } - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + namespace ContextValuesIncorrect + { + public class Foo + { + public int? Value { get; set; } + public int? Value2 { get; set; } + } + + public class FooDto + { + public int? Value { get; set; } + public int? Value2 { get; set; } + } + + public class When_conditionally_skipping_null_destination_values : AutoMapperSpecBase + { + private FooDto _destination; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForAllMembers(opt => opt.Condition((src, p, srvVal, destVal) => destVal == null)); + }); + + protected override void Because_of() + { + var source = new Foo + { + Value = 3, + Value2 = 4 + }; + _destination = new FooDto + { + Value = 5 + }; + + Mapper.Map(source, _destination); + } + + [Fact] + public void Should_map_the_null_value() + { + _destination.Value2.ShouldBe(4); + } + + [Fact] + public void Should_leave_the_non_null_value_alone() + { + _destination.Value.ShouldBe(5); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ConventionCreateMapsWithCircularReference.cs b/src/UnitTests/Bug/ConventionCreateMapsWithCircularReference.cs new file mode 100644 index 0000000000..7d6757f8e9 --- /dev/null +++ b/src/UnitTests/Bug/ConventionCreateMapsWithCircularReference.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; +using AutoMapper.Mappers; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class ConventionCreateMapsWithCircularReference : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + //cfg.CreateMap().ReverseMap(); + //cfg.CreateMap().ReverseMap(); + //cfg.CreateMap().ReverseMap(); + cfg.ForAllMaps((t, c) => + { + c.PreserveReferences(); + }); + cfg.CreateMissingTypeMaps = true; + cfg.AddConditionalObjectMapper().Where((s, d) => + { + if (d.Name.Equals(s.Name + "Poco")) + { + return true; + } + return false; + }); + }); + + [Fact] + public void Main() + { + var role = new Role(); + var user = new User() + { + UsersInRoles = new List() + }; + user.UsersInRoles.Add(new UsersInRole() + { + Role = role, + User = user + }); + + var result = Mapper.Map(user); + } + + public partial class Role + { + public Role() + { + this.UsersInRoles = new List(); + } + public virtual IList UsersInRoles { get; set; } + } + + public partial class RolePoco + { + public RolePoco() + { + this.UsersInRoles = new List(); + } + public virtual IList UsersInRoles { get; set; } + } + + public partial class User + { + public User() + { + this.UsersInRoles = new List(); + } + public virtual IList UsersInRoles { get; set; } + } + + public partial class UserPoco + { + public UserPoco() + { + this.UsersInRoles = new List(); + } + public virtual IList UsersInRoles { get; set; } + } + + public partial class UsersInRole + { + public virtual Role Role { get; set; } + public virtual User User { get; set; } + } + + public partial class UsersInRolePoco + { + public virtual RolePoco Role { get; set; } + public virtual UserPoco User { get; set; } + } + + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/ConvertMapperThreading.cs b/src/UnitTests/Bug/ConvertMapperThreading.cs new file mode 100644 index 0000000000..f167045cb3 --- /dev/null +++ b/src/UnitTests/Bug/ConvertMapperThreading.cs @@ -0,0 +1,47 @@ +using System; +using Xunit; +using AutoMapper; +using System.Linq; +using System.Threading.Tasks; +using System.Diagnostics; +using System.Runtime.ExceptionServices; + +namespace AutoMapper.UnitTests +{ + public class ConvertMapperThreading + { + class Source + { + public string Number { get; set; } + } + + class Destination + { + public int Number { get; set; } + } + + [Fact] + public void Should_work() + { + var tasks = Enumerable.Range(0, 5).Select(i => Task.Factory.StartNew(() => + { + new MapperConfiguration(c => c.CreateMap()); + })).ToArray(); + try + { + Task.WaitAll(tasks); + } + catch(AggregateException ex) + { + ex.Handle(e => + { + if(e is InvalidOperationException) + { + throw e; + } + return false; + }); + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/CreateMapExpressionWithIgnoredPropertyBug.cs b/src/UnitTests/Bug/CreateMapExpressionWithIgnoredPropertyBug.cs index e2b9cbbdfe..05dc9a51c0 100644 --- a/src/UnitTests/Bug/CreateMapExpressionWithIgnoredPropertyBug.cs +++ b/src/UnitTests/Bug/CreateMapExpressionWithIgnoredPropertyBug.cs @@ -1,34 +1,34 @@ -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - using QueryableExtensions; - - public class CreateMapExpressionWithIgnoredPropertyBug - { - [Fact] - public void ShouldNotMapPropertyWhenItIsIgnored() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(x => x.Name, x => x.Ignore()); - }); - - IQueryable collection = (new List { new Person { Name = "Person1" } }).AsQueryable(); - - List result = collection.ProjectTo(config).ToList(); - - result.ForEach(x => x.Name.ShouldBeNull()); - } - - public class Person - { - public string Name { get; set; } - } - } +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + using QueryableExtensions; + + public class CreateMapExpressionWithIgnoredPropertyBug + { + [Fact] + public void ShouldNotMapPropertyWhenItIsIgnored() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(x => x.Name, x => x.Ignore()); + }); + + IQueryable collection = (new List { new Person { Name = "Person1" } }).AsQueryable(); + + List result = collection.ProjectTo(config).ToList(); + + result.ForEach(x => x.Name.ShouldBeNull()); + } + + public class Person + { + public string Name { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/CustomConverters.cs b/src/UnitTests/Bug/CustomConverters.cs new file mode 100644 index 0000000000..143744796f --- /dev/null +++ b/src/UnitTests/Bug/CustomConverters.cs @@ -0,0 +1,149 @@ +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableTypeConverter : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public DateTimeOffset? Date { get; set; } + } + + class Destination + { + public DateTime? Date { get; set; } + } + + public class NullableDateTimeOffsetConverter : ITypeConverter + { + public DateTime? Convert(DateTimeOffset? source, DateTime? destination, ResolutionContext context) + { + if(source.HasValue) + { + return source.Value.DateTime; + } + return default(DateTime?); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap(); + c.CreateMap().ConvertUsing(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Date = DateTimeOffset.MaxValue }); + } + + [Fact] + public void Should_use_the_converter() + { + _destination.Date.ShouldBe(DateTime.MaxValue); + } + } + + public class CustomConverters : AutoMapperSpecBase + { + public class NullableIntToBoolConverter : ITypeConverter + { + public bool Convert(int? source, bool destination, ResolutionContext context) + { + if(source == null) + return false; + + return source == 1; + } + } + + public class BoolToNullableIntConverter : ITypeConverter + { + public int? Convert(bool source, int? destination, ResolutionContext context) + { + return source ? 1 : 0; + } + } + + public class IntToBoolConverter : ITypeConverter + { + public bool Convert(int source, bool destination, ResolutionContext context) + { + return source == 1; + } + } + + public class BoolToIntConverter : ITypeConverter + { + public int Convert(bool source, int destination, ResolutionContext context) + { + return source ? 1 : 0; + } + } + + private class IntEntity + { + public int IntProperty { get; set; } + + public IntEntity() { } + + public IntEntity(int value) + { + IntProperty = value; + } + } + + private class BoolModel + { + public bool IntProperty { get; set; } + + public BoolModel() { } + + public BoolModel(bool value) + { + IntProperty = value; + } + } + + private class NullableIntEntity + { + public int? IntProperty { get; set; } + + public NullableIntEntity() { } + + public NullableIntEntity(int? value) + { + IntProperty = value; + } + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + }); + + [Fact] + public void CheckConverters() + { + Mapper.Map(1).ShouldBeTrue(); + Mapper.Map(0).ShouldBeFalse(); + Mapper.Map(0).ShouldBeFalse(); + Mapper.Map(1).ShouldBeTrue(); + Mapper.Map(true).ShouldBe(1); + Mapper.Map(false).ShouldBe(0); + Mapper.Map(true).ShouldBe(1); + Mapper.Map(false).ShouldBe(0); + Mapper.Map(null).ShouldBeFalse(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/CustomIEnumerableBug.cs b/src/UnitTests/Bug/CustomIEnumerableBug.cs index 08ca77dd5e..96fcb61184 100644 --- a/src/UnitTests/Bug/CustomIEnumerableBug.cs +++ b/src/UnitTests/Bug/CustomIEnumerableBug.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class One - { - public IEnumerable Stuff { get; set; } - } - - public class Two - { - public IEnumerable Stuff { get; set; } - } - - public class Item - { - public string Value { get; set; } - } - - public class StringToItemConverter : ITypeConverter, IEnumerable> - { - public IEnumerable Convert(IEnumerable source, ResolutionContext context) - { - var result = new List(); - foreach (string s in source) - if (!String.IsNullOrEmpty(s)) - result.Add(new Item { Value = s }); - return result; - } - } - public class AutoMapperBugTest - { - [Fact] - public void ShouldMapOneToTwo() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - cfg.CreateMap, IEnumerable>().ConvertUsing(); - }); - - config.AssertConfigurationIsValid(); - - var engine = config.CreateMapper(); - var one = new One - { - Stuff = new List { "hi", "", "mom" } - }; - - var two = engine.Map(one); - - two.ShouldNotBeNull(); - two.Stuff.Count().ShouldEqual(2); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper; +using AutoMapper.Mappers; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class One + { + public IEnumerable Stuff { get; set; } + } + + public class Two + { + public IEnumerable Stuff { get; set; } + } + + public class Item + { + public string Value { get; set; } + } + + public class StringToItemConverter : ITypeConverter, IEnumerable> + { + public IEnumerable Convert(IEnumerable source, IEnumerable destination, ResolutionContext context) + { + var result = new List(); + foreach (string s in source) + if (!String.IsNullOrEmpty(s)) + result.Add(new Item { Value = s }); + return result; + } + } + public class AutoMapperBugTest + { + [Fact] + public void ShouldMapOneToTwo() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap, IEnumerable>().ConvertUsing(); + }); + + config.AssertConfigurationIsValid(); + + var engine = config.CreateMapper(); + var one = new One + { + Stuff = new List { "hi", "", "mom" } + }; + + var two = engine.Map(one); + + two.ShouldNotBeNull(); + two.Stuff.Count().ShouldBe(2); + } + } +} diff --git a/src/UnitTests/Bug/DeepCloningBug.cs b/src/UnitTests/Bug/DeepCloningBug.cs new file mode 100644 index 0000000000..df67c76429 --- /dev/null +++ b/src/UnitTests/Bug/DeepCloningBug.cs @@ -0,0 +1,46 @@ +namespace AutoMapper.UnitTests.Bug +{ + using System; + using Shouldly; + using Xunit; + + public class DeepCloningBug : AutoMapperSpecBase + { + private Outer _source; + private Outer _dest; + + public class Outer + { + public Inner Foo { get; set; } + } + + public class Inner + { + + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Outer { Foo = new Inner() }; + _dest = Mapper.Map(_source); + } + + [Fact] + public void Should_map_new_top_object() + { + _dest.ShouldNotBeSameAs(_source); + } + + [Fact] + public void Should_map_new_second_level_object() + { + _dest.Foo.ShouldNotBeSameAs(_source.Foo); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/DeepInheritanceIssue.cs b/src/UnitTests/Bug/DeepInheritanceIssue.cs index 3104001402..391bd68a5a 100644 --- a/src/UnitTests/Bug/DeepInheritanceIssue.cs +++ b/src/UnitTests/Bug/DeepInheritanceIssue.cs @@ -1,80 +1,80 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class DeepInheritanceIssue - { - [Fact] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - cfg.CreateMap() - .Include() - .Include(); - - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - - var expectedCSrc = new CSrc() {StringA = "A", StringB = "B", StringC = "C"}; - var expectedBSrc = new BSrc() {StringA = "A", StringB = "B"}; - - var expectedContCSrc = new ContainsASrc() {A = expectedCSrc}; - var expectedContBSrc = new ContainsASrc() {A = expectedBSrc}; - - var mapper = config.CreateMapper(); - var actualContCDest = mapper.Map(expectedContCSrc); - var actualContBDest = mapper.Map(expectedContBSrc); // THROWS - - config.AssertConfigurationIsValid(); - actualContBDest.ShouldNotBeNull(); - actualContCDest.ShouldNotBeNull(); - } - } - - public class ContainsASrc - { - public ASrc A { get; set; } - } - - public abstract class ASrc - { - public string StringA { get; set; } - } - - public class BSrc : ASrc - { - public string StringB { get; set; } - } - - public class CSrc : BSrc - { - public string StringC { get; set; } - } - - public class ContainsADest - { - public ADest A { get; set; } - } - - public abstract class ADest - { - public string StringA { get; set; } - } - - public class BDest : ADest - { - public string StringB { get; set; } - } - - public class CDest : BDest - { - public string StringC { get; set; } - } +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class DeepInheritanceIssue + { + [Fact] + public void Example() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap() + .Include() + .Include(); + + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + + var expectedCSrc = new CSrc() {StringA = "A", StringB = "B", StringC = "C"}; + var expectedBSrc = new BSrc() {StringA = "A", StringB = "B"}; + + var expectedContCSrc = new ContainsASrc() {A = expectedCSrc}; + var expectedContBSrc = new ContainsASrc() {A = expectedBSrc}; + + var mapper = config.CreateMapper(); + var actualContCDest = mapper.Map(expectedContCSrc); + var actualContBDest = mapper.Map(expectedContBSrc); // THROWS + + config.AssertConfigurationIsValid(); + actualContBDest.ShouldNotBeNull(); + actualContCDest.ShouldNotBeNull(); + } + } + + public class ContainsASrc + { + public ASrc A { get; set; } + } + + public abstract class ASrc + { + public string StringA { get; set; } + } + + public class BSrc : ASrc + { + public string StringB { get; set; } + } + + public class CSrc : BSrc + { + public string StringC { get; set; } + } + + public class ContainsADest + { + public ADest A { get; set; } + } + + public abstract class ADest + { + public string StringA { get; set; } + } + + public class BDest : ADest + { + public string StringB { get; set; } + } + + public class CDest : BDest + { + public string StringC { get; set; } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/DestinationCtorCalledTwice.cs b/src/UnitTests/Bug/DestinationCtorCalledTwice.cs index ef0288955b..69424436e1 100644 --- a/src/UnitTests/Bug/DestinationCtorCalledTwice.cs +++ b/src/UnitTests/Bug/DestinationCtorCalledTwice.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; namespace AutoMapper.UnitTests.Bug { @@ -43,7 +43,7 @@ public void Should_call_ctor_once() var config = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); config.CreateMapper().Map(source, dest); - Destination.CallCount.ShouldEqual(1); + Destination.CallCount.ShouldBe(1); } } } diff --git a/src/UnitTests/Bug/DestinationValueInitializedByCtorBug.cs b/src/UnitTests/Bug/DestinationValueInitializedByCtorBug.cs index 521f534add..6fd65816e8 100644 --- a/src/UnitTests/Bug/DestinationValueInitializedByCtorBug.cs +++ b/src/UnitTests/Bug/DestinationValueInitializedByCtorBug.cs @@ -1,65 +1,65 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class DestinationValueInitializedByCtorBug : AutoMapperSpecBase - { - public class ItemToMapDto - { - public ItemToMapDto() - { - /* Remove the line below and the mapping works correctly*/ - this.Tag = new TagDto() { Name = Guid.NewGuid().ToString() }; - } - public string Name { get; set; } - public TagDto Tag { get; set; } - } - public class TagDto - { - public string Name { get; set; } - public bool IsTrue { get; set; } - } - public class ItemToMap - { - public string Name { get; set; } - public Tag Tag { get; set; } - } - public class Tag - { - public string Name { get; set; } - public bool IsTrue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - [Fact] - public void Should_map_all_null_values_to_its_substitute() - { - var tag = new Tag(); - - List entities = new List(); - - for (int i = 0; i < 10; i++) - { - entities.Add(new ItemToMap() - { - Name = Guid.NewGuid().ToString(), - Tag = tag, - }); - } - - Mapper.Map, List>(entities); - typeof(AutoMapperMappingException).ShouldNotBeThrownBy(() => Mapper.Map, List>(entities)); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper; +using AutoMapper.Mappers; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class DestinationValueInitializedByCtorBug : AutoMapperSpecBase + { + public class ItemToMapDto + { + public ItemToMapDto() + { + /* Remove the line below and the mapping works correctly*/ + this.Tag = new TagDto() { Name = Guid.NewGuid().ToString() }; + } + public string Name { get; set; } + public TagDto Tag { get; set; } + } + public class TagDto + { + public string Name { get; set; } + public bool IsTrue { get; set; } + } + public class ItemToMap + { + public string Name { get; set; } + public Tag Tag { get; set; } + } + public class Tag + { + public string Name { get; set; } + public bool IsTrue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_all_null_values_to_its_substitute() + { + var tag = new Tag(); + + List entities = new List(); + + for (int i = 0; i < 10; i++) + { + entities.Add(new ItemToMap() + { + Name = Guid.NewGuid().ToString(), + Tag = tag, + }); + } + + Mapper.Map, List>(entities); + typeof(AutoMapperMappingException).ShouldNotBeThrownBy(() => Mapper.Map, List>(entities)); + } + } +} diff --git a/src/UnitTests/Bug/DuplicateExtensionMethods.cs b/src/UnitTests/Bug/DuplicateExtensionMethods.cs new file mode 100644 index 0000000000..6578451b27 --- /dev/null +++ b/src/UnitTests/Bug/DuplicateExtensionMethods.cs @@ -0,0 +1,42 @@ +using Xunit; +using Shouldly; +using System; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class DuplicateExtensionMethods : AutoMapperSpecBase + { + public class Outlay + { + public int Amount { get; set; } + } + + public enum AccountKind { None } + + class Source + { + public int UserId { get; set; } + public string UserName { get; set; } + public string UserPhone { get; set; } + public string IDCard { get; set; } + public AccountKind Kind { get; set; } + public decimal UnUsedAmount { get; set; } + public List Outlay { get; set; } + } + class Destination + { + public int UserId { get; set; } + public string UserName { get; set; } + public string UserPhone { get; set; } + public string IDCard { get; set; } + public AccountKind Kind { get; set; } + public decimal UnUsedAmount { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/DuplicateValuesBug.cs b/src/UnitTests/Bug/DuplicateValuesBug.cs index 4065fae704..cf009956b9 100644 --- a/src/UnitTests/Bug/DuplicateValuesBug.cs +++ b/src/UnitTests/Bug/DuplicateValuesBug.cs @@ -1,71 +1,74 @@ -using System.Collections.Generic; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - namespace DuplicateValuesBug - { - public class SourceObject - { - public int Id; - public IList Children; - - public void AddChild(SourceObject childObject) - { - if (this.Children == null) - this.Children = new List(); - - Children.Add(childObject); - } - } - - - public class DestObject - { - public int Id; - public IList Children; - - public void AddChild(DestObject childObject) - { - if (this.Children == null) - this.Children = new List(); - - Children.Add(childObject); - } - } - public class DuplicateValuesIssue - { - [Fact] - public void Should_map_the_existing_array_elements_over() - { - var sourceList = new List(); - var destList = new List(); - - var config = new MapperConfiguration(cfg => cfg.CreateMap().PreserveReferences()); - config.AssertConfigurationIsValid(); - - var source1 = new SourceObject - { - Id = 1, - }; - sourceList.Add(source1); - - var source2 = new SourceObject - { - Id = 2, - }; - sourceList.Add(source2); - - source1.AddChild(source2); // This causes the problem - - DestObject dest1 = new DestObject(); - config.CreateMapper().Map(sourceList, destList); - - destList.Count.ShouldEqual(2); - destList[0].Children.Count.ShouldEqual(1); - destList[0].Children[0].ShouldBeSameAs(destList[1]); - } - } - } +using System.Collections.Generic; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + namespace DuplicateValuesBug + { + public class SourceObject + { + public int Id; + public IList Children; + + public void AddChild(SourceObject childObject) + { + if (this.Children == null) + this.Children = new List(); + + Children.Add(childObject); + } + } + + + public class DestObject + { + public int Id; + public IList Children; + + public DestObject() + { + } + + public void AddChild(DestObject childObject) + { + if (this.Children == null) + this.Children = new List(); + + Children.Add(childObject); + } + } + public class DuplicateValuesIssue + { + [Fact] + public void Should_map_the_existing_array_elements_over() + { + var sourceList = new List(); + var destList = new List(); + + var config = new MapperConfiguration(cfg => cfg.CreateMap().PreserveReferences()); + config.AssertConfigurationIsValid(); + + var source1 = new SourceObject + { + Id = 1, + }; + sourceList.Add(source1); + + var source2 = new SourceObject + { + Id = 2, + }; + sourceList.Add(source2); + + source1.AddChild(source2); // This causes the problem + + config.CreateMapper().Map(sourceList, destList); + + destList.Count.ShouldBe(2); + destList[0].Children.Count.ShouldBe(1); + destList[0].Children[0].ShouldBeSameAs(destList[1]); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/DuplicateValuesBugWithoutPR.cs b/src/UnitTests/Bug/DuplicateValuesBugWithoutPR.cs new file mode 100644 index 0000000000..78f3bbfaf8 --- /dev/null +++ b/src/UnitTests/Bug/DuplicateValuesBugWithoutPR.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class DuplicateValuesIssue + { + public class SourceObject + { + public int Id; + public IList Children; + + public void AddChild(SourceObject childObject) + { + if(this.Children == null) + this.Children = new List(); + + Children.Add(childObject); + } + } + + + public class DestObject + { + public int Id; + public IList Children; + + public DestObject() + { + } + + public void AddChild(DestObject childObject) + { + if(this.Children == null) + this.Children = new List(); + + Children.Add(childObject); + } + } + + [Fact] + public void Should_map_the_existing_array_elements_over() + { + var sourceList = new List(); + var destList = new List(); + + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + config.AssertConfigurationIsValid(); + + var source1 = new SourceObject + { + Id = 1, + }; + sourceList.Add(source1); + + var source2 = new SourceObject + { + Id = 2, + }; + sourceList.Add(source2); + + source1.AddChild(source2); // This causes the problem + + config.CreateMapper().Map(sourceList, destList); + + destList.Count.ShouldBe(2); + destList[0].Children.Count.ShouldBe(1); + destList[0].Children[0].ShouldBeSameAs(destList[1]); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/DynamicMapArrays.cs b/src/UnitTests/Bug/DynamicMapArrays.cs index 0609f509bb..966f3865f3 100644 --- a/src/UnitTests/Bug/DynamicMapArrays.cs +++ b/src/UnitTests/Bug/DynamicMapArrays.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using Should; +using Shouldly; using Xunit; using AutoMapper; @@ -32,7 +32,7 @@ public void Should_dynamic_map_the_array() source = Enumerable.Range(0, 9).Select(i => new Source(i)).ToArray(); var config = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); destination = config.CreateMapper().Map(source); - destination.Length.ShouldEqual(source.Length); + destination.Length.ShouldBe(source.Length); Array.TrueForAll(source, s => s.Value == destination[s.Value].Value).ShouldBeTrue(); } } diff --git a/src/UnitTests/Bug/EFCollections.cs b/src/UnitTests/Bug/EFCollections.cs index 5f058fb7ba..33b938a563 100644 --- a/src/UnitTests/Bug/EFCollections.cs +++ b/src/UnitTests/Bug/EFCollections.cs @@ -1,60 +1,60 @@ -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class EFCollections : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public ICollection Children { get; set; } - - } - - public class OtherSource : Source - { - } - - public class OtherChild : Child - { - - } - - public class Dest - { - public ICollection Children { get; set; } - } - - public class DestChild {} - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var source = new OtherSource - { - Children = new Collection - { - new OtherChild(), - new OtherChild() - } - }; - _dest = Mapper.Map(source); - } - - [Fact] - public void Should_map_collection_items() - { - _dest.Children.Count.ShouldEqual(2); - } - } -} +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class EFCollections : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public ICollection Children { get; set; } + + } + + public class OtherSource : Source + { + } + + public class OtherChild : Child + { + + } + + public class Dest + { + public ICollection Children { get; set; } + } + + public class DestChild {} + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new OtherSource + { + Children = new Collection + { + new OtherChild(), + new OtherChild() + } + }; + _dest = Mapper.Map(source); + } + + [Fact] + public void Should_map_collection_items() + { + _dest.Children.Count.ShouldBe(2); + } + } +} diff --git a/src/UnitTests/Bug/EmptyNullSubstituteBug.cs b/src/UnitTests/Bug/EmptyNullSubstituteBug.cs index e6dff83ff7..9260eef0fd 100644 --- a/src/UnitTests/Bug/EmptyNullSubstituteBug.cs +++ b/src/UnitTests/Bug/EmptyNullSubstituteBug.cs @@ -1,56 +1,56 @@ -namespace AutoMapper.UnitTests.Bug -{ - using Should; - using Xunit; - - public class EmptyNullSubstituteBug : NonValidatingSpecBase - { - private Entity _destination; - - public class Model - { - public string Name { get; set; } - public int Age { get; set; } - } - - public class Entity - { - public string Name { get; set; } - public int Age { get; set; } - public string ClientIPAddress { get; set; } - public string NotifyEmail { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(e => e.ClientIPAddress, opts => opts.NullSubstitute("")) - .ForMember(e => e.NotifyEmail, opts => opts.NullSubstitute("")); - }); - - protected override void Because_of() - { - var model = new Model - { - Name = "Eric Cartman", - Age = 12 - }; - - _destination = new Entity - { - Name = "Eric Cartman", - Age = 12, - ClientIPAddress = "192.22.2.1", - NotifyEmail = "stan@gmail.com" - }; - - _destination = Mapper.Map(model, _destination); - } - - [Fact] - public void Should_keep_existing_ip_address() - { - _destination.ClientIPAddress.ShouldEqual("192.22.2.1"); - } - } +namespace AutoMapper.UnitTests.Bug +{ + using Shouldly; + using Xunit; + + public class EmptyNullSubstituteBug : NonValidatingSpecBase + { + private Entity _destination; + + public class Model + { + public string Name { get; set; } + public int Age { get; set; } + } + + public class Entity + { + public string Name { get; set; } + public int Age { get; set; } + public string ClientIPAddress { get; set; } + public string NotifyEmail { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(e => e.ClientIPAddress, opts => opts.NullSubstitute("")) + .ForMember(e => e.NotifyEmail, opts => opts.NullSubstitute("")); + }); + + protected override void Because_of() + { + var model = new Model + { + Name = "Eric Cartman", + Age = 12 + }; + + _destination = new Entity + { + Name = "Eric Cartman", + Age = 12, + ClientIPAddress = "192.22.2.1", + NotifyEmail = "stan@gmail.com" + }; + + _destination = Mapper.Map(model, _destination); + } + + [Fact] + public void Should_keep_existing_ip_address() + { + _destination.ClientIPAddress.ShouldBe("192.22.2.1"); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/EnumCaseSensitivityBug.cs b/src/UnitTests/Bug/EnumCaseSensitivityBug.cs new file mode 100644 index 0000000000..06cc41c2b8 --- /dev/null +++ b/src/UnitTests/Bug/EnumCaseSensitivityBug.cs @@ -0,0 +1,42 @@ +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + using Xunit; + + public class EnumCaseSensitivityBug : AutoMapperSpecBase + { + private SecondEnum _resultSecondEnum; + private FirstEnum _resultFirstEnum; + + public enum FirstEnum + { + Dog, + Cat + } + + public enum SecondEnum + { + cat, + dog + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + // not creating a map on purpose to trigger use of EnumToEnumMapper + }); + + protected override void Because_of() + { + _resultSecondEnum = Mapper.Map(FirstEnum.Cat); + _resultFirstEnum = Mapper.Map(SecondEnum.dog); + } + + [Fact] + public void Should_match_on_the_name_even_if_values_match() + { + _resultSecondEnum.ShouldBe(SecondEnum.cat); + _resultFirstEnum.ShouldBe(FirstEnum.Dog); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/EnumConditionsBug.cs b/src/UnitTests/Bug/EnumConditionsBug.cs index 30cf9b94dd..64e3852249 100644 --- a/src/UnitTests/Bug/EnumConditionsBug.cs +++ b/src/UnitTests/Bug/EnumConditionsBug.cs @@ -1,52 +1,52 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - namespace EnumConditionsBug - { - [Flags] - public enum Enum1 { One, Two }; - [Flags] - public enum Enum2 { Three, Four } - - public class EnumTestSource - { - public IEnumerable Prop1 { get; set; } - public IEnumerable Prop2 { get; set; } - } - - public class EnumTestDest - { - public Enum1 Prop1 { get; set; } - public Enum2 Prop2 { get; set; } - } - public class EnumMapperTest - { - [Fact] - public void Mapper_respects_condition() - { - var _c1Called = false; - var _c2Called = false; - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(m => m.Prop1, o => - { - o.Condition((_, srcProp, destProp) => { _c1Called = true; return srcProp != null; }); - o.ResolveUsing(f => f.Prop1?.Aggregate((current, next) => current | next)); - }) - .ForMember(m => m.Prop2, o => - { - o.Condition((_, srcProp, destProp) => { _c2Called = true; return srcProp != null; }); - o.ResolveUsing(f => f.Prop2?.Aggregate((current, next) => current | next)); - })); - var src = new EnumTestSource { Prop1 = new[] { Enum1.One }, Prop2 = null }; - var dest = config.CreateMapper().Map(src); // will throw - _c1Called.ShouldBeTrue(); - _c2Called.ShouldBeTrue(); - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + namespace EnumConditionsBug + { + [Flags] + public enum Enum1 { One, Two }; + [Flags] + public enum Enum2 { Three, Four } + + public class EnumTestSource + { + public IEnumerable Prop1 { get; set; } + public IEnumerable Prop2 { get; set; } + } + + public class EnumTestDest + { + public Enum1 Prop1 { get; set; } + public Enum2 Prop2 { get; set; } + } + public class EnumMapperTest + { + [Fact] + public void Mapper_respects_condition() + { + var _c1Called = false; + var _c2Called = false; + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(m => m.Prop1, o => + { + o.Condition((_, srcProp, destProp) => { _c1Called = true; return srcProp != null; }); + o.MapFrom((f, _) => f.Prop1?.Aggregate((current, next) => current | next)); + }) + .ForMember(m => m.Prop2, o => + { + o.Condition((_, srcProp, destProp) => { _c2Called = true; return srcProp != null; }); + o.MapFrom((f, _) => f.Prop2?.Aggregate((current, next) => current | next)); + })); + var src = new EnumTestSource { Prop1 = new[] { Enum1.One }, Prop2 = null }; + var dest = config.CreateMapper().Map(src); // will throw + _c1Called.ShouldBeTrue(); + _c2Called.ShouldBeTrue(); + } + } + } +} diff --git a/src/UnitTests/Bug/EnumMatchingOnValue.cs b/src/UnitTests/Bug/EnumMatchingOnValue.cs index d5a6bcf028..f71dc882dc 100644 --- a/src/UnitTests/Bug/EnumMatchingOnValue.cs +++ b/src/UnitTests/Bug/EnumMatchingOnValue.cs @@ -1,53 +1,53 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class EnumMatchingOnValue : AutoMapperSpecBase - { - private SecondClass _result; - - public class FirstClass - { - public FirstEnum EnumValue { get; set; } - } - - public enum FirstEnum - { - NamedEnum = 1, - SecondNameEnum = 2 - } - - public class SecondClass - { - public SecondEnum EnumValue { get; set; } - } - - public enum SecondEnum - { - DifferentNamedEnum = 1, - SecondNameEnum = 2 - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var source = new FirstClass - { - EnumValue = FirstEnum.NamedEnum - }; - _result = Mapper.Map(source); - } - - [Fact] - public void Should_match_on_the_name_even_if_values_match() - { - _result.EnumValue.ShouldEqual(SecondEnum.DifferentNamedEnum); - } - } - +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class EnumMatchingOnValue : AutoMapperSpecBase + { + private SecondClass _result; + + public class FirstClass + { + public FirstEnum EnumValue { get; set; } + } + + public enum FirstEnum + { + NamedEnum = 1, + SecondNameEnum = 2 + } + + public class SecondClass + { + public SecondEnum EnumValue { get; set; } + } + + public enum SecondEnum + { + DifferentNamedEnum = 1, + SecondNameEnum = 2 + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new FirstClass + { + EnumValue = FirstEnum.NamedEnum + }; + _result = Mapper.Map(source); + } + + [Fact] + public void Should_match_on_the_name_even_if_values_match() + { + _result.EnumValue.ShouldBe(SecondEnum.DifferentNamedEnum); + } + } + } \ No newline at end of file diff --git a/src/UnitTests/Bug/ExistingArrays.cs b/src/UnitTests/Bug/ExistingArrays.cs index 567f8f5693..3593a34e65 100644 --- a/src/UnitTests/Bug/ExistingArrays.cs +++ b/src/UnitTests/Bug/ExistingArrays.cs @@ -1,63 +1,63 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class ExistingArrays : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - [Fact] - public void should_map_array_inside_object() - { - var source = new Source { Values = new[] { "1", "2" } }; - var dest = Mapper.Map(source); - } - - - [Fact] - public void should_map_over_enumerable_empty() - { - var source = new Source { Values = new[] { "1", "2" } }; - var dest = Mapper.Map(source); - } - - public class Source - { - public Source() - { - Values = new string[0]; - } - - public string[] Values { get; set; } - } - - public class Dest - { - public Dest() - { - // remove this line will get it fixed. - Values = new string[0]; - } - - public string[] Values { get; set; } - } - - public class DestWithIEnumerableInitializer - { - public DestWithIEnumerableInitializer() - { - // remove this line will get it fixed. - Values = Enumerable.Empty(); - } - - public IEnumerable Values { get; set; } - } - } +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class ExistingArrays : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void should_map_array_inside_object() + { + var source = new Source { Values = new[] { "1", "2" } }; + var dest = Mapper.Map(source); + } + + + [Fact] + public void should_map_over_enumerable_empty() + { + var source = new Source { Values = new[] { "1", "2" } }; + var dest = Mapper.Map(source); + } + + public class Source + { + public Source() + { + Values = new string[0]; + } + + public string[] Values { get; set; } + } + + public class Dest + { + public Dest() + { + // remove this line will get it fixed. + Values = new string[0]; + } + + public string[] Values { get; set; } + } + + public class DestWithIEnumerableInitializer + { + public DestWithIEnumerableInitializer() + { + // remove this line will get it fixed. + Values = Enumerable.Empty(); + } + + public IEnumerable Values { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ExpressionMapping.cs b/src/UnitTests/Bug/ExpressionMapping.cs deleted file mode 100644 index b4aba0b145..0000000000 --- a/src/UnitTests/Bug/ExpressionMapping.cs +++ /dev/null @@ -1,341 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using AutoMapper.QueryableExtensions; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public static class GenericTestExtensionMethods - { - public static bool Any(this IEnumerable self, Func func) - { - return self.Where(func).Any(); - } - - public static bool AnyParamReverse(this IEnumerable self, Func func) - { - return self.Any(t => func(t,t)); - } - - public static bool Lambda(this T self, Func func) - { - return func(self); - } - } - - public class ExpressionPropertyMapping : NonValidatingSpecBase - { - - public class SourceExpressionHolder - { - public Expression> Expression { get; set; } - } - - public class DestExpressionHolder - { - public Expression> Expression { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ReverseMap(); - cfg.CreateMap().ReverseMap(); - cfg.CreateMap() - .ForMember(d => d.ID_, opt => opt.MapFrom(s => s.ID)) - .ReverseMap() - .ForMember(d => d.ID, opt => opt.MapFrom(s => s.ID_)); - }); - - [Fact] - public void Should_Map_Expressions_UsingExpressions() - { - var source = new SourceExpressionHolder() { Expression = p => p.Child != null }; - var dest = Mapper.Map(source); - } - } - - public class ExpressionMapping : NonValidatingSpecBase - { - public class GrandParentDTO - { - public ParentDTO Parent { get; set; } - } - public class ParentDTO - { - public ICollection Children { get; set; } - public ChildDTO Child { get; set; } - public DateTime DateTime { get; set; } - } - - public class ChildDTO - { - public ParentDTO Parent { get; set; } - public ChildDTO GrandChild { get; set; } - public int ID_ { get; set; } - public int? IDs { get; set; } - public int ID2 { get; set; } - } - - public class GrandParent - { - public Parent Parent { get; set; } - } - - public class Parent - { - public ICollection Children { get; set; } - - private Child _child; - public Child Child - { - get { return _child; } - set - { - _child = value; - _child.Parent = this; - } - } - public DateTime DateTime { get; set; } - } - - public class Child - { - private Parent _parent; - public Parent Parent - { - get { return _parent; } - set - { - _parent = value; - if (GrandChild != null) - GrandChild.Parent = _parent; - } - } - - public int ID { get; set; } - public Child GrandChild { get; set; } - public int IDs { get; set; } - public int? ID2 { get; set; } - } - - private Expression> _predicateExpression; - private Parent _valid; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ReverseMap(); - cfg.CreateMap().ReverseMap(); - cfg.CreateMap() - .ForMember(d => d.ID_, opt => opt.MapFrom(s => s.ID)) - .ReverseMap() - .ForMember(d => d.ID, opt => opt.MapFrom(s => s.ID_)); - }); - - public override void MainTeardown() - { - Should_Validate(); - base.MainTeardown(); - } - - private void Should_Validate() - { - var expression = Mapper.Map>>(_predicateExpression); - var items = new[] {_valid}.AsQueryable(); - items.Where(expression).ShouldContain(_valid); - var items2 = items.UseAsDataSource(Mapper).For().Where(_predicateExpression); - //var a = items2.ToList(); - items2.Count().ShouldEqual(1); - } - - [Fact] - public void GrandParent_Mapping_To_Sub_Sub_Property_Condition() - { - Expression> _predicateExpression = gp => gp.Parent.Children.Any(c => c.ID2 == 3); - var expression = Mapper.Map>>(_predicateExpression); - var items = new[] {new GrandParent(){Parent = new Parent(){Children = new[]{new Child(){ID2 = 3}}, Child = new Child(){ID2 = 3}}}}.AsQueryable(); - items.Where(expression).ShouldContain(items.First()); - var items2 = items.UseAsDataSource(Mapper).For().Where(_predicateExpression); - items2.Count().ShouldEqual(1); - When_Use_Outside_Class_Method_Call(); - } - - [Fact] - public void GrandParent_Mapping_To_Sub_Sub_Property_Condition2() - { - Expression, bool>> _predicateExpression = gps => gps.Any(gp => gp.Parent.Children.Any(c => c.ID_ == 3)); - Expression, IQueryable>> _predicateExpression2 = gps => gps.Where(gp => gp.Parent.Children.Any(c => c.ID_ == 3)); - var expression = Mapper.Map, bool>>>(_predicateExpression); - var expression2 = Mapper.Map, IQueryable>>>(_predicateExpression2); - When_Use_Outside_Class_Method_Call(); - } - - [Fact] - public void When_Use_Outside_Class_Method_Call() - { - var ids = new[] { 4, 5 }; - _predicateExpression = p => p.Children.Where((c, i) => c.ID_ > 4).Any(c => ids.Contains(c.ID_)); - _valid = new Parent { Children = new[] { new Child { ID = 5 } } }; - } - - [Fact] - public void When_Use_Property_From_Child_Property() - { - _predicateExpression = p => p.Child.ID_ > 4; - _valid = new Parent { Child= new Child { ID = 5 } }; - } - - [Fact] - public void When_Use_Null_Substitution_Mappings_Against_Constants() - { - _predicateExpression = p => p.Child.ID_ > 4; - _valid = new Parent { Child = new Child { ID = 5 } }; - } - - [Fact] - public void When_Use_Null_Substitution_Mappings_Against_Constants_Reverse_Order() - { - _predicateExpression = p => 4 < p.Child.ID_; - _valid = new Parent { Child = new Child { ID = 5 } }; - } - - [Fact] - public void When_Use_Reverse_Null_Substitution_Mappings_Against_Constants() - { - _predicateExpression = p => p.Child.ID2 > 4; - _valid = new Parent {Child = new Child {ID2 = 5}}; - } - - [Fact] - public void When_Use_Reverse_Null_Substitution_Mappings_Against_Constants_Reverse_Order() - { - _predicateExpression = p => 4 < p.Child.ID2; - _valid = new Parent { Child = new Child { ID2 = 5 } }; - } - - [Fact] - public void When_Use_Sub_Lambda_Statement() - { - _predicateExpression = p => p.Children.Any(c => c.ID_ > 4); - _valid = new Parent { Children = new[] { new Child { ID = 5 } } }; - } - - [Fact] - public void When_Use_Multiple_Parameter_Lambda_Statement() - { - _predicateExpression = p => p.Children.Any((c, i) => c.ID_ > 4); - _valid = new Parent { Children = new[] { new Child { ID = 5 } } }; - } - - [Fact] - public void When_Use_Lambda_Statement_With_TypeMapped_Property_Being_Other_Than_First() - { - _predicateExpression = p => p.Children.AnyParamReverse((c, c2) => c.ID_ > 4); - _valid = new Parent {Children = new[] {new Child {ID = 5}}}; - } - - [Fact] - public void When_Use_Child_TypeMap_In_Sub_Lambda_Statement() - { - _predicateExpression = p => p.Children.Any(c => c.GrandChild.GrandChild.ID_ == 4); - _valid = new Parent - { - Children = new[] - { - new Child {GrandChild = new Child {GrandChild = new Child {ID = 4}}} - } - }; - } - - [Fact] - public void When_Use_Parent_And_Child_Lambda_Parameters_In_Child_Lambda_Statement() - { - _predicateExpression = p => p.Children.Any(c => c.GrandChild.ID_ == p.Child.ID_); - _valid = new Parent - { - Child = new Child {ID = 4}, - Children = new[] {new Child {GrandChild = new Child {ID = 4}}} - }; - } - - [Fact] - public void When_Use_Lambdas_Where_Type_Matches_Parent_Object() - { - _predicateExpression = p => p.Child.Lambda(c => c.ID_ == 4); - _valid = new Parent {Child = new Child {ID = 4}}; - } - - [Fact] - public void When_Reusing_TypeMaps() - { - _predicateExpression = p => p.Child.Parent.Child.GrandChild.ID_ == 4; - _valid = new Parent {Child = new Child {GrandChild = new Child {ID = 4}}}; - } - - [Fact] - public void When_Using_Non_TypeMapped_Class_Property() - { - var year = DateTime.Now.Year; - _predicateExpression = p => p.DateTime.Year == year; - _valid = new Parent {DateTime = DateTime.Now}; - } - - [Fact] - public void When_Using_Non_TypeMapped_Class_Method() - { - var year = DateTime.Now.Year; - _predicateExpression = p => p.DateTime.Year.Equals(year); - _valid = new Parent { DateTime = DateTime.Now }; - } - - [Fact] - public void When_Using_Non_TypeMapped_Class_Property_Against_Constant() - { - _predicateExpression = p => p.DateTime.Year.ToString() == "2015"; - _valid = new Parent { DateTime = new DateTime(2015, 1, 1) }; - } - - [Fact] - public void When_Using_Non_TypeMapped_Class_Method_Against_Constant() - { - _predicateExpression = p => p.DateTime.Year.ToString().Equals("2015"); - _valid = new Parent { DateTime = new DateTime(2015, 1, 1) }; - } - - [Fact] - public void When_Using_Everything_At_Once() - { - var year = DateTime.Now.Year; - _predicateExpression = p => p.DateTime.Year == year && p.Child.Parent.Child.GrandChild.Parent.Child.GrandChild.GrandChild.ID_ == 4 && p.Children.Any(c => c.GrandChild.GrandChild.ID_ == 4); - _valid = new Parent { DateTime = DateTime.Now, Child = new Child { GrandChild = new Child { GrandChild = new Child { ID = 4 } } }, Children = new[] { new Child { GrandChild = new Child { GrandChild = new Child { ID = 4 } } } } }; - } - - [Fact] - public void When_Using_Static_Constants() - { - _predicateExpression = p => p.DateTime.Year.ToString() != string.Empty; - _valid = new Parent { DateTime = DateTime.Now }; - } - } - - - public class A : IQueryable - { - public IEnumerator GetEnumerator() - { - throw new NotImplementedException(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public Expression Expression { get; private set; } - public Type ElementType { get; private set; } - public IQueryProvider Provider { get; private set; } - } -} \ No newline at end of file diff --git a/src/UnitTests/Bug/ForAllMembersAndDoNotUseDestinationValue.cs b/src/UnitTests/Bug/ForAllMembersAndDoNotUseDestinationValue.cs index 40d3bc9bb8..3d44f040a9 100644 --- a/src/UnitTests/Bug/ForAllMembersAndDoNotUseDestinationValue.cs +++ b/src/UnitTests/Bug/ForAllMembersAndDoNotUseDestinationValue.cs @@ -1,10 +1,10 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug { - public class ForAllMembersAndDoNotUseDestinationValue : AutoMapperSpecBase + public class ForAllMembersAndResolveUsing : AutoMapperSpecBase { private Destination _destination; @@ -19,7 +19,7 @@ class Destination protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { - cfg.CreateMap().ForAllMembers(opt => opt.DoNotUseDestinationValue()); + cfg.CreateMap().ForAllMembers(opt => opt.MapFrom(s=>12)); }); protected override void Because_of() @@ -34,7 +34,7 @@ protected override void Because_of() [Fact] public void Should_work_together() { - _destination.Number.ShouldEqual(23); + _destination.Number.ShouldBe(12); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/GenericTypeConverter.cs b/src/UnitTests/Bug/GenericTypeConverter.cs index 3d4c35af5d..167c431c57 100644 --- a/src/UnitTests/Bug/GenericTypeConverter.cs +++ b/src/UnitTests/Bug/GenericTypeConverter.cs @@ -1,169 +1,169 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class GenericTypeConverterWithTwoArguments : AutoMapperSpecBase - { - List _destination; - - protected override MapperConfiguration Configuration => new MapperConfiguration(c=>c.CreateMap(typeof(List<>), typeof(List<>)).ConvertUsing(typeof(Converter<,>))); - - protected override void Because_of() - { - _destination = Mapper.Map, List>(Enumerable.Range(1, 10).ToList()); - } - - [Fact] - public void Should_work() - { - _destination.ShouldEqual(Converter.Result); - } - - public class Converter : ITypeConverter, List> - { - public static readonly List Result = new List(); - - public List Convert(List source, ResolutionContext context) - { - return Result; - } - } - } - - public class GenericTypeConverter : AutoMapperSpecBase - { - Destination _destination; - OtherDestination _otherDestination; - int _openGenericToNonGenericDestination; - Destination _nonGenericToOpenGenericDestination; - OtherDestination _closedGenericToOpenGenericDestination; - Destination _openGenericToClosedGenericDestination; - - public class Source - { - public T Value { get; set; } - } - - public class Destination - { - public T Value { get; set; } - } - - public class OtherSource - { - public T Value { get; set; } - } - - public class OtherDestination - { - public T Value { get; set; } - } - - public class Converter : - ITypeConverter, Destination>, - ITypeConverter, OtherDestination>, - ITypeConverter, int>, - ITypeConverter>, - ITypeConverter, Destination>, - ITypeConverter, OtherDestination> - { - public static Destination SomeDestination = new Destination(); - public static OtherDestination SomeOtherDestination = new OtherDestination(); - public static int NongenericDestination = default(int); - public static OtherDestination OpenDestinationViaClosedSource = new OtherDestination(); - public static Destination ClosedDestinationViaOpenSource = new Destination(); - - public Destination Convert(Source source, ResolutionContext context) - { - return SomeDestination; - } - - OtherDestination ITypeConverter, OtherDestination>.Convert(OtherSource source, ResolutionContext context) - { - return SomeOtherDestination; - } - - int ITypeConverter, int>.Convert(Source source, ResolutionContext context) - { - return NongenericDestination; - } - - Destination ITypeConverter>.Convert(int source, ResolutionContext context) - { - return SomeDestination; - } - - Destination ITypeConverter, Destination>.Convert(OtherSource source, ResolutionContext context) - { - return ClosedDestinationViaOpenSource; - } - - OtherDestination ITypeConverter, OtherDestination>.Convert(Source source, ResolutionContext context) - { - return OpenDestinationViaClosedSource; - } - } - - public class Converter : ITypeConverter> - - { - public static IReadOnlyDictionary ReadOnlyDictionaryDestination = new Dictionary(); - - public IReadOnlyDictionary Convert(Hashtable source, ResolutionContext context) - { - return ReadOnlyDictionaryDestination; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof (Source<>), typeof (Destination<>)).ConvertUsing(typeof (Converter<>)); - cfg.CreateMap(typeof (OtherSource<>), typeof (OtherDestination<>)).ConvertUsing(typeof (Converter<>)); - cfg.CreateMap(typeof (Source<>), typeof (int)).ConvertUsing(typeof (Converter<>)); - cfg.CreateMap(typeof (int), typeof (Destination<>)).ConvertUsing(typeof (Converter<>)); - cfg.CreateMap(typeof (OtherSource<>), typeof (Destination)).ConvertUsing(typeof (Converter<>)); - cfg.CreateMap(typeof (Source), typeof (OtherDestination<>)).ConvertUsing(typeof (Converter<>)); - - cfg.CreateMap(typeof (Hashtable), typeof (IReadOnlyDictionary<,>)).ConvertUsing(typeof (Converter<,>)); - }); - - protected override void Because_of() - { - _destination = Mapper.Map>(new Source()); - _otherDestination = Mapper.Map>(new OtherSource()); - _openGenericToNonGenericDestination = Mapper.Map(new Source()); - _nonGenericToOpenGenericDestination = Mapper.Map>(default(int)); - _openGenericToClosedGenericDestination = Mapper.Map>(new OtherSource()); - _closedGenericToOpenGenericDestination = Mapper.Map>(new Source()); - } - - [Fact] - public void Should_use_generic_converter_with_correct_interface() - { - _destination.ShouldBeSameAs(Converter.SomeDestination); - _otherDestination.ShouldBeSameAs(Converter.SomeOtherDestination); - _openGenericToNonGenericDestination.ShouldEqual(Converter.NongenericDestination); - _nonGenericToOpenGenericDestination.ShouldBeSameAs(Converter.SomeDestination); - _openGenericToClosedGenericDestination.ShouldEqual(Converter.ClosedDestinationViaOpenSource); - _closedGenericToOpenGenericDestination.ShouldEqual(Converter.OpenDestinationViaClosedSource); - } - - [Fact] - public void Should_use_generic_converter_when_covered_by_object_map() - { - Mapper.Map>(new Hashtable()).ShouldBeSameAs(Converter.ReadOnlyDictionaryDestination); - } - - [Fact] - public void Should_use_generic_converter_with_correct_closed_type() - { - Mapper.Map>(new Source()).ShouldBeSameAs(Converter.SomeDestination); - Mapper.Map>(new Source()).ShouldBeSameAs(Converter.SomeDestination); - } - } -} \ No newline at end of file +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class GenericTypeConverterWithTwoArguments : AutoMapperSpecBase + { + List _destination; + + protected override MapperConfiguration Configuration => new MapperConfiguration(c=>c.CreateMap(typeof(List<>), typeof(List<>)).ConvertUsing(typeof(Converter<,>))); + + protected override void Because_of() + { + _destination = Mapper.Map, List>(Enumerable.Range(1, 10).ToList()); + } + + [Fact] + public void Should_work() + { + _destination.ShouldBe(Converter.Result); + } + + public class Converter : ITypeConverter, List> + { + public static readonly List Result = new List(); + + public List Convert(List source, List destination, ResolutionContext context) + { + return Result; + } + } + } + + public class GenericTypeConverter : AutoMapperSpecBase + { + Destination _destination; + OtherDestination _otherDestination; + int _openGenericToNonGenericDestination; + Destination _nonGenericToOpenGenericDestination; + OtherDestination _closedGenericToOpenGenericDestination; + Destination _openGenericToClosedGenericDestination; + + public class Source + { + public T Value { get; set; } + } + + public class Destination + { + public T Value { get; set; } + } + + public class OtherSource + { + public T Value { get; set; } + } + + public class OtherDestination + { + public T Value { get; set; } + } + + public class Converter : + ITypeConverter, Destination>, + ITypeConverter, OtherDestination>, + ITypeConverter, int>, + ITypeConverter>, + ITypeConverter, Destination>, + ITypeConverter, OtherDestination> + { + public static Destination SomeDestination = new Destination(); + public static OtherDestination SomeOtherDestination = new OtherDestination(); + public static int NongenericDestination = default(int); + public static OtherDestination OpenDestinationViaClosedSource = new OtherDestination(); + public static Destination ClosedDestinationViaOpenSource = new Destination(); + + public Destination Convert(Source source, Destination dest, ResolutionContext context) + { + return SomeDestination; + } + + OtherDestination ITypeConverter, OtherDestination>.Convert(OtherSource source, OtherDestination dest, ResolutionContext context) + { + return SomeOtherDestination; + } + + int ITypeConverter, int>.Convert(Source source, int dest, ResolutionContext context) + { + return NongenericDestination; + } + + Destination ITypeConverter>.Convert(int source, Destination dest, ResolutionContext context) + { + return SomeDestination; + } + + Destination ITypeConverter, Destination>.Convert(OtherSource source, Destination dest, ResolutionContext context) + { + return ClosedDestinationViaOpenSource; + } + + OtherDestination ITypeConverter, OtherDestination>.Convert(Source source, OtherDestination dest, ResolutionContext context) + { + return OpenDestinationViaClosedSource; + } + } + + public class Converter : ITypeConverter> + + { + public static IReadOnlyDictionary ReadOnlyDictionaryDestination = new Dictionary(); + + public IReadOnlyDictionary Convert(Hashtable source, IReadOnlyDictionary dest, ResolutionContext context) + { + return ReadOnlyDictionaryDestination; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof (Source<>), typeof (Destination<>)).ConvertUsing(typeof (Converter<>)); + cfg.CreateMap(typeof (OtherSource<>), typeof (OtherDestination<>)).ConvertUsing(typeof (Converter<>)); + cfg.CreateMap(typeof (Source<>), typeof (int)).ConvertUsing(typeof (Converter<>)); + cfg.CreateMap(typeof (int), typeof (Destination<>)).ConvertUsing(typeof (Converter<>)); + cfg.CreateMap(typeof (OtherSource<>), typeof (Destination)).ConvertUsing(typeof (Converter<>)); + cfg.CreateMap(typeof (Source), typeof (OtherDestination<>)).ConvertUsing(typeof (Converter<>)); + + cfg.CreateMap(typeof (Hashtable), typeof (IReadOnlyDictionary<,>)).ConvertUsing(typeof (Converter<,>)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map>(new Source()); + _otherDestination = Mapper.Map>(new OtherSource()); + _openGenericToNonGenericDestination = Mapper.Map(new Source()); + _nonGenericToOpenGenericDestination = Mapper.Map>(default(int)); + _openGenericToClosedGenericDestination = Mapper.Map>(new OtherSource()); + _closedGenericToOpenGenericDestination = Mapper.Map>(new Source()); + } + + [Fact] + public void Should_use_generic_converter_with_correct_interface() + { + _destination.ShouldBeSameAs(Converter.SomeDestination); + _otherDestination.ShouldBeSameAs(Converter.SomeOtherDestination); + _openGenericToNonGenericDestination.ShouldBe(Converter.NongenericDestination); + _nonGenericToOpenGenericDestination.ShouldBeSameAs(Converter.SomeDestination); + _openGenericToClosedGenericDestination.ShouldBe(Converter.ClosedDestinationViaOpenSource); + _closedGenericToOpenGenericDestination.ShouldBe(Converter.OpenDestinationViaClosedSource); + } + + [Fact] + public void Should_use_generic_converter_when_covered_by_object_map() + { + Mapper.Map>(new Hashtable()).ShouldBeSameAs(Converter.ReadOnlyDictionaryDestination); + } + + [Fact] + public void Should_use_generic_converter_with_correct_closed_type() + { + Mapper.Map>(new Source()).ShouldBeSameAs(Converter.SomeDestination); + Mapper.Map>(new Source()).ShouldBeSameAs(Converter.SomeDestination); + } + } +} diff --git a/src/UnitTests/Bug/GuidTryExpression.cs b/src/UnitTests/Bug/GuidTryExpression.cs new file mode 100644 index 0000000000..5b5627dbd8 --- /dev/null +++ b/src/UnitTests/Bug/GuidTryExpression.cs @@ -0,0 +1,41 @@ +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests.Bug +{ + public class GuidTryExpression : AutoMapperSpecBase + { + private Destination _destination; + private Guid _value = Guid.NewGuid(); + + class Source + { + public Guid Value { get; set; } + } + class Destination + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.Value, o => o.MapFrom(s => s.Value)); + }); + + protected override void Because_of() + { + var source = new Source + { + Value = _value + }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_int_to_nullable_decimal() + { + _destination.Value.ShouldBe(_value.ToString()); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/IgnoreAll.cs b/src/UnitTests/Bug/IgnoreAll.cs index f609310a6d..05a3b391a2 100644 --- a/src/UnitTests/Bug/IgnoreAll.cs +++ b/src/UnitTests/Bug/IgnoreAll.cs @@ -1,83 +1,74 @@ -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - using Should; - - public class When_configuring_all_members_and_some_do_not_match - { - public class ModelObjectNotMatching - { - public string Foo_notfound { get; set; } - public string Bar_notfound; - } - - public class ModelDto - { - public string Foo { get; set; } - public string Bar; - } - - public When_configuring_all_members_and_some_do_not_match() - { - SetUp(); - } - public void SetUp() - { - - } - - [Fact] - public void Should_still_apply_configuration_to_missing_members() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForAllMembers(opt => opt.Ignore())); - config.AssertConfigurationIsValid(); - } - } - - public class When_configuring_all_non_source_value_null_members : NonValidatingSpecBase - { - private Dest _destination; - - public class Source - { - public string Value1 { get; set; } - public int? Value2 { get; set; } - } - - public class Dest - { - public string Value1 { get; set; } - public int? Value2 { get; set; } - public string Unmapped { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForAllMembers(opt => opt.Condition((src, dest, srcVal, destVal, c) => srcVal != null)); - }); - - protected override void Because_of() - { - var source = new Source(); - _destination = new Dest - { - Value1 = "Foo", - Value2 = 10, - Unmapped = "Asdf" - }; - Mapper.Map(source, _destination); - } - - [Fact] - public void Should_only_apply_source_value_when_not_null() - { - _destination.Value1.ShouldNotBeNull(); - _destination.Value2.ShouldNotEqual(null); - _destination.Unmapped.ShouldNotBeNull(); - } - } - +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + using Shouldly; + + public class When_configuring_all_members_and_some_do_not_match + { + public class ModelObjectNotMatching + { + public string Foo_notfound { get; set; } + public string Bar_notfound; + } + + public class ModelDto + { + public string Foo { get; set; } + public string Bar; + } + + [Fact] + public void Should_still_apply_configuration_to_missing_members() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForAllMembers(opt => opt.Ignore())); + config.AssertConfigurationIsValid(); + } + } + + public class When_configuring_all_non_source_value_null_members : NonValidatingSpecBase + { + private Dest _destination; + + public class Source + { + public string Value1 { get; set; } + public int? Value2 { get; set; } + } + + public class Dest + { + public string Value1 { get; set; } + public int? Value2 { get; set; } + public string Unmapped { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForAllMembers(opt => opt.Condition((src, dest, srcVal, destVal, c) => srcVal != null)); + }); + + protected override void Because_of() + { + var source = new Source(); + _destination = new Dest + { + Value1 = "Foo", + Value2 = 10, + Unmapped = "Asdf" + }; + Mapper.Map(source, _destination); + } + + [Fact] + public void Should_only_apply_source_value_when_not_null() + { + _destination.Value1.ShouldNotBeNull(); + _destination.Value2.ShouldNotBe(null); + _destination.Unmapped.ShouldNotBeNull(); + } + } + } \ No newline at end of file diff --git a/src/UnitTests/Bug/IncludeBaseInheritance.cs b/src/UnitTests/Bug/IncludeBaseInheritance.cs index 0c36e7e953..f8f4a8de43 100644 --- a/src/UnitTests/Bug/IncludeBaseInheritance.cs +++ b/src/UnitTests/Bug/IncludeBaseInheritance.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -42,15 +42,15 @@ public class DestinationLevel2 : DestinationLevel1 protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() - .ForMember(dest => dest.DPropertyLevel0, o => o.ResolveUsing(src => src.SPropertyLevel0)); + .ForMember(dest => dest.DPropertyLevel0, o => o.MapFrom(src => src.SPropertyLevel0)); cfg.CreateMap() .IncludeBase() - .ForMember(dest => dest.DPropertyLevel1, o => o.ResolveUsing(src => src.SPropertyLevel1)); + .ForMember(dest => dest.DPropertyLevel1, o => o.MapFrom(src => src.SPropertyLevel1)); cfg.CreateMap() .IncludeBase() - .ForMember(dest => dest.DPropertyLevel2, o => o.ResolveUsing(src => src.SPropertyLevel2)); + .ForMember(dest => dest.DPropertyLevel2, o => o.MapFrom(src => src.SPropertyLevel2)); }); protected override void Because_of() @@ -68,7 +68,7 @@ protected override void Because_of() [Fact] public void Should_inherit_resolvers() { - _destination.DPropertyLevel0.ShouldEqual("SPropertyLevel0"); + _destination.DPropertyLevel0.ShouldBe("SPropertyLevel0"); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/IncludeInheritance.cs b/src/UnitTests/Bug/IncludeInheritance.cs index 9dbd8ab0c9..81433407ed 100644 --- a/src/UnitTests/Bug/IncludeInheritance.cs +++ b/src/UnitTests/Bug/IncludeInheritance.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -43,14 +43,14 @@ public class DestinationLevel2 : DestinationLevel1 { cfg.CreateMap() .Include() - .ForMember(dest => dest.DPropertyLevel0, o => o.ResolveUsing(src => src.SPropertyLevel0)); + .ForMember(dest => dest.DPropertyLevel0, o => o.MapFrom(src => src.SPropertyLevel0)); cfg.CreateMap() .Include() - .ForMember(dest => dest.DPropertyLevel1, o => o.ResolveUsing(src => src.SPropertyLevel1)); + .ForMember(dest => dest.DPropertyLevel1, o => o.MapFrom(src => src.SPropertyLevel1)); cfg.CreateMap() - .ForMember(dest => dest.DPropertyLevel2, o => o.ResolveUsing(src => src.SPropertyLevel2)); + .ForMember(dest => dest.DPropertyLevel2, o => o.MapFrom(src => src.SPropertyLevel2)); }); protected override void Because_of() @@ -68,7 +68,7 @@ protected override void Because_of() [Fact] public void Should_inherit_resolvers() { - _destination.DPropertyLevel0.ShouldEqual("SPropertyLevel0"); + _destination.DPropertyLevel0.ShouldBe("SPropertyLevel0"); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/InheritanceIssue.cs b/src/UnitTests/Bug/InheritanceIssue.cs deleted file mode 100644 index 3a921a9228..0000000000 --- a/src/UnitTests/Bug/InheritanceIssue.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Linq; -using System.Text; -using AutoMapper; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - - namespace EntityTest1 - { - #region Dto objects - public abstract class DynamicPropertyDTO - { - } - - public class ComplexPropertyDTO : DynamicPropertyDTO - { - public Dictionary Properties { get; set; } - - public ComplexPropertyDTO() - { - this.Properties = new Dictionary(); - } - } - - public class ComponentContainerDTO - { - public Dictionary Components - { - get; - set; - } - - public ComponentContainerDTO() - { - this.Components = new Dictionary(); - } - } - - public class EntityDTO : ComponentContainerDTO - { - public int Id { get; set; } - - } - - public class ComponentDTO : ComplexPropertyDTO - { - public EntityDTO Owner { get; set; } - public int Id { get; set; } - public string Name { get; set; } - - } - - public class HealthDTO : ComponentDTO - { - public decimal CurrentHealth { get; set; } - - } - - public class PhysicalLocationDTO : ComponentDTO - { - public Point2D Location { get; set; } - } - #endregion - - - #region Domain objects - public abstract class DynamicProperty : INotifyPropertyChanged - { - public abstract event PropertyChangedEventHandler PropertyChanged; - } - - public class ComplexProperty : DynamicProperty - { - public Dictionary Properties { get; set; } - - #pragma warning disable 67 - public override event PropertyChangedEventHandler PropertyChanged; - - public ComplexProperty() - { - this.Properties = new Dictionary(); - } - } - - public class SimpleProperty : DynamicProperty - { - #pragma warning disable 67 - public override event PropertyChangedEventHandler PropertyChanged; - } - - public class ComponentContainer - { - public Dictionary Components { get; set; } - - public ComponentContainer() - { - this.Components = new Dictionary(); - } - } - - public class Entity : ComponentContainer - { - public int Id { get; set; } - - } - - public class Component : ComplexProperty - { - public Entity Owner { get; set; } - public int Id { get; set; } - public string Name { get; set; } - - } - - public class Health : Component - { - public decimal CurrentHealth { get; set; } - } - - public struct Point2D - { - public decimal X; - public decimal Y; - - public Point2D(decimal x, decimal y) - { - X = x; - Y = y; - } - } - - public class PhysicalLocation : Component - { - public Point2D Location { get; set; } - } - #endregion - - class Program - { - static void Main(string[] args) - { - var entity = new Entity() { Id = 1 }; - var healthComponent = new Health() - { - CurrentHealth = 100, - Owner = entity, - Name = "Health", - Id = 2 - }; - entity.Components.Add("1", healthComponent); - var locationComponent = new PhysicalLocation() - { - Location - = new Point2D() { X = 1, Y = 2 }, - Owner = entity, - Name = - "PhysicalLocation", - Id = 3 - }; - entity.Components.Add("2", locationComponent); - - var config = new MapperConfiguration(cfg => - { - - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - - cfg.CreateMap() - .Include() - .Include(); - - cfg.CreateMap(); - cfg.CreateMap(); - }); - - config.AssertConfigurationIsValid(); - - EntityDTO targetEntity = config.CreateMapper().Map(entity); - - targetEntity.Components.Count.ShouldEqual(2); - - targetEntity.Components.Last().Value.Name.ShouldEqual("PhysicalLocation"); - - targetEntity.Components.First().Value.ShouldBeType(); - - targetEntity.Components.Last().Value.ShouldBeType(); - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Bug/InitializeNRE.cs b/src/UnitTests/Bug/InitializeNRE.cs new file mode 100644 index 0000000000..d3638d44ba --- /dev/null +++ b/src/UnitTests/Bug/InitializeNRE.cs @@ -0,0 +1,64 @@ +using Xunit; +using Shouldly; +using System; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class InitializeNRE2 : AutoMapperSpecBase + { + public interface IRes : IValueResolver + { + } + + public class Res : IRes + { + public int Resolve(Source source, Destination destination, int destMember, ResolutionContext context) + { + return 1000; + } + } + + public class Source + { + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.ConstructServicesUsing(t => new Res()); + cfg.CreateMap().ForMember(d => d.Value, o => o.MapFrom()); + }); + } + + + public class InitializeNRE : AutoMapperSpecBase + { + public class TestEntity + { + public string SomeData { get; set; } + + public int SomeCount { get; set; } + + public ICollection Tags { get; set; } + } + + public class TestViewModel + { + public string SomeData { get; set; } + + public int SomeCount { get; set; } + + public string Tags { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/IntToNullableDecimal.cs b/src/UnitTests/Bug/IntToNullableDecimal.cs index 560310c1ed..d01af8949d 100644 --- a/src/UnitTests/Bug/IntToNullableDecimal.cs +++ b/src/UnitTests/Bug/IntToNullableDecimal.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -34,7 +34,7 @@ protected override void Because_of() [Fact] public void Should_map_int_to_nullable_decimal() { - _destination.Number.ShouldEqual(23); + _destination.Number.ShouldBe(23); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/InterfaceMultipleInheritance.cs b/src/UnitTests/Bug/InterfaceMultipleInheritance.cs index 3e485e5630..bd305e9cfe 100644 --- a/src/UnitTests/Bug/InterfaceMultipleInheritance.cs +++ b/src/UnitTests/Bug/InterfaceMultipleInheritance.cs @@ -1,5 +1,5 @@ using System; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -35,12 +35,12 @@ public interface IMapFromElementDerivedBoth : IMapFromElementDerived1, IMapFromE public interface IMapToElementWritable { - new string Prop { get; set; } + string Prop { get; set; } } public interface IMapToElementWritableDerived : IMapToElementWritable { - new string Prop2 { get; set; } + string Prop2 { get; set; } } public class MapFrom : IMapFrom @@ -56,7 +56,7 @@ public class MapFromElement : IMapFromElement public class MapFromElementDerived : MapFromElement, IMapFromElementDerivedBoth { - public string Prop { get; set; } + public new string Prop { get; set; } public string Prop2 { get; set; } } @@ -100,7 +100,7 @@ protected override void Because_of() public void Should_Map_UsingDerivedInterface() { var element = (IMapToElementWritableDerived)_destination.Element; - element.Prop2.ShouldEqual("PROP2"); + element.Prop2.ShouldBe("PROP2"); } } @@ -215,7 +215,7 @@ protected override void Because_of() [Fact] public void Should_Map_UsingDerivedInterface() { - _destination.prop4.ShouldEqual("PROP4"); + _destination.prop4.ShouldBe("PROP4"); } } } diff --git a/src/UnitTests/Bug/InterfaceSelfMappingBug.cs b/src/UnitTests/Bug/InterfaceSelfMappingBug.cs index 39ec3a37bd..0b95848b26 100644 --- a/src/UnitTests/Bug/InterfaceSelfMappingBug.cs +++ b/src/UnitTests/Bug/InterfaceSelfMappingBug.cs @@ -1,47 +1,47 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class InterfaceSelfMappingBug - { - public interface IFoo - { - int Value { get; set; } - } - - public class Bar : IFoo - { - public int Value { get; set; } - } - - public class Baz : IFoo - { - public int Value { get; set; } - } - - [Fact] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.AllowNullCollections = true; - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - - IFoo bar = new Bar - { - Value = 5 - }; - IFoo baz = new Baz - { - Value = 10 - }; - - config.CreateMapper().Map(bar, baz); - - baz.Value.ShouldEqual(5); - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class InterfaceSelfMappingBug + { + public interface IFoo + { + int Value { get; set; } + } + + public class Bar : IFoo + { + public int Value { get; set; } + } + + public class Baz : IFoo + { + public int Value { get; set; } + } + + [Fact] + public void Example() + { + var config = new MapperConfiguration(cfg => + { + cfg.AllowNullCollections = true; + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + + IFoo bar = new Bar + { + Value = 5 + }; + IFoo baz = new Baz + { + Value = 10 + }; + + config.CreateMapper().Map(bar, baz); + + baz.Value.ShouldBe(5); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/InternalProperties.cs b/src/UnitTests/Bug/InternalProperties.cs index dfdde71220..985779c97f 100644 --- a/src/UnitTests/Bug/InternalProperties.cs +++ b/src/UnitTests/Bug/InternalProperties.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -32,7 +32,7 @@ protected override void Because_of() [Fact] public void Should_map_internal_property() { - _destination.Number.ShouldEqual(SomeValue); + _destination.Number.ShouldBe(SomeValue); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/JsonNet.cs b/src/UnitTests/Bug/JsonNet.cs index a3c53be15b..d25d96acbe 100644 --- a/src/UnitTests/Bug/JsonNet.cs +++ b/src/UnitTests/Bug/JsonNet.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using System.Linq; using System.Collections; @@ -36,7 +36,7 @@ class Destination protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() - .ForMember(d => d.Json, o => o.ResolveUsing(s => new JObject(s.JsonString))); + .ForMember(d => d.Json, o => o.MapFrom(s => new JObject(s.JsonString))); }); protected override void Because_of() @@ -52,10 +52,143 @@ protected override void Because_of() public void Should_map_dictionary_with_non_KeyValuePair_enumerable() { var json = (JObject)_destination.Json; - json.Count.ShouldEqual(3); - json["1"].ShouldEqual("one"); - json["2"].ShouldEqual("two"); - json["3"].ShouldEqual("three"); + json.Count.ShouldBe(3); + json["1"].ShouldBe("one"); + json["2"].ShouldBe("two"); + json["3"].ShouldBe("three"); } } + + public class JObjectField : AutoMapperSpecBase + { + class JContainer : IEnumerable + { + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)this).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return (IEnumerator)new[] { DBNull.Value }.GetEnumerator(); + } + } + + class JObject : JContainer, IDictionary + { + public JObject() + { + } + + public string this[string key] + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + public int Count + { + get + { + throw new NotImplementedException(); + } + } + + public bool IsReadOnly + { + get + { + throw new NotImplementedException(); + } + } + + public ICollection Keys + { + get + { + throw new NotImplementedException(); + } + } + + public ICollection Values + { + get + { + throw new NotImplementedException(); + } + } + + public void Add(StringKeyValuePair item) + { + throw new NotImplementedException(); + } + + public void Add(string key, string value) + { + throw new NotImplementedException(); + } + + public void Clear() + { + throw new NotImplementedException(); + } + + public bool Contains(StringKeyValuePair item) + { + throw new NotImplementedException(); + } + + public bool ContainsKey(string key) + { + throw new NotImplementedException(); + } + + public void CopyTo(StringKeyValuePair[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + public IEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } + + public bool Remove(StringKeyValuePair item) + { + throw new NotImplementedException(); + } + + public bool Remove(string key) + { + throw new NotImplementedException(); + } + + public bool TryGetValue(string key, out string value) + { + throw new NotImplementedException(); + } + } + + class Source + { + public JObject Json { get; set; } + } + + class Destination + { + public JObject Json { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/LazyCollectionMapping.cs b/src/UnitTests/Bug/LazyCollectionMapping.cs index 990d259d20..1760cc419d 100644 --- a/src/UnitTests/Bug/LazyCollectionMapping.cs +++ b/src/UnitTests/Bug/LazyCollectionMapping.cs @@ -1,82 +1,73 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class LazyCollectionMapping - { - public LazyCollectionMapping() - { - SetUp(); - } - public void SetUp() - { - - } - - public class OneTimeEnumerator : IEnumerable - { - private readonly IEnumerable inner; - - public OneTimeEnumerator(IEnumerable inner) - { - this.inner = inner; - } - - private bool isEnumerated; - - public IEnumerator GetEnumerator() - { - if (isEnumerated) - throw new NotSupportedException(); - isEnumerated = true; - return inner.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } - - public class Source - { - public IEnumerable Collection { get; set; } - } - - public class Destination - { - public IEnumerable Collection { get; set; } - } - - [Fact] - public void OneTimeEnumerator_should_throw_exception_if_enumerating_twice() - { - IEnumerable enumerable = Create(new[] {"one", "two", "three"}); - - enumerable.Count().ShouldEqual(3); - - typeof (NotSupportedException).ShouldBeThrownBy(() => enumerable.Count()); - } - - [Fact] - public void Should_not_enumerate_twice() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var source = new Source {Collection = Create(new[] {"one", "two", "three"})}; - var enumerable = config.CreateMapper().Map(source, new Destination()); - - enumerable.Collection.Count().ShouldEqual(3); - } - - public static IEnumerable Create(IEnumerable inner) - { - return new OneTimeEnumerator(inner); - } - } +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class LazyCollectionMapping + { + public class OneTimeEnumerator : IEnumerable + { + private readonly IEnumerable inner; + + public OneTimeEnumerator(IEnumerable inner) + { + this.inner = inner; + } + + private bool isEnumerated; + + public IEnumerator GetEnumerator() + { + if (isEnumerated) + throw new NotSupportedException(); + isEnumerated = true; + return inner.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } + + public class Source + { + public IEnumerable Collection { get; set; } + } + + public class Destination + { + public IEnumerable Collection { get; set; } + } + + [Fact] + public void OneTimeEnumerator_should_throw_exception_if_enumerating_twice() + { + IEnumerable enumerable = Create(new[] {"one", "two", "three"}); + + enumerable.Count().ShouldBe(3); + + typeof (NotSupportedException).ShouldBeThrownBy(() => enumerable.Count()); + } + + [Fact] + public void Should_not_enumerate_twice() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var source = new Source {Collection = Create(new[] {"one", "two", "three"})}; + var enumerable = config.CreateMapper().Map(source, new Destination()); + + enumerable.Collection.Count().ShouldBe(3); + } + + public static IEnumerable Create(IEnumerable inner) + { + return new OneTimeEnumerator(inner); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ListSourceMapperBug.cs b/src/UnitTests/Bug/ListSourceMapperBug.cs index ba9668b681..2456a47602 100644 --- a/src/UnitTests/Bug/ListSourceMapperBug.cs +++ b/src/UnitTests/Bug/ListSourceMapperBug.cs @@ -1,46 +1,46 @@ -namespace AutoMapper.UnitTests.Bug -{ - using System; - using System.Collections; - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Linq; - using Should; - using Xunit; - - public class ListSourceMapperBug - { - public class CustomCollection : Collection, IListSource - { - public IList GetList() - { - return new ReadOnlyCollection(this.ToList()); - } - - public bool ContainsListCollection - { - get { return true; } - } - } - - public class Source - { - } - - public class Dest - { - } - - [Fact] - public void CustomListSourceShouldNotBlowUp() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var source = new CustomCollection {new Source()}; - - var dests = config.CreateMapper().Map, CustomCollection>(source); - - dests.Count.ShouldEqual(1); - } - } +namespace AutoMapper.UnitTests.Bug +{ + using System; + using System.Collections; + using System.Collections.ObjectModel; + using System.ComponentModel; + using System.Linq; + using Shouldly; + using Xunit; + + public class ListSourceMapperBug + { + public class CustomCollection : Collection, IListSource + { + public IList GetList() + { + return new ReadOnlyCollection(this.ToList()); + } + + public bool ContainsListCollection + { + get { return true; } + } + } + + public class Source + { + } + + public class Dest + { + } + + [Fact] + public void CustomListSourceShouldNotBlowUp() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var source = new CustomCollection {new Source()}; + + var dests = config.CreateMapper().Map, CustomCollection>(source); + + dests.Count.ShouldBe(1); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/MapAtRuntime/BaseEntity.cs b/src/UnitTests/Bug/MapAtRuntime/BaseEntity.cs new file mode 100644 index 0000000000..5e9eb334ee --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/BaseEntity.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class BaseEntity + { + public Guid Id { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/BaseEntityDTO.cs b/src/UnitTests/Bug/MapAtRuntime/BaseEntityDTO.cs new file mode 100644 index 0000000000..d3f363d7f3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/BaseEntityDTO.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class BaseEntity + { + public Guid Id { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity1.cs b/src/UnitTests/Bug/MapAtRuntime/Entity1.cs new file mode 100644 index 0000000000..bd5efc24fa --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity1.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity1 : BaseEntity + { + public Entity1() + { + this.Entities2 = new Entity2(); + } + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid? Entity22Id { get; set; } + public Entity22 Entity22 { get; set; } + public Guid? Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + public Guid? Entity12Id { get; set; } + public Entity12 Entity12 { get; set; } + public Guid Entity14Id { get; set; } + public Entity14 Entity14 { get; set; } + public Guid Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + public Entity2 Entities2 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity10.cs b/src/UnitTests/Bug/MapAtRuntime/Entity10.cs new file mode 100644 index 0000000000..a3afeb80da --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity10.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace OmmitedDatabaseModel3 +{ + public class Entity10 : BaseEntity + { + public Entity10() + { + this.Entities11 = new Entity11(); + } + public Entity11 Entities11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity11.cs b/src/UnitTests/Bug/MapAtRuntime/Entity11.cs new file mode 100644 index 0000000000..e3f332794f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity11.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity11 : BaseEntity + { + public Entity11() + { + this.Entities10 = new Entity10(); + this.Entities8 = new Entity8(); + } + public Entity10 Entities10 { get; set; } + public Entity8 Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity12.cs b/src/UnitTests/Bug/MapAtRuntime/Entity12.cs new file mode 100644 index 0000000000..f536dd4245 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity12.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity12 : BaseEntity + { + public Entity12() + { + //this.Entities20 = new Entity20(); + //this.Entities14 = new Entity14(); + //this.Entities16 = new Entity16(); + } + public Entity20 Entities20 { get; set; } + public Entity16 Entities16 { get; set; } + public Entity14 Entities14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity13.cs b/src/UnitTests/Bug/MapAtRuntime/Entity13.cs new file mode 100644 index 0000000000..ae8a6cb6c9 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity13.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity13 : BaseEntity + { + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity14.cs b/src/UnitTests/Bug/MapAtRuntime/Entity14.cs new file mode 100644 index 0000000000..9bbc83f5fd --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity14.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity14 : BaseEntity + { + public Entity14() + { + this.Entities12 = new Entity12(); + this.Entities1 = new Entity1(); + } + + public Entity12 Entities12 { get; set; } + public Entity1 Entities1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity15.cs b/src/UnitTests/Bug/MapAtRuntime/Entity15.cs new file mode 100644 index 0000000000..408f6b5047 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity15.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity15 : BaseEntity + { + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity16.cs b/src/UnitTests/Bug/MapAtRuntime/Entity16.cs new file mode 100644 index 0000000000..df5dbb4bb7 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity16.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity16 : BaseEntity + { + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + public Guid Entity12Id { get; set; } + public Entity12 Entity12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity17.cs b/src/UnitTests/Bug/MapAtRuntime/Entity17.cs new file mode 100644 index 0000000000..176e524caa --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity17.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity17 :BaseEntity + { + public Entity17() + { + //this.Entities20 = new Entity20(); + this.Entities8 = new Entity8(); + this.Entities5 = new Entity5(); + this.Entities18 = new Entity18(); + } + + public Entity20 Entities20 { get; set; } + public Entity8 Entities8 { get; set; } + public Entity5 Entities5 { get; set; } + public Entity18 Entities18 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity18.cs b/src/UnitTests/Bug/MapAtRuntime/Entity18.cs new file mode 100644 index 0000000000..ca61ff7162 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity18.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDatabaseModel3 +{ + public class Entity18 : BaseEntity + { + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity19.cs b/src/UnitTests/Bug/MapAtRuntime/Entity19.cs new file mode 100644 index 0000000000..05bcf24345 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity19.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3 +{ + public class Entity19 : BaseEntity + { + public Guid Entity25Id { get; set; } + public Entity25 Entity25 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity2.cs b/src/UnitTests/Bug/MapAtRuntime/Entity2.cs new file mode 100644 index 0000000000..247108a0f9 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity2.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3 +{ + public class Entity2 : BaseEntity + { + public Guid Entity1Id { get; set; } + public Entity1 Entity1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity20.cs b/src/UnitTests/Bug/MapAtRuntime/Entity20.cs new file mode 100644 index 0000000000..fbb7b4e06d --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity20.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity20 : BaseEntity + { + public Entity20() + { + //this.Entities8 = new Entity8(); + //this.Entities26 = new Entity26(); + //this.Entities12 = new Entity12(); + //this.Entities17 = new Entity17(); + //this.Entities21 = new Entity21(); + //this.Entities16 = new Entity16(); + } + + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public Entity22 Entity22 { get; set; } + public Entity8 Entities8 { get; set; } + public Entity26 Entities26 { get; set; } + public Entity12 Entities12 { get; set; } + public Entity17 Entities17 { get; set; } + public Entity21 Entities21 { get; set; } + public Entity16 Entities16 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity21.cs b/src/UnitTests/Bug/MapAtRuntime/Entity21.cs new file mode 100644 index 0000000000..2b28082108 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity21.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3 +{ + public class Entity21 : BaseEntity + { + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity22.cs b/src/UnitTests/Bug/MapAtRuntime/Entity22.cs new file mode 100644 index 0000000000..d0f90a2a6b --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity22.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity22 : BaseEntity + { + public Entity22() + { + this.Entities20 = new Entity20(); + this.Entities24 = new Entity24(); + } + public Entity20 Entities20 { get; set; } + public Entity24 Entities24 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity23.cs b/src/UnitTests/Bug/MapAtRuntime/Entity23.cs new file mode 100644 index 0000000000..63d004623f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity23.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity23 : BaseEntity + { + public Guid Entity5Id { get; set; } + public Entity5 Entity5 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity24.cs b/src/UnitTests/Bug/MapAtRuntime/Entity24.cs new file mode 100644 index 0000000000..d3072a6912 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity24.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity24 : BaseEntity + { + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public Entity22 Entity22 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity25.cs b/src/UnitTests/Bug/MapAtRuntime/Entity25.cs new file mode 100644 index 0000000000..8840d2d66a --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity25.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity25 : BaseEntity + { + public Entity25() + { + this.Entities19 = new Entity19(); + } + + public Entity19 Entities19 { get; set; } + public Guid? Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity26.cs b/src/UnitTests/Bug/MapAtRuntime/Entity26.cs new file mode 100644 index 0000000000..ad2ded07b3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity26.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity26 : BaseEntity + { + public Entity26() + { + //this.Entities20 = new Entity20(); + } + + public Entity20 Entities20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity3.cs b/src/UnitTests/Bug/MapAtRuntime/Entity3.cs new file mode 100644 index 0000000000..f751a3ee63 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity3.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity3 : BaseEntity + { + public Entity3() + { + this.Entities4 = new Entity4(); + this.Entities8 = new Entity8(); + } + public Entity4 Entities4 { get; set; } + public Entity8 Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity4.cs b/src/UnitTests/Bug/MapAtRuntime/Entity4.cs new file mode 100644 index 0000000000..eb1c8a847e --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity4.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity4 : BaseEntity + { + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity5.cs b/src/UnitTests/Bug/MapAtRuntime/Entity5.cs new file mode 100644 index 0000000000..faf98014c5 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity5.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity5 : BaseEntity + { + public Entity5() + { + //this.Entities6 = new Entity6(); + //this.TimeSlots = new Entity23(); + //this.Entities5 = new Entity5(); + } + + public Guid? Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid? Entity5Id { get; set; } + public Entity5 Entity5Exception { get; set; } + public Entity5 Entities5 { get; set; } + public Entity6 Entities6 { get; set; } + public Entity23 TimeSlots { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity6.cs b/src/UnitTests/Bug/MapAtRuntime/Entity6.cs new file mode 100644 index 0000000000..b4fc4dd03c --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity6.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity6 : BaseEntity + { + public Entity6() + { + this.Entities12 = new Entity12(); + } + + public Guid Entity5Id { get; set; } + public Entity5 Entity5 { get; set; } + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + public Entity12 Entities12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity7.cs b/src/UnitTests/Bug/MapAtRuntime/Entity7.cs new file mode 100644 index 0000000000..71e035d3bf --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity7.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDatabaseModel3 +{ + public class Entity7 : BaseEntity + { + public Guid Entity25Id { get; set; } + public Entity25 Entity25 { get; set; } + public Guid? Entity14Id { get; set; } + public Entity14 Entity14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity8.cs b/src/UnitTests/Bug/MapAtRuntime/Entity8.cs new file mode 100644 index 0000000000..e047d6e68f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity8.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3 +{ + public class Entity8 : BaseEntity + { + public Entity8() + { + //this.Entities20 = new Entity20(); + //this.Entities22 = new Entity22(); + //this.Entities3 = new Entity3(); + //this.Entities11 = new Entity11(); + //this.Entities17 = new Entity17(); + } + + public Entity20 Entities20 { get; set; } + public Entity17 Entities17 { get; set; } + public Entity22 Entities22 { get; set; } + public Entity3 Entities3 { get; set; } + public Entity11 Entities11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/Entity9.cs b/src/UnitTests/Bug/MapAtRuntime/Entity9.cs new file mode 100644 index 0000000000..d2f6404df3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/Entity9.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3 +{ + public class Entity9 : BaseEntity + { + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO1.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO1.cs new file mode 100644 index 0000000000..74373f4be1 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO1.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO1 : BaseEntity + { + public EntityDTO1() + { + this.Entities2 = new EntityDTO2(); + } + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid? Entity22Id { get; set; } + public EntityDTO22 Entity22 { get; set; } + public Guid? Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + public Guid? Entity12Id { get; set; } + public EntityDTO12 Entity12 { get; set; } + public Guid Entity14Id { get; set; } + public EntityDTO14 Entity14 { get; set; } + public Guid Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + public EntityDTO2 Entities2 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO10.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO10.cs new file mode 100644 index 0000000000..d88657af4c --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO10.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO10 : BaseEntity + { + public EntityDTO10() + { + this.Entities11 = new EntityDTO11(); + } + public EntityDTO11 Entities11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO11.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO11.cs new file mode 100644 index 0000000000..5aa07559e9 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO11.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO11 : BaseEntity + { + public EntityDTO11() + { + //this.Entities10 = new EntityDTO10(); + //this.Entities8 = new EntityDTO8(); + } + public EntityDTO10 Entities10 { get; set; } + public EntityDTO8 Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO12.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO12.cs new file mode 100644 index 0000000000..94c6cea25a --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO12.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO12 : BaseEntity + { + public EntityDTO12() + { + //this.Entities20 = new EntityDTO20(); + //this.Entities14 = new EntityDTO14(); + //Entities16 = new EntityDTO16(); + } + public EntityDTO20 Entities20 { get; set; } + public EntityDTO16 Entities16 { get; set; } + public EntityDTO14 Entities14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO13.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO13.cs new file mode 100644 index 0000000000..0072308d9d --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO13.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO13 : BaseEntity + { + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO14.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO14.cs new file mode 100644 index 0000000000..fb53288042 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO14.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO14 : BaseEntity + { + public EntityDTO14() + { + this.Entities12 = new EntityDTO12(); + this.Entities1 = new EntityDTO1(); + } + + //public Address Address { get; set; } + public EntityDTO12 Entities12 { get; set; } + public EntityDTO1 Entities1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO15.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO15.cs new file mode 100644 index 0000000000..6896fcfc76 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO15.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO15 : BaseEntity + { + public EntityDTO15() + { + } + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO16.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO16.cs new file mode 100644 index 0000000000..cf4787a7ae --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO16.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO16 : BaseEntity + { + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + public Guid Entity12Id { get; set; } + public EntityDTO12 Entity12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO17.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO17.cs new file mode 100644 index 0000000000..40f61205a3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO17.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO17 :BaseEntity + { + public EntityDTO17() + { + //this.Entities20 = new EntityDTO20(); + //this.Entities8 = new EntityDTO8(); + //this.Entities5 = new EntityDTO5(); + //this.Entities18 = new EntityDTO18(); + } + + public EntityDTO20 Entities20 { get; set; } + public EntityDTO8 Entities8 { get; set; } + public EntityDTO5 Entities5 { get; set; } + public EntityDTO18 Entities18 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO18.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO18.cs new file mode 100644 index 0000000000..d6937f8c9a --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO18.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO18 : BaseEntity + { + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO19.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO19.cs new file mode 100644 index 0000000000..e31a6c498f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO19.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO19 : BaseEntity + { + public Guid Entity25Id { get; set; } + public EntityDTO25 Entity25 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO2.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO2.cs new file mode 100644 index 0000000000..47eb7917d8 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO2.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO2 : BaseEntity + { + public Guid Entity1Id { get; set; } + public EntityDTO1 Entity1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO20.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO20.cs new file mode 100644 index 0000000000..f91e23f761 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO20.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO20 : BaseEntity + { + //TODO Remove comments + public EntityDTO20() + { + //this.Entities8 = new EntityDTO8(); + //this.Entities26 = new EntityDTO26(); + //this.Entities12 = new EntityDTO12(); + //this.Entities17 = new EntityDTO17(); + //this.Entities21 = new EntityDTO21(); + //this.Entities16 = new EntityDTO16(); + } + + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public EntityDTO22 Entity22 { get; set; } + public EntityDTO8 Entities8 { get; set; } + public EntityDTO26 Entities26 { get; set; } + public EntityDTO12 Entities12 { get; set; } + public EntityDTO17 Entities17 { get; set; } + public EntityDTO21 Entities21 { get; set; } + public EntityDTO16 Entities16 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO21.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO21.cs new file mode 100644 index 0000000000..b7b3d8e060 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO21.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO21 : BaseEntity + { + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO22.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO22.cs new file mode 100644 index 0000000000..2ece3d7bc3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO22.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO22 : BaseEntity + { + public EntityDTO22() + { + //this.Entities20 = new EntityDTO20(); + //this.Entities24 = new EntityDTO24(); + } + public EntityDTO20 Entities20 { get; set; } + public EntityDTO24 Entities24 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO23.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO23.cs new file mode 100644 index 0000000000..42ea51a503 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO23.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO23 : BaseEntity + { + public Guid Entity5Id { get; set; } + public EntityDTO5 Entity5 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO24.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO24.cs new file mode 100644 index 0000000000..dbc3260516 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO24.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO24 : BaseEntity + { + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public EntityDTO22 Entity22 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO25.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO25.cs new file mode 100644 index 0000000000..7621f7e849 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO25.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO25 : BaseEntity + { + public EntityDTO25() + { + this.Entities19 = new EntityDTO19(); + } + + public EntityDTO19 Entities19 { get; set; } + public Guid? Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO26.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO26.cs new file mode 100644 index 0000000000..9c4eea101b --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO26.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO26 : BaseEntity + { + public EntityDTO26() + { + this.Entities20 = new EntityDTO20(); + } + + public EntityDTO20 Entities20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO3.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO3.cs new file mode 100644 index 0000000000..6c5784042c --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO3.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO3 : BaseEntity + { + public EntityDTO3() + { + //this.Entities4 = new EntityDTO4(); + //this.Entities8 = new EntityDTO8(); + } + public EntityDTO4 Entities4 { get; set; } + public EntityDTO8 Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO4.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO4.cs new file mode 100644 index 0000000000..34ab48fb66 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO4.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO4 : BaseEntity + { + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO5.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO5.cs new file mode 100644 index 0000000000..7af45e23f8 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO5.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO5 : BaseEntity + { + public EntityDTO5() + { + //this.Entities6 = new EntityDTO6(); + //this.TimeSlots = new EntityDTO23(); + //this.Entities5 = new EntityDTO5(); + } + + public Guid? Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid? Entity5Id { get; set; } + public EntityDTO5 Entity5Exception { get; set; } + public EntityDTO5 Entities5 { get; set; } + public EntityDTO6 Entities6 { get; set; } + public EntityDTO23 TimeSlots { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO6.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO6.cs new file mode 100644 index 0000000000..ab46c495ca --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO6.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO6 : BaseEntity + { + public EntityDTO6() + { + //this.Entities12 = new EntityDTO12(); + } + + public Guid Entity5Id { get; set; } + public EntityDTO5 Entity5 { get; set; } + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + public EntityDTO12 Entities12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO7.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO7.cs new file mode 100644 index 0000000000..bbc5a68c10 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO7.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO7 : BaseEntity + { + public Guid Entity25Id { get; set; } + public EntityDTO25 Entity25 { get; set; } + public Guid? Entity14Id { get; set; } + public EntityDTO14 Entity14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO8.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO8.cs new file mode 100644 index 0000000000..e9e52de419 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO8.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO8 : BaseEntity + { + public EntityDTO8() + { + this.Entities20 = new EntityDTO20(); + this.Entities22 = new EntityDTO22(); + this.Entities3 = new EntityDTO3(); + this.Entities11 = new EntityDTO11(); + this.Entities17 = new EntityDTO17(); + } + + public EntityDTO20 Entities20 { get; set; } + public EntityDTO17 Entities17 { get; set; } + public EntityDTO22 Entities22 { get; set; } + public EntityDTO3 Entities3 { get; set; } + public EntityDTO11 Entities11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/EntityDTO9.cs b/src/UnitTests/Bug/MapAtRuntime/EntityDTO9.cs new file mode 100644 index 0000000000..1eadd471d8 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/EntityDTO9.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3 +{ + public class EntityDTO9 : BaseEntity + { + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntime/MapAtRuntime.cs b/src/UnitTests/Bug/MapAtRuntime/MapAtRuntime.cs new file mode 100644 index 0000000000..416897a150 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntime/MapAtRuntime.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using OmmitedDatabaseModel3; +using OmmitedDTOModel3; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class MapAtRuntime : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + //cfg.ForAllPropertyMaps(p => !p.SourceType.IsValueType(), (pm, o) => o.MapAtRuntime()); + }); + + public class Initialize + { + Entity2 appointmentStatusHistory1; + Entity8 center1; + Entity12 insurance1; + Entity14 patient1; + Entity17 resource1; + Entity20 service1; + Entity22 speciality1; + + public Initialize() + { + appointmentStatusHistory1 = new Entity2 { Id = Guid.NewGuid() }; + center1 = new Entity8 { Id = Guid.NewGuid() }; + insurance1 = new Entity12 { Id = Guid.NewGuid() }; + patient1 = new Entity14 { Id = Guid.NewGuid() }; + resource1 = new Entity17 { Id = Guid.NewGuid() }; + service1 = new Entity20 { Id = Guid.NewGuid() }; + speciality1 = new Entity22 { Id = Guid.NewGuid() }; + + service1.Entity22 = speciality1; + service1.Entity22Id = speciality1.Id; + } + + public Entity1 GenerateAppointment() + { + var appointment1 = new Entity1 { Id = Guid.NewGuid() }; + appointmentStatusHistory1.Entity1 = appointment1; + appointmentStatusHistory1.Entity1Id = appointment1.Id; + appointment1.Entity8 = center1; + appointment1.Entity8Id = center1.Id; + appointment1.Entity12 = insurance1; + appointment1.Entity12Id = insurance1.Id; + appointment1.Entity14 = patient1; + appointment1.Entity14Id = patient1.Id; + appointment1.Entity17 = resource1; + appointment1.Entity17Id = resource1.Id; + appointment1.Entity20 = service1; + appointment1.Entity20Id = service1.Id; + appointment1.Entity22 = speciality1; + appointment1.Entity22Id = speciality1.Id; + return appointment1; + } + } + + [Fact] + public void ShouldNotBeSlow() + { + //List of objects performing slow + //Entity1 + //Entity17 + //Entity25 + //Entity19 + //Entity15 + //Entity13 + //Entity7 + //Entity5 + //Entity2 + + var list = new List(); + var initialize = new Initialize(); + list.Add(initialize.GenerateAppointment()); + var appointmentsDTO = Mapper.Map>(list); + var list2 = new List(); + var entity = new Entity1(); + list2.Add(entity); + var DTOs = Mapper.Map>(list2); + var list3 = new List(); + var entity17 = new Entity17(); + list3.Add(entity17); + var DTOs17 = Mapper.Map>(list3); + var list4 = new List(); + var entity25 = new Entity25(); + list4.Add(entity25); + var DTOs25 = Mapper.Map>(list4); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/BaseEntity.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/BaseEntity.cs new file mode 100644 index 0000000000..2b7847d662 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/BaseEntity.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class BaseEntity + { + public Guid Id { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/BaseEntityDTO.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/BaseEntityDTO.cs new file mode 100644 index 0000000000..614ef7bf79 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/BaseEntityDTO.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class BaseEntity + { + public Guid Id { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity1.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity1.cs new file mode 100644 index 0000000000..e0325f9a7b --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity1.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity1 : BaseEntity + { + public Entity1() + { + this.Entities2 = new List(); + } + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid? Entity22Id { get; set; } + public Entity22 Entity22 { get; set; } + public Guid? Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + public Guid? Entity12Id { get; set; } + public Entity12 Entity12 { get; set; } + public Guid Entity14Id { get; set; } + public Entity14 Entity14 { get; set; } + public Guid Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + public ICollection Entities2 { get; set; } + public Entity2 Entity2 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity10.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity10.cs new file mode 100644 index 0000000000..0443f6e559 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity10.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity10 : BaseEntity + { + public Entity10() + { + this.Entities11 = new List(); + } + public ICollection Entities11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity11.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity11.cs new file mode 100644 index 0000000000..aa48befff5 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity11.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity11 : BaseEntity + { + public Entity11() + { + this.Entities10 = new List(); + this.Entities8 = new List(); + } + public ICollection Entities10 { get; set; } + public ICollection Entities8 { get; set; } + public Entity8 Entity8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity12.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity12.cs new file mode 100644 index 0000000000..60df85d8df --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity12.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity12 : BaseEntity + { + public Entity12() + { + this.Entities20 = new List(); + this.Entities14 = new List(); + this.Entities16 = new List(); + } + public ICollection Entities20 { get; set; } + public ICollection Entities16 { get; set; } + public ICollection Entities14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity13.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity13.cs new file mode 100644 index 0000000000..732f76d7a4 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity13.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity13 : BaseEntity + { + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity14.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity14.cs new file mode 100644 index 0000000000..5d358c9637 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity14.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity14 : BaseEntity + { + public Entity14() + { + this.Entities12 = new List(); + this.Entities1 = new List(); + } + + public ICollection Entities12 { get; set; } + public ICollection Entities1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity15.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity15.cs new file mode 100644 index 0000000000..7ef998a1cc --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity15.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity15 : BaseEntity + { + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity16.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity16.cs new file mode 100644 index 0000000000..1385b6f515 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity16.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity16 : BaseEntity + { + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + public Guid Entity12Id { get; set; } + public Entity12 Entity12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity17.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity17.cs new file mode 100644 index 0000000000..fb1e9d3f26 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity17.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity17 :BaseEntity + { + public Entity17() + { + this.Entities20 = new List(); + this.Entities8 = new List(); + this.Entities5 = new List(); + this.Entities18 = new List(); + } + + public ICollection Entities20 { get; set; } + public ICollection Entities8 { get; set; } + public ICollection Entities5 { get; set; } + public ICollection Entities18 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity18.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity18.cs new file mode 100644 index 0000000000..22b6de7d54 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity18.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity18 : BaseEntity + { + public Guid Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity19.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity19.cs new file mode 100644 index 0000000000..e0f45d1c64 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity19.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity19 : BaseEntity + { + public Guid Entity25Id { get; set; } + public Entity25 Entity25 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity2.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity2.cs new file mode 100644 index 0000000000..9f1b548773 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity2.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity2 : BaseEntity + { + public Guid Entity1Id { get; set; } + public Entity1 Entity1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity20.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity20.cs new file mode 100644 index 0000000000..ce523b0145 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity20.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity20 : BaseEntity + { + public Entity20() + { + this.Entities8 = new List(); + this.Entities26 = new List(); + this.Entities12 = new List(); + this.Entities17 = new List(); + this.Entities21 = new List(); + this.Entities16 = new List(); + } + + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public Entity22 Entity22 { get; set; } + public ICollection Entities8 { get; set; } + public Entity8 Entity8 { get; set; } + public ICollection Entities26 { get; set; } + public ICollection Entities12 { get; set; } + public ICollection Entities17 { get; set; } + public Entity17 Entitys17 { get; set; } + public ICollection Entities21 { get; set; } + public ICollection Entities16 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity21.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity21.cs new file mode 100644 index 0000000000..dea88ef68c --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity21.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity21 : BaseEntity + { + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity22.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity22.cs new file mode 100644 index 0000000000..d3c8243c85 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity22.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity22 : BaseEntity + { + public Entity22() + { + this.Entities20 = new List(); + this.Entities24 = new List(); + } + public ICollection Entities20 { get; set; } + public ICollection Entities24 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity23.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity23.cs new file mode 100644 index 0000000000..065a63f7be --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity23.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity23 : BaseEntity + { + public Guid Entity5Id { get; set; } + public Entity5 Entity5 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity24.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity24.cs new file mode 100644 index 0000000000..2a3cdfae8a --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity24.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity24 : BaseEntity + { + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public Entity22 Entity22 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity25.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity25.cs new file mode 100644 index 0000000000..da1fe61249 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity25.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity25 : BaseEntity + { + public Entity25() + { + this.Entities19 = new List(); + } + + public ICollection Entities19 { get; set; } + public Guid? Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity26.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity26.cs new file mode 100644 index 0000000000..cf0532a1b1 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity26.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity26 : BaseEntity + { + public Entity26() + { + this.Entities20 = new List(); + } + + public ICollection Entities20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity3.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity3.cs new file mode 100644 index 0000000000..1e3b2192ac --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity3.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity3 : BaseEntity + { + public Entity3() + { + this.Entities4 = new List(); + this.Entities8 = new List(); + } + public ICollection Entities4 { get; set; } + public ICollection Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity4.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity4.cs new file mode 100644 index 0000000000..250c6d5eeb --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity4.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity4 : BaseEntity + { + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity5.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity5.cs new file mode 100644 index 0000000000..c3f9a3c7c7 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity5.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity5 : BaseEntity + { + public Entity5() + { + this.Entities6 = new List(); + this.TimeSlots = new List(); + this.Entities5 = new List(); + } + + public Guid? Entity8Id { get; set; } + public Entity8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public Entity17 Entity17 { get; set; } + public Guid? Entity5Id { get; set; } + public Entity5 Entity5Exception { get; set; } + public ICollection Entities5 { get; set; } + public List Entities6 { get; set; } + public ICollection TimeSlots { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity6.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity6.cs new file mode 100644 index 0000000000..63f485bcaf --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity6.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity6 : BaseEntity + { + public Entity6() + { + this.Entities12 = new List(); + } + + public Guid Entity5Id { get; set; } + public Entity5 Entity5 { get; set; } + public Guid Entity20Id { get; set; } + public Entity20 Entity20 { get; set; } + public ICollection Entities12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity7.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity7.cs new file mode 100644 index 0000000000..cb485cfe2e --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity7.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity7 : BaseEntity + { + public Guid Entity25Id { get; set; } + public Entity25 Entity25 { get; set; } + public Guid? Entity14Id { get; set; } + public Entity14 Entity14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity8.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity8.cs new file mode 100644 index 0000000000..939b751447 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity8.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity8 : BaseEntity + { + public Entity8() + { + this.Entities20 = new List(); + this.Entities22 = new List(); + this.Entities3 = new List(); + this.Entities11 = new List(); + this.Entities17 = new List(); + } + + public ICollection Entities20 { get; set; } + public ICollection Entities17 { get; set; } + public Entity17 Entity17 { get; set; } + public ICollection Entities22 { get; set; } + public Entity22 Entity22 { get; set; } + public ICollection Entities3 { get; set; } + public ICollection Entities11 { get; set; } + public Entity11 Entity11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity9.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity9.cs new file mode 100644 index 0000000000..1a29282e7f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/Entity9.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDatabaseModel3WithCollections +{ + public class Entity9 : BaseEntity + { + public Guid Entity3Id { get; set; } + public Entity3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO1.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO1.cs new file mode 100644 index 0000000000..7e3718421f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO1.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO1 : BaseEntity + { + public EntityDTO1() + { + this.Entities2 = new List(); + } + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid? Entity22Id { get; set; } + public EntityDTO22 Entity22 { get; set; } + public Guid? Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + public Guid? Entity12Id { get; set; } + public EntityDTO12 Entity12 { get; set; } + public Guid Entity14Id { get; set; } + public EntityDTO14 Entity14 { get; set; } + public Guid Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + public ICollection Entities2 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO10.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO10.cs new file mode 100644 index 0000000000..aa7235c145 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO10.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO10 : BaseEntity + { + public EntityDTO10() + { + this.Entities11 = new List(); + } + public ICollection Entities11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO11.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO11.cs new file mode 100644 index 0000000000..7c157eeb6f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO11.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO11 : BaseEntity + { + public EntityDTO11() + { + this.Entities10 = new List(); + this.Entities8 = new List(); + } + public ICollection Entities10 { get; set; } + public ICollection Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO12.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO12.cs new file mode 100644 index 0000000000..d740892fa6 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO12.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO12 : BaseEntity + { + public EntityDTO12() + { + this.Entities20 = new List(); + this.Entities14 = new List(); + Entities16 = new List(); + } + public ICollection Entities20 { get; set; } + public ICollection Entities16 { get; set; } + public ICollection Entities14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO13.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO13.cs new file mode 100644 index 0000000000..b1926690dd --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO13.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO13 : BaseEntity + { + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO14.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO14.cs new file mode 100644 index 0000000000..16aebbad2d --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO14.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO14 : BaseEntity + { + public EntityDTO14() + { + this.Entities12 = new List(); + this.Entities1 = new List(); + } + + //public Address Address { get; set; } + public ICollection Entities12 { get; set; } + public ICollection Entities1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO15.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO15.cs new file mode 100644 index 0000000000..757572536e --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO15.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO15 : BaseEntity + { + public EntityDTO15() + { + } + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO16.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO16.cs new file mode 100644 index 0000000000..db5045a37c --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO16.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO16 : BaseEntity + { + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + public Guid Entity12Id { get; set; } + public EntityDTO12 Entity12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO17.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO17.cs new file mode 100644 index 0000000000..c60894a015 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO17.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO17 :BaseEntity + { + public EntityDTO17() + { + this.Entities20 = new List(); + this.Entities8 = new List(); + this.Entities5 = new List(); + this.Entities18 = new List(); + } + + public ICollection Entities20 { get; set; } + public ICollection Entities8 { get; set; } + public ICollection Entities5 { get; set; } + public ICollection Entities18 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO18.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO18.cs new file mode 100644 index 0000000000..ee7bac155e --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO18.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO18 : BaseEntity + { + public Guid Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO19.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO19.cs new file mode 100644 index 0000000000..18e2bf014f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO19.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO19 : BaseEntity + { + public Guid Entity25Id { get; set; } + public EntityDTO25 Entity25 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO2.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO2.cs new file mode 100644 index 0000000000..dd772d9b27 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO2.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO2 : BaseEntity + { + public Guid Entity1Id { get; set; } + public EntityDTO1 Entity1 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO20.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO20.cs new file mode 100644 index 0000000000..f6a3682e26 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO20.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO20 : BaseEntity + { + public EntityDTO20() + { + this.Entities8 = new List(); + this.Entities26 = new List(); + this.Entities12 = new List(); + this.Entities17 = new List(); + this.Entities21 = new List(); + this.Entities16 = new List(); + } + + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public EntityDTO22 Entity22 { get; set; } + public ICollection Entities8 { get; set; } + public ICollection Entities26 { get; set; } + public ICollection Entities12 { get; set; } + public ICollection Entities17 { get; set; } + public ICollection Entities21 { get; set; } + public ICollection Entities16 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO21.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO21.cs new file mode 100644 index 0000000000..ae0b6d5a91 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO21.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO21 : BaseEntity + { + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO22.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO22.cs new file mode 100644 index 0000000000..33b2382745 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO22.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO22 : BaseEntity + { + public EntityDTO22() + { + this.Entities20 = new List(); + this.Entities24 = new List(); + } + public ICollection Entities20 { get; set; } + public ICollection Entities24 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO23.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO23.cs new file mode 100644 index 0000000000..b6b10ab4f6 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO23.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO23 : BaseEntity + { + public Guid Entity5Id { get; set; } + public EntityDTO5 Entity5 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO24.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO24.cs new file mode 100644 index 0000000000..ab7b48c61e --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO24.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO24 : BaseEntity + { + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + public Guid Entity22Id { get; set; } + public EntityDTO22 Entity22 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO25.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO25.cs new file mode 100644 index 0000000000..1961eb36c4 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO25.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO25 : BaseEntity + { + public EntityDTO25() + { + this.Entities19 = new List(); + } + + public ICollection Entities19 { get; set; } + public Guid? Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO26.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO26.cs new file mode 100644 index 0000000000..e1d68f19f3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO26.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO26 : BaseEntity + { + public EntityDTO26() + { + this.Entities20 = new List(); + } + + public ICollection Entities20 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO3.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO3.cs new file mode 100644 index 0000000000..01bc26f28b --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO3.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO3 : BaseEntity + { + public EntityDTO3() + { + this.Entities4 = new List(); + this.Entities8 = new List(); + } + public ICollection Entities4 { get; set; } + public ICollection Entities8 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO4.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO4.cs new file mode 100644 index 0000000000..6c8f4bd249 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO4.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO4 : BaseEntity + { + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO5.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO5.cs new file mode 100644 index 0000000000..9a1421a0df --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO5.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO5 : BaseEntity + { + public EntityDTO5() + { + this.Entities6 = new List(); + this.TimeSlots = new List(); + this.Entities5 = new List(); + } + + public Guid? Entity8Id { get; set; } + public EntityDTO8 Entity8 { get; set; } + public Guid? Entity17Id { get; set; } + public EntityDTO17 Entity17 { get; set; } + public Guid? Entity5Id { get; set; } + public EntityDTO5 Entity5Exception { get; set; } + public ICollection Entities5 { get; set; } + public List Entities6 { get; set; } + public ICollection TimeSlots { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO6.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO6.cs new file mode 100644 index 0000000000..5cca04c88e --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO6.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO6 : BaseEntity + { + public EntityDTO6() + { + this.Entities12 = new List(); + } + + public Guid Entity5Id { get; set; } + public EntityDTO5 Entity5 { get; set; } + public Guid Entity20Id { get; set; } + public EntityDTO20 Entity20 { get; set; } + public ICollection Entities12 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO7.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO7.cs new file mode 100644 index 0000000000..24697bebe3 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO7.cs @@ -0,0 +1,12 @@ +using System; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO7 : BaseEntity + { + public Guid Entity25Id { get; set; } + public EntityDTO25 Entity25 { get; set; } + public Guid? Entity14Id { get; set; } + public EntityDTO14 Entity14 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO8.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO8.cs new file mode 100644 index 0000000000..3b122d75f2 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO8.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO8 : BaseEntity + { + public EntityDTO8() + { + this.Entities20 = new List(); + this.Entities22 = new List(); + this.Entities3 = new List(); + this.Entities11 = new List(); + this.Entities17 = new List(); + } + + public ICollection Entities20 { get; set; } + public ICollection Entities17 { get; set; } + public ICollection Entities22 { get; set; } + public ICollection Entities3 { get; set; } + public ICollection Entities11 { get; set; } + public EntityDTO11 Entity11 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO9.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO9.cs new file mode 100644 index 0000000000..2384e7bb78 --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/EntityDTO9.cs @@ -0,0 +1,10 @@ +using System; + +namespace OmmitedDTOModel3WithCollections +{ + public class EntityDTO9 : BaseEntity + { + public Guid Entity3Id { get; set; } + public EntityDTO3 Entity3 { get; set; } + } +} diff --git a/src/UnitTests/Bug/MapAtRuntimeWithCollections/MapAtRuntimeWithCollections.cs b/src/UnitTests/Bug/MapAtRuntimeWithCollections/MapAtRuntimeWithCollections.cs new file mode 100644 index 0000000000..55049c3b2f --- /dev/null +++ b/src/UnitTests/Bug/MapAtRuntimeWithCollections/MapAtRuntimeWithCollections.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using OmmitedDatabaseModel3WithCollections; +using OmmitedDTOModel3WithCollections; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class MapAtRuntimeWithCollections : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + //cfg.ForAllPropertyMaps(p => !p.SourceType.IsValueType(), (pm, o) => o.MapAtRuntime()); + }); + + public class Initialize + { + Entity2 appointmentStatusHistory1; + Entity8 center1; + Entity12 insurance1; + Entity14 patient1; + Entity17 resource1; + Entity20 service1; + Entity22 speciality1; + + public Initialize() + { + appointmentStatusHistory1 = new Entity2 { Id = Guid.NewGuid() }; + center1 = new Entity8 { Id = Guid.NewGuid() }; + insurance1 = new Entity12 { Id = Guid.NewGuid() }; + patient1 = new Entity14 { Id = Guid.NewGuid() }; + resource1 = new Entity17 { Id = Guid.NewGuid() }; + service1 = new Entity20 { Id = Guid.NewGuid() }; + speciality1 = new Entity22 { Id = Guid.NewGuid() }; + + speciality1.Entities20.Add(service1); + + service1.Entities8.Add(center1); + service1.Entities12.Add(insurance1); + service1.Entities17.Add(resource1); + service1.Entity22 = speciality1; + service1.Entity22Id = speciality1.Id; + + resource1.Entities8.Add(center1); + resource1.Entities20.Add(service1); + + patient1.Entities12.Add(insurance1); + + insurance1.Entities14.Add(patient1); + insurance1.Entities20.Add(service1); + + center1.Entities17.Add(resource1); + center1.Entities20.Add(service1); + center1.Entities22.Add(speciality1); + } + + public Entity1 GenerateAppointment() + { + var appointment1 = new Entity1 { Id = Guid.NewGuid() }; + appointmentStatusHistory1.Entity1 = appointment1; + appointmentStatusHistory1.Entity1Id = appointment1.Id; + appointment1.Entities2.Add(appointmentStatusHistory1); + appointment1.Entity8 = center1; + appointment1.Entity8Id = center1.Id; + appointment1.Entity12 = insurance1; + appointment1.Entity12Id = insurance1.Id; + appointment1.Entity14 = patient1; + appointment1.Entity14Id = patient1.Id; + appointment1.Entity17 = resource1; + appointment1.Entity17Id = resource1.Id; + appointment1.Entity20 = service1; + appointment1.Entity20Id = service1.Id; + appointment1.Entity22 = speciality1; + appointment1.Entity22Id = speciality1.Id; + + patient1.Entities1.Add(appointment1); + + return appointment1; + } + } + + [Fact] + public void ShouldNotBeSlow() + { + //List of objects performing slow + //Entity1 + //Entity17 + //Entity25 + //Entity19 + //Entity15 + //Entity13 + //Entity7 + //Entity5 + //Entity2 + + var list = new List(); + var initialize = new Initialize(); + list.Add(initialize.GenerateAppointment()); + var appointmentsDTO = Mapper.Map>(list); + var list2 = new List(); + var entity = new Entity1(); + list2.Add(entity); + var DTOs = Mapper.Map>(list2); + var list3 = new List(); + var entity17 = new Entity17(); + list3.Add(entity17); + var DTOs17 = Mapper.Map>(list3); + var list4 = new List(); + var entity25 = new Entity25(); + list4.Add(entity25); + var DTOs25 = Mapper.Map>(list4); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MapExpandoObjectProperty.cs b/src/UnitTests/Bug/MapExpandoObjectProperty.cs new file mode 100644 index 0000000000..5e7b3e25e1 --- /dev/null +++ b/src/UnitTests/Bug/MapExpandoObjectProperty.cs @@ -0,0 +1,30 @@ +using System.Dynamic; + +namespace AutoMapper.UnitTests.Bug +{ + public class MapExpandoObjectProperty : AutoMapperSpecBase + { + + class From + { + public ExpandoObject ExpandoObject { get; set; } + } + + class To + { + public ExpandoObject ExpandoObject { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + dynamic baseSettings = new ExpandoObject(); + + var settings = Mapper.Map(new From { ExpandoObject = baseSettings}); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MapFromClosureBug.cs b/src/UnitTests/Bug/MapFromClosureBug.cs new file mode 100644 index 0000000000..d1006355bc --- /dev/null +++ b/src/UnitTests/Bug/MapFromClosureBug.cs @@ -0,0 +1,70 @@ +using FakeItEasy; + +namespace AutoMapper.UnitTests.Bug +{ + using System; + using Shouldly; + + public class MapFromClosureBug : SpecBaseBase + { + private static readonly IDateProvider _dateProvider; + + static MapFromClosureBug() => _dateProvider = A.Fake(); + + public interface IDateProvider + { + DateTime CurrentRestaurantTime(Restaurant restaurant); + } + + public class Result + { + public Booking Booking { get; set; } + } + + public class Restaurant + { + } + + public class Booking + { + public Restaurant Restaurant { get; set; } + + public int? CalculateTotal(DateTime currentTime) + { + return null; + } + } + + public class ResultDto + { + public BookingDto Booking { get; set; } + } + + public class BookingDto + { + public int? Total { get; set; } + } + + public void Should_map_successfully() + { + var mapperConfiguration = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(d => d.Total, + o => o.MapFrom(b => b.CalculateTotal(_dateProvider.CurrentRestaurantTime(b.Restaurant)))); + }); + + var mapper = mapperConfiguration.CreateMapper(); + + var result = new Result { Booking = new Booking() }; + + // Act + var dto = mapper.Map(result); + + // Assert + dto.ShouldNotBeNull(); + } + + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MapOverloadsWithDynamic.cs b/src/UnitTests/Bug/MapOverloadsWithDynamic.cs index 1f7498265f..0bbefd3af4 100644 --- a/src/UnitTests/Bug/MapOverloadsWithDynamic.cs +++ b/src/UnitTests/Bug/MapOverloadsWithDynamic.cs @@ -1,55 +1,55 @@ using Xunit; -using Should; +using Shouldly; using System; -using System.Dynamic; - +using System.Dynamic; + namespace AutoMapper.UnitTests.Bug { public class MapOverloadsWithDynamic : AutoMapperSpecBase { Settings _settings; - class SubSetting - { - public int SubTimeout { get; set; } - public string SubColour { get; set; } - } - - class Settings - { - public int Timeout { get; set; } - public string Colour { get; set; } - public SubSetting SubSettings { get; set; } + class SubSetting + { + public int SubTimeout { get; set; } + public string SubColour { get; set; } + } + + class Settings + { + public int Timeout { get; set; } + public string Colour { get; set; } + public SubSetting SubSettings { get; set; } } protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => {}); protected override void Because_of() - { - // The SubSettings property is another ExpandoObject. - dynamic baseSettings = new ExpandoObject(); - baseSettings.Timeout = 1; - baseSettings.Colour = "Red"; - baseSettings.SubSettings = new ExpandoObject(); - baseSettings.SubSettings.SubTimeout = 11; - baseSettings.SubSettings.SubColour = "Green"; - - // Create another object we will map onto the one above. - // Notice that we do not set a Colour or SubColour property. - dynamic overrideSettings = new ExpandoObject(); - overrideSettings.Timeout = 2; - overrideSettings.SubSettings = new ExpandoObject(); - overrideSettings.SubSettings.SubTimeout = 22; - - _settings = Mapper.Map(baseSettings); + { + // The SubSettings property is another ExpandoObject. + dynamic baseSettings = new ExpandoObject(); + baseSettings.Timeout = 1; + baseSettings.Colour = "Red"; + baseSettings.SubSettings = new ExpandoObject(); + baseSettings.SubSettings.SubTimeout = 11; + baseSettings.SubSettings.SubColour = "Green"; + + // Create another object we will map onto the one above. + // Notice that we do not set a Colour or SubColour property. + dynamic overrideSettings = new ExpandoObject(); + overrideSettings.Timeout = 2; + overrideSettings.SubSettings = new ExpandoObject(); + overrideSettings.SubSettings.SubTimeout = 22; + + _settings = Mapper.Map(baseSettings); Mapper.Map(overrideSettings, _settings); } [Fact] - public void Should_work() - { - _settings.Timeout.ShouldEqual(2); - _settings.SubSettings.SubTimeout.ShouldEqual(22); + public void Should_work() + { + _settings.Timeout.ShouldBe(2); + _settings.SubSettings.SubTimeout.ShouldBe(22); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/MappingInheritance.cs b/src/UnitTests/Bug/MappingInheritance.cs index 58389ed3cc..48a7b0d3f1 100644 --- a/src/UnitTests/Bug/MappingInheritance.cs +++ b/src/UnitTests/Bug/MappingInheritance.cs @@ -1,102 +1,102 @@ - -namespace AutoMapper.UnitTests.Bug -{ - using Should; - using Xunit; - - public class MappingInheritance : AutoMapperSpecBase - { - private Entity testEntity; - private EditModel testModel; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap() - .ForMember(model => model.Value1, mce => mce.MapFrom(entity => entity.Value2)) - .ForMember(model => model.Value2, mce => mce.MapFrom(entity => entity.Value1)) - .Include() - .Include(); - cfg.CreateMap() - .ForMember(model => model.Value3, mce => mce.MapFrom(entity => entity.Value1 + entity.Value2)); - }); - - protected override void Because_of() - { - testEntity = new Entity - { - Value1 = 1, - Value2 = 2, - }; - testModel = Mapper.Map(testEntity); - } - - [Fact] - public void AutoMapper_should_map_derived_types_properly() - { - testEntity.Value1.ShouldEqual(testModel.Value2); - testEntity.Value2.ShouldEqual(testModel.Value1); - (testEntity.Value1 + testEntity.Value2).ShouldEqual(testModel.Value3); - } - - public class Entity - { - public int Value1 { get; set; } - public int Value2 { get; set; } - } - - public class BaseModel - { - public int Value1 { get; set; } - public int Value2 { get; set; } - } - - public class EditModel : BaseModel - { - public int Value3 { get; set; } - } - - public class ViewModel : BaseModel { } - } - - public class MappingInheritanceBug - { - [Fact] - public void TestMethod1() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include() - .Include(); - cfg.CreateMap(); - cfg.CreateMap(); - }); - - var mapper = config.CreateMapper(); - - var mailOrder = new MailOrder() { NewId = 1 }; - var mapped = mapper.Map(mailOrder); - - mapped.ShouldBeType(); - } - - public abstract class Base - { - } - - public class Order : Base { } - public class OnlineOrder : Order { } - public class MailOrder : Order - { - public int NewId { get; set; } - } - - public class OrderDto { } - public class OnlineOrderDto : OrderDto { } - public class MailOrderDto : OrderDto - { - public int NewId { get; set; } - } - } -} + +namespace AutoMapper.UnitTests.Bug +{ + using Shouldly; + using Xunit; + + public class MappingInheritance : AutoMapperSpecBase + { + private Entity testEntity; + private EditModel testModel; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(model => model.Value1, mce => mce.MapFrom(entity => entity.Value2)) + .ForMember(model => model.Value2, mce => mce.MapFrom(entity => entity.Value1)) + .Include() + .Include(); + cfg.CreateMap() + .ForMember(model => model.Value3, mce => mce.MapFrom(entity => entity.Value1 + entity.Value2)); + }); + + protected override void Because_of() + { + testEntity = new Entity + { + Value1 = 1, + Value2 = 2, + }; + testModel = Mapper.Map(testEntity); + } + + [Fact] + public void AutoMapper_should_map_derived_types_properly() + { + testEntity.Value1.ShouldBe(testModel.Value2); + testEntity.Value2.ShouldBe(testModel.Value1); + (testEntity.Value1 + testEntity.Value2).ShouldBe(testModel.Value3); + } + + public class Entity + { + public int Value1 { get; set; } + public int Value2 { get; set; } + } + + public class BaseModel + { + public int Value1 { get; set; } + public int Value2 { get; set; } + } + + public class EditModel : BaseModel + { + public int Value3 { get; set; } + } + + public class ViewModel : BaseModel { } + } + + public class MappingInheritanceBug + { + [Fact] + public void TestMethod1() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include() + .Include(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + var mapper = config.CreateMapper(); + + var mailOrder = new MailOrder() { NewId = 1 }; + var mapped = mapper.Map(mailOrder); + + mapped.ShouldBeOfType(); + } + + public abstract class Base + { + } + + public class Order : Base { } + public class OnlineOrder : Order { } + public class MailOrder : Order + { + public int NewId { get; set; } + } + + public class OrderDto { } + public class OnlineOrderDto : OrderDto { } + public class MailOrderDto : OrderDto + { + public int NewId { get; set; } + } + } +} diff --git a/src/UnitTests/Bug/MappingToAReadOnlyCollection.cs b/src/UnitTests/Bug/MappingToAReadOnlyCollection.cs index 05564906a0..b586b568ee 100644 --- a/src/UnitTests/Bug/MappingToAReadOnlyCollection.cs +++ b/src/UnitTests/Bug/MappingToAReadOnlyCollection.cs @@ -1,6 +1,6 @@ using System; using System.Collections.ObjectModel; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug diff --git a/src/UnitTests/Bug/MemberListSourceAndForPath.cs b/src/UnitTests/Bug/MemberListSourceAndForPath.cs new file mode 100644 index 0000000000..1f4049ee5b --- /dev/null +++ b/src/UnitTests/Bug/MemberListSourceAndForPath.cs @@ -0,0 +1,49 @@ +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class MemberListSourceAndForPath : AutoMapperSpecBase + { + bool _equal; + + public class TargetOuter + { + public TargetInner Inner { get; set; } + + // The properties below should be ignored, they are not relevant + public int Unrelated { get; set; } + public string AlsoUnrelated { get; set; } + } + + public class TargetInner + { + public string MyProp { get; set; } + } + + public class Input + { + public string Source { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source) + .ForPath(x => x.Inner.MyProp, opt => opt.MapFrom(x => x.Source)); + }); + + protected override void Because_of() + { + var input = new Input() {Source = "Hello World!"}; + var output = Mapper.Map(input); + + _equal = output.Inner.MyProp == input.Source; + } + + [Fact] + public void Should_ignore_destination_members() + { + _equal.ShouldBeTrue(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MemberNamedTypeBug.cs b/src/UnitTests/Bug/MemberNamedTypeBug.cs index b26f6fdaf5..d2cf0195e6 100644 --- a/src/UnitTests/Bug/MemberNamedTypeBug.cs +++ b/src/UnitTests/Bug/MemberNamedTypeBug.cs @@ -1,63 +1,63 @@ -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - using System; - using Should; - - public class CorrectCtorIsPickedOnDestinationType : NonValidatingSpecBase - { - public class SourceClass { } - - public class DestinationClass - { - public DestinationClass() { } - - // Since the name of the parameter is 'type', Automapper.TypeMapFactory chooses SourceClass.GetType() - // to fulfill the dependency, causing an InvalidCastException during Mapper.Map() - public DestinationClass(Int32 type) - { - Type = type; - } - - public Int32 Type { get; private set; } - } - - protected override MapperConfiguration Configuration { get; } - = new MapperConfiguration(cfg => cfg.CreateMap()); - - [Fact] - public void Should_pick_a_ctor_which_best_matches() - { - var source = new SourceClass(); - - Mapper.Map(source); - } - } - public class MemberNamedTypeWrong : AutoMapperSpecBase - { - public class SourceClass - { - public string Type { get; set; } - } - - public class DestinationClass - { - public string Type { get; set; } - } - - [Fact] - public void Should_map_correctly() - { - var source = new SourceClass - { - Type = "Hello" - }; - - var result = Mapper.Map(source); - result.Type.ShouldEqual(source.Type); - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap()); - } +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + using System; + using Shouldly; + + public class CorrectCtorIsPickedOnDestinationType : NonValidatingSpecBase + { + public class SourceClass { } + + public class DestinationClass + { + public DestinationClass() { } + + // Since the name of the parameter is 'type', Automapper.TypeMapFactory chooses SourceClass.GetType() + // to fulfill the dependency, causing an InvalidCastException during Mapper.Map() + public DestinationClass(Int32 type) + { + Type = type; + } + + public Int32 Type { get; private set; } + } + + protected override MapperConfiguration Configuration { get; } + = new MapperConfiguration(cfg => cfg.CreateMap()); + + [Fact] + public void Should_pick_a_ctor_which_best_matches() + { + var source = new SourceClass(); + + Mapper.Map(source); + } + } + public class MemberNamedTypeWrong : AutoMapperSpecBase + { + public class SourceClass + { + public string Type { get; set; } + } + + public class DestinationClass + { + public string Type { get; set; } + } + + [Fact] + public void Should_map_correctly() + { + var source = new SourceClass + { + Type = "Hello" + }; + + var result = Mapper.Map(source); + result.Type.ShouldBe(source.Type); + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap()); + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/MissingMapping.cs b/src/UnitTests/Bug/MissingMapping.cs new file mode 100644 index 0000000000..fa6d062dc0 --- /dev/null +++ b/src/UnitTests/Bug/MissingMapping.cs @@ -0,0 +1,29 @@ +namespace AutoMapper.UnitTests +{ + using System.Linq; + using Shouldly; + using Xunit; + using QueryableExtensions; + using System; + + public class MissingMapping : AutoMapperSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => c.CreateMissingTypeMaps = false); + + [Fact] + public void Can_not_map_unmapped_type() + { + new Action(() => Mapper.Map(new Source())).ShouldThrow(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MultiThreadingIssues.cs b/src/UnitTests/Bug/MultiThreadingIssues.cs index 1ab3c41324..0acccf4c02 100644 --- a/src/UnitTests/Bug/MultiThreadingIssues.cs +++ b/src/UnitTests/Bug/MultiThreadingIssues.cs @@ -1,315 +1,1326 @@ -using System ; -using System.Collections.Generic; -using System.Diagnostics ; -using System.Linq; -using System.Threading ; -using System.Threading.Tasks ; -using AutoMapper.Mappers; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - using Should; - - public class MultiThreadingIssues - { - public class Type1 - { - public string FirstName ; - public string MiddleName ; - public string LastName ; - public int Age ; - } - - public class Type1Point3 - { - public string FirstName ; - public string MiddleName ; - public string LastName ; - } - - public class Type1Point2 - { - public string FirstName ; - public string MiddleName ; - } - - public class Type1Point1 - { - public string FirstName ; - } - - public class DestType - { - public string FirstName ; - public string MiddleName ; - public string LastName ; - public int Age ; - } - - static int _done ; - readonly ManualResetEvent _allDone = new ManualResetEvent( false ); - - [Fact] - public void ShouldMapToNewISet() - { - const int threadCount = 130 ; - - for (int i = 0; i < threadCount; i++) - { - Task.Factory.StartNew( doMapping ).ContinueWith( - a => - { - if (Interlocked.Increment(ref _done) == threadCount) - { - _allDone.Set( ) ; - } - - } ) ; - } - - _allDone.WaitOne( TimeSpan.FromSeconds( 10 ) ) ; - } - - static void doMapping( ) - { - var source = createSource( ) ; - - Console.WriteLine( @"Mapping {0} on thread {1}", source.GetType( ), Thread.CurrentThread.ManagedThreadId ) ; - - var config = new MapperConfiguration(cfg => cfg.CreateMap(source.GetType(), typeof (DestType))); - - DestType t2 = (DestType)config.CreateMapper().Map(source, source.GetType( ), typeof( DestType ) ) ; - } - - static readonly Random _random = new Random(); - - static object createSource( ) - { - - int n = _random.Next( 0, 4 ) ; - - if( n == 0 ) - { - return new Type1 - { - Age = 12, - FirstName = @"Fred", - LastName = @"Smith", - MiddleName = @"G" - } ; - } - if( n == 1 ) - { - return new Type1Point1( ) - { - FirstName = @"Fred", - } ; - - } - if( n == 2 ) - { - return new Type1Point2( ) - { - FirstName = @"Fred", - MiddleName = @"G" - } ; - - } - if( n == 3 ) - { - return new Type1Point3( ) - { - FirstName = @"Fred", - LastName = @"Smith", - MiddleName = @"G" - } ; - - } - - throw new Exception(); - } - } - - public class DynamicMapThreadingIssues - { - public class SomeDtoA - { - private string Property1 { get; set; } - private string Property21 { get; set; } - private string Property3 { get; set; } - private string Property4 { get; set; } - private string Property5 { get; set; } - private string Property6 { get; set; } - private string Property7 { get; set; } - private string Property8 { get; set; } - private string Property9 { get; set; } - private string Property10 { get; set; } - private string Property11 { get; set; } - } - - public class SomeDtoB - { - private string Property1 { get; set; } - private string Property21 { get; set; } - private string Property3 { get; set; } - private string Property4 { get; set; } - private string Property5 { get; set; } - private string Property6 { get; set; } - private string Property7 { get; set; } - private string Property8 { get; set; } - private string Property9 { get; set; } - private string Property10 { get; set; } - private string Property11 { get; set; } - } - - public class SomeDtoC - { - private string Property1 { get; set; } - private string Property21 { get; set; } - private string Property3 { get; set; } - private string Property4 { get; set; } - private string Property5 { get; set; } - private string Property6 { get; set; } - private string Property7 { get; set; } - private string Property8 { get; set; } - private string Property9 { get; set; } - private string Property10 { get; set; } - private string Property11 { get; set; } - } - - public class SomeDtoD - { - private string Property1 { get; set; } - private string Property21 { get; set; } - private string Property3 { get; set; } - private string Property4 { get; set; } - private string Property5 { get; set; } - private string Property6 { get; set; } - private string Property7 { get; set; } - private string Property8 { get; set; } - private string Property9 { get; set; } - private string Property10 { get; set; } - private string Property11 { get; set; } - } - - [Fact] - public void Should_not_fail() - { - var config = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); - var mapper = config.CreateMapper(); - - var tasks = Enumerable.Range(0, 5).Select( - i => - Task.Factory.StartNew( - () => - { - mapper.Map(new SomeDtoA()); - mapper.Map(new SomeDtoB()); - mapper.Map(new SomeDtoC()); - mapper.Map(new SomeDtoD()); - })) - .ToArray(); - Exception exception = null; - try - { - Task.WaitAll(tasks); - } - catch (Exception e) - { - exception = e; - } - exception.ShouldBeNull(); - //typeof(Exception).ShouldNotBeThrownBy(() => Task.WaitAll(tasks)); - } - } -} - -// The three exceptions I saw while running the multithreading tests for DynamicMap (lbargaoanu) - -//Unhandled Exception: System.AggregateException: One or more errors occurred. ---> AutoMapper.AutoMapperMappingException: - -//Mapping types: -//SomeDtoB -> SomeDtoA -//TestConsole.Program+SomeDtoB -> TestConsole.Program+SomeDtoA - -//Destination path: -//SomeDtoA - -//Source value: -//TestConsole.Program+SomeDtoB ---> System.NullReferenceException: Object reference not set to an instance of an object. -// at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.c -//s:line 256 -// --- End of inner exception stack trace --- -// at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.c -//s:line 264 -// at AutoMapper.MappingEngine.DynamicMap(Object source, Type sourceType, Type destinationType) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine -//.cs:line 199 -// at AutoMapper.MappingEngine.DynamicMap[TSource, TDestination](TSource source) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.cs:line 170 -// at AutoMapper.Mapper.DynamicMap[TSource, TDestination](TSource source) in D:\Projects\AutoMapper\src\AutoMapper\Mapper.cs:line 174 -// at TestConsole.Program.<>c.
b__6_1() in D:\Projects\TestConsole\TestConsole\Program.cs:line 141 -// at System.Threading.Tasks.Task.Execute() -// --- End of inner exception stack trace --- -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout) -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks) -// at TestConsole.Program.Main(String[] args) in D:\Projects\TestConsole\TestConsole\Program.cs:line 146 - -//Unhandled Exception: System.AggregateException: One or more errors occurred. ---> AutoMapper.AutoMapperMappingException: - -//Mapping types: -//SomeDtoB -> SomeDtoA -//TestConsole.Program+SomeDtoB -> TestConsole.Program+SomeDtoA - -//Destination path: -//SomeDtoA - -//Source value: -//TestConsole.Program+SomeDtoB ---> System.NullReferenceException: Object reference not set to an instance of an object. -// at AutoMapper.Mappers.TypeMapMapper.Map(ResolutionContext context, IMappingEngineRunner mapper) in D:\Projects\AutoMapper\src\AutoMapper\Mappers\Ty -//peMapMapper.cs:line 17 -// at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.c -//s:line 260 -// --- End of inner exception stack trace --- -// at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.c -//s:line 268 -// at AutoMapper.MappingEngine.DynamicMap(Object source, Type sourceType, Type destinationType) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine -//.cs:line 199 -// at AutoMapper.MappingEngine.DynamicMap[TSource, TDestination](TSource source) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.cs:line 170 -// at AutoMapper.Mapper.DynamicMap[TSource, TDestination](TSource source) in D:\Projects\AutoMapper\src\AutoMapper\Mapper.cs:line 174 -// at TestConsole.Program.<>c.
b__6_1() in D:\Projects\TestConsole\TestConsole\Program.cs:line 141 -// at System.Threading.Tasks.Task.Execute() -// --- End of inner exception stack trace --- -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout) -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks) -// at TestConsole.Program.Main(String[] args) in D:\Projects\TestConsole\TestConsole\Program.cs:line 145 - -//Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.Collections.Generic.KeyNotFoundException: The given key was n -//ot present in the dictionary. -// at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key) -// at AutoMapper.Internal.DictionaryFactoryOverride.ConcurrentDictionaryImpl`2.get_Item(TKey key) in D:\Projects\AutoMapper\src\AutoMapper\Internal\Co -//ncurrentDictionaryFactory.cs:line 42 -// at AutoMapper.ConfigurationStore.b__87_1(TypePair tp) in D:\Projects\AutoMapper\src\AutoMapper\ConfigurationStore.cs:line 356 -// at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() -// at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) -// at AutoMapper.ConfigurationStore.b__87_0(TypePair _) in D:\Projects\AutoMapper\src\AutoMapper\ConfigurationStore.cs:line 353 -// at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) -// at AutoMapper.Internal.DictionaryFactoryOverride.ConcurrentDictionaryImpl`2.GetOrAdd(TKey key, Func`2 valueFactory) in D:\Projects\AutoMapper\src\A -//utoMapper\Internal\ConcurrentDictionaryFactory.cs:line 37 -// at AutoMapper.ConfigurationStore.ResolveTypeMap(TypePair typePair) in D:\Projects\AutoMapper\src\AutoMapper\ConfigurationStore.cs:line 351 -// at AutoMapper.ConfigurationStore.ResolveTypeMap(Type sourceType, Type destinationType) in D:\Projects\AutoMapper\src\AutoMapper\ConfigurationStore. -//cs:line 346 -// at AutoMapper.ConfigurationStore.ResolveTypeMap(Object source, Object destination, Type sourceType, Type destinationType) in D:\Projects\AutoMapper -//\src\AutoMapper\ConfigurationStore.cs:line 364 -// at AutoMapper.MappingEngine.DynamicMap(Object source, Type sourceType, Type destinationType) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine -//.cs:line 191 -// at AutoMapper.MappingEngine.DynamicMap[TSource, TDestination](TSource source) in D:\Projects\AutoMapper\src\AutoMapper\MappingEngine.cs:line 170 -// at AutoMapper.Mapper.DynamicMap[TSource, TDestination](TSource source) in D:\Projects\AutoMapper\src\AutoMapper\Mapper.cs:line 174 -// at TestConsole.Program.<>c.
b__6_1() in D:\Projects\TestConsole\TestConsole\Program.cs:line 143 -// at System.Threading.Tasks.Task.Execute() -// --- End of inner exception stack trace --- -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout) -// at System.Threading.Tasks.Task.WaitAll(Task[] tasks) -// at TestConsole.Program.Main(String[] args) in D:\Projects\TestConsole\TestConsole\Program.cs:line 145 +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AutoMapper.Mappers; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + using Shouldly; + + public class MultiThreadingIssues + { + public class Type1 + { + public string FirstName; + public string MiddleName; + public string LastName; + public int Age; + } + + public class Type1Point3 + { + public string FirstName; + public string MiddleName; + public string LastName; + } + + public class Type1Point2 + { + public string FirstName; + public string MiddleName; + } + + public class Type1Point1 + { + public string FirstName; + } + + public class DestType + { + public string FirstName; + public string MiddleName; + public string LastName; + public int Age; + } + + static int _done; + readonly ManualResetEvent _allDone = new ManualResetEvent(false); + + [Fact] + public void ShouldMapToNewISet() + { + const int threadCount = 13; + + for(int i = 0; i < threadCount; i++) + { + Task.Factory.StartNew(doMapping).ContinueWith( + a => + { + if(Interlocked.Increment(ref _done) == threadCount) + { + _allDone.Set(); + } + + }); + } + + _allDone.WaitOne(TimeSpan.FromSeconds(10)); + } + + static void doMapping() + { + var source = createSource(); + + Debug.WriteLine(@"Mapping {0} on thread {1}", source.GetType(), Thread.CurrentThread.ManagedThreadId); + + var config = new MapperConfiguration(cfg => cfg.CreateMap(source.GetType(), typeof(DestType))); + + DestType t2 = (DestType)config.CreateMapper().Map(source, source.GetType(), typeof(DestType)); + } + + static readonly Random _random = new Random(); + + static object createSource() + { + + int n = _random.Next(0, 4); + + if(n == 0) + { + return new Type1 + { + Age = 12, + FirstName = @"Fred", + LastName = @"Smith", + MiddleName = @"G" + }; + } + if(n == 1) + { + return new Type1Point1() + { + FirstName = @"Fred", + }; + + } + if(n == 2) + { + return new Type1Point2() + { + FirstName = @"Fred", + MiddleName = @"G" + }; + + } + if(n == 3) + { + return new Type1Point3() + { + FirstName = @"Fred", + LastName = @"Smith", + MiddleName = @"G" + }; + + } + + throw new Exception(); + } + } + + public class DynamicMapThreadingIssues + { + public class SomeDtoA + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeDtoB + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeDtoC + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeDtoD + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + [Fact] + public void Should_not_fail() + { + var config = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); + var mapper = config.CreateMapper(); + + var tasks = Enumerable.Range(0, 5).Select(index => + Task.Factory.StartNew(() => + { + if(index % 2 == 0) + { + mapper.Map(new SomeDtoA()); + mapper.Map(new SomeDtoC()); + } + else + { + mapper.Map(new SomeDtoB()); + mapper.Map(new SomeDtoD()); + } + })).ToArray(); + Task.WaitAll(tasks); + } + } + + public class ResolveTypeMapThreadingIssues + { + public class SomeDtoA + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeDtoB + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeDtoC : SomeDtoA + { + } + + public class SomeDtoD : SomeDtoB + { + } + + [Fact] + public void Should_not_fail() + { + var config = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); + var mapper = config.CreateMapper(); + + var tasks = Enumerable.Range(0, 5).Select(index => + Task.Factory.StartNew(() => + { + if(index % 2 == 0) + { + mapper.Map(new SomeDtoC()); + } + else + { + mapper.Map(new SomeDtoC()); + } + })).ToArray(); + Task.WaitAll(tasks); + } + } + + public class ResolveWithCreateMissingTypeMaps + { + public class SomeDtoA + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoB + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoC + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoD + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoE + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoF + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoG + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoH + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoI + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoJ + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoK + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoL + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoM + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoN + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoO + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoP + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeEntityA + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityB + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityC + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityD + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityE + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityF + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityG + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityH + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityI + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityJ + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityK + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityL + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityM + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityN + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityO + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityP + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + [Fact] + public void Should_work() + { + var c = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); + var types = new[]{ + new[] { typeof(SomeEntityA), typeof(SomeDtoA) }, + new[] { typeof(SomeEntityB), typeof(SomeDtoB) }, + new[] { typeof(SomeEntityC), typeof(SomeDtoC) }, + new[] { typeof(SomeEntityD), typeof(SomeDtoD) }, + new[] { typeof(SomeEntityE), typeof(SomeDtoE) }, + new[] { typeof(SomeEntityF), typeof(SomeDtoF) }, + new[] { typeof(SomeEntityG), typeof(SomeDtoG) }, + new[] { typeof(SomeEntityH), typeof(SomeDtoH) }, + new[] { typeof(SomeEntityI), typeof(SomeDtoI) }, + new[] { typeof(SomeEntityJ), typeof(SomeDtoJ) }, + new[] { typeof(SomeEntityK), typeof(SomeDtoK) }, + new[] { typeof(SomeEntityL), typeof(SomeDtoL) }, + new[] { typeof(SomeEntityM), typeof(SomeDtoM) }, + new[] { typeof(SomeEntityN), typeof(SomeDtoN) }, + new[] { typeof(SomeEntityO), typeof(SomeDtoO) }, + new[] { typeof(SomeEntityP), typeof(SomeDtoP) }, + }; + var tasks = + types + .Concat(types.Select(t=>t.Reverse().ToArray())) + .ToArray() + .Select(s => Task.Factory.StartNew(() => c.ResolveTypeMap(s[0], s[1]))) + .ToArray(); + Task.WaitAll(tasks); + } + } + + public class ResolveWithGenericMap + { + public class SomeDtoA + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoB + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoC + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoD + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoE + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoF + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoG + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoH + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoI + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoJ + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoK + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoL + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoM + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoN + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoO + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeDtoP + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string PropertyX { get; set; } + } + + public class SomeEntityA + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityB + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityC + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityD + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityE + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityF + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityG + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityH + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityI + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityJ + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityK + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityL + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityM + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityN + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityO + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class SomeEntityP + { + public string Property1 { get; set; } + public string Property21 { get; set; } + public string Property3 { get; set; } + public string Property4 { get; set; } + public string Property5 { get; set; } + public string Property6 { get; set; } + public string Property7 { get; set; } + public string Property8 { get; set; } + public string Property9 { get; set; } + public string Property10 { get; set; } + public string Property11 { get; set; } + } + + public class Entity + { + public T Data { get; set; } + } + + public class Dto + { + public T Data { get; set; } + public int Value { get; set; } + } + + [Fact] + public void Should_work() + { + var sourceType = typeof(Entity<>); + var destinationType = typeof(Dto<>); + var c = new MapperConfiguration(cfg => + { + cfg.CreateMap(sourceType, destinationType).ForMember("Value", o => o.Ignore()); + }); + var types = new[]{ + new[] { typeof(SomeEntityA), typeof(SomeDtoA) }, + new[] { typeof(SomeEntityB), typeof(SomeDtoB) }, + new[] { typeof(SomeEntityC), typeof(SomeDtoC) }, + new[] { typeof(SomeEntityD), typeof(SomeDtoD) }, + new[] { typeof(SomeEntityE), typeof(SomeDtoE) }, + new[] { typeof(SomeEntityF), typeof(SomeDtoF) }, + new[] { typeof(SomeEntityG), typeof(SomeDtoG) }, + new[] { typeof(SomeEntityH), typeof(SomeDtoH) }, + new[] { typeof(SomeEntityI), typeof(SomeDtoI) }, + new[] { typeof(SomeEntityJ), typeof(SomeDtoJ) }, + new[] { typeof(SomeEntityK), typeof(SomeDtoK) }, + new[] { typeof(SomeEntityL), typeof(SomeDtoL) }, + new[] { typeof(SomeEntityM), typeof(SomeDtoM) }, + new[] { typeof(SomeEntityN), typeof(SomeDtoN) }, + new[] { typeof(SomeEntityO), typeof(SomeDtoO) }, + new[] { typeof(SomeEntityP), typeof(SomeDtoP) }, + }; + var tasks = + types + .Concat(types.Select(t => t.Reverse().ToArray())) + .Select(t=>new { SourceType = sourceType.MakeGenericType(t[0]), DestinationType = destinationType.MakeGenericType(t[1]) }) + .ToArray() + .Select(s => Task.Factory.StartNew(() => c.ResolveTypeMap(s.SourceType, s.DestinationType))) + .ToArray(); + Task.WaitAll(tasks); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/MultidimensionalArrays.cs b/src/UnitTests/Bug/MultidimensionalArrays.cs index 61241df983..0d66768b8b 100644 --- a/src/UnitTests/Bug/MultidimensionalArrays.cs +++ b/src/UnitTests/Bug/MultidimensionalArrays.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using AutoMapper.Mappers; using System.Collections.Generic; using System; @@ -42,24 +42,24 @@ protected override void Because_of() [Fact] public void Should_map_multidimensional_array() { - _destination.GetLength(0).ShouldEqual(_source.GetLength(0)); - _destination.GetLength(1).ShouldEqual(_source.GetLength(1)); - _destination[0, 0].Value.ShouldEqual(SomeValue); - _destination[0, 2].Value.ShouldEqual(2); - _destination[1, 1].Value.ShouldEqual(11); - _destination[2, 0].Value.ShouldEqual(20); - _destination[3, 2].Value.ShouldEqual(SomeValue); + _destination.GetLength(0).ShouldBe(_source.GetLength(0)); + _destination.GetLength(1).ShouldBe(_source.GetLength(1)); + _destination[0, 0].Value.ShouldBe(SomeValue); + _destination[0, 2].Value.ShouldBe(2); + _destination[1, 1].Value.ShouldBe(11); + _destination[2, 0].Value.ShouldBe(20); + _destination[3, 2].Value.ShouldBe(SomeValue); } } public class FillMultidimensionalArray : SpecBase { int[,] _source; - MultidimensionalArrayFiller _filler; + MultidimensionalArrayMapper.MultidimensionalArrayFiller _filler; protected override void Establish_context() { _source = new int[4,3]; - _filler = new MultidimensionalArrayFiller(_source); + _filler = new MultidimensionalArrayMapper.MultidimensionalArrayFiller(_source); } protected override void Because_of() @@ -76,10 +76,10 @@ public void Should_set_values_in_array() int index = 0; foreach(var value in _source) { - value.ShouldEqual(index); + value.ShouldBe(index); index++; } - index.ShouldEqual(_source.Length); + index.ShouldBe(_source.Length); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/MultipleInterfaceInheritance.cs b/src/UnitTests/Bug/MultipleInterfaceInheritance.cs index 7871f9cefd..a0ff3f4881 100644 --- a/src/UnitTests/Bug/MultipleInterfaceInheritance.cs +++ b/src/UnitTests/Bug/MultipleInterfaceInheritance.cs @@ -1,54 +1,54 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class MultipleInterfaceInheritance : AutoMapperSpecBase - { - private ThingDto _thingDto; - - public class Thing - { - public IItem[] Items { get; set; } - } - - public class ThingDto - { - public ItemDto[] Items { get; set; } - } - - public class Item : IItem - { - } - - public class ItemDto - { - } - - public interface IItem : ISome // everything works well if IItem doesn't inherit ISome. - { - } - - public interface ISome - { - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var thing = new Thing { Items = new[] { new Item() } }; - _thingDto = Mapper.Map(thing); - } - - [Fact] - public void Should_map_successfully() - { - _thingDto.Items.Length.ShouldEqual(1); - } - } +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class MultipleInterfaceInheritance : AutoMapperSpecBase + { + private ThingDto _thingDto; + + public class Thing + { + public IItem[] Items { get; set; } + } + + public class ThingDto + { + public ItemDto[] Items { get; set; } + } + + public class Item : IItem + { + } + + public class ItemDto + { + } + + public interface IItem : ISome // everything works well if IItem doesn't inherit ISome. + { + } + + public interface ISome + { + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var thing = new Thing { Items = new[] { new Item() } }; + _thingDto = Mapper.Map(thing); + } + + [Fact] + public void Should_map_successfully() + { + _thingDto.Items.Length.ShouldBe(1); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/MultipleTypeConverterInterfaces.cs b/src/UnitTests/Bug/MultipleTypeConverterInterfaces.cs index 79f911249d..6c993bb0fb 100644 --- a/src/UnitTests/Bug/MultipleTypeConverterInterfaces.cs +++ b/src/UnitTests/Bug/MultipleTypeConverterInterfaces.cs @@ -1,74 +1,74 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class When_specifying_a_type_converter_implementing_multiple_type_converter_interfaces : AutoMapperSpecBase - { - private DestinationFoo _resultFoo; - private DestinationBar _resultBar; - - public class SourceFoo - { - public int SourceFooValue { get; set; } - } - - public class DestinationFoo - { - public int DestinationFooValue { get; set; } - } - public class SourceBar - { - public int SourceBarValue { get; set; } - } - - public class DestinationBar - { - public int DestinationBarValue { get; set; } - } - - public class DualConverter : ITypeConverter, - ITypeConverter - { - public DestinationFoo Convert(SourceFoo source, ResolutionContext context) - { - return new DestinationFoo { DestinationFooValue = source.SourceFooValue + 100 }; - } - - DestinationBar ITypeConverter.Convert(SourceBar source, ResolutionContext context) - { - return new DestinationBar { DestinationBarValue = source.SourceBarValue + 1000 }; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof (SourceFoo), typeof (DestinationFoo)).ConvertUsing(typeof (DualConverter)); - cfg.CreateMap(typeof (SourceBar), typeof (DestinationBar)).ConvertUsing(typeof (DualConverter)); - }); - - protected override void Because_of() - { - _resultFoo = Mapper.Map(new SourceFoo { SourceFooValue = 5 }); - _resultBar = Mapper.Map(new SourceBar { SourceBarValue = 6 }); - } - - [Fact] - public void Should_use_implicit_converter() - { - _resultFoo.DestinationFooValue.ShouldEqual(105); - } - - [Fact] - public void Should_use_explicit_converter() - { - _resultBar.DestinationBarValue.ShouldEqual(1006); - } - - [Fact] - public void Should_pass_configuration_validation() - { - Configuration.AssertConfigurationIsValid(); - } - } +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class When_specifying_a_type_converter_implementing_multiple_type_converter_interfaces : AutoMapperSpecBase + { + private DestinationFoo _resultFoo; + private DestinationBar _resultBar; + + public class SourceFoo + { + public int SourceFooValue { get; set; } + } + + public class DestinationFoo + { + public int DestinationFooValue { get; set; } + } + public class SourceBar + { + public int SourceBarValue { get; set; } + } + + public class DestinationBar + { + public int DestinationBarValue { get; set; } + } + + public class DualConverter : ITypeConverter, + ITypeConverter + { + public DestinationFoo Convert(SourceFoo source, DestinationFoo destination, ResolutionContext context) + { + return new DestinationFoo { DestinationFooValue = source.SourceFooValue + 100 }; + } + + DestinationBar ITypeConverter.Convert(SourceBar source, DestinationBar destination, ResolutionContext context) + { + return new DestinationBar { DestinationBarValue = source.SourceBarValue + 1000 }; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof (SourceFoo), typeof (DestinationFoo)).ConvertUsing(typeof (DualConverter)); + cfg.CreateMap(typeof (SourceBar), typeof (DestinationBar)).ConvertUsing(typeof (DualConverter)); + }); + + protected override void Because_of() + { + _resultFoo = Mapper.Map(new SourceFoo { SourceFooValue = 5 }); + _resultBar = Mapper.Map(new SourceBar { SourceBarValue = 6 }); + } + + [Fact] + public void Should_use_implicit_converter() + { + _resultFoo.DestinationFooValue.ShouldBe(105); + } + + [Fact] + public void Should_use_explicit_converter() + { + _resultBar.DestinationBarValue.ShouldBe(1006); + } + + [Fact] + public void Should_pass_configuration_validation() + { + Configuration.AssertConfigurationIsValid(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NamingConventions.cs b/src/UnitTests/Bug/NamingConventions.cs index b934649776..2252915cfc 100644 --- a/src/UnitTests/Bug/NamingConventions.cs +++ b/src/UnitTests/Bug/NamingConventions.cs @@ -1,70 +1,70 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - namespace NamingConventions - { - public class Neda - { - public string cmok { get; set; } - - public string moje_ime { get; set; } - - public string moje_prezime { get; set; } - - public string ja_se_zovem_imenom { get; set; } - - } - - public class Dario - { - public string cmok { get; set; } - - public string MojeIme { get; set; } - - public string MojePrezime { get; set; } - - public string JaSeZovemImenom { get; set; } - } - - public class When_mapping_with_lowercae_naming_conventions_two_ways_in_profiles : AutoMapperSpecBase - { - private Dario _dario; - private Neda _neda; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateProfile("MyMapperProfile", prf => - { - prf.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention(); - prf.CreateMap(); - }); - cfg.CreateProfile("MyMapperProfile2", prf => - { - prf.DestinationMemberNamingConvention = new LowerUnderscoreNamingConvention(); - prf.CreateMap(); - }); - }); - - protected override void Because_of() - { - _dario = Mapper.Map(new Neda {ja_se_zovem_imenom = "foo"}); - _neda = Mapper.Map(_dario); - } - - [Fact] - public void Should_map_from_lower_to_pascal() - { - _neda.ja_se_zovem_imenom.ShouldEqual("foo"); - } - - [Fact] - public void Should_map_from_pascal_to_lower() - { - _dario.JaSeZovemImenom.ShouldEqual("foo"); - } - } - - } +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + namespace NamingConventions + { + public class Neda + { + public string cmok { get; set; } + + public string moje_ime { get; set; } + + public string moje_prezime { get; set; } + + public string ja_se_zovem_imenom { get; set; } + + } + + public class Dario + { + public string cmok { get; set; } + + public string MojeIme { get; set; } + + public string MojePrezime { get; set; } + + public string JaSeZovemImenom { get; set; } + } + + public class When_mapping_with_lowercae_naming_conventions_two_ways_in_profiles : AutoMapperSpecBase + { + private Dario _dario; + private Neda _neda; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateProfile("MyMapperProfile", prf => + { + prf.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention(); + prf.CreateMap(); + }); + cfg.CreateProfile("MyMapperProfile2", prf => + { + prf.DestinationMemberNamingConvention = new LowerUnderscoreNamingConvention(); + prf.CreateMap(); + }); + }); + + protected override void Because_of() + { + _dario = Mapper.Map(new Neda {ja_se_zovem_imenom = "foo"}); + _neda = Mapper.Map(_dario); + } + + [Fact] + public void Should_map_from_lower_to_pascal() + { + _neda.ja_se_zovem_imenom.ShouldBe("foo"); + } + + [Fact] + public void Should_map_from_pascal_to_lower() + { + _dario.JaSeZovemImenom.ShouldBe("foo"); + } + } + + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NestedMappingProjectionsExplicitExpanding.cs b/src/UnitTests/Bug/NestedMappingProjectionsExplicitExpanding.cs index a46ba25e42..9ae2c45389 100644 --- a/src/UnitTests/Bug/NestedMappingProjectionsExplicitExpanding.cs +++ b/src/UnitTests/Bug/NestedMappingProjectionsExplicitExpanding.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using AutoMapper.QueryableExtensions; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -57,7 +57,7 @@ protected override void Because_of() [Fact] public void Should_map_nested_classes() { - _destination.Man.Chu.Prop.ShouldEqual(_propValue); + _destination.Man.Chu.Prop.ShouldBe(_propValue); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NonExistingProperty.cs b/src/UnitTests/Bug/NonExistingProperty.cs index 5ade6a65bd..ef1c384828 100644 --- a/src/UnitTests/Bug/NonExistingProperty.cs +++ b/src/UnitTests/Bug/NonExistingProperty.cs @@ -1,5 +1,5 @@ using System; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug diff --git a/src/UnitTests/Bug/NullArrayBug.cs b/src/UnitTests/Bug/NullArrayBug.cs index 27cb73b356..bb2f1fd5f6 100644 --- a/src/UnitTests/Bug/NullArrayBug.cs +++ b/src/UnitTests/Bug/NullArrayBug.cs @@ -1,49 +1,49 @@ -namespace AutoMapper.UnitTests.Bug -{ - using Should; - using Xunit; - - public class NullArrayBug : AutoMapperSpecBase - { - private static Source _source; - private Destination _destination; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullCollections = false; - cfg.CreateMap(); - - _source = new Source {Name = null, Data = null}; - }); - - protected override void Because_of() - { - _destination = Mapper.Map(_source); - } - - [Fact] - public void Should_map_name_to_null() - { - _destination.Name.ShouldBeNull(); - } - - [Fact] - public void Should_map_null_array_to_empty() - { - _destination.Data.ShouldNotBeNull(); - _destination.Data.ShouldBeEmpty(); - } - - public class Source - { - public string Name { get; set; } - public string[] Data { get; set; } - } - - public class Destination - { - public string Name { get; set; } - public string[] Data { get; set; } - } - } +namespace AutoMapper.UnitTests.Bug +{ + using Shouldly; + using Xunit; + + public class NullArrayBug : AutoMapperSpecBase + { + private static Source _source; + private Destination _destination; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullCollections = false; + cfg.CreateMap(); + + _source = new Source {Name = null, Data = null}; + }); + + protected override void Because_of() + { + _destination = Mapper.Map(_source); + } + + [Fact] + public void Should_map_name_to_null() + { + _destination.Name.ShouldBeNull(); + } + + [Fact] + public void Should_map_null_array_to_empty() + { + _destination.Data.ShouldNotBeNull(); + _destination.Data.ShouldBeEmpty(); + } + + public class Source + { + public string Name { get; set; } + public string[] Data { get; set; } + } + + public class Destination + { + public string Name { get; set; } + public string[] Data { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullConstructorParameterName.cs b/src/UnitTests/Bug/NullConstructorParameterName.cs new file mode 100644 index 0000000000..59b549d7dc --- /dev/null +++ b/src/UnitTests/Bug/NullConstructorParameterName.cs @@ -0,0 +1,42 @@ +using System; +using System.Reflection; +using System.Reflection.Emit; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ +#if NET461 + public class NullConstructorParameterName + { + [Fact] + public void ShouldBeSkipped() + { + var proxy = CreateDynamicObject(); + var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(ResourcePointDTO), proxy.GetType())); + } + + public class ResourcePointDTO { } + + object CreateDynamicObject() + { + var assemblyName = new AssemblyName("TestClass"); + AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run); + ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule"); + TypeBuilder typeBuilder = moduleBuilder.DefineType(assemblyName.FullName + , TypeAttributes.Public | + TypeAttributes.Class | + TypeAttributes.AutoClass | + TypeAttributes.AnsiClass | + TypeAttributes.BeforeFieldInit | + TypeAttributes.AutoLayout + , null); + typeBuilder.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName); + var cBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, CallingConventions.Standard, new []{ typeof(int) }); + ILGenerator myConstructorIL = cBuilder.GetILGenerator(); + myConstructorIL.Emit(OpCodes.Ret); + var type = typeBuilder.CreateType(); + return Activator.CreateInstance(type); + } + } +#endif +} diff --git a/src/UnitTests/Bug/NullSubstituteInnerClass.cs b/src/UnitTests/Bug/NullSubstituteInnerClass.cs new file mode 100644 index 0000000000..bacb0e666a --- /dev/null +++ b/src/UnitTests/Bug/NullSubstituteInnerClass.cs @@ -0,0 +1,56 @@ +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullSubstituteInnerClass : AutoMapperSpecBase + { + private FooDto _destination; + + public class Foo + { + public int Id { get; set; } + public Bar Bar { get; set; } + } + + public class Bar + { + public string Name { get; set; } + } + + + public class FooDto + { + public int Id { get; set; } + public BarDto Bar { get; set; } + } + + public class BarDto + { + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(dest => dest.Bar, opts => opts.NullSubstitute(new Bar())); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Foo() + { + Id = 5, + Bar = null + }); + } + + [Fact] + public void Should_map_int_to_nullable_decimal() + { + _destination.Bar.ShouldNotBeNull(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/NullSubstituteType.cs b/src/UnitTests/Bug/NullSubstituteType.cs index 568048ac12..e6efcc1930 100644 --- a/src/UnitTests/Bug/NullSubstituteType.cs +++ b/src/UnitTests/Bug/NullSubstituteType.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -30,7 +30,7 @@ protected override void Because_of() [Fact] public void Should_substitute_zero_for_null() { - _destination.Number.ShouldEqual(0); + _destination.Number.ShouldBe(0); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullToString.cs b/src/UnitTests/Bug/NullToString.cs new file mode 100644 index 0000000000..1b986a8f0e --- /dev/null +++ b/src/UnitTests/Bug/NullToString.cs @@ -0,0 +1,39 @@ +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullToString : AutoMapperSpecBase + { + private Destination _destination; + + class Source + { + public InnerSource Inner { get; set; } + } + class InnerSource + { + } + class Destination + { + public string Inner { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_int_to_nullable_decimal() + { + _destination.Inner.ShouldBeNull(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableBytesAndEnums.cs b/src/UnitTests/Bug/NullableBytesAndEnums.cs index acc257b721..f965f43ac9 100644 --- a/src/UnitTests/Bug/NullableBytesAndEnums.cs +++ b/src/UnitTests/Bug/NullableBytesAndEnums.cs @@ -1,73 +1,110 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class NullableBytesAndEnums : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public byte? Value { get; set; } - } - - public enum Foo : byte - { - Blarg = 1, - Splorg = 2 - } - - public class Destination - { - public Foo? Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Value = 2}); - } - - [Fact] - public void Should_map_the_byte_to_the_enum_with_the_same_value() - { - _destination.Value.ShouldEqual(Foo.Splorg); - } - } - - public class NullableLong : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public long? Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Value = 2 }); - } - - [Fact] - public void Should_map_the_byte_to_the_enum_with_the_same_value() - { - _destination.Value.ShouldEqual(2); - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableBytesAndEnums : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public byte? Value { get; set; } + } + + public enum Foo : byte + { + Blarg = 1, + Splorg = 2 + } + + public class Destination + { + public Foo? Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Value = 2}); + } + + [Fact] + public void Should_map_the_byte_to_the_enum_with_the_same_value() + { + _destination.Value.ShouldBe(Foo.Splorg); + } + } + + public class NullableLong : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public long? Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Value = 2 }); + } + + [Fact] + public void Should_map_the_byte_to_the_enum_with_the_same_value() + { + _destination.Value.ShouldBe(2); + } + } + + public class NullableShortWithCustomMapFrom : AutoMapperSpecBase + { + public class Source + { + public short Value { get; set; } + } + + public class Destination + { + public short? Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(t => t.Value, opts => opts.MapFrom(s => s.Value > 0 ? s.Value : default(short?))); + }); + + protected override void Because_of() + { + } + + [Fact] + public void Should_map_the_value() + { + var destination = Mapper.Map(new Source { Value = 2 }); + destination.Value.ShouldBe((short)2); + } + + [Fact] + public void Should_map_the_value_with_condition() + { + var destination = Mapper.Map(new Source { Value = 0 }); + destination.Value.ShouldBeNull(); + } + } +} diff --git a/src/UnitTests/Bug/NullableConverterBug.cs b/src/UnitTests/Bug/NullableConverterBug.cs index 43cfbfda0b..aca5532a6e 100644 --- a/src/UnitTests/Bug/NullableConverterBug.cs +++ b/src/UnitTests/Bug/NullableConverterBug.cs @@ -1,72 +1,72 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - namespace NullableConverterBug - { - namespace AutoMapperIssue - { - using System; - using System.Collections.Generic; - using AutoMapper; - public class TestProblem - { - [Fact] - public void Example() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ConvertUsing(); - - cfg.CreateMap() - .ConvertUsing(); - }); - - var guids = new List() - { - 1, - 2, - null - }; - - var result = config.CreateMapper().Map>(guids); - - result[2].ShouldBeNull(); - } - } - - public class IntToEntityConverter : ITypeConverter - { - public Entity Convert(int source, ResolutionContext context) - { - return new Entity() { Id = source }; - } - } - - public class NullableIntToEntityConverter : ITypeConverter - { - public Entity Convert(int? source, ResolutionContext context) - { - if (source.HasValue) - { - return new Entity() { Id = source.Value }; - } - - return null; - } - } - - public class Entity - { - public int Id { get; set; } - - public override string ToString() - { - return Id.ToString(); - } - } - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + namespace NullableConverterBug + { + namespace AutoMapperIssue + { + using System; + using System.Collections.Generic; + using AutoMapper; + public class TestProblem + { + [Fact] + public void Example() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ConvertUsing(); + + cfg.CreateMap() + .ConvertUsing(); + }); + + var guids = new List() + { + 1, + 2, + null + }; + + var result = config.CreateMapper().Map>(guids); + + result[2].ShouldBeNull(); + } + } + + public class IntToEntityConverter : ITypeConverter + { + public Entity Convert(int source, Entity destination, ResolutionContext context) + { + return new Entity() { Id = source }; + } + } + + public class NullableIntToEntityConverter : ITypeConverter + { + public Entity Convert(int? source, Entity destination, ResolutionContext context) + { + if (source.HasValue) + { + return new Entity() { Id = source.Value }; + } + + return null; + } + } + + public class Entity + { + public int Id { get; set; } + + public override string ToString() + { + return Id.ToString(); + } + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableDateTime.cs b/src/UnitTests/Bug/NullableDateTime.cs index c0ebdb615f..579b07920c 100644 --- a/src/UnitTests/Bug/NullableDateTime.cs +++ b/src/UnitTests/Bug/NullableDateTime.cs @@ -1,10 +1,73 @@ using System; -using Should; +using System.Linq; +using Shouldly; using AutoMapper; using Xunit; namespace AutoMapper.UnitTests.Bug { + public class NullableDateTimeMapFromArray : AutoMapperSpecBase + { + public class Source + { + public SourceInner[] Bars { get; set; } + } + + public class SourceInner + { + public DateTime Bar { get; set; } + } + + public class Destination + { + public DateTime? Foo { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(m => m.Foo, opt => + { + opt.Condition(src => src.Bars != null && src.Bars.Length > 0); + opt.MapFrom(src => src.Bars.Min(b => b.Bar)); + }); + }); + } + + public class FromDateToNullableDateTime : AutoMapperSpecBase + { + Destination _destination; + DateTime _date = new DateTime(1900, 1, 1); + + public class Source + { + public DateTime? FiredDate { get; set; } + public DateTime HiredDate { get; set; } + } + + public class Destination + { + public DateTime? FiredDate { get; set; } + public DateTime HiredDate { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.FiredDate, o => o.MapFrom(s => s.HiredDate.Date)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { HiredDate = _date }); + } + + [Fact] + public void Should_map_as_usual() + { + _destination.FiredDate.ShouldBe(_date.Date); + } + } + public class NullableDateTime : AutoMapperSpecBase { Destination _destination; @@ -35,7 +98,7 @@ protected override void Because_of() [Fact] public void Should_map_as_usual() { - _destination.Value.ShouldEqual(_date); + _destination.Value.ShouldBe(_date); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableEnumToNullableValueType.cs b/src/UnitTests/Bug/NullableEnumToNullableValueType.cs index 9958f07133..fbfb31a3b5 100644 --- a/src/UnitTests/Bug/NullableEnumToNullableValueType.cs +++ b/src/UnitTests/Bug/NullableEnumToNullableValueType.cs @@ -1,42 +1,42 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class NullableEnumToNullableValueType - { - public class CannotConvertEnumToNullableWhenPassedNull : AutoMapperSpecBase - { - public enum DummyTypes : int - { - Foo = 1, - Bar = 2 - } - - public class DummySource - { - public DummyTypes? Dummy { get; set; } - } - - public class DummyDestination - { - public int? Dummy { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_map_null_enum_to_nullable_base_type() - { - DummySource src = new DummySource() { Dummy = null }; - - var destination = Mapper.Map(src); - - destination.Dummy.ShouldBeNull(); - } - } - } +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableEnumToNullableValueType + { + public class CannotConvertEnumToNullableWhenPassedNull : AutoMapperSpecBase + { + public enum DummyTypes : int + { + Foo = 1, + Bar = 2 + } + + public class DummySource + { + public DummyTypes? Dummy { get; set; } + } + + public class DummyDestination + { + public int? Dummy { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_null_enum_to_nullable_base_type() + { + DummySource src = new DummySource() { Dummy = null }; + + var destination = Mapper.Map(src); + + destination.Dummy.ShouldBeNull(); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableEnums.cs b/src/UnitTests/Bug/NullableEnums.cs index 9d9dcd6e51..49d32253b5 100644 --- a/src/UnitTests/Bug/NullableEnums.cs +++ b/src/UnitTests/Bug/NullableEnums.cs @@ -1,26 +1,26 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class NullableEnums : AutoMapperSpecBase - { - public class Src { public EnumType? A { get; set; } } - public class Dst { public EnumType? A { get; set; } } - - public enum EnumType { One, Two } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void TestNullableEnum() - { - var d = Mapper.Map(new Src { A = null }, new Dst { A = EnumType.One }); - - d.A.ShouldBeNull(); - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableEnums : AutoMapperSpecBase + { + public class Src { public EnumType? A { get; set; } } + public class Dst { public EnumType? A { get; set; } } + + public enum EnumType { One, Two } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void TestNullableEnum() + { + var d = Mapper.Map(new Src { A = null }, new Dst { A = EnumType.One }); + + d.A.ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableIntToNullableDecimal.cs b/src/UnitTests/Bug/NullableIntToNullableDecimal.cs new file mode 100644 index 0000000000..c4d18aa2ae --- /dev/null +++ b/src/UnitTests/Bug/NullableIntToNullableDecimal.cs @@ -0,0 +1,73 @@ +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableIntToNullableDecimal : AutoMapperSpecBase + { + private Destination _destination; + + class Source + { + public int? Number { get; set; } + } + class Destination + { + public decimal? Number { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source + { + Number = 23 + }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_int_to_nullable_decimal() + { + _destination.Number.ShouldBe(23); + } + } + + public class NullNullableIntToNullableDecimal : AutoMapperSpecBase + { + private Destination _destination; + + class Source + { + public int? Number { get; set; } + } + class Destination + { + public decimal? Number { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source + { + }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_int_to_nullable_decimal() + { + _destination.Number.ShouldBeNull(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableIntToNullableEnum.cs b/src/UnitTests/Bug/NullableIntToNullableEnum.cs index 14539337d4..38ae512690 100644 --- a/src/UnitTests/Bug/NullableIntToNullableEnum.cs +++ b/src/UnitTests/Bug/NullableIntToNullableEnum.cs @@ -1,5 +1,5 @@ using System; -using Should; +using Shouldly; using AutoMapper; using Xunit; diff --git a/src/UnitTests/Bug/NullablePropertiesBug.cs b/src/UnitTests/Bug/NullablePropertiesBug.cs index 430182962b..0f742e70ea 100644 --- a/src/UnitTests/Bug/NullablePropertiesBug.cs +++ b/src/UnitTests/Bug/NullablePropertiesBug.cs @@ -1,22 +1,22 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class NullablePropertiesBug - { - public class Source { public int? A { get; set; } } - public class Target { public int? A { get; set; } } - - [Fact] - public void Example() - { - - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var d = config.CreateMapper().Map(new Source { A = null }, new Target { A = 10 }); - - d.A.ShouldBeNull(); - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullablePropertiesBug + { + public class Source { public int? A { get; set; } } + public class Target { public int? A { get; set; } } + + [Fact] + public void Example() + { + + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var d = config.CreateMapper().Map(new Source { A = null }, new Target { A = 10 }); + + d.A.ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/NullableResolveUsing.cs b/src/UnitTests/Bug/NullableResolveUsing.cs index d966059447..748b3775df 100644 --- a/src/UnitTests/Bug/NullableResolveUsing.cs +++ b/src/UnitTests/Bug/NullableResolveUsing.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -19,7 +19,7 @@ class Destination protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { - cfg.CreateMap().ForMember(d=>d.OddNumber, o=>o.ResolveUsing(s=>s.Number)); + cfg.CreateMap().ForMember(d => d.OddNumber, o => o.MapFrom(s => s.Number)); }); protected override void Because_of() diff --git a/src/UnitTests/Bug/NullableToInvalid.cs b/src/UnitTests/Bug/NullableToInvalid.cs new file mode 100644 index 0000000000..d54f98f17f --- /dev/null +++ b/src/UnitTests/Bug/NullableToInvalid.cs @@ -0,0 +1,35 @@ +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableToInvalid : NonValidatingSpecBase + { + public class Source + { + public int? Value { get; set; } + } + + public class Destination + { + public SomeObject Value { get; set; } + } + + public class SomeObject + { + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMissingTypeMaps = false; + }); + + [Fact] + public void Should_not_validate() + { + new Action(Configuration.AssertConfigurationIsValid).ShouldThrow(); + } + } +} diff --git a/src/UnitTests/Bug/NullableUntypedMapFrom.cs b/src/UnitTests/Bug/NullableUntypedMapFrom.cs new file mode 100644 index 0000000000..635f10a3ee --- /dev/null +++ b/src/UnitTests/Bug/NullableUntypedMapFrom.cs @@ -0,0 +1,35 @@ +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class NullableUntypedMapFrom : AutoMapperSpecBase + { + private Destination _destination; + + class Source + { + public decimal? Number { get; set; } + } + class Destination + { + public decimal? OddNumber { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.OddNumber, o => o.MapFrom(s => (object)s.Number)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Number = 12 }); + } + + [Fact] + public void Should_map_nullable_decimal() + { + _destination.OddNumber.ShouldBe(12); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/ObjectEnumToObjectEnum.cs b/src/UnitTests/Bug/ObjectEnumToObjectEnum.cs index fd5b17ad47..ee989222bf 100644 --- a/src/UnitTests/Bug/ObjectEnumToObjectEnum.cs +++ b/src/UnitTests/Bug/ObjectEnumToObjectEnum.cs @@ -1,5 +1,5 @@ using System; -using Should; +using Shouldly; using AutoMapper.Mappers; using Xunit; @@ -45,7 +45,7 @@ protected override void Because_of() [Fact] public void Should_be_enum() { - _target.Value.ShouldBeType(); + _target.Value.ShouldBeOfType(); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ObjectTypeMapFailure.cs b/src/UnitTests/Bug/ObjectTypeMapFailure.cs index 5d4af43064..fd4b2ee80f 100644 --- a/src/UnitTests/Bug/ObjectTypeMapFailure.cs +++ b/src/UnitTests/Bug/ObjectTypeMapFailure.cs @@ -1,37 +1,37 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class ObjectTypeMapFailure : SpecBase - { - [Fact] - public void Should_map_the_object_type() - { - var displayModel = new DisplayModel - { - Radius = 300 - }; - object vm = new SomeViewModel(); - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var mapper = config.CreateMapper(); - mapper.Map(displayModel, vm); - ((SomeViewModel)vm).Radius.ShouldEqual(300); // fails - - var vm2 = new SomeViewModel(); - mapper.Map(displayModel, vm2); - vm2.Radius.ShouldEqual(300); // succeeds - } - - public class SomeViewModel - { - public int Radius { get; set; } - } - - public class DisplayModel - { - public int Radius { get; set; } - } - } -} +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class ObjectTypeMapFailure : SpecBase + { + [Fact] + public void Should_map_the_object_type() + { + var displayModel = new DisplayModel + { + Radius = 300 + }; + object vm = new SomeViewModel(); + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var mapper = config.CreateMapper(); + mapper.Map(displayModel, vm); + ((SomeViewModel)vm).Radius.ShouldBe(300); // fails + + var vm2 = new SomeViewModel(); + mapper.Map(displayModel, vm2); + vm2.Radius.ShouldBe(300); // succeeds + } + + public class SomeViewModel + { + public int Radius { get; set; } + } + + public class DisplayModel + { + public int Radius { get; set; } + } + } +} diff --git a/src/UnitTests/Bug/OneSourceWithMultipleDestinationsAndPreserveReferences.cs b/src/UnitTests/Bug/OneSourceWithMultipleDestinationsAndPreserveReferences.cs new file mode 100644 index 0000000000..a48b0769ce --- /dev/null +++ b/src/UnitTests/Bug/OneSourceWithMultipleDestinationsAndPreserveReferences.cs @@ -0,0 +1,43 @@ +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class OneSourceWithMultipleDestinationsAndPreserveReferences : AutoMapperSpecBase + { + ClientModel _destination; + + public partial class Client + { + public string Address1 { get; set; } + } + public class AddressModel + { + public string Address1 { get; set; } + } + public class ClientModel + { + public AddressModel Address { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(mapConfig => + { + mapConfig.CreateMap() + .ForMember(m => m.Address, opt => opt.MapFrom(x => x)) + .PreserveReferences(); + mapConfig.CreateMap() + .PreserveReferences(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Client { Address1 = "abc" }); + } + + [Fact] + public void Should_map_ok() + { + _destination.Address.Address1.ShouldBe("abc"); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/OneSourceWithMultipleDestinationsWithoutPR.cs b/src/UnitTests/Bug/OneSourceWithMultipleDestinationsWithoutPR.cs new file mode 100644 index 0000000000..c038d01bdd --- /dev/null +++ b/src/UnitTests/Bug/OneSourceWithMultipleDestinationsWithoutPR.cs @@ -0,0 +1,41 @@ +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class OneSourceWithMultipleDestinationsWithoutPR : AutoMapperSpecBase + { + ClientModel _destination; + + public partial class Client + { + public string Address1 { get; set; } + } + public class AddressModel + { + public string Address1 { get; set; } + } + public class ClientModel + { + public AddressModel Address { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(mapConfig => + { + mapConfig.CreateMap() + .ForMember(m => m.Address, opt => opt.MapFrom(x => x)); + mapConfig.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Client { Address1 = "abc" }); + } + + [Fact] + public void Should_map_ok() + { + _destination.Address.Address1.ShouldBe("abc"); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/ParentChildResolversBug.cs b/src/UnitTests/Bug/ParentChildResolversBug.cs index 6465207642..a28dbc4ed0 100644 --- a/src/UnitTests/Bug/ParentChildResolversBug.cs +++ b/src/UnitTests/Bug/ParentChildResolversBug.cs @@ -1,109 +1,109 @@ -namespace AutoMapper.UnitTests.Bug -{ - namespace ParentChildResolversBug - { - using Should; - using Xunit; - - public enum DestEnum - { - a, - b, - c, - } - - public enum ParentDestEnum - { - d, - e, - f - } - - public class ParentDest - { - public ParentDestEnum? field - { - get; - set; - } - } - - public class Dest : ParentDest - { - public new DestEnum? field - { - get; - set; - } - } - - public class Source - { - public string fieldCode - { - get; - set; - } - } - - - public class ParentResolver : IValueResolver - { - public ParentDestEnum? Resolve(Source source, ResolutionContext context) - { - switch (source.fieldCode) - { - case "testa": return ParentDestEnum.d; - case "testb": return ParentDestEnum.e; - case "testc": return ParentDestEnum.f; - default: return null; - } - } - } - - public class Resolver : IValueResolver - { - public DestEnum? Resolve(Source source, ResolutionContext context) - { - switch (source.fieldCode) - { - case "testa": return DestEnum.a; - case "testb": return DestEnum.b; - case "testc": return DestEnum.c; - default: return null; - } - } - } - - public class ParentChildResolverTests : AutoMapperSpecBase - { - private Dest _dest; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.field, opt => opt.ResolveUsing()) - .Include(); - - cfg.CreateMap() - .ForMember(dest => dest.field, opt => opt.ResolveUsing()); - }); - - protected override void Because_of() - { - var source = new Source() - { - fieldCode = "testa" - }; - - _dest = Mapper.Map(source); - } - - [Fact] - public void Should_use_correct_resolver() - { - _dest.field.ShouldEqual(DestEnum.a); - } - } - } +namespace AutoMapper.UnitTests.Bug +{ + namespace ParentChildResolversBug + { + using Shouldly; + using Xunit; + + public enum DestEnum + { + a, + b, + c, + } + + public enum ParentDestEnum + { + d, + e, + f + } + + public class ParentDest + { + public ParentDestEnum? field + { + get; + set; + } + } + + public class Dest : ParentDest + { + public new DestEnum? field + { + get; + set; + } + } + + public class Source + { + public string fieldCode + { + get; + set; + } + } + + + public class ParentResolver : IValueResolver + { + public ParentDestEnum? Resolve(Source source, ParentDest dest, ParentDestEnum? destMember, ResolutionContext context) + { + switch (source.fieldCode) + { + case "testa": return ParentDestEnum.d; + case "testb": return ParentDestEnum.e; + case "testc": return ParentDestEnum.f; + default: return null; + } + } + } + + public class Resolver : IValueResolver + { + public DestEnum? Resolve(Source source, ParentDest dest, DestEnum? destMember, ResolutionContext context) + { + switch (source.fieldCode) + { + case "testa": return DestEnum.a; + case "testb": return DestEnum.b; + case "testc": return DestEnum.c; + default: return null; + } + } + } + + public class ParentChildResolverTests : AutoMapperSpecBase + { + private Dest _dest; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.field, opt => opt.MapFrom()) + .Include(); + + cfg.CreateMap() + .ForMember(dest => dest.field, opt => opt.MapFrom()); + }); + + protected override void Because_of() + { + var source = new Source() + { + fieldCode = "testa" + }; + + _dest = Mapper.Map(source); + } + + [Fact] + public void Should_use_correct_resolver() + { + _dest.field.ShouldBe(DestEnum.a); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/PreserveReferencesSameDestination.cs b/src/UnitTests/Bug/PreserveReferencesSameDestination.cs new file mode 100644 index 0000000000..b44ac3eda6 --- /dev/null +++ b/src/UnitTests/Bug/PreserveReferencesSameDestination.cs @@ -0,0 +1,92 @@ +using Xunit; +using Shouldly; +using System; +using System.Linq; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class Self_referencing_existing_destination : AutoMapperSpecBase + { + public class BaseType + { + public BaseType() + { + SelfReference = this; + } + public BaseType SelfReference { get; set; } + } + + public class BaseTypeDto + { + public BaseTypeDto() + { + SelfReference = this; + } + public BaseTypeDto SelfReference { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> cfg.CreateMap().PreserveReferences()); + + protected override void Because_of() + { + var baseType = new BaseType(); + var baseTypeDto = new BaseTypeDto(); + + Mapper.Map(baseType, baseTypeDto); + } + } + + public class PreserveReferencesSameDestination : AutoMapperSpecBase + { + public class DtoOne + { + public DtoTwo Two { get; set; } + } + + public class DtoTwo + { + public virtual ICollection Ones { get; set; } + } + + public class DtoThree + { + public int Id { get; set; } + } + + public class EntityOne + { + public int Id { get; set; } + public EntityTwo Two { get; set; } + } + + public class EntityTwo + { + public virtual ICollection Ones { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().PreserveReferences(); + cfg.CreateMap().PreserveReferences(); + cfg.CreateMap().PreserveReferences(); + }); + + [Fact] + public void Should_use_the_right_map() + { + var source = + new EntityOne { + Two = new EntityTwo { + Ones = new List { + new EntityOne { + Two = new EntityTwo { Ones = new List() } + } + } + } + }; + Mapper.Map(source).ShouldBeOfType(); + Mapper.Map(source).ShouldBeOfType(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/ProjectCollectionsBug.cs b/src/UnitTests/Bug/ProjectCollectionsBug.cs index caf32bb573..0417c2fd72 100644 --- a/src/UnitTests/Bug/ProjectCollectionsBug.cs +++ b/src/UnitTests/Bug/ProjectCollectionsBug.cs @@ -1,70 +1,70 @@ -namespace AutoMapper.UnitTests.Bug -{ - using System.Collections.Generic; - - namespace ProjectCollectionsBug - { - using System; - using System.Linq; - using QueryableExtensions; - using Xunit; - - public class A - { - public int AP1 { get; set; } - public string AP2 { get; set; } - } - - public class B - { - public B() - { - BP2 = new HashSet(); - } - public int BP1 { get; set; } - public ICollection BP2 { get; set; } - } - - public class AEntity - { - public int AP1 { get; set; } - public string AP2 { get; set; } - } - - public class BEntity - { - public BEntity() - { - BP2 = new HashSet(); - } - public int BP1 { get; set; } - public ICollection BP2 { get; set; } - } - - public class Bug - { - [Fact] - public void Should_not_throw_exception() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - //config.AssertConfigurationIsValid(); - - var be = new BEntity(); - be.BP1 = 3; - be.BP2.Add(new AEntity() { AP1 = 1, AP2 = "hello" }); - be.BP2.Add(new AEntity() { AP1 = 2, AP2 = "two" }); - - var b = config.CreateMapper().Map(be); - - var belist = new List(); - belist.Add(be); - IQueryable bei = belist.AsQueryable(); - typeof(Exception).ShouldNotBeThrownBy(() => bei.ProjectTo(config)); - } - } - } +namespace AutoMapper.UnitTests.Bug +{ + using System.Collections.Generic; + + namespace ProjectCollectionsBug + { + using System; + using System.Linq; + using QueryableExtensions; + using Xunit; + + public class A + { + public int AP1 { get; set; } + public string AP2 { get; set; } + } + + public class B + { + public B() + { + BP2 = new HashSet(); + } + public int BP1 { get; set; } + public ICollection BP2 { get; set; } + } + + public class AEntity + { + public int AP1 { get; set; } + public string AP2 { get; set; } + } + + public class BEntity + { + public BEntity() + { + BP2 = new HashSet(); + } + public int BP1 { get; set; } + public ICollection BP2 { get; set; } + } + + public class Bug + { + [Fact] + public void Should_not_throw_exception() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + //config.AssertConfigurationIsValid(); + + var be = new BEntity(); + be.BP1 = 3; + be.BP2.Add(new AEntity() { AP1 = 1, AP2 = "hello" }); + be.BP2.Add(new AEntity() { AP1 = 2, AP2 = "two" }); + + var b = config.CreateMapper().Map(be); + + var belist = new List(); + belist.Add(be); + IQueryable bei = belist.AsQueryable(); + typeof(Exception).ShouldNotBeThrownBy(() => bei.ProjectTo(config)); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ProjectConstructorParameters.cs b/src/UnitTests/Bug/ProjectConstructorParameters.cs index 63f40d4355..0f2fc0d5df 100644 --- a/src/UnitTests/Bug/ProjectConstructorParameters.cs +++ b/src/UnitTests/Bug/ProjectConstructorParameters.cs @@ -1,6 +1,6 @@ using System.Linq; using AutoMapper.QueryableExtensions; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -51,7 +51,7 @@ protected override void Because_of() [Fact] public void Should_project_constructor_parameter_mappings() { - _dest.Value.ShouldEqual(SomeValue); + _dest.Value.ShouldBe(SomeValue); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ProjectUsingTheQueriedEntity.cs b/src/UnitTests/Bug/ProjectUsingTheQueriedEntity.cs index 096fc1e05f..f12a38fd79 100644 --- a/src/UnitTests/Bug/ProjectUsingTheQueriedEntity.cs +++ b/src/UnitTests/Bug/ProjectUsingTheQueriedEntity.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using System.Linq; using AutoMapper.QueryableExtensions; @@ -21,7 +21,7 @@ class Destination protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { - cfg.CreateMap().ProjectUsing(s => new Destination {Number = 23 + s.Number}); + cfg.CreateMap().ConvertUsing(s => new Destination {Number = 23 + s.Number}); }); protected override void Because_of() @@ -32,7 +32,7 @@ protected override void Because_of() [Fact] public void Should_handle_projectusing_with_the_queried_entity() { - _destination.Number.ShouldEqual(23); + _destination.Number.ShouldBe(23); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/PropertyNamedType.cs b/src/UnitTests/Bug/PropertyNamedType.cs index 4668d1d49b..efa2f1c4a0 100644 --- a/src/UnitTests/Bug/PropertyNamedType.cs +++ b/src/UnitTests/Bug/PropertyNamedType.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -19,8 +19,8 @@ class Destination public void Should_detect_unmapped_destination_property_named_type() { var config = new MapperConfiguration(c=>c.CreateMap()); - new Action(config.AssertConfigurationIsValid).ShouldThrow( - ex=>ex.Errors[0].UnmappedPropertyNames[0].ShouldEqual("Type")); + new Action(config.AssertConfigurationIsValid).ShouldThrowException( + ex=>ex.Errors[0].UnmappedPropertyNames[0].ShouldBe("Type")); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ReadOnlyCollectionMappingBug.cs b/src/UnitTests/Bug/ReadOnlyCollectionMappingBug.cs index f005983c37..5b99a425a8 100644 --- a/src/UnitTests/Bug/ReadOnlyCollectionMappingBug.cs +++ b/src/UnitTests/Bug/ReadOnlyCollectionMappingBug.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -20,8 +20,8 @@ public void Example() var source = new List { new Source { X = 42 } }; var target = config.CreateMapper().Map>(source); - target.Count.ShouldEqual(source.Count); - target[0].X.ShouldEqual(source[0].X); + target.Count.ShouldBe(source.Count); + target[0].X.ShouldBe(source[0].X); } } } diff --git a/src/UnitTests/Bug/ReadOnlyFieldMappingBug.cs b/src/UnitTests/Bug/ReadOnlyFieldMappingBug.cs index 71d5950227..5b52b95421 100644 --- a/src/UnitTests/Bug/ReadOnlyFieldMappingBug.cs +++ b/src/UnitTests/Bug/ReadOnlyFieldMappingBug.cs @@ -1,4 +1,4 @@ -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -33,7 +33,7 @@ public void Should_map_over_constructor() var dest = Mapper.Map(source); - dest.Value.ShouldEqual(source.Value); + dest.Value.ShouldBe(source.Value); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/RecognizeDestinationPostfixes.cs b/src/UnitTests/Bug/RecognizeDestinationPostfixes.cs new file mode 100644 index 0000000000..6839ff9bbe --- /dev/null +++ b/src/UnitTests/Bug/RecognizeDestinationPostfixes.cs @@ -0,0 +1,36 @@ +using Shouldly; +using System; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class RecognizeDestinationPostfixes : AutoMapperSpecBase + { + class Person + { + public int Age { get; set; } + public int Age2 => 2017 - Birthday.Year; + public DateTime Birthday { get; set; } + public string Name { get; set; } + } + + class PersonDto + { + public int AgeV { get; set; } + public string NameV { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.RecognizeDestinationPostfixes("V"); + cfg.CreateMap().ForMember("AgeV", m => m.MapFrom("Age2")); + }); + + [Fact] + public void Should_be_overriden_by_MapFrom() + { + var person = new Person { Birthday = new DateTime(2000, 1, 1), Name = "Shy" }; + Mapper.Map(person).AgeV.ShouldBe(17); + } + } +} diff --git a/src/UnitTests/Bug/RecognizeIxesBug.cs b/src/UnitTests/Bug/RecognizeIxesBug.cs index c716bb95cd..5dd0419d58 100644 --- a/src/UnitTests/Bug/RecognizeIxesBug.cs +++ b/src/UnitTests/Bug/RecognizeIxesBug.cs @@ -1,63 +1,63 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - namespace RecognizeIxesBug - { - public class IxesTest : AutoMapperSpecBase - { - private Stuff _source; - private StuffView _dest; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizeDestinationPostfixes("CodeKey", "Key"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _source = new Stuff - { - Id = 4, - Name = "Foo", - RankCode = "Bar" - }; - _dest = Mapper.Map(_source); - } - - [Fact] - public void Should_recognize_a_full_prefix() - { - _dest.IdCodeKey.ShouldEqual(_source.Id); - } - - [Fact] - public void Should_recognize_a_partial_prefix() - { - _dest.NameKey.ShouldEqual(_source.Name); - } - - [Fact] - public void Should_recognize_a_partial_match_prefix() - { - _dest.RankCodeKey.ShouldEqual(_source.RankCode); - } - - public class Stuff - { - public int Id { get; set; } - public string Name { get; set; } - public string RankCode { get; set; } - } - - public class StuffView - { - public int IdCodeKey { get; set; } - public string NameKey { get; set; } - public string RankCodeKey { get; set; } - } - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + namespace RecognizeIxesBug + { + public class IxesTest : AutoMapperSpecBase + { + private Stuff _source; + private StuffView _dest; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizeDestinationPostfixes("CodeKey", "Key"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Stuff + { + Id = 4, + Name = "Foo", + RankCode = "Bar" + }; + _dest = Mapper.Map(_source); + } + + [Fact] + public void Should_recognize_a_full_prefix() + { + _dest.IdCodeKey.ShouldBe(_source.Id); + } + + [Fact] + public void Should_recognize_a_partial_prefix() + { + _dest.NameKey.ShouldBe(_source.Name); + } + + [Fact] + public void Should_recognize_a_partial_match_prefix() + { + _dest.RankCodeKey.ShouldBe(_source.RankCode); + } + + public class Stuff + { + public int Id { get; set; } + public string Name { get; set; } + public string RankCode { get; set; } + } + + public class StuffView + { + public int IdCodeKey { get; set; } + public string NameKey { get; set; } + public string RankCodeKey { get; set; } + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/RemovePrefixes.cs b/src/UnitTests/Bug/RemovePrefixes.cs index 1fdb1c7b0c..e53680b50e 100644 --- a/src/UnitTests/Bug/RemovePrefixes.cs +++ b/src/UnitTests/Bug/RemovePrefixes.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using AutoMapper.Mappers; diff --git a/src/UnitTests/Bug/RepeatedMappingConfigurationTest.cs b/src/UnitTests/Bug/RepeatedMappingConfigurationTest.cs index d0385dc171..ea94703464 100644 --- a/src/UnitTests/Bug/RepeatedMappingConfigurationTest.cs +++ b/src/UnitTests/Bug/RepeatedMappingConfigurationTest.cs @@ -1,44 +1,44 @@ -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class When_mapping_for_derived_class_is_duplicated : SpecBase - { - public class ModelObject - { - public string BaseString { get; set; } - } - - public class ModelSubObject : ModelObject - { - public string SubString { get; set; } - } - - public class DtoObject - { - public string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - [Fact] - public void should_not_throw_duplicated_key_exception() - { - new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - } - } -} +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class When_mapping_for_derived_class_is_duplicated : SpecBase + { + public class ModelObject + { + public string BaseString { get; set; } + } + + public class ModelSubObject : ModelObject + { + public string SubString { get; set; } + } + + public class DtoObject + { + public string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + [Fact] + public void should_not_throw_duplicated_key_exception() + { + new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + } + } +} diff --git a/src/UnitTests/Bug/ReportMissingInclude.cs b/src/UnitTests/Bug/ReportMissingInclude.cs index d462d974b1..d6f153f118 100644 --- a/src/UnitTests/Bug/ReportMissingInclude.cs +++ b/src/UnitTests/Bug/ReportMissingInclude.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -9,10 +9,67 @@ public class ReportMissingInclude [Fact] public void ShouldDiscoverMissingMappingsInIncludedType() { - new Action(()=>new MapperConfiguration(cfg => - { - cfg.CreateMap().Include(); - })).ShouldThrow(ex=>ex.Message.ShouldStartWith("Missing map from Object to ChildType.")); + new Action(() => new MapperConfiguration(cfg => + { + cfg.CreateMap().Include(); + })).ShouldThrowException(ex => ex.Message.ShouldStartWith($"Missing map from {typeof(object)} to {typeof(ChildType)}.")); + } + + public class BaseType { } + + public class ChildType : BaseType + { + public string Value { get; set; } + } + } + + public class ReportMissingIncludeCreateMissingMap + { + [Fact] + public void ShouldDiscoverMissingMappingsInIncludedType() + { + new Action(() => new MapperConfiguration(cfg => + { + cfg.CreateMap().Include(); + })).ShouldThrowException(ex => ex.Message.ShouldStartWith($"Missing map from {typeof(ReportMissingIncludeCreateMissingMap)} to {typeof(ChildType)}.")); + } + + public class BaseType { } + + public class ChildType : BaseType + { + public string Value { get; set; } + } + } + + public class ReportMissingIncludeBase + { + [Fact] + public void ShouldDiscoverMissingMappingsInIncludedType() + { + new Action(() => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeBase(); + })).ShouldThrowException(ex => ex.Message.ShouldStartWith($"Missing map from {typeof(object)} to {typeof(BaseType)}.")); + } + + public class BaseType { } + + public class ChildType : BaseType + { + public string Value { get; set; } + } + } + + public class ReportMissingIncludeBaseCreateMissingMap + { + [Fact] + public void ShouldDiscoverMissingMappingsInIncludedType() + { + new Action(() => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeBase(); + })).ShouldThrowException(ex => ex.Message.ShouldStartWith($"Missing map from {typeof(ReportMissingIncludeBaseCreateMissingMap)} to {typeof(BaseType)}.")); } public class BaseType { } diff --git a/src/UnitTests/Bug/ReverseMapReplaceMemberName.cs b/src/UnitTests/Bug/ReverseMapReplaceMemberName.cs index b49b14e4c9..69202924a4 100644 --- a/src/UnitTests/Bug/ReverseMapReplaceMemberName.cs +++ b/src/UnitTests/Bug/ReverseMapReplaceMemberName.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -42,8 +42,8 @@ protected override void Because_of() [Fact] public void Should_work_together() { - _source.AccountId.ShouldEqual(SomeId); - _destination.UserId.ShouldEqual(SomeOtherId); + _source.AccountId.ShouldBe(SomeId); + _destination.UserId.ShouldBe(SomeOtherId); } } @@ -94,8 +94,8 @@ protected override void Because_of() [Fact] public void Should_work_together() { - _source.AccountId.ShouldEqual(SomeId); - _destination.UserId.ShouldEqual(SomeOtherId); + _source.AccountId.ShouldBe(SomeId); + _destination.UserId.ShouldBe(SomeOtherId); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/SamePropertyNameOnParentAndChildClasses.cs b/src/UnitTests/Bug/SamePropertyNameOnParentAndChildClasses.cs new file mode 100644 index 0000000000..99ce2fa63d --- /dev/null +++ b/src/UnitTests/Bug/SamePropertyNameOnParentAndChildClasses.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class SamePropertyNameOnParentAndChildClasses : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(d => d.CostCenters, opt => opt.Ignore()); + cfg.CreateMap().MaxDepth(2); + cfg.CreateMap().MaxDepth(2); + }); + + [Fact] + public void should_not_throw_exception_on_expression_map() + { + Expression> _predicate = x => x.Name == "aa" && x.Id == 10 && x.AA == "bb" && x.BUId == 1 && x.BU.Id == 1 && x.BU.Name == "bb"; + var newPredicate = Mapper.Map>>(_predicate); + } + + public abstract class BaseVM + { + public int Id { get; set; } + } + + public class CostCenterVM : BaseVM + { + public string Name { get; set; } + public string AA { get; set; } + public int BUId { get; set; } + public virtual BUVM BU { get; set; } + } + + + public class BUVM : BaseVM + { + public string Name { get; set; } + public string Code { get; set; } + } + + public abstract class AuditableEntity + { + public virtual T Id { get; set; } + } + + public class CostCenter : AuditableEntity + { + public string Name { get; set; } + public string AA { get; set; } + public int BUId { get; set; } + public virtual BU BU { get; set; } + } + + public class BU : AuditableEntity + { + public string Name { get; set; } + public string Code { get; set; } + public virtual ICollection CostCenters { get; set; } + } + + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/SelectiveConfigurationValidation.cs b/src/UnitTests/Bug/SelectiveConfigurationValidation.cs index dc96174d5c..3f35c4759e 100644 --- a/src/UnitTests/Bug/SelectiveConfigurationValidation.cs +++ b/src/UnitTests/Bug/SelectiveConfigurationValidation.cs @@ -1,50 +1,50 @@ -namespace AutoMapper.UnitTests.Bug -{ - using System; - using Xunit; - - public class SelectiveConfigurationValidation : NonValidatingSpecBase - { - public class GoodSrc { } - public class GoodDest { } - - public class BadSrc - { - public Type BlowUp { get; set; } - } - - public class BadDest - { - public int Value { get; set; } - public int BlowUp { get; set; } - } - public class GoodProfile : Profile - { - public GoodProfile() - { - CreateMap(); - } - } - - public class BadProfile : Profile - { - public BadProfile() - { - CreateMap(); - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AddProfile(); - cfg.AddProfile(); - }); - - [Fact] - public void Should_pass_specific_profile_assertion() - { - typeof(AutoMapperConfigurationException) - .ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } +namespace AutoMapper.UnitTests.Bug +{ + using System; + using Xunit; + + public class SelectiveConfigurationValidation : NonValidatingSpecBase + { + public class GoodSrc { } + public class GoodDest { } + + public class BadSrc + { + public Type BlowUp { get; set; } + } + + public class BadDest + { + public int Value { get; set; } + public int BlowUp { get; set; } + } + public class GoodProfile : Profile + { + public GoodProfile() + { + CreateMap(); + } + } + + public class BadProfile : Profile + { + public BadProfile() + { + CreateMap(); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AddProfile(); + cfg.AddProfile(); + }); + + [Fact] + public void Should_pass_specific_profile_assertion() + { + typeof(AutoMapperConfigurationException) + .ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/SequenceContainsNoElementsTest.cs b/src/UnitTests/Bug/SequenceContainsNoElementsTest.cs index 6c42f47843..09c3d1b961 100644 --- a/src/UnitTests/Bug/SequenceContainsNoElementsTest.cs +++ b/src/UnitTests/Bug/SequenceContainsNoElementsTest.cs @@ -1,48 +1,48 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Bug -{ - public class SequenceContainsNoElementsTest : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void should_not_throw_InvalidOperationException() - { - Person[] personArr = new Person[] { }; - People people = new People(personArr); - var pmc = Mapper.Map>(people); - pmc.ShouldNotBeNull(); - pmc.Count.ShouldEqual(0); - } - } - - public class People : IEnumerable - { - private readonly Person[] people; - public People(Person[] people) - { - this.people = people; - } - public IEnumerator GetEnumerator() => people.GetEnumerator(); - } - - public class Person - { - public string Name { get; set; } - } - - public class PersonModel - { - public string Name { get; set; } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Bug +{ + public class SequenceContainsNoElementsTest : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void should_not_throw_InvalidOperationException() + { + Person[] personArr = new Person[] { }; + People people = new People(personArr); + var pmc = Mapper.Map>(people); + pmc.ShouldNotBeNull(); + pmc.Count.ShouldBe(0); + } + } + + public class People : IEnumerable + { + private readonly Person[] people; + public People(Person[] people) + { + this.people = people; + } + public IEnumerator GetEnumerator() => people.GetEnumerator(); + } + + public class Person + { + public string Name { get; set; } + } + + public class PersonModel + { + public string Name { get; set; } + } +} diff --git a/src/UnitTests/Bug/SetterOnlyBug.cs b/src/UnitTests/Bug/SetterOnlyBug.cs index 6d80a24b84..3547cd4cca 100644 --- a/src/UnitTests/Bug/SetterOnlyBug.cs +++ b/src/UnitTests/Bug/SetterOnlyBug.cs @@ -1,50 +1,50 @@ -namespace AutoMapper.UnitTests.Bug -{ - namespace SetterOnlyBug - { - using Should; - using Xunit; - - public class MappingTests : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg - .CreateMap() - .ForMember("Property", o => o.Ignore()); - }); - - [Fact] - public void TestMapping() - { - var source = new Source - { - Property = "Something" - }; - var destination = Mapper.Map(source); - - destination.GetProperty().ShouldBeNull(); - } - } - - public class Source - { - public string Property { get; set; } - } - - public class Desitination - { - string _property; - - public string Property - { - set { _property = value; } - } - - public string GetProperty() - { - return _property; - } - } - } +namespace AutoMapper.UnitTests.Bug +{ + namespace SetterOnlyBug + { + using Shouldly; + using Xunit; + + public class MappingTests : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg + .CreateMap() + .ForMember("Property", o => o.Ignore()); + }); + + [Fact] + public void TestMapping() + { + var source = new Source + { + Property = "Something" + }; + var destination = Mapper.Map(source); + + destination.GetProperty().ShouldBeNull(); + } + } + + public class Source + { + public string Property { get; set; } + } + + public class Desitination + { + string _property; + + public string Property + { + set { _property = value; } + } + + public string GetProperty() + { + return _property; + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/StructMapping.cs b/src/UnitTests/Bug/StructMapping.cs index 347ca54b35..370ed7f20e 100644 --- a/src/UnitTests/Bug/StructMapping.cs +++ b/src/UnitTests/Bug/StructMapping.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -34,7 +34,7 @@ protected override void Because_of() [Fact] public void Should_work() { - _destination.Number.ShouldEqual(23); + _destination.Number.ShouldBe(23); } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/SubclassMappings.cs b/src/UnitTests/Bug/SubclassMappings.cs index 837c7b708d..b974262a1c 100644 --- a/src/UnitTests/Bug/SubclassMappings.cs +++ b/src/UnitTests/Bug/SubclassMappings.cs @@ -1,41 +1,41 @@ -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class SubclassMappings : AutoMapperSpecBase - { - public class Source - { - public string Name { get; set; } - } - - public class Destination - { - public string Name { get; set; } - } - - public class SubDestination : Destination - { - public string SubName { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void TestCase() - { - - var source = new Source() { Name = "Test" }; - var destination = new Destination(); - - Mapper.Map(source, destination); // Works - - var subDestination = new SubDestination(); - - Mapper.Map(source, subDestination); // Fails - } - } +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class SubclassMappings : AutoMapperSpecBase + { + public class Source + { + public string Name { get; set; } + } + + public class Destination + { + public string Name { get; set; } + } + + public class SubDestination : Destination + { + public string SubName { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void TestCase() + { + + var source = new Source() { Name = "Test" }; + var destination = new Destination(); + + Mapper.Map(source, destination); // Works + + var subDestination = new SubDestination(); + + Mapper.Map(source, subDestination); // Fails + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/TargetISet.cs b/src/UnitTests/Bug/TargetISet.cs index 12cc35346c..350e12da0d 100644 --- a/src/UnitTests/Bug/TargetISet.cs +++ b/src/UnitTests/Bug/TargetISet.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; using System.Collections.Generic; @@ -35,5 +35,11 @@ public void Should_map_IEnumerable_to_ISet() { _destination.Items.SetEquals(_items).ShouldBeTrue(); } + + [Fact] + public void Should_map_null_to_empty() + { + Mapper.Map(new Source()).ShouldNotBeNull(); + } } } \ No newline at end of file diff --git a/src/UnitTests/Bug/TypeMapIncludeBaseTypes.cs b/src/UnitTests/Bug/TypeMapIncludeBaseTypes.cs new file mode 100644 index 0000000000..d02fbef482 --- /dev/null +++ b/src/UnitTests/Bug/TypeMapIncludeBaseTypes.cs @@ -0,0 +1,79 @@ +using Shouldly; +using System.Linq; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public abstract class TypeMapIncludeBaseTypes + { + public abstract class Source { public int? A { get; set; } } + public class SourceA : Source { } + public class SourceB : Source { } + public abstract class Target { public int? A { get; set; } } + public class TargetA : Target { } + public class TargetB : Target { } + + public class IncludeFromBase : TypeMapIncludeBaseTypes + { + protected override IConfigurationProvider CreateConfigurationProvider() + { + return new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include() + .Include(); + + cfg.CreateMap(); + + cfg.CreateMap(); + }); + } + } + + public class IncludeFromDerived : TypeMapIncludeBaseTypes + { + protected override IConfigurationProvider CreateConfigurationProvider() + { + return new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap() + .IncludeBase(); + + cfg.CreateMap() + .IncludeBase(); + }); + } + } + + [Fact] + public void TypeMap_Should_include_derivied_types() + { + var config = CreateConfigurationProvider(); + var typeMap = config.ResolveTypeMap(typeof(Source), typeof(Target)); + + var typePairs = new[]{ + new TypePair(typeof(SourceA), typeof(TargetA)), + new TypePair(typeof(SourceB), typeof(TargetB)), + }; + + typeMap.IncludedDerivedTypes.SequenceEqual(typePairs).ShouldBeTrue(); + } + + [Fact] + public void TypeMap_Should_include_base_types() + { + var config = CreateConfigurationProvider(); + var typeMap = config.ResolveTypeMap(typeof(SourceA), typeof(TargetA)); + + var typePairs = new[]{ + new TypePair(typeof(Source), typeof(Target)) + }; + + typeMap.IncludedBaseTypes.SequenceEqual(typePairs).ShouldBeTrue(); + } + + protected abstract IConfigurationProvider CreateConfigurationProvider(); + } +} diff --git a/src/UnitTests/Bug/UseDestinationValue.cs b/src/UnitTests/Bug/UseDestinationValue.cs new file mode 100644 index 0000000000..ff57ee4464 --- /dev/null +++ b/src/UnitTests/Bug/UseDestinationValue.cs @@ -0,0 +1,195 @@ +using Xunit; +using Shouldly; +using System; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class UseDestinationValue : AutoMapperSpecBase + { + public class OrganizationDTO + { + public long? ID { get; set; } + public string Name { get; set; } + + private CollectionDTOController _branchCollection; + public CollectionDTOController BranchCollection + { + get + { + if(_branchCollection == null) + _branchCollection = new CollectionDTOController(); + + return _branchCollection; + } + set { _branchCollection = value; } + } + } + + public class BranchDTO + { + public short? ID { get; set; } + public string Name { get; set; } + + } + + public class CollectionDTOController + where T : class + where K : struct + { + public IEnumerable Models { get; set; } + public K? SelectedID { get; set; } + } + + public class Organization + { + public long? ID { get; set; } + public string Name { get; set; } + + private CollectionController _BranchCollection; + public CollectionController BranchCollection + { + get + { + if(_BranchCollection == null) + _BranchCollection = new CollectionController(this); + + return _BranchCollection; + } + set { _BranchCollection = value; } + } + } + + public class Branch + { + public short? ID { get; set; } + public string Name { get; set; } + + } + + public class CollectionController + where T : class + where K : struct + where Z : EventArgs + { + private object _owner; + public CollectionController(object owner) + { + _owner = owner; + } + public IEnumerable Models { get; set; } + public K? SelectedID { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d=>d.BranchCollection, o=>o.UseDestinationValue()); + cfg.CreateMap(); + cfg.CreateMap(typeof(CollectionDTOController<,>), typeof(CollectionController<,,>), MemberList.None); + }); + + protected override void Because_of() + { + var branchDto = new BranchDTO { ID = 51, Name = "B1" }; + var orgDto = new OrganizationDTO { ID = 5, Name = "O1" }; + orgDto.BranchCollection.Models = new BranchDTO[] { branchDto }; + + Mapper.Map(orgDto); + } + } + + public class DontUseDestinationValue : NonValidatingSpecBase + { + public class OrganizationDTO + { + public long? ID { get; set; } + public string Name { get; set; } + + private CollectionDTOController _branchCollection; + public CollectionDTOController BranchCollection + { + get + { + if(_branchCollection == null) + _branchCollection = new CollectionDTOController(); + + return _branchCollection; + } + set { _branchCollection = value; } + } + } + + public class BranchDTO + { + public short? ID { get; set; } + public string Name { get; set; } + + } + + public class CollectionDTOController + where T : class + where K : struct + { + public IEnumerable Models { get; set; } + public K? SelectedID { get; set; } + } + + public class Organization + { + public long? ID { get; set; } + public string Name { get; set; } + + private CollectionController _BranchCollection; + public CollectionController BranchCollection + { + get + { + if(_BranchCollection == null) + _BranchCollection = new CollectionController(this); + + return _BranchCollection; + } + set { _BranchCollection = value; } + } + } + + public class Branch + { + public short? ID { get; set; } + public string Name { get; set; } + + } + + public class CollectionController + where T : class + where K : struct + where Z : EventArgs + { + private object _owner; + public CollectionController(object owner) + { + _owner = owner; + } + public IEnumerable Models { get; set; } + public K? SelectedID { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(typeof(CollectionDTOController<,>), typeof(CollectionController<,,>), MemberList.None); + }); + + [Fact] + public void Should_report_missing_constructor() + { + var branchDto = new BranchDTO { ID = 51, Name = "B1" }; + var orgDto = new OrganizationDTO { ID = 5, Name = "O1" }; + orgDto.BranchCollection.Models = new BranchDTO[] { branchDto }; + + new Action(()=>Mapper.Map(orgDto)).ShouldThrowException( + ex=>ex.InnerException.Message.ShouldStartWith(typeof(CollectionController) + " needs to have a constructor with 0 args or only optional args")); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Bug/WithoutPreserveReferencesSameDestination.cs b/src/UnitTests/Bug/WithoutPreserveReferencesSameDestination.cs new file mode 100644 index 0000000000..c7ebc0c21c --- /dev/null +++ b/src/UnitTests/Bug/WithoutPreserveReferencesSameDestination.cs @@ -0,0 +1,92 @@ +using Xunit; +using Shouldly; +using System; +using System.Linq; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests.Bug +{ + public class Self_referencing_existing_destination_without_PreserveReferences : AutoMapperSpecBase + { + public class BaseType + { + public BaseType() + { + SelfReference = this; + } + public BaseType SelfReference { get; set; } + } + + public class BaseTypeDto + { + public BaseTypeDto() + { + SelfReference = this; + } + public BaseTypeDto SelfReference { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> cfg.CreateMap()); + + protected override void Because_of() + { + var baseType = new BaseType(); + var baseTypeDto = new BaseTypeDto(); + + Mapper.Map(baseType, baseTypeDto); + } + } + + public class WithoutPreserveReferencesSameDestination : AutoMapperSpecBase + { + public class DtoOne + { + public DtoTwo Two { get; set; } + } + + public class DtoTwo + { + public virtual ICollection Ones { get; set; } + } + + public class DtoThree + { + public int Id { get; set; } + } + + public class EntityOne + { + public int Id { get; set; } + public EntityTwo Two { get; set; } + } + + public class EntityTwo + { + public virtual ICollection Ones { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_use_the_right_map() + { + var source = + new EntityOne { + Two = new EntityTwo { + Ones = new List { + new EntityOne { + Two = new EntityTwo { Ones = new List() } + } + } + } + }; + Mapper.Map(source).ShouldBeOfType(); + Mapper.Map(source).ShouldBeOfType(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/BuildExecutionPlan.cs b/src/UnitTests/BuildExecutionPlan.cs new file mode 100644 index 0000000000..8e613e622c --- /dev/null +++ b/src/UnitTests/BuildExecutionPlan.cs @@ -0,0 +1,66 @@ +using System; +using AutoMapper; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class BuildExecutionPlan : AutoMapperSpecBase + { + Model _source; + Dto _destination; + + public class Model + { + public Guid? Id { get; set; } + public Guid? FooId { get; set; } + public string FullDescription { get; set; } + public string ShortDescription { get; set; } + public DateTime Date { get; set; } + public int? IntValue { get; set; } + } + + public class Dto + { + public Guid? Id { get; set; } + public string FooId { get; set; } + public string FullDescription { get; set; } + public string ShortDescription { get; set; } + public DateTime Date { get; set; } + public int IntValue { get; set; } + public string CompanyName { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap().ForMember(d => d.CompanyName, o => o.Ignore()); + }); + + protected override void Because_of() + { + _source = new Model + { + Id = Guid.NewGuid(), + FooId = Guid.NewGuid(), + ShortDescription = "Yoyodyne Foo", + FullDescription = "Deluxe Foo Manufactured by Yoyodyne, Inc.", + Date = DateTime.Now, + IntValue = 13, + }; + var plan = Configuration.BuildExecutionPlan(typeof(Model), typeof(Dto)); + var context = ((IRuntimeMapper)Mapper).DefaultContext; + _destination = ((Func)plan.Compile())(_source, null, context); + } + + [Fact] + public void Should_build_the_execution_plan() + { + _destination.Id.ShouldBe(_source.Id); + _destination.FooId.ShouldBe(_source.FooId.ToString()); + _destination.ShortDescription.ShouldBe(_source.ShortDescription); + _destination.FullDescription.ShouldBe(_source.FullDescription); + _destination.Date.ShouldBe(_source.Date); + _destination.IntValue.ShouldBe(_source.IntValue.Value); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/CollectionMapping.cs b/src/UnitTests/CollectionMapping.cs index 2e47951407..a812fd3aa8 100644 --- a/src/UnitTests/CollectionMapping.cs +++ b/src/UnitTests/CollectionMapping.cs @@ -1,295 +1,780 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - public class CollectionMapping - { - public CollectionMapping() - { - SetUp(); - } - public void SetUp() - { - - } - - - public class MasterWithList - { - private IList _details = new List(); - - public int Id { get; set; } - - public IList Details - { - get { return _details; } - set { _details = value; } - } - } - - public class MasterWithCollection - { - public MasterWithCollection(ICollection details) - { - Details = details; - } - - public int Id { get; set; } - - public ICollection Details { get; set; } - } - - public class MasterWithNoExistingCollection - { - public int Id { get; set; } - public HashSet Details { get; set; } - } - - public class Detail - { - public int Id { get; set; } - } - - public class MasterDto - { - public int Id { get; set; } - public DetailDto[] Details { get; set; } - } - - public class DetailDto - { - public int Id { get; set; } - } - - private static IMapper mapper; - - private static void FillCollection( - TSource s, TDestination d, - Func> getSourceEnum, - Func> getDestinationColl) - { - ICollection collection = getDestinationColl(d); - collection.Clear(); - foreach (TSourceItem sourceItem in getSourceEnum(s)) - { - collection.Add(mapper.Map(sourceItem)); - } - } - - [Fact] - public void Should_keep_and_fill_destination_collection_when_collection_is_implemented_as_list() - { - var config = new MapperConfiguration(cfg => - { - - cfg.CreateMap() - .ForMember(d => d.Details, o => o.UseDestinationValue()); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = new MasterWithCollection(new List()); - ICollection originalCollection = master.Details; - - config.CreateMapper().Map(dto, master); - - originalCollection.ShouldBeSameAs(master.Details); - originalCollection.Count.ShouldEqual(master.Details.Count); - } - - [Fact] - public void Should_keep_and_fill_destination_collection_when_collection_is_implemented_as_set() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Details, o => o.UseDestinationValue()); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = new MasterWithCollection(new HashSet()); - ICollection originalCollection = master.Details; - - config.CreateMapper().Map(dto, master); - - originalCollection.ShouldBeSameAs(master.Details); - originalCollection.Count.ShouldEqual(master.Details.Count); - } - - [Fact] - public void Should_keep_and_fill_destination_collection_when_collection_is_implemented_as_set_with_aftermap() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Details, o => o.Ignore()) - .AfterMap((s, d) => FillCollection(s, d, ss => ss.Details, dd => dd.Details)); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = new MasterWithCollection(new HashSet()); - ICollection originalCollection = master.Details; - - mapper = config.CreateMapper(); - - mapper.Map(dto, master); - - originalCollection.ShouldBeSameAs(master.Details); - originalCollection.Count.ShouldEqual(master.Details.Count); - } - - [Fact] - public void Should_keep_and_fill_destination_list() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Details, o => o.UseDestinationValue()); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = new MasterWithList(); - IList originalCollection = master.Details; - - config.CreateMapper().Map(dto, master); - - originalCollection.ShouldBeSameAs(master.Details); - originalCollection.Count.ShouldEqual(master.Details.Count); - } - - [Fact] - public void Should_not_replace_destination_collection() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = new MasterWithCollection(new List()); - ICollection originalCollection = master.Details; - - config.CreateMapper().Map(dto, master); - - originalCollection.ShouldBeSameAs(master.Details); - } - - [Fact] - public void Should_be_able_to_map_to_a_collection_type_that_implements_ICollection_of_T() - { - var config = new MapperConfiguration(cfg => - { - - cfg.CreateMap(); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = config.CreateMapper().Map(dto); - - master.Details.Count.ShouldEqual(2); - } - - [Fact] - public void Should_not_replace_destination_list() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - var dto = new MasterDto - { - Id = 1, - Details = new[] - { - new DetailDto {Id = 2}, - new DetailDto {Id = 3}, - } - }; - - var master = new MasterWithList(); - IList originalCollection = master.Details; - - config.CreateMapper().Map(dto, master); - - originalCollection.ShouldBeSameAs(master.Details); - } - - [Fact] - public void Should_map_to_NameValueCollection() { - // initially results in the following exception: - // ----> System.InvalidCastException : Unable to cast object of type 'System.Collections.Specialized.NameValueCollection' to type 'System.Collections.IList'. - // this was fixed by adding NameValueCollectionMapper to the MapperRegistry. - var c = new NameValueCollection(); - var config = new MapperConfiguration(cfg => { }); - var mappedCollection = config.CreateMapper().Map(c); - - mappedCollection.ShouldNotBeNull(); - } - } -} \ No newline at end of file +using System; +using System.Linq; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using Xunit; +using Shouldly; +using System.Collections; +using System.Reflection; + +namespace AutoMapper.UnitTests +{ + public class When_mapping_to_existing_observable_collection : AutoMapperSpecBase + { + class CollectionHolder + { + public CollectionHolder() + { + Observable = new ObservableCollection>(); + } + + public ObservableCollection> Observable { get; set; } + } + + class CollectionHolderDto + { + public CollectionHolderDto() + { + Observable = new List>(); + } + + public List> Observable { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap().ForMember(a => a.Observable, opt => opt.UseDestinationValue())); + + [Fact] + public void Should_map_ok() + { + var ch = new CollectionHolderDto(); + var list = new List{ 5, 6 }; + ch.Observable.Add(list); + var mapped = Mapper.Map(ch); + mapped.Observable.Single().ShouldBe(list); + } + } + + public class When_mapping_to_member_typed_as_IEnumerable : AutoMapperSpecBase + { + public class SourceItem { } + public class DestItem { } + public class SourceA + { + public IEnumerable Items { get; set; } + public IEnumerable Bs { get; set; } // Problem + } + + public class SourceB + { + public IEnumerable Items { get; set; } + } + + public class DestA + { + public IEnumerable Items { get; set; } + public IEnumerable Bs { get; set; } // Problem + } + + public class DestB + { + public IEnumerable Items { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_ok() + { + Mapper.Map(new SourceB()).Items.ShouldBeEmpty(); + } + } + + public class When_mapping_to_existing_collection_typed_as_IEnumerable : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(_=>{ }); + + [Fact] + public void Should_map_ok() + { + IEnumerable destination = new List(); + var source = Enumerable.Range(1, 10).ToArray(); + Mapper.Map(source, destination); + destination.SequenceEqual(source).ShouldBeTrue(); + } + } + + public class When_mapping_to_readonly_property_as_IEnumerable_and_existing_destination : AutoMapperSpecBase + { + public class Source + { + private readonly List _myCollection = new List { "one", "two" }; + + public string[] MyCollection => _myCollection.ToArray(); + } + + public class Destination + { + private IList _myCollection = new List(); + public IEnumerable MyCollection => _myCollection; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + cfg.CreateMap().ForMember(m => m.MyCollection, opt => + { + opt.MapFrom(src => src.MyCollection); + })); + + [Fact] + public void Should_map_ok() + { + Mapper.Map(new Source(), new Destination()) + .MyCollection.SequenceEqual(new[] { "one", "two" }).ShouldBeTrue(); + } + } + + public class When_mapping_to_readonly_property_UseDestinationValue : AutoMapperSpecBase + { + public class Source + { + private readonly List _myCollection = new List { "one", "two" }; + + public string[] MyCollection => _myCollection.ToArray(); + } + + public class Destination + { + private IList _myCollection = new List(); + public IEnumerable MyCollection => _myCollection; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + cfg.CreateMap().ForMember(m => m.MyCollection, opt => + { + opt.MapFrom(src => src.MyCollection); + })); + + [Fact] + public void Should_map_ok() + { + Mapper.Map(new Source()) + .MyCollection.SequenceEqual(new[] { "one", "two" }).ShouldBeTrue(); + } + } + + public class When_mapping_to_readonly_property_as_IEnumerable : AutoMapperSpecBase + { + public class Source + { + private readonly List _myCollection = new List { "one", "two" }; + + public string[] MyCollection => _myCollection.ToArray(); + } + + public class Destination + { + private IList _myCollection = new List(); + public IEnumerable MyCollection => _myCollection; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + cfg.CreateMap().ForMember(m => m.MyCollection, opt => + { + opt.MapFrom(src => src.MyCollection); + opt.UseDestinationValue(); + })); + + [Fact] + public void Should_map_ok() + { + Mapper.Map(new Source()) + .MyCollection.SequenceEqual(new[] { "one", "two" }).ShouldBeTrue(); + } + } + + public class When_mapping_from_struct_collection : AutoMapperSpecBase + { + public struct MyCollection : IEnumerable + { + public IEnumerator GetEnumerator() + { + for(int i = 1; i <= 10; i++) + { + yield return i; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } + + public class SourceItem + { + public string Name { get; set; } + public MyCollection ShipsTo { get; set; } + } + + public class DestItem + { + public string Name { get; set; } + public List ShipsTo { get; set; } + } + + protected override MapperConfiguration Configuration => + new MapperConfiguration(cfg => cfg.CreateMap()); + + [Fact] + public void Should_map_ok() + { + Mapper.Map(new SourceItem { ShipsTo = new MyCollection() }) + .ShipsTo.SequenceEqual(Enumerable.Range(1, 10)).ShouldBeTrue(); + } + } + + public class When_mapping_to_custom_collection_type : AutoMapperSpecBase + { + public class MyCollection : CollectionBase + { + } + + public class SourceItem + { + public string Name { get; set; } + public List ShipsTo { get; set; } + } + + public class DestItem + { + public string Name { get; set; } + public MyCollection ShipsTo { get; set; } + } + + protected override MapperConfiguration Configuration => + new MapperConfiguration(cfg => cfg.CreateMap()); + + [Fact] + public void Should_map_ok() + { + var items = Enumerable.Range(1, 10).Select(i => i.ToString()).ToArray(); + Mapper.Map(new SourceItem { ShipsTo = new List(items) }) + .ShipsTo.Cast().SequenceEqual(items).ShouldBeTrue(); + } + } + + public class When_mapping_to_unknown_collection_type : NonValidatingSpecBase + { + public class MyCollection + { + } + + public class SourceItem + { + public string Name { get; set; } + public List ShipsTo { get; set; } + } + + public class DestItem + { + public string Name { get; set; } + public MyCollection ShipsTo { get; set; } + } + + protected override MapperConfiguration Configuration => + new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMissingTypeMaps = false; + }); + + [Fact] + public void Should_report_missing_map() + { + new Action(Configuration.AssertConfigurationIsValid).ShouldThrowException(ex => + { + ex.PropertyMap.SourceMember.ShouldBe(typeof(SourceItem).GetProperty("ShipsTo")); + ex.Types.Value.ShouldBe(new TypePair(typeof(SourceItem), typeof(DestItem))); + }); + } + } + + public class When_mapping_collections_with_inheritance : AutoMapperSpecBase + { + public class Source + { + public IEnumerable Items { get; set; } + } + public class Destination + { + public IEnumerable Items { get; set; } + } + public class SourceItem + { + public int Value { get; set; } + } + public class DestinationItemBase + { + public int Value { get; set; } + } + public class SpecificDestinationItem : DestinationItemBase + { + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().As(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + } + + public class When_passing_a_not_empty_collection : AutoMapperSpecBase + { + Destination _destination = new Destination(); + + class Source + { + public List Items { get; } + } + + class SourceItem + { + } + + class Destination + { + public List Items { get; } = new List { new DestinationItem() }; + } + + class DestinationItem + { + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + Mapper.Map(new Source(), _destination); + } + + [Fact] + public void It_should_be_cleared_first() + { + _destination.Items.ShouldBeEmpty(); + } + } + + public class When_mapping_collections_with_structs : AutoMapperSpecBase + { + BarDTO _destination; + + public struct Foo { } + public struct Bar + { + public IEnumerable Foos { get; set; } + } + + public struct FooDTO { } + public struct BarDTO + { + public IEnumerable Foos { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Bar { Foos = new Foo[5] }); + } + + [Fact] + public void Should_map_ok() + { + _destination.Foos.SequenceEqual(new FooDTO[5]).ShouldBeTrue(); + } + } + + public class CollectionMapping + { + public class MasterWithList + { + private IList _details = new List(); + + public int Id { get; set; } + + public IList Details + { + get { return _details; } + set { _details = value; } + } + } + + public class MasterWithCollection + { + public MasterWithCollection(ICollection details) + { + Details = details; + } + + public int Id { get; set; } + + public ICollection Details { get; set; } + } + + public class MasterWithNoExistingCollection + { + public int Id { get; set; } + public HashSet Details { get; set; } + } + + public class Detail + { + public int Id { get; set; } + } + + public class MasterDto + { + public int Id { get; set; } + public DetailDto[] Details { get; set; } + } + + public class DetailDto + { + public int Id { get; set; } + } + + private static IMapper mapper; + + private static void FillCollection( + TSource s, TDestination d, + Func> getSourceEnum, + Func> getDestinationColl) + { + ICollection collection = getDestinationColl(d); + collection.Clear(); + foreach (TSourceItem sourceItem in getSourceEnum(s)) + { + collection.Add(mapper.Map(sourceItem)); + } + } + + [Fact] + public void Should_keep_and_fill_destination_collection_when_collection_is_implemented_as_list() + { + var config = new MapperConfiguration(cfg => + { + + cfg.CreateMap() + .ForMember(d => d.Details, o => o.UseDestinationValue()); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = new MasterWithCollection(new List()); + ICollection originalCollection = master.Details; + + config.CreateMapper().Map(dto, master); + + originalCollection.ShouldBeSameAs(master.Details); + originalCollection.Count.ShouldBe(master.Details.Count); + } + + [Fact] + public void Should_keep_and_fill_destination_collection_when_collection_is_implemented_as_set() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Details, o => o.UseDestinationValue()); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = new MasterWithCollection(new HashSet()); + ICollection originalCollection = master.Details; + + config.CreateMapper().Map(dto, master); + + originalCollection.ShouldBeSameAs(master.Details); + originalCollection.Count.ShouldBe(master.Details.Count); + } + + [Fact] + public void Should_keep_and_fill_destination_collection_when_collection_is_implemented_as_set_with_aftermap() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Details, o => o.Ignore()) + .AfterMap((s, d) => FillCollection(s, d, ss => ss.Details, dd => dd.Details)); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = new MasterWithCollection(new HashSet()); + ICollection originalCollection = master.Details; + + mapper = config.CreateMapper(); + + mapper.Map(dto, master); + + originalCollection.ShouldBeSameAs(master.Details); + originalCollection.Count.ShouldBe(master.Details.Count); + } + + [Fact] + public void Should_keep_and_fill_destination_list() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Details, o => o.UseDestinationValue()); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = new MasterWithList(); + IList originalCollection = master.Details; + + config.CreateMapper().Map(dto, master); + + originalCollection.ShouldBeSameAs(master.Details); + originalCollection.Count.ShouldBe(master.Details.Count); + } + + [Fact] + public void Should_not_replace_destination_collection() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Details, opt => opt.UseDestinationValue()); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = new MasterWithCollection(new List()); + ICollection originalCollection = master.Details; + + config.CreateMapper().Map(dto, master); + + originalCollection.ShouldBeSameAs(master.Details); + } + + [Fact] + public void Should_be_able_to_map_to_a_collection_type_that_implements_ICollection_of_T() + { + var config = new MapperConfiguration(cfg => + { + + cfg.CreateMap(); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = config.CreateMapper().Map(dto); + + master.Details.Count.ShouldBe(2); + } + + [Fact] + public void Should_not_replace_destination_list() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Details, opt => opt.UseDestinationValue()); + cfg.CreateMap(); + }); + + var dto = new MasterDto + { + Id = 1, + Details = new[] + { + new DetailDto {Id = 2}, + new DetailDto {Id = 3}, + } + }; + + var master = new MasterWithList(); + IList originalCollection = master.Details; + + config.CreateMapper().Map(dto, master); + + originalCollection.ShouldBeSameAs(master.Details); + } + + [Fact] + public void Should_map_to_NameValueCollection() { + // initially results in the following exception: + // ----> System.InvalidCastException : Unable to cast object of type 'System.Collections.Specialized.NameValueCollection' to type 'System.Collections.IList'. + // this was fixed by adding NameValueCollectionMapper to the MapperRegistry. + var c = new NameValueCollection(); + var config = new MapperConfiguration(cfg => { }); + var mappedCollection = config.CreateMapper().Map(c); + + mappedCollection.ShouldNotBeNull(); + } + } + + public class When_mapping_from_ICollection_types_but_implementations_are_different : AutoMapperSpecBase + { + public class Source + { + public ICollection Items { get; set; } + + public class Item + { + public int Value { get; set; } + } + } + public class Dest + { + public ICollection Items { get; set; } = new HashSet(); + + public class Item + { + public int Value { get; set; } + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_items() + { + var source = new Source + { + Items = new List + { + new Source.Item { Value = 5 } + } + }; + var dest = new Dest(); + + Mapper.Map(source, dest); + + dest.Items.Count.ShouldBe(1); + dest.Items.First().Value.ShouldBe(5); + } + } + + public class When_mapping_enumerable_to_array : AutoMapperSpecBase + { + public class Source + { + public int X { get; set; } + public IEnumerable Items { get; set; } + } + + public class SourceItem + { + public int I { get; set; } + } + + public class Target + { + public int X { get; set; } + public TargetItem[] Items { get; set; } + } + + public class TargetItem + { + public int I { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullCollections = true; + + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void IncludedMappings() + { + var src = new Source + { + X = 5, + Items = new List + { + new SourceItem {I = 1}, + new SourceItem {I = 2}, + new SourceItem {I = 3} + } + }; + + var dest = Mapper.Map(src); + + src.X.ShouldBe(dest.X); + + dest.Items.Length.ShouldBe(3); + dest.Items[0].I.ShouldBe(1); + dest.Items[1].I.ShouldBe(2); + dest.Items[2].I.ShouldBe(3); + } + } +} diff --git a/src/UnitTests/ConditionalMapping.cs b/src/UnitTests/ConditionalMapping.cs index b8610fe4e2..aa39184d01 100644 --- a/src/UnitTests/ConditionalMapping.cs +++ b/src/UnitTests/ConditionalMapping.cs @@ -1,246 +1,297 @@ -using System; -using System.Linq; -using System.Reflection; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace ConditionalMapping - { - public class When_configuring_a_member_to_skip_based_on_the_property_value : AutoMapperSpecBase - { - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.Condition(src => src.Value > 0)); - }); - - [Fact] - public void Should_skip_the_mapping_when_the_condition_is_true() - { - var destination = Mapper.Map(new Source {Value = -1}); - - destination.Value.ShouldEqual(0); - } - - [Fact] - public void Should_execute_the_mapping_when_the_condition_is_false() - { - var destination = Mapper.Map(new Source { Value = 7 }); - - destination.Value.ShouldEqual(7); - } - } - - public class When_configuring_a_member_to_skip_based_on_the_property_value_with_custom_mapping : AutoMapperSpecBase - { - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => - { - opt.Condition(src => src.Value > 0); - opt.ResolveUsing((Source src) => - { - return 10; - }); - }); - }); - - [Fact] - public void Should_skip_the_mapping_when_the_condition_is_true() - { - var destination = Mapper.Map(new Source { Value = -1 }); - - destination.Value.ShouldEqual(0); - } - - [Fact] - public void Should_execute_the_mapping_when_the_condition_is_false() - { - Mapper.Map(new Source { Value = 7 }).Value.ShouldEqual(10); - } - } - - public class When_configuring_a_map_to_ignore_all_properties_with_an_inaccessible_setter : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Id { get; set; } - public string Title { get; set; } - public string CodeName { get; set; } - public string Nickname { get; set; } - public string ScreenName { get; set; } - } - - public class Destination - { - private double _height; - - public int Id { get; set; } - public virtual string Name { get; protected set; } - public string Title { get; internal set; } - public string CodeName { get; private set; } - public string Nickname { get; private set; } - public string ScreenName { get; private set; } - public int Age { get; private set; } - - public double Height - { - get { return _height; } - } - - public Destination() - { - _height = 60; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.ScreenName, opt => opt.MapFrom(src => src.ScreenName)) - .IgnoreAllPropertiesWithAnInaccessibleSetter() - .ForMember(dest => dest.Nickname, opt => opt.MapFrom(src => src.Nickname)); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Id = 5, CodeName = "007", Nickname = "Jimmy", ScreenName = "jbogard" }); - } - - [Fact] - public void Should_consider_the_configuration_valid_even_if_some_properties_with_an_inaccessible_setter_are_unmapped() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - - [Fact] - public void Should_map_a_property_with_an_inaccessible_setter_if_a_specific_mapping_is_configured_after_the_ignore_method() - { - _destination.Nickname.ShouldEqual("Jimmy"); - } - - [Fact] - public void Should_not_map_a_property_with_an_inaccessible_setter_if_no_specific_mapping_is_configured_even_though_name_and_type_match() - { - _destination.CodeName.ShouldBeNull(); - } - - [Fact] - public void Should_not_map_a_property_with_no_public_setter_if_a_specific_mapping_is_configured_before_the_ignore_method() - { - _destination.ScreenName.ShouldBeNull(); - } - } - - public class When_configuring_a_reverse_map_to_ignore_all_source_properties_with_an_inaccessible_setter : AutoMapperSpecBase - { - private Destination _destination; - private Source _source; - - public class Source - { - public int Id { get; set; } - public string Name { get; set; } - public int Age { get; set; } - public string Force { get; set; } - public string ReverseForce { get; private set; } - public string Respect { get; private set; } - public int Foo { get; private set; } - public int Bar { get; protected set; } - - public void Initialize() - { - ReverseForce = "You With"; - Respect = "R-E-S-P-E-C-T"; - } - } - - public class Destination - { - public string Name { get; set; } - public int Age { get; set; } - public bool IsVisible { get; set; } - public string Force { get; private set; } - public string ReverseForce { get; set; } - public string Respect { get; set; } - public int Foz { get; private set; } - public int Baz { get; protected set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .IgnoreAllPropertiesWithAnInaccessibleSetter() - .ForMember(dest => dest.IsVisible, opt => opt.Ignore()) - .ForMember(dest => dest.Force, opt => opt.MapFrom(src => src.Force)) - .ReverseMap() - .IgnoreAllSourcePropertiesWithAnInaccessibleSetter() - .ForMember(dest => dest.ReverseForce, opt => opt.MapFrom(src => src.ReverseForce)) - .ForSourceMember(dest => dest.IsVisible, opt => opt.Ignore()); - }); - - protected override void Because_of() - { - var source = new Source { Id = 5, Name = "Bob", Age = 35, Force = "With You" }; - source.Initialize(); - _destination = Mapper.Map(source); - _source = Mapper.Map(_destination); - } - - [Fact] - public void Should_consider_the_configuration_valid_even_if_some_properties_with_an_inaccessible_setter_are_unmapped() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - - [Fact] - public void Should_forward_and_reverse_map_a_property_that_is_accessible_on_both_source_and_destination() - { - _source.Name.ShouldEqual("Bob"); - } - - [Fact] - public void Should_forward_and_reverse_map_an_inaccessible_destination_property_if_a_mapping_is_defined() - { - _source.Force.ShouldEqual("With You"); - } - - [Fact] - public void Should_forward_and_reverse_map_an_inaccessible_source_property_if_a_mapping_is_defined() - { - _source.ReverseForce.ShouldEqual("You With"); - } - - [Fact] - public void Should_forward_and_reverse_map_an_inaccessible_source_property_even_if_a_mapping_is_not_defined() - { - _source.Respect.ShouldEqual("R-E-S-P-E-C-T"); // justification: if the mapping works one way, it should work in reverse - } - } - } +using System; +using System.Linq; +using System.Reflection; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.ConditionalMapping +{ + public class When_adding_a_condition_for_all_members : AutoMapperSpecBase + { + Source _source = new Source { Value = 3 }; + Destination _destination = new Destination { Value = 7 }; + + class Source + { + public int Value { get; set; } + } + + class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForAllMembers(o => o.Condition((source, destination, sourceProperty, destinationProperty) => + { + source.ShouldBeSameAs(_source); + destination.ShouldBeSameAs(_destination); + ((int)sourceProperty).ShouldBe(3); + ((int)destinationProperty).ShouldBe(7); + return true; + })); + }); + + protected override void Because_of() + { + Mapper.Map(_source, _destination); + } + } + + public class When_ignoring_all_properties_with_an_inaccessible_setter_and_explicitly_implemented_member : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(c => c.CreateMap().IgnoreAllPropertiesWithAnInaccessibleSetter()); + + interface Interface + { + int Value { get; } + } + + class SourceClass + { + public int PublicProperty { get; set; } + } + + class DestinationClass : Interface + { + int Interface.Value { get { return 123; } } + + public int PrivateProperty { get; private set; } + + public int PublicProperty { get; set; } + } + } + + public class When_configuring_a_member_to_skip_based_on_the_property_value : AutoMapperSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.Condition(src => src.Value > 0)); + }); + + [Fact] + public void Should_skip_the_mapping_when_the_condition_is_true() + { + var destination = Mapper.Map(new Source {Value = -1}); + + destination.Value.ShouldBe(0); + } + + [Fact] + public void Should_execute_the_mapping_when_the_condition_is_false() + { + var destination = Mapper.Map(new Source { Value = 7 }); + + destination.Value.ShouldBe(7); + } + } + + public class When_configuring_a_member_to_skip_based_on_the_property_value_with_custom_mapping : AutoMapperSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => + { + opt.Condition(src => src.Value > 0); + opt.MapFrom(src => 10); + }); + }); + + [Fact] + public void Should_skip_the_mapping_when_the_condition_is_true() + { + var destination = Mapper.Map(new Source { Value = -1 }); + + destination.Value.ShouldBe(0); + } + + [Fact] + public void Should_execute_the_mapping_when_the_condition_is_false() + { + Mapper.Map(new Source { Value = 7 }).Value.ShouldBe(10); + } + } + + public class When_configuring_a_map_to_ignore_all_properties_with_an_inaccessible_setter : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Id { get; set; } + public string Title { get; set; } + public string CodeName { get; set; } + public string Nickname { get; set; } + public string ScreenName { get; set; } + } + + public class Destination + { + private double _height; + + public int Id { get; set; } + public virtual string Name { get; protected set; } + public string Title { get; internal set; } + public string CodeName { get; private set; } + public string Nickname { get; private set; } + public string ScreenName { get; private set; } + public int Age { get; private set; } + + public double Height + { + get { return _height; } + } + + public Destination() + { + _height = 60; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.ScreenName, opt => opt.MapFrom(src => src.ScreenName)) + .IgnoreAllPropertiesWithAnInaccessibleSetter() + .ForMember(dest => dest.Nickname, opt => opt.MapFrom(src => src.Nickname)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Id = 5, CodeName = "007", Nickname = "Jimmy", ScreenName = "jbogard" }); + } + + [Fact] + public void Should_consider_the_configuration_valid_even_if_some_properties_with_an_inaccessible_setter_are_unmapped() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + + [Fact] + public void Should_map_a_property_with_an_inaccessible_setter_if_a_specific_mapping_is_configured_after_the_ignore_method() + { + _destination.Nickname.ShouldBe("Jimmy"); + } + + [Fact] + public void Should_not_map_a_property_with_an_inaccessible_setter_if_no_specific_mapping_is_configured_even_though_name_and_type_match() + { + _destination.CodeName.ShouldBeNull(); + } + + [Fact] + public void Should_not_map_a_property_with_no_public_setter_if_a_specific_mapping_is_configured_before_the_ignore_method() + { + _destination.ScreenName.ShouldBeNull(); + } + } + + public class When_configuring_a_reverse_map_to_ignore_all_source_properties_with_an_inaccessible_setter : AutoMapperSpecBase + { + private Destination _destination; + private Source _source; + + public class Source + { + public int Id { get; set; } + public string Name { get; set; } + public int Age { get; set; } + public string Force { get; set; } + public string ReverseForce { get; private set; } + public string Respect { get; private set; } + public int Foo { get; private set; } + public int Bar { get; protected set; } + + public void Initialize() + { + ReverseForce = "You With"; + Respect = "R-E-S-P-E-C-T"; + } + } + + public class Destination + { + public string Name { get; set; } + public int Age { get; set; } + public bool IsVisible { get; set; } + public string Force { get; private set; } + public string ReverseForce { get; set; } + public string Respect { get; set; } + public int Foz { get; private set; } + public int Baz { get; protected set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter() + .ForMember(dest => dest.IsVisible, opt => opt.Ignore()) + .ForMember(dest => dest.Force, opt => opt.MapFrom(src => src.Force)) + .ReverseMap() + .IgnoreAllSourcePropertiesWithAnInaccessibleSetter() + .ForMember(dest => dest.ReverseForce, opt => opt.MapFrom(src => src.ReverseForce)) + .ForSourceMember(dest => dest.IsVisible, opt => opt.DoNotValidate()); + }); + + protected override void Because_of() + { + var source = new Source { Id = 5, Name = "Bob", Age = 35, Force = "With You" }; + source.Initialize(); + _destination = Mapper.Map(source); + _source = Mapper.Map(_destination); + } + + [Fact] + public void Should_consider_the_configuration_valid_even_if_some_properties_with_an_inaccessible_setter_are_unmapped() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + + [Fact] + public void Should_forward_and_reverse_map_a_property_that_is_accessible_on_both_source_and_destination() + { + _source.Name.ShouldBe("Bob"); + } + + [Fact] + public void Should_forward_and_reverse_map_an_inaccessible_destination_property_if_a_mapping_is_defined() + { + _source.Force.ShouldBe("With You"); + } + + [Fact] + public void Should_forward_and_reverse_map_an_inaccessible_source_property_if_a_mapping_is_defined() + { + _source.ReverseForce.ShouldBe("You With"); + } + + [Fact] + public void Should_forward_and_reverse_map_an_inaccessible_source_property_even_if_a_mapping_is_not_defined() + { + _source.Respect.ShouldBe("R-E-S-P-E-C-T"); // justification: if the mapping works one way, it should work in reverse + } + } } \ No newline at end of file diff --git a/src/UnitTests/ConfigCompilation.cs b/src/UnitTests/ConfigCompilation.cs new file mode 100644 index 0000000000..33d74e4814 --- /dev/null +++ b/src/UnitTests/ConfigCompilation.cs @@ -0,0 +1,29 @@ +namespace AutoMapper.UnitTests +{ + using System.Collections.Generic; + using Shouldly; + using Xunit; + + public class ConfigCompilation : NonValidatingSpecBase + { + public class Source { } + public class Dest { } + public class Source2 { } + public class Dest2 { } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(typeof(IEnumerable<>), typeof(IEnumerable<>)).ConvertUsing(s => s); + }); + + [Fact] + public void Should_compile_mappings() + { + Configuration.CompileMappings(); + + Mapper.Map(new Source()).ShouldNotBeNull(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/ConfigurationFeatureTest.cs b/src/UnitTests/ConfigurationFeatureTest.cs new file mode 100644 index 0000000000..e729458f5d --- /dev/null +++ b/src/UnitTests/ConfigurationFeatureTest.cs @@ -0,0 +1,142 @@ +using AutoMapper.Features; +using Shouldly; +using System.Collections.Generic; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class ConfigurationFeatureTest + { + [Fact] + public void Adding_same_feature_multiple_times_should_replace_eachother() + { + var featureA = new ConfigurationExpressionFeatureA(1); + var featureB = new ConfigurationExpressionFeatureB(1); + var config = new MapperConfiguration(cfg => + { + cfg.SetFeature(new ConfigurationExpressionFeatureA(3)); + cfg.SetFeature(new ConfigurationExpressionFeatureA(2)); + cfg.SetFeature(featureA); + cfg.SetFeature(new ConfigurationExpressionFeatureB(3)); + cfg.SetFeature(new ConfigurationExpressionFeatureB(2)); + cfg.SetFeature(featureB); + }); + + Validate(featureA, config); + Validate(featureB, config); + } + + [Fact] + public void Add_single_feature() + { + var featureA = new ConfigurationExpressionFeatureA(1); + var config = new MapperConfiguration(cfg => + { + cfg.SetFeature(featureA); + }); + + Validate(featureA, config); + } + + [Fact] + public void Add_multiple_features() + { + var featureA = new ConfigurationExpressionFeatureA(1); + var featureB = new ConfigurationExpressionFeatureB(2); + var config = new MapperConfiguration(cfg => + { + cfg.SetFeature(featureA); + cfg.SetFeature(featureB); + }); + + Validate(featureA, config); + Validate(featureB, config); + } + + private void Validate(ConfigurationExpressionFeatureBase feature, MapperConfiguration config) + where TFeature : ConfigurationFeatureBase + { + feature.ConfigurationProviders.ShouldBeOfLength(1); + + var configurationFeature = config.Features.Get(); + configurationFeature.ShouldNotBeNull(); + configurationFeature.Value.ShouldBe(feature.Value); + configurationFeature.SealedCount.ShouldBe(1); + } + + public class ConfigurationExpressionFeatureA : ConfigurationExpressionFeatureBase + { + public ConfigurationExpressionFeatureA(int value) : base(value, new ConfigurationFeatureA(value)) + { + } + } + + public class ConfigurationExpressionFeatureB : ConfigurationExpressionFeatureBase + { + public ConfigurationExpressionFeatureB(int value) : base(value, new ConfigurationFeatureB(value)) + { + } + } + + public abstract class ConfigurationExpressionFeatureBase : ConfigurationExpressionFeatureBase + where TFeature : IRuntimeFeature + { + private readonly TFeature _feature; + + protected ConfigurationExpressionFeatureBase(int value, TFeature feature) + : base(value) + { + _feature = feature; + } + + public override void Configure(IConfigurationProvider configurationProvider) + { + ConfigurationProviders.Add(configurationProvider); + configurationProvider.Features.Set(_feature); + } + } + + public abstract class ConfigurationExpressionFeatureBase : IGlobalFeature + { + public int Value { get; } + public List ConfigurationProviders { get; } = new List(); + + protected ConfigurationExpressionFeatureBase(int value) + { + Value = value; + } + + public abstract void Configure(IConfigurationProvider configurationProvider); + } + + public class ConfigurationFeatureA : ConfigurationFeatureBase + { + public ConfigurationFeatureA(int value) : base(value) + { + } + } + + public class ConfigurationFeatureB : ConfigurationFeatureBase + { + public ConfigurationFeatureB(int value) : base(value) + { + } + } + + public abstract class ConfigurationFeatureBase : IRuntimeFeature + { + public int SealedCount { get; private set; } + public int Value { get; } + + public ConfigurationFeatureBase(int value) + { + Value = value; + } + + void IRuntimeFeature.Seal(IConfigurationProvider configurationProvider) + { + SealedCount++; + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/ConfigurationRules.cs b/src/UnitTests/ConfigurationRules.cs new file mode 100644 index 0000000000..966b19b0c6 --- /dev/null +++ b/src/UnitTests/ConfigurationRules.cs @@ -0,0 +1,95 @@ +using System; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class ConfigurationRules : SpecBase + { + public class Source { } + public class Dest { } + + public class Profile1 : Profile + { + public Profile1() + { + CreateMap(); + } + } + + public class Profile2 : Profile + { + public Profile2() + { + CreateMap(); + } + } + + [Fact] + public void Should_throw_for_multiple_create_map_calls() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + typeof(DuplicateTypeMapConfigurationException).ShouldBeThrownBy(() => config.AssertConfigurationIsValid()); + } + + [Fact] + public void Should_not_throw_when_allowing_multiple_create_map_calls() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.Advanced.AllowAdditiveTypeMapCreation = true; + }); + + typeof(DuplicateTypeMapConfigurationException).ShouldNotBeThrownBy(() => config.AssertConfigurationIsValid()); + } + + [Fact] + public void Should_throw_for_multiple_create_map_calls_in_different_profiles() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddProfile(); + cfg.AddProfile(); + }); + + typeof(DuplicateTypeMapConfigurationException).ShouldBeThrownBy(() => config.AssertConfigurationIsValid()); + } + + [Fact] + public void Should_not_throw_when_allowing_multiple_create_map_calls_in_different_profiles() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddProfile(); + cfg.AddProfile(); + cfg.Advanced.AllowAdditiveTypeMapCreation = true; + }); + + typeof(DuplicateTypeMapConfigurationException).ShouldNotBeThrownBy(() => config.AssertConfigurationIsValid()); + } + + [Fact] + public void Should_throw_for_multiple_create_map_calls_in_configuration_expression_and_profile() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.AddProfile(); + }); + + new Action(() => config.AssertConfigurationIsValid()).ShouldThrowException(c => + { + c.Errors.SelectMany(t => t.ProfileNames).ShouldNotContain(string.Empty); + }); + } + + } +} \ No newline at end of file diff --git a/src/UnitTests/ConfigurationValidation.cs b/src/UnitTests/ConfigurationValidation.cs index efc382d645..3ec3e3948e 100644 --- a/src/UnitTests/ConfigurationValidation.cs +++ b/src/UnitTests/ConfigurationValidation.cs @@ -1,484 +1,748 @@ using System; using System.Collections.Generic; -using Should; +using System.Linq; +using AutoMapper.Mappers; +using Shouldly; using Xunit; -namespace AutoMapper.UnitTests +namespace AutoMapper.UnitTests.ConfigurationValidation { - namespace ConfigurationValidation + public class When_using_custom_validation { - public class When_testing_a_dto_with_mismatched_members : NonValidatingSpecBase + bool _calledForRoot = false; + bool _calledForValues = false; + bool _calledForInt = false; + + public class Source { - public class ModelObject - { - public string Foo { get; set; } - public string Barr { get; set; } - } + public int[] Values { get; set; } + } - public class ModelDto - { - public string Foo { get; set; } - public string Bar { get; set; } - } + public class Dest + { + public int[] Values { get; set; } + } - public class ModelObject2 + [Fact] + public void Should_call_the_validator() + { + var config = new MapperConfiguration(cfg => { - public string Foo { get; set; } - public string Barr { get; set; } - } + cfg.Advanced.Validator(Validator); + cfg.CreateMap(); + }); - public class ModelDto2 - { - public string Foo { get; set; } - public string Bar { get; set; } - public string Bar1 { get; set; } - public string Bar2 { get; set; } - public string Bar3 { get; set; } - public string Bar4 { get; set; } - } + config.AssertConfigurationIsValid(); + + _calledForRoot.ShouldBeTrue(); + _calledForValues.ShouldBeTrue(); + _calledForInt.ShouldBeTrue(); + } - public class ModelObject3 + private void Validator(ValidationContext context) + { + if(context.TypeMap != null) { - public string Foo { get; set; } - public string Bar { get; set; } - public string Bar1 { get; set; } - public string Bar2 { get; set; } - public string Bar3 { get; set; } - public string Bar4 { get; set; } + _calledForRoot = true; + context.TypeMap.Types.ShouldBe(context.Types); + context.Types.SourceType.ShouldBe(typeof(Source)); + context.Types.DestinationType.ShouldBe(typeof(Dest)); + context.ObjectMapper.ShouldBeNull(); + context.PropertyMap.ShouldBeNull(); } - - public class ModelDto3 + else { - public string Foo { get; set; } - public string Bar { get; set; } + context.PropertyMap.SourceMember.Name.ShouldBe("Values"); + context.PropertyMap.DestinationName.ShouldBe("Values"); + if(context.Types.Equals(new TypePair(typeof(int), typeof(int)))) + { + _calledForInt = true; + context.ObjectMapper.ShouldBeOfType(); + } + else + { + _calledForValues = true; + context.ObjectMapper.ShouldBeOfType(); + context.Types.SourceType.ShouldBe(typeof(int[])); + context.Types.DestinationType.ShouldBe(typeof(int[])); + } } + } + } + public class When_using_a_type_converter : AutoMapperSpecBase + { + public class A + { + public string Foo { get; set; } + } + public class B + { + public C Foo { get; set; } + } + public class C { } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(MemberList.Source); - }); + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap().ConvertUsing(x => new B { Foo = new C() })); + } - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } + public class When_using_a_type_converter_class : AutoMapperSpecBase + { + public class A + { + public string Foo { get; set; } } + public class B + { + public C Foo { get; set; } + } + public class C { } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap().ConvertUsing()); - public class When_testing_a_dto_with_fully_mapped_and_custom_matchers : NonValidatingSpecBase + class Converter : ITypeConverter { - public class ModelObject - { - public string Foo { get; set; } - public string Barr { get; set; } - } + public B Convert(A source, B dest, ResolutionContext context) => new B { Foo = new C() }; + } + } - public class ModelDto - { - public string Foo { get; set; } - public string Bar { get; set; } - } + public class When_skipping_validation : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dto => dto.Bar, opt => opt.MapFrom(m => m.Barr)); - }); + public class Dest + { + public int Blarg { get; set; } + } - [Fact] - public void Should_pass_an_inspection_of_missing_mappings() - { - Configuration.AssertConfigurationIsValid(); - } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap(MemberList.None)); + + [Fact] + public void Should_skip_validation() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Mapper.ConfigurationProvider.AssertConfigurationIsValid()); } + } - public class When_testing_a_dto_with_matching_member_names_but_mismatched_types : NonValidatingSpecBase + public class When_constructor_does_not_match : NonValidatingSpecBase + { + public class Source { - public class Source - { - public decimal Value { get; set; } - } + public int Value { get; set; } + } - public class Destination + public class Dest + { + public Dest(int blarg) { - public Type Value { get; set; } + Value = blarg; } + public int Value { get; set; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap()); - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } + [Fact] + public void Should_throw() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(() => Configuration.AssertConfigurationIsValid()); } + } - public class When_testing_a_dto_with_member_type_mapped_mappings : AutoMapperSpecBase + public class When_constructor_partially_matches : NonValidatingSpecBase + { + public class Source { - private AutoMapperConfigurationException _exception; + public int Value { get; set; } + } - public class Source + public class Dest + { + public Dest(int value, int blarg) { - public int Value { get; set; } - public OtherSource Other { get; set; } + Value = blarg; } - public class OtherSource - { - public int Value { get; set; } - } + public int Value { get; } + } - public class Destination - { - public int Value { get; set; } - public OtherDest Other { get; set; } - } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap()); - public class OtherDest - { - public int Value { get; set; } - } + [Fact] + public void Should_throw() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(() => Configuration.AssertConfigurationIsValid()); + } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); + public class When_constructor_partially_matches_and_ctor_param_configured : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } - protected override void Because_of() + public class Dest + { + public Dest(int value, int blarg) { - try - { - Configuration.AssertConfigurationIsValid(); - } - catch (AutoMapperConfigurationException ex) - { - _exception = ex; - } + Value = blarg; } - [Fact] - public void Should_pass_a_configuration_check() - { - _exception.ShouldBeNull(); - } + public int Value { get; } } - public class When_testing_a_dto_with_matched_members_but_mismatched_types_that_are_ignored : AutoMapperSpecBase + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { - private AutoMapperConfigurationException _exception; + cfg.CreateMap() + .ForCtorParam("blarg", opt => opt.MapFrom(src => src.Value)); + }); - public class ModelObject - { - public string Foo { get; set; } - public string Bar { get; set; } - } + [Fact] + public void Should_throw() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid()); + } + } + + public class When_constructor_partially_matches_and_constructor_validation_skipped : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } - public class ModelDto + public class Dest + { + public Dest(int value, int blarg) { - public string Foo { get; set; } - public int Bar { get; set; } + Value = blarg; } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Bar, opt => opt.Ignore()); - }); + public int Value { get; } + } - protected override void Because_of() - { - try - { - Configuration.AssertConfigurationIsValid(); - } - catch (AutoMapperConfigurationException ex) - { - _exception = ex; - } - } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().DisableCtorValidation(); + }); - [Fact] - public void Should_pass_a_configuration_check() - { - _exception.ShouldBeNull(); - } + [Fact] + public void Should_throw() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid()); } + } - public class When_testing_a_dto_with_array_types_with_mismatched_element_types : NonValidatingSpecBase + public class When_testing_a_dto_with_mismatched_members : NonValidatingSpecBase + { + public class ModelObject { - public class Source - { - public SourceItem[] Items; - } + public string Foo { get; set; } + public string Barr { get; set; } + } - public class Destination - { - public DestinationItem[] Items; - } + public class ModelDto + { + public string Foo { get; set; } + public string Bar { get; set; } + } - public class SourceItem - { + public class ModelObject2 + { + public string Foo { get; set; } + public string Barr { get; set; } + } - } + public class ModelDto2 + { + public string Foo { get; set; } + public string Bar { get; set; } + public string Bar1 { get; set; } + public string Bar2 { get; set; } + public string Bar3 { get; set; } + public string Bar4 { get; set; } + } - public class DestinationItem - { + public class ModelObject3 + { + public string Foo { get; set; } + public string Bar { get; set; } + public string Bar1 { get; set; } + public string Bar2 { get; set; } + public string Bar3 { get; set; } + public string Bar4 { get; set; } + } - } + public class ModelDto3 + { + public string Foo { get; set; } + public string Bar { get; set; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(MemberList.Source); + }); + + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); } + } - public class When_testing_a_dto_with_list_types_with_mismatched_element_types : NonValidatingSpecBase + public class When_testing_a_dto_with_fully_mapped_and_custom_matchers : NonValidatingSpecBase + { + public class ModelObject { - public class Source - { - public List Items; - } + public string Foo { get; set; } + public string Barr { get; set; } + } - public class Destination - { - public List Items; - } + public class ModelDto + { + public string Foo { get; set; } + public string Bar { get; set; } + } - public class SourceItem - { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dto => dto.Bar, opt => opt.MapFrom(m => m.Barr)); + }); - } + [Fact] + public void Should_pass_an_inspection_of_missing_mappings() + { + Configuration.AssertConfigurationIsValid(); + } + } - public class DestinationItem - { + public class When_testing_a_dto_with_matching_member_names_but_mismatched_types : NonValidatingSpecBase + { + public class Source + { + public decimal Value { get; set; } + } - } + public class Destination + { + public Type Value { get; set; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMissingTypeMaps = false; + }); - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); } + } + + public class When_testing_a_dto_with_member_type_mapped_mappings : AutoMapperSpecBase + { + private AutoMapperConfigurationException _exception; - public class When_testing_a_dto_with_readonly_members : NonValidatingSpecBase + public class Source { - public class Source - { - public int Value { get; set; } - } + public int Value { get; set; } + public OtherSource Other { get; set; } + } - public class Destination - { - public int Value { get; set; } - public string ValuePlusOne { get { return (Value + 1).ToString(); } } - public int ValuePlusTwo { get { return Value + 2; } } - } + public class OtherSource + { + public int Value { get; set; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); + public class Destination + { + public int Value { get; set; } + public OtherDest Other { get; set; } + } - protected override void Because_of() + public class OtherDest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + try { - Mapper.Map(new Source { Value = 5 }); + Configuration.AssertConfigurationIsValid(); } - - [Fact] - public void Should_be_valid() + catch (AutoMapperConfigurationException ex) { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + _exception = ex; } } - public class When_testing_a_dto_in_a_specfic_profile : NonValidatingSpecBase + [Fact] + public void Should_pass_a_configuration_check() { - public class GoodSource - { - public int Value { get; set; } - } + _exception.ShouldBeNull(); + } + } - public class GoodDest + public class When_testing_a_dto_with_matched_members_but_mismatched_types_that_are_ignored : AutoMapperSpecBase + { + private AutoMapperConfigurationException _exception; + + public class ModelObject + { + public string Foo { get; set; } + public string Bar { get; set; } + } + + public class ModelDto + { + public string Foo { get; set; } + public int Bar { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Bar, opt => opt.Ignore()); + }); + + protected override void Because_of() + { + try { - public int Value { get; set; } + Configuration.AssertConfigurationIsValid(); } - - public class BadDest + catch (AutoMapperConfigurationException ex) { - public int Valufffff { get; set; } + _exception = ex; } + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateProfile("Good", profile => - { - profile.CreateMap(); - }); - cfg.CreateProfile("Bad", profile => - { - profile.CreateMap(); - }); - }); + [Fact] + public void Should_pass_a_configuration_check() + { + _exception.ShouldBeNull(); + } + } - [Fact] - public void Should_ignore_bad_dtos_in_other_profiles() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid("Good")); - } + public class When_testing_a_dto_with_array_types_with_mismatched_element_types : NonValidatingSpecBase + { + public class Source + { + public SourceItem[] Items; } - public class When_testing_a_dto_with_mismatched_custom_member_mapping : NonValidatingSpecBase + public class Destination { - public class SubBarr { } + public DestinationItem[] Items; + } - public class SubBar { } + public class SourceItem + { - public class ModelObject - { - public string Foo { get; set; } - public SubBarr Barr { get; set; } - } + } - public class ModelDto - { - public string Foo { get; set; } - public SubBar Bar { get; set; } - } + public class DestinationItem + { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Bar, opt => opt.MapFrom(src => src.Barr)); - }); + } - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMissingTypeMaps = false; + }); + + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); } + } - public class When_testing_a_dto_with_value_specified_members : NonValidatingSpecBase + public class When_testing_a_dto_with_list_types_with_mismatched_element_types : NonValidatingSpecBase + { + public class Source { - public class Source { } - public class Destination - { - public int Value { get; set; } - } + public List Items; + } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - object i = 7; - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.UseValue(i)); - }); + public class Destination + { + public List Items; + } + + public class SourceItem + { + + } + + public class DestinationItem + { - [Fact] - public void Should_validate_successfully() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } } - - public class When_testing_a_dto_with_setter_only_peroperty_member : NonValidatingSpecBase - { - public class Source - { - public string Value { set { } } - } - - public class Destination - { - public string Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } - - public class When_testing_a_dto_with_matching_void_method_member : NonValidatingSpecBase - { - public class Source - { - public void Method() - { - } - } - - public class Destination - { - public string Method { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_fail_a_configuration_check() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } - - public class When_redirecting_types : NonValidatingSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMissingTypeMaps = false; + }); + + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_testing_a_dto_with_readonly_members : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + public string ValuePlusOne { get { return (Value + 1).ToString(); } } + public int ValuePlusTwo { get { return Value + 2; } } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + Mapper.Map(new Source { Value = 5 }); + } + + [Fact] + public void Should_be_valid() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_testing_a_dto_in_a_specfic_profile : NonValidatingSpecBase + { + public class GoodSource + { + public int Value { get; set; } + } + + public class GoodDest + { + public int Value { get; set; } + } + + public class BadDest + { + public int Valufffff { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateProfile("Good", profile => { - cfg.CreateMap() - .ForMember(d => d.DifferentName, opt => opt.MapFrom(s => s.Name)); - cfg.CreateMap().As(); + profile.CreateMap(); }); - - [Fact] - public void Should_pass_configuration_check() + cfg.CreateProfile("Bad", profile => { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } + profile.CreateMap(); + }); + }); - class ConcreteSource - { - public string Name { get; set; } - } + [Fact] + public void Should_ignore_bad_dtos_in_other_profiles() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid("Good")); + } + + [Fact] + public void Should_throw_when_profile_name_does_not_exist() + { + typeof(ArgumentOutOfRangeException).ShouldBeThrownBy(() => Configuration.AssertConfigurationIsValid("Does not exist")); + } + } + + public class When_testing_a_dto_with_mismatched_custom_member_mapping : NonValidatingSpecBase + { + public class SubBarr { } + + public class SubBar { } - class ConcreteDest : IAbstractDest + public class ModelObject + { + public string Foo { get; set; } + public SubBarr Barr { get; set; } + } + + public class ModelDto + { + public string Foo { get; set; } + public SubBar Bar { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Bar, opt => opt.MapFrom(src => src.Barr)); + cfg.CreateMissingTypeMaps = false; + }); + + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_testing_a_dto_with_value_specified_members : NonValidatingSpecBase + { + public class Source { } + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + object i = 7; + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => i)); + }); + + [Fact] + public void Should_validate_successfully() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_testing_a_dto_with_setter_only_peroperty_member : NonValidatingSpecBase + { + public class Source + { + public string Value { set { } } + } + + public class Destination + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_testing_a_dto_with_matching_void_method_member : NonValidatingSpecBase + { + public class Source + { + public void Method() { - public string DifferentName { get; set; } } + } + + public class Destination + { + public string Method { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_fail_a_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_redirecting_types : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.DifferentName, opt => opt.MapFrom(s => s.Name)); + cfg.CreateMap().As(); + }); + + [Fact] + public void Should_pass_configuration_check() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + + class ConcreteSource + { + public string Name { get; set; } + } - interface IAbstractDest + class ConcreteDest : IAbstractDest + { + public string DifferentName { get; set; } + } + + interface IAbstractDest + { + string DifferentName { get; set; } + } + } + + public class When_configuring_a_resolver : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.CreateMap().ForMember(d => d.Details, o => o.MapFrom()); + }); + public class DetailsValueResolver : IValueResolver>> + { + public List> Resolve(Query source, Command destination, List> destMember, ResolutionContext context) { - string DifferentName { get; set; } + return source.Details + .Select(d => new KeyValuePair(d.ToString(), d.ToString())) + .ToList(); } } - } + public class Query + { + public List Details { get; set; } + } -} + public class Command + { + public List> Details { get; private set; } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Constructors.cs b/src/UnitTests/Constructors.cs index 5db64628b4..b69b267b53 100644 --- a/src/UnitTests/Constructors.cs +++ b/src/UnitTests/Constructors.cs @@ -1,775 +1,1609 @@ -using System; -using System.Linq.Expressions; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace Constructors - { - public class When_mapping_an_optional_GUID_constructor : AutoMapperSpecBase - { - Destination _destination; - - public class Destination - { - public Destination(Guid id = default(Guid)) { Id = id; } - public Guid Id { get; set; } - } - - public class Source - { - public Guid Id { get; set; } - } - - protected override MapperConfiguration Configuration - { - get - { - return new MapperConfiguration(c=>c.CreateMap()); - } - } - - protected override void Because_of() - { - _destination = Mapper.Map(new Source()); - } - - [Fact] - public void Should_map_ok() - { - _destination.Id.ShouldEqual(Guid.Empty); - } - } - - public class When_mapping_a_constructor_parameter_from_nested_members : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public NestedSource Nested { get; set; } - } - - public class NestedSource - { - public int Foo { get; set; } - } - - public class Destination - { - public int Foo { get; } - - public Destination(int foo) - { - Foo = foo; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ForCtorParam("foo", opt => opt.MapFrom(s => s.Nested.Foo)); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Nested = new NestedSource { Foo = 5 } }); - } - - [Fact] - public void Should_map_the_constructor_argument() - { - _destination.Foo.ShouldEqual(5); - } - } - - public class When_the_destination_has_a_matching_constructor_with_optional_extra_parameters : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Foo { get; set; } - } - - public class Destination - { - private readonly int _foo; - - public int Foo - { - get { return _foo; } - } - - public string Bar { get;} - - public Destination(int foo, string bar = "bar") - { - _foo = foo; - Bar = bar; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Foo = 5 }); - } - - [Fact] - public void Should_map_the_constructor_argument() - { - _destination.Foo.ShouldEqual(5); - _destination.Bar.ShouldEqual("bar"); - } - } - - public class When_mapping_to_an_object_with_a_constructor_with_a_matching_argument : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Foo { get; set; } - public int Bar { get; set; } - } - - public class Dest - { - private readonly int _foo; - - public int Foo - { - get { return _foo; } - } - - public int Bar { get; set; } - - public Dest(int foo) - { - _foo = foo; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - Expression> ctor = (input) => new Dest((int)input); - - object o = ctor.Compile()(5); - - _dest = Mapper.Map(new Source { Foo = 5, Bar = 10 }); - } - - [Fact] - public void Should_map_the_constructor_argument() - { - _dest.Foo.ShouldEqual(5); - } - - [Fact] - public void Should_map_the_existing_properties() - { - _dest.Bar.ShouldEqual(10); - } - } - - public class When_mapping_to_an_object_with_a_private_constructor : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Foo { get; set; } - } - - public class Dest - { - private readonly int _foo; - - public int Foo - { - get { return _foo; } - } - - private Dest(int foo) - { - _foo = foo; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source { Foo = 5 }); - } - - [Fact] - public void Should_map_the_constructor_argument() - { - _dest.Foo.ShouldEqual(5); - } - } - - public class When_mapping_to_an_object_using_service_location : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Foo { get; set; } - } - - public class Dest - { - private int _foo; - private readonly int _addend; - - public int Foo - { - get { return _foo + _addend; } - set { _foo = value; } - } - - public Dest(int addend) - { - _addend = addend; - } - - public Dest() - : this(0) - { - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.ConstructServicesUsing(t => new Dest(5)); - cfg.CreateMap() - .ConstructUsingServiceLocator(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source { Foo = 5 }); - } - - [Fact] - public void Should_map_with_the_custom_constructor() - { - _dest.Foo.ShouldEqual(10); - } - } - - public class When_mapping_to_an_object_using_contextual_service_location : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Foo { get; set; } - } - - public class Dest - { - private int _foo; - private readonly int _addend; - - public int Foo - { - get { return _foo + _addend; } - set { _foo = value; } - } - - public Dest(int addend) - { - _addend = addend; - } - - public Dest() - : this(0) - { - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.ConstructServicesUsing(t => new Dest(5)); - cfg.CreateMap() - .ConstructUsingServiceLocator(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source { Foo = 5 }, opt => opt.ConstructServicesUsing(t => new Dest(6))); - } - - [Fact] - public void Should_map_with_the_custom_constructor() - { - _dest.Foo.ShouldEqual(11); - } - } - - public class When_mapping_to_an_object_with_multiple_constructors_and_constructor_mapping_is_disabled : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Foo { get; set; } - public int Bar { get; set; } - } - - public class Dest - { - public int Foo { get; set; } - - public int Bar { get; set; } - - public Dest(int foo) - { - throw new NotImplementedException(); - } - - public Dest() { } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.DisableConstructorMapping(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source { Foo = 5, Bar = 10 }); - } - - [Fact] - public void Should_map_the_existing_properties() - { - _dest.Foo.ShouldEqual(5); - _dest.Bar.ShouldEqual(10); - } - } - public class UsingMappingEngineToResolveConstructorArguments - { - [Fact] - public void Should_resolve_constructor_arguments_using_mapping_engine() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - cfg.CreateMap(); - }); - - var sourceBar = new SourceBar("fooBar"); - var sourceFoo = new SourceFoo(sourceBar); - - var destinationFoo = config.CreateMapper().Map(sourceFoo); - - destinationFoo.Bar.FooBar.ShouldEqual(sourceBar.FooBar); - } - - - public class DestinationFoo - { - private readonly DestinationBar _bar; - - public DestinationBar Bar - { - get { return _bar; } - } - - public DestinationFoo(DestinationBar bar) - { - _bar = bar; - } - } - - public class DestinationBar - { - private readonly string _fooBar; - - public string FooBar - { - get { return _fooBar; } - } - - public DestinationBar(string fooBar) - { - _fooBar = fooBar; - } - } - - public class SourceFoo - { - public SourceBar Bar { get; private set; } - - public SourceFoo(SourceBar bar) - { - Bar = bar; - } - } - - public class SourceBar - { - public string FooBar { get; private set; } - - public SourceBar(string fooBar) - { - FooBar = fooBar; - } - } - } - - public class MappingMultipleConstructorArguments - { - [Fact] - public void Should_resolve_constructor_arguments_using_mapping_engine() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - cfg.CreateMap(); - }); - - var sourceBar = new SourceBar("fooBar"); - var sourceFoo = new SourceFoo(sourceBar, new SourceBar("fooBar2")); - - var destinationFoo = config.CreateMapper().Map(sourceFoo); - - destinationFoo.Bar.FooBar.ShouldEqual(sourceBar.FooBar); - destinationFoo.Bar2.FooBar.ShouldEqual("fooBar2"); - } - - - public class DestinationFoo - { - private readonly DestinationBar _bar; - - public DestinationBar Bar - { - get { return _bar; } - } - - public DestinationBar Bar2 { get; private set; } - - public DestinationFoo(DestinationBar bar, DestinationBar bar2) - { - _bar = bar; - Bar2 = bar2; - } - } - - public class DestinationBar - { - private readonly string _fooBar; - - public string FooBar - { - get { return _fooBar; } - } - - public DestinationBar(string fooBar) - { - _fooBar = fooBar; - } - } - - public class SourceFoo - { - public SourceBar Bar { get; private set; } - public SourceBar Bar2 { get; private set; } - - public SourceFoo(SourceBar bar, SourceBar bar2) - { - Bar = bar; - Bar2 = bar2; - } - } - - public class SourceBar - { - public string FooBar { get; private set; } - - public SourceBar(string fooBar) - { - FooBar = fooBar; - } - } - } - - public class When_mapping_to_an_object_with_a_constructor_with_multiple_optional_arguments - { - [Fact] - public void Should_resolve_constructor_when_args_are_optional() - { - - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var sourceBar = new SourceBar("fooBar"); - var sourceFoo = new SourceFoo(sourceBar); - - var destinationFoo = config.CreateMapper().Map(sourceFoo); - - destinationFoo.Bar.ShouldBeNull(); - destinationFoo.Str.ShouldEqual("hello"); - } - - - public class DestinationFoo - { - private readonly DestinationBar _bar; - private string _str; - - public DestinationBar Bar - { - get { return _bar; } - } - - public string Str - { - get { return _str; } - } - - public DestinationFoo(DestinationBar bar=null,string str="hello") - { - _bar = bar; - _str = str; - } - } - - public class DestinationBar - { - private readonly string _fooBar; - - public string FooBar - { - get { return _fooBar; } - } - - public DestinationBar(string fooBar) - { - _fooBar = fooBar; - } - } - - public class SourceFoo - { - public SourceBar Bar { get; private set; } - - public SourceFoo(SourceBar bar) - { - Bar = bar; - } - } - - public class SourceBar - { - public string FooBar { get; private set; } - - public SourceBar(string fooBar) - { - FooBar = fooBar; - } - } - } - - - public class When_mapping_to_an_object_with_a_constructor_with_single_optional_arguments - { - [Fact] - public void Should_resolve_constructor_when_arg_is_optional() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var sourceBar = new SourceBar("fooBar"); - var sourceFoo = new SourceFoo(sourceBar); - - var destinationFoo = config.CreateMapper().Map(sourceFoo); - - destinationFoo.Bar.ShouldBeNull(); - } - - - public class DestinationFoo - { - private readonly DestinationBar _bar; - - public DestinationBar Bar - { - get { return _bar; } - } - - public DestinationFoo(DestinationBar bar = null) - { - _bar = bar; - } - } - - public class DestinationBar - { - private readonly string _fooBar; - - public string FooBar - { - get { return _fooBar; } - } - - public DestinationBar(string fooBar) - { - _fooBar = fooBar; - } - } - - public class SourceFoo - { - public SourceBar Bar { get; private set; } - - public SourceFoo(SourceBar bar) - { - Bar = bar; - } - } - - public class SourceBar - { - public string FooBar { get; private set; } - - public SourceBar(string fooBar) - { - FooBar = fooBar; - } - } - } - - public class When_mapping_to_an_object_with_a_constructor_with_string_optional_arguments - { - [Fact] - public void Should_resolve_constructor_when_string_args_are_optional() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var sourceBar = new SourceBar("fooBar"); - var sourceFoo = new SourceFoo(sourceBar); - - var destinationFoo = config.CreateMapper().Map(sourceFoo); - - destinationFoo.A.ShouldEqual("a"); - destinationFoo.B.ShouldEqual("b"); - destinationFoo.C.ShouldEqual(3); - } - - - public class DestinationFoo - { - private string _a; - private string _b; - private int _c; - public string A - { - get { return _a; } - } - - public string B - { - get { return _b; } - } - - public int C - { - get { return _c; } - } - - public DestinationFoo(string a = "a",string b="b", int c = 3) - { - _a = a; - _b = b; - _c = c; - } - } - - public class DestinationBar - { - private readonly string _fooBar; - - public string FooBar - { - get { return _fooBar; } - } - - public DestinationBar(string fooBar) - { - _fooBar = fooBar; - } - } - - public class SourceFoo - { - public SourceBar Bar { get; private set; } - - public SourceFoo(SourceBar bar) - { - Bar = bar; - } - } - - public class SourceBar - { - public string FooBar { get; private set; } - - public SourceBar(string fooBar) - { - FooBar = fooBar; - } - } - } - - public class When_configuring_ctor_param_members : AutoMapperSpecBase - { - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public Dest(int thing) - { - Value1 = thing; - } - - public int Value1 { get; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ForCtorParam("thing", opt => opt.MapFrom(src => src.Value)); - }); - - [Fact] - public void Should_redirect_value() - { - var dest = Mapper.Map(new Source {Value = 5}); - - dest.Value1.ShouldEqual(5); - } - } - } -} \ No newline at end of file +using System; +using System.Linq; +using System.Linq.Expressions; +using Xunit; +using Shouldly; +using System.Collections.Generic; +using System.Diagnostics; + +namespace AutoMapper.UnitTests.Constructors +{ + public class Dynamic_constructor_mapping : AutoMapperSpecBase + { + public class ParentDTO + { + public ChildDTO First => Children[0]; + public List Children { get; set; } = new List(); + public int IdParent { get; set; } + } + + public class ChildDTO + { + public int IdChild { get; set; } + public ParentDTO Parent { get; set; } + } + + public class ParentModel + { + public ChildModel First { get; set; } + public List Children { get; set; } = new List(); + public int IdParent { get; set; } + } + + public class ChildModel + { + int _idChild; + + public ChildModel(ParentModel parent) + { + Parent = parent; + } + + public int IdChild + { + get => _idChild; + set + { + if(_idChild != 0) + { + throw new Exception("Set IdChild again."); + } + _idChild = value; + } + } + public ParentModel Parent { get; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(_=> { }); + + [Fact] + public void Should_work() + { + var parentDto = new ParentDTO { IdParent = 1 }; + for(var i = 0; i < 5; i++) + { + parentDto.Children.Add(new ChildDTO { IdChild = i, Parent = parentDto }); + } + var parentModel = Mapper.Map(parentDto); + var mappedChildren = Mapper.Map, List>(parentDto.Children); + } + } + + public class Constructor_mapping_without_preserve_references : AutoMapperSpecBase + { + public class ParentDTO + { + public ChildDTO First => Children[0]; + public List Children { get; set; } = new List(); + public int IdParent { get; set; } + } + + public class ChildDTO + { + public int IdChild { get; set; } + public ParentDTO Parent { get; set; } + } + + public class ParentModel + { + public ChildModel First { get; set; } + public List Children { get; set; } = new List(); + public int IdParent { get; set; } + } + + public class ChildModel + { + int _idChild; + + public ChildModel(ParentModel parent) + { + Parent = parent; + } + + public int IdChild + { + get => _idChild; + set + { + if(_idChild != 0) + { + throw new Exception("Set IdChild again."); + } + _idChild = value; + } + } + public ParentModel Parent { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(c => c.Parent, o => o.Ignore()); + cfg.CreateMap(); + }); + + [Fact] + public void Should_work() + { + var parentDto = new ParentDTO { IdParent = 1 }; + for(var i = 0; i < 5; i++) + { + parentDto.Children.Add(new ChildDTO { IdChild = i, Parent = parentDto }); + } + + var mappedChildren = Mapper.Map, List>(parentDto.Children); + } + } + + public class Preserve_references_with_constructor_mapping : AutoMapperSpecBase + { + public class ParentDTO + { + public ChildDTO First => Children[0]; + public List Children { get; set; } = new List(); + public int IdParent { get; set; } + } + + public class ChildDTO + { + public int IdChild { get; set; } + public ParentDTO Parent { get; set; } + } + + public class ParentModel + { + public ChildModel First { get; set; } + public List Children { get; set; } = new List(); + public int IdParent { get; set; } + } + + public class ChildModel + { + int _idChild; + + public ChildModel(ParentModel parent) + { + Parent = parent; + } + + public int IdChild + { + get => _idChild; + set + { + if(_idChild != 0) + { + throw new Exception("Set IdChild again."); + } + _idChild = value; + } + } + public ParentModel Parent { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap().PreserveReferences(); + cfg.CreateMap().ForMember(c => c.Parent, o => o.Ignore()).PreserveReferences(); + }); + + [Fact] + public void Should_work() + { + var parentDto = new ParentDTO { IdParent = 1 }; + for(var i = 0; i < 5; i++) + { + parentDto.Children.Add(new ChildDTO { IdChild = i, Parent = parentDto }); + } + + var mappedChildren = Mapper.Map, List>(parentDto.Children); + var parentModel = mappedChildren.Select(c => c.Parent).Distinct().Single(); + parentModel.First.ShouldBe(mappedChildren[0]); + } + } + + public class When_construct_mapping_a_struct_with_string : AutoMapperSpecBase + { + public struct Source + { + public string Property { get; set; } + } + + public struct Destination + { + public Destination(string property) + { + Property = property; + } + + public string Property { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_ok() + { + var source = new Source { Property = "value" }; + var destination = Mapper.Map(source); + destination.Property.ShouldBe("value"); + } + } + + public class When_construct_mapping_a_struct : AutoMapperSpecBase + { + public class Dto + { + public double Value { get; set; } + } + + public class Entity + { + public double Value { get; set; } + } + + public struct Source + { + public Dto Property { get; set; } + } + + public struct Destination + { + public Destination(Entity property) + { + Property = property; + } + + public Entity Property { get; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + }); + + [Fact] + public void Should_map_ok() + { + var source = new Source + { + Property = new Dto { Value = 5.0 } + }; + var destination = Mapper.Map(source); + destination.Property.Value.ShouldBe(5.0); + Mapper.Map(destination).Property.Value.ShouldBe(5.0); + } + } + + public class When_mapping_to_an_abstract_type : AutoMapperSpecBase + { + class Source + { + public int Value { get; set; } + } + + abstract class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c=>c.CreateMap()); + + [Fact] + public void Should_throw() + { + new Action(() => Mapper.Map(new Source())).ShouldThrow($"Cannot create an instance of abstract type {typeof(Destination)}."); + } + } + + public class When_a_constructor_with_extra_parameters_doesnt_match : AutoMapperSpecBase + { + PersonTarget _destination; + + class PersonSource + { + public int Age { get; set; } + public string Name { get; set; } + } + + class PersonTarget + { + public int Age { get; set; } + public string Name { get; set; } + + public PersonTarget(int age, string name) + { + this.Age = age; + this.Name = name; + } + + public PersonTarget(int age, string firstName, string lastName) + { + this.Age = age; + this.Name = firstName + " " + lastName; + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c=>c.CreateMap()); + + protected override void Because_of() + { + _destination = Mapper.Map(new PersonSource { Age = 23, Name = "Marc" }); + } + + [Fact] + public void We_should_choose_a_matching_constructor() + { + _destination.Age.ShouldBe(23); + _destination.Name.ShouldBe("Marc"); + } + } + + public class When_renaming_class_constructor_parameter : AutoMapperSpecBase + { + Destination _destination; + + public class Source + { + public InnerSource InnerSource { get; set; } + } + + public class InnerSource + { + public string Name { get; set; } + } + + public class Destination + { + public Destination(InnerDestination inner) + { + InnerDestination = inner; + } + + public InnerDestination InnerDestination { get; } + } + + public class InnerDestination + { + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap().ForCtorParam("inner", o=>o.MapFrom(s=>s.InnerSource)); + c.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { InnerSource = new InnerSource { Name = "Core" } }); + } + + [Fact] + public void Should_map_ok() + { + _destination.InnerDestination.Name.ShouldBe("Core"); + } + } + + public class When_constructor_matches_with_prefix_and_postfix : AutoMapperSpecBase + { + PersonDto _destination; + + public class Person + { + public string PrefixNamePostfix { get; set; } + } + + public class PersonDto + { + string name; + + public PersonDto(string name) + { + this.name = name; + } + + public string Name => name; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.RecognizePostfixes("postfix"); + cfg.RecognizePrefixes("prefix"); + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Person { PrefixNamePostfix = "John" }); + } + + [Fact] + public void Should_map_from_the_property() + { + _destination.Name.ShouldBe("John"); + } + } + + public class When_constructor_matches_with_destination_prefix_and_postfix : AutoMapperSpecBase + { + PersonDto _destination; + + public class Person + { + public string Name { get; set; } + } + + public class PersonDto + { + string name; + + public PersonDto(string prefixNamePostfix) + { + name = prefixNamePostfix; + } + + public string Name => name; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.RecognizeDestinationPostfixes("postfix"); + cfg.RecognizeDestinationPrefixes("prefix"); + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Person { Name = "John" }); + } + + [Fact] + public void Should_map_from_the_property() + { + _destination.Name.ShouldBe("John"); + } + } + + public class When_constructor_matches_but_is_overriden_by_ConstructUsing : AutoMapperSpecBase + { + PersonDto _destination; + + public class Person + { + public string Name { get; set; } + } + + public class PersonDto + { + public PersonDto() + { + } + + public PersonDto(string name) + { + Name = name; + } + + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap().ConstructUsing(p=>new PersonDto())); + + protected override void Because_of() + { + _destination = Mapper.Map(new Person { Name = "John" }); + } + + [Fact] + public void Should_map_from_the_property() + { + var typeMap = Configuration.FindTypeMapFor(); + _destination.Name.ShouldBe("John"); + } + } + + public class When_constructor_is_match_with_default_value : AutoMapperSpecBase + { + PersonDto _destination; + + public class Person + { + public string Name { get; set; } + } + + public class PersonDto + { + public PersonDto(string name = null) + { + Name = name; + } + + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap()); + + protected override void Because_of() + { + _destination = Mapper.Map(new Person { Name = "John" }); + } + + [Fact] + public void Should_map_from_the_property() + { + _destination.Name.ShouldBe("John"); + } + } + + public class When_constructor_is_partial_match_with_value_type : AutoMapperSpecBase + { + GeoCoordinate _destination; + + public class GeolocationDTO + { + public double Longitude { get; set; } + public double Latitude { get; set; } + public double? HorizontalAccuracy { get; set; } + } + + public struct GeoCoordinate + { + public GeoCoordinate(double longitude, double latitude, double x) + { + Longitude = longitude; + Latitude = latitude; + HorizontalAccuracy = 0; + } + public double Longitude { get; set; } + public double Latitude { get; set; } + public double? HorizontalAccuracy { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new GeolocationDTO + { + Latitude = 34d, + Longitude = -93d, + HorizontalAccuracy = 100 + }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_ok() + { + _destination.Latitude.ShouldBe(34); + _destination.Longitude.ShouldBe(-93); + _destination.HorizontalAccuracy.ShouldBe(100); + } + } + + public class When_constructor_is_partial_match : AutoMapperSpecBase + { + GeoCoordinate _destination; + + public class GeolocationDTO + { + public double Longitude { get; set; } + public double Latitude { get; set; } + public double? HorizontalAccuracy { get; set; } + } + + public class GeoCoordinate + { + public GeoCoordinate() + { + } + public GeoCoordinate(double longitude, double latitude, double x) + { + Longitude = longitude; + Latitude = latitude; + } + public double Longitude { get; set; } + public double Latitude { get; set; } + public double? HorizontalAccuracy { get; set; } + public double Altitude { get; set; } + public double VerticalAccuracy { get; set; } + public double Speed { get; set; } + public double Course { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap() + .ForMember(dest => dest.Altitude, opt => opt.Ignore()) + .ForMember(dest => dest.VerticalAccuracy, opt => opt.Ignore()) + .ForMember(dest => dest.Speed, opt => opt.Ignore()) + .ForMember(dest => dest.Course, opt => opt.Ignore()); + }); + + protected override void Because_of() + { + var source = new GeolocationDTO + { + Latitude = 34d, + Longitude = -93d, + HorizontalAccuracy = 100 + }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_ok() + { + _destination.Latitude.ShouldBe(34); + _destination.Longitude.ShouldBe(-93); + _destination.HorizontalAccuracy.ShouldBe(100); + } + } + + public class When_constructor_matches_but_the_destination_is_passed : AutoMapperSpecBase + { + Destination _destination = new Destination(); + + public class Source + { + public int MyTypeId { get; set; } + } + + public class MyType + { + } + + public class Destination + { + private MyType _myType; + + public Destination() + { + + } + public Destination(MyType myType) + { + _myType = myType; + } + + public MyType MyType + { + get { return _myType; } + set { _myType = value; } + } + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(cfg => + { + cfg.RecognizePostfixes("Id"); + cfg.CreateMap(); + cfg.CreateMap(); + }); + } + } + + protected override void Because_of() + { + Mapper.Map(new Source(), _destination); + } + + [Fact] + public void Should_map_ok() + { + _destination.MyType.ShouldNotBeNull(); + } + } + + public class When_mapping_through_constructor_and_destination_has_setter : AutoMapperSpecBase + { + public class Source + { + public int MyTypeId { get; set; } + } + + public class MyType + { + } + + Destination _destination; + public class Destination + { + private MyType _myType; + + private Destination() + { + + } + public Destination(MyType myType) + { + _myType = myType; + } + + public MyType MyType + { + get { return _myType; } + private set + { + throw new Exception("Should not set through setter."); + } + } + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(cfg => + { + cfg.RecognizePostfixes("Id"); + cfg.CreateMap(); + cfg.CreateMap(); + + }); + } + } + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.MyType.ShouldNotBeNull(); + } + } + + public class When_mapping_an_optional_GUID_constructor : AutoMapperSpecBase + { + Destination _destination; + + public class Destination + { + public Destination(Guid id = default(Guid)) { Id = id; } + public Guid Id { get; set; } + } + + public class Source + { + public Guid Id { get; set; } + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(c=>c.CreateMap()); + } + } + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Id.ShouldBe(Guid.Empty); + } + } + + public class When_mapping_a_constructor_parameter_from_nested_members : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public NestedSource Nested { get; set; } + } + + public class NestedSource + { + public int Foo { get; set; } + } + + public class Destination + { + public int Foo { get; } + + public Destination(int foo) + { + Foo = foo; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForCtorParam("foo", opt => opt.MapFrom(s => s.Nested.Foo)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Nested = new NestedSource { Foo = 5 } }); + } + + [Fact] + public void Should_map_the_constructor_argument() + { + _destination.Foo.ShouldBe(5); + } + } + + public class When_the_destination_has_a_matching_constructor_with_optional_extra_parameters : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Foo { get; set; } + } + + public class Destination + { + private readonly int _foo; + + public int Foo + { + get { return _foo; } + } + + public string Bar { get;} + + public Destination(int foo, string bar = "bar") + { + _foo = foo; + Bar = bar; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Foo = 5 }); + } + + [Fact] + public void Should_map_the_constructor_argument() + { + _destination.Foo.ShouldBe(5); + _destination.Bar.ShouldBe("bar"); + } + } + + public class When_mapping_constructor_argument_fails : AutoMapperSpecBase + { + public class Source + { + public int Foo { get; set; } + public int Bar { get; set; } + } + + public class Dest + { + private readonly int _foo; + + public int Foo + { + get { return _foo; } + } + + public int Bar { get; set; } + + public Dest(DateTime foo) + { + _foo = foo.Day; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMissingTypeMaps = false; + cfg.CreateMap(); + }); + + [Fact] + public void Should_say_what_parameter_fails() + { + new Action(() => Mapper.Map(new Source { Foo = 5, Bar = 10 })).ShouldThrowException(ex => + ex.MemberMap.DestinationName.ShouldBe("AutoMapper.UnitTests.Constructors.When_mapping_constructor_argument_fails+Dest.Void .ctor(System.DateTime).parameter foo")); + } + } + + public class When_mapping_to_an_object_with_a_constructor_with_a_matching_argument : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Foo { get; set; } + public int Bar { get; set; } + } + + public class Dest + { + private readonly int _foo; + + public int Foo + { + get { return _foo; } + } + + public int Bar { get; set; } + + public Dest(int foo) + { + _foo = foo; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + Expression> ctor = (input) => new Dest((int)input); + + object o = ctor.Compile()(5); + + _dest = Mapper.Map(new Source { Foo = 5, Bar = 10 }); + } + + [Fact] + public void Should_map_the_constructor_argument() + { + _dest.Foo.ShouldBe(5); + } + + [Fact] + public void Should_map_the_existing_properties() + { + _dest.Bar.ShouldBe(10); + } + } + + public class When_mapping_to_an_object_with_a_private_constructor : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Foo { get; set; } + } + + public class Dest + { + private readonly int _foo; + + public int Foo + { + get { return _foo; } + } + + private Dest(int foo) + { + _foo = foo; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source { Foo = 5 }); + } + + [Fact] + public void Should_map_the_constructor_argument() + { + _dest.Foo.ShouldBe(5); + } + } + + public class When_mapping_to_an_object_using_service_location : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Foo { get; set; } + } + + public class Dest + { + private int _foo; + private readonly int _addend; + + public int Foo + { + get { return _foo + _addend; } + set { _foo = value; } + } + + public Dest(int addend) + { + _addend = addend; + } + + public Dest() + : this(0) + { + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ConstructServicesUsing(t => new Dest(5)); + cfg.CreateMap() + .ConstructUsingServiceLocator(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source { Foo = 5 }); + } + + [Fact] + public void Should_map_with_the_custom_constructor() + { + _dest.Foo.ShouldBe(10); + } + } + + public class When_mapping_to_an_object_using_contextual_service_location : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Foo { get; set; } + } + + public class Dest + { + private int _foo; + private readonly int _addend; + + public int Foo + { + get { return _foo + _addend; } + set { _foo = value; } + } + + public Dest(int addend) + { + _addend = addend; + } + + public Dest() + : this(0) + { + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ConstructServicesUsing(t => new Dest(5)); + cfg.CreateMap() + .ConstructUsingServiceLocator(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source { Foo = 5 }, opt => opt.ConstructServicesUsing(t => new Dest(6))); + } + + [Fact] + public void Should_map_with_the_custom_constructor() + { + _dest.Foo.ShouldBe(11); + } + } + + public class When_mapping_to_an_object_with_multiple_constructors_and_constructor_mapping_is_disabled : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Foo { get; set; } + public int Bar { get; set; } + } + + public class Dest + { + public int Foo { get; set; } + + public int Bar { get; set; } + + public Dest(int foo) + { + throw new NotImplementedException(); + } + + public Dest() { } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.DisableConstructorMapping(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source { Foo = 5, Bar = 10 }); + } + + [Fact] + public void Should_map_the_existing_properties() + { + _dest.Foo.ShouldBe(5); + _dest.Bar.ShouldBe(10); + } + } + public class UsingMappingEngineToResolveConstructorArguments + { + [Fact] + public void Should_resolve_constructor_arguments_using_mapping_engine() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap(); + }); + + var sourceBar = new SourceBar("fooBar"); + var sourceFoo = new SourceFoo(sourceBar); + + var destinationFoo = config.CreateMapper().Map(sourceFoo); + + destinationFoo.Bar.FooBar.ShouldBe(sourceBar.FooBar); + } + + + public class DestinationFoo + { + private readonly DestinationBar _bar; + + public DestinationBar Bar + { + get { return _bar; } + } + + public DestinationFoo(DestinationBar bar) + { + _bar = bar; + } + } + + public class DestinationBar + { + private readonly string _fooBar; + + public string FooBar + { + get { return _fooBar; } + } + + public DestinationBar(string fooBar) + { + _fooBar = fooBar; + } + } + + public class SourceFoo + { + public SourceBar Bar { get; private set; } + + public SourceFoo(SourceBar bar) + { + Bar = bar; + } + } + + public class SourceBar + { + public string FooBar { get; private set; } + + public SourceBar(string fooBar) + { + FooBar = fooBar; + } + } + } + + public class MappingMultipleConstructorArguments + { + [Fact] + public void Should_resolve_constructor_arguments_using_mapping_engine() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap(); + }); + + var sourceBar = new SourceBar("fooBar"); + var sourceFoo = new SourceFoo(sourceBar, new SourceBar("fooBar2")); + + var destinationFoo = config.CreateMapper().Map(sourceFoo); + + destinationFoo.Bar.FooBar.ShouldBe(sourceBar.FooBar); + destinationFoo.Bar2.FooBar.ShouldBe("fooBar2"); + } + + + public class DestinationFoo + { + private readonly DestinationBar _bar; + + public DestinationBar Bar + { + get { return _bar; } + } + + public DestinationBar Bar2 { get; private set; } + + public DestinationFoo(DestinationBar bar, DestinationBar bar2) + { + _bar = bar; + Bar2 = bar2; + } + } + + public class DestinationBar + { + private readonly string _fooBar; + + public string FooBar + { + get { return _fooBar; } + } + + public DestinationBar(string fooBar) + { + _fooBar = fooBar; + } + } + + public class SourceFoo + { + public SourceBar Bar { get; private set; } + public SourceBar Bar2 { get; private set; } + + public SourceFoo(SourceBar bar, SourceBar bar2) + { + Bar = bar; + Bar2 = bar2; + } + } + + public class SourceBar + { + public string FooBar { get; private set; } + + public SourceBar(string fooBar) + { + FooBar = fooBar; + } + } + } + + public class When_mapping_to_an_object_with_a_constructor_with_multiple_optional_arguments + { + [Fact] + public void Should_resolve_constructor_when_args_are_optional() + { + + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var sourceBar = new SourceBar("fooBar"); + var sourceFoo = new SourceFoo(sourceBar); + + var destinationFoo = config.CreateMapper().Map(sourceFoo); + + destinationFoo.Bar.ShouldBeNull(); + destinationFoo.Str.ShouldBe("hello"); + } + + + public class DestinationFoo + { + private readonly DestinationBar _bar; + private string _str; + + public DestinationBar Bar + { + get { return _bar; } + } + + public string Str + { + get { return _str; } + } + + public DestinationFoo(DestinationBar bar=null,string str="hello") + { + _bar = bar; + _str = str; + } + } + + public class DestinationBar + { + private readonly string _fooBar; + + public string FooBar + { + get { return _fooBar; } + } + + public DestinationBar(string fooBar) + { + _fooBar = fooBar; + } + } + + public class SourceFoo + { + public SourceBar Bar { get; private set; } + + public SourceFoo(SourceBar bar) + { + Bar = bar; + } + } + + public class SourceBar + { + public string FooBar { get; private set; } + + public SourceBar(string fooBar) + { + FooBar = fooBar; + } + } + } + + + public class When_mapping_to_an_object_with_a_constructor_with_single_optional_arguments + { + [Fact] + public void Should_resolve_constructor_when_arg_is_optional() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var sourceBar = new SourceBar("fooBar"); + var sourceFoo = new SourceFoo(sourceBar); + + var destinationFoo = config.CreateMapper().Map(sourceFoo); + + destinationFoo.Bar.ShouldBeNull(); + } + + + public class DestinationFoo + { + private readonly DestinationBar _bar; + + public DestinationBar Bar + { + get { return _bar; } + } + + public DestinationFoo(DestinationBar bar = null) + { + _bar = bar; + } + } + + public class DestinationBar + { + private readonly string _fooBar; + + public string FooBar + { + get { return _fooBar; } + } + + public DestinationBar(string fooBar) + { + _fooBar = fooBar; + } + } + + public class SourceFoo + { + public SourceBar Bar { get; private set; } + + public SourceFoo(SourceBar bar) + { + Bar = bar; + } + } + + public class SourceBar + { + public string FooBar { get; private set; } + + public SourceBar(string fooBar) + { + FooBar = fooBar; + } + } + } + + public class When_mapping_to_an_object_with_a_constructor_with_string_optional_arguments + { + [Fact] + public void Should_resolve_constructor_when_string_args_are_optional() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var sourceBar = new SourceBar("fooBar"); + var sourceFoo = new SourceFoo(sourceBar); + + var destinationFoo = config.CreateMapper().Map(sourceFoo); + + destinationFoo.A.ShouldBe("a"); + destinationFoo.B.ShouldBe("b"); + destinationFoo.C.ShouldBe(3); + } + + + public class DestinationFoo + { + private string _a; + private string _b; + private int _c; + public string A + { + get { return _a; } + } + + public string B + { + get { return _b; } + } + + public int C + { + get { return _c; } + } + + public DestinationFoo(string a = "a",string b="b", int c = 3) + { + _a = a; + _b = b; + _c = c; + } + } + + public class DestinationBar + { + private readonly string _fooBar; + + public string FooBar + { + get { return _fooBar; } + } + + public DestinationBar(string fooBar) + { + _fooBar = fooBar; + } + } + + public class SourceFoo + { + public SourceBar Bar { get; private set; } + + public SourceFoo(SourceBar bar) + { + Bar = bar; + } + } + + public class SourceBar + { + public string FooBar { get; private set; } + + public SourceBar(string fooBar) + { + FooBar = fooBar; + } + } + } + + public class When_configuring_ctor_param_members : AutoMapperSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public Dest(int thing) + { + Value1 = thing; + } + + public int Value1 { get; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForCtorParam("thing", opt => opt.MapFrom(src => src.Value)); + }); + + [Fact] + public void Should_redirect_value() + { + var dest = Mapper.Map(new Source {Value = 5}); + + dest.Value1.ShouldBe(5); + } + } + + public class When_configuring_nullable_ctor_param_members : AutoMapperSpecBase + { + public class Source + { + public int? Value { get; set; } + } + + public class Dest + { + public Dest(int? thing) + { + Value1 = thing; + } + + public int? Value1 { get; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForCtorParam("thing", opt => opt.MapFrom(src => src.Value)); + }); + + [Fact] + public void Should_redirect_value() + { + var dest = Mapper.Map(new Source()); + + dest.Value1.ShouldBeNull(); + } + } +} diff --git a/src/UnitTests/ContextItems.cs b/src/UnitTests/ContextItems.cs index 31f8015155..439896062b 100644 --- a/src/UnitTests/ContextItems.cs +++ b/src/UnitTests/ContextItems.cs @@ -1,113 +1,193 @@ -namespace AutoMapper.UnitTests -{ - namespace ContextItems - { - using Should; - using Xunit; - - public class When_mapping_with_contextual_values - { - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - public class ContextResolver : IValueResolver - { - public int Resolve(int source, ResolutionContext context) - { - return source + (int)context.Options.Items["Item"]; - } - } - - [Fact] - public void Should_use_value_passed_in() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Value, opt => opt.ResolveUsing(src => src.Value)); - }); - - var dest = config.CreateMapper().Map(new Source { Value = 5 }, opt => { opt.Items["Item"] = 10; }); - - dest.Value.ShouldEqual(15); - } - } - - public class When_mapping_with_contextual_values_shortcut - { - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - public class ContextResolver : IValueResolver - { - public int Resolve(int source, ResolutionContext context) - { - return source + (int)context.Options.Items["Item"]; - } - } - - [Fact] - public void Should_use_value_passed_in() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Value, opt => opt.ResolveUsing((src, ctxt) => (int)ctxt.Items["Item"] + 5)); - }); - - var dest = config.CreateMapper().Map(new Source { Value = 5 }, opt => opt.Items["Item"] = 10); - - dest.Value.ShouldEqual(15); - } - } - - public class When_mapping_with_contextual_values_in_resolve_func - { - public class Source - { - public int Value1 { get; set; } - } - - public class Dest - { - public int Value1 { get; set; } - } - - public class ContextResolver : IValueResolver - { - public int Resolve(int source, ResolutionContext context) - { - return source + (int)context.Options.Items["Item"]; - } - } - - [Fact] - public void Should_use_value_passed_in() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Value1, opt => opt.ResolveUsing((source, context) => (int)context.Options.Items["Item"] + source.Value1)); - }); - - var dest = config.CreateMapper().Map(new Source { Value1 = 5 }, opt => { opt.Items["Item"] = 10; }); - - dest.Value1.ShouldEqual(15); - } - } - } +using System.Collections.Generic; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + namespace ContextItems + { + using Shouldly; + using Xunit; + + public class When_mapping_with_contextual_values + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + public class ContextResolver : IMemberValueResolver + { + public int Resolve(Source src, Dest d, int source, int dest, ResolutionContext context) + { + return source + (int)context.Options.Items["Item"]; + } + } + + [Fact] + public void Should_use_value_passed_in() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value, opt => opt.MapFrom(src => src.Value)); + }); + + var dest = config.CreateMapper().Map(new Source { Value = 5 }, opt => { opt.Items["Item"] = 10; }); + + dest.Value.ShouldBe(15); + } + } + + public class When_mapping_with_contextual_values_shortcut + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + [Fact] + public void Should_use_value_passed_in() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value, opt => opt.MapFrom((src, d, member, ctxt) => (int)ctxt.Items["Item"] + 5)); + }); + + var dest = config.CreateMapper().Map(new Source { Value = 5 }, opt => opt.Items["Item"] = 10); + + dest.Value.ShouldBe(15); + } + } + + public class When_mapping_with_contextual_values_in_resolve_func + { + public class Source + { + public int Value1 { get; set; } + } + + public class Dest + { + public int Value1 { get; set; } + } + + [Fact] + public void Should_use_value_passed_in() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value1, opt => opt.MapFrom((source, d, dMember, context) => (int)context.Options.Items["Item"] + source.Value1)); + }); + + var dest = config.CreateMapper().Map(new Source { Value1 = 5 }, opt => { opt.Items["Item"] = 10; }); + + dest.Value1.ShouldBe(15); + } + } + + public class When_mapping_nested_context_items : AutoMapperSpecBase + { + public class Door { } + + public class FromGarage + { + public List FromCars { get; set; } + } + + public class ToGarage + { + public List ToCars { get; set; } + } + + public class FromCar + { + public int Id { get; set; } + public string Name { get; set; } + public Door Door { get; set; } + } + + public class ToCar + { + public int Id { get; set; } + public string Name { get; set; } + public Door Door { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.ToCars, opts => opts.MapFrom((src, dest, destVal, ctx) => + { + var toCars = new List(); + + ToCar toCar; + foreach (var fromCar in src.FromCars) + { + toCar = ctx.Mapper.Map(fromCar); + if (toCar == null) + continue; + + toCars.Add(toCar); + } + + return toCars; + })); + + cfg.CreateMap() + .ConvertUsing((src, dest, ctx) => + { + ToCar toCar = null; + FromCar fromCar = src; + + if (fromCar.Name != null) + { + toCar = new ToCar + { + Id = fromCar.Id, + Name = fromCar.Name, + Door = (Door) ctx.Items["Door"] + }; + } + + return toCar; + }); + }); + + [Fact] + public void Should_flow_context_items_to_nested_mappings() + { + var door = new Door(); + var fromGarage = new FromGarage + { + FromCars = new List + { + new FromCar {Door = door, Id = 2, Name = "Volvo"}, + new FromCar {Door = door, Id = 3, Name = "Hyundai"}, + } + }; + + var toGarage = Mapper.Map(fromGarage, opts => + { + opts.Items.Add("Door", door); + }); + + foreach (var d in toGarage.ToCars.Select(c => c.Door)) + { + d.ShouldBeSameAs(door); + } + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/ConvensionTest.cs b/src/UnitTests/ConvensionTest.cs index 08b2a83fe2..439e49f74f 100644 --- a/src/UnitTests/ConvensionTest.cs +++ b/src/UnitTests/ConvensionTest.cs @@ -3,10 +3,10 @@ using System.Reflection; using AutoMapper.Mappers; using AutoMapper.Configuration.Conventions; -using Should; +using Shouldly; using Xunit; -namespace AutoMapper.UnitTests +namespace AutoMapper.UnitTests.Conventions { public class ConvensionTest { @@ -42,12 +42,12 @@ public void Fact() var mapper = config.CreateMapper(); var a2 = mapper.Map(new Client() { Value= "Test", Transval = "test"}); - a2.ValueTransfer.ShouldEqual("Test"); - a2.val.ShouldEqual("test"); + a2.ValueTransfer.ShouldBe("Test"); + a2.val.ShouldBe("test"); var a = mapper.Map(new ClientDto() { ValueTransfer = "TestTransfer", val = "testTransfer"}); - a.Value.ShouldEqual("TestTransfer"); - a.Transval.ShouldEqual("testTransfer"); + a.Value.ShouldBe("TestTransfer"); + a.Transval.ShouldBe("testTransfer"); var clients = mapper.Map(new[] { new ClientDto() }); Expression> expr = c => c.ID < 5; @@ -56,20 +56,20 @@ public void Fact() public class ConventionProfile : Profile { - protected override void Configure() + public ConventionProfile() { AddMemberConfiguration().AddName( - _ => _.AddStrings(p => p.DestinationPostfixes, "Transfer") - .AddStrings(p => p.Postfixes, "Transfer") - .AddStrings(p => p.DestinationPrefixes, "Trans") - .AddStrings(p => p.Prefixes, "Trans")); + _ => _.AddStrings(p => p.DestinationPostfixes, "Transfer") + .AddStrings(p => p.Postfixes, "Transfer") + .AddStrings(p => p.DestinationPrefixes, "Trans") + .AddStrings(p => p.Prefixes, "Trans")); AddConditionalObjectMapper().Where((s, d) => s.Name.Contains(d.Name) || d.Name.Contains(s.Name)); } } public class ToDTO : Profile { - protected override void Configure() + public ToDTO() { AddMemberConfiguration().AddName( _ => _.AddStrings(p => p.Postfixes, "Transfer") @@ -79,7 +79,7 @@ protected override void Configure() } public class FromDTO : Profile { - protected override void Configure() + public FromDTO() { AddMemberConfiguration().AddName( _ => _.AddStrings(p => p.DestinationPostfixes, "Transfer") @@ -87,6 +87,7 @@ protected override void Configure() AddConditionalObjectMapper().Where((s, d) => d.Name == s.Name + "Dto"); } } + [Fact] public void Fact2() { var config = new MapperConfiguration(cfg => @@ -96,12 +97,12 @@ public void Fact2() var mapper = config.CreateMapper(); var a2 = mapper.Map(new Client() { Value = "Test", Transval = "test" }); - a2.ValueTransfer.ShouldEqual("Test"); - a2.val.ShouldEqual("test"); + a2.ValueTransfer.ShouldBe("Test"); + a2.val.ShouldBe("test"); var a = mapper.Map(new ClientDto() { ValueTransfer = "TestTransfer", val = "testTransfer" }); - a.Value.ShouldEqual("TestTransfer"); - a.Transval.ShouldEqual("testTransfer"); + a.Value.ShouldBe("TestTransfer"); + a.Transval.ShouldBe("testTransfer"); var clients = mapper.Map(new[] { new ClientDto() }); Expression> expr = c => c.ID < 5; @@ -119,12 +120,12 @@ public void Fact3() var mapper = config.CreateMapper(); var a2 = mapper.Map(new Client() { Value = "Test", Transval = "test" }); - a2.ValueTransfer.ShouldEqual("Test"); - a2.val.ShouldEqual("test"); + a2.ValueTransfer.ShouldBe("Test"); + a2.val.ShouldBe("test"); var a = mapper.Map(new ClientDto() { ValueTransfer = "TestTransfer", val = "testTransfer" }); - a.Value.ShouldEqual("TestTransfer"); - a.Transval.ShouldEqual("testTransfer"); + a.Value.ShouldBe("TestTransfer"); + a.Transval.ShouldBe("testTransfer"); var clients = mapper.Map(new[] { new ClientDto() }); Expression> expr = c => c.ID < 5; @@ -144,4 +145,38 @@ public void Should_Work_Without_Explicitly_Mapping_Before_Hand() var clientExp = config.CreateMapper().Map>>(expr); } } + + public class ConventionsValidations + { + public class Foo + { + public string Bar { get; set; } + } + + public class FooViewModel + { + public string Bar { get; set; } + public string Extra { get; set; } + } + + public class ViewModelConvention : Profile + { + public ViewModelConvention() + { + AddConditionalObjectMapper().Where((source, dest) => dest.Name == source.Name + "ViewModel"); + ForAllMaps((tm, m) => m.ValidateMemberList(MemberList.None)); + } + } + + [Fact] + public void TestMappingWithMissingTargetProperty() + { + var config = new MapperConfiguration(cfg => cfg.AddProfile()); + var mapper = config.CreateMapper(); + + var action = new Action(() => mapper.Map(new Foo {Bar = "Baz"})); + + action.ShouldNotThrow(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/ConversionOperators.cs b/src/UnitTests/ConversionOperators.cs index 50d21b5de2..4daeb6258f 100644 --- a/src/UnitTests/ConversionOperators.cs +++ b/src/UnitTests/ConversionOperators.cs @@ -1,145 +1,145 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace ConversionOperators - { - public class When_mapping_to_classes_with_implicit_conversion_operators_on_the_destination - { - private Bar _bar; - - public class Foo - { - public string Value { get; set; } - } - - public class Bar - { - public string OtherValue { get; set; } - - public static implicit operator Bar(Foo other) - { - return new Bar - { - OtherValue = other.Value - }; - } - - } - - [Fact] - public void Should_use_the_implicit_conversion_operator() - { - var source = new Foo { Value = "Hello" }; - var config = new MapperConfiguration(cfg => { }); - - _bar = config.CreateMapper().Map(source); - - _bar.OtherValue.ShouldEqual("Hello"); - } - } - - public class When_mapping_to_classes_with_implicit_conversion_operators_on_the_source - { - private Bar _bar; - - public class Foo - { - public string Value { get; set; } - - public static implicit operator Bar(Foo other) - { - return new Bar - { - OtherValue = other.Value - }; - } - - public static implicit operator string(Foo other) - { - return other.Value; - } - - } - - public class Bar - { - public string OtherValue { get; set; } - } - - [Fact] - public void Should_use_the_implicit_conversion_operator() - { - var source = new Foo { Value = "Hello" }; - - var config = new MapperConfiguration(cfg => { }); - _bar = config.CreateMapper().Map(source); - - _bar.OtherValue.ShouldEqual("Hello"); - } - } - - public class When_mapping_to_classes_with_explicit_conversion_operator_on_the_destination - { - private Bar _bar; - - public class Foo - { - public string Value { get; set; } - } - - public class Bar - { - public string OtherValue { get; set; } - - public static explicit operator Bar(Foo other) - { - return new Bar - { - OtherValue = other.Value - }; - } - } - - [Fact] - public void Should_use_the_explicit_conversion_operator() - { - var config = new MapperConfiguration(cfg => { }); - _bar = config.CreateMapper().Map(new Foo { Value = "Hello" }); - _bar.OtherValue.ShouldEqual("Hello"); - } - } - - public class When_mapping_to_classes_with_explicit_conversion_operator_on_the_source - { - private Bar _bar; - - public class Foo - { - public string Value { get; set; } - - public static explicit operator Bar(Foo other) - { - return new Bar - { - OtherValue = other.Value - }; - } - } - - public class Bar - { - public string OtherValue { get; set; } - } - - [Fact] - public void Should_use_the_explicit_conversion_operator() - { - var config = new MapperConfiguration(cfg => { }); - _bar = config.CreateMapper().Map(new Foo { Value = "Hello" }); - _bar.OtherValue.ShouldEqual("Hello"); - } - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests +{ + namespace ConversionOperators + { + public class When_mapping_to_classes_with_implicit_conversion_operators_on_the_destination + { + private Bar _bar; + + public class Foo + { + public string Value { get; set; } + } + + public class Bar + { + public string OtherValue { get; set; } + + public static implicit operator Bar(Foo other) + { + return new Bar + { + OtherValue = other.Value + }; + } + + } + + [Fact] + public void Should_use_the_implicit_conversion_operator() + { + var source = new Foo { Value = "Hello" }; + var config = new MapperConfiguration(cfg => { }); + + _bar = config.CreateMapper().Map(source); + + _bar.OtherValue.ShouldBe("Hello"); + } + } + + public class When_mapping_to_classes_with_implicit_conversion_operators_on_the_source + { + private Bar _bar; + + public class Foo + { + public string Value { get; set; } + + public static implicit operator Bar(Foo other) + { + return new Bar + { + OtherValue = other.Value + }; + } + + public static implicit operator string(Foo other) + { + return other.Value; + } + + } + + public class Bar + { + public string OtherValue { get; set; } + } + + [Fact] + public void Should_use_the_implicit_conversion_operator() + { + var source = new Foo { Value = "Hello" }; + + var config = new MapperConfiguration(cfg => { }); + _bar = config.CreateMapper().Map(source); + + _bar.OtherValue.ShouldBe("Hello"); + } + } + + public class When_mapping_to_classes_with_explicit_conversion_operator_on_the_destination + { + private Bar _bar; + + public class Foo + { + public string Value { get; set; } + } + + public class Bar + { + public string OtherValue { get; set; } + + public static explicit operator Bar(Foo other) + { + return new Bar + { + OtherValue = other.Value + }; + } + } + + [Fact] + public void Should_use_the_explicit_conversion_operator() + { + var config = new MapperConfiguration(cfg => { }); + _bar = config.CreateMapper().Map(new Foo { Value = "Hello" }); + _bar.OtherValue.ShouldBe("Hello"); + } + } + + public class When_mapping_to_classes_with_explicit_conversion_operator_on_the_source + { + private Bar _bar; + + public class Foo + { + public string Value { get; set; } + + public static explicit operator Bar(Foo other) + { + return new Bar + { + OtherValue = other.Value + }; + } + } + + public class Bar + { + public string OtherValue { get; set; } + } + + [Fact] + public void Should_use_the_explicit_conversion_operator() + { + var config = new MapperConfiguration(cfg => { }); + _bar = config.CreateMapper().Map(new Foo { Value = "Hello" }); + _bar.OtherValue.ShouldBe("Hello"); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/CustomCollectionTester.cs b/src/UnitTests/CustomCollectionTester.cs new file mode 100644 index 0000000000..e556f34db3 --- /dev/null +++ b/src/UnitTests/CustomCollectionTester.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using Xunit; + +namespace AutoMapper.UnitTests { + public class CustomCollectionTester { + [Fact] + public void Should_be_able_to_handle_custom_dictionary_with_custom_methods() { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + var mapper = config.CreateMapper(); + } + + public class BaseClassWithDictionary { + public DataDictionary Data { get; set; } + } + + public class DerivedClassWithDictionary : BaseClassWithDictionary { } + + public class DataDictionary : Dictionary { + public string GetString(string name, string @default) { + return null; + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/CustomMapping.cs b/src/UnitTests/CustomMapping.cs index a82a833947..5fd95c114c 100644 --- a/src/UnitTests/CustomMapping.cs +++ b/src/UnitTests/CustomMapping.cs @@ -1,10 +1,367 @@ using System; using System.Collections; -using Should; +using System.Collections.Generic; +using System.Linq; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests { + public class When_implementing_multiple_IValueResolver_interfaces : AutoMapperSpecBase + { + public class Source1 { } + + public class Source2 { } + + public class Destination + { + public string Value { get; set; } + } + + public class MyTestResolver : IValueResolver, IValueResolver + { + public string Resolve(Source1 source, Destination destination, string destMember, ResolutionContext context) + { + return "source1"; + } + + public string Resolve(Source2 source, Destination destination, string destMember, ResolutionContext context) + { + return "source2"; + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(dest => dest.Value, opt => opt.MapFrom()); + cfg.CreateMap().ForMember(dest => dest.Value, opt => opt.MapFrom()); + }); + + [Fact] + public void Should_map_ok() + { + Mapper.Map(new Source1()).Value.ShouldBe("source1"); + Mapper.Map(new Source2()).Value.ShouldBe("source2"); + } + } + + public class When_using_IMemberResolver_derived_interface : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public string SValue { get; set; } + } + + class Destination + { + public string Value { get; set; } + } + + interface IResolver : IMemberValueResolver + { + } + + class Resolver : IResolver + { + public string Resolve(Source source, Destination destination, string sourceMember, string destMember, ResolutionContext context) + { + return "Resolved"; + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.Value, o => o.MapFrom(new Resolver(), s=>s.SValue)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Value.ShouldBe("Resolved"); + } + } + + public class OpenGenericMapForMember : AutoMapperSpecBase + { + ModelPager _destination; + int[] _items = Enumerable.Range(1, 10).ToArray(); + + public interface IPager : IEnumerable + { + int CurrentPage { get; set; } + + int PageCount { get; set; } + + int PageSize { get; set; } + + int TotalItems { get; set; } + } + public class ModelPager + { + public int CurrentPage { get; set; } + + public IEnumerable Items { get; set; } + + public int PageCount { get; set; } + + public int PageSize { get; set; } + + public int TotalItems { get; set; } + } + public class Pager : IPager + { + private readonly IEnumerable _items; + + public Pager(IEnumerable items) :this(items, 0, 0, 0) + { + } + public Pager(IEnumerable items, + int currentPage, + int pageSize, + int totalItems) + { + _items = items ?? Enumerable.Empty(); + CurrentPage = currentPage; + PageSize = pageSize; + TotalItems = totalItems; + } + + public int CurrentPage { get; set; } + + public int PageCount { get; set; } + + public int PageSize { get; set; } + + public int TotalItems { get; set; } + + IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } + + public IEnumerator GetEnumerator() { return _items.GetEnumerator(); } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(IPager<>), typeof(ModelPager<>)).ForMember("Items", e => e.MapFrom(o => (IEnumerable)o)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map>(new Pager(_items)); + } + + [Fact] + public void Should_map_ok() + { + _destination.Items.SequenceEqual(_items).ShouldBeTrue(); + } + } + + public class IntToNullableIntConverter : AutoMapperSpecBase + { + Destination _destination; + + public class IntToNullableConverter : ITypeConverter + { + public int? Convert(int source, int? destination, ResolutionContext context) + { + if(source == default(int)) + { + return null; + } + return source; + } + } + + public class Source + { + public int Id { get; set; } + } + + public class Destination + { + public int? Id { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_use_the_converter() + { + _destination.Id.ShouldBeNull(); + } + } + + public class When_throwing_NRE_from_MapFrom_value_types : AutoMapperSpecBase + { + ViewModel _viewModel; + + public class Model + { + public List SubModels { get; set; } + } + + public class SubModel + { + public List SubSubModels { get; set; } + } + + public class SubSubModel + { + public int Id { get; set; } + } + + public class ViewModel + { + public int SubModelId { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(x => x.SubModelId, + opts => opts.MapFrom(src => src.SubModels.FirstOrDefault().SubSubModels.FirstOrDefault().Id)); + }); + + protected override void Because_of() + { + var model = new Model + { + SubModels = new List() + }; + _viewModel = Mapper.Map(model); + } + + [Fact] + public void Should_map_ok() + { + _viewModel.SubModelId.ShouldBe(0); + } + } + + public class When_throwing_NRE_from_MapFrom : AutoMapperSpecBase + { + class Source + { + } + + class Destination + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + string x = null; + cfg.CreateMap().ForMember(d=>d.Value, o=>o.MapFrom(s=>x.ToString())); + }); + + [Fact] + public void We_should_catch_it() + { + Mapper.Map(new Source()).Value.ShouldBeNull(); + } + } + + public class When_using_value_with_mismatched_properties : AutoMapperSpecBase + { + Destination _destination; + static Guid _guid = Guid.NewGuid(); + + class Source + { + public int Value { get; set; } + } + + class Destination + { + public Guid Value { get; set; } + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(c => + { + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom(src => _guid)); + }); + } + } + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Value.ShouldBe(_guid); + } + } + + public class When_custom_resolving_mismatched_properties : AutoMapperSpecBase + { + Destination _destination; + static Guid _guid = Guid.NewGuid(); + + class Source + { + public int Value { get; set; } + } + + class Destination + { + public Guid Value { get; set; } + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(c => + { + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom()); + }); + } + } + + class Resolver : IValueResolver + { + public Guid Resolve(Source model, Destination d, Guid dest, ResolutionContext context) + { + return _guid; + } + } + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Value.ShouldBe(_guid); + } + } + public class When_resolve_throws : NonValidatingSpecBase { Exception _ex = new Exception(); @@ -24,7 +381,7 @@ protected override MapperConfiguration Configuration { return new MapperConfiguration(c => { - c.CreateMap().ForMember(d => d.Value, o => o.ResolveUsing(s => { Throw(); return 0; })); + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom((s, d) => { Throw(); return 0; })); }); } } @@ -37,11 +394,11 @@ private void Throw() [Fact] public void Should_propagate_exception() { - new Action(()=>Mapper.Map(new Source())).ShouldThrow(e=>e.InnerException.ShouldEqual(_ex)); + new Action(()=>Mapper.Map(new Source())).ShouldThrowException(e=>e.InnerException.ShouldBe(_ex)); } } - public class When_mapping_different_types_with_UseValue : AutoMapperSpecBase + public class When_mapping_different_types_with_explicit_value : AutoMapperSpecBase { Destination _destination; @@ -71,7 +428,7 @@ protected override MapperConfiguration Configuration return new MapperConfiguration(c => { c.CreateMap(); - c.CreateMap().ForMember(d => d.Value, o => o.UseValue(new InnerSource { IntValue = 15 })); + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom(src => new InnerSource { IntValue = 15 })); }); } } @@ -84,7 +441,7 @@ protected override void Because_of() [Fact] public void Should_work() { - _destination.Value.IntValue.ShouldEqual(15); + _destination.Value.IntValue.ShouldBe(15); } } @@ -119,7 +476,7 @@ protected override MapperConfiguration Configuration return new MapperConfiguration(c => { c.CreateMap(); - c.CreateMap().ForMember(d => d.Value, o => o.ResolveUsing(s => s.ObjectValue)); + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom(s => s.ObjectValue)); }); } } @@ -132,7 +489,7 @@ protected override void Because_of() [Fact] public void Should_work() { - _destination.Value.IntValue.ShouldEqual(15); + _destination.Value.IntValue.ShouldBe(15); } } @@ -153,7 +510,7 @@ protected override MapperConfiguration Configuration { get { - return new MapperConfiguration(c => c.CreateMap().ForMember(d => d.Value, o => o.UseValue(new object()))); + return new MapperConfiguration(c => c.CreateMap().ForMember(d => d.Value, o => o.MapFrom(src => new object()))); } } @@ -165,7 +522,7 @@ protected override void Because_of() [Fact] public void Should_use_to_string() { - _destination.Value.ShouldEqual("System.Object"); + _destination.Value.ShouldBe("System.Object"); } } @@ -183,13 +540,8 @@ class Destination public string Value { get; set; } } - protected override MapperConfiguration Configuration - { - get - { - return new MapperConfiguration(c => c.CreateMap().ForMember(d=>d.Value, o=>o.ResolveUsing(s=>s.ObjectValue))); - } - } + protected override MapperConfiguration Configuration { get; } + = new MapperConfiguration(c => c.CreateMap().ForMember(d=>d.Value, o=>o.MapFrom(s=>s.ObjectValue))); protected override void Because_of() { @@ -199,7 +551,7 @@ protected override void Because_of() [Fact] public void Should_use_to_string() { - _destination.Value.ShouldEqual("System.Object"); + _destination.Value.ShouldBe("System.Object"); } } @@ -225,17 +577,17 @@ public class ModelDto public int Value5 { get; set; } } - public class CustomResolver : IValueResolver + public class CustomResolver : IValueResolver { - public int Resolve(ModelObject source, ResolutionContext context) + public int Resolve(ModelObject source, ModelDto d, int dest, ResolutionContext context) { return source.Value + 1; } } - public class CustomResolver2 : IValueResolver + public class CustomResolver2 : IValueResolver { - public int Resolve(ModelObject source, ResolutionContext context) + public int Resolve(ModelObject source, ModelDto d, int dest, ResolutionContext context) { return source.Value2fff + 2; } @@ -244,9 +596,9 @@ public int Resolve(ModelObject source, ResolutionContext context) protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() - .ForMember(dto => dto.Value, opt => opt.ResolveUsing()) - .ForMember(dto => dto.Value2, opt => opt.ResolveUsing(new CustomResolver2())) - .ForMember(dto => dto.Value5, opt => opt.ResolveUsing(src => src.Value5 + 5)); + .ForMember(dto => dto.Value, opt => opt.MapFrom()) + .ForMember(dto => dto.Value2, opt => opt.MapFrom(new CustomResolver2())) + .ForMember(dto => dto.Value5, opt => opt.MapFrom(src => src.Value5 + 5)); }); @@ -259,25 +611,25 @@ protected override void Because_of() [Fact] public void Should_ignore_the_mapping_for_normal_members() { - _result.Value3.ShouldEqual(42); + _result.Value3.ShouldBe(42); } [Fact] public void Should_use_the_custom_generic_mapping_for_custom_dto_members() { - _result.Value.ShouldEqual(43); + _result.Value.ShouldBe(43); } [Fact] public void Should_use_the_instance_based_mapping_for_custom_dto_members() { - _result.Value2.ShouldEqual(44); + _result.Value2.ShouldBe(44); } [Fact] public void Should_use_the_func_based_mapping_for_custom_dto_members() { - _result.Value5.ShouldEqual(47); + _result.Value5.ShouldBe(47); } } @@ -300,9 +652,9 @@ public class ModelDto public int SomeValue { get; set; } } - public class CustomResolver : IValueResolver + public class CustomResolver : IMemberValueResolver { - public int Resolve(ModelSubObject source, ResolutionContext context) + public int Resolve(object s, object d, ModelSubObject source, int ignored, ResolutionContext context) { return source.SomeValue + 1; } @@ -311,7 +663,7 @@ public int Resolve(ModelSubObject source, ResolutionContext context) protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() - .ForMember(dto => dto.SomeValue, opt => opt.ResolveUsing(m => m.Sub)); + .ForMember(dto => dto.SomeValue, opt => opt.MapFrom(m => m.Sub)); }); [Fact] @@ -326,7 +678,7 @@ public void Should_use_the_specified_model_member_to_resolve_from() }; _result = Mapper.Map(model); - _result.SomeValue.ShouldEqual(47); + _result.SomeValue.ShouldBe(47); } } @@ -345,9 +697,9 @@ public class Dest public int SomeValue { get; set; } } - public class CustomResolver : IValueResolver + public class CustomResolver : IMemberValueResolver { - public int Resolve(int source, ResolutionContext context) + public int Resolve(object s, object d, int source, int dest, ResolutionContext context) { return source + 5; } @@ -357,7 +709,7 @@ public int Resolve(int source, ResolutionContext context) { cfg.CreateMap() .ForMember(dto => dto.SomeValue, - opt => opt.ResolveUsing(m => m.SomeOtherValue)); + opt => opt.MapFrom(m => m.SomeOtherValue)); }); @@ -375,7 +727,7 @@ protected override void Because_of() [Fact] public void Should_override_the_existing_match_to_the_new_custom_resolved_member() { - _result.SomeValue.ShouldEqual(58); + _result.SomeValue.ShouldBe(58); } } @@ -393,14 +745,6 @@ public class Dest public int Type { get; set; } } - public class CustomResolver : IValueResolver - { - public int Resolve(int source, ResolutionContext context) - { - return source + 5; - } - } - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() @@ -421,7 +765,7 @@ protected override void Because_of() [Fact] public void Should_override_the_existing_match_to_the_new_custom_resolved_member() { - _result.Type.ShouldEqual(5); + _result.Type.ShouldBe(5); } } @@ -440,7 +784,7 @@ public class Destination public int Value { get; set; } } - public class CustomResolver : IValueResolver + public class CustomResolver : IMemberValueResolver { private readonly int _toAdd; @@ -454,7 +798,7 @@ public CustomResolver() _toAdd = 10; } - public int Resolve(int source, ResolutionContext context) + public int Resolve(object s, object d, int source, int dest, ResolutionContext context) { return source + _toAdd; } @@ -464,7 +808,7 @@ public int Resolve(int source, ResolutionContext context) { cfg.CreateMap() .ForMember(s => s.Value, - opt => opt.ResolveUsing(new CustomResolver(15), src => src.Value)); + opt => opt.MapFrom(new CustomResolver(15), src => src.Value)); }); @@ -481,7 +825,7 @@ protected override void Because_of() [Fact] public void Should_use_the_custom_constructor() { - _dest.Value.ShouldEqual(25); + _dest.Value.ShouldBe(25); } } @@ -500,7 +844,7 @@ public class Destination public int Value { get; set; } } - public class CustomResolver : IValueResolver + public class CustomResolver : IMemberValueResolver { private readonly int _toAdd; @@ -514,7 +858,7 @@ public CustomResolver() _toAdd = 10; } - public int Resolve(int source, ResolutionContext context) + public int Resolve(object s, object d, int source, int dest, ResolutionContext context) { return source + _toAdd; } @@ -524,7 +868,7 @@ public int Resolve(int source, ResolutionContext context) { cfg.CreateMap() .ForMember(s => s.Value, - opt => opt.ResolveUsing(new CustomResolver(15), s => s.Value) + opt => opt.MapFrom(new CustomResolver(15), s => s.Value) ); }); @@ -541,7 +885,7 @@ protected override void Because_of() [Fact] public void Should_use_the_custom_constructor() { - _dest.Value.ShouldEqual(25); + _dest.Value.ShouldBe(25); } } @@ -577,7 +921,7 @@ public void Should_use_the_custom_translator() .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } [Fact] @@ -588,7 +932,7 @@ public void Should_ignore_other_mapping_rules() .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } } @@ -621,10 +965,10 @@ public When_specifying_a_custom_translator_using_projection() public void Should_use_the_custom_translator() { var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ProjectUsing(s => new Destination { Value = s.Value + 10 })); + .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } [Fact] @@ -632,10 +976,10 @@ public void Should_ignore_other_mapping_rules() { var config = new MapperConfiguration(cfg => cfg.CreateMap() .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) - .ProjectUsing(s => new Destination { Value = s.Value + 10 })); + .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } } @@ -676,7 +1020,7 @@ public void Should_resolve_to_the_destination_object_from_the_custom_translator( .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source, _dest); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } [Fact] @@ -687,7 +1031,7 @@ public void Should_ignore_other_mapping_rules() .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source, _dest); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } } @@ -718,7 +1062,7 @@ public When_specifying_a_custom_translator_using_generics() public class Converter : ITypeConverter { - public Destination Convert(Source source, ResolutionContext context) + public Destination Convert(Source source, Destination destination, ResolutionContext context) { return new Destination { Value = source.Value + 10 }; } @@ -731,7 +1075,7 @@ public void Should_use_the_custom_translator() .ConvertUsing()); _dest = config.CreateMapper().Map(_source); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } [Fact] @@ -742,7 +1086,7 @@ public void Should_ignore_other_mapping_rules() .ConvertUsing(s => new Destination { Value = s.Value + 10 })); _dest = config.CreateMapper().Map(_source); - _dest.Value.ShouldEqual(20); + _dest.Value.ShouldBe(20); } } @@ -774,7 +1118,7 @@ public CustomConverter(int value) _value = value; } - public Destination Convert(Source source, ResolutionContext context) + public Destination Convert(Source source, Destination destination, ResolutionContext context) { return new Destination { Value = source.Value + _value }; } @@ -795,7 +1139,7 @@ protected override void Because_of() [Fact] public void Should_use_the_custom_constructor_function() { - _result.Value.ShouldEqual(15); + _result.Value.ShouldBe(15); } } @@ -851,7 +1195,7 @@ public class Destination public int Value { get; set; } } - public class CustomValueResolver : IValueResolver + public class CustomValueResolver : IMemberValueResolver { private readonly int _toAdd; public CustomValueResolver() { _toAdd = 11; } @@ -861,7 +1205,7 @@ public CustomValueResolver(int toAdd) _toAdd = toAdd; } - public int Resolve(int source, ResolutionContext context) + public int Resolve(object s, object d, int source, int dest, ResolutionContext context) { return source + _toAdd; } @@ -872,7 +1216,7 @@ public int Resolve(int source, ResolutionContext context) cfg.ConstructServicesUsing(type => new CustomValueResolver(5)); cfg.CreateMap() - .ForMember(d => d.Value, opt => opt.ResolveUsing(src => src.Value)); + .ForMember(d => d.Value, opt => opt.MapFrom(src => src.Value)); }); protected override void Because_of() @@ -883,7 +1227,7 @@ protected override void Because_of() [Fact] public void Should_use_the_specified_constructor() { - _result.Value.ShouldEqual(10); + _result.Value.ShouldBe(10); } } @@ -902,18 +1246,18 @@ public class Destination public int Value { get; set; } } - public class CustomValueResolver : IValueResolver + public class CustomValueResolver : IMemberValueResolver { - public int Resolve(int source, ResolutionContext context) + public int Resolve(object s, object d, int source, int dest, ResolutionContext context) { - return ((Destination)context.DestinationValue).Value; + return dest; } } protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() - .ForMember(d => d.Value, opt => opt.ResolveUsing(src => src.Value)); + .ForMember(d => d.Value, opt => opt.MapFrom(src => src.Value)); }); protected override void Because_of() @@ -924,7 +1268,65 @@ protected override void Because_of() [Fact] public void Should_not_overwrite_destination_value() { - _result.Value.ShouldEqual(55); + _result.Value.ShouldBe(55); + } + } + + public class When_using_inheritance_with_value_resoluvers : AutoMapperSpecBase + { + public class SourceDto + { + public int Id { get; set; } + public string NumberValue { get; set; } + } + + public class SourceChildDto : SourceDto + { + public string ChildField { get; set; } + } + + public class DestinationDto + { + public int Ident { get; set; } + public int Number { get; set; } + } + + public class DestinationChildDto : DestinationDto + { + public string ChildField { get; set; } + } + + public class CustomResolver : IMemberValueResolver + { + public int Resolve(SourceDto src, object dest, string source, int member, ResolutionContext context) + { + return int.Parse(source); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { + cfg.CreateMap() + .ForMember(dest => dest.Ident, opt => opt.MapFrom(x => x.Id)) + .ForMember(dest => dest.Number, opt => opt.MapFrom(src => src.NumberValue)) + ; + cfg.CreateMap() + .IncludeBase() + ; + }); + + [Fact] + public void Should_inherit_value_resolver() + { + var sourceChild = new SourceChildDto + { + Id = 1, + NumberValue = "13", + ChildField = "alpha" + }; + + // destination = { Ident: 1, Number: 0 /* should be 13 */, ChildField: "alpha" } + var destination = Mapper.Map(sourceChild); + destination.Number.ShouldBe(13); } } @@ -943,13 +1345,13 @@ public class Destination public int DestinationValue { get; set; } } - public class CustomValueResolver : IValueResolver + public class CustomValueResolver : IMemberValueResolver { public CustomValueResolver() { } - public object Resolve(int source, ResolutionContext context) + public object Resolve(object s, object d, int source, object dest, ResolutionContext context) { return source + 5; } @@ -961,7 +1363,7 @@ public object Resolve(int source, ResolutionContext context) cfg.CreateMap() .ForMember("DestinationValue", - opt => opt.ResolveUsing("SourceValue")); + opt => opt.MapFrom("SourceValue")); }); protected override void Because_of() @@ -972,7 +1374,7 @@ protected override void Because_of() [Fact] public void Should_translate_the_property() { - _result.DestinationValue.ShouldEqual(10); + _result.DestinationValue.ShouldBe(10); } } @@ -1040,7 +1442,7 @@ protected override void Because_of() [Fact] public void Should_perform_the_translation() { - _dest.Name.ShouldEqual("jon"); + _dest.Name.ShouldBe("jon"); } } @@ -1088,25 +1490,25 @@ protected override void Because_of() [Fact] public void Should_copy_to_properties_that_have_setters() { - _dest.Value.ShouldEqual("value"); + _dest.Value.ShouldBe("value"); } [Fact] public void Should_not_attempt_to_translate_to_properties_that_do_not_have_a_setter() { - _dest.Today.ShouldEqual(DateTime.Today); + _dest.Today.ShouldBe(DateTime.Today); } [Fact] public void Should_translate_to_properties_that_have_a_private_setters() { - _dest.Name.ShouldEqual("jon"); + _dest.Name.ShouldBe("jon"); } [Fact] public void Should_translate_to_properties_that_have_a_protected_setters() { - _dest.Foo.ShouldEqual("bar"); + _dest.Foo.ShouldBe("bar"); } } @@ -1180,13 +1582,13 @@ protected override void Because_of() [Fact] public void Should_translate_to_properties_that_doesnt_have_a_getter() { - _dest.GetValue().ShouldEqual("jon"); + _dest.GetValue().ShouldBe("jon"); } [Fact] public void Should_translate_to_enumerable_properties_that_doesnt_have_a_getter() { - new[] { 1, 2 }.ShouldEqual(_destWithList.GetSomeList()); + new[] { 1, 2 }.ShouldBe(_destWithList.GetSomeList()); } } @@ -1226,13 +1628,13 @@ protected override void Because_of() [Fact] public void Should_use_supplied_constructor_to_map() { - _destination.OtherValue.ShouldEqual(9); + _destination.OtherValue.ShouldBe(9); } [Fact] public void Should_map_other_members() { - _destination.Value.ShouldEqual(5); + _destination.Value.ShouldBe(5); } } @@ -1253,7 +1655,7 @@ public class Dest protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.UseValue(5)); + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => 5)); }); protected override void Because_of() @@ -1264,7 +1666,7 @@ protected override void Because_of() [Fact] public void Should_map_from_that_constant_value() { - _dest.Value.ShouldEqual(5); + _dest.Value.ShouldBe(5); } } @@ -1288,7 +1690,7 @@ public void Should_map_from_that_constant_value() try { var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dest => dest, opt => opt.UseValue(5))); + .ForMember(dest => dest, opt => opt.MapFrom(src => 5))); } catch (Exception e) { @@ -1338,7 +1740,7 @@ protected override void Because_of() [Fact] public void Should_use_member_configuration() { - _dest.Value.ShouldEqual(1); + _dest.Value.ShouldBe(1); } private static int ParseValue(string value) diff --git a/src/UnitTests/Dictionaries.cs b/src/UnitTests/Dictionaries.cs index d440cda053..60c217ff31 100644 --- a/src/UnitTests/Dictionaries.cs +++ b/src/UnitTests/Dictionaries.cs @@ -1,466 +1,486 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace Dictionaries - { - //[Explicit("Need to resolve the assignable collection bug as well")] - //public class When_mapping_to_a_non_generic_dictionary : AutoMapperSpecBase - //{ - // private Destination _result; - - // public class Source - // { - // public Hashtable Values { get; set; } - // } - - // public class Destination - // { - // public IDictionary Values { get; set; } - // } - - // protected override void Establish_context() - // { - // Mapper.CreateMap(); - // } - - // protected override void Because_of() - // { - // var source = new Source - // { - // Values = new Hashtable - // { - // {"Key1", "Value1"}, - // {"Key2", 4} - // } - // }; - - // _result = Mapper.Map(source); - // } - - // [Fact] - // public void Should_map_the_source_dictionary_with_all_keys_and_values_preserved() - // { - // _result.Values.Count.ShouldEqual(2); - - // _result.Values["Key1"].ShouldEqual("Value1"); - // _result.Values["Key2"].ShouldEqual(4); - // } - //} - - public class When_mapping_to_a_generic_dictionary_with_mapped_value_pairs : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public Dictionary Values { get; set; } - } - - public class SourceValue - { - public int Value { get; set; } - } - - public class Destination - { - public Dictionary Values { get; set; } - } - - public class DestinationValue - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var source = new Source - { - Values = new Dictionary - { - {"Key1", new SourceValue {Value = 5}}, - {"Key2", new SourceValue {Value = 10}}, - } - }; - - _result = Mapper.Map(source); - } - - [Fact] - public void Should_perform_mapping_for_individual_values() - { - _result.Values.Count.ShouldEqual(2); - - _result.Values["Key1"].Value.ShouldEqual(5); - _result.Values["Key2"].Value.ShouldEqual(10); - } - } - - public class When_mapping_to_a_generic_dictionary_interface_with_mapped_value_pairs : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public Dictionary Values { get; set; } - } - - public class SourceValue - { - public int Value { get; set; } - } - - public class Destination - { - public System.Collections.Generic.IDictionary Values { get; set; } - } - - public class DestinationValue - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var source = new Source - { - Values = new Dictionary - { - {"Key1", new SourceValue {Value = 5}}, - {"Key2", new SourceValue {Value = 10}}, - } - }; - - _result = Mapper.Map(source); - } - - [Fact] - public void Should_perform_mapping_for_individual_values() - { - _result.Values.Count.ShouldEqual(2); - - _result.Values["Key1"].Value.ShouldEqual(5); - _result.Values["Key2"].Value.ShouldEqual(10); - } - } - - public class When_mapping_from_a_source_with_a_null_dictionary_member : AutoMapperSpecBase - { - private FooDto _result; - - public class Foo - { - public System.Collections.Generic.IDictionary Bar { get; set; } - } - - public class FooDto - { - public System.Collections.Generic.IDictionary Bar { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = false; - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var foo1 = new Foo - { - Bar = new Dictionary - { - {"lol", new Foo()} - } - }; - - _result = Mapper.Map(foo1); - } - - [Fact] - public void Should_fill_the_destination_with_an_empty_dictionary() - { - _result.Bar["lol"].Bar.ShouldNotBeNull(); - _result.Bar["lol"].Bar.ShouldBeType>(); - } - } - - - public class When_mapping_to_a_generic_dictionary_that_does_not_use_keyvaluepairs : AutoMapperSpecBase - { - private System.Collections.Generic.IDictionary _dest; - - public class SourceDto - { - public System.Collections.Generic.IDictionary Items { get; set; } - } - - public class DestDto - { - public System.Collections.Generic.IDictionary Items { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Items, opt => opt.MapFrom(s => s.Items)); - }); - - protected override void Because_of() - { - var source = new SourceDto() - { - Items = new GenericWrappedDictionary - { - {"A", "AAA"}, - {"B", "BBB"}, - {"C", "CCC"} - } - }; - - - _dest = Mapper.Map, System.Collections.Generic.IDictionary>(source.Items); - } - - [Fact] - public void Should_map_using_the_nongeneric_dictionaryentry() - { - _dest.Values.Count.ShouldEqual(3); - } - - // A wrapper for an IDictionary that implements IDictionary - // - // The important difference from a standard generic BCL dictionary is that: - // - // ((IEnumerable)GenericWrappedDictionary).GetEnumerator() returns DictionaryEntrys - // GenericWrappedDictionary.GetEnumerator() returns KeyValuePairs - // - // This behaviour is demonstrated by NHibernate's PersistentGenericMap - // (which wraps a nongeneric PersistentMap). - public class GenericWrappedDictionary : - System.Collections.Generic.IDictionary, System.Collections.IDictionary - { - System.Collections.IDictionary inner = new Dictionary(); - - public void Add(TKey key, TValue value) - { - inner.Add(key, value); - } - - public bool ContainsKey(TKey key) - { - throw new NotImplementedException(); - } - - public ICollection Keys - { - get { return inner.Keys.Cast().ToList(); } - } - - public bool Remove(TKey key) - { - throw new NotImplementedException(); - } - - public bool TryGetValue(TKey key, out TValue value) - { - throw new NotImplementedException(); - } - - public ICollection Values - { - get { return inner.Values.Cast().ToList(); } - } - - public TValue this[TKey key] - { - get - { - return (TValue)inner[key]; - } - set - { - inner[key] = value; - } - } - - public void Add(KeyValuePair item) - { - throw new NotImplementedException(); - } - - public void Clear() - { - throw new NotImplementedException(); - } - - public bool Contains(KeyValuePair item) - { - throw new NotImplementedException(); - } - - public void CopyTo(KeyValuePair[] array, int arrayIndex) - { - throw new NotImplementedException(); - } - - public int Count - { - get { throw new NotImplementedException(); } - } - - public bool IsReadOnly - { - get { throw new NotImplementedException(); } - } - - public bool Remove(KeyValuePair item) - { - throw new NotImplementedException(); - } - - public IEnumerator> GetEnumerator() - { - return inner.GetEnumerator() as IEnumerator>; - } - - IEnumerator IEnumerable.GetEnumerator() - { - return inner.GetEnumerator(); - } - - public void Add(object key, object value) - { - inner.Add(key, value); - } - - public bool Contains(object key) - { - throw new NotImplementedException(); - } - - IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator() - { - return ((System.Collections.IDictionary)inner).GetEnumerator(); - } - - public bool IsFixedSize - { - get { throw new NotImplementedException(); } - } - - ICollection System.Collections.IDictionary.Keys - { - get { return inner.Keys; } - } - - public void Remove(object key) - { - throw new NotImplementedException(); - } - - ICollection System.Collections.IDictionary.Values - { - get { return inner.Values; } - } - - public object this[object key] - { - get - { - return inner[key]; - } - set - { - inner[key] = value; - } - } - - public void CopyTo(Array array, int index) - { - throw new NotImplementedException(); - } - - public bool IsSynchronized - { - get { throw new NotImplementedException(); } - } - - public object SyncRoot - { - get { throw new NotImplementedException(); } - } - } - - } - - public class When_mapping_from_a_list_of_object_to_generic_dictionary : AutoMapperSpecBase - { - private FooObject _result; - - public class FooDto - { - public DestinationValuePair[] Values { get; set; } - } - - public class FooObject - { - public Dictionary Values { get; set; } - } - - public class DestinationValuePair - { - public string Key { get; set; } - public string Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap>() - .ConvertUsing(src => new KeyValuePair(src.Key, src.Value)); - }); - - protected override void Because_of() - { - var source = new FooDto - { - Values = new List - { - new DestinationValuePair {Key = "Key1", Value = "Value1"}, - new DestinationValuePair {Key = "Key2", Value = "Value2"} - }.ToArray() - }; - - _result = Mapper.Map(source); - } - - [Fact] - public void Should_perform_mapping_for_individual_values() - { - _result.Values.Count.ShouldEqual(2); - - _result.Values["Key1"].ShouldEqual("Value1"); - _result.Values["Key2"].ShouldEqual("Value2"); - } - } - } +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + namespace Dictionaries + { + //[Explicit("Need to resolve the assignable collection bug as well")] + //public class When_mapping_to_a_non_generic_dictionary : AutoMapperSpecBase + //{ + // private Destination _result; + + // public class Source + // { + // public Hashtable Values { get; set; } + // } + + // public class Destination + // { + // public IDictionary Values { get; set; } + // } + + // protected override void Establish_context() + // { + // Mapper.CreateMap(); + // } + + // protected override void Because_of() + // { + // var source = new Source + // { + // Values = new Hashtable + // { + // {"Key1", "Value1"}, + // {"Key2", 4} + // } + // }; + + // _result = Mapper.Map(source); + // } + + // [Fact] + // public void Should_map_the_source_dictionary_with_all_keys_and_values_preserved() + // { + // _result.Values.Count.ShouldBe(2); + + // _result.Values["Key1"].ShouldBe("Value1"); + // _result.Values["Key2"].ShouldBe(4); + // } + //} + + public class When_mapping_to_a_generic_dictionary_with_mapped_value_pairs : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public Dictionary Values { get; set; } + } + + public class SourceValue + { + public int Value { get; set; } + } + + public class Destination + { + public Dictionary Values { get; set; } + } + + public class DestinationValue + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source + { + Values = new Dictionary + { + {"Key1", new SourceValue {Value = 5}}, + {"Key2", new SourceValue {Value = 10}}, + } + }; + + _result = Mapper.Map(source); + } + + [Fact] + public void Should_perform_mapping_for_individual_values() + { + _result.Values.Count.ShouldBe(2); + + _result.Values["Key1"].Value.ShouldBe(5); + _result.Values["Key2"].Value.ShouldBe(10); + } + } + + public class When_mapping_to_a_generic_dictionary_interface_with_mapped_value_pairs : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public Dictionary Values { get; set; } + } + + public class SourceValue + { + public int Value { get; set; } + } + + public class Destination + { + public System.Collections.Generic.IDictionary Values { get; set; } + } + + public class DestinationValue + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source + { + Values = new Dictionary + { + {"Key1", new SourceValue {Value = 5}}, + {"Key2", new SourceValue {Value = 10}}, + } + }; + + _result = Mapper.Map(source); + } + + [Fact] + public void Should_perform_mapping_for_individual_values() + { + _result.Values.Count.ShouldBe(2); + + _result.Values["Key1"].Value.ShouldBe(5); + _result.Values["Key2"].Value.ShouldBe(10); + } + } + + public class When_mapping_from_a_source_with_a_null_dictionary_member : AutoMapperSpecBase + { + private FooDto _result; + + public class Foo + { + public System.Collections.Generic.IDictionary Bar { get; set; } + } + + public class FooDto + { + public System.Collections.Generic.IDictionary Bar { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var foo1 = new Foo + { + Bar = new Dictionary + { + {"lol", new Foo()} + } + }; + + _result = Mapper.Map(foo1); + } + + [Fact] + public void Should_fill_the_destination_with_an_empty_dictionary() + { + _result.Bar["lol"].Bar.ShouldNotBeNull(); + _result.Bar["lol"].Bar.ShouldBeOfType>(); + } + } + + + public class When_mapping_to_a_generic_dictionary_that_does_not_use_keyvaluepairs : AutoMapperSpecBase + { + private System.Collections.Generic.IDictionary _dest; + + public class SourceDto + { + public System.Collections.Generic.IDictionary Items { get; set; } + } + + public class DestDto + { + public System.Collections.Generic.IDictionary Items { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Items, opt => opt.MapFrom(s => s.Items)); + }); + + protected override void Because_of() + { + var source = new SourceDto() + { + Items = new GenericWrappedDictionary + { + {"A", "AAA"}, + {"B", "BBB"}, + {"C", "CCC"} + } + }; + + + _dest = Mapper.Map, System.Collections.Generic.IDictionary>(source.Items); + } + + [Fact] + public void Should_map_using_the_nongeneric_dictionaryentry() + { + _dest.Values.Count.ShouldBe(3); + } + + // A wrapper for an IDictionary that implements IDictionary + // + // The important difference from a standard generic BCL dictionary is that: + // + // ((IEnumerable)GenericWrappedDictionary).GetEnumerator() returns DictionaryEntrys + // GenericWrappedDictionary.GetEnumerator() returns KeyValuePairs + // + // This behaviour is demonstrated by NHibernate's PersistentGenericMap + // (which wraps a nongeneric PersistentMap). + public class GenericWrappedDictionary : + System.Collections.Generic.IDictionary, System.Collections.IDictionary + { + System.Collections.IDictionary inner = new Dictionary(); + + public void Add(TKey key, TValue value) + { + inner.Add(key, value); + } + + public bool ContainsKey(TKey key) + { + throw new NotImplementedException(); + } + + public ICollection Keys + { + get { return inner.Keys.Cast().ToList(); } + } + + public bool Remove(TKey key) + { + throw new NotImplementedException(); + } + + public bool TryGetValue(TKey key, out TValue value) + { + throw new NotImplementedException(); + } + + public ICollection Values + { + get { return inner.Values.Cast().ToList(); } + } + + public TValue this[TKey key] + { + get + { + return (TValue)inner[key]; + } + set + { + inner[key] = value; + } + } + + public void Add(KeyValuePair item) + { + throw new NotImplementedException(); + } + + public void Clear() + { + throw new NotImplementedException(); + } + + public bool Contains(KeyValuePair item) + { + throw new NotImplementedException(); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + public int Count + { + get { throw new NotImplementedException(); } + } + + public bool IsReadOnly + { + get { throw new NotImplementedException(); } + } + + public bool Remove(KeyValuePair item) + { + throw new NotImplementedException(); + } + + public IEnumerator> GetEnumerator() + { + return inner.GetEnumerator() as IEnumerator>; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return inner.GetEnumerator(); + } + + public void Add(object key, object value) + { + inner.Add(key, value); + } + + public bool Contains(object key) + { + throw new NotImplementedException(); + } + + IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator() + { + return ((System.Collections.IDictionary)inner).GetEnumerator(); + } + + public bool IsFixedSize + { + get { throw new NotImplementedException(); } + } + + ICollection System.Collections.IDictionary.Keys + { + get { return inner.Keys; } + } + + public void Remove(object key) + { + throw new NotImplementedException(); + } + + ICollection System.Collections.IDictionary.Values + { + get { return inner.Values; } + } + + public object this[object key] + { + get + { + return inner[key]; + } + set + { + inner[key] = value; + } + } + + public void CopyTo(Array array, int index) + { + throw new NotImplementedException(); + } + + public bool IsSynchronized + { + get { throw new NotImplementedException(); } + } + + public object SyncRoot + { + get { throw new NotImplementedException(); } + } + } + + } + + public class When_mapping_from_a_list_of_object_to_generic_dictionary : AutoMapperSpecBase + { + private FooObject _result; + + public class FooDto + { + public DestinationValuePair[] Values { get; set; } + } + + public class FooObject + { + public IDictionary Values { get; set; } + } + + public class DestinationValuePair + { + public string Key { get; set; } + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap>() + .ConvertUsing(src => new KeyValuePair(src.Key, src.Value)); + }); + + protected override void Because_of() + { + var source = new FooDto + { + Values = new List + { + new DestinationValuePair {Key = "Key1", Value = "Value1"}, + new DestinationValuePair {Key = "Key2", Value = "Value2"} + }.ToArray() + }; + + _result = Mapper.Map(source); + } + + [Fact] + public void Should_perform_mapping_for_individual_values() + { + _result.Values.Count.ShouldBe(2); + + _result.Values["Key1"].ShouldBe("Value1"); + _result.Values["Key2"].ShouldBe("Value2"); + } + } + + public class When_mapping_nongeneric_type_inherited_from_dictionary : AutoMapperSpecBase + { + public class BaseClassWithDictionary + { + public DataDictionary Data { get; set; } + } + + public class DerivedClassWithDictionary : BaseClassWithDictionary { } + + public class DataDictionary : Dictionary + { + public string GetString(string name, string @default) + { + return null; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap()); + } + } } \ No newline at end of file diff --git a/src/UnitTests/DynamicMapping.cs b/src/UnitTests/DynamicMapping.cs index 38dbb6171e..153640ac1f 100644 --- a/src/UnitTests/DynamicMapping.cs +++ b/src/UnitTests/DynamicMapping.cs @@ -1,181 +1,570 @@ -using System; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace DynamicMapping - { - public class When_mapping_two_non_configured_types : NonValidatingSpecBase - { - private Destination _resultWithGenerics; - private Destination _resultWithoutGenerics; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); - - [Fact] - public void Should_dynamically_map_the_two_types() - { - _resultWithGenerics = Mapper.Map(new Source {Value = 5}); - _resultWithoutGenerics = (Destination) Mapper.Map(new Source {Value = 5}, typeof(Source), typeof(Destination)); - _resultWithGenerics.Value.ShouldEqual(5); - _resultWithoutGenerics.Value.ShouldEqual(5); - } - } - - public class When_mapping_two_non_configured_types_with_nesting : NonValidatingSpecBase - { - private Destination _resultWithGenerics; - - public class Source - { - public int Value { get; set; } - public ChildSource Child { get; set; } - } - - public class ChildSource - { - public string Value2 { get; set; } - } - - public class Destination - { - public int Value { get; set; } - public ChildDestination Child { get; set; } - } - - public class ChildDestination - { - public string Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); - - public When_mapping_two_non_configured_types_with_nesting() - { - var source = new Source - { - Value = 5, - Child = new ChildSource - { - Value2 = "foo" - } - }; - _resultWithGenerics = Mapper.Map(source); - } - - [Fact] - public void Should_dynamically_map_the_two_types() - { - _resultWithGenerics.Value.ShouldEqual(5); - } - - [Fact] - public void Should_dynamically_map_the_children() - { - _resultWithGenerics.Child.Value2.ShouldEqual("foo"); - } - } - - public class When_mapping_two_non_configured_types_that_do_not_match : NonValidatingSpecBase - { - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Valuefff { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); - - [Fact] - public void Should_ignore_any_members_that_do_not_match() - { - var destination = Mapper.Map(new Source {Value = 5}); - - destination.Valuefff.ShouldEqual(0); - } - - [Fact] - public void Should_not_throw_any_configuration_errors() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Mapper.Map(new Source { Value = 5 })); - } - } - - public class When_mapping_to_an_existing_destination_object : NonValidatingSpecBase - { - private Destination _destination; - - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - public class Destination - { - public int Valuefff { get; set; } - public int Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); - - public When_mapping_to_an_existing_destination_object() - { - _destination = new Destination { Valuefff = 7}; - Mapper.Map(new Source { Value = 5, Value2 = 3}, _destination); - } - - [Fact] - public void Should_preserve_existing_values() - { - _destination.Valuefff.ShouldEqual(7); - } - - [Fact] - public void Should_map_new_values() - { - _destination.Value2.ShouldEqual(3); - } - } - -#if !PORTABLE - public class When_mapping_from_an_anonymous_type_to_an_interface : NonValidatingSpecBase - { - private IDestination _result; - - public interface IDestination - { - int Value { get; set; } - } - - protected override void Because_of() - { - _result = Mapper.Map(new {Value = 5}); - } - - [Fact] - public void Should_allow_dynamic_mapping() - { - _result.Value.ShouldEqual(5); - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); - } -#endif - } +using System; +using System.Linq; +using Xunit; +using Shouldly; +using System.Collections.Generic; +using AutoMapper.QueryableExtensions; + +namespace AutoMapper.UnitTests.DynamicMapping +{ + public class When_mapping_from_untyped_enum_to_typed_enum : NonValidatingSpecBase + { + private Destination _result; + + public class Destination + { + public ConsoleColor Value { get; set; } + } + + protected override void Because_of() + { + _result = Mapper.Map(new { Value = (Enum) ConsoleColor.DarkGreen }); + } + + [Fact] + public void Should_map_ok() + { + _result.Value.ShouldBe(ConsoleColor.DarkGreen); + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => {}); + } + + public class When_mapping_nested_types : NonValidatingSpecBase + { + List _destination; + + public class Test + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class TestDto + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class ParentTestDto + { + public int Code { get; set; } + public string FullName { get; set; } + public TestDto Patient { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + protected override void Because_of() + { + var dynamicObject = new + { + Code = 5, + FullName = "John", + Patient = new Test + { + Id = 10, + Name = "Roberts" + } + }; + var dynamicList = new List { dynamicObject }; + _destination = Mapper.Map>(dynamicList); + } + + [Fact] + public void Should_map_ok() + { + var result = _destination.First(); + result.Patient.Id.ShouldBe(10); + } + } + + public class When_mapping_two_non_configured_types : NonValidatingSpecBase + { + private Destination _resultWithGenerics; + private Destination _resultWithoutGenerics; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + [Fact] + public void Should_dynamically_map_the_two_types() + { + _resultWithGenerics = Mapper.Map(new Source {Value = 5}); + _resultWithoutGenerics = (Destination) Mapper.Map(new Source {Value = 5}, typeof(Source), typeof(Destination)); + _resultWithGenerics.Value.ShouldBe(5); + _resultWithoutGenerics.Value.ShouldBe(5); + } + } + + public class When_mapping_two_non_configured_types_with_resolvers : NonValidatingSpecBase + { + public class Inner + { + public string Content { get; set; } + } + + public class Original + { + public string Text { get; set; } + } + + public class Target + { + public string Text { get; set; } + + public Inner Child { get; set; } + } + + public class TargetResolver : IValueResolver + { + public Inner Resolve(Original source, Target dest, Inner destination, ResolutionContext context) + { + return new Inner { Content = "Hello world from inner!" }; + } + } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(t => t.Child, o => o.MapFrom()); + }); + + [Fact] + public void Should_use_resolver() + { + var tm = Configuration.FindTypeMapFor(); + var original = new Original { Text = "Hello world from original!" }; + var mapped = Mapper.Map(original); + + mapped.Text.ShouldBe(original.Text); + mapped.Child.ShouldNotBeNull(); + mapped.Child.Content.ShouldBe("Hello world from inner!"); + } + } + + public class When_mapping_two_non_configured_types_with_nesting : NonValidatingSpecBase + { + private Destination _resultWithGenerics; + + public class Source + { + public int Value { get; set; } + public ChildSource Child { get; set; } + } + + public class ChildSource + { + public string Value2 { get; set; } + } + + public class Destination + { + public int Value { get; set; } + public ChildDestination Child { get; set; } + } + + public class ChildDestination + { + public string Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => {}); + + public When_mapping_two_non_configured_types_with_nesting() + { + var source = new Source + { + Value = 5, + Child = new ChildSource + { + Value2 = "foo" + } + }; + _resultWithGenerics = Mapper.Map(source); + } + + [Fact] + public void Should_dynamically_map_the_two_types() + { + _resultWithGenerics.Value.ShouldBe(5); + } + + [Fact] + public void Should_dynamically_map_the_children() + { + _resultWithGenerics.Child.Value2.ShouldBe("foo"); + } + } + + public class When_mapping_two_non_configured_types_that_do_not_match : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Valuefff { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + [Fact] + public void Should_ignore_any_members_that_do_not_match() + { + var destination = Mapper.Map(new Source {Value = 5}, opt => opt.ConfigureMap(MemberList.None)); + + destination.Valuefff.ShouldBe(0); + } + + [Fact] + public void Should_not_throw_any_configuration_errors() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Mapper.Map(new Source { Value = 5 }, opt => opt.ConfigureMap(MemberList.None))); + } + } + + public class When_mapping_to_an_existing_destination_object : NonValidatingSpecBase + { + private Destination _destination; + + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + public class Destination + { + public int Valuefff { get; set; } + public int Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => {}); + + public When_mapping_to_an_existing_destination_object() + { + _destination = new Destination { Valuefff = 7}; + Mapper.Map(new Source { Value = 5, Value2 = 3}, _destination, opt => opt.ConfigureMap(MemberList.None)); + } + + [Fact] + public void Should_preserve_existing_values() + { + _destination.Valuefff.ShouldBe(7); + } + + [Fact] + public void Should_map_new_values() + { + _destination.Value2.ShouldBe(3); + } + } + + public class When_inline_mapping_with_inline_captured_closure : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(_ => {}); + + [Fact] + public void Should_use_inline_value() + { + var value = 0; + + var source = new Source { Value = 10 }; + + void ConfigOpts(IMappingOperationOptions opt) => opt.ConfigureMap().ForMember(d => d.Value, m => m.MapFrom(src => src.Value + value)); + + var dest = Mapper.Map(source, ConfigOpts); + + dest.Value.ShouldBe(10); + + value = 10; + + dest = Mapper.Map(source, ConfigOpts); + + dest.Value.ShouldBe(20); + } + } + + public class When_mapping_from_an_anonymous_type_to_an_interface : NonValidatingSpecBase + { + private IDestination _result; + + public interface IDestination + { + int Value { get; set; } + } + + protected override void Because_of() + { + _result = Mapper.Map(new {Value = 5}); + } + + [Fact] + public void Should_allow_dynamic_mapping() + { + _result.Value.ShouldBe(5); + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + } + + public class When_dynamically_mapping_a_badly_configured_map : NonValidatingSpecBase + { + public class Source + { + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + [Fact] + public void Should_throw() + { + new Action(() => Mapper.Map(new Source())) + .ShouldThrowException( + ex=>ex.Message.ShouldContain("AutoMapper created this type map for you, but your types cannot be mapped using the current configuration.", Case.Sensitive)); + } + } + + public class When_dynamically_mapping_a_badly_configured_map_and_turning_off_validation : NonValidatingSpecBase + { + public class Source + { + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValidateInlineMaps = false; + }); + + [Fact] + public void Should_not_throw() + { + Action action = () => Mapper.Map(new Source()); + + action.ShouldNotThrow(); + } + } + + public class When_automatically_dynamically_mapping : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => {}); + + [Fact] + public void Should_map() + { + var source = new Source {Value = 5}; + var dest = Mapper.Map(source); + dest.Value.ShouldBe(5); + } + } + + public class When_automatically_dynamically_projecting : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => {}); + + [Fact] + public void Should_map() + { + var source = new Source {Value = 5}; + var items = new[] {source}.AsQueryable(); + var dest = items.ProjectTo(ConfigProvider).ToArray(); + + dest.Length.ShouldBe(1); + dest[0].Value.ShouldBe(5); + } + } + + public class When_mixing_auto_and_manual_map : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + public Inner Value2 { get; set; } + + public class Inner + { + public string Value { get; set; } + } + } + + public class Dest + { + public int Value { get; set; } + public Inner Value2 { get; set; } + + public class Inner + { + public string Value { get; set; } + } + + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap().ForMember(d => d.Value, opt => opt.MapFrom(src => src.Value + 5))); + + [Fact] + public void Should_map() + { + var source = new Source + { + Value = 5, + Value2 = new Source.Inner + { + Value = "asdf" + } + }; + + var dest = Mapper.Map(source); + + dest.Value.ShouldBe(source.Value + 5); + dest.Value2.Value.ShouldBe(source.Value2.Value); + } + } + + public class When_mixing_auto_and_manual_map_with_mismatched_properties : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + public Inner Value2 { get; set; } + + public class Inner + { + public string Value { get; set; } + } + } + + public class Dest + { + public int Value { get; set; } + public Inner Value2 { get; set; } + + public class Inner + { + public string Valuefff { get; set; } + } + + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap().ForMember(d => d.Value, opt => opt.MapFrom(src => src.Value + 5))); + + [Fact] + public void Should_pass_validation() + { + Action assert = () => Configuration.AssertConfigurationIsValid(); + + assert.ShouldNotThrow(); + } + + [Fact] + public void Should_not_pass_runtime_validation() + { + Action assert = () => Mapper.Map(new Source { Value = 5, Value2 = new Source.Inner { Value = "asdf"}}); + + var exception = assert.ShouldThrow(); + var inner = exception.InnerException as AutoMapperConfigurationException; + + inner.ShouldNotBeNull(); + + inner.Errors.Select(e => e.TypeMap.Types).ShouldContain(tp => tp == new TypePair(typeof(Source.Inner), typeof(Dest.Inner))); + } + } + + public class When_inner_maps_are_mismatched : AutoMapperSpecBase + { + public class Source + { + public int Value { get; set; } + public Child Value2 { get; set; } + + public class Child + { + public InnerChild Value { get; set; } + } + public class InnerChild + { + public string Value { get; set; } + } + } + + public class Dest + { + public int Value { get; set; } + public Child Value2 { get; set; } + + public class Child + { + public InnerChild Value { get; set; } + } + public class InnerChild + { + public string Valuefff { get; set; } + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap()); + + [Fact] + public void Should_not_pass_runtime_validation() + { + Action assert = () => Mapper.Map(new Source { Value = 5, Value2 = new Source.Child { Value = new Source.InnerChild { Value = "asdf" } } }); + + var exception = assert.ShouldThrow(); + var inner = exception.GetBaseException() as AutoMapperConfigurationException; + + inner.ShouldNotBeNull(); + + inner.Errors.Select(e => e.TypeMap.Types).ShouldContain(tp => tp == new TypePair(typeof(Source.InnerChild), typeof(Dest.InnerChild))); + } + } } \ No newline at end of file diff --git a/src/UnitTests/EnumToNullableEnum.cs b/src/UnitTests/EnumToNullableEnum.cs index d1c8c69334..82cf28b88c 100644 --- a/src/UnitTests/EnumToNullableEnum.cs +++ b/src/UnitTests/EnumToNullableEnum.cs @@ -1,4 +1,4 @@ -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests @@ -31,7 +31,7 @@ protected override void Because_of() [Fact] public void Should_map_enum_to_nullable_enum() { - _destination.EnumValue.ShouldEqual(SomeEnum.Bar); + _destination.EnumValue.ShouldBe(SomeEnum.Bar); } } } diff --git a/src/UnitTests/Enumerations.cs b/src/UnitTests/Enumerations.cs index b0eb23a10e..910ff245ad 100644 --- a/src/UnitTests/Enumerations.cs +++ b/src/UnitTests/Enumerations.cs @@ -1,467 +1,693 @@ -using System; -using AutoMapper.UnitTests; -using Should; -using Xunit; - -namespace AutoMapper.Tests -{ - public class EnumMappingFixture - { - public EnumMappingFixture() - { - Cleanup(); - } - - public void Cleanup() - { - - } - - [Fact] - public void ShouldMapSharedEnum() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new Order - { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(Status.InProgress); - } - - [Fact] - public void ShouldMapToUnderlyingType() { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new Order { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(1); - } - - [Fact] - public void ShouldMapToStringType() { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new Order { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual("InProgress"); - } - - [Fact] - public void ShouldMapFromUnderlyingType() { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new OrderDtoInt { - Status = 1 - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(Status.InProgress); - } - - [Fact] - public void ShouldMapFromStringType() { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new OrderDtoString { - Status = "InProgress" - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(Status.InProgress); - } - - [Fact] - public void ShouldMapEnumByMatchingNames() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new Order - { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(StatusForDto.InProgress); - } - - [Fact] - public void ShouldMapEnumByMatchingValues() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new Order - { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(StatusForDto.InProgress); - } - - [Fact] - public void ShouldMapSharedNullableEnum() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new OrderWithNullableStatus { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(Status.InProgress); - } - - [Fact] - public void ShouldMapNullableEnumByMatchingValues() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new OrderWithNullableStatus { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldEqual(StatusForDto.InProgress); - } - - [Fact] - public void ShouldMapNullableEnumToNullWhenSourceEnumIsNullAndDestinationWasNotNull() - { - var config = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = true; - cfg.CreateMap(); - }); - - var dto = new OrderDtoWithOwnNullableStatus() - { - Status = StatusForDto.Complete - }; - - var order = new OrderWithNullableStatus - { - Status = null - }; - - var mapper = config.CreateMapper(); - mapper.Map(order, dto); - - dto.Status.ShouldBeNull(); - } - - [Fact] - public void ShouldMapNullableEnumToNullWhenSourceEnumIsNull() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new OrderWithNullableStatus { - Status = null - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - dto.Status.ShouldBeNull(); - } - - [Fact] - public void ShouldMapEnumUsingCustomResolver() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dto => dto.Status, options => options.ResolveUsing())); - - var order = new Order - { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var mappedDto = mapper.Map(order); - - mappedDto.Status.ShouldEqual(StatusForDto.InProgress); - } - - [Fact] - public void ShouldMapEnumUsingGenericEnumResolver() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dto => dto.Status, options => options.ResolveUsing, Status>(m => m.Status))); - - var order = new Order - { - Status = Status.InProgress - }; - - var mapper = config.CreateMapper(); - var mappedDto = mapper.Map(order); - - mappedDto.Status.ShouldEqual(StatusForDto.InProgress); - } - - [Fact] - public void ShouldMapEnumWithInvalidValue() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - var order = new Order - { - Status = 0 - }; - - var mapper = config.CreateMapper(); - var dto = mapper.Map(order); - - var expected = (StatusForDto)0; - - dto.Status.ShouldEqual(expected); - } - - public enum Status - { - InProgress = 1, - Complete = 2 - } - - public enum StatusForDto - { - InProgress = 1, - Complete = 2 - } - - public class Order - { - public Status Status { get; set; } - } - - public class OrderDto - { - public Status Status { get; set; } - } - - public class OrderDtoInt { - public int Status { get; set; } - } - - public class OrderDtoString { - public string Status { get; set; } - } - - public class OrderDtoWithOwnStatus - { - public StatusForDto Status { get; set; } - } - - public class OrderWithNullableStatus - { - public Status? Status { get; set; } - } - - public class OrderDtoWithNullableStatus - { - public Status? Status { get; set; } - } - - public class OrderDtoWithOwnNullableStatus - { - public StatusForDto? Status { get; set; } - } - - public class DtoStatusValueResolver : IValueResolver - { - public StatusForDto Resolve(Order source, ResolutionContext context) - { - return context.Mapper.Map(source.Status); - } - } - - public class EnumValueResolver : IValueResolver - { - public TOutputEnum Resolve(TInputEnum source, ResolutionContext context) - { - return ((TOutputEnum)Enum.Parse(typeof(TOutputEnum), Enum.GetName(typeof(TInputEnum), source), false)); - } - } - } - public class When_mapping_from_a_null_object_with_an_enum : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = false; - cfg.CreateMap(); - }); - - public enum EnumValues - { - One, Two, Three - } - - public class DestinationClass - { - public EnumValues Values { get; set; } - } - - public class SourceClass - { - public EnumValues Values { get; set; } - } - - [Fact] - public void Should_set_the_target_enum_to_the_default_value() - { - SourceClass sourceClass = null; - var dest = Mapper.Map(sourceClass); - dest.Values.ShouldEqual(default(EnumValues)); - } - } - public class When_mapping_from_a_null_object_with_a_nullable_enum : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = false; - cfg.CreateMap(); - }); - - public enum EnumValues - { - One, Two, Three - } - - public class DestinationClass - { - public EnumValues Values { get; set; } - } - - public class SourceClass - { - public EnumValues? Values { get; set; } - } - - [Fact] - public void Should_set_the_target_enum_to_the_default_value() - { - SourceClass sourceClass = null; - var dest = Mapper.Map(sourceClass); - dest.Values.ShouldEqual(default(EnumValues)); - } - } - public class When_mapping_from_a_null_object_with_a_nullable_enum_as_string : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - public enum EnumValues - { - One, Two, Three - } - - public class DestinationClass - { - public EnumValues Values1 { get; set; } - public EnumValues? Values2 { get; set; } - public EnumValues Values3 { get; set; } - } - - public class SourceClass - { - public string Values1 { get; set; } - public string Values2 { get; set; } - public string Values3 { get; set; } - } - - [Fact] - public void Should_set_the_target_enum_to_the_default_value() - { - var sourceClass = new SourceClass(); - var dest = Mapper.Map(sourceClass); - dest.Values1.ShouldEqual(default(EnumValues)); - } - - [Fact] - public void Should_set_the_target_nullable_to_null() - { - var sourceClass = new SourceClass(); - var dest = Mapper.Map(sourceClass); - dest.Values2.ShouldBeNull(); - } - - [Fact] - public void Should_set_the_target_empty_to_null() - { - var sourceClass = new SourceClass - { - Values3 = "" - }; - var dest = Mapper.Map(sourceClass); - dest.Values3.ShouldEqual(default(EnumValues)); - } - } - - - public class When_mapping_a_flags_enum : NonValidatingSpecBase - { - private DestinationFlags _result; - - [Flags] - private enum SourceFlags - { - None = 0, - One = 1, - Two = 2, - Four = 4, - Eight = 8 - } - - [Flags] - private enum DestinationFlags - { - None = 0, - One = 1, - Two = 2, - Four = 4, - Eight = 8 - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); - - protected override void Because_of() - { - _result = Mapper.Map(SourceFlags.One | SourceFlags.Four | SourceFlags.Eight); - } - - [Fact] - public void Should_include_all_source_enum_values() - { - _result.ShouldEqual(DestinationFlags.One | DestinationFlags.Four | DestinationFlags.Eight); - } - } - -} +using System; +using System.Runtime.Serialization; +using AutoMapper.UnitTests; +using Shouldly; +using Xunit; + +namespace AutoMapper.Tests +{ + public class DefaultEnumValueToString : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public ConsoleColor Color { get; set; } + } + + class Destination + { + public string Color { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Color.ShouldBe("Black"); + } + } + + public class StringToNullableEnum : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public string Color { get; set; } + } + + class Destination + { + public ConsoleColor? Color { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Color = "Red" }); + } + + [Fact] + public void Should_map_with_underlying_type() + { + _destination.Color.ShouldBe(ConsoleColor.Red); + } + } + + public class NullableEnumToString : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public ConsoleColor? Color { get; set; } + } + + class Destination + { + public string Color { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap().ConvertUsing((Enum src) => "Test"); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Color = ConsoleColor.Black }); + } + + [Fact] + public void Should_map_with_underlying_type() + { + _destination.Color.ShouldBe("Test"); + } + } + + public class EnumMappingFixture + { + [Fact] + public void ShouldMapSharedEnum() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new Order + { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(Status.InProgress); + } + + [Fact] + public void ShouldMapToUnderlyingType() { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new Order { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(1); + } + + [Fact] + public void ShouldMapToStringType() { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new Order { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe("InProgress"); + } + + [Fact] + public void ShouldMapFromUnderlyingType() { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new OrderDtoInt { + Status = 1 + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(Status.InProgress); + } + + [Fact] + public void ShouldMapFromStringType() { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new OrderDtoString { + Status = "InProgress" + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(Status.InProgress); + } + + [Fact] + public void ShouldMapEnumByMatchingNames() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new Order + { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(StatusForDto.InProgress); + } + + [Fact] + public void ShouldMapEnumByMatchingValues() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new Order + { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(StatusForDto.InProgress); + } + + [Fact] + public void ShouldMapSharedNullableEnum() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new OrderWithNullableStatus { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(Status.InProgress); + } + + [Fact] + public void ShouldMapNullableEnumByMatchingValues() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new OrderWithNullableStatus { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBe(StatusForDto.InProgress); + } + + [Fact] + public void ShouldMapNullableEnumToNullWhenSourceEnumIsNullAndDestinationWasNotNull() + { + var config = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = true; + cfg.CreateMap(); + }); + + var dto = new OrderDtoWithOwnNullableStatus() + { + Status = StatusForDto.Complete + }; + + var order = new OrderWithNullableStatus + { + Status = null + }; + + var mapper = config.CreateMapper(); + mapper.Map(order, dto); + + dto.Status.ShouldBeNull(); + } + + [Fact] + public void ShouldMapNullableEnumToNullWhenSourceEnumIsNull() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new OrderWithNullableStatus { + Status = null + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + dto.Status.ShouldBeNull(); + } + + [Fact] + public void ShouldMapEnumUsingCustomResolver() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(dto => dto.Status, options => options.MapFrom())); + + var order = new Order + { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var mappedDto = mapper.Map(order); + + mappedDto.Status.ShouldBe(StatusForDto.InProgress); + } + + [Fact] + public void ShouldMapEnumUsingGenericEnumResolver() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(dto => dto.Status, options => options.MapFrom, Status>(m => m.Status))); + + var order = new Order + { + Status = Status.InProgress + }; + + var mapper = config.CreateMapper(); + var mappedDto = mapper.Map(order); + + mappedDto.Status.ShouldBe(StatusForDto.InProgress); + } + + [Fact] + public void ShouldMapEnumWithInvalidValue() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + var order = new Order + { + Status = 0 + }; + + var mapper = config.CreateMapper(); + var dto = mapper.Map(order); + + var expected = (StatusForDto)0; + + dto.Status.ShouldBe(expected); + } + + public enum Status + { + InProgress = 1, + Complete = 2 + } + + public enum StatusForDto + { + InProgress = 1, + Complete = 2 + } + + public class Order + { + public Status Status { get; set; } + } + + public class OrderDto + { + public Status Status { get; set; } + } + + public class OrderDtoInt { + public int Status { get; set; } + } + + public class OrderDtoString { + public string Status { get; set; } + } + + public class OrderDtoWithOwnStatus + { + public StatusForDto Status { get; set; } + } + + public class OrderWithNullableStatus + { + public Status? Status { get; set; } + } + + public class OrderDtoWithNullableStatus + { + public Status? Status { get; set; } + } + + public class OrderDtoWithOwnNullableStatus + { + public StatusForDto? Status { get; set; } + } + + public class DtoStatusValueResolver : IValueResolver + { + public StatusForDto Resolve(Order source, object d, StatusForDto dest, ResolutionContext context) + { + return context.Mapper.Map(source.Status); + } + } + + public class EnumValueResolver : IMemberValueResolver + { + public TOutputEnum Resolve(object s, object d, TInputEnum source, TOutputEnum dest, ResolutionContext context) + { + return ((TOutputEnum)Enum.Parse(typeof(TOutputEnum), Enum.GetName(typeof(TInputEnum), source), false)); + } + } + } + public class When_mapping_from_a_null_object_with_an_enum : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap(); + }); + + public enum EnumValues + { + One, Two, Three + } + + public class DestinationClass + { + public EnumValues Values { get; set; } + } + + public class SourceClass + { + public EnumValues Values { get; set; } + } + + [Fact] + public void Should_set_the_target_enum_to_the_default_value() + { + SourceClass sourceClass = null; + var dest = Mapper.Map(sourceClass); + dest.Values.ShouldBe(default(EnumValues)); + } + } + + public class When_mapping_to_a_nullable_flags_enum : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Flags] + public enum EnumValues + { + One, Two = 2, Three = 4 + } + + public class SourceClass + { + public EnumValues Values { get; set; } + } + + public class DestinationClass + { + public EnumValues? Values { get; set; } + } + + [Fact] + public void Should_set_the_target_enum_to_the_default_value() + { + var values = EnumValues.Two | EnumValues.Three; + var dest = Mapper.Map(new SourceClass { Values = values }); + dest.Values.ShouldBe(values); + } + } + + public class When_mapping_from_a_null_object_with_a_nullable_enum : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap(); + }); + + public enum EnumValues + { + One, Two, Three + } + + public class DestinationClass + { + public EnumValues Values { get; set; } + } + + public class SourceClass + { + public EnumValues? Values { get; set; } + } + + [Fact] + public void Should_set_the_target_enum_to_the_default_value() + { + SourceClass sourceClass = null; + var dest = Mapper.Map(sourceClass); + dest.Values.ShouldBe(default(EnumValues)); + } + } + public class When_mapping_from_a_null_object_with_a_nullable_enum_as_string : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + public enum EnumValues + { + One, Two, Three + } + + public class DestinationClass + { + public EnumValues Values1 { get; set; } + public EnumValues? Values2 { get; set; } + public EnumValues Values3 { get; set; } + } + + public class SourceClass + { + public string Values1 { get; set; } + public string Values2 { get; set; } + public string Values3 { get; set; } + } + + [Fact] + public void Should_set_the_target_enum_to_the_default_value() + { + var sourceClass = new SourceClass(); + var dest = Mapper.Map(sourceClass); + dest.Values1.ShouldBe(default(EnumValues)); + } + + [Fact] + public void Should_set_the_target_nullable_to_null() + { + var sourceClass = new SourceClass(); + var dest = Mapper.Map(sourceClass); + dest.Values2.ShouldBeNull(); + } + + [Fact] + public void Should_set_the_target_empty_to_null() + { + var sourceClass = new SourceClass + { + Values3 = "" + }; + var dest = Mapper.Map(sourceClass); + dest.Values3.ShouldBe(default(EnumValues)); + } + } + + + public class When_mapping_a_flags_enum : NonValidatingSpecBase + { + private DestinationFlags _result; + + [Flags] + private enum SourceFlags + { + None = 0, + One = 1, + Two = 2, + Four = 4, + Eight = 8 + } + + [Flags] + private enum DestinationFlags + { + None = 0, + One = 1, + Two = 2, + Four = 4, + Eight = 8 + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + protected override void Because_of() + { + _result = Mapper.Map(SourceFlags.One | SourceFlags.Four | SourceFlags.Eight); + } + + [Fact] + public void Should_include_all_source_enum_values() + { + _result.ShouldBe(DestinationFlags.One | DestinationFlags.Four | DestinationFlags.Eight); + } + } + + public class When_the_target_has_an_enummemberattribute_value : AutoMapperSpecBase + { + public enum EnumWithEnumMemberAttribute + { + Null, + [EnumMember(Value = "Eins")] + One + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + [Fact] + public void Should_return_the_enum_from_defined_enummemberattribute_value() + { + var dest = Mapper.Map("Eins"); + dest.ShouldBe(EnumWithEnumMemberAttribute.One); + } + + [Fact] + public void Should_return_the_enum_from_undefined_enummemberattribute_value() + { + var dest = Mapper.Map("Null"); + dest.ShouldBe(EnumWithEnumMemberAttribute.Null); + } + + [Fact] + public void Should_return_the_nullable_enum_from_defined_enummemberattribute_value() + { + var dest = Mapper.Map("Eins"); + dest.ShouldBe(EnumWithEnumMemberAttribute.One); + } + + [Fact] + public void Should_return_the_enum_from_undefined_enummemberattribute_value_mixedcase() + { + var dest = Mapper.Map("NuLl"); + dest.ShouldBe(EnumWithEnumMemberAttribute.Null); + } + + [Fact] + public void Should_return_the_enum_from_defined_enummemberattribute_value_mixedcase() + { + var dest = Mapper.Map("eInS"); + dest.ShouldBe(EnumWithEnumMemberAttribute.One); + } + + [Fact] + public void Should_return_the_nullable_enum_from_null_value() + { + var dest = Mapper.Map(null); + dest.ShouldBe(null); + } + + [Fact] + public void Should_return_the_nullable_enum_from_undefined_enummemberattribute_value() + { + var dest = Mapper.Map("Null"); + dest.ShouldBe(EnumWithEnumMemberAttribute.Null); + } + } + + + public class When_the_source_has_an_enummemberattribute_value : AutoMapperSpecBase + { + public enum EnumWithEnumMemberAttribute + { + Null, + [EnumMember(Value = "Eins")] + One + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + [Fact] + public void Should_return_the_defined_enummemberattribute_value() + { + var dest = Mapper.Map(EnumWithEnumMemberAttribute.One); + dest.ShouldBe("Eins"); + } + + [Fact] + public void Should_return_the_enum_value() + { + var dest = Mapper.Map(EnumWithEnumMemberAttribute.Null); + dest.ShouldBe("Null"); + } + + [Fact] + public void Should_return_the_defined_enummemberattribute_value_nullable() + { + var dest = Mapper.Map(EnumWithEnumMemberAttribute.One); + dest.ShouldBe("Eins"); + } + + [Fact] + public void Should_return_the_enum_value_nullable() + { + var dest = Mapper.Map(EnumWithEnumMemberAttribute.Null); + dest.ShouldBe("Null"); + } + + [Fact] + public void Should_return_null() + { + var dest = Mapper.Map(null); + dest.ShouldBe(null); + } + } +} diff --git a/src/UnitTests/ExplicitMapperCreation.cs b/src/UnitTests/ExplicitMapperCreation.cs index 8fe94d96ce..f20af41987 100644 --- a/src/UnitTests/ExplicitMapperCreation.cs +++ b/src/UnitTests/ExplicitMapperCreation.cs @@ -1,4 +1,4 @@ -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests @@ -31,7 +31,7 @@ public void Should_map() var source = new Source {Value = 10}; var dest = _mapper.Map(source); - dest.Value.ShouldEqual(source.Value); + dest.Value.ShouldBe(source.Value); } [Fact] diff --git a/src/UnitTests/ExpressionBridge.cs b/src/UnitTests/ExpressionBridge.cs index 6e490555ee..9b42fc970b 100644 --- a/src/UnitTests/ExpressionBridge.cs +++ b/src/UnitTests/ExpressionBridge.cs @@ -1,291 +1,291 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using Should; -using Xunit; -using System.Linq; - -namespace AutoMapper.UnitTests -{ - namespace ExpressionBridge - { - using QueryableExtensions; - - public class SimpleProductDto - { - public string Name { set; get; } - public string ProductSubcategoryName { set; get; } - public string CategoryName { set; get; } - } - public class ExtendedProductDto - { - public string Name { set; get; } - public string ProductSubcategoryName { set; get; } - public string CategoryName { set; get; } - public List BOM { set; get; } - } - public class ComplexProductDto - { - public string Name { get; set; } - public ProductSubcategoryDto ProductSubcategory { get; set; } - } - public class ProductSubcategoryDto - { - public string Name { get; set; } - public ProductCategoryDto ProductCategory { get; set; } - } - public class ProductCategoryDto - { - public string Name { get; set; } - } - public class AbstractProductDto - { - public string Name { set; get; } - public string ProductSubcategoryName { set; get; } - public string CategoryName { set; get; } - public List Types { get; set; } - } - public abstract class ProductTypeDto { } - public class ProdTypeA : ProductTypeDto {} - public class ProdTypeB : ProductTypeDto {} - - public class ProductTypeConverter : ITypeConverter - { - public ProductTypeDto Convert(ProductType source, ResolutionContext context) - { - if (source.Name == "A") - return new ProdTypeA(); - if (source.Name == "B") - return new ProdTypeB(); - throw new ArgumentException(); - } - } - - - public class ProductType - { - public string Name { get; set; } - } - - public class BillOfMaterialsDto - { - public int BillOfMaterialsID { set; get; } - } - - public class Product - { - public string Name { get; set; } - public ProductSubcategory ProductSubcategory { get; set; } - public List BillOfMaterials { set; get; } - public List Types { get; set; } - } - - public class ProductSubcategory - { - public string Name { get; set; } - public ProductCategory ProductCategory { get; set; } - } - - public class ProductCategory - { - public string Name { get; set; } - } - - public class BillOfMaterials - { - public int BillOfMaterialsID { set; get; } - } - public class When_mapping_using_expressions : SpecBase - { - private List _products; - private Expression> _simpleProductConversionLinq; - private Expression> _extendedProductConversionLinq; - private Expression> _abstractProductConversionLinq; - private List _simpleProducts; - private List _extendedProducts; - private MapperConfiguration _config; - - protected override void Establish_context() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(m => m.CategoryName, dst => dst.MapFrom(p => p.ProductSubcategory.ProductCategory.Name)); - cfg.CreateMap() - .ForMember(m => m.CategoryName, dst => dst.MapFrom(p => p.ProductSubcategory.ProductCategory.Name)) - .ForMember(m => m.BOM, dst => dst.MapFrom(p => p.BillOfMaterials)); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap() - //.ConvertUsing(x => ProductTypeDto.GetProdType(x)); - .ConvertUsing(); - }); - _simpleProductConversionLinq = _config.ExpressionBuilder.CreateMapExpression(); - _extendedProductConversionLinq = _config.ExpressionBuilder.CreateMapExpression(); - _abstractProductConversionLinq = _config.ExpressionBuilder.CreateMapExpression(); - - _products = new List() - { - new Product - { - Name = "Foo", - ProductSubcategory = new ProductSubcategory - { - Name = "Bar", - ProductCategory = new ProductCategory - { - Name = "Baz" - } - }, - BillOfMaterials = new List - { - new BillOfMaterials - { - BillOfMaterialsID = 5 - } - } - , - Types = new List - { - new ProductType() { Name = "A" }, - new ProductType() { Name = "B" }, - new ProductType() { Name = "A" } - } - } - }; - } - - protected override void Because_of() - { - var queryable = _products.AsQueryable(); - - _simpleProducts = queryable.Select(_simpleProductConversionLinq).ToList(); - - _extendedProducts = queryable.Select(_extendedProductConversionLinq).ToList(); - - } - - [Fact] - public void Should_map_and_flatten() - { - - - _simpleProducts.Count.ShouldEqual(1); - _simpleProducts[0].Name.ShouldEqual("Foo"); - _simpleProducts[0].ProductSubcategoryName.ShouldEqual("Bar"); - _simpleProducts[0].CategoryName.ShouldEqual("Baz"); - - _extendedProducts.Count.ShouldEqual(1); - _extendedProducts[0].Name.ShouldEqual("Foo"); - _extendedProducts[0].ProductSubcategoryName.ShouldEqual("Bar"); - _extendedProducts[0].CategoryName.ShouldEqual("Baz"); - _extendedProducts[0].BOM.Count.ShouldEqual(1); - _extendedProducts[0].BOM[0].BillOfMaterialsID.ShouldEqual(5); - } - - [Fact] - public void Should_use_extension_methods() - { - - - var queryable = _products.AsQueryable(); - - var simpleProducts = queryable.ProjectTo(_config).ToList(); - - simpleProducts.Count.ShouldEqual(1); - simpleProducts[0].Name.ShouldEqual("Foo"); - simpleProducts[0].ProductSubcategoryName.ShouldEqual("Bar"); - simpleProducts[0].CategoryName.ShouldEqual("Baz"); - - var extendedProducts = queryable.ProjectTo(_config).ToList(); - - extendedProducts.Count.ShouldEqual(1); - extendedProducts[0].Name.ShouldEqual("Foo"); - extendedProducts[0].ProductSubcategoryName.ShouldEqual("Bar"); - extendedProducts[0].CategoryName.ShouldEqual("Baz"); - extendedProducts[0].BOM.Count.ShouldEqual(1); - extendedProducts[0].BOM[0].BillOfMaterialsID.ShouldEqual(5); - - var complexProducts = queryable.ProjectTo(_config).ToList(); - - complexProducts.Count.ShouldEqual(1); - complexProducts[0].Name.ShouldEqual("Foo"); - complexProducts[0].ProductSubcategory.Name.ShouldEqual("Bar"); - complexProducts[0].ProductSubcategory.ProductCategory.Name.ShouldEqual("Baz"); - } - } - - namespace CircularReferences - { - public class A - { - public int AP1 { get; set; } - public string AP2 { get; set; } - public virtual B B { get; set; } - } - - public class B - { - public B() - { - BP2 = new HashSet(); - } - public int BP1 { get; set; } - public virtual ICollection BP2 { get; set; } - } - - public class AEntity - { - public int AP1 { get; set; } - public string AP2 { get; set; } - public virtual BEntity B { get; set; } - } - public class BEntity - { - public BEntity() - { - BP2 = new HashSet(); - } - public int BP1 { get; set; } - public virtual ICollection BP2 { get; set; } - } - - public class C - { - public C Value { get; set; } - } - - public class When_mapping_circular_references : AutoMapperSpecBase - { - private IQueryable _bei; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().MaxDepth(3); - cfg.CreateMap().MaxDepth(3); - }); - - protected override void Because_of() - { - var be = new BEntity(); - be.BP1 = 3; - be.BP2.Add(new AEntity() { AP1 = 1, AP2 = "hello", B = be }); - be.BP2.Add(new AEntity() { AP1 = 2, AP2 = "two", B = be }); - - var belist = new List(); - belist.Add(be); - _bei = belist.AsQueryable(); - } - - [Fact] - public void Should_not_throw_exception() - { - typeof(StackOverflowException).ShouldNotBeThrownBy(() => _bei.ProjectTo(Configuration)); - } - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using Shouldly; +using Xunit; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + namespace ExpressionBridge + { + using QueryableExtensions; + + public class SimpleProductDto + { + public string Name { set; get; } + public string ProductSubcategoryName { set; get; } + public string CategoryName { set; get; } + } + public class ExtendedProductDto + { + public string Name { set; get; } + public string ProductSubcategoryName { set; get; } + public string CategoryName { set; get; } + public List BOM { set; get; } + } + public class ComplexProductDto + { + public string Name { get; set; } + public ProductSubcategoryDto ProductSubcategory { get; set; } + } + public class ProductSubcategoryDto + { + public string Name { get; set; } + public ProductCategoryDto ProductCategory { get; set; } + } + public class ProductCategoryDto + { + public string Name { get; set; } + } + public class AbstractProductDto + { + public string Name { set; get; } + public string ProductSubcategoryName { set; get; } + public string CategoryName { set; get; } + public List Types { get; set; } + } + public abstract class ProductTypeDto { } + public class ProdTypeA : ProductTypeDto {} + public class ProdTypeB : ProductTypeDto {} + + public class ProductTypeConverter : ITypeConverter + { + public ProductTypeDto Convert(ProductType source, ProductTypeDto destination, ResolutionContext context) + { + if (source.Name == "A") + return new ProdTypeA(); + if (source.Name == "B") + return new ProdTypeB(); + throw new ArgumentException(); + } + } + + + public class ProductType + { + public string Name { get; set; } + } + + public class BillOfMaterialsDto + { + public int BillOfMaterialsID { set; get; } + } + + public class Product + { + public string Name { get; set; } + public ProductSubcategory ProductSubcategory { get; set; } + public List BillOfMaterials { set; get; } + public List Types { get; set; } + } + + public class ProductSubcategory + { + public string Name { get; set; } + public ProductCategory ProductCategory { get; set; } + } + + public class ProductCategory + { + public string Name { get; set; } + } + + public class BillOfMaterials + { + public int BillOfMaterialsID { set; get; } + } + public class When_mapping_using_expressions : SpecBase + { + private List _products; + private Expression> _simpleProductConversionLinq; + private Expression> _extendedProductConversionLinq; + private Expression> _abstractProductConversionLinq; + private List _simpleProducts; + private List _extendedProducts; + private MapperConfiguration _config; + + protected override void Establish_context() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(m => m.CategoryName, dst => dst.MapFrom(p => p.ProductSubcategory.ProductCategory.Name)); + cfg.CreateMap() + .ForMember(m => m.CategoryName, dst => dst.MapFrom(p => p.ProductSubcategory.ProductCategory.Name)) + .ForMember(m => m.BOM, dst => dst.MapFrom(p => p.BillOfMaterials)); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap() + //.ConvertUsing(x => ProductTypeDto.GetProdType(x)); + .ConvertUsing(); + }); + _simpleProductConversionLinq = _config.ExpressionBuilder.GetMapExpression(); + _extendedProductConversionLinq = _config.ExpressionBuilder.GetMapExpression(); + _abstractProductConversionLinq = _config.ExpressionBuilder.GetMapExpression(); + + _products = new List() + { + new Product + { + Name = "Foo", + ProductSubcategory = new ProductSubcategory + { + Name = "Bar", + ProductCategory = new ProductCategory + { + Name = "Baz" + } + }, + BillOfMaterials = new List + { + new BillOfMaterials + { + BillOfMaterialsID = 5 + } + } + , + Types = new List + { + new ProductType() { Name = "A" }, + new ProductType() { Name = "B" }, + new ProductType() { Name = "A" } + } + } + }; + } + + protected override void Because_of() + { + var queryable = _products.AsQueryable(); + + _simpleProducts = queryable.Select(_simpleProductConversionLinq).ToList(); + + _extendedProducts = queryable.Select(_extendedProductConversionLinq).ToList(); + + } + + [Fact] + public void Should_map_and_flatten() + { + + + _simpleProducts.Count.ShouldBe(1); + _simpleProducts[0].Name.ShouldBe("Foo"); + _simpleProducts[0].ProductSubcategoryName.ShouldBe("Bar"); + _simpleProducts[0].CategoryName.ShouldBe("Baz"); + + _extendedProducts.Count.ShouldBe(1); + _extendedProducts[0].Name.ShouldBe("Foo"); + _extendedProducts[0].ProductSubcategoryName.ShouldBe("Bar"); + _extendedProducts[0].CategoryName.ShouldBe("Baz"); + _extendedProducts[0].BOM.Count.ShouldBe(1); + _extendedProducts[0].BOM[0].BillOfMaterialsID.ShouldBe(5); + } + + [Fact] + public void Should_use_extension_methods() + { + + + var queryable = _products.AsQueryable(); + + var simpleProducts = queryable.ProjectTo(_config).ToList(); + + simpleProducts.Count.ShouldBe(1); + simpleProducts[0].Name.ShouldBe("Foo"); + simpleProducts[0].ProductSubcategoryName.ShouldBe("Bar"); + simpleProducts[0].CategoryName.ShouldBe("Baz"); + + var extendedProducts = queryable.ProjectTo(_config).ToList(); + + extendedProducts.Count.ShouldBe(1); + extendedProducts[0].Name.ShouldBe("Foo"); + extendedProducts[0].ProductSubcategoryName.ShouldBe("Bar"); + extendedProducts[0].CategoryName.ShouldBe("Baz"); + extendedProducts[0].BOM.Count.ShouldBe(1); + extendedProducts[0].BOM[0].BillOfMaterialsID.ShouldBe(5); + + var complexProducts = queryable.ProjectTo(_config).ToList(); + + complexProducts.Count.ShouldBe(1); + complexProducts[0].Name.ShouldBe("Foo"); + complexProducts[0].ProductSubcategory.Name.ShouldBe("Bar"); + complexProducts[0].ProductSubcategory.ProductCategory.Name.ShouldBe("Baz"); + } + } + + namespace CircularReferences + { + public class A + { + public int AP1 { get; set; } + public string AP2 { get; set; } + public virtual B B { get; set; } + } + + public class B + { + public B() + { + BP2 = new HashSet(); + } + public int BP1 { get; set; } + public virtual ICollection BP2 { get; set; } + } + + public class AEntity + { + public int AP1 { get; set; } + public string AP2 { get; set; } + public virtual BEntity B { get; set; } + } + public class BEntity + { + public BEntity() + { + BP2 = new HashSet(); + } + public int BP1 { get; set; } + public virtual ICollection BP2 { get; set; } + } + + public class C + { + public C Value { get; set; } + } + + public class When_mapping_circular_references : AutoMapperSpecBase + { + private IQueryable _bei; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().MaxDepth(3); + cfg.CreateMap().MaxDepth(3); + }); + + protected override void Because_of() + { + var be = new BEntity(); + be.BP1 = 3; + be.BP2.Add(new AEntity() { AP1 = 1, AP2 = "hello", B = be }); + be.BP2.Add(new AEntity() { AP1 = 2, AP2 = "two", B = be }); + + var belist = new List(); + belist.Add(be); + _bei = belist.AsQueryable(); + } + + [Fact] + public void Should_not_throw_exception() + { + typeof(Exception).ShouldNotBeThrownBy(() => _bei.ProjectTo(Configuration)); + } + } + } + } +} diff --git a/src/UnitTests/ExpressionConversion.cs b/src/UnitTests/ExpressionConversion.cs deleted file mode 100644 index afce09e022..0000000000 --- a/src/UnitTests/ExpressionConversion.cs +++ /dev/null @@ -1,118 +0,0 @@ - -namespace AutoMapper.UnitTests -{ - using System; - using System.Linq; - using System.Linq.Expressions; - using Should; - using Should.Core.Assertions; - using Xunit; - - public class ExpressionConversion - { - public class Source - { - public int Value { get; set; } - public int Foo { get; set; } - public ChildSrc Child { get; set; } - } - - public class ChildSrc - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - public int Bar { get; set; } - public int ChildValue { get; set; } - } - - [Fact] - public void Can_map_single_properties() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - Expression> expr = d => d.Value == 10; - - var mapped = config.CreateMapper().Map>, Expression>>(expr); - - var items = new[] - { - new Source {Value = 10}, - new Source {Value = 10}, - new Source {Value = 15} - }; - - items.AsQueryable().Where(mapped).Count().ShouldEqual(2); - } - - [Fact] - public void Can_map_flattened_properties() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - Expression> expr = d => d.ChildValue == 10; - - var mapped = config.CreateMapper().Map>, Expression>>(expr); - - var items = new[] - { - new Source {Child = new ChildSrc {Value = 10}}, - new Source {Child = new ChildSrc {Value = 10}}, - new Source {Child = new ChildSrc {Value = 15}} - }; - - items.AsQueryable().Where(mapped).Count().ShouldEqual(2); - } - - [Fact] - public void Can_map_custom_mapped_properties() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap().ForMember(d => d.Bar, opt => opt.MapFrom(src => src.Foo))); - - Expression> expr = d => d.Bar == 10; - - var mapped = config.CreateMapper().Map>, Expression>>(expr); - - var items = new[] - { - new Source {Foo = 10}, - new Source {Foo = 10}, - new Source {Foo = 15} - }; - - items.AsQueryable().Where(mapped).Count().ShouldEqual(2); - } - - [Fact] - public void Throw_AutoMapperMappingException_if_expression_types_dont_match() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - Expression> expr = d => d.Bar == 10; - - Assert.Throws(() => config.CreateMapper().Map>, Expression>>(expr)); - } - - [Fact] - public void Can_map_with_different_destination_types() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap().ForMember(d => d.Bar, opt => opt.MapFrom(src => src.Foo))); - - Expression> expr = d => d; - - var mapped = config.CreateMapper().Map>, Expression>>(expr); - - var items = new[] - { - new Source {Foo = 10}, - new Source {Foo = 10}, - new Source {Foo = 15} - }; - - var items2 = items.AsQueryable().Select(mapped).ToList(); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/ExtensionMethods.cs b/src/UnitTests/ExtensionMethods.cs index 7af7934a6f..6891692349 100644 --- a/src/UnitTests/ExtensionMethods.cs +++ b/src/UnitTests/ExtensionMethods.cs @@ -1,141 +1,176 @@ -using System; -using Xunit; -using Should; -using System.Reflection; - -namespace AutoMapper.UnitTests -{ - namespace ExtensionMethods - { - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public static class When_extension_method_returns_value_type_SourceExtensions - { - public static string GetValue2(this When_extension_method_returns_value_type.Source source) { return "hello from extension"; } - } - - public class When_extension_method_returns_value_type : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value1 { get; set; } - } - - public struct Destination - { - public int Value1 { get; set; } - public string Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.IncludeSourceExtensionMethods(typeof(When_extension_method_returns_value_type_SourceExtensions)); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Value1 = 3 }); - } - - [Fact] - public void Should_use_extension_method() - { - _destination.Value2.ShouldEqual("hello from extension"); - } - - [Fact] - public void Should_still_map_value_type() - { - _destination.Value1.ShouldEqual(3); - } - } - - public static class When_extension_method_returns_object_SourceExtensions - { - public static When_extension_method_returns_object.Nested GetInsideThing(this When_extension_method_returns_object.Source source) - { - return new When_extension_method_returns_object.Nested { Property = source.Value1 + 10 }; - } - } - - public class When_extension_method_returns_object : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value1 { get; set; } - } - - public struct Destination - { - public int Value1 { get; set; } - public int InsideThingProperty { get; set; } - } - - public class Nested - { - public int Property { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.IncludeSourceExtensionMethods(typeof(When_extension_method_returns_object_SourceExtensions)); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Value1 = 7 }); - } - - [Fact] - public void Should_flatten_using_extension_method() - { - _destination.InsideThingProperty.ShouldEqual(17); - } - - [Fact] - public void Should_still_map_value_type() - { - _destination.Value1.ShouldEqual(7); - } - } - - public class When_extension_contains_LINQ_methods : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public IEnumerable Values { get; set; } - } - - public class Destination - { - public int ValuesCount { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Values = Enumerable.Repeat(1, 10)}); - } - - [Fact] - public void Should_resolve_LINQ_method_automatically() - { - _destination.ValuesCount.ShouldEqual(10); - } - } - } -} +using Xunit; +using Shouldly; +using System.Collections.Generic; +using System.Linq; +using System; + +namespace AutoMapper.UnitTests +{ + public static class BarExtensions + { + public static string GetSimpleName(this When_null_is_passed_to_an_extension_method.Bar source) + { + if(source == null) + throw new ArgumentNullException("source"); + return "SimpleName"; + } + } + + public class When_null_is_passed_to_an_extension_method : AutoMapperSpecBase + { + public class Foo + { + public Bar Bar { get; set; } + } + + public class Bar + { + public string Name { get; set; } + } + + public class FooDto + { + public string BarSimpleName { get; set; } + public Guid Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.IncludeSourceExtensionMethods(typeof(BarExtensions)); + cfg.CreateMap().ForMember(d=>d.Value, o=>o.MapFrom(s=>Guid.NewGuid())); + }); + + [Fact] + public void Should_work() + { + Mapper.Map(new Foo()).BarSimpleName.ShouldBeNull(); + } + } + + public static class When_extension_method_returns_value_type_SourceExtensions + { + public static string GetValue2(this When_extension_method_returns_value_type.Source source) { return "hello from extension"; } + } + + public class When_extension_method_returns_value_type : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value1 { get; set; } + } + + public struct Destination + { + public int Value1 { get; set; } + public string Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.IncludeSourceExtensionMethods(typeof(When_extension_method_returns_value_type_SourceExtensions)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Value1 = 3 }); + } + + [Fact] + public void Should_use_extension_method() + { + _destination.Value2.ShouldBe("hello from extension"); + } + + [Fact] + public void Should_still_map_value_type() + { + _destination.Value1.ShouldBe(3); + } + } + + public static class When_extension_method_returns_object_SourceExtensions + { + public static When_extension_method_returns_object.Nested GetInsideThing(this When_extension_method_returns_object.Source source) + { + return new When_extension_method_returns_object.Nested { Property = source.Value1 + 10 }; + } + } + + public class When_extension_method_returns_object : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value1 { get; set; } + } + + public struct Destination + { + public int Value1 { get; set; } + public int InsideThingProperty { get; set; } + } + + public class Nested + { + public int Property { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.IncludeSourceExtensionMethods(typeof(When_extension_method_returns_object_SourceExtensions)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Value1 = 7 }); + } + + [Fact] + public void Should_flatten_using_extension_method() + { + _destination.InsideThingProperty.ShouldBe(17); + } + + [Fact] + public void Should_still_map_value_type() + { + _destination.Value1.ShouldBe(7); + } + } + + public class When_extension_contains_LINQ_methods : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public IEnumerable Values { get; set; } + } + + public class Destination + { + public int ValuesCount { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = Enumerable.Repeat(1, 10) }); + } + + [Fact] + public void Should_resolve_LINQ_method_automatically() + { + _destination.ValuesCount.ShouldBe(10); + } + } +} diff --git a/src/UnitTests/FillingExistingDestination.cs b/src/UnitTests/FillingExistingDestination.cs index 0ecc15f8a2..1332642a6b 100644 --- a/src/UnitTests/FillingExistingDestination.cs +++ b/src/UnitTests/FillingExistingDestination.cs @@ -1,156 +1,247 @@ -using System.Collections.Generic; -using Should; -using Xunit; -using System.Linq; - -namespace AutoMapper.UnitTests -{ - namespace FillingExistingDestination - { - - public class When_the_destination_object_is_specified : AutoMapperSpecBase - { - private Source _source; - private Destination _originalDest; - private Destination _dest; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - _source = new Source - { - Value = 10, - }; - _originalDest = new Destination { Value = 1111 }; - _dest = Mapper.Map(_source, _originalDest); - } - - [Fact] - public void Should_do_the_translation() - { - _dest.Value.ShouldEqual(10); - } - - [Fact] - public void Should_return_the_destination_object_that_was_passed_in() - { - _originalDest.ShouldBeSameAs(_dest); - } - } - - public class When_the_destination_object_is_specified_with_child_objects : AutoMapperSpecBase - { - private Source _source; - private Destination _originalDest; - private Destination _dest; - - public class Source - { - public int Value { get; set; } - public ChildSource Child { get; set; } - } - - public class Destination - { - public int Value { get; set; } - public string Name { get; set; } - public ChildDestination Child { get; set; } - } - - public class ChildSource - { - public int Value { get; set; } - } - - public class ChildDestination - { - public int Value { get; set; } - public string Name { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(MemberList.Source); - cfg.CreateMap(MemberList.Source); - }); - - protected override void Because_of() - { - _source = new Source - { - Value = 10, - Child = new ChildSource - { - Value = 20 - } - }; - _originalDest = new Destination - { - Value = 1111, - Name = "foo", - Child = new ChildDestination - { - Name = "bar" - } - }; - _dest = Mapper.Map(_source, _originalDest); - } - - [Fact] - public void Should_do_the_translation() - { - _dest.Value.ShouldEqual(10); - _dest.Child.Value.ShouldEqual(20); - } - - [Fact] - public void Should_return_the_destination_object_that_was_passed_in() - { - _dest.Name.ShouldEqual("foo"); - _dest.Child.Name.ShouldEqual("bar"); - } - } - - - public class When_the_destination_object_is_specified_and_you_are_converting_an_enum : NonValidatingSpecBase - { - private string _result; - - public enum SomeEnum - { - One, - Two, - Three - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); - - - protected override void Because_of() - { - _result = Mapper.Map(SomeEnum.Two, "test"); - } - - [Fact] - public void Should_return_the_enum_as_a_string() - { - _result.ShouldEqual("Two"); - } - } - } +using System.Collections.Generic; +using Shouldly; +using Xunit; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + public class When_a_source_child_object_is_null : AutoMapperSpecBase + { + public class Source + { + public Child Child { get; set; } + } + + public class Destination + { + public Child Child { get; set; } = new Child(); + } + + public class Child + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.Child, o => o.MapAtRuntime()); + }); + + [Fact] + public void Should_overwrite_the_existing_child_destination() + { + var destination = new Destination(); + Mapper.Map(new Source(), destination); + destination.Child.ShouldBeNull(); + } + } + + public class When_the_destination_object_is_specified : AutoMapperSpecBase + { + private Source _source; + private Destination _originalDest; + private Destination _dest; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + _source = new Source + { + Value = 10, + }; + _originalDest = new Destination { Value = 1111 }; + _dest = Mapper.Map(_source, _originalDest); + } + + [Fact] + public void Should_do_the_translation() + { + _dest.Value.ShouldBe(10); + } + + [Fact] + public void Should_return_the_destination_object_that_was_passed_in() + { + _originalDest.ShouldBeSameAs(_dest); + } + } + + public class When_the_destination_object_is_specified_with_child_objects : AutoMapperSpecBase + { + private Source _source; + private Destination _originalDest; + private Destination _dest; + + public class Source + { + public int Value { get; set; } + public ChildSource Child { get; set; } + } + + public class Destination + { + public int Value { get; set; } + public string Name { get; set; } + public ChildDestination Child { get; set; } + } + + public class ChildSource + { + public int Value { get; set; } + } + + public class ChildDestination + { + public int Value { get; set; } + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source) + .ForMember(d => d.Child, opt => opt.UseDestinationValue()); + cfg.CreateMap(MemberList.Source) + .ForMember(d => d.Name, opt => opt.UseDestinationValue()); + }); + + protected override void Because_of() + { + _source = new Source + { + Value = 10, + Child = new ChildSource + { + Value = 20 + } + }; + _originalDest = new Destination + { + Value = 1111, + Name = "foo", + Child = new ChildDestination + { + Name = "bar" + } + }; + _dest = Mapper.Map(_source, _originalDest); + } + + [Fact] + public void Should_do_the_translation() + { + _dest.Value.ShouldBe(10); + _dest.Child.Value.ShouldBe(20); + } + + [Fact] + public void Should_return_the_destination_object_that_was_passed_in() + { + _dest.Name.ShouldBe("foo"); + _dest.Child.Name.ShouldBe("bar"); + } + } + + public class When_the_destination_object_has_child_objects : AutoMapperSpecBase + { + private Source _source; + private Destination _originalDest; + private ChildDestination _originalDestChild; + private Destination _dest; + + public class Source + { + public ChildSource Child { get; set; } + } + + public class Destination + { + public ChildDestination Child { get; set; } + } + + public class ChildSource + { + public int Value { get; set; } + } + + public class ChildDestination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _source = new Source + { + Child = new ChildSource + { + Value = 20 + } + }; + _originalDestChild = new ChildDestination + { + Value = 10 + }; + _originalDest = new Destination + { + Child = _originalDestChild + }; + _dest = Mapper.Map(_source, _originalDest); + } + + [Fact] + public void Should_return_the_destination_object_that_was_passed_in() + { + _dest.ShouldBeSameAs(_originalDest); + _dest.Child.ShouldBeSameAs(_originalDestChild); + _dest.Child.Value.ShouldBe(20); + } + } + + + public class When_the_destination_object_is_specified_and_you_are_converting_an_enum : NonValidatingSpecBase + { + private string _result; + + public enum SomeEnum + { + One, + Two, + Three + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + + protected override void Because_of() + { + _result = Mapper.Map(SomeEnum.Two, "test"); + } + + [Fact] + public void Should_return_the_enum_as_a_string() + { + _result.ShouldBe("Two"); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Bug/ForAllMaps.cs b/src/UnitTests/ForAllMaps.cs similarity index 83% rename from src/UnitTests/Bug/ForAllMaps.cs rename to src/UnitTests/ForAllMaps.cs index 62845c51a3..e31ee43b5e 100644 --- a/src/UnitTests/Bug/ForAllMaps.cs +++ b/src/UnitTests/ForAllMaps.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System; namespace AutoMapper.UnitTests.Bug @@ -37,9 +37,9 @@ class Destination2 public int Number { get; set; } } - public class MinusOneResolver : IValueResolver + public class MinusOneResolver : IValueResolver { - public object Resolve(object source, ResolutionContext context) + public object Resolve(object source, object dest, object destMember, ResolutionContext context) { return -1; } @@ -50,7 +50,7 @@ public object Resolve(object source, ResolutionContext context) cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); - cfg.ForAllMaps((tm, map) => map.ForMember("Number", o => o.ResolveUsing())); + cfg.ForAllMaps((tm, map) => map.ForMember("Number", o => o.MapFrom())); }); protected override void Because_of() @@ -63,9 +63,9 @@ protected override void Because_of() [Fact] public void Should_configure_all_maps() { - _destination.Number.ShouldEqual(-1); - _destination1.Number.ShouldEqual(-1); - _destination2.Number.ShouldEqual(-1); + _destination.Number.ShouldBe(-1); + _destination1.Number.ShouldBe(-1); + _destination2.Number.ShouldBe(-1); } } } \ No newline at end of file diff --git a/src/UnitTests/ForAllMembers.cs b/src/UnitTests/ForAllMembers.cs new file mode 100644 index 0000000000..5ca7f21d3c --- /dev/null +++ b/src/UnitTests/ForAllMembers.cs @@ -0,0 +1,54 @@ +namespace AutoMapper.UnitTests +{ + namespace ForAllMembers + { + using System; + using Shouldly; + using Xunit; + + public class When_conditionally_applying_a_resolver_globally : AutoMapperSpecBase + { + public class Source + { + public DateTime SomeDate { get; set; } + public DateTime OtherDate { get; set; } + } + + public class Dest + { + public DateTime SomeDate { get; set; } + public DateTime OtherDate { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ForAllPropertyMaps(pm => pm.DestinationName.StartsWith("Other"), + (pm, opt) => opt.MapFrom(typeof(ConditionalValueResolver), pm.SourceMember.Name)); + + cfg.CreateMap(); + }); + + public class ConditionalValueResolver : IMemberValueResolver + { + public DateTime Resolve(object s, object d, DateTime source, DateTime destination, ResolutionContext context) + { + return source.AddDays(1); + } + } + + [Fact] + public void Should_use_resolver() + { + var source = new Source + { + SomeDate = new DateTime(2000, 1, 1), + OtherDate = new DateTime(2000, 1, 1), + }; + var dest = Mapper.Map(source); + + dest.SomeDate.ShouldBe(source.SomeDate); + dest.OtherDate.ShouldBe(source.OtherDate.AddDays(1)); + } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/ForAllOtherMembers.cs b/src/UnitTests/ForAllOtherMembers.cs index 997203565d..82c2321952 100644 --- a/src/UnitTests/ForAllOtherMembers.cs +++ b/src/UnitTests/ForAllOtherMembers.cs @@ -1,4 +1,4 @@ -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests @@ -32,7 +32,58 @@ protected override void Because_of() [Fact] public void Should_map_not_ignored() { - _destination.value.ShouldEqual(12); + _destination.value.ShouldBe(12); } } -} + + public class ForAllOtherMembersWithInherintance : AutoMapperSpecBase + { + public interface Interface1 + { + string Name { get; } + } + public interface Interface2 : Interface1 + { + new string Name { get; set; } + } + public interface Interface3 : Interface1, Interface2 + { + string Code { get; set; } + } + class SourceClass + { + public string Name { get; set; } + public string Code { get; set; } + } + class TargetClass : Interface3 + { + public string Name { get; set; } + public string Code { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap(MemberList.None) + .ForMember(trg => trg.Name, opt => opt.MapFrom(src => src.Name)) + .ForAllOtherMembers(opt => opt.Ignore()); + }); + + [Fact] + public void Should_work() + { + var source = new SourceClass() + { + Name = "SourceName", + Code = "SourceCode" + }; + Interface3 dest = new TargetClass() + { + Name = "TargetName", + Code = "TargetCode" + }; + Mapper.Map(source, dest); + dest.Code.ShouldBe("TargetCode"); + dest.Name.ShouldBe("SourceName"); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/ForPath.cs b/src/UnitTests/ForPath.cs new file mode 100644 index 0000000000..22ec947446 --- /dev/null +++ b/src/UnitTests/ForPath.cs @@ -0,0 +1,412 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class InheritForPath : AutoMapperSpecBase + { + public class RootModel + { + public int ID { get; set; } + public string Title { get; set; } + public NestedModel Nested { get; set; } + } + + public class NestedModel + { + public int NestedID { get; set; } + public string NestedTitle { get; set; } + public string NestedTitle2 { get; set; } + } + + public class DerivedModel : RootModel + { + public string DescendantField { get; set; } + } + // destination types + public class DataModel + { + public int ID { get; set; } + public string Title { get; set; } + + public int OtherID { get; set; } + public string Title2 { get; set; } + } + + public class DerivedDataModel : DataModel + { + public string DescendantField { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap() + .ForMember(dest => dest.OtherID, opt => opt.MapFrom(src => src.Nested.NestedID)) + .ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Nested.NestedTitle)) + .ForMember(dest => dest.Title2, opt => opt.MapFrom(src => src.Nested.NestedTitle2)) + .ReverseMap() + .ForPath(d=>d.Nested.NestedTitle2, o=>o.Ignore()); + + cfg.CreateMap() + .IncludeBase().ReverseMap() + .ForPath(d=>d.Nested.NestedTitle, o=>o.Ignore()) + .ForPath(d => d.Nested.NestedTitle2, opt => opt.MapFrom(src => src.Title2)); + }); + + [Fact] + public void Should_work() + { + var source = new DerivedDataModel() { OtherID = 2, Title2 = "nested test", ID = 1, Title = "test", DescendantField = "descendant field" }; + var destination = Mapper.Map(source); + destination.Nested.NestedID.ShouldBe(2); + destination.Nested.NestedTitle.ShouldBeNull(); + destination.Nested.NestedTitle2.ShouldBe("nested test"); + } + } + + public class ForPath : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(o=>o.CustomerHolder.Customer.Name, o=>o.MapFrom(s=>s.CustomerName)) + .ForPath(o => o.CustomerHolder.Customer.Total, o => o.MapFrom(s => s.Total)); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerName = "George Costanza", Total = 74.85m }; + var model = Mapper.Map(dto); + model.CustomerHolder.Customer.Name.ShouldBe("George Costanza"); + model.CustomerHolder.Customer.Total.ShouldBe(74.85m); + } + } + + public class ForPathWithoutSettersForSubObjects : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(o => o.CustomerHolder.Customer.Name, o => o.MapFrom(s => s.CustomerName)) + .ForPath(o => o.CustomerHolder.Customer.Total, o => o.MapFrom(s => s.Total)); + }); + + [Fact] + public void Should_unflatten() + { + new Action(() => Mapper.Map(new OrderDto())).ShouldThrowException(ex => + ex.InnerException?.Message.ShouldBe("typeMapDestination.CustomerHolder.Customer cannot be null because it's used by ForPath.")); + } + } + + public class ForPathWithoutSettersShouldBehaveAsForMember : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; set; } + public int Value { get; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; } + public decimal Total { get; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(o=>o.Value, o=>o.MapFrom(src => 9)) + .ForPath(o => o.CustomerHolder.Customer.Name, o => o.MapFrom(s => s.CustomerName)) + .ForPath(o => o.CustomerHolder.Customer.Total, o => o.MapFrom(s => s.Total)); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerName = "George Costanza", Total = 74.85m }; + var model = Mapper.Map(dto); + model.Value.ShouldBe(0); + model.CustomerHolder.Customer.Name.ShouldBeNull(); + model.CustomerHolder.Customer.Total.ShouldBe(0m); + } + } + + public class ForPathWithIgnoreShouldNotSetValue : AutoMapperSpecBase + { + public partial class TimesheetModel + { + public int ID { get; set; } + public DateTime? StartDate { get; set; } + public int? Contact { get; set; } + public ContactModel ContactNavigation { get; set; } + } + + public class TimesheetViewModel + { + public int? Contact { get; set; } + public DateTime? StartDate { get; set; } + } + + public class ContactModel + { + public int Id { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Contact, o => o.MapFrom(s => s.ContactNavigation.Id)) + .ReverseMap() + .ForPath(s => s.ContactNavigation.Id, opt => opt.Ignore()); + }); + + [Fact] + public void Should_not_set_value() + { + var source = new TimesheetModel + { + Contact = 6, + ContactNavigation = new ContactModel + { + Id = 5 + } + }; + var dest = new TimesheetViewModel + { + Contact = 10 + }; + Mapper.Map(dest, source); + + source.ContactNavigation.Id.ShouldBe(5); + } + } + + public class ForPathWithNullExpressionShouldFail + { + public class DestinationModel + { + public string Name { get; set; } + } + + public class SourceModel + { + public string Name { get; set; } + } + + [Fact] + public void Should_throw_exception() + { + Assert.Throws(() => + { + var cfg = new MapperConfiguration(config => + { + Assert.Throws(() => + { + config.CreateMap() + .ForPath(sourceModel => sourceModel.Name, opts => opts.MapFrom(null)); + }); + }); + }); + } + } + + public class ForPathWithPrivateSetters : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; private set; } + } + + public class CustomerHolder + { + public Customer Customer { get; private set; } + } + + public class Customer + { + public string Name { get; private set; } + public decimal Total { get; private set; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(o => o.CustomerHolder.Customer.Name, o => o.MapFrom(s => s.CustomerName)) + .ForPath(o => o.CustomerHolder.Customer.Total, o => o.MapFrom(s => s.Total)); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerName = "George Costanza", Total = 74.85m }; + var model = Mapper.Map(dto); + model.CustomerHolder.Customer.Name.ShouldBe("George Costanza"); + model.CustomerHolder.Customer.Total.ShouldBe(74.85m); + } + } + + public class ForPathWithValueTypesAndFields : AutoMapperSpecBase + { + public struct Order + { + public CustomerHolder CustomerHolder; + } + + public struct CustomerHolder + { + public Customer Customer; + } + + public struct Customer + { + public string Name; + public decimal Total; + } + + public struct OrderDto + { + public string CustomerName; + public decimal Total; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(o => o.CustomerHolder.Customer.Name, o => o.MapFrom(s => s.CustomerName)) + .ForPath(o => o.CustomerHolder.Customer.Total, o => o.MapFrom(s => s.Total)); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerName = "George Costanza", Total = 74.85m }; + var model = Mapper.Map(dto); + model.CustomerHolder.Customer.Name.ShouldBe("George Costanza"); + model.CustomerHolder.Customer.Total.ShouldBe(74.85m); + } + } + + public class ForPathWithConditions : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + public int Value { get; set; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(o => o.CustomerHolder.Customer.Name, o => + { + o.Condition(c => !c.SourceMember.StartsWith("George")); + o.MapFrom(s => s.CustomerName); + }) + .ForPath(o => o.CustomerHolder.Customer.Total, o => + { + o.Condition(c => c.Source.Total < 50); + o.MapFrom(s => s.Total); + }) + .ForPath(o => o.CustomerHolder.Customer.Value, o => + { + o.Condition(c => c.Destination.CustomerHolder.Customer.Value == 0); + o.MapFrom(s => s.Value); + }); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerName = "George Costanza", Total = 74.85m, Value = 100 }; + var model = Mapper.Map(dto); + model.CustomerHolder.Customer.Name.ShouldBeNull(); + model.CustomerHolder.Customer.Total.ShouldBe(0); + model.CustomerHolder.Customer.Value.ShouldBe(100); + } + } +} diff --git a/src/UnitTests/General.cs b/src/UnitTests/General.cs index f1d19fab9f..5b36bea796 100644 --- a/src/UnitTests/General.cs +++ b/src/UnitTests/General.cs @@ -1,451 +1,451 @@ -using System; -using System.Collections.Generic; -using Should; -using Xunit; -using System.Linq; - -namespace AutoMapper.UnitTests -{ - namespace General - { - public class When_mapping_dto_with_a_missing_match : NonValidatingSpecBase - { - public class ModelObject - { - } - - public class ModelDto - { - public string SomePropertyThatDoesNotExistOnModel { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_map_successfully() - { - ModelDto dto = Mapper.Map(new ModelObject()); - - dto.ShouldNotBeNull(); - } - } - - public class When_mapping_a_null_model : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelDto - { - } - - public class ModelObject - { - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = false; - cfg.CreateMap(); - - }); - - [Fact] - public void Should_always_provide_a_dto() - { - _result = Mapper.Map(null); - _result.ShouldNotBeNull(); - } - } - - public class When_mapping_a_dto_with_a_private_parameterless_constructor : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public string SomeValue { get; set; } - } - - public class ModelDto - { - public string SomeValue { get; set; } - - private ModelDto() - { - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelObject - { - SomeValue = "Some value" - }; - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_the_dto_value() - { - _result.SomeValue.ShouldEqual("Some value"); - } - } - - public class When_mapping_to_a_dto_string_property_and_the_dto_type_is_not_a_string : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public int NotAString { get; set; } - } - - public class ModelDto - { - public string NotAString { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var model = new ModelObject - { - NotAString = 5 - }; - _result = Mapper.Map(model); - } - - [Fact] - public void Should_use_the_ToString_value_of_the_unmatched_type() - { - _result.NotAString.ShouldEqual("5"); - } - } - - public class When_mapping_dto_with_an_array_property : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public IEnumerable GetSomeCoolValues() - { - return new[] { 4, 5, 6 }; - } - } - - public class ModelDto - { - public string[] SomeCoolValues { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var model = new ModelObject(); - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_the_collection_of_items_in_the_input_to_the_array() - { - _result.SomeCoolValues[0].ShouldEqual("4"); - _result.SomeCoolValues[1].ShouldEqual("5"); - _result.SomeCoolValues[2].ShouldEqual("6"); - } - } - - public class When_mapping_a_dto_with_mismatched_property_types : NonValidatingSpecBase - { - public class ModelObject - { - public string NullableDate { get; set; } - } - - public class ModelDto - { - public DateTime NullableDate { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_throw_a_mapping_exception() - { - var model = new ModelObject(); - model.NullableDate = "Lorem Ipsum"; - - typeof(AutoMapperMappingException).ShouldBeThrownBy(() => Mapper.Map(model)); - } - } - - public class When_mapping_an_array_of_model_objects : AutoMapperSpecBase - { - private ModelObject[] _model; - private ModelDto[] _dto; - - public class ModelObject - { - public string SomeValue { get; set; } - } - - public class ModelDto - { - public string SomeValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - _model = new[] {new ModelObject {SomeValue = "First"}, new ModelObject {SomeValue = "Second"}}; - _dto = (ModelDto[]) Mapper.Map(_model, typeof (ModelObject[]), typeof (ModelDto[])); - } - - [Fact] - public void Should_create_an_array_of_ModelDto_objects() - { - _dto.Length.ShouldEqual(2); - } - - [Fact] - public void Should_map_properties() - { - _dto.Any(d => d.SomeValue.Contains("First")).ShouldBeTrue(); - _dto.Any(d => d.SomeValue.Contains("Second")).ShouldBeTrue(); - } - } - - public class When_mapping_a_List_of_model_objects : AutoMapperSpecBase - { - private List _model; - private ModelDto[] _dto; - - public class ModelObject - { - public string SomeValue { get; set; } - } - - public class ModelDto - { - public string SomeValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - _model = new List {new ModelObject {SomeValue = "First"}, new ModelObject {SomeValue = "Second"}}; - _dto = (ModelDto[]) Mapper.Map(_model, typeof (List), typeof (ModelDto[])); - } - - [Fact] - public void Should_create_an_array_of_ModelDto_objects() - { - _dto.Length.ShouldEqual(2); - } - - [Fact] - public void Should_map_properties() - { - _dto.Any(d => d.SomeValue.Contains("First")).ShouldBeTrue(); - _dto.Any(d => d.SomeValue.Contains("Second")).ShouldBeTrue(); - } - } - - public class When_mapping_a_nullable_type_to_non_nullable_type : AutoMapperSpecBase - { - private ModelObject _model; - private ModelDto _dto; - - public class ModelObject - { - public int? SomeValue { get; set; } - public int? SomeNullableValue { get; set; } - } - - public class ModelDto - { - public int SomeValue { get; set; } - public int SomeNullableValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _model = new ModelObject { SomeValue = 2 }; - _dto = Mapper.Map(_model); - } - - [Fact] - public void Should_map_value_if_has_value() - { - _dto.SomeValue.ShouldEqual(2); - } - - [Fact] - public void Should_not_set_value_if_null() - { - _dto.SomeNullableValue.ShouldEqual(0); - } - } - - public class When_mapping_a_non_nullable_type_to_a_nullable_type : AutoMapperSpecBase - { - private ModelObject _model; - private ModelDto _dto; - - public class ModelObject - { - public int SomeValue { get; set; } - public int SomeOtherValue { get; set; } - } - - public class ModelDto - { - public int? SomeValue { get; set; } - public int? SomeOtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - _model = new ModelObject {SomeValue = 2}; - _dto = Mapper.Map(_model); - } - - [Fact] - public void Should_map_value_if_has_value() - { - _dto.SomeValue.ShouldEqual(2); - } - - [Fact] - public void Should_not_set_value_if_null() - { - _dto.SomeOtherValue.ShouldEqual(0); - } - - } - - public class When_mapping_a_nullable_type_to_a_nullable_type : AutoMapperSpecBase - { - private ModelObject _model; - private ModelDto _dto; - - public class ModelObject - { - public int? SomeValue { get; set; } - public int? SomeOtherValue { get; set; } - } - - public class ModelDto - { - public int? SomeValue { get; set; } - public int? SomeOtherValue2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.SomeOtherValue2, opt => opt.MapFrom(src => src.SomeOtherValue)); - - }); - - protected override void Because_of() - { - _model = new ModelObject(); - _dto = Mapper.Map(_model); - } - - [Fact] - public void Should_map_value_if_has_value() - { - _dto.SomeValue.ShouldBeNull(); - } - - [Fact] - public void Should_not_set_value_if_null() - { - _dto.SomeOtherValue2.ShouldBeNull(); - } - - } - - public class When_mapping_tuples : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public Tuple Value { get; set; } - } - public class Dest - { - public Tuple Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var source = new Source - { - Value = new Tuple(10, 11) - }; - _dest = Mapper.Map(source); - } - - [Fact] - public void Should_map_tuple() - { - _dest.Value.ShouldNotBeNull(); - _dest.Value.Item1.ShouldEqual(10); - _dest.Value.Item2.ShouldEqual(11); - } - } - } -} +using System; +using System.Collections.Generic; +using Shouldly; +using Xunit; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + namespace General + { + public class When_mapping_dto_with_a_missing_match : NonValidatingSpecBase + { + public class ModelObject + { + } + + public class ModelDto + { + public string SomePropertyThatDoesNotExistOnModel { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_successfully() + { + ModelDto dto = Mapper.Map(new ModelObject()); + + dto.ShouldNotBeNull(); + } + } + + public class When_mapping_a_null_model : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelDto + { + } + + public class ModelObject + { + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap(); + + }); + + [Fact] + public void Should_always_provide_a_dto() + { + _result = Mapper.Map(null); + _result.ShouldNotBeNull(); + } + } + + public class When_mapping_a_dto_with_a_private_parameterless_constructor : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public string SomeValue { get; set; } + } + + public class ModelDto + { + public string SomeValue { get; set; } + + private ModelDto() + { + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject + { + SomeValue = "Some value" + }; + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_the_dto_value() + { + _result.SomeValue.ShouldBe("Some value"); + } + } + + public class When_mapping_to_a_dto_string_property_and_the_dto_type_is_not_a_string : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public int NotAString { get; set; } + } + + public class ModelDto + { + public string NotAString { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var model = new ModelObject + { + NotAString = 5 + }; + _result = Mapper.Map(model); + } + + [Fact] + public void Should_use_the_ToString_value_of_the_unmatched_type() + { + _result.NotAString.ShouldBe("5"); + } + } + + public class When_mapping_dto_with_an_array_property : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public IEnumerable GetSomeCoolValues() + { + return new[] { 4, 5, 6 }; + } + } + + public class ModelDto + { + public string[] SomeCoolValues { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var model = new ModelObject(); + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_the_collection_of_items_in_the_input_to_the_array() + { + _result.SomeCoolValues[0].ShouldBe("4"); + _result.SomeCoolValues[1].ShouldBe("5"); + _result.SomeCoolValues[2].ShouldBe("6"); + } + } + + public class When_mapping_a_dto_with_mismatched_property_types : NonValidatingSpecBase + { + public class ModelObject + { + public string NullableDate { get; set; } + } + + public class ModelDto + { + public DateTime NullableDate { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_throw_a_mapping_exception() + { + var model = new ModelObject(); + model.NullableDate = "Lorem Ipsum"; + + typeof(AutoMapperMappingException).ShouldBeThrownBy(() => Mapper.Map(model)); + } + } + + public class When_mapping_an_array_of_model_objects : AutoMapperSpecBase + { + private ModelObject[] _model; + private ModelDto[] _dto; + + public class ModelObject + { + public string SomeValue { get; set; } + } + + public class ModelDto + { + public string SomeValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + _model = new[] {new ModelObject {SomeValue = "First"}, new ModelObject {SomeValue = "Second"}}; + _dto = (ModelDto[]) Mapper.Map(_model, typeof (ModelObject[]), typeof (ModelDto[])); + } + + [Fact] + public void Should_create_an_array_of_ModelDto_objects() + { + _dto.Length.ShouldBe(2); + } + + [Fact] + public void Should_map_properties() + { + _dto.Any(d => d.SomeValue.Contains("First")).ShouldBeTrue(); + _dto.Any(d => d.SomeValue.Contains("Second")).ShouldBeTrue(); + } + } + + public class When_mapping_a_List_of_model_objects : AutoMapperSpecBase + { + private List _model; + private ModelDto[] _dto; + + public class ModelObject + { + public string SomeValue { get; set; } + } + + public class ModelDto + { + public string SomeValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + _model = new List {new ModelObject {SomeValue = "First"}, new ModelObject {SomeValue = "Second"}}; + _dto = (ModelDto[]) Mapper.Map(_model, typeof (List), typeof (ModelDto[])); + } + + [Fact] + public void Should_create_an_array_of_ModelDto_objects() + { + _dto.Length.ShouldBe(2); + } + + [Fact] + public void Should_map_properties() + { + _dto.Any(d => d.SomeValue.Contains("First")).ShouldBeTrue(); + _dto.Any(d => d.SomeValue.Contains("Second")).ShouldBeTrue(); + } + } + + public class When_mapping_a_nullable_type_to_non_nullable_type : AutoMapperSpecBase + { + private ModelObject _model; + private ModelDto _dto; + + public class ModelObject + { + public int? SomeValue { get; set; } + public int? SomeNullableValue { get; set; } + } + + public class ModelDto + { + public int SomeValue { get; set; } + public int SomeNullableValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _model = new ModelObject { SomeValue = 2 }; + _dto = Mapper.Map(_model); + } + + [Fact] + public void Should_map_value_if_has_value() + { + _dto.SomeValue.ShouldBe(2); + } + + [Fact] + public void Should_not_set_value_if_null() + { + _dto.SomeNullableValue.ShouldBe(0); + } + } + + public class When_mapping_a_non_nullable_type_to_a_nullable_type : AutoMapperSpecBase + { + private ModelObject _model; + private ModelDto _dto; + + public class ModelObject + { + public int SomeValue { get; set; } + public int SomeOtherValue { get; set; } + } + + public class ModelDto + { + public int? SomeValue { get; set; } + public int? SomeOtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + _model = new ModelObject {SomeValue = 2}; + _dto = Mapper.Map(_model); + } + + [Fact] + public void Should_map_value_if_has_value() + { + _dto.SomeValue.ShouldBe(2); + } + + [Fact] + public void Should_not_set_value_if_null() + { + _dto.SomeOtherValue.ShouldBe(0); + } + + } + + public class When_mapping_a_nullable_type_to_a_nullable_type : AutoMapperSpecBase + { + private ModelObject _model; + private ModelDto _dto; + + public class ModelObject + { + public int? SomeValue { get; set; } + public int? SomeOtherValue { get; set; } + } + + public class ModelDto + { + public int? SomeValue { get; set; } + public int? SomeOtherValue2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.SomeOtherValue2, opt => opt.MapFrom(src => src.SomeOtherValue)); + + }); + + protected override void Because_of() + { + _model = new ModelObject(); + _dto = Mapper.Map(_model); + } + + [Fact] + public void Should_map_value_if_has_value() + { + _dto.SomeValue.ShouldBeNull(); + } + + [Fact] + public void Should_not_set_value_if_null() + { + _dto.SomeOtherValue2.ShouldBeNull(); + } + + } + + public class When_mapping_tuples : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public Tuple Value { get; set; } + } + public class Dest + { + public Tuple Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source + { + Value = new Tuple(10, 11) + }; + _dest = Mapper.Map(source); + } + + [Fact] + public void Should_map_tuple() + { + _dest.Value.ShouldNotBeNull(); + _dest.Value.Item1.ShouldBe(10); + _dest.Value.Item2.ShouldBe(11); + } + } + } +} diff --git a/src/UnitTests/IMappingExpression/ForCtorParam.cs b/src/UnitTests/IMappingExpression/ForCtorParam.cs index 05e7e5f868..626b43e311 100644 --- a/src/UnitTests/IMappingExpression/ForCtorParam.cs +++ b/src/UnitTests/IMappingExpression/ForCtorParam.cs @@ -1,7 +1,6 @@ using System; -using System.Linq.Expressions; using Xunit; -using Should; +using Shouldly; namespace AutoMapper.UnitTests { @@ -22,6 +21,11 @@ public Dest(int thing) public int Value1 { get; } } + public class DestWithNoConstructor + { + public int Value1 { get; set; } + } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { cfg.CreateMap(typeof(Source), typeof(Dest)) @@ -33,14 +37,14 @@ public void Should_redirect_value() { var dest = Mapper.Map(new Source { Value = 5 }); - dest.Value1.ShouldEqual(5); + dest.Value1.ShouldBe(5); } [Fact] public void Should_resolve_using_custom_func() { var mapper = new MapperConfiguration( - cfg => cfg.CreateMap().ForCtorParam("thing", opt => opt.ResolveUsing(src => + cfg => cfg.CreateMap().ForCtorParam("thing", opt => opt.MapFrom((src, ctxt) => { var rev = src.Value + 3; return rev; @@ -49,7 +53,72 @@ public void Should_resolve_using_custom_func() var dest = mapper.Map(new Source { Value = 5 }); - dest.Value1.ShouldEqual(8); + dest.Value1.ShouldBe(8); + } + + [Fact] + public void Should_resolve_using_custom_func_with_correct_ResolutionContext() + { + const string itemKey = "key"; + var mapper = new MapperConfiguration( + cfg => cfg.CreateMap().ForCtorParam("thing", opt => + opt.MapFrom((src, ctx) => ctx.Items[itemKey]) + )) + .CreateMapper(); + + var dest = mapper.Map(new Source { Value = 8 }, + opts => opts.Items[itemKey] = 10); + + dest.Value1.ShouldBe(10); + } + + [Fact] + public void Should_throw_on_nonexistent_parameter() + { + Action configuration = () => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForCtorParam("thing", opt => opt.MapFrom(src => src.Value)) + .ForCtorParam("think", opt => opt.MapFrom(src => src.Value)); + }); + configuration.ShouldThrowException(exception => + { + exception.Message.ShouldContain("does not have a constructor with a parameter named 'think'.", Case.Sensitive); + exception.Message.ShouldContain(typeof(Dest).FullName, Case.Sensitive); + }); + } + + [Fact] + public void Should_throw_when_no_constructor_is_present() + { + Action configuration = () => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Value1, opt => opt.MapFrom(src => src.Value)) + .ForCtorParam("thing", opt => opt.MapFrom(src => src.Value)); + }); + + configuration.ShouldThrowException(exception => + { + exception.Message.ShouldContain("does not have a constructor.", Case.Sensitive); + exception.Message.ShouldContain(typeof(Dest).FullName, Case.Sensitive); + }); + } + + [Fact] + public void Should_throw_when_parameter_is_misspelt() + { + Action configuration = () => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForCtorParam("think", opt => opt.MapFrom(src => src.Value)); + }); + + configuration.ShouldThrowException(exception => + { + exception.Message.ShouldContain("does not have a constructor with a parameter named 'think'.", Case.Sensitive); + exception.Message.ShouldContain(typeof(Dest).FullName, Case.Sensitive); + }); } } } \ No newline at end of file diff --git a/src/UnitTests/IMappingExpression/IncludeMembers.cs b/src/UnitTests/IMappingExpression/IncludeMembers.cs new file mode 100644 index 0000000000..f405b946f5 --- /dev/null +++ b/src/UnitTests/IMappingExpression/IncludeMembers.cs @@ -0,0 +1,1153 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.IMappingExpression +{ + public class IncludeMembers : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap().IncludeMembers(s=>s.InnerSource, s=>s.OtherInnerSource); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource{ Description = "description" }, OtherInnerSource = new OtherInnerSource{ Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + + public class IncludeMembersWithMapFromExpression : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description1 { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title1 { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Description, o=>o.MapFrom(s=>s.Description1)); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Title, o=>o.MapFrom(s=>s.Title1)); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description1 = "description" }, OtherInnerSource = new OtherInnerSource { Title1 = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + + public class IncludeMembersWithNullSubstitute : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.NullSubstitute("description")); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Title, o => o.NullSubstitute("title")); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name" }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + + public class IncludeMembersWithMapFromFunc : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description1 { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title1 { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.MapFrom((s, d) => s.Description1)); + cfg.CreateMap(MemberList.None).ForMember(d => d.Title, o => o.MapFrom((s, d) => s.Title1)); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description1 = "description" }, OtherInnerSource = new OtherInnerSource { Title1 = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + + public class IncludeMembersWithResolver : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description1 { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title1 { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.MapFrom()); + cfg.CreateMap(MemberList.None).ForMember(d => d.Title, o => o.MapFrom()); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description1 = "description" }, OtherInnerSource = new OtherInnerSource { Title1 = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + + private class DescriptionResolver : IValueResolver + { + public string Resolve(InnerSource source, Destination destination, string destMember, ResolutionContext context) => source.Description1; + } + + private class TitleResolver : IValueResolver + { + public string Resolve(OtherInnerSource source, Destination destination, string destMember, ResolutionContext context) => source.Title1; + } + } + + public class IncludeMembersWithMemberResolver : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description1 { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title1 { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.MapFrom(s=>s.Description1)); + cfg.CreateMap(MemberList.None).ForMember(d => d.Title, o => o.MapFrom("Title1")); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description1 = "description" }, OtherInnerSource = new OtherInnerSource { Title1 = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + + private class DescriptionResolver : IMemberValueResolver + { + public string Resolve(InnerSource source, Destination destination, string sourceMember, string destMember, ResolutionContext context) => sourceMember; + } + + private class TitleResolver : IMemberValueResolver + { + public string Resolve(OtherInnerSource source, Destination destination, string sourceMember, string destMember, ResolutionContext context) => sourceMember; + } + } + public class IncludeMembersWithValueConverter : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description1 { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title1 { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.ConvertUsing(s => s.Description1)); + cfg.CreateMap(MemberList.None).ForMember(d => d.Title, o => o.ConvertUsing("Title1")); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description1 = "description" }, OtherInnerSource = new OtherInnerSource { Title1 = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + + private class ValueConverter : IValueConverter + { + public string Convert(string sourceMember, ResolutionContext context) => sourceMember; + } + } + + public class IncludeMembersWithConditions : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.Condition((s, d, sm, dm, c) => false)); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.Condition((s, d, sm, dm, c) => true)); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBeNull(); + destination.Title.ShouldBe("title"); + } + } + public class IncludeMembersWithPreConditions : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.PreCondition((s, d, c) => false)); + cfg.CreateMap(MemberList.None).ForMember(d => d.Description, o => o.PreCondition((s, d, c) => true)); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBeNull(); + destination.Title.ShouldBe("title"); + } + } + public class IncludeMembersCycle : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public Source Parent { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + public Source Parent { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + public Destination Parent { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).IncludeMembers(s=>s.Parent); + cfg.CreateMap(MemberList.None).IncludeMembers(s=>s.Parent); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + source.InnerSource.Parent = source; + source.OtherInnerSource.Parent = source; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + destination.Parent.ShouldBe(destination); + } + } + public class IncludeMembersReverseMap : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource).ReverseMap(); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_unflatten() + { + var source = Mapper.Map(new Destination { Description = "description", Name = "name", Title = "title" }); + source.Name.ShouldBe("name"); + source.InnerSource.Name.ShouldBe("name"); + source.OtherInnerSource.Name.ShouldBe("name"); + source.InnerSource.Description.ShouldBe("description"); + source.OtherInnerSource.Description.ShouldBe("description"); + source.OtherInnerSource.Title.ShouldBe("title"); + } + } + public class IncludeMembersReverseMapOverride : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource).ReverseMap() + .ForMember(d=>d.InnerSource, o=>o.Ignore()) + .ForMember(d=>d.OtherInnerSource, o=>o.Ignore()); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_unflatten() + { + var source = Mapper.Map(new Destination { Description = "description", Name = "name", Title = "title" }); + source.Name.ShouldBe("name"); + source.InnerSource.ShouldBeNull(); + source.OtherInnerSource.ShouldBeNull(); + } + } + + public class ReverseMapToIncludeMembers : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.InnerSource, o => o.MapFrom(s => s)) + .ForMember(d => d.OtherInnerSource, o => o.MapFrom(s => s)) + .ReverseMap(); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + public class ReverseMapToIncludeMembersOverride : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.InnerSource, o => o.MapFrom(s => s)) + .ForMember(d => d.OtherInnerSource, o => o.MapFrom(s => s)) + .ReverseMap() + .IncludeMembers(); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBeNull(); + destination.Title.ShouldBeNull(); + } + } + public class IncludeMembersWithAfterMap : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + bool afterMap, beforeMap; + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).AfterMap((s,d)=>afterMap=true); + cfg.CreateMap(MemberList.None).BeforeMap((s, d, c) => beforeMap = true); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + afterMap.ShouldBeTrue(); + beforeMap.ShouldBeTrue(); + } + } + + public class IncludeMembersWithForPath : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public InnerDestination InnerDestination { get; set; } + } + class InnerDestination + { + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForPath(d=>d.InnerDestination.Description, o=> + { + o.MapFrom(s => s.Description); + o.Condition(c => true); + }); + cfg.CreateMap(MemberList.None).ForPath(d=>d.InnerDestination.Title, o=> + { + o.MapFrom(s => s.Title); + o.Condition(c => true); + }); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.InnerDestination.Description.ShouldBe("description"); + destination.InnerDestination.Title.ShouldBe("title"); + } + } + public class IncludeMembersTransformers : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource).AddTransform(s => s + "Main"); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Description, o=>o.AddTransform(s=>s+"Extra")).AddTransform(s => s + "Ex"); + cfg.CreateMap(MemberList.None).ForMember(d => d.Title, o => o.AddTransform(s => s + "Extra")).AddTransform(s => s + "Ex"); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("nameMain"); + destination.Description.ShouldBe("descriptionExtraExMain"); + destination.Title.ShouldBe("titleExtraExMain"); + } + } + public class IncludeMembersTransformersPerMember : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None).ForMember(d=>d.Description, o=>o.AddTransform(s=>s+"Ex")); + cfg.CreateMap(MemberList.None).ForMember(d => d.Title, o => o.AddTransform(s => s + "Ex")); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("descriptionEx"); + destination.Title.ShouldBe("titleEx"); + } + } + public class IncludeMembersInvalidExpression + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + + [Fact] + public void Should_throw() + { + new MapperConfiguration(cfg => + { + Assert.Throws("memberExpressions", () => cfg.CreateMap().IncludeMembers(s => s.InnerSource.ToString(), s => s.OtherInnerSource)); + }); + } + } + + public class IncludeMembersWithGenerics : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source<,>), typeof(Destination), MemberList.None).IncludeMembers("InnerSource", "OtherInnerSource"); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + + public class IncludeMembersWithGenericsInvalidStrings + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + [Fact] + public void Should_throw() + { + new MapperConfiguration(cfg => + { + Assert.Throws(() => cfg.CreateMap(typeof(Source<,>), typeof(Destination), MemberList.None).IncludeMembers("dInnerSource", "fOtherInnerSource")); + }); + } + } + + public class IncludeMembersReverseMapGenerics : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source<,>), typeof(Destination), MemberList.None).IncludeMembers("InnerSource", "OtherInnerSource").ReverseMap(); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_unflatten() + { + var source = Mapper.Map>(new Destination { Description = "description", Name = "name", Title = "title" }); + source.Name.ShouldBe("name"); + source.InnerSource.Name.ShouldBe("name"); + source.OtherInnerSource.Name.ShouldBe("name"); + source.InnerSource.Description.ShouldBe("description"); + source.OtherInnerSource.Description.ShouldBe("description"); + source.OtherInnerSource.Title.ShouldBe("title"); + } + } + public class IncludeMembersReverseMapGenericsOverride : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source<,>), typeof(Destination), MemberList.None).IncludeMembers("InnerSource", "OtherInnerSource").ReverseMap() + .ForMember("InnerSource", o=>o.Ignore()) + .ForMember("OtherInnerSource", o=>o.Ignore()); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_unflatten() + { + var source = Mapper.Map>(new Destination { Description = "description", Name = "name", Title = "title" }); + source.Name.ShouldBe("name"); + source.InnerSource.ShouldBeNull(); + source.OtherInnerSource.ShouldBeNull(); + } + } + public class ReverseMapToIncludeMembersGenerics : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Destination), typeof(Source<,>)) + .ForMember("InnerSource", o => o.MapFrom(s => s)) + .ForMember("OtherInnerSource", o => o.MapFrom(s => s)) + .ReverseMap(); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBe("description"); + destination.Title.ShouldBe("title"); + } + } + public class ReverseMapToIncludeMembersGenericsOverride : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Destination), typeof(Source<,>)) + .ForMember("InnerSource", o => o.MapFrom(s => s)) + .ForMember("OtherInnerSource", o => o.MapFrom(s => s)) + .ReverseMap() + .IncludeMembers(); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + [Fact] + public void Should_flatten() + { + var source = new Source { Name = "name", InnerSource = new InnerSource { Description = "description" }, OtherInnerSource = new OtherInnerSource { Title = "title" } }; + var destination = Mapper.Map(source); + destination.Name.ShouldBe("name"); + destination.Description.ShouldBeNull(); + destination.Title.ShouldBeNull(); + } + } + public class IncludeMembersSourceValidation : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public InnerSource InnerSource { get; set; } + public OtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source).IncludeMembers(s => s.InnerSource, s => s.OtherInnerSource); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + } + public class IncludeMembersWithGenericsSourceValidation : AutoMapperSpecBase + { + class Source + { + public string Name { get; set; } + public TInnerSource InnerSource { get; set; } + public TOtherInnerSource OtherInnerSource { get; set; } + } + class InnerSource + { + public string Name { get; set; } + public string Description { get; set; } + } + class OtherInnerSource + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + class Destination + { + public string Name { get; set; } + public string Description { get; set; } + public string Title { get; set; } + } + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source<,>), typeof(Destination), MemberList.Source).IncludeMembers("InnerSource", "OtherInnerSource"); + cfg.CreateMap(MemberList.None); + cfg.CreateMap(MemberList.None); + }); + } +} \ No newline at end of file diff --git a/src/UnitTests/IMappingExpression/NonGenericAllMembersNullSubstitute.cs b/src/UnitTests/IMappingExpression/NonGenericAllMembersNullSubstitute.cs deleted file mode 100644 index b9a3d192c0..0000000000 --- a/src/UnitTests/IMappingExpression/NonGenericAllMembersNullSubstitute.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class NonGenericAllMembersNullSubstituteBug : SpecBase - { - public class Source - { - public int? Value1 { get; set; } - public int? Value2 { get; set; } - public int? Value3 { get; set; } - } - - public class Destination - { - public string Value1 { get; set; } - public string Value2 { get; set; } - public string Value3 { get; set; } - } - - [Fact] - public void Should_map_all_null_values_to_its_substitute() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source), typeof(Destination)) - .ForAllMembers(opt => opt.NullSubstitute(string.Empty))); - - var src = new Source - { - Value1 = 5 - }; - - var mapper = config.CreateMapper(); - var dest = mapper.Map(src); - - dest.Value1.ShouldEqual("5"); - dest.Value2.ShouldEqual(string.Empty); - dest.Value3.ShouldEqual(string.Empty); - } - } -} diff --git a/src/UnitTests/IMappingExpression/NonGenericConstructorTests.cs b/src/UnitTests/IMappingExpression/NonGenericConstructorTests.cs index 9eb91922b2..22c09612b7 100644 --- a/src/UnitTests/IMappingExpression/NonGenericConstructorTests.cs +++ b/src/UnitTests/IMappingExpression/NonGenericConstructorTests.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Linq.Expressions; using QueryableExtensions; - using Should; + using Shouldly; using Xunit; public class NonGenericConstructorTests : AutoMapperSpecBase @@ -34,8 +34,8 @@ public Dest(int other) protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { - Expression> constructor = src => new Dest(src.Value + 10); - cfg.CreateMap(typeof (Source), typeof (Dest)).ConstructProjectionUsing(constructor); + Expression> constructor = src => new Dest(((Source) src).Value + 10); + cfg.CreateMap(typeof (Source), typeof (Dest)).ConstructUsing(constructor); }); protected override void Because_of() @@ -54,7 +54,7 @@ protected override void Because_of() [Fact] public void Should_construct_correctly() { - _dest[0].Other.ShouldEqual(15); + _dest[0].Other.ShouldBe(15); } } } \ No newline at end of file diff --git a/src/UnitTests/IMappingExpression/NonGenericProjectEnumTest.cs b/src/UnitTests/IMappingExpression/NonGenericProjectEnumTest.cs index 888363b2bf..2e05e68dca 100644 --- a/src/UnitTests/IMappingExpression/NonGenericProjectEnumTest.cs +++ b/src/UnitTests/IMappingExpression/NonGenericProjectEnumTest.cs @@ -1,9 +1,10 @@ -namespace AutoMapper.UnitTests.Projection +using System; + +namespace AutoMapper.UnitTests.Projection { using QueryableExtensions; - using Should; + using Shouldly; using System.Linq; - using Should.Core.Assertions; using Xunit; public class NonGenericProjectEnumTest @@ -15,7 +16,7 @@ public NonGenericProjectEnumTest() _config = new MapperConfiguration(cfg => { cfg.CreateMap(typeof(Customer), typeof(CustomerDto)); - cfg.CreateMap(typeof(CustomerType), typeof(string)).ProjectUsing(ct => ct.ToString().ToUpper()); + cfg.CreateMap(typeof(CustomerType), typeof(string)).ConvertUsing(ct => ct.ToString().ToUpper()); }); } @@ -26,7 +27,7 @@ public void ProjectingEnumToString() var projected = customers.ProjectTo(_config); projected.ShouldNotBeNull(); - Assert.Equal(customers.Single().CustomerType.ToString().ToUpper(), projected.Single().CustomerType); + customers.Single().CustomerType.ToString().ToUpper().ShouldBe(projected.Single().CustomerType); } public class Customer @@ -63,7 +64,7 @@ public NonGenericProjectAndMapEnumTest() var config = new MapperConfiguration(cfg => { cfg.CreateMap(typeof (Customer), typeof (CustomerDto)); - cfg.CreateMap(typeof (CustomerType), typeof (string)).ProjectUsing(ct => ct.ToString().ToUpper()); + cfg.CreateMap(typeof (CustomerType), typeof (string)).ConvertUsing(ct => ct.ToString().ToUpper()); }); _mapper = config.CreateMapper(); } @@ -75,7 +76,7 @@ public void ProjectingEnumToString() var projected = customers.ProjectTo(_mapper.ConfigurationProvider); projected.ShouldNotBeNull(); - Assert.Equal(customers.Single().CustomerType.ToString().ToUpper(), projected.Single().CustomerType); + Assert.Equal(customers.Single().CustomerType.ToString(), projected.Single().CustomerType, StringComparer.OrdinalIgnoreCase); } public class Customer @@ -117,7 +118,7 @@ public class Dest protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { - cfg.CreateMap(typeof (Source), typeof (Dest)).ProjectUsing(src => new Dest {Value = 10}); + cfg.CreateMap(typeof (Source), typeof (Dest)).ConvertUsing(src => new Dest {Value = 10}); }); [Fact] diff --git a/src/UnitTests/IMappingExpression/NonGenericResolveUsing.cs b/src/UnitTests/IMappingExpression/NonGenericResolveUsing.cs new file mode 100644 index 0000000000..27d377ba59 --- /dev/null +++ b/src/UnitTests/IMappingExpression/NonGenericResolveUsing.cs @@ -0,0 +1,35 @@ +using Xunit; +using Shouldly; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + public class When_using_non_generic_ResolveUsing : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + } + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source), typeof(Destination)).ForMember("Value", o => o.MapFrom((src, dest, member, ctx) => 10)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_ok() + { + _destination.Value.ShouldBe(10); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/IMappingExpression/NonGenericReverseMapping.cs b/src/UnitTests/IMappingExpression/NonGenericReverseMapping.cs index b5a3f90340..4a1343c3dd 100644 --- a/src/UnitTests/IMappingExpression/NonGenericReverseMapping.cs +++ b/src/UnitTests/IMappingExpression/NonGenericReverseMapping.cs @@ -1,5 +1,5 @@ using Xunit; -using Should; +using Shouldly; using System.Linq; namespace AutoMapper.UnitTests @@ -39,7 +39,7 @@ protected override void Because_of() [Fact] public void Should_create_a_map_with_the_reverse_items() { - _source.Value.ShouldEqual(10); + _source.Value.ShouldBe(10); } } @@ -97,7 +97,7 @@ public void GetUnmappedPropertyNames_ShouldReturnBoo() //Act var unmappedPropertyNames = typeMap.GetUnmappedPropertyNames(); //Assert - unmappedPropertyNames[0].ShouldEqual("Boo"); + unmappedPropertyNames[0].ShouldBe("Boo"); } [Fact] @@ -113,7 +113,7 @@ public void WhenSecondCallTo_GetUnmappedPropertyNames_ShouldReturnBoo() //Act var unmappedPropertyNames = typeMap.GetUnmappedPropertyNames(); //Assert - unmappedPropertyNames[0].ShouldEqual("Boo"); + unmappedPropertyNames[0].ShouldBe("Boo"); } } } diff --git a/src/UnitTests/IgnoreAllPropertiesWithAnInaccessibleSetterTests.cs b/src/UnitTests/IgnoreAllPropertiesWithAnInaccessibleSetterTests.cs new file mode 100644 index 0000000000..65675178af --- /dev/null +++ b/src/UnitTests/IgnoreAllPropertiesWithAnInaccessibleSetterTests.cs @@ -0,0 +1,43 @@ +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class SomeSource + { + public int IgnoreMe { get; set; } + } + + public class Destination : DestinationBase + { + } + + public class DestinationBase + { + public int IgnoreMe { get; private set; } + } + + public class IgnoreAllPropertiesWithAnInaccessibleSetterTests + { + [Fact] + public void AutoMapper_SimpleObject_IgnoresPrivateSettersInBaseClasses() + { + // Arrange + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter(); + }); + var mapper = config.CreateMapper(); + + var source = new SomeSource { IgnoreMe = 666 }; + var destination = new Destination(); + + // Act + mapper.Map(source, destination); + + // Assert + config.AssertConfigurationIsValid(); + Assert.Equal(0, destination.IgnoreMe); + } + } +} diff --git a/src/UnitTests/IgnoreAllTests.cs b/src/UnitTests/IgnoreAllTests.cs index a8da9555c3..ea49ab69e6 100644 --- a/src/UnitTests/IgnoreAllTests.cs +++ b/src/UnitTests/IgnoreAllTests.cs @@ -1,149 +1,221 @@ -using System.Collections.Generic; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - public class IgnoreAllTests - { - public class Source - { - public string ShouldBeMapped { get; set; } - } - - public class Destination - { - public string ShouldBeMapped { get; set; } - public string StartingWith_ShouldNotBeMapped { get; set; } - public List StartingWith_ShouldBeNullAfterwards { get; set; } - public string AnotherString_ShouldBeNullAfterwards { get; set; } - } - - public class DestinationWrongType - { - public Destination ShouldBeMapped { get; set; } - } - - [Fact] - public void GlobalIgnore_ignores_all_properties_beginning_with_string() - { - var config = new MapperConfiguration(cfg => - { - cfg.AddGlobalIgnore("StartingWith"); - cfg.CreateMap() - .ForMember(dest => dest.AnotherString_ShouldBeNullAfterwards, opt => opt.Ignore()); - }); - - config.CreateMapper().Map(new Source{ShouldBeMapped = "true"}); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void GlobalIgnore_ignores_properties_with_names_matching_but_different_types() - { - var config = new MapperConfiguration(cfg => - { - cfg.AddGlobalIgnore("ShouldBeMapped"); - cfg.CreateMap(); - }); - - config.CreateMapper().Map(new Source { ShouldBeMapped = "true" }); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void Ignored_properties_should_be_default_value() - { - var config = new MapperConfiguration(cfg => - { - cfg.AddGlobalIgnore("StartingWith"); - cfg.CreateMap() - .ForMember(dest => dest.AnotherString_ShouldBeNullAfterwards, opt => opt.Ignore()); - }); - - Destination destination = config.CreateMapper().Map(new Source { ShouldBeMapped = "true" }); - destination.StartingWith_ShouldBeNullAfterwards.ShouldEqual(null); - destination.StartingWith_ShouldNotBeMapped.ShouldEqual(null); - } - - [Fact] - public void Ignore_supports_two_different_values() - { - var config = new MapperConfiguration(cfg => - { - cfg.AddGlobalIgnore("StartingWith"); - cfg.AddGlobalIgnore("AnotherString"); - cfg.CreateMap(); - }); - - Destination destination = config.CreateMapper().Map(new Source { ShouldBeMapped = "true" }); - destination.AnotherString_ShouldBeNullAfterwards.ShouldEqual(null); - destination.StartingWith_ShouldNotBeMapped.ShouldEqual(null); - } - } - public class IgnoreAttributeTests - { - public class Source - { - public string ShouldBeMapped { get; set; } - public string ShouldNotBeMapped { get; set; } - } - - public class Destination - { - public string ShouldBeMapped { get; set; } - [IgnoreMap] - public string ShouldNotBeMapped { get; set; } - } - - [Fact] - public void Ignore_On_Source_Field() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - config.AssertConfigurationIsValid(); - - Source source = new Source - { - ShouldBeMapped = "Value1", - ShouldNotBeMapped = "Value2" - }; - - Destination destination = config.CreateMapper().Map(source); - destination.ShouldNotBeMapped.ShouldEqual(null); - } - } - - public class ReverseMapIgnoreAttributeTests - { - public class Source - { - public string ShouldBeMapped { get; set; } - public string ShouldNotBeMapped { get; set; } - } - - public class Destination - { - public string ShouldBeMapped { get; set; } - [IgnoreMap] - public string ShouldNotBeMapped { get; set; } - } - - [Fact] - public void Ignore_On_Source_Field() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ReverseMap()); - config.AssertConfigurationIsValid(); - - Destination source = new Destination - { - ShouldBeMapped = "Value1", - ShouldNotBeMapped = "Value2" - }; - - Source destination = config.CreateMapper().Map(source); - destination.ShouldNotBeMapped.ShouldEqual(null); - - } - } +using System.Collections.Generic; +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests +{ + public class When_overriding_global_ignore : AutoMapperSpecBase + { + Destination _destination; + + public class Source + { + public int ShouldBeMapped { get; set; } + } + + public class Destination + { + public int ShouldBeMapped { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.AddGlobalIgnore("ShouldBeMapped"); + cfg.CreateMap().ForMember(d => d.ShouldBeMapped, o => o.MapFrom(src => 12)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source()); + } + + [Fact] + public void Should_not_ignore() + { + _destination.ShouldBeMapped.ShouldBe(12); + } + } + + public class IgnoreAllTests + { + public class Source + { + public string ShouldBeMapped { get; set; } + } + + public class Destination + { + public string ShouldBeMapped { get; set; } + public string StartingWith_ShouldNotBeMapped { get; set; } + public List StartingWith_ShouldBeNullAfterwards { get; set; } + public string AnotherString_ShouldBeNullAfterwards { get; set; } + } + + public class DestinationWrongType + { + public Destination ShouldBeMapped { get; set; } + } + + public class FooProfile : Profile + { + public FooProfile() + { + CreateMap() + .ForMember(dest => dest.AnotherString_ShouldBeNullAfterwards, opt => opt.Ignore()); + } + } + + [Fact] + public void GlobalIgnore_ignores_all_properties_beginning_with_string() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddGlobalIgnore("StartingWith"); + cfg.CreateMap() + .ForMember(dest => dest.AnotherString_ShouldBeNullAfterwards, opt => opt.Ignore()); + }); + + config.CreateMapper().Map(new Source{ShouldBeMapped = "true"}); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void GlobalIgnore_ignores_all_properties_beginning_with_string_in_profiles() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddGlobalIgnore("StartingWith"); + cfg.AddProfile(); + }); + + config.CreateMapper().Map(new Source{ShouldBeMapped = "true"}); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void GlobalIgnore_ignores_properties_with_names_matching_but_different_types() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddGlobalIgnore("ShouldBeMapped"); + cfg.CreateMap(); + }); + + config.CreateMapper().Map(new Source { ShouldBeMapped = "true" }); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void Ignored_properties_should_be_default_value() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddGlobalIgnore("StartingWith"); + cfg.CreateMap() + .ForMember(dest => dest.AnotherString_ShouldBeNullAfterwards, opt => opt.Ignore()); + }); + + Destination destination = config.CreateMapper().Map(new Source { ShouldBeMapped = "true" }); + destination.StartingWith_ShouldBeNullAfterwards.ShouldBe(null); + destination.StartingWith_ShouldNotBeMapped.ShouldBe(null); + } + + [Fact] + public void Ignore_supports_two_different_values() + { + var config = new MapperConfiguration(cfg => + { + cfg.AddGlobalIgnore("StartingWith"); + cfg.AddGlobalIgnore("AnotherString"); + cfg.CreateMap(); + }); + + Destination destination = config.CreateMapper().Map(new Source { ShouldBeMapped = "true" }); + destination.AnotherString_ShouldBeNullAfterwards.ShouldBe(null); + destination.StartingWith_ShouldNotBeMapped.ShouldBe(null); + } + } + public class IgnoreAttributeTests + { + public class Source + { + public string ShouldBeMapped { get; set; } + public string ShouldNotBeMapped { get; set; } + } + + public class Destination + { + public string ShouldBeMapped { get; set; } + [IgnoreMap] + public string ShouldNotBeMapped { get; set; } + } + + [Fact] + public void Ignore_On_Source_Field() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + config.AssertConfigurationIsValid(); + + Source source = new Source + { + ShouldBeMapped = "Value1", + ShouldNotBeMapped = "Value2" + }; + + Destination destination = config.CreateMapper().Map(source); + destination.ShouldNotBeMapped.ShouldBe(null); + } + } + + public class ReverseMapIgnoreAttributeTests + { + public class Source + { + public string ShouldBeMapped { get; set; } + public string ShouldNotBeMapped { get; set; } + } + + public class Destination + { + public string ShouldBeMapped { get; set; } + [IgnoreMap] + public string ShouldNotBeMapped { get; set; } + } + + [Fact] + public void Ignore_On_Source_Field() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ReverseMap()); + config.AssertConfigurationIsValid(); + + Destination source = new Destination + { + ShouldBeMapped = "Value1", + ShouldNotBeMapped = "Value2" + }; + + Source destination = config.CreateMapper().Map(source); + destination.ShouldNotBeMapped.ShouldBe(null); + + } + + public class Source2 + { + } + + public class Destination2 + { + [IgnoreMap] + public string ShouldNotThrowExceptionOnReverseMapping { get; set; } + } + + [Fact] + public void Sould_not_throw_exception_when_reverse_property_does_not_exist() + { + typeof(ArgumentOutOfRangeException).ShouldNotBeThrownBy(() => new MapperConfiguration(cfg => cfg.CreateMap() + .ReverseMap())); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Indexers.cs b/src/UnitTests/Indexers.cs index fe4f2c61b7..d13e5bfc59 100644 --- a/src/UnitTests/Indexers.cs +++ b/src/UnitTests/Indexers.cs @@ -1,58 +1,58 @@ -using System; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace Indexers - { - public class When_mapping_to_a_destination_with_an_indexer_property : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public string Value { get; set; } - } - - public class Destination - { - public string Value { get; set; } - public string this[string key] { get { return null; }} - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Value = "Bob"}); - } - - [Fact] - public void Should_ignore_indexers_and_map_successfully() - { - _result.Value.ShouldEqual("Bob"); - } - - [Fact] - public void Should_pass_configuration_check() - { - Exception thrown = null; - try - { - Configuration.AssertConfigurationIsValid(); - } - catch (Exception ex) - { - thrown = ex; - } - - thrown.ShouldBeNull(); - } - } - - } +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + namespace Indexers + { + public class When_mapping_to_a_destination_with_an_indexer_property : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public string Value { get; set; } + } + + public class Destination + { + public string Value { get; set; } + public string this[string key] { get { return null; }} + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Value = "Bob"}); + } + + [Fact] + public void Should_ignore_indexers_and_map_successfully() + { + _result.Value.ShouldBe("Bob"); + } + + [Fact] + public void Should_pass_configuration_check() + { + Exception thrown = null; + try + { + Configuration.AssertConfigurationIsValid(); + } + catch (Exception ex) + { + thrown = ex; + } + + thrown.ShouldBeNull(); + } + } + + } } \ No newline at end of file diff --git a/src/UnitTests/InterfaceMapping.cs b/src/UnitTests/InterfaceMapping.cs index fe5a5e895b..6ed34fa947 100644 --- a/src/UnitTests/InterfaceMapping.cs +++ b/src/UnitTests/InterfaceMapping.cs @@ -1,594 +1,615 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace InterfaceMapping - { - public class When_mapping_base_interface_members - { - public interface ISource - { - int Id { get; set; } - } - - public interface ITarget : ITargetBase - { - int Id { get; set; } - } - - public interface ITargetBase - { - int BaseId { get; set; } - } - - [Fact] - public void Should_find_inherited_members_by_name() - { - new MapperConfiguration(c=>c.CreateMap().ForMember("BaseId", opt => opt.Ignore())); - } - } - - public class When_mapping_to_existing_object_through_interfaces : AutoMapperSpecBase - { - private class2DTO _result; - - public class class1 : iclass1 - { - public string prop1 { get; set; } - } - - public class class2 : class1, iclass2 - { - public string prop2 { get; set; } - } - - public class class1DTO : iclass1DTO - { - public string prop1 { get; set; } - } - - public class class2DTO : class1DTO, iclass2DTO - { - public string prop2 { get; set; } - } - - public interface iclass1 - { - string prop1 { get; set; } - } - - public interface iclass2 - { - string prop2 { get; set; } - } - - public interface iclass1DTO - { - string prop1 { get; set; } - } - - public interface iclass2DTO - { - string prop2 { get; set; } - } - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var bo = new class2 { prop1 = "PROP1", prop2 = "PROP2" }; - _result = Mapper.Map(bo, new class2DTO()); - } - - [Fact] - public void Should_use_the_most_derived_interface() - { - _result.prop2.ShouldEqual("PROP2"); - } - } - - public class When_mapping_an_interface_to_an_abstract_type : AutoMapperSpecBase - { - private DtoObject _result; - - public class ModelObject - { - public IChildModelObject Child { get; set; } - } - - public interface IChildModelObject - { - string ChildProperty { get; set; } - } - - public class SubChildModelObject : IChildModelObject - { - public string ChildProperty { get; set; } - } - - public class DtoObject - { - public DtoChildObject Child { get; set; } - } - - public abstract class DtoChildObject - { - public virtual string ChildProperty { get; set; } - } - - public class SubDtoChildObject : DtoChildObject - { - } - - protected override void Because_of() - { - var model = new ModelObject - { - Child = new SubChildModelObject {ChildProperty = "child property value"} - }; - _result = Mapper.Map(model); - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - - cfg.CreateMap(); - - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - - [Fact] - public void Should_map_Child_to_SubDtoChildObject_type() - { - _result.Child.ShouldBeType(typeof (SubDtoChildObject)); - } - - [Fact] - public void Should_map_ChildProperty_to_child_property_value() - { - _result.Child.ChildProperty.ShouldEqual("child property value"); - } - } - -#if !PORTABLE - public class When_mapping_a_concrete_type_to_an_interface_type : AutoMapperSpecBase - { - private IDestination _result; - - public class Source - { - public int Value { get; set; } - } - - public interface IDestination - { - int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Value = 5}); - } - - [Fact] - public void Should_create_an_implementation_of_the_interface() - { - _result.Value.ShouldEqual(5); - } - - [Fact] - public void Should_not_derive_from_INotifyPropertyChanged() - { - _result.ShouldNotBeInstanceOf(); - } - } - - public class When_mapping_a_concrete_type_to_an_interface_type_that_derives_from_INotifyPropertyChanged : AutoMapperSpecBase - { - private IDestination _result; - - private int _count; - - public class Source - { - public int Value { get; set; } - } - - public interface IDestination : INotifyPropertyChanged - { - int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Value = 5}); - } - - [Fact] - public void Should_create_an_implementation_of_the_interface() - { - _result.Value.ShouldEqual(5); - } - - [Fact] - public void Should_derive_from_INotifyPropertyChanged() - { - var q = _result as INotifyPropertyChanged; - q.ShouldNotBeNull(); - } - - [Fact] - public void Should_notify_property_changes() - { - var count = 0; - _result.PropertyChanged += (o, e) => { - count++; - o.ShouldBeSameAs(_result); - e.PropertyName.ShouldEqual("Value"); - }; - - _result.Value = 42; - count.ShouldEqual(1); - _result.Value.ShouldEqual(42); - } - - [Fact] - public void Should_detach_event_handler() - { - _result.PropertyChanged += MyHandler; - _count.ShouldEqual(0); - - _result.Value = 56; - _count.ShouldEqual(1); - - _result.PropertyChanged -= MyHandler; - _count.ShouldEqual(1); - - _result.Value = 75; - _count.ShouldEqual(1); - } - - private void MyHandler(object sender, PropertyChangedEventArgs e) { - _count++; - } - } -#endif - - public class When_mapping_a_derived_interface_to_an_derived_concrete_type : AutoMapperSpecBase - { - private Destination _result = null; - - public interface ISourceBase - { - int Id { get; } - } - - public interface ISource : ISourceBase - { - int SecondId { get; } - } - - public class Source : ISource - { - public int Id { get; set; } - public int SecondId { get; set; } - } - - public abstract class DestinationBase - { - public int Id { get; set; } - } - - public class Destination : DestinationBase - { - public int SecondId { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Id = 7, SecondId = 42}); - } - - [Fact] - public void Should_map_base_interface_property() - { - _result.Id.ShouldEqual(7); - } - - [Fact] - public void Should_map_derived_interface_property() - { - _result.SecondId.ShouldEqual(42); - } - - [Fact] - public void Should_pass_configuration_testing() - { - Configuration.AssertConfigurationIsValid(); - } - } - - public class When_mapping_a_derived_interface_to_an_derived_concrete_type_with_readonly_interface_members : - AutoMapperSpecBase - { - private Destination _result = null; - - public interface ISourceBase - { - int Id { get; } - } - - public interface ISource : ISourceBase - { - int SecondId { get; } - } - - public class Source : ISource - { - public int Id { get; set; } - public int SecondId { get; set; } - } - - public interface IDestinationBase - { - int Id { get; } - } - - public interface IDestination : IDestinationBase - { - int SecondId { get; } - } - - public abstract class DestinationBase : IDestinationBase - { - public int Id { get; set; } - } - - public class Destination : DestinationBase, IDestination - { - public int SecondId { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Id = 7, SecondId = 42}); - } - - [Fact] - public void Should_map_base_interface_property() - { - _result.Id.ShouldEqual(7); - } - - [Fact] - public void Should_map_derived_interface_property() - { - _result.SecondId.ShouldEqual(42); - } - - [Fact] - public void Should_pass_configuration_testing() - { - Configuration.AssertConfigurationIsValid(); - } - } - - public class When_mapping_to_a_type_with_explicitly_implemented_interface_members : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value { get; set; } - } - - public interface IOtherDestination - { - int OtherValue { get; set; } - } - - public class Destination : IOtherDestination - { - public int Value { get; set; } - int IOtherDestination.OtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Value = 10}); - } - - [Fact] - public void Should_ignore_interface_members_for_mapping() - { - _destination.Value.ShouldEqual(10); - } - - [Fact] - public void Should_ignore_interface_members_for_validation() - { - Configuration.AssertConfigurationIsValid(); - } - } - - public class MappingToInterfacesWithPolymorphism : AutoMapperSpecBase - { - private BaseDto[] _baseDtos; - - public interface IBase { } - public interface IDerived : IBase { } - public class Base : IBase { } - public class Derived : Base, IDerived { } - public class BaseDto { } - public class DerivedDto : BaseDto { } - - //and following mappings: - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().Include(); - cfg.CreateMap(); - cfg.CreateMap().Include(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - List list = new List() { new Derived() }; - _baseDtos = Mapper.Map, BaseDto[]>(list); - } - - [Fact] - public void Should_use_the_derived_type_map() - { - _baseDtos.First().ShouldBeType(); - } - - } - - //[TestFixture, Explicit] - //public class MappingToInterfacesPolymorphic - //{ - // [SetUp] - // public void SetUp() - // { - // - // } - - // public interface DomainInterface - // { - // Guid Id { get; set; } - // NestedType Nested { get; set; } - // } - - // public class NestedType - // { - // public virtual string Name { get; set; } - // public virtual decimal DecimalValue { get; set; } - // } - - // public class DomainImplA : DomainInterface - // { - // public virtual Guid Id { get; set; } - // private NestedType nested; - - // public virtual NestedType Nested - // { - // get - // { - // if (nested == null) nested = new NestedType(); - // return nested; - // } - // set { nested = value; } - // } - // } - - // public class DomainImplB : DomainInterface - // { - // public virtual Guid Id { get; set; } - // private NestedType nested; - - // public virtual NestedType Nested - // { - // get - // { - // if (nested == null) nested = new NestedType(); - // return nested; - // } - // set { nested = value; } - // } - // } - - // public class Dto - // { - // public Guid Id { get; set; } - // public string Name { get; set; } - // public decimal DecimalValue { get; set; } - // } - - // [Fact] - // public void CanMapToDomainInterface() - // { - // Mapper.CreateMap() - // .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Nested.Name)) - // .ForMember(dest => dest.DecimalValue, opt => opt.MapFrom(src => src.Nested.DecimalValue)); - // Mapper.CreateMap() - // .ForMember(dest => dest.Nested.Name, opt => opt.MapFrom(src => src.Name)) - // .ForMember(dest => dest.Nested.DecimalValue, opt => opt.MapFrom(src => src.DecimalValue)); - - // var domainInstance1 = new DomainImplA(); - // var domainInstance2 = new DomainImplB(); - // var domainInstance3 = new DomainImplA(); - - // var dtoCollection = new List - // { - // Mapper.Map(domainInstance1), - // Mapper.Map(domainInstance2), - // Mapper.Map(domainInstance3) - // }; - - // dtoCollection[0].Id = Guid.NewGuid(); - // dtoCollection[0].DecimalValue = 1M; - // dtoCollection[0].Name = "Bob"; - // dtoCollection[1].Id = Guid.NewGuid(); - // dtoCollection[1].DecimalValue = 0.1M; - // dtoCollection[1].Name = "Frank"; - // dtoCollection[2].Id = Guid.NewGuid(); - // dtoCollection[2].DecimalValue = 2.1M; - // dtoCollection[2].Name = "Sam"; - - // Mapper.Map(dtoCollection[0], domainInstance1); - // Mapper.Map(dtoCollection[1], domainInstance2); - // Mapper.Map(dtoCollection[2], domainInstance3); - - // dtoCollection[0].Id.ShouldEqual(domainInstance1.Id); - // dtoCollection[1].Id.ShouldEqual(domainInstance2.Id); - // dtoCollection[2].Id.ShouldEqual(domainInstance3.Id); - - // dtoCollection[0].DecimalValue.ShouldEqual(domainInstance1.Nested.DecimalValue); - // dtoCollection[1].DecimalValue.ShouldEqual(domainInstance2.Nested.DecimalValue); - // dtoCollection[2].DecimalValue.ShouldEqual(domainInstance3.Nested.DecimalValue); - - // dtoCollection[0].DecimalValue.ShouldEqual(domainInstance1.Nested.Name); - // dtoCollection[1].DecimalValue.ShouldEqual(domainInstance2.Nested.Name); - // dtoCollection[2].DecimalValue.ShouldEqual(domainInstance3.Nested.Name); - // } - //} - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.InterfaceMapping +{ + public class GenericsAndInterfaces : AutoMapperSpecBase + { + MyClass source = new MyClass { Container = new ContainerClass { MyProperty = 3 } }; + + public interface IMyInterface + { + T Container { get; set; } + } + + public class ContainerClass + { + public int MyProperty { get; set; } + } + + public class ImplementedClass : IMyInterface + { + public ContainerClass Container + { + get; + set; + } + } + + public class MyClass + { + public T Container { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap(typeof(MyClass<>), typeof(IMyInterface<>))); + + [Fact] + public void ShouldMapToExistingObject() + { + var destination = new ImplementedClass(); + Mapper.Map(source, destination, typeof(MyClass), typeof(IMyInterface)); + destination.Container.MyProperty.ShouldBe(3); + } + + [Fact] + public void ShouldMapToNewObject() + { + var destination = (IMyInterface) Mapper.Map(source, typeof(MyClass), typeof(IMyInterface)); + destination.Container.MyProperty.ShouldBe(3); + } + } + + public class When_mapping_generic_interface : AutoMapperSpecBase + { + public class Source : List + { + public String PropertyToMap { get; set; } + public String PropertyToIgnore { get; set; } = "I am not ignored"; + } + + public class Destination : DestinationBase + { + } + + public abstract class DestinationBase : DestinationBaseBase, IDestinationBase + { + private String m_PropertyToIgnore; + + public virtual String PropertyToMap { get; set; } + + [IgnoreMap] + public override String PropertyToIgnore + { + get + { + return m_PropertyToIgnore ?? (m_PropertyToIgnore = "Ignore me"); + } + set + { + m_PropertyToIgnore = value; + } + } + + public virtual List Items { get; set; } + } + + public abstract class DestinationBaseBase + { + [IgnoreMap] + public virtual String PropertyToIgnore { get; set; } + } + + public interface IDestinationBase + { + String PropertyToMap { get; set; } + List Items { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + cfg.CreateMap(typeof(IList<>), typeof(IDestinationBase<>)) + .ForMember(nameof(IDestinationBase.Items), p_Expression => p_Expression.MapFrom(p_Source => p_Source)) + .ForMember("PropertyToMap", o=>o.Ignore())); + + [Fact] + public void Should_work() + { + var source = new Source{"Cat", "Dog"}; + source.PropertyToMap = "Hello World"; + var destination = Mapper.Map>(source); + destination.PropertyToMap.ShouldBeNull(); + destination.Items.ShouldBe(source); + } + } + + public class When_mapping_an_interface_with_getter_only_member : AutoMapperSpecBase + { + interface ISource + { + int Id { get; set; } + } + + public interface IDestination + { + int Id { get; set; } + int ReadOnly { get; } + } + + class Source : ISource + { + public int Id { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c=>c.CreateMap()); + + [Fact] + public void ShouldMapOk() + { + Mapper.Map(new Source { Id = 5 }).Id.ShouldBe(5); + } + } + + public class When_mapping_base_interface_members + { + public interface ISource + { + int Id { get; set; } + } + + public interface ITarget : ITargetBase + { + int Id { get; set; } + } + + public interface ITargetBase + { + int BaseId { get; set; } + } + + [Fact] + public void Should_find_inherited_members_by_name() + { + new MapperConfiguration(c=>c.CreateMap().ForMember("BaseId", opt => opt.Ignore())); + } + } + + public class When_mapping_to_existing_object_through_interfaces : AutoMapperSpecBase + { + private class2DTO _result; + + public class class1 : iclass1 + { + public string prop1 { get; set; } + } + + public class class2 : class1, iclass2 + { + public string prop2 { get; set; } + } + + public class class1DTO : iclass1DTO + { + public string prop1 { get; set; } + } + + public class class2DTO : class1DTO, iclass2DTO + { + public string prop2 { get; set; } + } + + public interface iclass1 + { + string prop1 { get; set; } + } + + public interface iclass2 + { + string prop2 { get; set; } + } + + public interface iclass1DTO + { + string prop1 { get; set; } + } + + public interface iclass2DTO + { + string prop2 { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var bo = new class2 { prop1 = "PROP1", prop2 = "PROP2" }; + _result = Mapper.Map(bo, new class2DTO()); + } + + [Fact] + public void Should_use_the_most_derived_interface() + { + _result.prop2.ShouldBe("PROP2"); + } + } + + public class When_mapping_an_interface_to_an_abstract_type : AutoMapperSpecBase + { + private DtoObject _result; + + public class ModelObject + { + public IChildModelObject Child { get; set; } + } + + public interface IChildModelObject + { + string ChildProperty { get; set; } + } + + public class SubChildModelObject : IChildModelObject + { + public string ChildProperty { get; set; } + } + + public class DtoObject + { + public DtoChildObject Child { get; set; } + } + + public abstract class DtoChildObject + { + public virtual string ChildProperty { get; set; } + } + + public class SubDtoChildObject : DtoChildObject + { + } + + protected override void Because_of() + { + var model = new ModelObject + { + Child = new SubChildModelObject {ChildProperty = "child property value"} + }; + _result = Mapper.Map(model); + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + + cfg.CreateMap(); + + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_Child_to_SubDtoChildObject_type() + { + _result.Child.ShouldBeOfType(typeof (SubDtoChildObject)); + } + + [Fact] + public void Should_map_ChildProperty_to_child_property_value() + { + _result.Child.ChildProperty.ShouldBe("child property value"); + } + } + + public class When_mapping_a_concrete_type_to_an_interface_type : AutoMapperSpecBase + { + private IDestination _result; + + public class Source + { + public int Value { get; set; } + } + + public interface IDestination + { + int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Value = 5}); + } + + [Fact] + public void Should_create_an_implementation_of_the_interface() + { + _result.Value.ShouldBe(5); + } + + [Fact] + public void Should_not_derive_from_INotifyPropertyChanged() + { + _result.ShouldNotBeOfType(); + } + } + + public class When_mapping_a_concrete_type_to_an_interface_type_that_derives_from_INotifyPropertyChanged : AutoMapperSpecBase + { + private IDestination _result; + + private int _count; + + public class Source + { + public int Value { get; set; } + } + + public interface IDestination : INotifyPropertyChanged + { + int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Value = 5}); + } + + [Fact] + public void Should_create_an_implementation_of_the_interface() + { + _result.Value.ShouldBe(5); + } + + [Fact] + public void Should_derive_from_INotifyPropertyChanged() + { + var q = _result as INotifyPropertyChanged; + q.ShouldNotBeNull(); + } + + [Fact] + public void Should_notify_property_changes() + { + var count = 0; + _result.PropertyChanged += (o, e) => { + count++; + o.ShouldBeSameAs(_result); + e.PropertyName.ShouldBe("Value"); + }; + + _result.Value = 42; + count.ShouldBe(1); + _result.Value.ShouldBe(42); + } + + [Fact] + public void Should_detach_event_handler() + { + _result.PropertyChanged += MyHandler; + _count.ShouldBe(0); + + _result.Value = 56; + _count.ShouldBe(1); + + _result.PropertyChanged -= MyHandler; + _count.ShouldBe(1); + + _result.Value = 75; + _count.ShouldBe(1); + } + + private void MyHandler(object sender, PropertyChangedEventArgs e) { + _count++; + } + } + + public class When_mapping_a_derived_interface_to_an_derived_concrete_type : AutoMapperSpecBase + { + private Destination _result = null; + + public interface ISourceBase + { + int Id { get; } + } + + public interface ISource : ISourceBase + { + int SecondId { get; } + } + + public class Source : ISource + { + public int Id { get; set; } + public int SecondId { get; set; } + } + + public abstract class DestinationBase + { + public int Id { get; set; } + } + + public class Destination : DestinationBase + { + public int SecondId { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Id = 7, SecondId = 42}); + } + + [Fact] + public void Should_map_base_interface_property() + { + _result.Id.ShouldBe(7); + } + + [Fact] + public void Should_map_derived_interface_property() + { + _result.SecondId.ShouldBe(42); + } + + [Fact] + public void Should_pass_configuration_testing() + { + Configuration.AssertConfigurationIsValid(); + } + } + + public class When_mapping_a_derived_interface_to_an_derived_concrete_type_with_readonly_interface_members : + AutoMapperSpecBase + { + private Destination _result = null; + + public interface ISourceBase + { + int Id { get; } + } + + public interface ISource : ISourceBase + { + int SecondId { get; } + } + + public class Source : ISource + { + public int Id { get; set; } + public int SecondId { get; set; } + } + + public interface IDestinationBase + { + int Id { get; } + } + + public interface IDestination : IDestinationBase + { + int SecondId { get; } + } + + public abstract class DestinationBase : IDestinationBase + { + public int Id { get; set; } + } + + public class Destination : DestinationBase, IDestination + { + public int SecondId { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Id = 7, SecondId = 42}); + } + + [Fact] + public void Should_map_base_interface_property() + { + _result.Id.ShouldBe(7); + } + + [Fact] + public void Should_map_derived_interface_property() + { + _result.SecondId.ShouldBe(42); + } + + [Fact] + public void Should_pass_configuration_testing() + { + Configuration.AssertConfigurationIsValid(); + } + } + + public class When_mapping_to_a_type_with_explicitly_implemented_interface_members : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value { get; set; } + } + + public interface IOtherDestination + { + int OtherValue { get; set; } + } + + public class Destination : IOtherDestination + { + public int Value { get; set; } + int IOtherDestination.OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Value = 10}); + } + + [Fact] + public void Should_ignore_interface_members_for_mapping() + { + _destination.Value.ShouldBe(10); + } + + [Fact] + public void Should_ignore_interface_members_for_validation() + { + Configuration.AssertConfigurationIsValid(); + } + } + + public class MappingToInterfacesWithPolymorphism : AutoMapperSpecBase + { + private BaseDto[] _baseDtos; + + public interface IBase { } + public interface IDerived : IBase { } + public class Base : IBase { } + public class Derived : Base, IDerived { } + public class BaseDto { } + public class DerivedDto : BaseDto { } + + //and following mappings: + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().Include(); + cfg.CreateMap(); + cfg.CreateMap().Include(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + List list = new List() { new Derived() }; + _baseDtos = Mapper.Map, BaseDto[]>(list); + } + + [Fact] + public void Should_use_the_derived_type_map() + { + _baseDtos.First().ShouldBeOfType(); + } + + } +} diff --git a/src/UnitTests/Internal/CreateProxyThreading.cs b/src/UnitTests/Internal/CreateProxyThreading.cs new file mode 100644 index 0000000000..38fd534c07 --- /dev/null +++ b/src/UnitTests/Internal/CreateProxyThreading.cs @@ -0,0 +1,37 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using AutoMapper.Execution; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class CreateProxyThreading + { + [Fact] + public void Should_create_the_proxy_once() + { + var tasks = Enumerable.Range(0, 5).Select(i => Task.Factory.StartNew(() => + { + ProxyGenerator.GetProxyType(typeof(ISomeDto)); + })).ToArray(); + Task.WaitAll(tasks); + } + + public interface ISomeDto + { + string Property1 { get; set; } + string Property21 { get; set; } + string Property3 { get; set; } + string Property4 { get; set; } + string Property5 { get; set; } + string Property6 { get; set; } + string Property7 { get; set; } + string Property8 { get; set; } + string Property9 { get; set; } + string Property10 { get; set; } + string Property11 { get; set; } + } + + } +} diff --git a/src/UnitTests/Internal/DelegateFactoryTests.cs b/src/UnitTests/Internal/DelegateFactoryTests.cs index 4f4e111da8..de579ba153 100644 --- a/src/UnitTests/Internal/DelegateFactoryTests.cs +++ b/src/UnitTests/Internal/DelegateFactoryTests.cs @@ -1,235 +1,132 @@ -using System; -using System.Linq.Expressions; -using System.Reflection; -using System.Reflection.Emit; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - using Execution; - - public class DelegateFactoryTests - { - protected DelegateFactory DelegateFactory => new DelegateFactory(); - - [Fact] - public void MethodTests() - { - MethodInfo method = typeof(String).GetMethod("StartsWith", new[] { typeof(string) }); - LateBoundMethod callback = DelegateFactory.CreateGet(method).Compile(); - - string foo = "this is a test"; - bool result = callback(foo, new[] { "this" }); - - result.ShouldBeTrue(); - } - - [Fact] - public void PropertyTests() - { - PropertyInfo property = typeof(Source).GetProperty("Value", typeof(int)); - LateBoundPropertyGet callback = DelegateFactory.CreateGet(property).Compile(); - - var source = new Source {Value = 5}; - int result = callback(source); - - result.ShouldEqual(5); - } - - [Fact] - public void FieldTests() - { - FieldInfo field = typeof(Source).GetField("Value2"); - LateBoundFieldGet callback = DelegateFactory.CreateGet(field).Compile(); - - var source = new Source {Value2 = 15}; - int result = callback(source); - - result.ShouldEqual(15); - } - - [Fact] - public void Should_set_field_when_field_is_a_value_type() - { - var sourceType = typeof (Source); - FieldInfo field = sourceType.GetField("Value2"); - LateBoundFieldSet callback = DelegateFactory.CreateSet(field).Compile(); - - var source = new Source(); - callback(source, 5); - - source.Value2.ShouldEqual(5); - } - - [Fact] - public void Should_set_field_when_field_is_a_reference_type() - { - var sourceType = typeof (Source); - FieldInfo field = sourceType.GetField("Value3"); - LateBoundFieldSet callback = DelegateFactory.CreateSet(field).Compile(); - - var source = new Source(); - callback(source, "hello"); - - source.Value3.ShouldEqual("hello"); - } - - [Fact] - public void Should_set_property_when_property_is_a_value_type() - { - var sourceType = typeof (Source); - PropertyInfo property = sourceType.GetProperty("Value"); - LateBoundPropertySet callback = DelegateFactory.CreateSet(property).Compile(); - - var source = new Source(); - callback(source, 5); - - source.Value.ShouldEqual(5); - } - - [Fact] - public void Should_set_property_when_property_is_a_value_type_and_type_is_interface() - { - var sourceType = typeof (ISource); - PropertyInfo property = sourceType.GetProperty("Value"); - LateBoundPropertySet callback = DelegateFactory.CreateSet(property).Compile(); - - var source = new Source(); - callback(source, 5); - - source.Value.ShouldEqual(5); - } - - [Fact] - public void Should_set_property_when_property_is_a_reference_type() - { - var sourceType = typeof(Source); - PropertyInfo property = sourceType.GetProperty("Value4"); - LateBoundPropertySet callback = DelegateFactory.CreateSet(property).Compile(); - - var source = new Source(); - callback(source, "hello"); - - source.Value4.ShouldEqual("hello"); - } - - internal delegate void DoIt3(ref ValueSource source, string value); - - private void SetValue(object thing, object value) - { - var source = ((ValueSource) thing); - source.Value = (string)value; - } - - [Fact] - public void Test_with_create_ctor() - { - var sourceType = typeof(Source); - - LateBoundCtor ctor = DelegateFactory.CreateCtor(sourceType); - - var target = ctor(); - - target.ShouldBeType(); - } - - [Fact] - public void Test_with_value_object_create_ctor() - { - var sourceType = typeof(ValueSource); - - LateBoundCtor ctor = DelegateFactory.CreateCtor(sourceType); - - var target = ctor(); - - target.ShouldBeType(); - } - - [Fact] - public void Create_ctor_should_throw_when_default_constructor_is_missing() - { - var type = typeof(NoDefaultConstructor); - new Action(()=>DelegateFactory.CreateCtor(type)).ShouldThrow(ex=> - { - ex.Message.ShouldStartWith(type.FullName); - }); - } - - public object CreateValueSource() - { - return new ValueSource(); - } - - public delegate void SetValueDelegate(ref ValueSource source, string value); - - private static void SetValue2(ref object thing, object value) - { - var source = ((ValueSource)thing); - source.Value = (string)value; - thing = source; - } - - private void SetValue(ref ValueSource thing, string value) - { - thing.Value = value; - } - - private void DoIt(object source, object value) - { - ((Source)source).Value2 = (int)value; - } - - private void DoIt4(object source, object value) - { - var valueSource = ((ValueSource)source); - valueSource.Value = (string)value; - } - - private void DoIt2(object source, object value) - { - int toSet = value == null ? default(int) : (int) value; - ((Source)source).Value = toSet; - } - - private void DoIt4(ref object source, object value) - { - var valueSource = (ValueSource) source; - valueSource.Value = (string) value; - } - - private static class Test - { - private static T DoIt() - { - return default(T); - } - } - - public class NoDefaultConstructor - { - public NoDefaultConstructor(int x) - { - } - } - - - public struct ValueSource - { - public string Value { get; set; } - } - - public interface ISource - { - int Value { get; set; } - } - - public class Source : ISource - { - public int Value { get; set; } - public int Value2; - public string Value3; - public string Value4 { get; set; } - } - } +using System; +using System.Linq.Expressions; +using System.Reflection; +using System.Reflection.Emit; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + using Execution; + + public class DelegateFactoryTests + { + internal delegate void DoIt3(ref ValueSource source, string value); + + private void SetValue(object thing, object value) + { + var source = ((ValueSource) thing); + source.Value = (string)value; + } + + [Fact] + public void Test_with_create_ctor() + { + var sourceType = typeof(Source); + + Func ctor = DelegateFactory.CreateCtor(sourceType); + + var target = ctor(); + + target.ShouldBeOfType(); + } + + [Fact] + public void Test_with_value_object_create_ctor() + { + var sourceType = typeof(ValueSource); + + Func ctor = DelegateFactory.CreateCtor(sourceType); + + var target = ctor(); + + target.ShouldBeOfType(); + } + + [Fact] + public void Create_ctor_should_throw_when_default_constructor_is_missing() + { + var type = typeof(NoDefaultConstructor); + new Action(()=>DelegateFactory.CreateCtor(type)()).ShouldThrowException(ex=> + { + ex.Message.ShouldStartWith(type.FullName); + }); + } + + public object CreateValueSource() + { + return new ValueSource(); + } + + public delegate void SetValueDelegate(ref ValueSource source, string value); + + private static void SetValue2(ref object thing, object value) + { + var source = ((ValueSource)thing); + source.Value = (string)value; + thing = source; + } + + private void SetValue(ref ValueSource thing, string value) + { + thing.Value = value; + } + + private void DoIt(object source, object value) + { + ((Source)source).Value2 = (int)value; + } + + private void DoIt4(object source, object value) + { + var valueSource = ((ValueSource)source); + valueSource.Value = (string)value; + } + + private void DoIt2(object source, object value) + { + int toSet = value == null ? default(int) : (int) value; + ((Source)source).Value = toSet; + } + + private void DoIt4(ref object source, object value) + { + var valueSource = (ValueSource) source; + valueSource.Value = (string) value; + } + + private static class Test + { + private static T DoIt() + { + return default(T); + } + } + + public class NoDefaultConstructor + { + public NoDefaultConstructor(int x) + { + } + } + + + public struct ValueSource + { + public string Value { get; set; } + } + + public interface ISource + { + int Value { get; set; } + } + + public class Source : ISource + { + public int Value { get; set; } + public int Value2; + public string Value3; + public string Value4 { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Internal/GenerateSimilarType.cs b/src/UnitTests/Internal/GenerateSimilarType.cs new file mode 100644 index 0000000000..4035350116 --- /dev/null +++ b/src/UnitTests/Internal/GenerateSimilarType.cs @@ -0,0 +1,71 @@ +using System.Linq; +using System.Collections.Generic; +using AutoMapper.Execution; +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests +{ + public class GenerateSimilarType + { + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + } + + class ExtraProduct : Product + { + public long Long { get; set; } + public short Short { get; set; } + public Article Article { get; set; } + } + + [Fact] + public void Should_work() + { + var extraProperties = typeof(ExtraProduct).GetProperties().Except(typeof(Product).GetProperties()).Select(p => new PropertyDescription(p)); + var similarType = ProxyGenerator.GetSimilarType(typeof(Product), extraProperties); + + similarType.Assembly().IsDynamic.ShouldBeTrue(); + var sourceProperties = GetProperties(typeof(ExtraProduct)); + var similarTypeProperties = GetProperties(similarType); + similarTypeProperties.SequenceEqual(sourceProperties).ShouldBeTrue(); + + dynamic instance = Activator.CreateInstance(similarType); + instance.Id = 12; + instance.Name = "John"; + instance.ECommercePublished = true; + instance.Short = short.MaxValue; + instance.Long = long.MaxValue; + var articles = new Article[] { new Article(), null, null }; + instance.Articles = articles; + instance.Article = articles[0]; + + Assert.Equal(12, instance.Id); + Assert.Equal("John", instance.Name); + Assert.Equal(true, instance.ECommercePublished); + Assert.Equal(short.MaxValue, instance.Short); + Assert.Equal(long.MaxValue, instance.Long); + Assert.Equal(articles, instance.Articles); + Assert.Equal(articles[0], instance.Article); + } + + public IEnumerable GetProperties(Type type) + { + return type.GetProperties().OrderBy(p => p.Name).Select(p => new { p.Name, p.PropertyType }); + } + } +} diff --git a/src/UnitTests/Internal/PrimitiveExtensionsTester.cs b/src/UnitTests/Internal/PrimitiveExtensionsTester.cs index 163d06afc5..21eabbe09c 100644 --- a/src/UnitTests/Internal/PrimitiveExtensionsTester.cs +++ b/src/UnitTests/Internal/PrimitiveExtensionsTester.cs @@ -1,36 +1,57 @@ using System.Collections; using System.Collections.Generic; +using AutoMapper.Configuration.Internal; using Xunit; -using Should; +using Shouldly; namespace AutoMapper.UnitTests { using Configuration; public class PrimitiveExtensionsTester - { - [Fact] - public void Should_not_flag_only_enumerable_type_as_writeable_collection() - { - typeof(string).IsListOrDictionaryType().ShouldBeFalse(); - } - - [Fact] - public void Should_flag_list_as_writable_collection() - { - typeof(int[]).IsListOrDictionaryType().ShouldBeTrue(); - } - - [Fact] - public void Should_flag_generic_list_as_writeable_collection() - { - typeof(List).IsListOrDictionaryType().ShouldBeTrue(); - } - - [Fact] - public void Should_flag_dictionary_as_writeable_collection() - { - typeof(Dictionary).IsListOrDictionaryType().ShouldBeTrue(); - } - } + { + interface Interface + { + int Value { get; } + } + + class DestinationClass : Interface + { + int Interface.Value { get { return 123; } } + + public int PrivateProperty { get; private set; } + + public int PublicProperty { get; set; } + } + + [Fact] + public void Should_find_explicitly_implemented_member() + { + PrimitiveHelper.GetFieldOrProperty(typeof(DestinationClass), "Value").ShouldNotBeNull(); + } + + [Fact] + public void Should_not_flag_only_enumerable_type_as_writeable_collection() + { + PrimitiveHelper.IsListOrDictionaryType(typeof(string)).ShouldBeFalse(); + } + + [Fact] + public void Should_flag_list_as_writable_collection() + { + PrimitiveHelper.IsListOrDictionaryType(typeof(int[])).ShouldBeTrue(); + } + + [Fact] + public void Should_flag_generic_list_as_writeable_collection() + { + PrimitiveHelper.IsListOrDictionaryType(typeof(List)).ShouldBeTrue(); + } + + [Fact] + public void Should_flag_dictionary_as_writeable_collection() + { + PrimitiveHelper.IsListOrDictionaryType(typeof(Dictionary)).ShouldBeTrue(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Internal/QueryMapperHelperTests.cs b/src/UnitTests/Internal/QueryMapperHelperTests.cs new file mode 100644 index 0000000000..579caa7311 --- /dev/null +++ b/src/UnitTests/Internal/QueryMapperHelperTests.cs @@ -0,0 +1,17 @@ +using System; +using Xunit; +using Shouldly; +using AutoMapper.QueryableExtensions.Impl; + +namespace AutoMapper.UnitTests +{ + public class QueryMapperHelperTests + { + [Fact] + public void Should_include_full_type_name_when_missing_map() + { + QueryMapperHelper.MissingMapException(typeof(QueryMapperHelperTests), typeof(QueryMapperHelperTests)) + .Message.ShouldStartWith("Missing map from "+typeof(QueryMapperHelperTests).FullName); + } + } +} diff --git a/src/UnitTests/Internationalization.cs b/src/UnitTests/Internationalization.cs index 8a0b701fdb..b5df2d91fc 100644 --- a/src/UnitTests/Internationalization.cs +++ b/src/UnitTests/Internationalization.cs @@ -1,45 +1,53 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace Internationalization - { - public class When_mapping_a_source_with_non_english_property_names : AutoMapperSpecBase - { - private OrderDto _result; - - public class Order - { - public Customer Customer { get; set; } - } - - public class Customer - { - public string { get; set; } - } - - public class OrderDto - { - public string Customer { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Order {Customer = new Customer { = "Bob"}}); - } - - [Fact] - public void Should_match_to_identical_property_name_on_destination() - { - _result.Customer.ShouldEqual("Bob"); - } - } - - } -} \ No newline at end of file +using Xunit; +using Shouldly; + + +namespace AutoMapper.UnitTests +{ + namespace Internationalization + { + public class When_mapping_a_source_with_non_english_property_names : AutoMapperSpecBase + { + private OrderDto _result; + + + public class Order + { + public Customer Customer { get; set; } + } + + + public class Customer + { + public string Æøå { get; set; } + } + + + public class OrderDto + { + public string CustomerÆøå { get; set; } + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + + protected override void Because_of() + { + _result = Mapper.Map(new Order { Customer = new Customer { Æøå = "Bob" } }); + } + + + [Fact] + public void Should_match_to_identical_property_name_on_destination() + { + _result.CustomerÆøå.ShouldBe("Bob"); + } + } + + + } +} diff --git a/src/UnitTests/MapToAttributeTest.cs b/src/UnitTests/MapToAttributeTest.cs index 26f76a9651..b77d0a89e9 100644 --- a/src/UnitTests/MapToAttributeTest.cs +++ b/src/UnitTests/MapToAttributeTest.cs @@ -1,6 +1,6 @@ using AutoMapper.Mappers; using AutoMapper.Configuration.Conventions; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests @@ -39,8 +39,8 @@ public void Sould_Map_MapToAttribute_To_Property_With_Matching_Name() Key = "MyKey" }; CategoryDto result = Mapper.Map(category); - result.Id.ShouldEqual("3"); - result.MyValueProperty.ShouldEqual("MyKey"); + result.Id.ShouldBe("3"); + result.MyValueProperty.ShouldBe("MyKey"); } } } \ No newline at end of file diff --git a/src/UnitTests/Mappers/ConvertMapperTests.cs b/src/UnitTests/Mappers/ConvertMapperTests.cs new file mode 100644 index 0000000000..a7d5442059 --- /dev/null +++ b/src/UnitTests/Mappers/ConvertMapperTests.cs @@ -0,0 +1,55 @@ +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Mappers +{ + public class ConvertMapperTests : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(c => { }); + + [Fact] + public void A_few_cases() + { + Mapper.Map(1).ShouldBeTrue(); + Mapper.Map(0).ShouldBeFalse(); + Mapper.Map(1).Value.ShouldBeTrue(); + Mapper.Map(0).Value.ShouldBeFalse(); + Mapper.Map(12).ShouldBe((ulong)12); + Mapper.Map(12).ShouldBe((ulong)12); + Mapper.Map(true).ShouldBe((byte)1); + Mapper.Map(false).ShouldBe((byte)0); + Mapper.Map(true).ShouldBe((byte)1); + Mapper.Map(false).ShouldBe((byte)0); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + Mapper.Map(12).ShouldBe(12); + } + + [Fact] + public void From_string() + { + Mapper.Map("12").ShouldBe((byte)12); + Mapper.Map("12").ShouldBe((sbyte)12); + Mapper.Map("12").ShouldBe(12); + Mapper.Map("12").ShouldBe(12); + Mapper.Map("12").ShouldBe(12); + Mapper.Map("12").ShouldBe((ushort)12); + Mapper.Map("12").ShouldBe((ulong)12); + } + + [Fact] + public void From_null_string_to_nullable_int() + { + Mapper.Map(null).ShouldBeNull(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Mappers/CustomMapperTests.cs b/src/UnitTests/Mappers/CustomMapperTests.cs index 175e6b10a8..3ed859ff93 100644 --- a/src/UnitTests/Mappers/CustomMapperTests.cs +++ b/src/UnitTests/Mappers/CustomMapperTests.cs @@ -1,63 +1,181 @@ -namespace AutoMapper.UnitTests.Mappers -{ - namespace CustomMapperTests - { - using AutoMapper.Mappers; - using Xunit; - - public class When_adding_a_custom_mapper : NonValidatingSpecBase - { - public When_adding_a_custom_mapper() - { - MapperRegistry.Mappers.Insert(0, new TestObjectMapper()); - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Destination, opt => opt.MapFrom(src => src.Source)); - }); - - [Fact] - public void Should_have_valid_configuration() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - - - public class TestObjectMapper : IObjectMapper - { - public object Map(ResolutionContext context) - { - return new DestinationType(); - } - - public bool IsMatch(TypePair context) - { - return context.SourceType == typeof(SourceType) && context.DestinationType == typeof(DestinationType); - } - } - - public class ClassA - { - public SourceType Source { get; set; } - } - - public class ClassB - { - public DestinationType Destination { get; set; } - } - - public class SourceType - { - public int Value { get; set; } - } - - public class DestinationType - { - public bool Value { get; set; } - } - } - - } +using System; +using Shouldly; +using System.Linq; +using System.Linq.Expressions; +using AutoMapper; +using AutoMapper.Mappers; +using Xunit; + +namespace AutoMapper.UnitTests.Mappers +{ + public class When_adding_a_custom_mapper : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Destination, opt => opt.MapFrom(src => src.Source)); + cfg.Mappers.Add(new TestObjectMapper()); + }); + + [Fact] + public void Should_have_valid_configuration() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + + + public class TestObjectMapper : IObjectMapper + { + public object Map(ResolutionContext context) + { + return new DestinationType(); + } + + public bool IsMatch(TypePair context) + { + return context.SourceType == typeof(SourceType) && context.DestinationType == typeof(DestinationType); + } + + public Expression MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, + IMemberMap memberMap, + Expression sourceExpression, Expression destExpression, Expression contextExpression) + { + Expression> expr = () => new DestinationType(); + + return expr.Body; + } + } + + public class ClassA + { + public SourceType Source { get; set; } + } + + public class ClassB + { + public DestinationType Destination { get; set; } + } + + public class SourceType + { + public int Value { get; set; } + } + + public class DestinationType + { + public bool Value { get; set; } + } + } + + public class When_adding_a_simple_custom_mapper : AutoMapperSpecBase + { + ClassB _destination; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Destination, opt => opt.MapFrom(src => src.Source)); + cfg.Mappers.Add(new TestObjectMapper()); + }); + + protected override void Because_of() + { + _destination = new ClassB { Destination = new DestinationType() }; + Mapper.Map(new ClassA { Source = new SourceType() }, _destination); + } + + [Fact] + public void Should_use_the_object_mapper() + { + _destination.Destination.ShouldBeSameAs(TestObjectMapper.Instance); + } + + public class TestObjectMapper : ObjectMapper + { + public static DestinationType Instance = new DestinationType(); + + public override DestinationType Map(SourceType source, DestinationType destination, Type sourceType, Type destinationType, ResolutionContext context) + { + source.ShouldNotBeNull(); + destination.ShouldNotBeNull(); + context.ShouldNotBeNull(); + sourceType.ShouldBe(typeof(SourceType)); + destinationType.ShouldBe(typeof(DestinationType)); + return Instance; + } + + public override bool IsMatch(TypePair context) + { + return context.SourceType == typeof(SourceType) && context.DestinationType == typeof(DestinationType); + } + } + + public class ClassA + { + public SourceType Source { get; set; } + } + + public class ClassB + { + public DestinationType Destination { get; set; } + } + + public class SourceType + { + public int Value { get; set; } + } + + public class DestinationType + { + public bool Value { get; set; } + } + } + + public class When_adding_an_object_based_custom_mapper : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public ConsoleColor? Color { get; set; } + } + + class Destination + { + public string Color { get; set; } + } + + class EnumMapper : ObjectMapper + { + public override bool IsMatch(TypePair types) + { + var underlyingType = Nullable.GetUnderlyingType(types.SourceType) ?? types.SourceType; + return underlyingType.IsEnum() && types.DestinationType == typeof(string); + } + + public override string Map(object source, string destination, Type sourceType, Type destinationType, ResolutionContext context) + { + sourceType.ShouldBe(typeof(ConsoleColor?)); + destinationType.ShouldBe(typeof(string)); + return "Test"; + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.Mappers.Insert(0, new EnumMapper()); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Color = ConsoleColor.Black }); + } + + [Fact] + public void Should_map_with_underlying_type() + { + _destination.Color.ShouldBe("Test"); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Mappers/DynamicMapperTests.cs b/src/UnitTests/Mappers/DynamicMapperTests.cs index d7c8645903..13d09d8f7d 100644 --- a/src/UnitTests/Mappers/DynamicMapperTests.cs +++ b/src/UnitTests/Mappers/DynamicMapperTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Dynamic; -using Should; -using Should.Core.Assertions; +using System.Linq; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Mappers.Dynamic @@ -10,6 +10,9 @@ class Destination { public string Foo { get; set; } public string Bar { get; set; } + internal string Jack { get; set; } + public int[] Data { get; set; } + public int Baz { get; set; } } public class DynamicDictionary : DynamicObject @@ -26,6 +29,30 @@ public override bool TrySetMember(SetMemberBinder binder, object value) dictionary[binder.Name] = value; return true; } + + public int Count => dictionary.Count; + } + + public class When_mapping_to_dynamic_from_getter_only_property + { + class Source + { + public Source() + { + Value = 24; + } + + public int Value { get; } + } + + [Fact] + public void Should_map_source_properties() + { + var config = new MapperConfiguration(cfg => { }); + dynamic destination = config.CreateMapper().Map(new Source()); + ((int)destination.Count).ShouldBe(1); + Assert.Equal(24, destination.Value); + } } public class When_mapping_to_dynamic @@ -36,9 +63,13 @@ public class When_mapping_to_dynamic public void Should_map_source_properties() { var config = new MapperConfiguration(cfg => { }); - _destination = config.CreateMapper().Map(new Destination {Foo = "Foo", Bar = "Bar"}); + var data = new[] { 1, 2, 3 }; + _destination = config.CreateMapper().Map(new Destination { Foo = "Foo", Bar = "Bar", Data = data, Baz = 12 }); + ((int)_destination.Count).ShouldBe(4); Assert.Equal("Foo", _destination.Foo); Assert.Equal("Bar", _destination.Bar); + Assert.Equal(12, _destination.Baz); + ((int[])_destination.Data).SequenceEqual(data).ShouldBeTrue(); } } @@ -52,10 +83,38 @@ public void Should_map_destination_properties() dynamic source = new DynamicDictionary(); source.Foo = "Foo"; source.Bar = "Bar"; + source.Jack = "Jack"; var config = new MapperConfiguration(cfg => { }); _destination = config.CreateMapper().Map(source); - _destination.Foo.ShouldEqual("Foo"); - _destination.Bar.ShouldEqual("Bar"); + _destination.Foo.ShouldBe("Foo"); + _destination.Bar.ShouldBe("Bar"); + _destination.Jack.ShouldBeNull(); + } + } + + public class When_mapping_struct_from_dynamic + { + Destination _destination; + + struct Destination + { + public string Foo { get; set; } + public string Bar { get; set; } + internal string Jack { get; set; } + } + + [Fact] + public void Should_map_destination_properties() + { + dynamic source = new DynamicDictionary(); + source.Foo = "Foo"; + source.Bar = "Bar"; + source.Jack = "Jack"; + var config = new MapperConfiguration(cfg => { }); + _destination = config.CreateMapper().Map(source); + _destination.Foo.ShouldBe("Foo"); + _destination.Bar.ShouldBe("Bar"); + _destination.Jack.ShouldBeNull(); } } @@ -70,8 +129,26 @@ public void Should_map_existing_properties() source.Foo = "Foo"; var config = new MapperConfiguration(cfg => { }); _destination = config.CreateMapper().Map(source); - _destination.Foo.ShouldEqual("Foo"); + _destination.Foo.ShouldBe("Foo"); + _destination.Bar.ShouldBeNull(); + } + } + + public class When_mapping_from_dynamic_null_to_int + { + Destination _destination; + + [Fact] + public void Should_map_to_zero() + { + dynamic source = new DynamicDictionary(); + source.Foo = "Foo"; + source.Baz = null; + var config = new MapperConfiguration(cfg => { }); + _destination = config.CreateMapper().Map(source); + _destination.Foo.ShouldBe("Foo"); _destination.Bar.ShouldBeNull(); + _destination.Baz.ShouldBe(0); } } @@ -91,4 +168,48 @@ public void Should_map() Assert.Equal("Bar", _destination.Bar); } } + + public class When_mapping_from_dynamic_to_nullable + { + class DestinationWithNullable + { + public string StringValue { get; set; } + public int? NullIntValue { get; set; } + } + + [Fact] + public void Should_map_with_non_null_source() + { + dynamic source = new DynamicDictionary(); + source.StringValue = "Test"; + source.NullIntValue = 5; + var config = new MapperConfiguration(cfg => { }); + var destination = config.CreateMapper().Map(source); + Assert.Equal("Test", destination.StringValue); + Assert.Equal(5, destination.NullIntValue); + } + + [Fact] + public void Should_map_with_source_missing() + { + dynamic source = new DynamicDictionary(); + source.StringValue = "Test"; + var config = new MapperConfiguration(cfg => { }); + var destination = config.CreateMapper().Map(source); + Assert.Equal("Test", destination.StringValue); + Assert.Equal((int?)null, destination.NullIntValue); + } + + [Fact] + public void Should_map_with_null_source() + { + dynamic source = new DynamicDictionary(); + source.StringValue = "Test"; + source.NullIntValue = null; + var config = new MapperConfiguration(cfg => { }); + var destination = config.CreateMapper().Map(source); + Assert.Equal("Test", destination.StringValue); + Assert.Equal((int?)null, destination.NullIntValue); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Mappers/NameValueCollectionMapperTests.cs b/src/UnitTests/Mappers/NameValueCollectionMapperTests.cs index 7dc1ac4056..12a40a14ea 100644 --- a/src/UnitTests/Mappers/NameValueCollectionMapperTests.cs +++ b/src/UnitTests/Mappers/NameValueCollectionMapperTests.cs @@ -1,96 +1,88 @@ -#if !PORTABLE -using System; -using System.Collections.Specialized; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Mappers -{ - public class NameValueCollectionMapperTests - { - public class IsMatch - { - [Fact] - public void ReturnsTrueWhenBothSourceAndDestinationTypesAreNameValueCollection() - { - var tp = new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)); - var nvcm = new NameValueCollectionMapper(); - - var result = nvcm.IsMatch(tp); - - result.ShouldBeTrue(); - } - - [Fact] - public void ReturnsIsFalseWhenDestinationTypeIsNotNameValueCollection() - { - var tp = new TypePair(typeof(NameValueCollection), typeof(Object)); - var nvcm = new NameValueCollectionMapper(); - - var result = nvcm.IsMatch(tp); - - result.ShouldBeFalse(); - } - - [Fact] - public void ReturnsIsFalseWhenSourceTypeIsNotNameValueCollection() - { - var tp = new TypePair(typeof(Object), typeof(NameValueCollection)); - var nvcm = new NameValueCollectionMapper(); - - var result = nvcm.IsMatch(tp); - - result.ShouldBeFalse(); - } - } - public class Map - { - [Fact] - public void ReturnsNullIfSourceValueIsNull() - { - var config = new MapperConfiguration(_ => { }); - var mapper = new Mapper(config); - var rc = new ResolutionContext(null, new NameValueCollection(), new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)), new MappingOperationOptions(config.ServiceCtor), mapper); - var nvcm = new NameValueCollectionMapper(); - - var result = nvcm.Map(rc); - - result.ShouldBeNull(); - } - - [Fact] - public void ReturnsEmptyCollectionWhenSourceCollectionIsEmpty() - { - var config = new MapperConfiguration(_ => { }); - var mapper = new Mapper(config); - var sourceValue = new NameValueCollection(); - var rc = new ResolutionContext(sourceValue, null, new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)), new MappingOperationOptions(config.ServiceCtor), mapper); - var nvcm = new NameValueCollectionMapper(); - - var result = nvcm.Map(rc) as NameValueCollection; - - result.ShouldBeEmpty(); - } - - [Fact] - public void ReturnsMappedObjectWithExpectedValuesWhenSourceCollectionHasOneItem() - { - var config = new MapperConfiguration(_ => { }); - var mapper = new Mapper(config); - var sourceValue = new NameValueCollection() { { "foo", "bar" } }; - var rc = new ResolutionContext(sourceValue, new NameValueCollection(), new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)), new MappingOperationOptions(config.ServiceCtor), mapper); - - var nvcm = new NameValueCollectionMapper(); - - var result = nvcm.Map(rc) as NameValueCollection; - - 1.ShouldEqual(result.Count); - "foo".ShouldEqual(result.AllKeys[0]); - "bar".ShouldEqual(result["foo"]); - } - } - - } -} -#endif \ No newline at end of file +using System; +using System.Collections.Specialized; +using AutoMapper.Mappers; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Mappers +{ + public class NameValueCollectionMapperTests + { + public class IsMatch + { + [Fact] + public void ReturnsTrueWhenBothSourceAndDestinationTypesAreNameValueCollection() + { + var tp = new TypePair(typeof(NameValueCollection), typeof(NameValueCollection)); + var nvcm = new NameValueCollectionMapper(); + + var result = nvcm.IsMatch(tp); + + result.ShouldBeTrue(); + } + + [Fact] + public void ReturnsIsFalseWhenDestinationTypeIsNotNameValueCollection() + { + var tp = new TypePair(typeof(NameValueCollection), typeof(Object)); + var nvcm = new NameValueCollectionMapper(); + + var result = nvcm.IsMatch(tp); + + result.ShouldBeFalse(); + } + + [Fact] + public void ReturnsIsFalseWhenSourceTypeIsNotNameValueCollection() + { + var tp = new TypePair(typeof(Object), typeof(NameValueCollection)); + var nvcm = new NameValueCollectionMapper(); + + var result = nvcm.IsMatch(tp); + + result.ShouldBeFalse(); + } + } + public class Map + { + [Fact] + public void ReturnsTheDestinationWhenPassedOne() + { + var config = new MapperConfiguration(_ => { }); + IMapper mapper = new Mapper(config); + + var destination = new NameValueCollection(); + + var result = mapper.Map((NameValueCollection)null, destination); + + result.ShouldBeSameAs(destination); + } + + [Fact] + public void ReturnsEmptyCollectionWhenSourceCollectionIsEmpty() + { + var config = new MapperConfiguration(_ => { }); + IMapper mapper = new Mapper(config); + + var result = mapper.Map(new NameValueCollection(), (NameValueCollection)null); + + result.ShouldBeEmpty(); + } + + [Fact] + public void ReturnsMappedObjectWithExpectedValuesWhenSourceCollectionHasOneItem() + { + var config = new MapperConfiguration(_ => { }); + IMapper mapper = new Mapper(config); + var sourceValue = new NameValueCollection() { { "foo", "bar" } }; + + var result = mapper.Map(sourceValue, new NameValueCollection()); + + 1.ShouldBe(result.Count); + "foo".ShouldBe(result.AllKeys[0]); + "bar".ShouldBe(result["foo"]); + } + } + + } +} diff --git a/src/UnitTests/Mappers/ReadOnlyCollectionMapperTests.cs b/src/UnitTests/Mappers/ReadOnlyCollectionMapperTests.cs index ac2aeec420..5268780647 100644 --- a/src/UnitTests/Mappers/ReadOnlyCollectionMapperTests.cs +++ b/src/UnitTests/Mappers/ReadOnlyCollectionMapperTests.cs @@ -1,182 +1,296 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Mappers -{ - public class ReadOnlyCollectionMapperTests - { - SourceAsEnumerable _sourceAsEnumerable; - private IMapper _mapper; - - public ReadOnlyCollectionMapperTests() - { - SetUp(); - } - public void SetUp() - { - _sourceAsEnumerable = new SourceAsEnumerable() - { - ValueInt = new List() { 1, 2, 3 }, - ValueString = new List() { "a", "b", "c" }, - ValueIUser = new List() { new UserSource("z", 21) }, - ValueUser = new List() { new UserSource("y", 20), new UserSource("x", 19) }, - }; - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); - }); - _mapper = config.CreateMapper(); - } - - [Fact] - public void should_map_to_ReadOnlyCollection_when_destination_properties_are_null() - { - var destination = _mapper.Map(_sourceAsEnumerable); - - destination.ShouldNotBeNull(); - _sourceAsEnumerable.ValueInt.Count().ShouldEqual(destination.ValueInt.Count()); - foreach (var item in _sourceAsEnumerable.ValueInt) - { - destination.ValueInt.Contains(item).ShouldBeTrue(); - } - - _sourceAsEnumerable.ValueString.Count().ShouldEqual(destination.ValueString.Count()); - foreach (var item in _sourceAsEnumerable.ValueString) - { - destination.ValueString.Contains(item).ShouldBeTrue(); - } - - _sourceAsEnumerable.ValueUser.Count().ShouldEqual(destination.ValueUser.Count()); - for (int i = 0; i < _sourceAsEnumerable.ValueUser.Count(); i++) - { - _sourceAsEnumerable.ValueUser.ElementAt(i).Name.ShouldEqual(destination.ValueUser.ElementAt(i).Name); - } - - _sourceAsEnumerable.ValueIUser.Count().ShouldEqual(destination.ValueIUser.Count()); - for (int i = 0; i < _sourceAsEnumerable.ValueIUser.Count(); i++) - { - _sourceAsEnumerable.ValueIUser.ElementAt(i).Name.ShouldEqual(destination.ValueIUser.ElementAt(i).Name); - _sourceAsEnumerable.ValueIUser.ElementAt(i).Age.ShouldEqual(destination.ValueIUser.ElementAt(i).Age); - } - - } - - [Fact] - public void should_replace_ReadOnlyCollection_when_destination_properties_are_not_null() - { - var destination = _mapper.Map(_sourceAsEnumerable); - - destination.ShouldNotBeNull(); - _sourceAsEnumerable.ValueInt.Count().ShouldEqual(destination.ValueInt.Count()); - foreach (var item in _sourceAsEnumerable.ValueInt) - { - destination.ValueInt.Contains(item).ShouldBeTrue(); - } - - _sourceAsEnumerable.ValueString.Count().ShouldEqual(destination.ValueString.Count()); - foreach (var item in _sourceAsEnumerable.ValueString) - { - destination.ValueString.Contains(item).ShouldBeTrue(); - } - - for (int i = 0; i < _sourceAsEnumerable.ValueUser.Count(); i++) - { - _sourceAsEnumerable.ValueUser.ElementAt(i).Name.ShouldEqual(destination.ValueUser.ElementAt(i).Name); - } - - _sourceAsEnumerable.ValueIUser.Count().ShouldEqual(destination.ValueIUser.Count()); - for (int i = 0; i < _sourceAsEnumerable.ValueIUser.Count(); i++) - { - _sourceAsEnumerable.ValueIUser.ElementAt(i).Name.ShouldEqual(destination.ValueIUser.ElementAt(i).Name); - _sourceAsEnumerable.ValueIUser.ElementAt(i).Age.ShouldEqual(destination.ValueIUser.ElementAt(i).Age); - } - } - - [Fact] - public void should_set_ReadOnlyCollection_underlying_all_IReadOnlyList() - { - var destination = _mapper.Map(_sourceAsEnumerable); - - destination.ShouldNotBeNull(); - destination.ValueIUser.ShouldBeType>(); - } - - [Fact] - public void should_set_ReadOnlyCollection_underlying_all_IReadOnlyCollection() - { - var destination = _mapper.Map(_sourceAsEnumerable); - - destination.ShouldNotBeNull(); - destination.ValueUser.ShouldBeType>(); - } - - - public class SourceAsEnumerable - { - public IEnumerable ValueInt { get; set; } - public IEnumerable ValueString { get; set; } - public IEnumerable ValueUser { get; set; } - public IEnumerable ValueIUser { get; set; } - } - - public class DestinationAsReadOnlyCollectionNull - { - public ReadOnlyCollection ValueInt { get; set; } - public ReadOnlyCollection ValueString { get; set; } - public ReadOnlyCollection ValueUser { get; set; } - public ReadOnlyCollection ValueIUser { get; set; } - } - - public class DestinationAsReadOnlyCollectionNotNull - { - public DestinationAsReadOnlyCollectionNotNull() - { - ValueInt = new ReadOnlyCollection(new List()); - ValueString = new ReadOnlyCollection(new List()); - ValueUser = new ReadOnlyCollection(new List()); - ValueIUser = new ReadOnlyCollection(new List()); - } - - public ReadOnlyCollection ValueInt { get; set; } - public ReadOnlyCollection ValueString { get; set; } - public ReadOnlyCollection ValueUser { get; set; } - public ReadOnlyCollection ValueIUser { get; set; } - } - - public interface IUser - { - string Name { get; set; } - int Age { get; set; } - } - - public class UserSource : IUser - { - public UserSource() - { - - } - - public UserSource(string name, int age) - { - Name = name; - ((IUser)this).Age = age; - } - - public string Name { get; set; } - int IUser.Age { get; set; } - } - - public class UserDestination : IUser - { - public string Name { get; set; } - int IUser.Age { get; set; } - } - } +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Mappers +{ + namespace ReadOnlyCollections + { + public class When_mapping_to_interface_readonly_collection : AutoMapperSpecBase + { + public class Source + { + public IReadOnlyCollection Values { get; set; } + } + + public class Destination + { + public IReadOnlyCollection Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => + { + config.CreateMap(); + }); + + [Fact] + public void Should_map_readonly_values() + { + var source = new Source + { + Values = new List + { + 1, + 2, + 3, + 4, + } + }; + + var dest = Mapper.Map(source); + + dest.Values.Count.ShouldBe(4); + } + } + + public class When_mapping_to_concrete_readonly_collection : AutoMapperSpecBase + { + public class Source + { + public ReadOnlyCollection Values { get; set; } + } + + public class Destination + { + public ReadOnlyCollection Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => + { + config.CreateMap(); + }); + + [Fact] + public void Should_map_readonly_values() + { + var source = new Source + { + Values = new ReadOnlyCollection(new List + { + 1, + 2, + 3, + 4, + }) + }; + + var dest = Mapper.Map(source); + + dest.Values.Count.ShouldBe(4); + } + } + + public class When_mapping_to_interface_readonly_list : AutoMapperSpecBase + { + public class Source + { + public IReadOnlyList Values { get; set; } + } + + public class Destination + { + public IReadOnlyList Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => + { + config.CreateMap(); + }); + + [Fact] + public void Should_map_readonly_values() + { + var source = new Source + { + Values = new List + { + 1, + 2, + 3, + 4, + } + }; + + var dest = Mapper.Map(source); + + dest.Values.Count.ShouldBe(4); + } + } + + public class ReadOnlyCollectionMapperTests + { + readonly SourceAsEnumerable _sourceAsEnumerable; + private readonly IMapper _mapper; + + public ReadOnlyCollectionMapperTests() + { + _sourceAsEnumerable = new SourceAsEnumerable() + { + ValueInt = new List() {1, 2, 3}, + ValueString = new List() {"a", "b", "c"}, + ValueIUser = new List() {new UserSource("z", 21)}, + ValueUser = new List() {new UserSource("y", 20), new UserSource("x", 19)}, + }; + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + _mapper = config.CreateMapper(); + } + + [Fact] + public void should_map_to_ReadOnlyCollection_when_destination_properties_are_null() + { + var destination = + _mapper.Map(_sourceAsEnumerable); + + destination.ShouldNotBeNull(); + _sourceAsEnumerable.ValueInt.Count().ShouldBe(destination.ValueInt.Count()); + foreach (var item in _sourceAsEnumerable.ValueInt) + { + destination.ValueInt.Contains(item).ShouldBeTrue(); + } + + _sourceAsEnumerable.ValueString.Count().ShouldBe(destination.ValueString.Count()); + foreach (var item in _sourceAsEnumerable.ValueString) + { + destination.ValueString.Contains(item).ShouldBeTrue(); + } + + _sourceAsEnumerable.ValueUser.Count().ShouldBe(destination.ValueUser.Count()); + for (int i = 0; i < _sourceAsEnumerable.ValueUser.Count(); i++) + { + _sourceAsEnumerable.ValueUser.ElementAt(i).Name.ShouldBe(destination.ValueUser.ElementAt(i).Name); + } + + _sourceAsEnumerable.ValueIUser.Count().ShouldBe(destination.ValueIUser.Count()); + for (int i = 0; i < _sourceAsEnumerable.ValueIUser.Count(); i++) + { + _sourceAsEnumerable.ValueIUser.ElementAt(i).Name.ShouldBe(destination.ValueIUser.ElementAt(i).Name); + _sourceAsEnumerable.ValueIUser.ElementAt(i).Age.ShouldBe(destination.ValueIUser.ElementAt(i).Age); + } + + } + + [Fact] + public void should_replace_ReadOnlyCollection_when_destination_properties_are_not_null() + { + var destination = + _mapper.Map(_sourceAsEnumerable); + + destination.ShouldNotBeNull(); + _sourceAsEnumerable.ValueInt.Count().ShouldBe(destination.ValueInt.Count()); + foreach (var item in _sourceAsEnumerable.ValueInt) + { + destination.ValueInt.Contains(item).ShouldBeTrue(); + } + + _sourceAsEnumerable.ValueString.Count().ShouldBe(destination.ValueString.Count()); + foreach (var item in _sourceAsEnumerable.ValueString) + { + destination.ValueString.Contains(item).ShouldBeTrue(); + } + + for (int i = 0; i < _sourceAsEnumerable.ValueUser.Count(); i++) + { + _sourceAsEnumerable.ValueUser.ElementAt(i).Name.ShouldBe(destination.ValueUser.ElementAt(i).Name); + } + + _sourceAsEnumerable.ValueIUser.Count().ShouldBe(destination.ValueIUser.Count()); + for (int i = 0; i < _sourceAsEnumerable.ValueIUser.Count(); i++) + { + _sourceAsEnumerable.ValueIUser.ElementAt(i).Name.ShouldBe(destination.ValueIUser.ElementAt(i).Name); + _sourceAsEnumerable.ValueIUser.ElementAt(i).Age.ShouldBe(destination.ValueIUser.ElementAt(i).Age); + } + } + + [Fact] + public void should_set_ReadOnlyCollection_underlying_all_IReadOnlyList() + { + var destination = + _mapper.Map(_sourceAsEnumerable); + + destination.ShouldNotBeNull(); + destination.ValueIUser.ShouldBeOfType>(); + } + + [Fact] + public void should_set_ReadOnlyCollection_underlying_all_IReadOnlyCollection() + { + var destination = + _mapper.Map(_sourceAsEnumerable); + + destination.ShouldNotBeNull(); + destination.ValueUser.ShouldBeOfType>(); + } + + + public class SourceAsEnumerable + { + public IEnumerable ValueInt { get; set; } + public IEnumerable ValueString { get; set; } + public IEnumerable ValueUser { get; set; } + public IEnumerable ValueIUser { get; set; } + } + + public class DestinationAsReadOnlyCollectionNull + { + public ReadOnlyCollection ValueInt { get; set; } + public ReadOnlyCollection ValueString { get; set; } + public ReadOnlyCollection ValueUser { get; set; } + public ReadOnlyCollection ValueIUser { get; set; } + } + + public class DestinationAsReadOnlyCollectionNotNull + { + public DestinationAsReadOnlyCollectionNotNull() + { + ValueInt = new ReadOnlyCollection(new List()); + ValueString = new ReadOnlyCollection(new List()); + ValueUser = new ReadOnlyCollection(new List()); + ValueIUser = new ReadOnlyCollection(new List()); + } + + public ReadOnlyCollection ValueInt { get; set; } + public ReadOnlyCollection ValueString { get; set; } + public ReadOnlyCollection ValueUser { get; set; } + public ReadOnlyCollection ValueIUser { get; set; } + } + + public interface IUser + { + string Name { get; set; } + int Age { get; set; } + } + + public class UserSource : IUser + { + public UserSource() + { + + } + + public UserSource(string name, int age) + { + Name = name; + ((IUser) this).Age = age; + } + + public string Name { get; set; } + int IUser.Age { get; set; } + } + + public class UserDestination : IUser + { + public string Name { get; set; } + int IUser.Age { get; set; } + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Mappers/ReadOnlyDictionaryMapperTests.cs b/src/UnitTests/Mappers/ReadOnlyDictionaryMapperTests.cs new file mode 100644 index 0000000000..f0ccfa6a10 --- /dev/null +++ b/src/UnitTests/Mappers/ReadOnlyDictionaryMapperTests.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Mappers.ReadOnlyDictionaryMapper +{ + public class When_mapping_to_interface_readonly_dictionary : AutoMapperSpecBase + { + public class Source + { + public IReadOnlyDictionary Values { get; set; } + } + + public class Destination + { + public IReadOnlyDictionary Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => + { + config.CreateMap(); + }); + + [Fact] + public void Should_map_readonly_values() + { + var values = new Dictionary + { + {1, 1}, + {2, 2}, + {3, 3}, + {4, 4}, + }; + var source = new Source + { + Values = values + }; + + var dest = Mapper.Map(source); + + dest.Values.ShouldBe(values); + } + } + public class When_mapping_to_concrete_readonly_dictionary : AutoMapperSpecBase + { + public class Source + { + public ReadOnlyDictionary Values { get; set; } + } + + public class Destination + { + public ReadOnlyDictionary Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(config => + { + config.CreateMap(); + }); + + [Fact] + public void Should_map_readonly_values() + { + var values = new Dictionary + { + {1, 1}, + {2, 2}, + {3, 3}, + {4, 4}, + }; + var source = new Source + { + Values = new ReadOnlyDictionary(values) + }; + + var dest = Mapper.Map(source); + + dest.Values.ShouldBe(values); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/Mappers/StringDictionaryMapperTests.cs b/src/UnitTests/Mappers/StringDictionaryMapperTests.cs index 94b5f5ed41..7c7af6233b 100644 --- a/src/UnitTests/Mappers/StringDictionaryMapperTests.cs +++ b/src/UnitTests/Mappers/StringDictionaryMapperTests.cs @@ -1,4 +1,5 @@ -using Should; +using System; +using Shouldly; using Xunit; using StringDictionary = System.Collections.Generic.Dictionary; @@ -8,6 +9,7 @@ class Destination { public string Foo { get; set; } public string Bar { get; set; } + public int Baz { get; set; } } public class When_mapping_to_StringDictionary : NonValidatingSpecBase @@ -24,8 +26,8 @@ protected override void Because_of() [Fact] public void Should_map_source_properties() { - _destination["Foo"].ShouldEqual("Foo"); - _destination["Bar"].ShouldEqual("Bar"); + _destination["Foo"].ShouldBe("Foo"); + _destination["Bar"].ShouldBe("Bar"); } } @@ -44,8 +46,35 @@ protected override void Because_of() [Fact] public void Should_map_destination_properties() { - _destination.Foo.ShouldEqual("Foo"); - _destination.Bar.ShouldEqual("Bar"); + _destination.Foo.ShouldBe("Foo"); + _destination.Bar.ShouldBe("Bar"); + _destination.Baz.ShouldBe(0); + } + } + + public class When_mapping_struct_from_StringDictionary : NonValidatingSpecBase + { + Destination _destination; + + struct Destination + { + public string Foo { get; set; } + public string Bar { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + protected override void Because_of() + { + var source = new StringDictionary() { { "Foo", "Foo" }, { "Bar", "Bar" } }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_destination_properties() + { + _destination.Foo.ShouldBe("Foo"); + _destination.Bar.ShouldBe("Bar"); } } @@ -64,8 +93,30 @@ protected override void Because_of() [Fact] public void Should_map_existing_properties() { - _destination.Foo.ShouldEqual("Foo"); + _destination.Foo.ShouldBe("Foo"); + _destination.Bar.ShouldBeNull(); + _destination.Baz.ShouldBe(0); + } + } + + public class When_mapping_from_StringDictionary_null_to_int : NonValidatingSpecBase + { + Destination _destination; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); + + protected override void Because_of() + { + var source = new StringDictionary() { { "Foo", "Foo" }, { "Baz", null } }; + _destination = Mapper.Map(source); + } + + [Fact] + public void Should_map_to_zero() + { + _destination.Foo.ShouldBe("Foo"); _destination.Bar.ShouldBeNull(); + _destination.Baz.ShouldBe(0); } } @@ -84,8 +135,123 @@ protected override void Because_of() [Fact] public void Should_map() { - _destination["Foo"].ShouldEqual("Foo"); - _destination["Bar"].ShouldEqual("Bar"); + _destination["Foo"].ShouldBe("Foo"); + _destination["Bar"].ShouldBe("Bar"); + } + } + + public class When_mapping_from_StringDictionary_to_existing_destination : AutoMapperSpecBase + { + public abstract class SomeBase + { + protected int _x = 100; + public abstract int X { get; } + protected int _y = 200; + public abstract int Y { get; } + } + + public class SomeBody : SomeBase + { + public override int X { get { return _x + 10; } } + + public override int Y { get { return _y + 20; } } + private int _z = 300; + public int Z { get { return _z + 30; } } + public int Value { get; set; } + } + + public class SomeOne : SomeBase + { + public override int X { get { return _x - 10; } } + + public override int Y { get { return _y - 20; } } + private int _a = 300; + public int A { get { return _a - 30; } } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => c.CreateMap()); + + [Fact] + public void Should_map_ok() + { + SomeBase someBase = new SomeBody(); + var someOne = new StringDictionary(); + + Mapper.Map(someOne, someBase); + } + + public class Destination + { + public DateTime? NullableDate { get; set; } + public int? NullableInt { get; set; } + public int Int { get; set; } + public SomeBody SomeBody { get; set; } = new SomeBody { Value = 15 }; + public SomeOne SomeOne { get; set; } = new SomeOne(); + public string String { get; set; } = "value"; + } + + [Fact] + public void Should_override_existing_values() + { + var source = new StringDictionary(); + source["Int"] = 10; + source["NullableDate"] = null; + source["NullableInt"] = null; + source["String"] = null; + source["SomeBody"] = new SomeOne(); + source["SomeOne"] = null; + var destination = new Destination { NullableInt = 1, NullableDate = DateTime.Now }; + var someBody = destination.SomeBody; + + Mapper.Map(source, destination); + + destination.Int.ShouldBe(10); + destination.NullableInt.ShouldBeNull(); + destination.NullableDate.ShouldBeNull(); + destination.SomeBody.ShouldBe(someBody); + destination.SomeBody.Value.ShouldBe(15); + destination.String.ShouldBeNull(); + destination.SomeOne.ShouldBeNull(); + } + } + + public class When_mapping_from_StringDictionary_to_abstract_type : AutoMapperSpecBase + { + public abstract class SomeBase + { + protected int _x = 100; + public abstract int X { get; } + protected int _y = 200; + public abstract int Y { get; } + } + + public class SomeBody : SomeBase + { + public override int X { get { return _x + 10; } } + + public override int Y { get { return _y + 20; } } + private int _z = 300; + public int Z { get { return _z + 30; } } + } + + public class SomeOne : SomeBase + { + public override int X { get { return _x - 10; } } + + public override int Y { get { return _y - 20; } } + private int _a = 300; + public int A { get { return _a - 30; } } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => c.CreateMap()); + + [Fact] + public void Should_throw() + { + new Action(()=>Mapper.Map(new StringDictionary())) + .ShouldThrowException(ex=> + ex.InnerException.Message.ShouldStartWith($"Cannot create an instance of abstract type {typeof(SomeBase)}.")); + } } } \ No newline at end of file diff --git a/src/UnitTests/Mappers/TypeHelperTests.cs b/src/UnitTests/Mappers/TypeHelperTests.cs index 936abbe238..89735b22da 100644 --- a/src/UnitTests/Mappers/TypeHelperTests.cs +++ b/src/UnitTests/Mappers/TypeHelperTests.cs @@ -1,34 +1,34 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Mappers -{ - public class TypeHelperTests - { - [Fact] - public void CanReturnElementTypeOnCollectionThatImplementsTheSameGenericInterfaceMultipleTimes() - { - Type myType = typeof(ChargeCollection); - - Type elementType = TypeHelper.GetElementType(myType); - - elementType.ShouldNotBeNull(); - } - - public class Charge { } - - public interface IChargeCollection : IEnumerable { } - - public class ChargeCollection : Collection, IChargeCollection - { - public new IEnumerator GetEnumerator() - { - return null; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using AutoMapper.Mappers.Internal; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Mappers +{ + public class TypeHelperTests + { + [Fact] + public void CanReturnElementTypeOnCollectionThatImplementsTheSameGenericInterfaceMultipleTimes() + { + Type myType = typeof(ChargeCollection); + + Type elementType = ElementTypeHelper.GetElementType(myType); + + elementType.ShouldNotBeNull(); + } + + public class Charge { } + + public interface IChargeCollection : IEnumerable { } + + public class ChargeCollection : Collection, IChargeCollection + { + public new IEnumerator GetEnumerator() + { + return null; + } + } + } +} diff --git a/src/UnitTests/MappingExceptions.cs b/src/UnitTests/MappingExceptions.cs index 951cecb84f..510d4f2487 100644 --- a/src/UnitTests/MappingExceptions.cs +++ b/src/UnitTests/MappingExceptions.cs @@ -1,57 +1,99 @@ -using System; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.MappingExceptions -{ - public class When_the_exception_does_not_have_the_types - { - [Fact] - public void Should_provide_a_useful_message() - { - var ex = new AutoMapperMappingException(); - ex.Message.ShouldStartWith("Exception"); - } - } - - public class When_encountering_a_member_mapping_problem_during_mapping : NonValidatingSpecBase - { - public class Source - { - public string Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_provide_a_contextual_exception() - { - var source = new Source { Value = "adsf" }; - typeof(AutoMapperMappingException).ShouldBeThrownBy(() => Mapper.Map(source)); - } - - [Fact] - public void Should_have_contextual_mapping_information() - { - var source = new Source { Value = "adsf" }; - AutoMapperMappingException thrown = null; - try - { - Mapper.Map(source); - } - catch (AutoMapperMappingException ex) - { - thrown = ex; - } - thrown.ShouldNotBeNull(); - } - } +using System; +using System.Diagnostics; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.MappingExceptions +{ + public class When_encountering_a_member_mapping_problem_during_mapping : NonValidatingSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_provide_a_contextual_exception() + { + var source = new Source { Value = "adsf" }; + typeof(AutoMapperMappingException).ShouldBeThrownBy(() => Mapper.Map(source)); + } + + [Fact] + public void Should_have_contextual_mapping_information() + { + var source = new Source { Value = "adsf" }; + AutoMapperMappingException thrown = null; + try + { + Mapper.Map(source); + } + catch (AutoMapperMappingException ex) + { + thrown = ex; + } + thrown.ShouldNotBeNull(); + thrown.TypeMap.ShouldNotBeNull(); + thrown.MemberMap.ShouldNotBeNull(); + } + } + + public class When_encountering_a_path_mapping_problem_during_mapping : NonValidatingSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public Sub SubValue { get; set; } + + public class Sub + { + public int Value { get; set; } + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(d => d.SubValue.Value, opt => opt.MapFrom(src => src.Value)); + }); + + [Fact] + public void Should_provide_a_contextual_exception() + { + var source = new Source { Value = "adsf" }; + typeof(AutoMapperMappingException).ShouldBeThrownBy(() => Mapper.Map(source)); + } + + [Fact] + public void Should_have_contextual_mapping_information() + { + var source = new Source { Value = "adsf" }; + AutoMapperMappingException thrown = null; + try + { + Mapper.Map(source); + } + catch (AutoMapperMappingException ex) + { + thrown = ex; + } + thrown.ShouldNotBeNull(); + thrown.TypeMap.ShouldNotBeNull(); + thrown.MemberMap.ShouldNotBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/MappingExpressionFeatureWithReverseTest.cs b/src/UnitTests/MappingExpressionFeatureWithReverseTest.cs new file mode 100644 index 0000000000..0866cd9c78 --- /dev/null +++ b/src/UnitTests/MappingExpressionFeatureWithReverseTest.cs @@ -0,0 +1,259 @@ +using AutoMapper.Features; +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class MappingExpressionFeatureWithReverseTest + { + [Fact] + public void Adding_same_feature_multiple_times_should_replace_eachother() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(1); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(new MappingExpressionFeatureA(3)) + .SetFeature(new MappingExpressionFeatureA(2)) + .SetFeature(featureA) + .SetFeature(new MappingExpressionFeatureB(3)) + .SetFeature(new MappingExpressionFeatureB(2)) + .SetFeature(featureB) + .ReverseMap(); + }); + + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(2); + + Validate(featureA); + Validate(featureB); + + void Validate(MappingExpressionFeatureBase feature) + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseMaps.ShouldBeOfLength(1); + } + } + + [Fact] + public void Add_single_feature_with_reverse() + { + var featureA = new MappingExpressionFeatureA(1); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .ReverseMap(); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(1); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(1); + + Validate(featureA); + + void Validate(MappingExpressionFeatureBase feature) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseMaps.ShouldBeOfLength(1); + + var typeMapFeature = typeMap.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + + var typeMapFeatureReverse = typeMapReverse.Features.Get(); + typeMapFeatureReverse.ShouldNotBeNull(); + typeMapFeatureReverse.Value.ShouldBe(feature.Value + 1); + typeMapFeatureReverse.SealedCount.ShouldBe(1); + } + } + + [Fact] + public void Add_multiple_features_with_reverse() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(2); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .SetFeature(featureB) + .ReverseMap(); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(2); + + Validate(featureA); + Validate(featureB); + + void Validate(MappingExpressionFeatureBase feature) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseMaps.ShouldBeOfLength(1); + + var typeMapFeature = typeMap.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + + var typeMapFeatureReverse = typeMapReverse.Features.Get(); + typeMapFeatureReverse.ShouldNotBeNull(); + typeMapFeatureReverse.Value.ShouldBe(feature.Value + 1); + typeMapFeatureReverse.SealedCount.ShouldBe(1); + } + } + + [Fact] + public void Add_multiple_features_with_reverse_overriden() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(2); + var overridenFeatureB = new MappingExpressionFeatureB(10); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .SetFeature(featureB) + .ReverseMap() + .SetFeature(overridenFeatureB); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(2); + + Validate(featureA, typeMap); + Validate(featureB, typeMap); + Validate(featureA, typeMapReverse, value: featureA.Value + 1); + Validate(overridenFeatureB, typeMapReverse, 0); + + void Validate(MappingExpressionFeatureBase feature, TypeMap map, int reverseExecutedCount = 1, int? value = null) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseMaps.ShouldBeOfLength(reverseExecutedCount); + + var typeMapFeature = map.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(value ?? feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + } + } + + public class MappingExpressionFeatureA : MappingExpressionFeatureBase + { + public MappingExpressionFeatureA(int value) : base(value, new TypeMapFeatureA(value), () => new MappingExpressionFeatureA(value + 1)) + { + } + } + + public class MappingExpressionFeatureB : MappingExpressionFeatureBase + { + public MappingExpressionFeatureB(int value) : base(value, new TypeMapFeatureB(value), () => new MappingExpressionFeatureB(value + 1)) + { + } + } + + public abstract class MappingExpressionFeatureBase : MappingExpressionFeatureBase + where TFeature : IRuntimeFeature + { + private readonly TFeature _feature; + + protected MappingExpressionFeatureBase(int value, TFeature feature, Func reverseMappingExpressionFeature) + : base(value, reverseMappingExpressionFeature) + { + _feature = feature; + } + + public override void Configure(TypeMap typeMap) + { + ConfigureTypeMaps.Add(typeMap); + typeMap.Features.Set(_feature); + } + } + + public abstract class MappingExpressionFeatureBase : IMappingFeature + { + public int Value { get; } + public List ConfigureTypeMaps { get; } = new List(); + public List ReverseMaps { get; } = new List(); + + private readonly Func _reverseMappingExpressionFeature; + + protected MappingExpressionFeatureBase(int value, Func reverseMappingExpressionFeature) + { + Value = value; + _reverseMappingExpressionFeature = reverseMappingExpressionFeature; + } + + public abstract void Configure(TypeMap typeMap); + + public IMappingFeature Reverse() + { + var reverse = _reverseMappingExpressionFeature(); + ReverseMaps.Add(reverse); + return reverse; + } + } + + public class TypeMapFeatureA : TypeMapFeatureBase + { + public TypeMapFeatureA(int value) : base(value) + { + } + } + + public class TypeMapFeatureB : TypeMapFeatureBase + { + public TypeMapFeatureB(int value) : base(value) + { + } + } + + public abstract class TypeMapFeatureBase : IRuntimeFeature + { + public int SealedCount { get; private set; } + public int Value { get; } + + public TypeMapFeatureBase(int value) + { + Value = value; + } + + void IRuntimeFeature.Seal(IConfigurationProvider configurationProvider) + { + SealedCount++; + } + } + + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingExpressionFeatureWithoutReverseTest.cs b/src/UnitTests/MappingExpressionFeatureWithoutReverseTest.cs new file mode 100644 index 0000000000..d9067288ac --- /dev/null +++ b/src/UnitTests/MappingExpressionFeatureWithoutReverseTest.cs @@ -0,0 +1,307 @@ +using AutoMapper.Features; +using Shouldly; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class MappingExpressionFeatureWithoutReverseTest + { + [Fact] + public void Adding_same_feature_should_replace_eachother() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(2); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(new MappingExpressionFeatureA(3)) + .SetFeature(new MappingExpressionFeatureA(2)) + .SetFeature(featureA) + .SetFeature(new MappingExpressionFeatureB(3)) + .SetFeature(new MappingExpressionFeatureB(2)) + .SetFeature(featureB); + }); + + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.ResolveTypeMap(typeof(Dest), typeof(Source)); + typeMapReverse.Features.Count().ShouldBe(0); + + Validate(featureA); + Validate(featureB); + + void Validate(MappingExpressionFeatureBase feature) + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseExecutedCount.ShouldBe(0); + } + } + + [Fact] + public void Add_single_feature() + { + var featureA = new MappingExpressionFeatureA(1); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(1); + + var typeMapReverse = config.ResolveTypeMap(typeof(Dest), typeof(Source)); + typeMapReverse.Features.Count().ShouldBe(0); + + Validate(featureA); + + void Validate(MappingExpressionFeatureBase feature) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseExecutedCount.ShouldBe(0); + + var typeMapFeature = typeMap.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + } + } + + [Fact] + public void Add_single_feature_with_reverse() + { + var featureA = new MappingExpressionFeatureA(1); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .ReverseMap(); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(1); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(0); + + Validate(featureA); + + void Validate(MappingExpressionFeatureBase feature) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseExecutedCount.ShouldBe(1); + + var typeMapFeature = typeMap.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + } + } + + [Fact] + public void Add_multiple_features() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(2); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .SetFeature(featureB); + }); + + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.ResolveTypeMap(typeof(Dest), typeof(Source)); + typeMapReverse.Features.Count().ShouldBe(0); + + Validate(featureA); + Validate(featureB); + + void Validate(MappingExpressionFeatureBase feature) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseExecutedCount.ShouldBe(0); + + var typeMapFeature = typeMap.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + } + } + + [Fact] + public void Add_multiple_features_with_reverse() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(2); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .SetFeature(featureB) + .ReverseMap(); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(0); + + Validate(featureA); + Validate(featureB); + + void Validate(MappingExpressionFeatureBase feature) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseExecutedCount.ShouldBe(1); + + var typeMapFeature = typeMap.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + } + } + + [Fact] + public void Add_multiple_features_with_reverse_overriden() + { + var featureA = new MappingExpressionFeatureA(1); + var featureB = new MappingExpressionFeatureB(2); + var overridenFeatureB = new MappingExpressionFeatureB(10); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .SetFeature(featureA) + .SetFeature(featureB) + .ReverseMap() + .SetFeature(overridenFeatureB); + }); + + var typeMap = config.FindTypeMapFor(); + typeMap.Features.Count().ShouldBe(2); + + var typeMapReverse = config.FindTypeMapFor(); + typeMapReverse.Features.Count().ShouldBe(1); + + Validate(featureA, typeMap); + Validate(featureB, typeMap); + Validate(overridenFeatureB, typeMapReverse, 0); + + void Validate(MappingExpressionFeatureBase feature, TypeMap map, int reverseExecutedCount = 1) + where TFeature : TypeMapFeatureBase + { + feature.ConfigureTypeMaps.ShouldBeOfLength(1); + feature.ReverseExecutedCount.ShouldBe(reverseExecutedCount); + + var typeMapFeature = map.Features.Get(); + typeMapFeature.ShouldNotBeNull(); + typeMapFeature.Value.ShouldBe(feature.Value); + typeMapFeature.SealedCount.ShouldBe(1); + } + } + + public class MappingExpressionFeatureA : MappingExpressionFeatureBase + { + public MappingExpressionFeatureA(int value) : base(value, new TypeMapFeatureA(value)) + { + } + } + + public class MappingExpressionFeatureB : MappingExpressionFeatureBase + { + public MappingExpressionFeatureB(int value) : base(value, new TypeMapFeatureB(value)) + { + } + } + + public abstract class MappingExpressionFeatureBase : MappingExpressionFeatureBase + where TFeature : IRuntimeFeature + { + private readonly TFeature _feature; + + protected MappingExpressionFeatureBase(int value, TFeature feature) + : base(value) + { + _feature = feature; + } + + public override void Configure(TypeMap typeMap) + { + ConfigureTypeMaps.Add(typeMap); + typeMap.Features.Set(_feature); + } + } + + public abstract class MappingExpressionFeatureBase : IMappingFeature + { + public int Value { get; } + public List ConfigureTypeMaps { get; } = new List(); + public int ReverseExecutedCount { get; private set; } + + protected MappingExpressionFeatureBase(int value) + { + Value = value; + } + + public abstract void Configure(TypeMap typeMap); + + public IMappingFeature Reverse() + { + ReverseExecutedCount++; + return null; + } + } + + public class TypeMapFeatureA : TypeMapFeatureBase + { + public TypeMapFeatureA(int value) : base(value) + { + } + } + + public class TypeMapFeatureB : TypeMapFeatureBase + { + public TypeMapFeatureB(int value) : base(value) + { + } + } + + public abstract class TypeMapFeatureBase : IRuntimeFeature + { + public int SealedCount { get; private set; } + public int Value { get; } + + public TypeMapFeatureBase(int value) + { + Value = value; + } + + void IRuntimeFeature.Seal(IConfigurationProvider configurationProvider) + { + SealedCount++; + } + } + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/ApplyIncludeBaseRecursively.cs b/src/UnitTests/MappingInheritance/ApplyIncludeBaseRecursively.cs index b936e6173f..8793ab3493 100644 --- a/src/UnitTests/MappingInheritance/ApplyIncludeBaseRecursively.cs +++ b/src/UnitTests/MappingInheritance/ApplyIncludeBaseRecursively.cs @@ -1,52 +1,52 @@ -using System; -using Should; -using AutoMapper; -using Xunit; - -namespace AutoMapper.UnitTests.MappingInheritance -{ - public class ApplyIncludeBaseRecursively : AutoMapperSpecBase - { - ViewModel _destination; - - public class BaseEntity - { - public string Property1 { get; set; } - } - public class SubBaseEntity : BaseEntity { } - - public class SpecificEntity : SubBaseEntity - { - public bool Map { get; set; } - } - - public class ViewModel - { - public string Property2 { get; set; } - } - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(vm => vm.Property2, opt => opt.ResolveUsing(e => e.Property1)); - - cfg.CreateMap() - .IncludeBase(); - - cfg.CreateMap() - .IncludeBase() - .ForMember(vm => vm.Property2, opt => opt.Condition(e => e.Map)); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new SpecificEntity{ Map = true, Property1 = "Test" }); - } - - [Fact] - public void Should_apply_all_included_base_maps() - { - _destination.Property2.ShouldEqual("Test"); - } - } +using System; +using Shouldly; +using AutoMapper; +using Xunit; + +namespace AutoMapper.UnitTests.MappingInheritance +{ + public class ApplyIncludeBaseRecursively : AutoMapperSpecBase + { + ViewModel _destination; + + public class BaseEntity + { + public string Property1 { get; set; } + } + public class SubBaseEntity : BaseEntity { } + + public class SpecificEntity : SubBaseEntity + { + public bool Map { get; set; } + } + + public class ViewModel + { + public string Property2 { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(vm => vm.Property2, opt => opt.MapFrom(e => e.Property1)); + + cfg.CreateMap() + .IncludeBase(); + + cfg.CreateMap() + .IncludeBase() + .ForMember(vm => vm.Property2, opt => opt.Condition(e => e.Map)); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new SpecificEntity{ Map = true, Property1 = "Test" }); + } + + [Fact] + public void Should_apply_all_included_base_maps() + { + _destination.Property2.ShouldBe("Test"); + } + } } \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/ConventionMappedCollectionShouldMapBaseTypes.cs b/src/UnitTests/MappingInheritance/ConventionMappedCollectionShouldMapBaseTypes.cs index d7b257c90a..40ddee1b30 100644 --- a/src/UnitTests/MappingInheritance/ConventionMappedCollectionShouldMapBaseTypes.cs +++ b/src/UnitTests/MappingInheritance/ConventionMappedCollectionShouldMapBaseTypes.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -60,8 +60,8 @@ public void item_collection_should_map_by_base_type() } }); - dto.Items[0].ShouldBeType(); - dto.Items[1].ShouldBeType(); + dto.Items[0].ShouldBeOfType(); + dto.Items[1].ShouldBeOfType(); } [Fact] @@ -86,8 +86,8 @@ public void item_collection_should_map_by_base_type_for_map_with_one_parameter() } }); - dto.Items[0].ShouldBeType(); - dto.Items[1].ShouldBeType(); + dto.Items[0].ShouldBeOfType(); + dto.Items[1].ShouldBeOfType(); } } } diff --git a/src/UnitTests/MappingInheritance/GenericsAndInterfaces.cs b/src/UnitTests/MappingInheritance/GenericsAndInterfaces.cs deleted file mode 100644 index 9d8fa6b6a0..0000000000 --- a/src/UnitTests/MappingInheritance/GenericsAndInterfaces.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.MappingInheritance -{ - public class GenericsAndInterfaces : AutoMapperSpecBase - { - MyClass source = new MyClass { Container = new ContainerClass { MyProperty = 3 } }; - - public interface IMyInterface - { - T Container { get; set; } - } - - public class ContainerClass - { - public int MyProperty { get; set; } - } - - public class ImplementedClass : IMyInterface - { - public ContainerClass Container - { - get; - set; - } - } - - public class MyClass - { - public T Container { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => cfg.CreateMap(typeof(MyClass<>), typeof(IMyInterface<>))); - - [Fact] - public void ShouldMapToExistingObject() - { - var destination = new ImplementedClass(); - Mapper.Map(source, destination, typeof(MyClass), typeof(IMyInterface)); - destination.Container.MyProperty.ShouldEqual(3); - } - -#if !PORTABLE - [Fact] - public void ShouldMapToNewObject() - { - var destination = (IMyInterface) Mapper.Map(source, typeof(MyClass), typeof(ImplementedClass)); - destination.Container.MyProperty.ShouldEqual(3); - } -#endif - } -} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/IgnoreShouldBeInherited.cs b/src/UnitTests/MappingInheritance/IgnoreShouldBeInherited.cs new file mode 100644 index 0000000000..612308c792 --- /dev/null +++ b/src/UnitTests/MappingInheritance/IgnoreShouldBeInherited.cs @@ -0,0 +1,80 @@ +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class IgnoreShouldBeInherited : AutoMapperSpecBase + { + public class BaseDomain + { + } + + public class SpecificDomain : BaseDomain + { + public string SpecificProperty { get; set; } + } + + public class Dto + { + public string SpecificProperty { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.SpecificProperty, m => m.Ignore()) + .Include(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_ok() + { + var dto = Mapper.Map(new SpecificDomain { SpecificProperty = "Test" }); + dto.SpecificProperty.ShouldBeNull(); + } + } + + public class IgnoreShouldBeInheritedWithOpenGenerics : AutoMapperSpecBase + { + public abstract class BaseUserDto + { + public TIdType Id { get; set; } + public string Name { get; set; } + } + + public class ConcreteUserDto : BaseUserDto + { + } + + public abstract class BaseUserEntity + { + public TIdType Id { get; set; } + public string Name { get; set; } + } + + public class ConcreteUserEntity : BaseUserEntity + { + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(BaseUserDto<>), typeof(BaseUserEntity<>)).ForMember("Id", opt => opt.Ignore()); + cfg.CreateMap(typeof(ConcreteUserDto), typeof(ConcreteUserEntity)).IncludeBase(typeof(BaseUserDto), typeof(BaseUserEntity)); + }); + + [Fact] + public void Should_map_ok() + { + var user = new ConcreteUserDto + { + Id = "my-id", + Name = "my-User" + }; + var userEntity = Mapper.Map(user); + userEntity.Id.ShouldBeNull(); + userEntity.Name.ShouldBe("my-User"); + } + } +} diff --git a/src/UnitTests/MappingInheritance/IncludeAllDerived.cs b/src/UnitTests/MappingInheritance/IncludeAllDerived.cs new file mode 100644 index 0000000000..3c07e086d0 --- /dev/null +++ b/src/UnitTests/MappingInheritance/IncludeAllDerived.cs @@ -0,0 +1,45 @@ +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.MappingInheritance +{ + public class IncludeAllDerived : AutoMapperSpecBase + { + public class A + { + public int Value { get; set; } + } + public class B : A { } + public class C : B { } + public class D : A { } + + public class ADto + { + public int Value { get; set; } + } + + public class BDto : ADto { } + public class CDto : BDto { } + public class DDto : ADto { } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value, opt => opt.MapFrom(src => 5)) + .IncludeAllDerived(); + + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_apply_configuration_to_all_derived() + { + Mapper.Map(new A {Value = 10}).Value.ShouldBe(5); + Mapper.Map(new B {Value = 10}).Value.ShouldBe(5); + Mapper.Map(new C {Value = 10}).Value.ShouldBe(5); + Mapper.Map(new D {Value = 10}).Value.ShouldBe(5); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/IncludeBaseBug.cs b/src/UnitTests/MappingInheritance/IncludeBaseBug.cs index 4ec7c3fbbd..7e38e3ebc0 100644 --- a/src/UnitTests/MappingInheritance/IncludeBaseBug.cs +++ b/src/UnitTests/MappingInheritance/IncludeBaseBug.cs @@ -1,50 +1,50 @@ -namespace AutoMapper.UnitTests.MappingInheritance -{ - using Should; - - public class Test : AutoMapperSpecBase - { - public class From - { - public int Value { get; set; } - public int ChildValue { get; set; } - } - - - public class Concrete - { - public int ConcreteValue { get; set; } - } - - public abstract class AbstractChild : Concrete - { - public int AbstractValue { get; set; } - } - - public class Derivation : AbstractChild - { - public int DerivedValue { get; set; } - } - - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.ConcreteValue, o => o.MapFrom(s => s == null ? default(int) : s.ChildValue)) - .Include(); - cfg.CreateMap() - .ForMember(d => d.AbstractValue, o => o.Ignore()) - .Include(); - cfg.CreateMap() - .ForMember(d => d.DerivedValue, o => o.Ignore()); - cfg.AllowNullDestinationValues = false; - }); - - public void TestMethod1() - { - var dest = Mapper.Map(null, typeof(From), typeof(Concrete)); - dest.ShouldBeType(); - ReferenceEquals(dest.GetType(), typeof(Concrete)).ShouldBeTrue(); - } - } +namespace AutoMapper.UnitTests.MappingInheritance +{ + using Shouldly; + + public class Test : AutoMapperSpecBase + { + public class From + { + public int Value { get; set; } + public int ChildValue { get; set; } + } + + + public class Concrete + { + public int ConcreteValue { get; set; } + } + + public abstract class AbstractChild : Concrete + { + public int AbstractValue { get; set; } + } + + public class Derivation : AbstractChild + { + public int DerivedValue { get; set; } + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.ConcreteValue, o => o.MapFrom(s => s == null ? default(int) : s.ChildValue)) + .Include(); + cfg.CreateMap() + .ForMember(d => d.AbstractValue, o => o.Ignore()) + .Include(); + cfg.CreateMap() + .ForMember(d => d.DerivedValue, o => o.Ignore()); + cfg.AllowNullDestinationValues = false; + }); + + public void TestMethod1() + { + var dest = Mapper.Map(null, typeof(From), typeof(Concrete)); + dest.ShouldBeOfType(); + ReferenceEquals(dest.GetType(), typeof(Concrete)).ShouldBeTrue(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/IncludeBaseShouldNotCreateMaps.cs b/src/UnitTests/MappingInheritance/IncludeBaseShouldNotCreateMaps.cs index e5dd07200b..98a1ec0f5a 100644 --- a/src/UnitTests/MappingInheritance/IncludeBaseShouldNotCreateMaps.cs +++ b/src/UnitTests/MappingInheritance/IncludeBaseShouldNotCreateMaps.cs @@ -1,33 +1,33 @@ -using System; - -namespace AutoMapper.UnitTests.MappingInheritance -{ - public class IncludeBaseShouldNotCreateMaps : AutoMapperSpecBase - { - public abstract class BaseBaseSource { } - public class BaseSource : BaseBaseSource - { - public string Foo { get; set; } - } - public class Source : BaseSource { } - - public abstract class BaseBaseDest - { - public string Foo { get; set; } - } - public class BaseDest : BaseBaseDest { } - public class Dest : BaseDest { } - - public class TestProfile : Profile - { - protected override void Configure() - { - CreateMap(); - CreateMap() - .IncludeBase(); - } - } - - protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.AddProfile()); - } +using System; + +namespace AutoMapper.UnitTests.MappingInheritance +{ + public class IncludeBaseShouldNotCreateMaps : AutoMapperSpecBase + { + public abstract class BaseBaseSource { } + public class BaseSource : BaseBaseSource + { + public string Foo { get; set; } + } + public class Source : BaseSource { } + + public abstract class BaseBaseDest + { + public string Foo { get; set; } + } + public class BaseDest : BaseBaseDest { } + public class Dest : BaseDest { } + + public class TestProfile : Profile + { + public TestProfile() + { + CreateMap(); + CreateMap() + .IncludeBase(); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.AddProfile()); + } } \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/IncludeBaseShouldValidateTypes.cs b/src/UnitTests/MappingInheritance/IncludeBaseShouldValidateTypes.cs new file mode 100644 index 0000000000..8369935474 --- /dev/null +++ b/src/UnitTests/MappingInheritance/IncludeBaseShouldValidateTypes.cs @@ -0,0 +1,21 @@ +using Shouldly; +using System; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class IncludeBaseShouldValidateTypes + { + [Fact] + public void Should_throw() + { + new Action(() => + { + var c = new MapperConfiguration(cfg => cfg.CreateMap().IncludeBase()); + }).ShouldThrowException(ex => + { + ex.Message.ShouldStartWith($"{typeof(string)} is not derived from {typeof(int)}."); + }); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/IncludeBaseWithNonGenericUsage.cs b/src/UnitTests/MappingInheritance/IncludeBaseWithNonGenericUsage.cs new file mode 100644 index 0000000000..28e17edb70 --- /dev/null +++ b/src/UnitTests/MappingInheritance/IncludeBaseWithNonGenericUsage.cs @@ -0,0 +1,78 @@ +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.MappingInheritance +{ + public class IncludeBaseWithNonGenericUsage : NonValidatingSpecBase + { + class Source : SourceBase + { } + + class Destination : DestinationBase + { } + + abstract class SourceBase + { + public T Id; + public string Timestamp; + } + + abstract class DestinationBase + { + public T Id; + public string Time; + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + // It does not matter if generic type is or <>, result is the same. + cfg.CreateMap(typeof(SourceBase), typeof(DestinationBase)) + .ForMember("Time", mo => mo.MapFrom("Timestamp")); + cfg.CreateMap(typeof(Source), typeof(Destination)) + .IncludeBase(typeof(SourceBase), typeof(DestinationBase)); + }); + + [Fact] + public void Should_pass_validation() + { + Should.NotThrow(() => Configuration.AssertConfigurationIsValid()); + } + } + + public class IncludeBaseWithGenericUsage : NonValidatingSpecBase + { + class Source : SourceBase + { } + + class Destination : DestinationBase + { } + + abstract class SourceBase + { + public T Id; + public string Timestamp; + } + + abstract class DestinationBase + { + public T Id; + public string Time; + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + // It does not matter if generic type is or <>, result is the same. + cfg.CreateMap, DestinationBase>() + .ForMember("Time", mo => mo.MapFrom("Timestamp")); + cfg.CreateMap() + .IncludeBase, DestinationBase>(); + }); + + [Fact] + public void Should_pass_validation() + { + Should.NotThrow(() => Configuration.AssertConfigurationIsValid()); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/IncludedBaseMappingShouldInheritBaseMappings.cs b/src/UnitTests/MappingInheritance/IncludedBaseMappingShouldInheritBaseMappings.cs index 02de269f38..473349d8c1 100644 --- a/src/UnitTests/MappingInheritance/IncludedBaseMappingShouldInheritBaseMappings.cs +++ b/src/UnitTests/MappingInheritance/IncludedBaseMappingShouldInheritBaseMappings.cs @@ -1,330 +1,330 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - using CustomMapping; - - public class IncludedMappingShouldInheritBaseMappings : SpecBase - { - - public class ModelObject - { - public string DifferentBaseString { get; set; } - } - - public class ModelSubObject : ModelObject - { - public string SubString { get; set; } - } - - public class DtoObject - { - public string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - public class OtherDto - { - public string SubString { get; set; } - } - - [Fact] - public void included_mapping_should_inherit_base_mappings_should_not_throw() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void included_mapping_should_inherit_base_ignore_mappings_should_not_throw() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - .Include(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void more_specific_map_should_override_base_ignore_passes_validation() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - .Include(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); - }); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void more_specific_map_should_override_base_ignore_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - .Include(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); - }); - - var mapper = config.CreateMapper(); - - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "123".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void more_specific_map_should_override_base_ignore() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - .Include(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "123".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void more_specific_map_should_override_base_mapping_passes_validation() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.UseValue("789")); - }); - config.AssertConfigurationIsValid(); - } - [Fact] - public void more_specific_map_should_override_base_mapping_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.UseValue("789")); - }); - - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "789".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void more_specific_map_should_override_base_mapping() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.UseValue("789")); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "789".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void included_mapping_should_not_inherit_base_mappings_for_other_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - - cfg.CreateMap(); - cfg.CreateMap(); - }); - - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void included_mapping_should_not_inherit_base_mappings_for_other() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - - cfg.CreateMap(); - cfg.CreateMap(); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void included_mapping_should_not_inherit_base_mappings_for_other_should_not_throw() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - - cfg.CreateMap(); - cfg.CreateMap(); - }); - config.AssertConfigurationIsValid(); - } - [Fact] - public void include_should_allow_automapper_to_select_more_specific_included_type_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - - cfg.CreateMap(); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - dto.ShouldBeType(); - } - - [Fact] - public void include_should_allow_automapper_to_select_more_specific_included_type() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - .Include(); - - cfg.CreateMap(); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - dto.ShouldBeType(); - } - - [Fact] - public void include_should_apply_condition() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => - { - m.Condition(src => !string.IsNullOrWhiteSpace(src.DifferentBaseString)); - m.MapFrom(s => s.DifferentBaseString); - }) - .Include(); - - cfg.CreateMap(); - }); - var dest = new DtoSubObject - { - BaseString = "12345" - }; - var mapper = config.CreateMapper(); - mapper.Map(new ModelSubObject - { - DifferentBaseString = "", - }, dest); - - dest.BaseString.ShouldEqual("12345"); - } - - [Fact] - public void include_should_apply_null_substitute() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => - { - m.MapFrom(s => s.DifferentBaseString); - m.NullSubstitute("12345"); - }) - .Include(); - - cfg.CreateMap(); - }); - var mapper = config.CreateMapper(); - var dest = mapper.Map(new ModelSubObject()); - - dest.BaseString.ShouldEqual("12345"); - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + using CustomMapping; + + public class IncludedMappingShouldInheritBaseMappings : SpecBase + { + + public class ModelObject + { + public string DifferentBaseString { get; set; } + } + + public class ModelSubObject : ModelObject + { + public string SubString { get; set; } + } + + public class DtoObject + { + public string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + public class OtherDto + { + public string SubString { get; set; } + } + + [Fact] + public void included_mapping_should_inherit_base_mappings_should_not_throw() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void included_mapping_should_inherit_base_ignore_mappings_should_not_throw() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + .Include(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void more_specific_map_should_override_base_ignore_passes_validation() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + .Include(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); + }); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void more_specific_map_should_override_base_ignore_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + .Include(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); + }); + + var mapper = config.CreateMapper(); + + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "123".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void more_specific_map_should_override_base_ignore() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + .Include(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "123".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void more_specific_map_should_override_base_mapping_passes_validation() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(src => "789")); + }); + config.AssertConfigurationIsValid(); + } + [Fact] + public void more_specific_map_should_override_base_mapping_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(src => "789")); + }); + + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "789".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void more_specific_map_should_override_base_mapping() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(src => "789")); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "789".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void included_mapping_should_not_inherit_base_mappings_for_other_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + + cfg.CreateMap(); + cfg.CreateMap(); + }); + + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void included_mapping_should_not_inherit_base_mappings_for_other() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + + cfg.CreateMap(); + cfg.CreateMap(); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void included_mapping_should_not_inherit_base_mappings_for_other_should_not_throw() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + + cfg.CreateMap(); + cfg.CreateMap(); + }); + config.AssertConfigurationIsValid(); + } + [Fact] + public void include_should_allow_automapper_to_select_more_specific_included_type_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + + cfg.CreateMap(); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + dto.ShouldBeOfType(); + } + + [Fact] + public void include_should_allow_automapper_to_select_more_specific_included_type() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + .Include(); + + cfg.CreateMap(); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + dto.ShouldBeOfType(); + } + + [Fact] + public void include_should_apply_condition() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => + { + m.Condition(src => !string.IsNullOrWhiteSpace(src.DifferentBaseString)); + m.MapFrom(s => s.DifferentBaseString); + }) + .Include(); + + cfg.CreateMap(); + }); + var dest = new DtoSubObject + { + BaseString = "12345" + }; + var mapper = config.CreateMapper(); + mapper.Map(new ModelSubObject + { + DifferentBaseString = "", + }, dest); + + dest.BaseString.ShouldBe("12345"); + } + + [Fact] + public void include_should_apply_null_substitute() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => + { + m.MapFrom(s => s.DifferentBaseString); + m.NullSubstitute("12345"); + }) + .Include(); + + cfg.CreateMap(); + }); + var mapper = config.CreateMapper(); + var dest = mapper.Map(new ModelSubObject()); + + dest.BaseString.ShouldBe("12345"); + } + } +} diff --git a/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs b/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs index 207bba5049..404a567e5c 100644 --- a/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs +++ b/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs @@ -1,298 +1,298 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class IncludedBaseMappingShouldInheritBaseMappings : SpecBase - { - public class ModelObject - { - public string DifferentBaseString { get; set; } - } - - public class ModelSubObject : ModelObject - { - public string SubString { get; set; } - } - - public class DtoObject - { - public string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - public class OtherDto - { - public string SubString { get; set; } - } - - [Fact] - public void included_mapping_should_inherit_base_mappings_should_not_throw() - { - var config = new MapperConfiguration(cfg => - { - - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - cfg.CreateMap() - .IncludeBase(); - }); - - config.AssertConfigurationIsValid(); - } - [Fact] - public void included_mapping_should_not_care_about_order() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .IncludeBase(); - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - }); - - config.AssertConfigurationIsValid(); - } - - [Fact] - public void included_mapping_should_inherit_base_ignore_mappings_should_not_throw() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - ; - cfg.CreateMap() - .IncludeBase() - ; - }); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void more_specific_map_should_override_base_ignore_passes_validation() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - ; - cfg.CreateMap() - .IncludeBase() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - }); - config.AssertConfigurationIsValid(); - } - - [Fact] - public void more_specific_map_should_override_base_ignore_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - ; - cfg.CreateMap() - .IncludeBase() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - }); - - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "123".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void more_specific_map_should_override_base_ignore() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.Ignore()) - ; - cfg.CreateMap() - .IncludeBase() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "123".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void more_specific_map_should_override_base_mapping_passes_validation() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - cfg.CreateMap() - .IncludeBase() - .ForMember(d => d.BaseString, m => m.UseValue("789")); - }); - config.AssertConfigurationIsValid(); - } - [Fact] - public void more_specific_map_should_override_base_mapping_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); - cfg.CreateMap() - .IncludeBase() - .ForMember(d => d.BaseString, m => m.UseValue("789")); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "789".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void more_specific_map_should_override_base_mapping() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) - ; - cfg.CreateMap() - .IncludeBase() - .ForMember(d => d.BaseString, m => m.UseValue("789")); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - "789".ShouldEqual(dto.BaseString); - "456".ShouldEqual(dto.SubString); - } - - [Fact] - public void include_should_allow_automapper_to_select_more_specific_included_type_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); - - cfg.CreateMap() - .IncludeBase() - ; - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - dto.ShouldBeType(); - } - - [Fact] - public void include_should_allow_automapper_to_select_more_specific_included_type() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); - - cfg.CreateMap() - .IncludeBase(); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(new ModelSubObject - { - DifferentBaseString = "123", - SubString = "456" - }); - - dto.ShouldBeType(); - } - - [Fact] - public void include_should_apply_condition() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => - { - m.Condition(src => !string.IsNullOrWhiteSpace(src.DifferentBaseString)); - m.MapFrom(s => s.DifferentBaseString); - }) - ; - - cfg.CreateMap() - .IncludeBase() - ; - }); - var dest = new DtoSubObject - { - BaseString = "12345" - }; - var mapper = config.CreateMapper(); - mapper.Map(new ModelSubObject - { - DifferentBaseString = "", - }, dest); - - dest.BaseString.ShouldEqual("12345"); - } - - [Fact] - public void include_should_apply_null_substitute() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.BaseString, m => - { - m.MapFrom(s => s.DifferentBaseString); - m.NullSubstitute("12345"); - }) - ; - - cfg.CreateMap() - .IncludeBase() - ; - }); - var mapper = config.CreateMapper(); - var dest = mapper.Map(new ModelSubObject()); - - dest.BaseString.ShouldEqual("12345"); - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class IncludedBaseMappingShouldInheritBaseMappings : SpecBase + { + public class ModelObject + { + public string DifferentBaseString { get; set; } + } + + public class ModelSubObject : ModelObject + { + public string SubString { get; set; } + } + + public class DtoObject + { + public string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + public class OtherDto + { + public string SubString { get; set; } + } + + [Fact] + public void included_mapping_should_inherit_base_mappings_should_not_throw() + { + var config = new MapperConfiguration(cfg => + { + + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + cfg.CreateMap() + .IncludeBase(); + }); + + config.AssertConfigurationIsValid(); + } + [Fact] + public void included_mapping_should_not_care_about_order() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .IncludeBase(); + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + }); + + config.AssertConfigurationIsValid(); + } + + [Fact] + public void included_mapping_should_inherit_base_ignore_mappings_should_not_throw() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + ; + cfg.CreateMap() + .IncludeBase() + ; + }); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void more_specific_map_should_override_base_ignore_passes_validation() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + ; + cfg.CreateMap() + .IncludeBase() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + }); + config.AssertConfigurationIsValid(); + } + + [Fact] + public void more_specific_map_should_override_base_ignore_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + ; + cfg.CreateMap() + .IncludeBase() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + }); + + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "123".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void more_specific_map_should_override_base_ignore() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.Ignore()) + ; + cfg.CreateMap() + .IncludeBase() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "123".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void more_specific_map_should_override_base_mapping_passes_validation() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + cfg.CreateMap() + .IncludeBase() + .ForMember(d => d.BaseString, m => m.MapFrom(src => "789")); + }); + config.AssertConfigurationIsValid(); + } + [Fact] + public void more_specific_map_should_override_base_mapping_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); + cfg.CreateMap() + .IncludeBase() + .ForMember(d => d.BaseString, m => m.MapFrom(src => "789")); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "789".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void more_specific_map_should_override_base_mapping() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)) + ; + cfg.CreateMap() + .IncludeBase() + .ForMember(d => d.BaseString, m => m.MapFrom(src => "789")); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + "789".ShouldBe(dto.BaseString); + "456".ShouldBe(dto.SubString); + } + + [Fact] + public void include_should_allow_automapper_to_select_more_specific_included_type_with_one_parameter() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); + + cfg.CreateMap() + .IncludeBase() + ; + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + dto.ShouldBeOfType(); + } + + [Fact] + public void include_should_allow_automapper_to_select_more_specific_included_type() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => m.MapFrom(s => s.DifferentBaseString)); + + cfg.CreateMap() + .IncludeBase(); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(new ModelSubObject + { + DifferentBaseString = "123", + SubString = "456" + }); + + dto.ShouldBeOfType(); + } + + [Fact] + public void include_should_apply_condition() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => + { + m.Condition(src => !string.IsNullOrWhiteSpace(src.DifferentBaseString)); + m.MapFrom(s => s.DifferentBaseString); + }) + ; + + cfg.CreateMap() + .IncludeBase() + ; + }); + var dest = new DtoSubObject + { + BaseString = "12345" + }; + var mapper = config.CreateMapper(); + mapper.Map(new ModelSubObject + { + DifferentBaseString = "", + }, dest); + + dest.BaseString.ShouldBe("12345"); + } + + [Fact] + public void include_should_apply_null_substitute() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.BaseString, m => + { + m.MapFrom(s => s.DifferentBaseString); + m.NullSubstitute("12345"); + }) + ; + + cfg.CreateMap() + .IncludeBase() + ; + }); + var mapper = config.CreateMapper(); + var dest = mapper.Map(new ModelSubObject()); + + dest.BaseString.ShouldBe("12345"); + } + } +} diff --git a/src/UnitTests/MappingInheritance/InheritanceWithoutIncludeShouldWork.cs b/src/UnitTests/MappingInheritance/InheritanceWithoutIncludeShouldWork.cs index 4ad7a87e04..6e0dd465b8 100644 --- a/src/UnitTests/MappingInheritance/InheritanceWithoutIncludeShouldWork.cs +++ b/src/UnitTests/MappingInheritance/InheritanceWithoutIncludeShouldWork.cs @@ -1,35 +1,35 @@ -namespace AutoMapper.UnitTests.MappingInheritance -{ - using Should; - using Xunit; - - public class InheritanceWithoutIncludeShouldWork : AutoMapperSpecBase - { - public class FooBase { } - public class Foo : FooBase { } - public class FooDto { public int Value { get; set; } } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ForMember(d => d.Value, opt => opt.UseValue(10)); - cfg.CreateMap().ForMember(d => d.Value, opt => opt.UseValue(5)); - }); - - [Fact] - public void Should_map_derived() - { - Map(new Foo()).Value.ShouldEqual(5); - } - - [Fact] - public void Should_map_base() - { - Map(new FooBase()).Value.ShouldEqual(10); - } - - private FooDto Map(FooBase foo) - { - return Mapper.Map(foo); - } - } +namespace AutoMapper.UnitTests.MappingInheritance +{ + using Shouldly; + using Xunit; + + public class InheritanceWithoutIncludeShouldWork : AutoMapperSpecBase + { + public class FooBase { } + public class Foo : FooBase { } + public class FooDto { public int Value { get; set; } } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(d => d.Value, opt => opt.MapFrom(src => 10)); + cfg.CreateMap().ForMember(d => d.Value, opt => opt.MapFrom(src => 5)); + }); + + [Fact] + public void Should_map_derived() + { + Map(new Foo()).Value.ShouldBe(5); + } + + [Fact] + public void Should_map_base() + { + Map(new FooBase()).Value.ShouldBe(10); + } + + private FooDto Map(FooBase foo) + { + return Mapper.Map(foo); + } + } } \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/InheritedIgnoreShouldBeOverridenByConventionMapping.cs b/src/UnitTests/MappingInheritance/InheritedIgnoreShouldBeOverridenByConventionMapping.cs deleted file mode 100644 index 46238e7a46..0000000000 --- a/src/UnitTests/MappingInheritance/InheritedIgnoreShouldBeOverridenByConventionMapping.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class InheritedIgnoreShouldBeOverriddenByConventionMapping - { - public class BaseDomain - { - - } - - public class SpecificDomain : BaseDomain - { - public string SpecificProperty { get; set; } - } - - public class Dto - { - public string SpecificProperty { get; set; } - } - - [Fact] - public void inhertited_ignore_should_be_pass_validation() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.SpecificProperty, m => m.Ignore()) - .Include(); - - cfg.CreateMap(); - }); - - config.AssertConfigurationIsValid(); - } - - [Fact] - public void inhertited_ignore_should_be_overridden_by_successful_convention_mapping() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.SpecificProperty, m => m.Ignore()) - .Include(); - - cfg.CreateMap(); - }); - - var dto = config.CreateMapper().Map(new SpecificDomain {SpecificProperty = "Test"}); - - dto.SpecificProperty.ShouldEqual("Test"); - } - - [Fact] - public void inhertited_ignore_should_be_overridden_by_successful_convention_mapping_with_one_parameter() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.SpecificProperty, m => m.Ignore()) - .Include(); - - cfg.CreateMap(); - }); - - var dto = config.CreateMapper().Map(new SpecificDomain { SpecificProperty = "Test" }); - - dto.SpecificProperty.ShouldEqual("Test"); - } - } -} diff --git a/src/UnitTests/MappingInheritance/MapToBaseClass.cs b/src/UnitTests/MappingInheritance/MapToBaseClass.cs index 511fb09e28..b5d79606cd 100644 --- a/src/UnitTests/MappingInheritance/MapToBaseClass.cs +++ b/src/UnitTests/MappingInheritance/MapToBaseClass.cs @@ -1,31 +1,31 @@ -namespace AutoMapper.UnitTests.MappingInheritance -{ - using System; - using Should; - using Xunit; - public class MapToBaseClass : AutoMapperSpecBase - { - A _destination; - - public class Input { } - public class A { } - public class B : A { } - - protected override MapperConfiguration Configuration => new MapperConfiguration(c => - { - c.CreateMap().Include(); - c.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Input()); - } - - [Fact] - public void ShouldReturnBaseClass() - { - _destination.ShouldBeType(); - } - } +namespace AutoMapper.UnitTests.MappingInheritance +{ + using System; + using Shouldly; + using Xunit; + public class MapToBaseClass : AutoMapperSpecBase + { + A _destination; + + public class Input { } + public class A { } + public class B : A { } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap().Include(); + c.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Input()); + } + + [Fact] + public void ShouldReturnBaseClass() + { + _destination.ShouldBeOfType(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/OpenGenericsWithInheritance.cs b/src/UnitTests/MappingInheritance/OpenGenericsWithInheritance.cs new file mode 100644 index 0000000000..9f248b1c72 --- /dev/null +++ b/src/UnitTests/MappingInheritance/OpenGenericsWithInheritance.cs @@ -0,0 +1,230 @@ +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class OpenGenericsWithAs : AutoMapperSpecBase + { + public class Source + { + public object Value { get; set; } + } + + public interface ITarget + { + T Value { get; } + } + + public class Target : ITarget + { + public T Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap(typeof(Source), typeof(Target<>)); + cfg.CreateMap(typeof(Source), typeof(ITarget<>)).As(typeof(Target<>)); + }); + + [Fact] + public void Should_use_the_redirected_map() + { + var source = new Source { Value = "value" }; + Mapper.Map>(source).Value.ShouldBe(source.Value); + } + } + + public class OpenGenericsWithInclude : AutoMapperSpecBase + { + public class Person + { + public string Name { get; set; } + public List BarList { get; set; } = new List(); + } + + public class PersonModel + { + public string Name { get; set; } + public List BarList { get; set; } + } + + abstract public class BarBase + { + public int Id { get; set; } + } + + public class Bar : BarBase + { + public T Value { get; set; } + } + + abstract public class BarModelBase + { + public int Id { get; set; } + public string Ignored { get; set; } + public string MappedFrom { get; set; } + } + + public class BarModel : BarModelBase + { + public T Value { get; set; } + public string DerivedMember { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d=>d.Ignored, o=>o.Ignore()) + .ForMember(d=>d.MappedFrom, o=>o.MapFrom(_=>"mappedFrom")) + .Include(typeof(Bar<>), typeof(BarModel<>)); + cfg.CreateMap(); + cfg.CreateMap(typeof(Bar<>), typeof(BarModel<>)).ForMember("DerivedMember", o=>o.MapFrom("Id")); + }); + + [Fact] + public void Should_work() + { + var person = new Person { Name = "Jack", BarList = { new Bar{ Id = 1, Value = "One" }, new Bar{ Id = 2, Value = "Two" } } }; + + var personMapped = Mapper.Map(person); + + var barModel = (BarModel)personMapped.BarList[0]; + barModel.Value.ShouldBe("One"); + barModel.DerivedMember.ShouldBe("1"); + barModel.MappedFrom.ShouldBe("mappedFrom"); + barModel = (BarModel)personMapped.BarList[1]; + barModel.Value.ShouldBe("Two"); + barModel.DerivedMember.ShouldBe("2"); + barModel.MappedFrom.ShouldBe("mappedFrom"); + } + } + + public class OpenGenericsWithIncludeBase : AutoMapperSpecBase + { + public class Person + { + public string Name { get; set; } + public List BarList { get; set; } = new List(); + } + + public class PersonModel + { + public string Name { get; set; } + public List BarList { get; set; } + } + + abstract public class BarBase + { + public int Id { get; set; } + } + + public class Bar : BarBase + { + public T Value { get; set; } + } + + abstract public class BarModelBase + { + public int Id { get; set; } + public string Ignored { get; set; } + public string MappedFrom { get; set; } + } + + public class BarModel : BarModelBase + { + public T Value { get; set; } + public string DerivedMember { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(BarBase), typeof(BarModelBase)) + .ForMember("Ignored", o => o.Ignore()) + .ForMember("MappedFrom", o => o.MapFrom(_=>"mappedFrom")); + cfg.CreateMap(); + cfg.CreateMap(typeof(Bar<>), typeof(BarModel<>)) + .ForMember("DerivedMember", o => o.MapFrom("Id")) + .IncludeBase(typeof(BarBase), typeof(BarModelBase)); + }); + + [Fact] + public void Should_work() + { + var person = new Person { Name = "Jack", BarList = { new Bar { Id = 1, Value = "One" }, new Bar { Id = 2, Value = "Two" } } }; + + var personMapped = Mapper.Map(person); + + var barModel = (BarModel)personMapped.BarList[0]; + barModel.Value.ShouldBe("One"); + barModel.DerivedMember.ShouldBe("1"); + barModel.MappedFrom.ShouldBe("mappedFrom"); + barModel = (BarModel)personMapped.BarList[1]; + barModel.Value.ShouldBe("Two"); + barModel.DerivedMember.ShouldBe("2"); + barModel.MappedFrom.ShouldBe("mappedFrom"); + } + } + + public class OpenGenericsAndNonGenericsWithIncludeBase : AutoMapperSpecBase + { + public abstract class Entity + { + public string BaseMember { get; set; } + } + + public abstract class Model + { + public string BaseMember { get; set; } + } + + public abstract class Entity : Entity + { + public TId Id { get; set; } + } + + public abstract class Model : Model + { + public TId Id { get; set; } + } + + public class SubEntity : Entity + { + public string SubMember { get; set; } + } + + public class SubModel : Model + { + public string SubMember { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap(typeof(Entity<>), typeof(Model<>)) + .IncludeBase(typeof(Entity), typeof(Model)); + + + cfg.CreateMap() + .IncludeBase, Model>() + .IncludeBase(); + }); + + [Fact] + public void Should_work() + { + var entity = new SubEntity { BaseMember = "foo", Id = 695, SubMember = "bar" }; + + var model = this.Mapper.Map(entity); + + model.BaseMember.ShouldBe("foo"); + model.Id.ShouldBe(695); + model.SubMember.ShouldBe("bar"); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/OverrideIgnore.cs b/src/UnitTests/MappingInheritance/OverrideIgnore.cs index 122405c2e6..5ce3fa5604 100644 --- a/src/UnitTests/MappingInheritance/OverrideIgnore.cs +++ b/src/UnitTests/MappingInheritance/OverrideIgnore.cs @@ -1,42 +1,42 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Bug -{ - public class OverrideIgnore - { - public class DomainBase - { - public string SomeProperty { get; set; } - } - - public class DtoBase - { - public string SomeDifferentProperty { get; set; } - } - - [Fact] - public void specifying_map_should_override_ignore() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(m=>m.SomeDifferentProperty, m=>m.Ignore()) - .ForMember(m=>m.SomeDifferentProperty, m=>m.MapFrom(s=>s.SomeProperty))); - - var dto = config.CreateMapper().Map(new DomainBase {SomeProperty = "Test"}); - - "Test".ShouldEqual(dto.SomeDifferentProperty); - } - - [Fact] - public void specifying_map_should_override_ignore_with_one_parameter() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(m => m.SomeDifferentProperty, m => m.Ignore()) - .ForMember(m => m.SomeDifferentProperty, m => m.MapFrom(s => s.SomeProperty))); - - var dto = config.CreateMapper().Map(new DomainBase { SomeProperty = "Test" }); - - "Test".ShouldEqual(dto.SomeDifferentProperty); - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Bug +{ + public class OverrideIgnore + { + public class DomainBase + { + public string SomeProperty { get; set; } + } + + public class DtoBase + { + public string SomeDifferentProperty { get; set; } + } + + [Fact] + public void specifying_map_should_override_ignore() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(m=>m.SomeDifferentProperty, m=>m.Ignore()) + .ForMember(m=>m.SomeDifferentProperty, m=>m.MapFrom(s=>s.SomeProperty))); + + var dto = config.CreateMapper().Map(new DomainBase {SomeProperty = "Test"}); + + "Test".ShouldBe(dto.SomeDifferentProperty); + } + + [Fact] + public void specifying_map_should_override_ignore_with_one_parameter() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(m => m.SomeDifferentProperty, m => m.Ignore()) + .ForMember(m => m.SomeDifferentProperty, m => m.MapFrom(s => s.SomeProperty))); + + var dto = config.CreateMapper().Map(new DomainBase { SomeProperty = "Test" }); + + "Test".ShouldBe(dto.SomeDifferentProperty); + } + } +} diff --git a/src/UnitTests/MappingInheritance/PreserveReferencesWithInheritance.cs b/src/UnitTests/MappingInheritance/PreserveReferencesWithInheritance.cs new file mode 100644 index 0000000000..c48f9098ba --- /dev/null +++ b/src/UnitTests/MappingInheritance/PreserveReferencesWithInheritance.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; + +namespace AutoMapper.UnitTests +{ + namespace Source + { + public class Instance + { + public Type Type { get; set; } + public Instance Definition { get; set; } + } + + public sealed class Class : Instance + { + private IList _properties; + public IList Properties + { + get { return _properties ?? (_properties = new List()); } + set { _properties = value; } + } + } + + public abstract class Member : Instance + { + public string Name { get; set; } + } + + public sealed class Parameter : Member + { + public int Position { get; set; } + } + + public sealed class Property : Member + { + } + + public sealed class Field : Member + { + } + } + + namespace Target + { + public class Instance + { + public Type Type { get; set; } + public Instance Definition { get; set; } + } + + public sealed class Class : Instance + { + public IList Properties { get; set; } + } + + public abstract class Member : Instance + { + public string Name { get; set; } + } + + public sealed class Parameter : Member + { + public int Position { get; set; } + } + + public sealed class Property : Member + { + } + + public sealed class Field : Member + { + } + } + + public class PreserveReferencesWithInheritance : AutoMapperSpecBase + { + List _destination; + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap() + .Include() + .Include(); + cfg.CreateMap() + .Include() + .Include() + .Include(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var field = new Source.Field { Name = "AddResult", Type = typeof(Int32) }; + var @class = new Source.Class { Properties = new List { field }, Type = typeof(float) }; + var returnValue = new Source.Instance { Type = typeof(float), Definition = @class }; + @class.Definition = @class; + + var source = new List { new Source.Property { Name = "(return)", Definition = returnValue.Definition, Type = returnValue.Type }}; + _destination = Mapper.Map>(source); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/PropertyOnMappingShouldResolveMostSpecificType.cs b/src/UnitTests/MappingInheritance/PropertyOnMappingShouldResolveMostSpecificType.cs index a61c0f9029..3716e383d6 100644 --- a/src/UnitTests/MappingInheritance/PropertyOnMappingShouldResolveMostSpecificType.cs +++ b/src/UnitTests/MappingInheritance/PropertyOnMappingShouldResolveMostSpecificType.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests.Bug @@ -88,9 +88,9 @@ public void container_class_is_caching_too_specific_mapper_for_collection() } }); - dto.Items[0].Description.ShouldBeType(); - dto.Items[1].ShouldBeType(); - dto.Items[1].Description.ShouldBeType(); + dto.Items[0].Description.ShouldBeOfType(); + dto.Items[1].ShouldBeOfType(); + dto.Items[1].Description.ShouldBeOfType(); } [Fact] @@ -128,9 +128,9 @@ public void container_class_is_caching_too_specific_mapper_for_collection_with_o } }); - dto.Items[0].Description.ShouldBeType(); - dto.Items[1].ShouldBeType(); - dto.Items[1].Description.ShouldBeType(); + dto.Items[0].Description.ShouldBeOfType(); + dto.Items[1].ShouldBeOfType(); + dto.Items[1].Description.ShouldBeOfType(); } [Fact] @@ -161,8 +161,8 @@ public void property_on_dto_mapped_from_self_should_be_specific_match() var dto = config.CreateMapper().Map(new DifferentItem()); - dto.ShouldBeType(); - dto.Description.ShouldBeType(); + dto.ShouldBeOfType(); + dto.Description.ShouldBeOfType(); } [Fact] @@ -193,8 +193,8 @@ public void property_on_dto_mapped_from_self_should_be_specific_match_with_one_p var dto = config.CreateMapper().Map(new DifferentItem()); - dto.ShouldBeType(); - dto.Description.ShouldBeType(); + dto.ShouldBeOfType(); + dto.Description.ShouldBeOfType(); } } } diff --git a/src/UnitTests/MappingInheritance/ProxyClassWithInheritance.cs b/src/UnitTests/MappingInheritance/ProxyClassWithInheritance.cs deleted file mode 100644 index 2fea360a61..0000000000 --- a/src/UnitTests/MappingInheritance/ProxyClassWithInheritance.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace AutoMapper.UnitTests.MappingInheritance -{ - using Should; - using Xunit; - - public class ProxyClassWithInheritance : SpecBase - { - public class Duck : Animal { } - public class DuckDto : AnimalDto { } - public abstract class Animal { } - public abstract class AnimalDto { } - public class DuckProxyClassFoo : Duck { } - - [Fact] - public void Should_map_correctly() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include(); - - cfg.CreateMap().ReverseMap(); - }); - - var aDuck = new DuckProxyClassFoo(); - - var mapper = config.CreateMapper(); - var dto = mapper.Map(aDuck); - - dto.ShouldBeType(); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/ReverseMapWithInclude.cs b/src/UnitTests/MappingInheritance/ReverseMapWithInclude.cs new file mode 100644 index 0000000000..ed257b9296 --- /dev/null +++ b/src/UnitTests/MappingInheritance/ReverseMapWithInclude.cs @@ -0,0 +1,75 @@ +namespace AutoMapper.UnitTests.MappingInheritance +{ + using System; + using Shouldly; + using Xunit; + + public class ReverseMapWithInclude : SpecBase + { + public class Duck : Animal { } + public class DuckDto : AnimalDto { } + public abstract class Animal { } + public abstract class AnimalDto { } + public class DuckProxyClassFoo : Duck { } + + [Fact] + public void Should_map_correctly() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include(); + + cfg.CreateMap().ReverseMap(); + }); + + var aDuck = new DuckProxyClassFoo(); + + var mapper = config.CreateMapper(); + var dto = mapper.Map(aDuck); + + dto.ShouldBeOfType(); + } + } + + public class ReverseMapWithIncludeBase : AutoMapperSpecBase + { + ConcreteSource _destination; + + public class Destination + { + public string Name { get; set; } + } + + public class ConcreteDestination : Destination { } + + public class Source + { + public string Title { get; set; } + } + + public class ConcreteSource : Source { } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Name, conf => conf.MapFrom(source => source.Title)) + .ReverseMap() + .ForMember(dest => dest.Title, conf => conf.MapFrom(source => source.Name)); + cfg.CreateMap() + .IncludeBase() + .ReverseMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new ConcreteDestination { Name = "Name" }); + } + + [Fact] + public void Should_work_together() + { + _destination.Title.ShouldBe("Name"); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/ShouldInheritBeforeAndAfterMap.cs b/src/UnitTests/MappingInheritance/ShouldInheritBeforeAndAfterMap.cs index 37e08fa6d1..df514a4ec0 100644 --- a/src/UnitTests/MappingInheritance/ShouldInheritBeforeAndAfterMap.cs +++ b/src/UnitTests/MappingInheritance/ShouldInheritBeforeAndAfterMap.cs @@ -1,67 +1,144 @@ -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.MappingInheritance -{ - public class ShouldInheritBeforeAndAfterMap - { - public class BaseClass - { - public string Prop { get; set; } - } - public class Class : BaseClass {} - - public class BaseDto - { - public string DifferentProp { get; set; } - } - public class Dto : BaseDto {} - - [Fact] - public void should_inherit_base_beforemap() - { - // arrange - var source = new Class{ Prop = "test" }; - var configurationProvider = new MapperConfiguration(cfg => - { - cfg - .CreateMap() - .BeforeMap((s, d) => d.DifferentProp = s.Prop) - .Include(); - - cfg.CreateMap(); - }); - var mappingEngine = configurationProvider.CreateMapper(); - - // act - var dest = mappingEngine.Map(source); - - // assert - "test".ShouldEqual(dest.DifferentProp); - } - - [Fact] - public void should_inherit_base_aftermap() - { - // arrange - var source = new Class { Prop = "test" }; - var configurationProvider = new MapperConfiguration(cfg => - { - cfg - .CreateMap() - .AfterMap((s, d) => d.DifferentProp = s.Prop) - .Include(); - - cfg.CreateMap(); - }); - var mappingEngine = configurationProvider.CreateMapper(); - - // act - var dest = mappingEngine.Map(source); - - // assert - "test".ShouldEqual(dest.DifferentProp); - } - } +using System; +using AutoMapper.Mappers; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.MappingInheritance +{ + public class ShouldInheritBeforeAndAfterMapOnlyOnce : AutoMapperSpecBase + { + int afterMapCount; + int beforeMapCount; + + public abstract class BaseBaseSource { } + public class BaseSource : BaseBaseSource + { + public string Foo { get; set; } + } + public class Source : BaseSource { } + + public abstract class BaseBaseDest + { + } + public class BaseDest : BaseBaseDest { } + public class Dest : BaseDest { } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().AfterMap((s, d) => afterMapCount++).BeforeMap((s, d)=>beforeMapCount++).Include().Include(); + cfg.CreateMap().Include(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + Mapper.Map(new Source()); + } + + [Fact] + public void Should_call_AfterMap_just_once() + { + afterMapCount.ShouldBe(1); + beforeMapCount.ShouldBe(1); + } + } + + public class ShouldInheritBeforeAndAfterMapOnlyOnceIncludeBase : AutoMapperSpecBase + { + int afterMapCount; + int beforeMapCount; + + public abstract class BaseBaseSource { } + public class BaseSource : BaseBaseSource + { + public string Foo { get; set; } + } + public class Source : BaseSource { } + + public abstract class BaseBaseDest + { + } + public class BaseDest : BaseBaseDest { } + public class Dest : BaseDest { } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap().AfterMap((s, d) => afterMapCount++).BeforeMap((s, d) => beforeMapCount++); + cfg.CreateMap().IncludeBase(); + cfg.CreateMap().IncludeBase(); + }); + + protected override void Because_of() + { + Mapper.Map(new Source()); + } + + [Fact] + public void Should_call_AfterMap_just_once() + { + afterMapCount.ShouldBe(1); + beforeMapCount.ShouldBe(1); + } + } + + public class ShouldInheritBeforeAndAfterMap + { + public class BaseClass + { + public string Prop { get; set; } + } + public class Class : BaseClass {} + + public class BaseDto + { + public string DifferentProp { get; set; } + } + public class Dto : BaseDto {} + + [Fact] + public void should_inherit_base_beforemap() + { + // arrange + var source = new Class{ Prop = "test" }; + var configurationProvider = new MapperConfiguration(cfg => + { + cfg + .CreateMap() + .BeforeMap((s, d) => d.DifferentProp = s.Prop) + .Include(); + + cfg.CreateMap(); + }); + var mappingEngine = configurationProvider.CreateMapper(); + + // act + var dest = mappingEngine.Map(source); + + // assert + "test".ShouldBe(dest.DifferentProp); + } + + [Fact] + public void should_inherit_base_aftermap() + { + // arrange + var source = new Class { Prop = "test" }; + var configurationProvider = new MapperConfiguration(cfg => + { + cfg + .CreateMap() + .AfterMap((s, d) => d.DifferentProp = s.Prop) + .Include(); + + cfg.CreateMap(); + }); + var mappingEngine = configurationProvider.CreateMapper(); + + // act + var dest = mappingEngine.Map(source); + + // assert + "test".ShouldBe(dest.DifferentProp); + } + } } \ No newline at end of file diff --git a/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs b/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs index 65c768ca22..a32a8cf55c 100644 --- a/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs +++ b/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs @@ -1,108 +1,212 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using AutoMapper.Mappers; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.MappingInheritance -{ - public class DestinationTypePolymorphismTest - { - public class Customer - { - public int Id { get; set; } - public string Name { get; set; } - } - - public class CustomerStubDTO - { - public int Id { get; set; } - } - - public class CustomerDTO : CustomerStubDTO - { - public string Name { get; set; } - } - - public class Order - { - public Customer Customer { get; set; } - } - - public class OrderDTO - { - public CustomerStubDTO Customer { get; set; } - } - - - [Fact] - public void Mapper_Should_Allow_Overriding_Of_Destination_Type() - { - var order = new Order() { Customer = new Customer() { Id = 1, Name = "A" } }; - - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap().As(); - }); - var orderDto = config.CreateMapper().Map(order); - - var customerDto = (CustomerDTO)orderDto.Customer; - "A".ShouldEqual(customerDto.Name); - 1.ShouldEqual(customerDto.Id); - - } - - } - public class DestinationTypePolymorphismTestNonGeneric - { - public class Customer - { - public int Id { get; set; } - public string Name { get; set; } - } - - public class CustomerStubDTO - { - public int Id { get; set; } - } - - public class CustomerDTO : CustomerStubDTO - { - public string Name { get; set; } - } - - public class Order - { - public Customer Customer { get; set; } - } - - public class OrderDTO - { - public CustomerStubDTO Customer { get; set; } - } - - - [Fact] - public void Mapper_Should_Allow_Overriding_Of_Destination_Type() - { - var order = new Order() { Customer = new Customer() { Id = 1, Name = "A" } }; - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof(Order), typeof(OrderDTO)); - cfg.CreateMap(typeof(Customer), typeof(CustomerDTO)); - cfg.CreateMap(typeof(Customer), typeof(CustomerStubDTO)).As(typeof(CustomerDTO)); - }); - var orderDto = config.CreateMapper().Map(order); - - var customerDto = (CustomerDTO)orderDto.Customer; - "A".ShouldEqual(customerDto.Name); - 1.ShouldEqual(customerDto.Id); - - } - - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AutoMapper.Mappers; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.MappingInheritance +{ + public class AsShouldWorkOnlyWithDerivedTypesWithGenerics : AutoMapperSpecBase + { + class Source + { + } + + class Destination + { + } + + class Override : Destination + { + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => c.CreateMap(typeof(Source<>), typeof(Destination<>)).As(typeof(Override<>))); + } + + public class AsShouldWorkOnlyWithDerivedTypes + { + class Source + { + } + + class Destination + { + } + + [Fact] + public void Should_detect_unrelated_override() + { + new Action(() => new MapperConfiguration(c => c.CreateMap(typeof(Source), typeof(Destination)).As(typeof(Source)))).ShouldThrowException(ex => + { + ex.Message.ShouldStartWith($"{typeof(Source)} is not derived from {typeof(Destination)}."); + }); + } + } + + public class DestinationTypePolymorphismTest + { + public class Customer + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class CustomerStubDTO + { + public int Id { get; set; } + } + + public class CustomerDTO : CustomerStubDTO + { + public string Name { get; set; } + } + + public class Order + { + public Customer Customer { get; set; } + } + + public class OrderDTO + { + public CustomerStubDTO Customer { get; set; } + } + + + [Fact] + public void Mapper_Should_Allow_Overriding_Of_Destination_Type() + { + var order = new Order() { Customer = new Customer() { Id = 1, Name = "A" } }; + + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap().As(); + }); + var orderDto = config.CreateMapper().Map(order); + + var customerDto = (CustomerDTO)orderDto.Customer; + "A".ShouldBe(customerDto.Name); + 1.ShouldBe(customerDto.Id); + + } + + } + public class DestinationTypePolymorphismTestNonGeneric + { + public class Customer + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class CustomerStubDTO + { + public int Id { get; set; } + } + + public class CustomerDTO : CustomerStubDTO + { + public string Name { get; set; } + } + + public class Order + { + public Customer Customer { get; set; } + } + + public class OrderDTO + { + public CustomerStubDTO Customer { get; set; } + } + + + [Fact] + public void Mapper_Should_Allow_Overriding_Of_Destination_Type() + { + var order = new Order() { Customer = new Customer() { Id = 1, Name = "A" } }; + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Order), typeof(OrderDTO)); + cfg.CreateMap(typeof(Customer), typeof(CustomerDTO)); + cfg.CreateMap(typeof(Customer), typeof(CustomerStubDTO)).As(typeof(CustomerDTO)); + }); + var orderDto = config.CreateMapper().Map(order); + + var customerDto = (CustomerDTO)orderDto.Customer; + "A".ShouldBe(customerDto.Name); + 1.ShouldBe(customerDto.Id); + + } + + } + + public class AsWithGenerics : AutoMapperSpecBase + { + INodeModel _destination; + + public interface INodeModel : INodeModel where T : struct + { + new T? ID { get; set; } + } + + public interface INodeModel + { + object ID { get; set; } + string Name { get; set; } + } + + public class NodeModel : INodeModel where T : struct + { + public T? ID { get; set; } + public string Name { get; set; } + + object INodeModel.ID + { + get + { + return ID; + } + + set + { + ID = value as T?; + } + } + } + + public class NodeDto where T : struct + { + public T? ID { get; set; } + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(cfg => { + cfg.CreateMap(typeof(NodeDto<>), typeof(NodeModel<>)); + cfg.CreateMap(typeof(NodeDto<>), typeof(INodeModel<>)).As(typeof(NodeModel<>)); + cfg.CreateMap(typeof(INodeModel<>), typeof(NodeModel<>)); + }); + } + } + + protected override void Because_of() + { + var dto = new NodeDto { ID = 1, Name = "Hi" }; + _destination = Mapper.Map>(dto); + } + + [Fact] + public void Should_override_the_map() + { + _destination.ShouldBeOfType>(); + _destination.ID.ShouldBe(1); + _destination.Name.ShouldBe("Hi"); + } + } +} diff --git a/src/UnitTests/MappingInheritance/SourceValidationWithInheritance.cs b/src/UnitTests/MappingInheritance/SourceValidationWithInheritance.cs new file mode 100644 index 0000000000..4b19ae7770 --- /dev/null +++ b/src/UnitTests/MappingInheritance/SourceValidationWithInheritance.cs @@ -0,0 +1,123 @@ +using System; + +namespace AutoMapper.UnitTests +{ + public class SourceValidationWithInheritance : AutoMapperSpecBase + { + public abstract class FormElement2 + { + public Guid Id { get; set; } + public int Order { get; set; } + } + + public abstract class FieldControl2 : FormElement2 + { + public string Label { get; set; } + public string Trailer { get; set; } + public bool Misspelled { get; set; } + } + + public abstract class TextFieldControl2 : FieldControl2 + { + public string DefaultValue { get; set; } + public int Size { get; set; } + } + + public class TextBoxControl2 : TextFieldControl2 + { + public int Rows { get; set; } + } + + public abstract class FormControlBaseDTO2 + { + public Guid Id { get; set; } + public int Order { get; set; } + } + + public class FormElementDTO2 : FormControlBaseDTO2 + { + public int ElementType { get; set; } + public string Label { get; set; } + public string Trailer { get; set; } + + public string DefaultValue { get; set; } + public int Size { get; set; } + public int Rows { get; set; } + + public bool Prepopulate { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source) + .Include(); + + cfg.CreateMap(MemberList.Source) + .ForMember(dto => dto.Prepopulate, opt => opt.MapFrom(src => src.Misspelled)) + .Include(); + + cfg.CreateMap(MemberList.Source) + .ForMember(dto => dto.ElementType, opt => opt.MapFrom(src => 0)); + }); + } + + public class SourceValidationWithIgnore: AutoMapperSpecBase + { + public abstract class FormElement2 + { + public Guid Id { get; set; } + public int Order { get; set; } + } + + public abstract class FieldControl2 : FormElement2 + { + public string Label { get; set; } + public string Trailer { get; set; } + public bool Misspelled { get; set; } + } + + public abstract class TextFieldControl2 : FieldControl2 + { + public string DefaultValue { get; set; } + public int Size { get; set; } + } + + public class TextBoxControl2 : TextFieldControl2 + { + public int Rows { get; set; } + } + + public abstract class FormControlBaseDTO2 + { + public Guid Id { get; set; } + public int Order { get; set; } + } + + public class FormElementDTO2 : FormControlBaseDTO2 + { + public int ElementType { get; set; } + public string Label { get; set; } + public string Trailer { get; set; } + + public string DefaultValue { get; set; } + public int Size { get; set; } + public int Rows { get; set; } + + public bool Prepopulate { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source) + .Include(); + + cfg.CreateMap(MemberList.Source) + .ForSourceMember(src => src.Misspelled, o=>o.DoNotValidate()) + .Include(); + + cfg.CreateMap(MemberList.Source) + .ForMember(dto => dto.ElementType, opt => opt.MapFrom(src => 0)); + }); + } + +} \ No newline at end of file diff --git a/src/UnitTests/MappingOrder.cs b/src/UnitTests/MappingOrder.cs index beb65c9fd8..21fca1bfbb 100644 --- a/src/UnitTests/MappingOrder.cs +++ b/src/UnitTests/MappingOrder.cs @@ -1,126 +1,126 @@ -using Xunit; -using Should; -using System; - -namespace AutoMapper.UnitTests -{ - namespace MappingOrder - { - public class When_specifying_a_mapping_order_for_base_members : AutoMapperSpecBase - { - Destination _destination; - - class Source - { - public string One { get; set; } - - public string Two { get; set; } - } - - class SourceChild : Source - { - } - - class Destination - { - // must be defined before property "One" to fail - public string Two { get; set; } - - private string one; - - public string One - { - get - { - return this.one; - } - set - { - this.one = value; - this.Two = value; - } - } - } - - protected override void Because_of() - { - _destination = Mapper.Map(new SourceChild { One = "first", Two = "second" }); - } - - [Fact] - public void Should_inherit_the_mapping_order() - { - _destination.Two.ShouldEqual("first"); - } - - protected override MapperConfiguration Configuration - { - get - { - return new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include() - .ForMember(dest => dest.One, opt => opt.SetMappingOrder(600)) - .ForMember(dest => dest.Two, opt => opt.SetMappingOrder(-500)); - - cfg.CreateMap(); - }); - } - } - } - - public class When_specifying_a_mapping_order_for_source_members : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - private int _startValue; - - public Source(int startValue) - { - _startValue = startValue; - } - - public int GetValue1() - { - _startValue += 10; - return _startValue; - } - - public int GetValue2() - { - _startValue += 5; - return _startValue; - } - } - - public class Destination - { - public int Value1 { get; set; } - public int Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(src => src.Value1, opt => opt.SetMappingOrder(2)) - .ForMember(src => src.Value2, opt => opt.SetMappingOrder(1)); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source(10)); - } - - [Fact] - public void Should_perform_the_mapping_in_the_order_specified() - { - _result.Value2.ShouldEqual(15); - _result.Value1.ShouldEqual(25); - } - } - - } +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests +{ + namespace MappingOrder + { + public class When_specifying_a_mapping_order_for_base_members : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public string One { get; set; } + + public string Two { get; set; } + } + + class SourceChild : Source + { + } + + class Destination + { + // must be defined before property "One" to fail + public string Two { get; set; } + + private string one; + + public string One + { + get + { + return this.one; + } + set + { + this.one = value; + this.Two = value; + } + } + } + + protected override void Because_of() + { + _destination = Mapper.Map(new SourceChild { One = "first", Two = "second" }); + } + + [Fact] + public void Should_inherit_the_mapping_order() + { + _destination.Two.ShouldBe("first"); + } + + protected override MapperConfiguration Configuration + { + get + { + return new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include() + .ForMember(dest => dest.One, opt => opt.SetMappingOrder(600)) + .ForMember(dest => dest.Two, opt => opt.SetMappingOrder(-500)); + + cfg.CreateMap(); + }); + } + } + } + + public class When_specifying_a_mapping_order_for_source_members : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + private int _startValue; + + public Source(int startValue) + { + _startValue = startValue; + } + + public int GetValue1() + { + _startValue += 10; + return _startValue; + } + + public int GetValue2() + { + _startValue += 5; + return _startValue; + } + } + + public class Destination + { + public int Value1 { get; set; } + public int Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(src => src.Value1, opt => opt.SetMappingOrder(2)) + .ForMember(src => src.Value2, opt => opt.SetMappingOrder(1)); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source(10)); + } + + [Fact] + public void Should_perform_the_mapping_in_the_order_specified() + { + _result.Value2.ShouldBe(15); + _result.Value1.ShouldBe(25); + } + } + + } } \ No newline at end of file diff --git a/src/UnitTests/MaxDepthTests.cs b/src/UnitTests/MaxDepthTests.cs index dd24a9b215..017c04febf 100644 --- a/src/UnitTests/MaxDepthTests.cs +++ b/src/UnitTests/MaxDepthTests.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; -using Should; +using Shouldly; using Xunit; namespace AutoMapper.UnitTests @@ -35,15 +34,10 @@ public class Destination public Destination Parent { get; set; } } - private Source _source; + private readonly Source _source; public MaxDepthTests() { - Initializer(); - } - public void Initializer() - { - var nest = new Source(1); nest.AddChild(new Source(2)); @@ -80,9 +74,9 @@ public void Second_level_children_are_not_null_with_max_depth_2() var destination = config.CreateMapper().Map(_source); foreach (var child in destination.Children) { - 2.ShouldEqual(child.Level); + 2.ShouldBe(child.Level); child.ShouldNotBeNull(); - destination.ShouldEqual(child.Parent); + destination.ShouldBe(child.Parent); } } @@ -111,9 +105,9 @@ public void Third_level_children_are_not_null_max_depth_3() child.Children.ShouldNotBeNull(); foreach (var subChild in child.Children) { - 3.ShouldEqual(subChild.Level); + 3.ShouldBe(subChild.Level); subChild.Children.ShouldNotBeNull(); - child.ShouldEqual(subChild.Parent); + child.ShouldBe(subChild.Parent); } } } diff --git a/src/UnitTests/MaxExecutionPlanDepth.cs b/src/UnitTests/MaxExecutionPlanDepth.cs new file mode 100644 index 0000000000..a4b154966e --- /dev/null +++ b/src/UnitTests/MaxExecutionPlanDepth.cs @@ -0,0 +1,110 @@ +using AutoMapper; +using System; +using System.Linq; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests +{ + public class MaxExecutionPlanDepth + { + class Source + { + public Source1 Inner { get; set; } + } + + class Source1 + { + public Source2 Inner { get; set; } + } + + class Source2 + { + public Source3 Inner { get; set; } + } + + class Source3 + { + public Source4 Inner { get; set; } + } + + class Source4 + { + public Source5 Inner { get; set; } + } + + class Source5 + { + public Source6 Inner { get; set; } + } + + class Source6 + { + public int Value { get; set; } + } + + class Destination + { + public Destination1 Inner { get; set; } + } + + class Destination1 + { + public Destination2 Inner { get; set; } + } + + class Destination2 + { + public Destination3 Inner { get; set; } + } + + class Destination3 + { + public Destination4 Inner { get; set; } + } + + class Destination4 + { + public Destination5 Inner { get; set; } + } + + class Destination5 + { + public Destination6 Inner { get; set; } + } + + class Destination6 + { + public int Value { get; set; } + } + + [Fact] + public void Should_set_inline_accordingly() + { + var configuration = new MapperConfiguration(cfg => + { + cfg.Advanced.MaxExecutionPlanDepth = 2; + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + }); + TypeMap map; + map = configuration.FindTypeMapFor(); + map.PropertyMaps.First().Inline.ShouldBeTrue(); + map = configuration.FindTypeMapFor(); + map.PropertyMaps.First().Inline.ShouldBeTrue(); + map = configuration.FindTypeMapFor(); + map.PropertyMaps.First().Inline.ShouldBeFalse(); + map = configuration.FindTypeMapFor(); + map.PropertyMaps.First().Inline.ShouldBeTrue(); + map = configuration.FindTypeMapFor(); + map.PropertyMaps.First().Inline.ShouldBeTrue(); + map = configuration.FindTypeMapFor(); + map.PropertyMaps.First().Inline.ShouldBeFalse(); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/MemberNameReplacers.cs b/src/UnitTests/MemberNameReplacers.cs index 981b35ab7f..4a2fb90909 100644 --- a/src/UnitTests/MemberNameReplacers.cs +++ b/src/UnitTests/MemberNameReplacers.cs @@ -6,8 +6,6 @@ namespace AutoMapper.UnitTests { - using Should.Core.Assertions; - public class When_using_a_member_name_replacer : SpecBase { public class Source diff --git a/src/UnitTests/MemberResolution.cs b/src/UnitTests/MemberResolution.cs index 7e77b310ed..7a36fcc3a5 100644 --- a/src/UnitTests/MemberResolution.cs +++ b/src/UnitTests/MemberResolution.cs @@ -1,1554 +1,1557 @@ -using System; -using System.Collections.Generic; -using AutoMapper.Mappers; -using Should; -using Xunit; -using System.Reflection; -using System.Linq; - -namespace AutoMapper.UnitTests -{ - namespace MemberResolution - { - public class When_mapping_derived_classes_in_arrays : AutoMapperSpecBase - { - private DtoObject[] _result; - - public class ModelObject - { - public string BaseString { get; set; } - } - - public class ModelSubObject : ModelObject - { - public string SubString { get; set; } - } - - public class DtoObject - { - public string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new[] - { - new ModelObject {BaseString = "Base1"}, - new ModelSubObject {BaseString = "Base2", SubString = "Sub2"} - }; - _result = (DtoObject[]) Mapper.Map(model, typeof (ModelObject[]), typeof (DtoObject[])); - } - - [Fact] - public void Should_map_both_the_base_and_sub_objects() - { - _result.Length.ShouldEqual(2); - _result[0].BaseString.ShouldEqual("Base1"); - _result[1].BaseString.ShouldEqual("Base2"); - } - - [Fact] - public void Should_map_to_the_correct_respective_dto_types() - { - _result[0].ShouldBeType(typeof (DtoObject)); - _result[1].ShouldBeType(typeof (DtoSubObject)); - } - } - - public class When_mapping_derived_classes : AutoMapperSpecBase - { - private DtoObject _result; - - public class ModelObject - { - public string BaseString { get; set; } - } - - public class ModelSubObject : ModelObject - { - public string SubString { get; set; } - } - - public class DtoObject - { - public string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelSubObject { BaseString = "Base2", SubString = "Sub2" }; - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_to_the_correct_dto_types() - { - _result.ShouldBeType(typeof(DtoSubObject)); - } - } - - public class When_mapping_derived_classes_from_intefaces_to_abstract : AutoMapperSpecBase - { - private DtoObject[] _result; - - public interface IModelObject - { - string BaseString { get; set; } - } - - public class ModelSubObject : IModelObject - { - public string SubString { get; set; } - public string BaseString { get; set; } - } - - public abstract class DtoObject - { - public virtual string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new IModelObject[] - { - new ModelSubObject {BaseString = "Base2", SubString = "Sub2"} - }; - _result = (DtoObject[]) Mapper.Map(model, typeof (IModelObject[]), typeof (DtoObject[])); - base.Because_of(); - } - - [Fact] - public void Should_map_both_the_base_and_sub_objects() - { - _result.Length.ShouldEqual(1); - _result[0].BaseString.ShouldEqual("Base2"); - } - - [Fact] - public void Should_map_to_the_correct_respective_dto_types() - { - _result[0].ShouldBeType(typeof (DtoSubObject)); - ((DtoSubObject) _result[0]).SubString.ShouldEqual("Sub2"); - } - } - - public class When_mapping_derived_classes_as_property_of_top_object : AutoMapperSpecBase - { - private DtoModel _result; - - public class Model - { - public IModelObject Object { get; set; } - } - - public interface IModelObject - { - string BaseString { get; set; } - } - - public class ModelSubObject : IModelObject - { - public string SubString { get; set; } - public string BaseString { get; set; } - } - - public class DtoModel - { - public DtoObject Object { get; set; } - } - - public abstract class DtoObject - { - public virtual string BaseString { get; set; } - } - - public class DtoSubObject : DtoObject - { - public string SubString { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - cfg.CreateMap() - .Include(); - - cfg.CreateMap(); - }); - - [Fact] - public void Should_map_object_to_sub_object() - { - var model = new Model - { - Object = new ModelSubObject {BaseString = "Base2", SubString = "Sub2"} - }; - - _result = Mapper.Map(model); - _result.Object.ShouldNotBeNull(); - _result.Object.ShouldBeType(); - _result.Object.ShouldBeType(); - _result.Object.BaseString.ShouldEqual("Base2"); - ((DtoSubObject) _result.Object).SubString.ShouldEqual("Sub2"); - } - } - - public class When_mapping_dto_with_only_properties : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public DateTime BaseDate { get; set; } - public ModelSubObject Sub { get; set; } - public ModelSubObject Sub2 { get; set; } - public ModelSubObject SubWithExtraName { get; set; } - public ModelSubObject SubMissing { get; set; } - } - - public class ModelSubObject - { - public string ProperName { get; set; } - public ModelSubSubObject SubSub { get; set; } - } - - public class ModelSubSubObject - { - public string IAmACoolProperty { get; set; } - } - - public class ModelDto - { - public DateTime BaseDate { get; set; } - public string SubProperName { get; set; } - public string Sub2ProperName { get; set; } - public string SubWithExtraNameProperName { get; set; } - public string SubSubSubIAmACoolProperty { get; set; } - public string SubMissingSubSubIAmACoolProperty { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelObject - { - BaseDate = new DateTime(2007, 4, 5), - Sub = new ModelSubObject - { - ProperName = "Some name", - SubSub = new ModelSubSubObject - { - IAmACoolProperty = "Cool daddy-o" - } - }, - Sub2 = new ModelSubObject - { - ProperName = "Sub 2 name" - }, - SubWithExtraName = new ModelSubObject - { - ProperName = "Some other name" - }, - SubMissing = new ModelSubObject - { - ProperName = "I have a missing sub sub object" - } - }; - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_item_in_first_level_of_hierarchy() - { - _result.BaseDate.ShouldEqual(new DateTime(2007, 4, 5)); - } - - [Fact] - public void Should_map_a_member_with_a_number() - { - _result.Sub2ProperName.ShouldEqual("Sub 2 name"); - } - - [Fact] - public void Should_map_item_in_second_level_of_hierarchy() - { - _result.SubProperName.ShouldEqual("Some name"); - } - - [Fact] - public void Should_map_item_with_more_items_in_property_name() - { - _result.SubWithExtraNameProperName.ShouldEqual("Some other name"); - } - - [Fact] - public void Should_map_item_in_any_level_of_depth_in_the_hierarchy() - { - _result.SubSubSubIAmACoolProperty.ShouldEqual("Cool daddy-o"); - } - } - - public class When_mapping_dto_with_only_fields : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public DateTime BaseDate; - public ModelSubObject Sub; - public ModelSubObject Sub2; - public ModelSubObject SubWithExtraName; - public ModelSubObject SubMissing; - } - - public class ModelSubObject - { - public string ProperName; - public ModelSubSubObject SubSub; - } - - public class ModelSubSubObject - { - public string IAmACoolProperty; - } - - public class ModelDto - { - public DateTime BaseDate; - public string SubProperName; - public string Sub2ProperName; - public string SubWithExtraNameProperName; - public string SubSubSubIAmACoolProperty; - public string SubMissingSubSubIAmACoolProperty; - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelObject - { - BaseDate = new DateTime(2007, 4, 5), - Sub = new ModelSubObject - { - ProperName = "Some name", - SubSub = new ModelSubSubObject - { - IAmACoolProperty = "Cool daddy-o" - } - }, - Sub2 = new ModelSubObject - { - ProperName = "Sub 2 name" - }, - SubWithExtraName = new ModelSubObject - { - ProperName = "Some other name" - }, - SubMissing = new ModelSubObject - { - ProperName = "I have a missing sub sub object" - } - }; - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_item_in_first_level_of_hierarchy() - { - _result.BaseDate.ShouldEqual(new DateTime(2007, 4, 5)); - } - - [Fact] - public void Should_map_a_member_with_a_number() - { - _result.Sub2ProperName.ShouldEqual("Sub 2 name"); - } - - [Fact] - public void Should_map_item_in_second_level_of_hierarchy() - { - _result.SubProperName.ShouldEqual("Some name"); - } - - [Fact] - public void Should_map_item_with_more_items_in_property_name() - { - _result.SubWithExtraNameProperName.ShouldEqual("Some other name"); - } - - [Fact] - public void Should_map_item_in_any_level_of_depth_in_the_hierarchy() - { - _result.SubSubSubIAmACoolProperty.ShouldEqual("Cool daddy-o"); - } - } - - public class When_mapping_dto_with_fields_and_properties : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public DateTime BaseDate { get; set;} - public ModelSubObject Sub; - public ModelSubObject Sub2 { get; set;} - public ModelSubObject SubWithExtraName; - public ModelSubObject SubMissing { get; set; } - } - - public class ModelSubObject - { - public string ProperName { get; set;} - public ModelSubSubObject SubSub; - } - - public class ModelSubSubObject - { - public string IAmACoolProperty { get; set;} - } - - public class ModelDto - { - public DateTime BaseDate; - public string SubProperName; - public string Sub2ProperName { get; set;} - public string SubWithExtraNameProperName; - public string SubSubSubIAmACoolProperty; - public string SubMissingSubSubIAmACoolProperty { get; set;} - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelObject - { - BaseDate = new DateTime(2007, 4, 5), - Sub = new ModelSubObject - { - ProperName = "Some name", - SubSub = new ModelSubSubObject - { - IAmACoolProperty = "Cool daddy-o" - } - }, - Sub2 = new ModelSubObject - { - ProperName = "Sub 2 name" - }, - SubWithExtraName = new ModelSubObject - { - ProperName = "Some other name" - }, - SubMissing = new ModelSubObject - { - ProperName = "I have a missing sub sub object" - } - }; - _result = Mapper.Map(model); - base.Because_of(); - } - - [Fact] - public void Should_map_item_in_first_level_of_hierarchy() - { - _result.BaseDate.ShouldEqual(new DateTime(2007, 4, 5)); - } - - [Fact] - public void Should_map_a_member_with_a_number() - { - _result.Sub2ProperName.ShouldEqual("Sub 2 name"); - } - - [Fact] - public void Should_map_item_in_second_level_of_hierarchy() - { - _result.SubProperName.ShouldEqual("Some name"); - } - - [Fact] - public void Should_map_item_with_more_items_in_property_name() - { - _result.SubWithExtraNameProperName.ShouldEqual("Some other name"); - } - - [Fact] - public void Should_map_item_in_any_level_of_depth_in_the_hierarchy() - { - _result.SubSubSubIAmACoolProperty.ShouldEqual("Cool daddy-o"); - } - } - - public class When_ignoring_a_dto_property_during_configuration : AutoMapperSpecBase - { - private TypeMap[] _allTypeMaps; - private Source _source; - - public class Source - { - public string Value { get; set; } - } - - public class Destination - { - public bool Ignored - { - get { return true; } - } - - public string Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(x => x.Ignored, opt => opt.Ignore()); - }); - - - [Fact] - public void Should_not_report_it_as_unmapped() - { - Array.ForEach(_allTypeMaps, t => t.GetUnmappedPropertyNames().ShouldBeOfLength(0)); - } - - [Fact] - public void Should_map_successfully() - { - var destination = Mapper.Map(_source); - destination.Value.ShouldEqual("foo"); - destination.Ignored.ShouldBeTrue(); - } - - protected override void Establish_context() - { - _source = new Source {Value = "foo"}; - _allTypeMaps = Configuration.GetAllTypeMaps(); - } - } - - public class When_mapping_dto_with_get_methods : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public string GetSomeCoolValue() - { - return "Cool value"; - } - - public ModelSubObject Sub { get; set; } - } - - public class ModelSubObject - { - public string GetSomeOtherCoolValue() - { - return "Even cooler"; - } - } - - public class ModelDto - { - public string SomeCoolValue { get; set; } - public string SubSomeOtherCoolValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelObject - { - Sub = new ModelSubObject() - }; - - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_base_method_value() - { - _result.SomeCoolValue.ShouldEqual("Cool value"); - } - - [Fact] - public void Should_map_second_level_method_value_off_of_property() - { - _result.SubSomeOtherCoolValue.ShouldEqual("Even cooler"); - } - } - - public class When_mapping_a_dto_with_names_matching_properties : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public string SomeCoolValue() - { - return "Cool value"; - } - - public ModelSubObject Sub { get; set; } - } - - public class ModelSubObject - { - public string SomeOtherCoolValue() - { - return "Even cooler"; - } - } - - public class ModelDto - { - public string SomeCoolValue { get; set; } - public string SubSomeOtherCoolValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var model = new ModelObject - { - Sub = new ModelSubObject() - }; - - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_base_method_value() - { - _result.SomeCoolValue.ShouldEqual("Cool value"); - } - - [Fact] - public void Should_map_second_level_method_value_off_of_property() - { - _result.SubSomeOtherCoolValue.ShouldEqual("Even cooler"); - } - } - - public class When_mapping_with_a_dto_subtype : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public ModelSubObject Sub { get; set; } - } - - public class ModelSubObject - { - public string SomeValue { get; set; } - } - - public class ModelDto - { - public ModelSubDto Sub { get; set; } - } - - public class ModelSubDto - { - public string SomeValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var model = new ModelObject - { - Sub = new ModelSubObject - { - SomeValue = "Some value" - } - }; - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_the_model_sub_type_to_the_dto_sub_type() - { - _result.Sub.ShouldNotBeNull(); - _result.Sub.SomeValue.ShouldEqual("Some value"); - } - } - - public class When_mapping_a_dto_with_a_set_only_property_and_a_get_method : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelDto - { - public int SomeValue { get; set; } - } - - public class ModelObject - { - private int _someValue; - - public int SomeValue - { - set { _someValue = value; } - } - - public int GetSomeValue() - { - return _someValue; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var model = new ModelObject(); - model.SomeValue = 46; - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_the_get_method_to_the_dto() - { - _result.SomeValue.ShouldEqual(46); - } - } - - public class When_mapping_using_a_custom_member_mappings : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelObject - { - public int Blarg { get; set; } - public string MoreBlarg { get; set; } - - public int SomeMethodToGetMoreBlarg() - { - return 45; - } - - public string SomeValue { get; set; } - public ModelSubObject SomeWeirdSubObject { get; set; } - - public string IAmSomeMethod() - { - return "I am some method"; - } - } - - public class ModelSubObject - { - public int Narf { get; set; } - public ModelSubSubObject SubSub { get; set; } - - public string SomeSubValue() - { - return "I am some sub value"; - } - } - - public class ModelSubSubObject - { - public int Norf { get; set; } - - public string SomeSubSubValue() - { - return "I am some sub sub value"; - } - } - - public class ModelDto - { - public int Splorg { get; set; } - public string SomeValue { get; set; } - public string SomeMethod { get; set; } - public int SubNarf { get; set; } - public string SubValue { get; set; } - public int GrandChildInt { get; set; } - public string GrandChildString { get; set; } - public int BlargPlus3 { get; set; } - public int BlargMinus2 { get; set; } - public int MoreBlarg { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg - .CreateMap() - .ForMember(dto => dto.Splorg, opt => opt.MapFrom(m => m.Blarg)) - .ForMember(dto => dto.SomeMethod, opt => opt.MapFrom(m => m.IAmSomeMethod())) - .ForMember(dto => dto.SubNarf, opt => opt.MapFrom(m => m.SomeWeirdSubObject.Narf)) - .ForMember(dto => dto.SubValue, opt => opt.MapFrom(m => m.SomeWeirdSubObject.SomeSubValue())) - .ForMember(dto => dto.GrandChildInt, opt => opt.MapFrom(m => m.SomeWeirdSubObject.SubSub.Norf)) - .ForMember(dto => dto.GrandChildString, - opt => opt.MapFrom(m => m.SomeWeirdSubObject.SubSub.SomeSubSubValue())) - .ForMember(dto => dto.MoreBlarg, opt => opt.MapFrom(m => m.SomeMethodToGetMoreBlarg())) - .ForMember(dto => dto.BlargPlus3, opt => opt.MapFrom(m => m.Blarg.Plus(3))) - .ForMember(dto => dto.BlargMinus2, opt => opt.MapFrom(m => m.Blarg - 2)); - - }); - - protected override void Because_of() - { - var model = new ModelObject - { - Blarg = 10, - SomeValue = "Some value", - SomeWeirdSubObject = new ModelSubObject - { - Narf = 5, - SubSub = new ModelSubSubObject - { - Norf = 15 - } - }, - MoreBlarg = "adsfdsaf" - }; - _result = Mapper.Map(model); - } - - [Fact] - public void Should_preserve_the_existing_mapping() - { - _result.SomeValue.ShouldEqual("Some value"); - } - - [Fact] - public void Should_map_top_level_properties() - { - _result.Splorg.ShouldEqual(10); - } - - [Fact] - public void Should_map_methods_results() - { - _result.SomeMethod.ShouldEqual("I am some method"); - } - - [Fact] - public void Should_map_children_properties() - { - _result.SubNarf.ShouldEqual(5); - } - - [Fact] - public void Should_map_children_methods() - { - _result.SubValue.ShouldEqual("I am some sub value"); - } - - [Fact] - public void Should_map_grandchildren_properties() - { - _result.GrandChildInt.ShouldEqual(15); - } - - [Fact] - public void Should_map_grandchildren_methods() - { - _result.GrandChildString.ShouldEqual("I am some sub sub value"); - } - - [Fact] - public void Should_map_blarg_plus_three_using_extension_method() - { - _result.BlargPlus3.ShouldEqual(13); - } - - [Fact] - public void Should_map_blarg_minus_2_using_lambda() - { - _result.BlargMinus2.ShouldEqual(8); - } - - [Fact] - public void Should_override_existing_matches_for_new_mappings() - { - _result.MoreBlarg.ShouldEqual(45); - } - } - - public class When_mapping_using_custom_member_mappings_without_generics : AutoMapperSpecBase - { - private OrderDTO _result; - - public class Order - { - public int Id { get; set; } - public string Status { get; set; } - public string Customer { get; set; } - public string ShippingCode { get; set; } - public string Zip { get; set; } - } - - public class OrderDTO - { - public int Id { get; set; } - public string CurrentState { get; set; } - public string Contact { get; set; } - public string Tracking { get; set; } - public string Postal { get; set; } - } - - public class StringCAPS : IValueResolver - { - public string Resolve(string source, ResolutionContext context) - { - return source.ToUpper(); - } - } - - public class StringLower : IValueResolver - { - public string Resolve(string source, ResolutionContext context) - { - return source.ToLower(); - } - } - - public class StringPadder : IValueResolver - { - private readonly int _desiredLength; - - public StringPadder(int desiredLength) - { - _desiredLength = desiredLength; - } - - public string Resolve(string source, ResolutionContext context) - { - return source.PadLeft(_desiredLength); - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof (Order), typeof (OrderDTO)) - .ForMember("CurrentState", map => map.MapFrom("Status")) - .ForMember("Contact", map => map.ResolveUsing(new StringCAPS(), "Customer")) - .ForMember("Tracking", map => map.ResolveUsing(typeof (StringLower), "ShippingCode")) - .ForMember("Postal", map => map.ResolveUsing(new StringPadder(6), "Zip")); - - }); - - protected override void Because_of() - { - var order = new Order - { - Id = 7, - Status = "Pending", - Customer = "Buster", - ShippingCode = "AbcxY23", - Zip = "XYZ" - }; - _result = Mapper.Map(order); - } - - [Fact] - public void Should_preserve_existing_mapping() - { - _result.Id.ShouldEqual(7); - } - - [Fact] - public void Should_support_custom_source_member() - { - _result.CurrentState.ShouldEqual("Pending"); - } - - [Fact] - public void Should_support_custom_resolver_on_custom_source_member() - { - _result.Contact.ShouldEqual("BUSTER"); - } - - [Fact] - public void Should_support_custom_resolver_by_type_on_custom_source_member() - { - _result.Tracking.ShouldEqual("abcxy23"); - } - - [Fact] - public void Should_support_custom_resolver_by_generic_type_with_constructor_on_custom_source_member() - { - _result.Postal.ShouldEqual(" XYZ"); - } - - } - - public class When_mapping_to_a_top_level_camelCased_destination_member : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public int SomeValueWithPascalName { get; set; } - } - - public class Destination - { - public int someValueWithPascalName { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var source = new Source {SomeValueWithPascalName = 5}; - _result = Mapper.Map(source); - } - - [Fact] - public void Should_match_to_PascalCased_source_member() - { - _result.someValueWithPascalName.ShouldEqual(5); - } - - [Fact] - public void Should_pass_configuration_check() - { - Configuration.AssertConfigurationIsValid(); - } - } - - public class When_mapping_to_a_self_referential_object : AutoMapperSpecBase - { - private CategoryDto _result; - - public class Category - { - public string Name { get; set; } - public IList Children { get; set; } - } - - public class CategoryDto - { - public string Name { get; set; } - public CategoryDto[] Children { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var category = new Category - { - Name = "Grandparent", - Children = new List() - { - new Category { Name = "Parent 1", Children = new List() - { - new Category { Name = "Child 1"}, - new Category { Name = "Child 2"}, - new Category { Name = "Child 3"}, - }}, - new Category { Name = "Parent 2", Children = new List() - { - new Category { Name = "Child 4"}, - new Category { Name = "Child 5"}, - new Category { Name = "Child 6"}, - new Category { Name = "Child 7"}, - }}, - } - }; - _result = Mapper.Map(category); - } - - [Fact] - public void Should_pass_configuration_check() - { - Configuration.AssertConfigurationIsValid(); - } - - [Fact] - public void Should_resolve_any_level_of_hierarchies() - { - _result.Name.ShouldEqual("Grandparent"); - _result.Children.Length.ShouldEqual(2); - _result.Children[0].Children.Length.ShouldEqual(3); - _result.Children[1].Children.Length.ShouldEqual(4); - } - } - - public class When_mapping_to_types_in_a_non_generic_manner : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof (Source), typeof (Destination)); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Value = 5}); - } - - [Fact] - public void Should_allow_for_basic_mapping() - { - _result.Value.ShouldEqual(5); - } - } - - public class When_matching_source_and_destination_members_with_underscored_members : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public SubSource some_source { get; set; } - } - - public class SubSource - { - public int value { get; set; } - } - - public class Destination - { - public int some_source_value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention(); - cfg.DestinationMemberNamingConvention = new LowerUnderscoreNamingConvention(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {some_source = new SubSource {value = 8}}); - } - - [Fact] - public void Should_use_underscores_as_tokenizers_to_flatten() - { - _destination.some_source_value.ShouldEqual(8); - } - } - - public class When_source_members_contain_prefixes : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int FooValue { get; set; } - public int GetOtherValue() - { - return 10; - } - } - - public class Destination - { - public int Value { get; set; } - public int OtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizePrefixes("Foo"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {FooValue = 5}); - } - - [Fact] - public void Registered_prefixes_ignored() - { - _destination.Value.ShouldEqual(5); - } - - [Fact] - public void Default_prefix_included() - { - _destination.OtherValue.ShouldEqual(10); - } - } - - - public class When_source_members_contain_prefixes_with_lowercase : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int fooValue { get; set; } - public int GetOtherValue() - { - return 10; - } - } - - public class Destination - { - public int Value { get; set; } - public int OtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizePrefixes("Foo"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { fooValue = 5 }); - } - - [Fact] - public void Registered_prefixes_ignored() - { - _destination.Value.ShouldEqual(5); - } - - [Fact] - public void Default_prefix_included() - { - _destination.OtherValue.ShouldEqual(10); - } - } - - public class When_source_members_contain_postfixes_with_lowercase : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Valuefoo { get; set; } - public int GetOtherValue() - { - return 10; - } - } - - public class Destination - { - public int Value { get; set; } - public int OtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizePostfixes("Foo"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Valuefoo = 5 }); - } - - [Fact] - public void Registered_prefixes_ignored() - { - _destination.Value.ShouldEqual(5); - } - - [Fact] - public void Default_prefix_included() - { - _destination.OtherValue.ShouldEqual(10); - } - } - - public class When_source_members_contain_postfixes_and_prefixes : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int FooValueBar { get; set; } - public int GetOtherValue() - { - return 10; - } - } - - public class Destination - { - public int Value { get; set; } - public int OtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizePrefixes("Foo"); - cfg.RecognizePostfixes("Bar"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { FooValueBar = 5 }); - } - - [Fact] - public void Registered_prefixes_ignored() - { - _destination.Value.ShouldEqual(5); - } - - [Fact] - public void Default_prefix_included() - { - _destination.OtherValue.ShouldEqual(10); - } - } - - public class When_source_member_names_match_with_underscores : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int I_amaCraAZZEE____Name { get; set; } - } - - public class Destination - { - public int I_amaCraAZZEE____Name { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {I_amaCraAZZEE____Name = 5}); - } - - [Fact] - public void Should_match_based_on_name() - { - _destination.I_amaCraAZZEE____Name.ShouldEqual(5); - } - } - - public class When_recognizing_explicit_member_aliases : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Foo { get; set; } - } - - public class Destination - { - public int Bar { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizeAlias("Foo", "Bar"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Foo = 5}); - } - - [Fact] - public void Members_that_match_alias_should_be_matched() - { - _destination.Bar.ShouldEqual(5); - } - } - - public class When_destination_members_contain_prefixes : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - public class Destination - { - public int FooValue { get; set; } - public int BarValue2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.RecognizeDestinationPrefixes("Foo", "Bar"); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source { Value = 5, Value2 = 10 }); - } - - [Fact] - public void Registered_prefixes_ignored() - { - _destination.FooValue.ShouldEqual(5); - _destination.BarValue2.ShouldEqual(10); - } - } - - } - - public class When_destination_type_has_private_members : AutoMapperSpecBase - { - private IDestination _destination; - - public class Source - { - public int Value { get; set; } - } - - public interface IDestination - { - int Value { get; } - } - - public class Destination : IDestination - { - public Destination(int value) - { - Value = value; - } - - private Destination() - { - } - - public int Value { get; private set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Value = 5}); - } - - [Fact] - public void Should_use_private_accessors_and_constructors() - { - _destination.Value.ShouldEqual(5); - } - } - - public static class MapFromExtensions - { - public static int Plus(this int left, int right) - { - return left + right; - } - } -} +using System; +using System.Collections.Generic; +using AutoMapper.Mappers; +using Shouldly; +using Xunit; +using System.Reflection; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + namespace MemberResolution + { + public class When_mapping_derived_classes_in_arrays : AutoMapperSpecBase + { + private DtoObject[] _result; + + public class ModelObject + { + public string BaseString { get; set; } + } + + public class ModelSubObject : ModelObject + { + public string SubString { get; set; } + } + + public class DtoObject + { + public string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new[] + { + new ModelObject {BaseString = "Base1"}, + new ModelSubObject {BaseString = "Base2", SubString = "Sub2"} + }; + _result = (DtoObject[]) Mapper.Map(model, typeof (ModelObject[]), typeof (DtoObject[])); + } + + [Fact] + public void Should_map_both_the_base_and_sub_objects() + { + _result.Length.ShouldBe(2); + _result[0].BaseString.ShouldBe("Base1"); + _result[1].BaseString.ShouldBe("Base2"); + } + + [Fact] + public void Should_map_to_the_correct_respective_dto_types() + { + _result[0].ShouldBeOfType(typeof (DtoObject)); + _result[1].ShouldBeOfType(typeof (DtoSubObject)); + } + } + + public class When_mapping_derived_classes : AutoMapperSpecBase + { + private DtoObject _result; + + public class ModelObject + { + public string BaseString { get; set; } + } + + public class ModelSubObject : ModelObject + { + public string SubString { get; set; } + } + + public class DtoObject + { + public string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelSubObject { BaseString = "Base2", SubString = "Sub2" }; + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_to_the_correct_dto_types() + { + _result.ShouldBeOfType(typeof(DtoSubObject)); + } + } + + public class When_mapping_derived_classes_from_intefaces_to_abstract : AutoMapperSpecBase + { + private DtoObject[] _result; + + public interface IModelObject + { + string BaseString { get; set; } + } + + public class ModelSubObject : IModelObject + { + public string SubString { get; set; } + public string BaseString { get; set; } + } + + public abstract class DtoObject + { + public virtual string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new IModelObject[] + { + new ModelSubObject {BaseString = "Base2", SubString = "Sub2"} + }; + _result = (DtoObject[]) Mapper.Map(model, typeof (IModelObject[]), typeof (DtoObject[])); + base.Because_of(); + } + + [Fact] + public void Should_map_both_the_base_and_sub_objects() + { + _result.Length.ShouldBe(1); + _result[0].BaseString.ShouldBe("Base2"); + } + + [Fact] + public void Should_map_to_the_correct_respective_dto_types() + { + _result[0].ShouldBeOfType(typeof (DtoSubObject)); + ((DtoSubObject) _result[0]).SubString.ShouldBe("Sub2"); + } + } + + public class When_mapping_derived_classes_as_property_of_top_object : AutoMapperSpecBase + { + private DtoModel _result; + + public class Model + { + public IModelObject Object { get; set; } + } + + public interface IModelObject + { + string BaseString { get; set; } + } + + public class ModelSubObject : IModelObject + { + public string SubString { get; set; } + public string BaseString { get; set; } + } + + public class DtoModel + { + public DtoObject Object { get; set; } + } + + public abstract class DtoObject + { + public virtual string BaseString { get; set; } + } + + public class DtoSubObject : DtoObject + { + public string SubString { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + cfg.CreateMap() + .Include(); + + cfg.CreateMap(); + }); + + [Fact] + public void Should_map_object_to_sub_object() + { + var model = new Model + { + Object = new ModelSubObject {BaseString = "Base2", SubString = "Sub2"} + }; + + _result = Mapper.Map(model); + _result.Object.ShouldNotBeNull(); + _result.Object.ShouldBeOfType(); + _result.Object.ShouldBeOfType(); + _result.Object.BaseString.ShouldBe("Base2"); + ((DtoSubObject) _result.Object).SubString.ShouldBe("Sub2"); + } + } + + public class When_mapping_dto_with_only_properties : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public DateTime BaseDate { get; set; } + public ModelSubObject Sub { get; set; } + public ModelSubObject Sub2 { get; set; } + public ModelSubObject SubWithExtraName { get; set; } + public ModelSubObject SubMissing { get; set; } + } + + public class ModelSubObject + { + public string ProperName { get; set; } + public ModelSubSubObject SubSub { get; set; } + } + + public class ModelSubSubObject + { + public string IAmACoolProperty { get; set; } + } + + public class ModelDto + { + public DateTime BaseDate { get; set; } + public string SubProperName { get; set; } + public string Sub2ProperName { get; set; } + public string SubWithExtraNameProperName { get; set; } + public string SubSubSubIAmACoolProperty { get; set; } + public string SubMissingSubSubIAmACoolProperty { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject + { + BaseDate = new DateTime(2007, 4, 5), + Sub = new ModelSubObject + { + ProperName = "Some name", + SubSub = new ModelSubSubObject + { + IAmACoolProperty = "Cool daddy-o" + } + }, + Sub2 = new ModelSubObject + { + ProperName = "Sub 2 name" + }, + SubWithExtraName = new ModelSubObject + { + ProperName = "Some other name" + }, + SubMissing = new ModelSubObject + { + ProperName = "I have a missing sub sub object" + } + }; + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_item_in_first_level_of_hierarchy() + { + _result.BaseDate.ShouldBe(new DateTime(2007, 4, 5)); + } + + [Fact] + public void Should_map_a_member_with_a_number() + { + _result.Sub2ProperName.ShouldBe("Sub 2 name"); + } + + [Fact] + public void Should_map_item_in_second_level_of_hierarchy() + { + _result.SubProperName.ShouldBe("Some name"); + } + + [Fact] + public void Should_map_item_with_more_items_in_property_name() + { + _result.SubWithExtraNameProperName.ShouldBe("Some other name"); + } + + [Fact] + public void Should_map_item_in_any_level_of_depth_in_the_hierarchy() + { + _result.SubSubSubIAmACoolProperty.ShouldBe("Cool daddy-o"); + } + } + + public class When_mapping_dto_with_only_fields : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public DateTime BaseDate; + public ModelSubObject Sub; + public ModelSubObject Sub2; + public ModelSubObject SubWithExtraName; + public ModelSubObject SubMissing; + } + + public class ModelSubObject + { + public string ProperName; + public ModelSubSubObject SubSub; + } + + public class ModelSubSubObject + { + public string IAmACoolProperty; + } + + public class ModelDto + { + public DateTime BaseDate; + public string SubProperName; + public string Sub2ProperName; + public string SubWithExtraNameProperName; + public string SubSubSubIAmACoolProperty; + public string SubMissingSubSubIAmACoolProperty; + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject + { + BaseDate = new DateTime(2007, 4, 5), + Sub = new ModelSubObject + { + ProperName = "Some name", + SubSub = new ModelSubSubObject + { + IAmACoolProperty = "Cool daddy-o" + } + }, + Sub2 = new ModelSubObject + { + ProperName = "Sub 2 name" + }, + SubWithExtraName = new ModelSubObject + { + ProperName = "Some other name" + }, + SubMissing = new ModelSubObject + { + ProperName = "I have a missing sub sub object" + } + }; + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_item_in_first_level_of_hierarchy() + { + _result.BaseDate.ShouldBe(new DateTime(2007, 4, 5)); + } + + [Fact] + public void Should_map_a_member_with_a_number() + { + _result.Sub2ProperName.ShouldBe("Sub 2 name"); + } + + [Fact] + public void Should_map_item_in_second_level_of_hierarchy() + { + _result.SubProperName.ShouldBe("Some name"); + } + + [Fact] + public void Should_map_item_with_more_items_in_property_name() + { + _result.SubWithExtraNameProperName.ShouldBe("Some other name"); + } + + [Fact] + public void Should_map_item_in_any_level_of_depth_in_the_hierarchy() + { + _result.SubSubSubIAmACoolProperty.ShouldBe("Cool daddy-o"); + } + } + + public class When_mapping_dto_with_fields_and_properties : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public DateTime BaseDate { get; set;} + public ModelSubObject Sub; + public ModelSubObject Sub2 { get; set;} + public ModelSubObject SubWithExtraName; + public ModelSubObject SubMissing { get; set; } + } + + public class ModelSubObject + { + public string ProperName { get; set;} + public ModelSubSubObject SubSub; + } + + public class ModelSubSubObject + { + public string IAmACoolProperty { get; set;} + } + + public class ModelDto + { + public DateTime BaseDate; + public string SubProperName; + public string Sub2ProperName { get; set;} + public string SubWithExtraNameProperName; + public string SubSubSubIAmACoolProperty; + public string SubMissingSubSubIAmACoolProperty { get; set;} + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject + { + BaseDate = new DateTime(2007, 4, 5), + Sub = new ModelSubObject + { + ProperName = "Some name", + SubSub = new ModelSubSubObject + { + IAmACoolProperty = "Cool daddy-o" + } + }, + Sub2 = new ModelSubObject + { + ProperName = "Sub 2 name" + }, + SubWithExtraName = new ModelSubObject + { + ProperName = "Some other name" + }, + SubMissing = new ModelSubObject + { + ProperName = "I have a missing sub sub object" + } + }; + _result = Mapper.Map(model); + base.Because_of(); + } + + [Fact] + public void Should_map_item_in_first_level_of_hierarchy() + { + _result.BaseDate.ShouldBe(new DateTime(2007, 4, 5)); + } + + [Fact] + public void Should_map_a_member_with_a_number() + { + _result.Sub2ProperName.ShouldBe("Sub 2 name"); + } + + [Fact] + public void Should_map_item_in_second_level_of_hierarchy() + { + _result.SubProperName.ShouldBe("Some name"); + } + + [Fact] + public void Should_map_item_with_more_items_in_property_name() + { + _result.SubWithExtraNameProperName.ShouldBe("Some other name"); + } + + [Fact] + public void Should_map_item_in_any_level_of_depth_in_the_hierarchy() + { + _result.SubSubSubIAmACoolProperty.ShouldBe("Cool daddy-o"); + } + } + + public class When_ignoring_a_dto_property_during_configuration : AutoMapperSpecBase + { + private TypeMap[] _allTypeMaps; + private Source _source; + + public class Source + { + public string Value { get; set; } + } + + public class Destination + { + public bool Ignored + { + get { return true; } + } + + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(x => x.Ignored, opt => opt.Ignore()); + }); + + + [Fact] + public void Should_not_report_it_as_unmapped() + { + foreach (var typeMap in _allTypeMaps) + { + typeMap.GetUnmappedPropertyNames().ShouldBeOfLength(0); + } + } + + [Fact] + public void Should_map_successfully() + { + var destination = Mapper.Map(_source); + destination.Value.ShouldBe("foo"); + destination.Ignored.ShouldBeTrue(); + } + + protected override void Establish_context() + { + _source = new Source {Value = "foo"}; + _allTypeMaps = Configuration.GetAllTypeMaps(); + } + } + + public class When_mapping_dto_with_get_methods : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public string GetSomeCoolValue() + { + return "Cool value"; + } + + public ModelSubObject Sub { get; set; } + } + + public class ModelSubObject + { + public string GetSomeOtherCoolValue() + { + return "Even cooler"; + } + } + + public class ModelDto + { + public string SomeCoolValue { get; set; } + public string SubSomeOtherCoolValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject + { + Sub = new ModelSubObject() + }; + + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_base_method_value() + { + _result.SomeCoolValue.ShouldBe("Cool value"); + } + + [Fact] + public void Should_map_second_level_method_value_off_of_property() + { + _result.SubSomeOtherCoolValue.ShouldBe("Even cooler"); + } + } + + public class When_mapping_a_dto_with_names_matching_properties : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public string SomeCoolValue() + { + return "Cool value"; + } + + public ModelSubObject Sub { get; set; } + } + + public class ModelSubObject + { + public string SomeOtherCoolValue() + { + return "Even cooler"; + } + } + + public class ModelDto + { + public string SomeCoolValue { get; set; } + public string SubSomeOtherCoolValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject + { + Sub = new ModelSubObject() + }; + + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_base_method_value() + { + _result.SomeCoolValue.ShouldBe("Cool value"); + } + + [Fact] + public void Should_map_second_level_method_value_off_of_property() + { + _result.SubSomeOtherCoolValue.ShouldBe("Even cooler"); + } + } + + public class When_mapping_with_a_dto_subtype : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public ModelSubObject Sub { get; set; } + } + + public class ModelSubObject + { + public string SomeValue { get; set; } + } + + public class ModelDto + { + public ModelSubDto Sub { get; set; } + } + + public class ModelSubDto + { + public string SomeValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var model = new ModelObject + { + Sub = new ModelSubObject + { + SomeValue = "Some value" + } + }; + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_the_model_sub_type_to_the_dto_sub_type() + { + _result.Sub.ShouldNotBeNull(); + _result.Sub.SomeValue.ShouldBe("Some value"); + } + } + + public class When_mapping_a_dto_with_a_set_only_property_and_a_get_method : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelDto + { + public int SomeValue { get; set; } + } + + public class ModelObject + { + private int _someValue; + + public int SomeValue + { + set { _someValue = value; } + } + + public int GetSomeValue() + { + return _someValue; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var model = new ModelObject(); + model.SomeValue = 46; + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_map_the_get_method_to_the_dto() + { + _result.SomeValue.ShouldBe(46); + } + } + + public class When_mapping_using_a_custom_member_mappings : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelObject + { + public int Blarg { get; set; } + public string MoreBlarg { get; set; } + + public int SomeMethodToGetMoreBlarg() + { + return 45; + } + + public string SomeValue { get; set; } + public ModelSubObject SomeWeirdSubObject { get; set; } + + public string IAmSomeMethod() + { + return "I am some method"; + } + } + + public class ModelSubObject + { + public int Narf { get; set; } + public ModelSubSubObject SubSub { get; set; } + + public string SomeSubValue() + { + return "I am some sub value"; + } + } + + public class ModelSubSubObject + { + public int Norf { get; set; } + + public string SomeSubSubValue() + { + return "I am some sub sub value"; + } + } + + public class ModelDto + { + public int Splorg { get; set; } + public string SomeValue { get; set; } + public string SomeMethod { get; set; } + public int SubNarf { get; set; } + public string SubValue { get; set; } + public int GrandChildInt { get; set; } + public string GrandChildString { get; set; } + public int BlargPlus3 { get; set; } + public int BlargMinus2 { get; set; } + public int MoreBlarg { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg + .CreateMap() + .ForMember(dto => dto.Splorg, opt => opt.MapFrom(m => m.Blarg)) + .ForMember(dto => dto.SomeMethod, opt => opt.MapFrom(m => m.IAmSomeMethod())) + .ForMember(dto => dto.SubNarf, opt => opt.MapFrom(m => m.SomeWeirdSubObject.Narf)) + .ForMember(dto => dto.SubValue, opt => opt.MapFrom(m => m.SomeWeirdSubObject.SomeSubValue())) + .ForMember(dto => dto.GrandChildInt, opt => opt.MapFrom(m => m.SomeWeirdSubObject.SubSub.Norf)) + .ForMember(dto => dto.GrandChildString, + opt => opt.MapFrom(m => m.SomeWeirdSubObject.SubSub.SomeSubSubValue())) + .ForMember(dto => dto.MoreBlarg, opt => opt.MapFrom(m => m.SomeMethodToGetMoreBlarg())) + .ForMember(dto => dto.BlargPlus3, opt => opt.MapFrom(m => m.Blarg.Plus(3))) + .ForMember(dto => dto.BlargMinus2, opt => opt.MapFrom(m => m.Blarg - 2)); + + }); + + protected override void Because_of() + { + var model = new ModelObject + { + Blarg = 10, + SomeValue = "Some value", + SomeWeirdSubObject = new ModelSubObject + { + Narf = 5, + SubSub = new ModelSubSubObject + { + Norf = 15 + } + }, + MoreBlarg = "adsfdsaf" + }; + _result = Mapper.Map(model); + } + + [Fact] + public void Should_preserve_the_existing_mapping() + { + _result.SomeValue.ShouldBe("Some value"); + } + + [Fact] + public void Should_map_top_level_properties() + { + _result.Splorg.ShouldBe(10); + } + + [Fact] + public void Should_map_methods_results() + { + _result.SomeMethod.ShouldBe("I am some method"); + } + + [Fact] + public void Should_map_children_properties() + { + _result.SubNarf.ShouldBe(5); + } + + [Fact] + public void Should_map_children_methods() + { + _result.SubValue.ShouldBe("I am some sub value"); + } + + [Fact] + public void Should_map_grandchildren_properties() + { + _result.GrandChildInt.ShouldBe(15); + } + + [Fact] + public void Should_map_grandchildren_methods() + { + _result.GrandChildString.ShouldBe("I am some sub sub value"); + } + + [Fact] + public void Should_map_blarg_plus_three_using_extension_method() + { + _result.BlargPlus3.ShouldBe(13); + } + + [Fact] + public void Should_map_blarg_minus_2_using_lambda() + { + _result.BlargMinus2.ShouldBe(8); + } + + [Fact] + public void Should_override_existing_matches_for_new_mappings() + { + _result.MoreBlarg.ShouldBe(45); + } + } + + public class When_mapping_using_custom_member_mappings_without_generics : AutoMapperSpecBase + { + private OrderDTO _result; + + public class Order + { + public int Id { get; set; } + public string Status { get; set; } + public string Customer { get; set; } + public string ShippingCode { get; set; } + public string Zip { get; set; } + } + + public class OrderDTO + { + public int Id { get; set; } + public string CurrentState { get; set; } + public string Contact { get; set; } + public string Tracking { get; set; } + public string Postal { get; set; } + } + + public class StringCAPS : IMemberValueResolver + { + public string Resolve(object s, object d, string source, string dest, ResolutionContext context) + { + return source.ToUpper(); + } + } + + public class StringLower : IMemberValueResolver + { + public string Resolve(object s, object d, string source, string dest, ResolutionContext context) + { + return source.ToLower(); + } + } + + public class StringPadder : IMemberValueResolver + { + private readonly int _desiredLength; + + public StringPadder(int desiredLength) + { + _desiredLength = desiredLength; + } + + public string Resolve(object s, object d, string source, string dest, ResolutionContext context) + { + return source.PadLeft(_desiredLength); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof (Order), typeof (OrderDTO)) + .ForMember("CurrentState", map => map.MapFrom("Status")) + .ForMember("Contact", map => map.MapFrom(new StringCAPS(), "Customer")) + .ForMember("Tracking", map => map.MapFrom(typeof (StringLower), "ShippingCode")) + .ForMember("Postal", map => map.MapFrom(new StringPadder(6), "Zip")); + + }); + + protected override void Because_of() + { + var order = new Order + { + Id = 7, + Status = "Pending", + Customer = "Buster", + ShippingCode = "AbcxY23", + Zip = "XYZ" + }; + _result = Mapper.Map(order); + } + + [Fact] + public void Should_preserve_existing_mapping() + { + _result.Id.ShouldBe(7); + } + + [Fact] + public void Should_support_custom_source_member() + { + _result.CurrentState.ShouldBe("Pending"); + } + + [Fact] + public void Should_support_custom_resolver_on_custom_source_member() + { + _result.Contact.ShouldBe("BUSTER"); + } + + [Fact] + public void Should_support_custom_resolver_by_type_on_custom_source_member() + { + _result.Tracking.ShouldBe("abcxy23"); + } + + [Fact] + public void Should_support_custom_resolver_by_generic_type_with_constructor_on_custom_source_member() + { + _result.Postal.ShouldBe(" XYZ"); + } + + } + + public class When_mapping_to_a_top_level_camelCased_destination_member : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public int SomeValueWithPascalName { get; set; } + } + + public class Destination + { + public int someValueWithPascalName { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var source = new Source {SomeValueWithPascalName = 5}; + _result = Mapper.Map(source); + } + + [Fact] + public void Should_match_to_PascalCased_source_member() + { + _result.someValueWithPascalName.ShouldBe(5); + } + + [Fact] + public void Should_pass_configuration_check() + { + Configuration.AssertConfigurationIsValid(); + } + } + + public class When_mapping_to_a_self_referential_object : AutoMapperSpecBase + { + private CategoryDto _result; + + public class Category + { + public string Name { get; set; } + public IList Children { get; set; } + } + + public class CategoryDto + { + public string Name { get; set; } + public CategoryDto[] Children { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var category = new Category + { + Name = "Grandparent", + Children = new List() + { + new Category { Name = "Parent 1", Children = new List() + { + new Category { Name = "Child 1"}, + new Category { Name = "Child 2"}, + new Category { Name = "Child 3"}, + }}, + new Category { Name = "Parent 2", Children = new List() + { + new Category { Name = "Child 4"}, + new Category { Name = "Child 5"}, + new Category { Name = "Child 6"}, + new Category { Name = "Child 7"}, + }}, + } + }; + _result = Mapper.Map(category); + } + + [Fact] + public void Should_pass_configuration_check() + { + Configuration.AssertConfigurationIsValid(); + } + + [Fact] + public void Should_resolve_any_level_of_hierarchies() + { + _result.Name.ShouldBe("Grandparent"); + _result.Children.Length.ShouldBe(2); + _result.Children[0].Children.Length.ShouldBe(3); + _result.Children[1].Children.Length.ShouldBe(4); + } + } + + public class When_mapping_to_types_in_a_non_generic_manner : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof (Source), typeof (Destination)); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Value = 5}); + } + + [Fact] + public void Should_allow_for_basic_mapping() + { + _result.Value.ShouldBe(5); + } + } + + public class When_matching_source_and_destination_members_with_underscored_members : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public SubSource some_source { get; set; } + } + + public class SubSource + { + public int value { get; set; } + } + + public class Destination + { + public int some_source_value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention(); + cfg.DestinationMemberNamingConvention = new LowerUnderscoreNamingConvention(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {some_source = new SubSource {value = 8}}); + } + + [Fact] + public void Should_use_underscores_as_tokenizers_to_flatten() + { + _destination.some_source_value.ShouldBe(8); + } + } + + public class When_source_members_contain_prefixes : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int FooValue { get; set; } + public int GetOtherValue() + { + return 10; + } + } + + public class Destination + { + public int Value { get; set; } + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizePrefixes("Foo"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {FooValue = 5}); + } + + [Fact] + public void Registered_prefixes_ignored() + { + _destination.Value.ShouldBe(5); + } + + [Fact] + public void Default_prefix_included() + { + _destination.OtherValue.ShouldBe(10); + } + } + + + public class When_source_members_contain_prefixes_with_lowercase : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int fooValue { get; set; } + public int GetOtherValue() + { + return 10; + } + } + + public class Destination + { + public int Value { get; set; } + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizePrefixes("Foo"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { fooValue = 5 }); + } + + [Fact] + public void Registered_prefixes_ignored() + { + _destination.Value.ShouldBe(5); + } + + [Fact] + public void Default_prefix_included() + { + _destination.OtherValue.ShouldBe(10); + } + } + + public class When_source_members_contain_postfixes_with_lowercase : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Valuefoo { get; set; } + public int GetOtherValue() + { + return 10; + } + } + + public class Destination + { + public int Value { get; set; } + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizePostfixes("Foo"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Valuefoo = 5 }); + } + + [Fact] + public void Registered_prefixes_ignored() + { + _destination.Value.ShouldBe(5); + } + + [Fact] + public void Default_prefix_included() + { + _destination.OtherValue.ShouldBe(10); + } + } + + public class When_source_members_contain_postfixes_and_prefixes : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int FooValueBar { get; set; } + public int GetOtherValue() + { + return 10; + } + } + + public class Destination + { + public int Value { get; set; } + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizePrefixes("Foo"); + cfg.RecognizePostfixes("Bar"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { FooValueBar = 5 }); + } + + [Fact] + public void Registered_prefixes_ignored() + { + _destination.Value.ShouldBe(5); + } + + [Fact] + public void Default_prefix_included() + { + _destination.OtherValue.ShouldBe(10); + } + } + + public class When_source_member_names_match_with_underscores : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int I_amaCraAZZEE____Name { get; set; } + } + + public class Destination + { + public int I_amaCraAZZEE____Name { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {I_amaCraAZZEE____Name = 5}); + } + + [Fact] + public void Should_match_based_on_name() + { + _destination.I_amaCraAZZEE____Name.ShouldBe(5); + } + } + + public class When_recognizing_explicit_member_aliases : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Foo { get; set; } + } + + public class Destination + { + public int Bar { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizeAlias("Foo", "Bar"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Foo = 5}); + } + + [Fact] + public void Members_that_match_alias_should_be_matched() + { + _destination.Bar.ShouldBe(5); + } + } + + public class When_destination_members_contain_prefixes : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + public class Destination + { + public int FooValue { get; set; } + public int BarValue2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.RecognizeDestinationPrefixes("Foo", "Bar"); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Value = 5, Value2 = 10 }); + } + + [Fact] + public void Registered_prefixes_ignored() + { + _destination.FooValue.ShouldBe(5); + _destination.BarValue2.ShouldBe(10); + } + } + + } + + public class When_destination_type_has_private_members : AutoMapperSpecBase + { + private IDestination _destination; + + public class Source + { + public int Value { get; set; } + } + + public interface IDestination + { + int Value { get; } + } + + public class Destination : IDestination + { + public Destination(int value) + { + Value = value; + } + + private Destination() + { + } + + public int Value { get; private set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Value = 5}); + } + + [Fact] + public void Should_use_private_accessors_and_constructors() + { + _destination.Value.ShouldBe(5); + } + } + + public static class MapFromExtensions + { + public static int Plus(this int left, int right) + { + return left + right; + } + } +} diff --git a/src/UnitTests/NestedContainers.cs b/src/UnitTests/NestedContainers.cs index b8b0e73e6c..b6c35c09ee 100644 --- a/src/UnitTests/NestedContainers.cs +++ b/src/UnitTests/NestedContainers.cs @@ -1,140 +1,140 @@ -using System; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace NestedContainers - { - public class When_specifying_a_custom_contextual_constructor : AutoMapperSpecBase - { - private Dest _dest; - - public class FooResolver : IValueResolver - { - private readonly int _value; - - public FooResolver() - : this(1) - { - } - - public FooResolver(int value) - { - _value = value; - } - - public int Resolve(int source, ResolutionContext context) - { - return source + _value; - } - } - - public class BarResolver : IValueResolver - { - public int Resolve(int source, ResolutionContext context) - { - return source + 1; - } - } - - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - public class Dest - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(x => x.Value, opt => opt.ResolveUsing(x => x.Value)) - .ForMember(x => x.Value2, opt => opt.ResolveUsing(x => x.Value2)); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source { Value = 5, Value2 = 6 }, - opt => opt.ConstructServicesUsing(type => type == typeof(FooResolver) ? new FooResolver(2) : null)); - } - - [Fact] - public void Should_use_the_new_ctor() - { - _dest.Value.ShouldEqual(7); - } - - [Fact] - public void Should_use_the_existing_ctor_for_non_overridden_ctors() - { - _dest.Value2.ShouldEqual(7); - } - } - - public class When_specifying_a_custom_contextual_constructor_for_type_converters : AutoMapperSpecBase - { - private Dest _dest; - - public class FooTypeConverter : ITypeConverter - { - private readonly int _value; - - public FooTypeConverter() - : this(1) - { - } - - public FooTypeConverter(int value) - { - _value = value; - } - - public Dest Convert(Source source, ResolutionContext context) - { - return new Dest - { - Value = source.Value + _value, - Value2 = source.Value2 + _value - }; - } - } - - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - public class Dest - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ConvertUsing(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source { Value = 5, Value2 = 6 }, - opt => opt.ConstructServicesUsing(type => type == typeof(FooTypeConverter) ? new FooTypeConverter(2) : null)); - } - - [Fact] - public void Should_use_the_new_ctor() - { - _dest.Value.ShouldEqual(7); - _dest.Value2.ShouldEqual(8); - } - - } - } +using System; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests +{ + namespace NestedContainers + { + public class When_specifying_a_custom_contextual_constructor : AutoMapperSpecBase + { + private Dest _dest; + + public class FooResolver : IMemberValueResolver + { + private readonly int _value; + + public FooResolver() + : this(1) + { + } + + public FooResolver(int value) + { + _value = value; + } + + public int Resolve(Source s, Dest d, int source, int dest, ResolutionContext context) + { + return source + _value; + } + } + + public class BarResolver : IMemberValueResolver + { + public int Resolve(Source s, Dest d, int source, int dest, ResolutionContext context) + { + return source + 1; + } + } + + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + public class Dest + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(x => x.Value, opt => opt.MapFrom(x => x.Value)) + .ForMember(x => x.Value2, opt => opt.MapFrom(x => x.Value2)); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source { Value = 5, Value2 = 6 }, + opt => opt.ConstructServicesUsing(type => type == typeof(FooResolver) ? new FooResolver(2) : null)); + } + + [Fact] + public void Should_use_the_new_ctor() + { + _dest.Value.ShouldBe(7); + } + + [Fact] + public void Should_use_the_existing_ctor_for_non_overridden_ctors() + { + _dest.Value2.ShouldBe(7); + } + } + + public class When_specifying_a_custom_contextual_constructor_for_type_converters : AutoMapperSpecBase + { + private Dest _dest; + + public class FooTypeConverter : ITypeConverter + { + private readonly int _value; + + public FooTypeConverter() + : this(1) + { + } + + public FooTypeConverter(int value) + { + _value = value; + } + + public Dest Convert(Source source, Dest destination, ResolutionContext context) + { + return new Dest + { + Value = source.Value + _value, + Value2 = source.Value2 + _value + }; + } + } + + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + public class Dest + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ConvertUsing(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source { Value = 5, Value2 = 6 }, + opt => opt.ConstructServicesUsing(type => type == typeof(FooTypeConverter) ? new FooTypeConverter(2) : null)); + } + + [Fact] + public void Should_use_the_new_ctor() + { + _dest.Value.ShouldBe(7); + _dest.Value2.ShouldBe(8); + } + + } + } } \ No newline at end of file diff --git a/src/UnitTests/NullBehavior.cs b/src/UnitTests/NullBehavior.cs index 1685010e4d..bf3932c37f 100644 --- a/src/UnitTests/NullBehavior.cs +++ b/src/UnitTests/NullBehavior.cs @@ -1,434 +1,905 @@ -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace NullBehavior - { - public class When_mapping_a_model_with_null_items : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelDto - { - public ModelSubDto Sub { get; set; } - public int SubSomething { get; set; } - public string NullString { get; set; } - } - - public class ModelSubDto - { - public int[] Items { get; set; } - } - - public class ModelObject - { - public ModelSubObject Sub { get; set; } - public string NullString { get; set; } - } - - public class ModelSubObject - { - public int[] GetItems() - { - return new[] { 0, 1, 2, 3 }; - } - - public int Something { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = false; - cfg.CreateMap(); - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var model = new ModelObject(); - model.Sub = null; - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_populate_dto_items_with_a_value() - { - _result.Sub.ShouldNotBeNull(); - } - - [Fact] - public void Should_provide_empty_array_for_array_type_values() - { - _result.Sub.Items.ShouldNotBeNull(); - } - - [Fact] - public void Should_return_default_value_of_property_in_the_chain() - { - _result.SubSomething.ShouldEqual(0); - } - - [Fact] - public void Default_value_for_string_should_be_empty() - { - _result.NullString.ShouldEqual(string.Empty); - } - } - - public class When_overriding_null_behavior_with_null_source_items : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelDto - { - public ModelSubDto Sub { get; set; } - public int SubSomething { get; set; } - public string NullString { get; set; } - } - - public class ModelSubDto - { - public int[] Items { get; set; } - } - - public class ModelObject - { - public ModelSubObject Sub { get; set; } - public string NullString { get; set; } - } - - public class ModelSubObject - { - public int[] GetItems() - { - return new[] { 0, 1, 2, 3 }; - } - - public int Something { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - - cfg.AllowNullDestinationValues = true; - cfg.CreateMap(); - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var model = new ModelObject(); - model.Sub = null; - model.NullString = null; - - _result = Mapper.Map(model); - } - - [Fact] - public void Should_map_first_level_items_as_null() - { - _result.NullString.ShouldBeNull(); - } - - [Fact] - public void Should_map_primitive_items_as_default() - { - _result.SubSomething.ShouldEqual(0); - } - - [Fact] - public void Should_map_any_sub_mapped_items_as_null() - { - _result.Sub.ShouldBeNull(); - } - } - - public class When_overriding_null_behavior_in_a_profile : AutoMapperSpecBase - { - private DefaultDestination _defaultResult; - private NullDestination _nullResult; - - public class DefaultSource - { - public object Value { get; set; } - } - - public class DefaultDestination - { - public object Value { get; set; } - } - - public class NullSource - { - public object Value { get; set; } - } - - public class NullDestination - { - public object Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateProfile("MapsNulls", p => - { - p.AllowNullDestinationValues = false; - p.CreateMap(); - }); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _defaultResult = Mapper.Map(new DefaultSource()); - _nullResult = Mapper.Map(new NullSource()); - } - - [Fact] - public void Should_use_default_behavior_in_default_profile() - { - _defaultResult.Value.ShouldBeNull(); - } - - [Fact] - public void Should_use_overridden_null_behavior_in_profile() - { - _nullResult.Value.ShouldNotBeNull(); - } - } - - public class When_using_a_custom_resolver_and_the_source_value_is_null : NonValidatingSpecBase - { - public class NullResolver : IValueResolver - { - public string Resolve(string source, ResolutionContext context) - { - if (source == null) - return "jon"; - return "fail"; - } - } - - private static Source _source; - private Destination _dest; - - public class Source - { - public string MyName { get; set; } - } - - public class Destination - { - public string Name { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Name, opt => opt.ResolveUsing(src => src.MyName)); - _source = new Source(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(_source); - } - - [Fact] - public void Should_perform_the_translation() - { - _dest.Name.ShouldEqual("jon"); - } - } - - public class When_mapping_using_a_custom_member_mapping_and_source_is_null : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public SubSource Sub { get; set; } - } - - public class SubSource - { - public int Value { get; set; } - } - - public class Dest - { - public int OtherValue { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AllowNullDestinationValues = false; - cfg.CreateMap() - .ForMember(dest => dest.OtherValue, opt => opt.MapFrom(src => src.Sub.Value)); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source()); - } - - [Fact] - public void Should_map_to_null_on_destination_values() - { - _dest.OtherValue.ShouldEqual(0); - } - } - - public class When_specifying_a_resolver_for_a_nullable_type : AutoMapperSpecBase - { - private FooViewModel _result; - - public class NullableBoolToLabel : ITypeConverter - { - public string Convert(bool? source, ResolutionContext context) - { - if (source.HasValue) - { - if (source.Value) - return "Yes"; - else - return "No"; - } - else - return "(n/a)"; - } - } - - public class Foo - { - public bool? IsFooBarred { get; set; } - } - - public class FooViewModel - { - public string IsFooBarred { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ConvertUsing(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var foo3 = new Foo { IsFooBarred = null }; - _result = Mapper.Map(foo3); - } - - [Fact] - public void Should_allow_the_resolver_to_handle_null_values() - { - _result.IsFooBarred.ShouldEqual("(n/a)"); - } - } - - public class When_overriding_collection_null_behavior : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public IEnumerable Values1 { get; set; } - public List Values2 { get; set; } - public Dictionary Values3 { get; set; } - public int[] Values4 { get; set; } - public ReadOnlyCollection Values5 { get; set; } - public Collection Values6 { get; set; } - } - - public class Dest - { - public IEnumerable Values1 { get; set; } - public List Values2 { get; set; } - public Dictionary Values3 { get; set; } - public int[] Values4 { get; set; } - public ReadOnlyCollection Values5 { get; set; } - public Collection Values6 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.AllowNullCollections = true; - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source()); - } - - [Fact] - public void Should_allow_null_ienumerables() - { - _dest.Values1.ShouldBeNull(); - } - - [Fact] - public void Should_allow_null_lists() - { - _dest.Values2.ShouldBeNull(); - } - - [Fact] - public void Should_allow_null_dictionaries() - { - _dest.Values3.ShouldBeNull(); - } - - [Fact] - public void Should_allow_null_arrays() - { - _dest.Values4.ShouldBeNull(); - } - - [Fact] - public void Should_allow_null_read_only_collections() - { - _dest.Values5.ShouldBeNull(); - } - - [Fact] - public void Should_allow_null_collections() - { - _dest.Values6.ShouldBeNull(); - } - } - - public class When_mapping_a_null_model : AutoMapperSpecBase - { - private ModelDto _result; - - public class ModelDto - { - } - - public class ModelObject - { - } - - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void Should_populate_dto_items_with_a_value() - { - Mapper.Map(null).ShouldBeNull(); - } - } - } +using System.Linq; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Shouldly; +using Xunit; +using System.Collections; +using System; + +namespace AutoMapper.UnitTests.NullBehavior +{ + public class When_mappping_null_array_to_IEnumerable_with_MapAtRuntime : AutoMapperSpecBase + { + class Source + { + public int[] Collection { get; set; } + } + + class Destination + { + public IEnumerable Collection { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap().ForMember(d=>d.Collection, o=>o.MapAtRuntime())); + + [Fact] + public void Should_map_to_non_null() + { + Mapper.Map(new Source()).Collection.ShouldNotBeNull(); + } + } + + public class When_mappping_null_array_to_IEnumerable : AutoMapperSpecBase + { + class Source + { + public int[] Collection { get; set; } + } + + class Destination + { + public IEnumerable Collection { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap()); + + [Fact] + public void Should_map_to_non_null() + { + Mapper.Map(new Source()).Collection.ShouldNotBeNull(); + } + } + + public class When_mappping_null_list_to_ICollection : AutoMapperSpecBase + { + class Source + { + public List Collection { get; set; } + } + + class Destination + { + public ICollection Collection { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap()); + + [Fact] + public void Should_map_to_non_null() + { + Mapper.Map(new Source()).Collection.ShouldNotBeNull(); + } + } + + public class When_mapping_untyped_null_to_IEnumerable_and_AllowNullCollections_is_true : AutoMapperSpecBase + { + class Source + { + public object Value { get; set; } + } + + class Destination + { + public IEnumerable Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.AllowNullCollections = true; + c.CreateMap(); + }); + + [Fact] + public void Should_map_to_null() + { + Mapper.Map(new Source()).Value.ShouldBeNull(); + } + } + + public class When_mapping_from_null_interface_and_AllowNullDestinationValues_is_false : AutoMapperSpecBase + { + ElementDestination _destination; + + interface ILink + { + int Id { get; set; } + string Type { get; set; } + } + + class LinkImpl : ILink + { + public int Id { get; set; } + public string Type { get; set; } + } + + class ElementSource + { + public int Id { get; set; } + public ILink Link { get; set; } + } + + class ElementDestination + { + public int Id { get; set; } + public LinkImpl Link { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new ElementSource()); + } + + [Fact] + public void Should_not_get_null() + { + _destination.Link.ShouldNotBeNull(); + } + } + + public class When_mapping_from_null_interface : AutoMapperSpecBase + { + ElementDestination _destination; + + interface ILink + { + int Id { get; set; } + string Type { get; set; } + } + + class LinkImpl : ILink + { + public int Id { get; set; } + public string Type { get; set; } + } + + class ElementSource + { + public int Id { get; set; } + public ILink Link { get; set; } + } + + class ElementDestination + { + public int Id { get; set; } + public LinkImpl Link { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ReverseMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new ElementSource()); + } + + [Fact] + public void Should_get_null() + { + _destination.Link.ShouldBeNull(); + } + } + + public class When_mapping_a_model_with_null_items : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelDto + { + public ModelSubDto Sub { get; set; } + public int SubSomething { get; set; } + public int? SubSomethingNullDest { get; set; } + public string NullString { get; set; } + } + + public class ModelSubDto + { + public int[] Items { get; set; } + } + + public class ModelObject + { + public ModelSubObject Sub { get; set; } + public string NullString { get; set; } + } + + public class ModelSubObject + { + public int[] GetItems() + { + return new[] { 0, 1, 2, 3 }; + } + + public int Something { get; set; } + public int SomethingNullDest { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var model = new ModelObject(); + model.Sub = null; + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_populate_dto_items_with_a_value() + { + _result.Sub.ShouldNotBeNull(); + } + + [Fact] + public void Should_provide_empty_array_for_array_type_values() + { + _result.Sub.Items.ShouldNotBeNull(); + } + + [Fact] + public void Should_return_default_value_of_property_in_the_chain() + { + _result.SubSomething.ShouldBe(0); + } + + [Fact] + public void Should_return_null_for_nullable_properties() + { + _result.SubSomethingNullDest.ShouldBeNull(); + } + + [Fact] + public void Default_value_for_string_should_be_empty() + { + _result.NullString.ShouldBe(string.Empty); + } + } + + public class When_overriding_null_behavior_with_null_source_items : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelDto + { + public ModelSubDto Sub { get; set; } + public int SubSomething { get; set; } + public int? NullableMapFrom { get; set; } + public string NullString { get; set; } + public int? SubExpressionName { get; set; } + } + + public class ModelSubDto + { + public int[] Items { get; set; } + } + + public class ModelObject + { + public ModelSubObject Sub { get; set; } + public string NullString { get; set; } + + public ModelSubObject[] Subs { get; set; } + + public int Id { get; set; } + } + + public class ModelSubObject + { + public int[] GetItems() + { + return new[] { 0, 1, 2, 3 }; + } + + public int Something { get; set; } + + public string Name { get; set; } + public ModelSubObject Sub { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + + cfg.AllowNullDestinationValues = true; + cfg.CreateMap(); + cfg.CreateMap() + .ForMember(d => d.SubExpressionName, opt => opt.MapFrom(src => + src.Subs.FirstOrDefault(spt => spt.Sub.Something == src.Id).Something)) + .ForMember(d => d.NullableMapFrom, opt => opt.MapFrom(s => s.Sub.Something)); + }); + + protected override void Because_of() + { + var model = new ModelObject(); + model.Sub = null; + model.NullString = null; + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_return_null_for_nullable_properties_that_are_complex_map_froms() + { + _result.SubExpressionName.ShouldBe(null); + } + + [Fact] + public void Should_return_null_for_nullable_properties_that_have_member_access_map_froms() + { + _result.NullableMapFrom.ShouldBe(null); + } + + [Fact] + public void Should_map_first_level_items_as_null() + { + _result.NullString.ShouldBeNull(); + } + + [Fact] + public void Should_map_primitive_items_as_default() + { + _result.SubSomething.ShouldBe(0); + } + + [Fact] + public void Should_map_any_sub_mapped_items_as_null() + { + _result.Sub.ShouldBeNull(); + } + } + + public class When_overriding_null_behavior_in_sub_profile : AutoMapperSpecBase + { + private ModelDto _result; + + public class ModelDto + { + public ModelSubDto Sub { get; set; } + public int SubSomething { get; set; } + public int? NullableMapFrom { get; set; } + public string NullString { get; set; } + public int? SubExpressionName { get; set; } + } + + public class ModelSubDto + { + public int[] Items { get; set; } + } + + public class ModelObject + { + public ModelSubObject Sub { get; set; } + public string NullString { get; set; } + + public ModelSubObject[] Subs { get; set; } + + public int Id { get; set; } + } + + public class ModelSubObject + { + public int[] GetItems() + { + return new[] { 0, 1, 2, 3 }; + } + + public int Something { get; set; } + + public string Name { get; set; } + public ModelSubObject Sub { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + + cfg.CreateProfile("Foo", p => + { + p.AllowNullDestinationValues = true; + p.CreateMap(); + p.CreateMap() + .ForMember(d => d.SubExpressionName, opt => opt.MapFrom(src => + src.Subs.FirstOrDefault(spt => spt.Sub.Something == src.Id).Something)) + .ForMember(d => d.NullableMapFrom, opt => opt.MapFrom(s => s.Sub.Something)); + }); + }); + + protected override void Because_of() + { + var model = new ModelObject(); + model.Sub = null; + model.NullString = null; + + _result = Mapper.Map(model); + } + + [Fact] + public void Should_return_null_for_nullable_properties_that_are_complex_map_froms() + { + _result.SubExpressionName.ShouldBe(null); + } + + [Fact] + public void Should_return_null_for_nullable_properties_that_have_member_access_map_froms() + { + _result.NullableMapFrom.ShouldBe(null); + } + + [Fact] + public void Should_map_first_level_items_as_null() + { + _result.NullString.ShouldBeNull(); + } + + [Fact] + public void Should_map_primitive_items_as_default() + { + _result.SubSomething.ShouldBe(0); + } + + [Fact] + public void Should_map_any_sub_mapped_items_as_null() + { + _result.Sub.ShouldBeNull(); + } + } + + public class When_overriding_null_behavior_in_a_profile : AutoMapperSpecBase + { + private DefaultDestination _defaultResult; + private NullDestination _nullResult; + + public class DefaultSource + { + public object Value { get; set; } + } + + public class DefaultDestination + { + public object Value { get; set; } + } + + public class NullSource + { + public object Value { get; set; } + } + + public class NullDestination + { + public object Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateProfile("MapsNulls", p => + { + p.AllowNullDestinationValues = false; + p.CreateMap(); + }); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _defaultResult = Mapper.Map(new DefaultSource()); + _nullResult = Mapper.Map(new NullSource()); + } + + [Fact] + public void Should_use_default_behavior_in_default_profile() + { + _defaultResult.Value.ShouldBeNull(); + } + + [Fact] + public void Should_use_overridden_null_behavior_in_profile() + { + _nullResult.Value.ShouldNotBeNull(); + } + } + + public class When_using_a_custom_resolver_and_the_source_value_is_null : NonValidatingSpecBase + { + public class NullResolver : IMemberValueResolver + { + public string Resolve(Source s, Destination d, string source, string dest, ResolutionContext context) + { + if(source == null) + return "jon"; + return "fail"; + } + } + + private static Source _source; + private Destination _dest; + + public class Source + { + public string MyName { get; set; } + } + + public class Destination + { + public string Name { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.MyName)); + _source = new Source(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(_source); + } + + [Fact] + public void Should_perform_the_translation() + { + _dest.Name.ShouldBe("jon"); + } + } + + public class When_mapping_using_a_custom_member_mapping_and_source_is_null : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public SubSource Sub { get; set; } + } + + public class SubSource + { + public int Value { get; set; } + } + + public class Dest + { + public int OtherValue { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AllowNullDestinationValues = false; + cfg.CreateMap() + .ForMember(dest => dest.OtherValue, opt => opt.MapFrom(src => src.Sub.Value)); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source()); + } + + [Fact] + public void Should_map_to_null_on_destination_values() + { + _dest.OtherValue.ShouldBe(0); + } + } + + public class When_specifying_a_resolver_for_a_nullable_type : AutoMapperSpecBase + { + private FooViewModel _result; + + public class NullableBoolToLabel : ITypeConverter + { + public string Convert(bool? source, string destination, ResolutionContext context) + { + if(source.HasValue) + { + if(source.Value) + return "Yes"; + else + return "No"; + } + else + return "(n/a)"; + } + } + + public class Foo + { + public bool? IsFooBarred { get; set; } + } + + public class FooViewModel + { + public string IsFooBarred { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var foo3 = new Foo { IsFooBarred = null }; + _result = Mapper.Map(foo3); + } + + [Fact] + public void Should_allow_the_resolver_to_handle_null_values() + { + _result.IsFooBarred.ShouldBe("(n/a)"); + } + } + + public class When_overriding_collection_null_behavior : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public IEnumerable Values1 { get; set; } + public List Values2 { get; set; } + public Dictionary Values3 { get; set; } + public int[] Values4 { get; set; } + public ReadOnlyCollection Values5 { get; set; } + public Collection Values6 { get; set; } + } + + public class Dest + { + public IEnumerable Values1 { get; set; } + public List Values2 { get; set; } + public Dictionary Values3 { get; set; } + public int[] Values4 { get; set; } + public ReadOnlyCollection Values5 { get; set; } + public Collection Values6 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.AllowNullCollections = true; + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source()); + } + + [Fact] + public void Should_allow_null_ienumerables() + { + _dest.Values1.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_lists() + { + _dest.Values2.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_dictionaries() + { + _dest.Values3.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_arrays() + { + _dest.Values4.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_read_only_collections() + { + _dest.Values5.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_collections() + { + _dest.Values6.ShouldBeNull(); + } + } + + public class When_overriding_collection_null_behavior_in_profile_with_MapAtRuntime : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public IEnumerable Values1 { get; set; } + public List Values2 { get; set; } + public Dictionary Values3 { get; set; } + public int[] Values4 { get; set; } + public ReadOnlyCollection Values5 { get; set; } + public Collection Values6 { get; set; } + public int[,] Values7 { get; set; } + } + + public class Dest + { + public IEnumerable Values1 { get; set; } + public List Values2 { get; set; } + public Dictionary Values3 { get; set; } + public int[] Values4 { get; set; } + public ReadOnlyCollection Values5 { get; set; } + public Collection Values6 { get; set; } + public int[,] Values7 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateProfile("MyProfile", p => + { + p.CreateMap().ForAllMembers(o=>o.MapAtRuntime()); + p.AllowNullCollections = true; + }); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source()); + } + + [Fact] + public void Should_allow_null_ienumerables() + { + _dest.Values1.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_lists() + { + _dest.Values2.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_dictionaries() + { + _dest.Values3.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_arrays() + { + _dest.Values4.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_read_only_collections() + { + _dest.Values5.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_collections() + { + _dest.Values6.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_multidimensional_arrays() + { + _dest.Values7.ShouldBeNull(); + } + } + + public class When_overriding_collection_null_behavior_in_profile : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public IEnumerable Values1 { get; set; } + public List Values2 { get; set; } + public Dictionary Values3 { get; set; } + public int[] Values4 { get; set; } + public ReadOnlyCollection Values5 { get; set; } + public Collection Values6 { get; set; } + public int[,] Values7 { get; set; } + } + + public class Dest + { + public IEnumerable Values1 { get; set; } + public List Values2 { get; set; } + public Dictionary Values3 { get; set; } + public int[] Values4 { get; set; } + public ReadOnlyCollection Values5 { get; set; } + public Collection Values6 { get; set; } + public int[,] Values7 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateProfile("MyProfile", p => + { + p.CreateMap(); + p.AllowNullCollections = true; + }); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source()); + } + + [Fact] + public void Should_allow_null_ienumerables() + { + _dest.Values1.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_lists() + { + _dest.Values2.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_dictionaries() + { + _dest.Values3.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_arrays() + { + _dest.Values4.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_read_only_collections() + { + _dest.Values5.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_collections() + { + _dest.Values6.ShouldBeNull(); + } + + [Fact] + public void Should_allow_null_multidimensional_arrays() + { + _dest.Values7.ShouldBeNull(); + } + } + + public class When_mapping_a_null_model : AutoMapperSpecBase + { + public class ModelDto + { + } + + public class ModelObject + { + } + + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_populate_dto_items_with_a_value() + { + Mapper.Map(null).ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/ObjectSubstitution.cs b/src/UnitTests/ObjectSubstitution.cs deleted file mode 100644 index f11b5f34f3..0000000000 --- a/src/UnitTests/ObjectSubstitution.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace AutoMapper.UnitTests -{ - namespace ObjectSubstitution - { - using System; - using Should; - using Xunit; - - public abstract class Animal { } - public class Cat : Animal { } - public class Dog : Animal { } - - public class AnimalProxy : Animal - { - public Type ToConvert { get; set; } - } - - public class CatProxy : Cat - { - public Type ToConvert { get; set; } - - } - public class DogProxy : Dog { } - - public abstract class AnimalDto { } - public class CatDto : AnimalDto { } - public class DogDto : AnimalDto { } - - - public class OverrideExample : AutoMapperSpecBase - { - private AnimalDto _animalDto; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Substitute(CastToEntity) - .Include() - .Include(); - cfg.CreateMap(); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var proxy = new CatProxy - { - ToConvert = typeof (Cat) - }; - _animalDto = Mapper.Map(proxy); - } - - [Fact] - public void Should_substitute_correct_object() - { - _animalDto.ShouldBeType(); - } - - private static object CastToEntity(Animal entity) - { - return Activator.CreateInstance(((CatProxy)entity).ToConvert); - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/OpenGenerics.cs b/src/UnitTests/OpenGenerics.cs index 9cfa13595b..60fde9e945 100644 --- a/src/UnitTests/OpenGenerics.cs +++ b/src/UnitTests/OpenGenerics.cs @@ -1,68 +1,272 @@ -namespace AutoMapper.UnitTests -{ - using Should; - using Xunit; - - public class OpenGenerics - { - public class Source - { - public int A { get; set; } - public T Value { get; set; } - } - - public class Dest - { - public int A { get; set; } - public T Value { get; set; } - } - - [Fact] - public void Can_map_simple_generic_types() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); - - var source = new Source - { - Value = 5 - }; - - var dest = config.CreateMapper().Map, Dest>(source); - - dest.Value.ShouldEqual(5); - } - - [Fact] - public void Can_map_non_generic_members() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); - - var source = new Source - { - A = 5 - }; - - var dest = config.CreateMapper().Map, Dest>(source); - - dest.A.ShouldEqual(5); - } - - [Fact] - public void Can_map_recursive_generic_types() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); - - var source = new Source> - { - Value = new Source - { - Value = 5, - } - }; - - var dest = config.CreateMapper().Map>, Dest>>(source); - - dest.Value.Value.ShouldEqual(5); - } - } +namespace AutoMapper.UnitTests +{ + using MappingInheritance; + using Shouldly; + using System; + using System.Linq; + using Xunit; + + public class RecursiveOpenGenerics : AutoMapperSpecBase + { + public class SourceTree + { + public SourceTree(T value, SourceTree[] children) + { + Value = value; + Children = children; + } + + public T Value { get; } + + public SourceTree[] Children { get; } + } + + public class DestinationTree + { + public DestinationTree(T value, DestinationTree[] children) + { + Value = value; + Children = children; + } + + public T Value { get; } + + public DestinationTree[] Children { get; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap(typeof(SourceTree<>), typeof(DestinationTree<>))); + + [Fact] + public void Should_work() + { + var source = new SourceTree("value", new SourceTree[0]); + Mapper.Map>(source).Value.ShouldBe("value"); + } + } + + public class OpenGenericsValidation : NonValidatingSpecBase + { + public class Source + { + public T Value { get; set; } + } + + public class Dest + { + public int A { get; set; } + public T Value { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); + + [Fact] + public void Should_report_unmapped_property() + { + new Action(()=>Mapper.Map>(new Source{ Value = 5 })) + .ShouldThrow() + .Errors.Single().UnmappedPropertyNames.Single().ShouldBe("A"); + } + } + + public class OpenGenericsProfileValidationNonGenericMembers : NonValidatingSpecBase + { + public class Source + { + public T[] Value { get; set; } + } + + public class Dest + { + public int A { get; set; } + public T[] Value { get; set; } + } + + class MyProfile : Profile + { + public MyProfile() + { + CreateMap(typeof(Source<>), typeof(Dest<>)); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.AddProfile()); + + [Fact] + public void Should_report_unmapped_property() + { + new Action(()=>Configuration.AssertConfigurationIsValid()) + .ShouldThrow() + .Errors.Single().UnmappedPropertyNames.Single().ShouldBe("A"); ; + } + } + + public class OpenGenericsProfileValidation : AutoMapperSpecBase + { + public class Source + { + public T[] Value { get; set; } + } + + public class Dest + { + public T[] Value { get; set; } + } + + class MyProfile : Profile + { + public MyProfile() + { + CreateMap(typeof(Source<>), typeof(Dest<>)); + } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => cfg.AddProfile()); + } + + public class OpenGenerics + { + public class Source + { + public int A { get; set; } + public T Value { get; set; } + } + + public class Dest + { + public int A { get; set; } + public T Value { get; set; } + } + + [Fact] + public void Can_map_simple_generic_types() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); + + var source = new Source + { + Value = 5 + }; + + var dest = config.CreateMapper().Map, Dest>(source); + + dest.Value.ShouldBe(5); + } + + [Fact] + public void Can_map_non_generic_members() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); + + var source = new Source + { + A = 5 + }; + + var dest = config.CreateMapper().Map, Dest>(source); + + dest.A.ShouldBe(5); + } + + [Fact] + public void Can_map_recursive_generic_types() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(Source<>), typeof(Dest<>))); + + var source = new Source> + { + Value = new Source + { + Value = 5, + } + }; + + var dest = config.CreateMapper().Map>, Dest>>(source); + + dest.Value.Value.ShouldBe(5); + } + } + + public class OpenGenerics_With_MemberConfiguration : AutoMapperSpecBase + { + public class Foo + { + public int A { get; set; } + public int B { get; set; } + } + + public class Bar + { + public int C { get; set; } + public int D { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(mapper => { + mapper.CreateMap(typeof(Foo<>), typeof(Bar<>)) + .ForMember("C", to => to.MapFrom("A")) + .ForMember("D", to => to.MapFrom("B")); + }); + + [Fact] + public void Can_remap_explicit_members() + { + var source = new Foo + { + A = 5, + B = 10 + }; + + var dest = Mapper.Map, Bar>(source); + + dest.C.ShouldBe(5); + dest.D.ShouldBe(10); + } + } + + public class OpenGenerics_With_UntypedMapFrom : AutoMapperSpecBase + { + public class Foo + { + public T Value1 { get; set; } + } + + public class Bar + { + public T Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(mapper => { + mapper.CreateMap(typeof(Foo<>), typeof(Bar<>)).ForMember("Value2", to => to.MapFrom("Value1")); + }); + + [Fact] + public void Can_remap_explicit_members() + { + var dest = Mapper.Map>(new Foo { Value1 = 5 }); + dest.Value2.ShouldBe(5); + } + } + + public class OpenGenerics_With_UntypedMapFromStructs : AutoMapperSpecBase + { + public class Foo where T : struct + { + public T Value1 { get; set; } + } + + public class Bar where T : struct + { + public T Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(mapper => { + mapper.CreateMap(typeof(Foo<>), typeof(Bar<>)).ForMember("Value2", to => to.MapFrom("Value1")); + }); + + [Fact] + public void Can_remap_explicit_members() + { + var dest = Mapper.Map>(new Foo { Value1 = 5 }); + dest.Value2.ShouldBe(5); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Profiles.cs b/src/UnitTests/Profiles.cs index 1acdb2ee6d..e624d06046 100644 --- a/src/UnitTests/Profiles.cs +++ b/src/UnitTests/Profiles.cs @@ -1,166 +1,169 @@ -using System; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace Profiles - { - using Should.Core.Assertions; - - public class When_segregating_configuration_through_a_profile : NonValidatingSpecBase - { - private Dto _result; - - public class Model - { - public int Value { get; set; } - } - - public class Dto - { - public Dto(string value) - { - Value = value; - } - - public string Value { get; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.DisableConstructorMapping(); - - cfg.CreateProfile("Custom", p => p.CreateMap()); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Model {Value = 5}); - } - - [Fact] - public void Should_not_include_default_profile_configuration_with_profiled_maps() - { - _result.Value.ShouldEqual("5"); - } - } - - public class When_configuring_a_profile_through_a_profile_subclass : AutoMapperSpecBase - { - private Dto _result; - private static CustomProfile1 _customProfile; - - public class Model - { - public int Value { get; set; } - } - - public class Dto - { - public string FooValue { get; set; } - } - - public class Dto2 - { - public string FooValue { get; set; } - } - - public class CustomProfile1 : Profile - { - public CustomProfile1() - { - RecognizeDestinationPrefixes("Foo"); - CreateMap(); - } - } - - public class CustomProfile2 : Profile - { - public CustomProfile2() - { - RecognizeDestinationPrefixes("Foo"); - - CreateMap(); - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - _customProfile = new CustomProfile1(); - cfg.AddProfile(_customProfile); - cfg.AddProfile(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Model { Value = 5 }); - } - - [Fact] - public void Should_default_the_custom_profile_name_to_the_type_name() - { - _customProfile.ProfileName.ShouldEqual(typeof(CustomProfile1).FullName); - } - - [Fact] - public void Should_use_the_overridden_configuration_method_to_configure() - { - _result.FooValue.ShouldEqual("5"); - } - } - - - public class When_disabling_constructor_mapping_with_profiles : AutoMapperSpecBase - { - private B _b; - - public class AProfile : Profile - { - public AProfile() - { - DisableConstructorMapping(); - CreateMap(); - } - } - - public class A - { - public string Value { get; set; } - } - - public class B - { - - public B() - { - } - - public B(string value) - { - throw new Exception(); - } - - public string Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.AddProfile(); - }); - - protected override void Because_of() - { - _b = Mapper.Map(new A { Value = "BLUEZ" }); - } - - [Fact] - public void When_using_profile_and_no_constructor_mapping() - { - Assert.Equal("BLUEZ", _b.Value); - } - } - - - } -} +using System; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + namespace Profiles + { + public class When_segregating_configuration_through_a_profile : NonValidatingSpecBase + { + private Dto _result; + + public class Model + { + public int Value { get; set; } + } + + public class Dto + { + public Dto(string value) + { + Value = value + "ffff"; + } + + public Dto() + { + Value = "Hello"; + } + + public string Value { get; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.DisableConstructorMapping(); + + cfg.CreateProfile("Custom", p => p.CreateMap()); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Model {Value = 5}); + } + + [Fact] + public void Should_include_default_profile_configuration_with_profiled_maps() + { + _result.Value.ShouldBe("Hello"); + } + } + + public class When_configuring_a_profile_through_a_profile_subclass : AutoMapperSpecBase + { + private Dto _result; + private static CustomProfile1 _customProfile; + + public class Model + { + public int Value { get; set; } + } + + public class Dto + { + public string FooValue { get; set; } + } + + public class Dto2 + { + public string FooValue { get; set; } + } + + public class CustomProfile1 : Profile + { + public CustomProfile1() + { + RecognizeDestinationPrefixes("Foo"); + CreateMap(); + } + } + + public class CustomProfile2 : Profile + { + public CustomProfile2() + { + RecognizeDestinationPrefixes("Foo"); + + CreateMap(); + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + _customProfile = new CustomProfile1(); + cfg.AddProfile(_customProfile); + cfg.AddProfile(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Model { Value = 5 }); + } + + [Fact] + public void Should_default_the_custom_profile_name_to_the_type_name() + { + _customProfile.ProfileName.ShouldBe(typeof(CustomProfile1).FullName); + } + + [Fact] + public void Should_use_the_overridden_configuration_method_to_configure() + { + _result.FooValue.ShouldBe("5"); + } + } + + + public class When_disabling_constructor_mapping_with_profiles : AutoMapperSpecBase + { + private B _b; + + public class AProfile : Profile + { + public AProfile() + { + DisableConstructorMapping(); + CreateMap(); + } + } + + public class A + { + public string Value { get; set; } + } + + public class B + { + + public B() + { + } + + public B(string value) + { + throw new Exception(); + } + + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.AddProfile(); + }); + + protected override void Because_of() + { + _b = Mapper.Map(new A { Value = "BLUEZ" }); + } + + [Fact] + public void When_using_profile_and_no_constructor_mapping() + { + Assert.Equal("BLUEZ", _b.Value, StringComparer.Ordinal); + } + } + + + } +} diff --git a/src/UnitTests/Projection/BindersAndResultConverters.cs b/src/UnitTests/Projection/BindersAndResultConverters.cs new file mode 100644 index 0000000000..084bf9873f --- /dev/null +++ b/src/UnitTests/Projection/BindersAndResultConverters.cs @@ -0,0 +1,97 @@ +using System; +using AutoMapper.QueryableExtensions; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; +using Shouldly; +using System.Linq.Expressions; +using System.Reflection; + +namespace AutoMapper.UnitTests.Projection +{ + using static Expression; + + public class QueryableBinders : AutoMapperSpecBase + { + class Source + { + public ConsoleColor Color { get; set; } + } + + class Destination + { + public int Color { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.Advanced.QueryableBinders.Add(new EnumToUnderlyingTypeBinder()); + cfg.CreateMap(); + }); + + [Fact] + public void Should_work_with_projections() + { + var destination = new[] { new Source { Color = ConsoleColor.Cyan } }.AsQueryable().ProjectTo(Configuration).First(); + destination.Color.ShouldBe(11); + } + + private class EnumToUnderlyingTypeBinder : IExpressionBinder + { + public MemberAssignment Build(IConfigurationProvider configuration, PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionRequest request, ExpressionResolutionResult result, IDictionary typePairCount, LetPropertyMaps letPropertyMaps) => + Bind(propertyMap.DestinationMember, Convert(result.ResolutionExpression, propertyMap.DestinationType)); + + public bool IsMatch(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result) => + propertyMap.SourceType.GetTypeInfo().IsEnum && Enum.GetUnderlyingType(propertyMap.SourceType) == propertyMap.DestinationType; + } + } + + public class QueryableResultConverters : AutoMapperSpecBase + { + class Source + { + public ConsoleColor Color { get; set; } + } + + class Destination + { + public int Color { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.Advanced.QueryableResultConverters.Insert(0, new EnumToUnderlyingTypeResultConverter()); + cfg.CreateMap(); + }); + + [Fact] + public void Should_work_with_projections() + { + var destination = new[] { new Source { Color = ConsoleColor.Cyan } }.AsQueryable().ProjectTo(Configuration).First(); + destination.Color.ShouldBe(11); + } + + private class EnumToUnderlyingTypeResultConverter : IExpressionResultConverter + { + public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap) => + propertyMap.SourceType.GetTypeInfo().IsEnum && Enum.GetUnderlyingType(propertyMap.SourceType) == propertyMap.DestinationType; + + public bool CanGetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap) + { + throw new NotImplementedException(); + } + + public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, PropertyMap propertyMap, LetPropertyMaps letPropertyMaps) => + new ExpressionResolutionResult( + Convert(MakeMemberAccess(expressionResolutionResult.ResolutionExpression, propertyMap.SourceMember), propertyMap.DestinationType), + propertyMap.DestinationType); + + public ExpressionResolutionResult GetExpressionResolutionResult(ExpressionResolutionResult expressionResolutionResult, ConstructorParameterMap propertyMap) + { + throw new NotImplementedException(); + } + } + } +} diff --git a/src/UnitTests/Projection/ConstructorTests.cs b/src/UnitTests/Projection/ConstructorTests.cs index ce66bc28cd..f5ddc70f7a 100644 --- a/src/UnitTests/Projection/ConstructorTests.cs +++ b/src/UnitTests/Projection/ConstructorTests.cs @@ -1,58 +1,58 @@ -namespace AutoMapper.UnitTests.Projection -{ - using System.Linq; - using QueryableExtensions; - using Should; - using Xunit; - - public class ConstructorTests : AutoMapperSpecBase - { - private Dest[] _dest; - - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public Dest() - { - - } - public Dest(int other) - { - Other = other; - } - - public int Value { get; set; } - [IgnoreMap] - public int Other { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ConstructProjectionUsing(src => new Dest(src.Value + 10)); - }); - - protected override void Because_of() - { - var values = new[] - { - new Source() - { - Value = 5 - } - }.AsQueryable(); - - _dest = values.ProjectTo(Configuration).ToArray(); - } - - [Fact] - public void Should_construct_correctly() - { - _dest[0].Other.ShouldEqual(15); - } - } +namespace AutoMapper.UnitTests.Projection +{ + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class ConstructorTests : AutoMapperSpecBase + { + private Dest[] _dest; + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public Dest() + { + + } + public Dest(int other) + { + Other = other; + } + + public int Value { get; set; } + [IgnoreMap] + public int Other { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ConstructUsing(src => new Dest(src.Value + 10)); + }); + + protected override void Because_of() + { + var values = new[] + { + new Source() + { + Value = 5 + } + }.AsQueryable(); + + _dest = values.ProjectTo(Configuration).ToArray(); + } + + [Fact] + public void Should_construct_correctly() + { + _dest[0].Other.ShouldBe(15); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/ExplicitExpansion.cs b/src/UnitTests/Projection/ExplicitExpansion.cs index b03cbdbf21..28007ebc33 100644 --- a/src/UnitTests/Projection/ExplicitExpansion.cs +++ b/src/UnitTests/Projection/ExplicitExpansion.cs @@ -1,78 +1,78 @@ -namespace AutoMapper.UnitTests.Projection -{ - using System.Linq; - using QueryableExtensions; - using Should; - using Xunit; - - public class ExplicitExpansion : AutoMapperSpecBase - { - private Dest[] _dests; - - public class Source - { - public ChildSource Child1 { get; set; } - public ChildSource Child2 { get; set; } - public ChildSource Child3 { get; set; } - } - - public class ChildSource - { - - } - - public class Dest - { - public ChildDest Child1 { get; set; } - public ChildDest Child2 { get; set; } - public ChildDest Child3 { get; set; } - } - - public class ChildDest - { - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(m => m.Child1, opt => opt.ExplicitExpansion()) - .ForMember(m => m.Child2, opt => opt.ExplicitExpansion()) - ; - cfg.CreateMap(); - }); - - - protected override void Because_of() - { - var sourceList = new[] - { - new Source - { - Child1 = new ChildSource(), - Child2 = new ChildSource(), - Child3 = new ChildSource() - } - }; - - _dests = sourceList.AsQueryable().ProjectTo(Configuration, d => d.Child2).ToArray(); - } - - [Fact] - public void Should_leave_non_expanded_item_null() - { - _dests[0].Child1.ShouldBeNull(); - } - - [Fact] - public void Should_expand_explicitly_expanded_item() - { - _dests[0].Child2.ShouldNotBeNull(); - } - - [Fact] - public void Should_default_to_expand() - { - _dests[0].Child3.ShouldNotBeNull(); - } - } +namespace AutoMapper.UnitTests.Projection +{ + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class ExplicitExpansion : AutoMapperSpecBase + { + private Dest[] _dests; + + public class Source + { + public ChildSource Child1 { get; set; } + public ChildSource Child2 { get; set; } + public ChildSource Child3 { get; set; } + } + + public class ChildSource + { + + } + + public class Dest + { + public ChildDest Child1 { get; set; } + public ChildDest Child2 { get; set; } + public ChildDest Child3 { get; set; } + } + + public class ChildDest + { + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(m => m.Child1, opt => opt.ExplicitExpansion()) + .ForMember(m => m.Child2, opt => opt.ExplicitExpansion()) + ; + cfg.CreateMap(); + }); + + + protected override void Because_of() + { + var sourceList = new[] + { + new Source + { + Child1 = new ChildSource(), + Child2 = new ChildSource(), + Child3 = new ChildSource() + } + }; + + _dests = sourceList.AsQueryable().ProjectTo(Configuration, d => d.Child2).ToArray(); + } + + [Fact] + public void Should_leave_non_expanded_item_null() + { + _dests[0].Child1.ShouldBeNull(); + } + + [Fact] + public void Should_expand_explicitly_expanded_item() + { + _dests[0].Child2.ShouldNotBeNull(); + } + + [Fact] + public void Should_default_to_expand() + { + _dests[0].Child3.ShouldNotBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/ExplicitValues.cs b/src/UnitTests/Projection/ExplicitValues.cs index c2b1358fb1..d9d4691cd1 100644 --- a/src/UnitTests/Projection/ExplicitValues.cs +++ b/src/UnitTests/Projection/ExplicitValues.cs @@ -1,42 +1,42 @@ -namespace AutoMapper.UnitTests.Projection -{ - using System.Collections.Generic; - using System.Linq; - using QueryableExtensions; - using Should; - using Xunit; - - public class ExplicitValues : AutoMapperSpecBase - { - private List _dests; - - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.UseValue(5)); - }); - - protected override void Because_of() - { - var source = new[] { new Source { Value = 10 } }.AsQueryable(); - - _dests = source.ProjectTo(Configuration).ToList(); - } - - [Fact] - public void Should_substitute_value() - { - _dests[0].Value.ShouldEqual(5); - } - } +namespace AutoMapper.UnitTests.Projection +{ + using System.Collections.Generic; + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class ExplicitValues : AutoMapperSpecBase + { + private List _dests; + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => 5)); + }); + + protected override void Because_of() + { + var source = new[] { new Source { Value = 10 } }.AsQueryable(); + + _dests = source.ProjectTo(Configuration).ToList(); + } + + [Fact] + public void Should_substitute_value() + { + _dests[0].Value.ShouldBe(5); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/GenericsTests.cs b/src/UnitTests/Projection/GenericsTests.cs index eb14fae68d..575960778c 100644 --- a/src/UnitTests/Projection/GenericsTests.cs +++ b/src/UnitTests/Projection/GenericsTests.cs @@ -2,7 +2,7 @@ { using System.Linq; using QueryableExtensions; - using Should; + using Shouldly; using Xunit; public class GenericsTests : AutoMapperSpecBase @@ -40,7 +40,7 @@ protected override void Because_of() [Fact] public void Should_convert_even_though_mapper_not_explicitly_called_before_hand() { - _dests[0].Value.ShouldEqual("5"); + _dests[0].Value.ShouldBe("5"); } } } \ No newline at end of file diff --git a/src/UnitTests/Projection/InheritedMaps.cs b/src/UnitTests/Projection/InheritedMaps.cs index 9cc4b080d2..e75b871069 100644 --- a/src/UnitTests/Projection/InheritedMaps.cs +++ b/src/UnitTests/Projection/InheritedMaps.cs @@ -1,58 +1,58 @@ -namespace AutoMapper.UnitTests.Projection -{ - namespace InheritedMaps - { - using System.Linq; - using QueryableExtensions; - using Should; - using Xunit; - - public class SourceBase - { - public int OtherValue { get; set; } - } - - public class Source : SourceBase - { - - } - - public class Dest - { - public int Value { get; set; } - } - - public class When_projecting_and_inheriting_maps : AutoMapperSpecBase - { - private Dest[] _dest; - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .Include() - .ForMember(d => d.Value, opt => opt.MapFrom(src => src.OtherValue)); - - cfg.CreateMap(); - }); - - protected override void Because_of() - { - IQueryable sources = new[] - { - new Source() - { - OtherValue = 10 - } - }.AsQueryable(); - - _dest = sources.ProjectTo(Configuration).ToArray(); - } - - [Fact] - public void Should_inherit_base_mapping() - { - _dest[0].Value.ShouldEqual(10); - } - } - } +namespace AutoMapper.UnitTests.Projection +{ + namespace InheritedMaps + { + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class SourceBase + { + public int OtherValue { get; set; } + } + + public class Source : SourceBase + { + + } + + public class Dest + { + public int Value { get; set; } + } + + public class When_projecting_and_inheriting_maps : AutoMapperSpecBase + { + private Dest[] _dest; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Include() + .ForMember(d => d.Value, opt => opt.MapFrom(src => src.OtherValue)); + + cfg.CreateMap(); + }); + + protected override void Because_of() + { + IQueryable sources = new[] + { + new Source() + { + OtherValue = 10 + } + }.AsQueryable(); + + _dest = sources.ProjectTo(Configuration).ToArray(); + } + + [Fact] + public void Should_inherit_base_mapping() + { + _dest[0].Value.ShouldBe(10); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/MapFromTest.cs b/src/UnitTests/Projection/MapFromTest.cs index 4f67045710..8cf97fdbc8 100644 --- a/src/UnitTests/Projection/MapFromTest.cs +++ b/src/UnitTests/Projection/MapFromTest.cs @@ -1,76 +1,92 @@ -using System; -using System.Linq; -using Should; -using Xunit; -using AutoMapper.QueryableExtensions; - -namespace AutoMapper.UnitTests.Projection.MapFromTest -{ - public class CustomMapFromExpressionTest - { - [Fact] - public void Should_not_fail() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dto => dto.FullName, opt => opt.MapFrom(src => src.LastName + " " + src.FirstName)); - }); - - typeof(NullReferenceException).ShouldNotBeThrownBy(() => config.ExpressionBuilder.CreateMapExpression()); //null reference exception here - } - - [Fact] - public void Should_map_from_String() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dto => dto.FullName, opt => opt.MapFrom("FirstName"))); - - var um = new UserModel(); - um.FirstName = "Hallo"; - var u = new UserDto(); - config.CreateMapper().Map(um, u); - - u.FullName.ShouldEqual(um.FirstName); - } - - public class UserModel - { - public string FirstName { get; set; } - public string LastName { get; set; } - } - - public class UserDto - { - public string FullName { get; set; } - } - } - - public class When_mapping_from_and_source_member_both_can_work : AutoMapperSpecBase - { - Dto _destination; - - public class Model - { - public string ShortDescription { get; set; } - } - - public class Dto - { - public string ShortDescription { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(c => c.CreateMap().ForMember(d => d.ShortDescription, o => o.MapFrom(s => "mappedFrom"))); - - protected override void Because_of() - { - _destination = new[] { new Model() }.AsQueryable().ProjectTo(Configuration).Single(); - } - - [Fact] - public void Map_from_should_prevail() - { - _destination.ShortDescription.ShouldEqual("mappedFrom"); - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Shouldly; +using Xunit; +using AutoMapper.QueryableExtensions; + +namespace AutoMapper.UnitTests.Projection.MapFromTest +{ + public class CustomMapFromExpressionTest + { + [Fact] + public void Should_not_fail() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dto => dto.FullName, opt => opt.MapFrom(src => src.LastName + " " + src.FirstName)); + }); + + typeof(NullReferenceException).ShouldNotBeThrownBy(() => config.ExpressionBuilder.GetMapExpression()); //null reference exception here + } + + [Fact] + public void Should_fail_Untyped() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dto => dto.FullName, opt => opt.MapFrom(src => src.LastName + " " + src.FirstName)); + }); + + typeof(ArgumentNullException).ShouldBeThrownBy(() => config.ExpressionBuilder.GetMapExpression(null, typeof(UserDto), new Dictionary(), new MemberInfo[0])); //ArgumentNullException here + typeof(ArgumentNullException).ShouldBeThrownBy(() => config.ExpressionBuilder.GetMapExpression(typeof(UserModel), null, new Dictionary(), new MemberInfo[0])); //ArgumentNullException here + typeof(ArgumentNullException).ShouldBeThrownBy(() => config.ExpressionBuilder.GetMapExpression(typeof(UserModel), typeof(UserDto), new Dictionary(), null)); //ArgumentNullException here + } + + [Fact] + public void Should_map_from_String() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(dto => dto.FullName, opt => opt.MapFrom("FirstName"))); + + var um = new UserModel(); + um.FirstName = "Hallo"; + var u = new UserDto(); + config.CreateMapper().Map(um, u); + + u.FullName.ShouldBe(um.FirstName); + } + + public class UserModel + { + public string FirstName { get; set; } + public string LastName { get; set; } + } + + public class UserDto + { + public string FullName { get; set; } + } + } + + public class When_mapping_from_and_source_member_both_can_work : AutoMapperSpecBase + { + Dto _destination; + + public class Model + { + public string ShortDescription { get; set; } + } + + public class Dto + { + public string ShortDescription { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(c => c.CreateMap().ForMember(d => d.ShortDescription, o => o.MapFrom(s => "mappedFrom"))); + + protected override void Because_of() + { + _destination = new[] { new Model() }.AsQueryable().ProjectTo(Configuration).Single(); + } + + [Fact] + public void Map_from_should_prevail() + { + _destination.ShortDescription.ShouldBe("mappedFrom"); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/MembersToExpand_ExpressionArray.cs b/src/UnitTests/Projection/MembersToExpand_ExpressionArray.cs new file mode 100644 index 0000000000..722cb4c507 --- /dev/null +++ b/src/UnitTests/Projection/MembersToExpand_ExpressionArray.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper.QueryableExtensions; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Projection +{ + using NameSourceType = String ; using NameDtoType = String ; // Example of Reference Type + using DescSourceType = Int32 ; using DescDtoType = Nullable; // Example of Value Type mapped to appropriate Nullable + + public class MembersToExpand_ExpressionArray : AutoMapperSpecBase + { + public class SourceDeepInner { public DescSourceType Desc { get; set; } } + public class SourceInner { public DescSourceType Desc { get; set; } public SourceDeepInner Deep { get; set; } } + public class Source + { + public NameSourceType Name { get; set; } + public DescSourceType Desc { get; set; } + public SourceInner Inner { get; set; } + } + public class Dto + { + public NameDtoType Name { get; set; } + public DescDtoType Desc { get; set; } + public DescDtoType InnerDescFlattened { get; set; } + public DescDtoType DeepFlattened { get; set; } + } + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dto => dto.InnerDescFlattened, conf => { conf.ExplicitExpansion(); conf.MapFrom(_ => _.Inner .Desc); }) + .ForMember(dto => dto. DeepFlattened, conf => { conf.ExplicitExpansion(); conf.MapFrom(_ => _.Inner.Deep.Desc); }) + ; + }); + + private static readonly IQueryable _iq = new List { + new Source() { Name = "Name1", Desc = -12, Inner = new SourceInner {Desc = -25, Deep = new SourceDeepInner() { Desc = 28 } } }, + } .AsQueryable(); + + private static readonly Source _iqf = _iq.First(); + + [Fact] public void ProjectReferenceType() => _iq.ProjectTo(Configuration, _ => _.Name ).First().Name.ShouldBe(_iqf.Name); + [Fact] public void ProjectValueType () => _iq.ProjectTo(Configuration, _ => _.Desc).First().Desc.ShouldBe(_iqf.Desc); + [Fact] public void ProjectBoth () => _iq.ProjectTo(Configuration, _ => _.Name, _ => _.Desc); + + [Fact] public void ProjectInner() => _iq.ProjectTo(Configuration, _ => _.InnerDescFlattened).First().InnerDescFlattened.ShouldBe(_iqf.Inner .Desc); + [Fact] public void ProjectDeepInner() => _iq.ProjectTo(Configuration, _ => _. DeepFlattened).First(). DeepFlattened.ShouldBe(_iqf.Inner.Deep.Desc); + } +} diff --git a/src/UnitTests/Projection/MoreExplanatoryExceptionTests.cs b/src/UnitTests/Projection/MoreExplanatoryExceptionTests.cs new file mode 100644 index 0000000000..6f38a1c1f7 --- /dev/null +++ b/src/UnitTests/Projection/MoreExplanatoryExceptionTests.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; +using AutoMapper.QueryableExtensions; + +namespace AutoMapper.UnitTests.Projection +{ + public class MoreExplanatoryExceptionTests + { + [Fact] + public void ConstructorWithUnknownParameterTypeThrowsExplicitException() + { + // Arrange + var config = new MapperConfiguration(cfg => + cfg.CreateMap()); + + // Act + var exception = Assert.Throws(() => + new EntitySource[0].AsQueryable().ProjectTo(config)); + + // Assert + Assert.Contains("object notSupported", exception.Message, StringComparison.OrdinalIgnoreCase); + } + + class EntitySource + { + } + class EntityDestination + { + public EntityDestination(object notSupported = null) { } + } + } +} diff --git a/src/UnitTests/Projection/NestedAndArraysTests.cs b/src/UnitTests/Projection/NestedAndArraysTests.cs index a421f0ddda..6c5b60f914 100644 --- a/src/UnitTests/Projection/NestedAndArraysTests.cs +++ b/src/UnitTests/Projection/NestedAndArraysTests.cs @@ -1,115 +1,114 @@ -namespace AutoMapper.UnitTests.Projection -{ - namespace NestedAndArraysTests - { - using System.Collections.Generic; - using QueryableExtensions; - using Xunit; - using System.Linq; - using Should.Core.Assertions; - - public class LinqTests - { - - public class Entity - { - public int EntityID { get; set; } - public string Title { get; set; } - public ICollection SubEntities { get; set; } - public Entity() - { - SubEntities = new HashSet(); - } - } - - public class SubEntity - { - public string Name { get; set; } - public string Description { get; set; } - } - - public class EntityViewModel - { - public int EntityID { get; set; } - public string[] SubEntityNames { get; set; } - } - - public class EntityDetailledViewModel - { - public int EntityID { get; set; } - public SubEntityViewModel[] SubEntities { get; set; } - } - - public class SubEntityViewModel - { - public string Description { get; set; } - } - - [Fact] - public void Example() - { - - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(m => m.SubEntityNames, o => o.MapFrom(f => f.SubEntities.Select(e => e.Name))); - }); - - var expression = config.ExpressionBuilder.CreateMapExpression(); - - var entity = new Entity - { - EntityID = 1, - SubEntities = - { - new SubEntity {Name = "First", Description = "First Description"}, - new SubEntity {Name = "Second", Description = "First Description"}, - }, - Title = "Entities" - }; - - var viewModel = expression.Compile()(entity); - - Assert.Equal(viewModel.EntityID, entity.EntityID); - Assert.Contains("First", viewModel.SubEntityNames.ToArray()); - Assert.Contains("Second", viewModel.SubEntityNames.ToArray()); - - - } - - - [Fact] - public void SubMap() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(m => m.Description, o => o.MapFrom(s => s.Description)); - - cfg.CreateMap(); - }); - - var expression = config.ExpressionBuilder.CreateMapExpression(); - - var entity = new Entity - { - EntityID = 1, - SubEntities = - { - new SubEntity {Name = "First", Description = "First Description"}, - new SubEntity {Name = "Second", Description = "First Description"}, - }, - Title = "Entities" - }; - - var viewModel = expression.Compile()(entity); - - Assert.Equal(viewModel.EntityID, entity.EntityID); - Assert.True(entity.SubEntities.All(subEntity => viewModel.SubEntities.Any(s => s.Description == subEntity.Description))); - - - } - - } - } +namespace AutoMapper.UnitTests.Projection +{ + namespace NestedAndArraysTests + { + using System.Collections.Generic; + using QueryableExtensions; + using Xunit; + using System.Linq; + + public class LinqTests + { + + public class Entity + { + public int EntityID { get; set; } + public string Title { get; set; } + public ICollection SubEntities { get; set; } + public Entity() + { + SubEntities = new HashSet(); + } + } + + public class SubEntity + { + public string Name { get; set; } + public string Description { get; set; } + } + + public class EntityViewModel + { + public int EntityID { get; set; } + public string[] SubEntityNames { get; set; } + } + + public class EntityDetailledViewModel + { + public int EntityID { get; set; } + public SubEntityViewModel[] SubEntities { get; set; } + } + + public class SubEntityViewModel + { + public string Description { get; set; } + } + + [Fact] + public void Example() + { + + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(m => m.SubEntityNames, o => o.MapFrom(f => f.SubEntities.Select(e => e.Name))); + }); + + var expression = config.ExpressionBuilder.GetMapExpression(); + + var entity = new Entity + { + EntityID = 1, + SubEntities = + { + new SubEntity {Name = "First", Description = "First Description"}, + new SubEntity {Name = "Second", Description = "First Description"}, + }, + Title = "Entities" + }; + + var viewModel = expression.Compile()(entity); + + Assert.Equal(viewModel.EntityID, entity.EntityID); + Assert.Contains("First", viewModel.SubEntityNames.ToArray()); + Assert.Contains("Second", viewModel.SubEntityNames.ToArray()); + + + } + + + [Fact] + public void SubMap() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(m => m.Description, o => o.MapFrom(s => s.Description)); + + cfg.CreateMap(); + }); + + var expression = config.ExpressionBuilder.GetMapExpression(); + + var entity = new Entity + { + EntityID = 1, + SubEntities = + { + new SubEntity {Name = "First", Description = "First Description"}, + new SubEntity {Name = "Second", Description = "First Description"}, + }, + Title = "Entities" + }; + + var viewModel = expression.Compile()(entity); + + Assert.Equal(viewModel.EntityID, entity.EntityID); + Assert.True(entity.SubEntities.All(subEntity => viewModel.SubEntities.Any(s => s.Description == subEntity.Description))); + + + } + + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/NestedExpressionsMapFromTests.cs b/src/UnitTests/Projection/NestedExpressionsMapFromTests.cs index baa5e09489..738d6ee02a 100644 --- a/src/UnitTests/Projection/NestedExpressionsMapFromTests.cs +++ b/src/UnitTests/Projection/NestedExpressionsMapFromTests.cs @@ -1,60 +1,59 @@ -namespace AutoMapper.UnitTests.Projection -{ - namespace NestedExpressionTests - { - using System.Collections.Generic; - using System.Linq; - using QueryableExtensions; - using Rhino.Mocks.Constraints; - using Should; - using Xunit; - - public class NestedExpressionMapFromTests - { - private MapperConfiguration _config; - - public NestedExpressionMapFromTests() - { - _config = new MapperConfiguration(cfg => - cfg.CreateMap() - .ForMember(dest => dest.TotalSum, opt => opt.MapFrom(p => p.Children.Sum(child => child.Value)))); - } - - [Fact] - public void Should_use_nested_expression() - { - var items = new[] - { - new Parent - { - Children = new List() - { - new Child() { Value = 4 }, - new Child() { Value = 5 }, - } - } - }; - - var projected = items.AsQueryable().ProjectTo(_config).ToList(); - - projected[0].TotalSum.ShouldEqual(9); - } - } - - public class ParentDto - { - public int TotalSum { get; set; } - } - - - public class Parent - { - public List Children { get; set; } - } - - public class Child - { - public int Value { get; set; } - } - } +namespace AutoMapper.UnitTests.Projection +{ + namespace NestedExpressionTests + { + using System.Collections.Generic; + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class NestedExpressionMapFromTests + { + private MapperConfiguration _config; + + public NestedExpressionMapFromTests() + { + _config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dest => dest.TotalSum, opt => opt.MapFrom(p => p.Children.Sum(child => child.Value)))); + } + + [Fact] + public void Should_use_nested_expression() + { + var items = new[] + { + new Parent + { + Children = new List() + { + new Child() { Value = 4 }, + new Child() { Value = 5 }, + } + } + }; + + var projected = items.AsQueryable().ProjectTo(_config).ToList(); + + projected[0].TotalSum.ShouldBe(9); + } + } + + public class ParentDto + { + public int TotalSum { get; set; } + } + + + public class Parent + { + public List Children { get; set; } + } + + public class Child + { + public int Value { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/NonGenericQueryableTests.cs b/src/UnitTests/Projection/NonGenericQueryableTests.cs index 9b28273308..0deafabbf7 100644 --- a/src/UnitTests/Projection/NonGenericQueryableTests.cs +++ b/src/UnitTests/Projection/NonGenericQueryableTests.cs @@ -1,57 +1,57 @@ -namespace AutoMapper.UnitTests.Projection -{ - using AutoMapper.QueryableExtensions; - using Should; - using System.Collections.Generic; - using System.Linq; - using Xunit; - - public class NonGenericQueryableTests - { - private MapperConfiguration _config; - - public NonGenericQueryableTests() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - } - - [Fact] - public void CanMapNonGenericQueryable() - { - var movies = - new List() { - new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 1" }, new Actor() { Name = "Actor 2" } } }, - new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 3" }, new Actor() { Name = "Actor 4" } } } - }.AsQueryable(); - - var mapped = movies.ProjectTo(_config); - - mapped.ElementAt(0).Actors.Length.ShouldEqual(2); - mapped.ElementAt(1).Actors[1].Name.ShouldEqual("Actor 4"); - } - - public class Movie - { - public Actor[] Actors { get; set; } - } - - public class MovieDto - { - public ActorDto[] Actors { get; set; } - } - - public class Actor - { - public string Name { get; set; } - } - - public class ActorDto - { - public string Name { get; set; } - } - } +namespace AutoMapper.UnitTests.Projection +{ + using AutoMapper.QueryableExtensions; + using Shouldly; + using System.Collections.Generic; + using System.Linq; + using Xunit; + + public class NonGenericQueryableTests + { + private MapperConfiguration _config; + + public NonGenericQueryableTests() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + } + + [Fact] + public void CanMapNonGenericQueryable() + { + var movies = + new List() { + new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 1" }, new Actor() { Name = "Actor 2" } } }, + new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 3" }, new Actor() { Name = "Actor 4" } } } + }.AsQueryable(); + + var mapped = movies.ProjectTo(_config); + + mapped.ElementAt(0).Actors.Length.ShouldBe(2); + mapped.ElementAt(1).Actors[1].Name.ShouldBe("Actor 4"); + } + + public class Movie + { + public Actor[] Actors { get; set; } + } + + public class MovieDto + { + public ActorDto[] Actors { get; set; } + } + + public class Actor + { + public string Name { get; set; } + } + + public class ActorDto + { + public string Name { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/NullSubstitutes.cs b/src/UnitTests/Projection/NullSubstitutes.cs index e276863dcd..8dcedc28ef 100644 --- a/src/UnitTests/Projection/NullSubstitutes.cs +++ b/src/UnitTests/Projection/NullSubstitutes.cs @@ -1,78 +1,78 @@ -namespace AutoMapper.UnitTests.Projection -{ - using System.Collections.Generic; - using System.Linq; - using QueryableExtensions; - using Should; - using Xunit; - - public class NullSubstitutes : AutoMapperSpecBase - { - private List _dests; - - public class Source - { - public int? Value { get; set; } - } - - public class Dest - { - public int? Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ForMember(m => m.Value, opt => opt.NullSubstitute(5)); - }); - - protected override void Because_of() - { - var source = new[] {new Source()}.AsQueryable(); - - _dests = source.ProjectTo(Configuration).ToList(); - } - - [Fact] - public void Can_substitute_null_values() - { - _dests[0].Value.ShouldEqual(5); - } - } - - public class NullSubstitutesWithMapFrom : AutoMapperSpecBase - { - private List _dests; - - public class Source - { - public int? Value { get; set; } - } - - public class Dest - { - public int? ValuePropertyNotMatching { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ForMember(m => m.ValuePropertyNotMatching, opt => - { - opt.MapFrom(src => src.Value); - opt.NullSubstitute(5); - }); - }); - - protected override void Because_of() - { - var source = new[] {new Source()}.AsQueryable(); - - _dests = source.ProjectTo(Configuration).ToList(); - } - - [Fact] - public void Can_substitute_null_values() - { - _dests[0].ValuePropertyNotMatching.ShouldEqual(5); - } - } +namespace AutoMapper.UnitTests.Projection +{ + using System.Collections.Generic; + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class NullSubstitutes : AutoMapperSpecBase + { + private List _dests; + + public class Source + { + public int? Value { get; set; } + } + + public class Dest + { + public int? Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(m => m.Value, opt => opt.NullSubstitute(5)); + }); + + protected override void Because_of() + { + var source = new[] {new Source()}.AsQueryable(); + + _dests = source.ProjectTo(Configuration).ToList(); + } + + [Fact] + public void Can_substitute_null_values() + { + _dests[0].Value.ShouldBe(5); + } + } + + public class NullSubstitutesWithMapFrom : AutoMapperSpecBase + { + private List _dests; + + public class Source + { + public int? Value { get; set; } + } + + public class Dest + { + public int? ValuePropertyNotMatching { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ForMember(m => m.ValuePropertyNotMatching, opt => + { + opt.MapFrom(src => src.Value); + opt.NullSubstitute(5); + }); + }); + + protected override void Because_of() + { + var source = new[] {new Source()}.AsQueryable(); + + _dests = source.ProjectTo(Configuration).ToList(); + } + + [Fact] + public void Can_substitute_null_values() + { + _dests[0].ValuePropertyNotMatching.ShouldBe(5); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/NullableItemsTests.cs b/src/UnitTests/Projection/NullableItemsTests.cs index 7d724140a1..0bb7fa34d2 100644 --- a/src/UnitTests/Projection/NullableItemsTests.cs +++ b/src/UnitTests/Projection/NullableItemsTests.cs @@ -1,113 +1,112 @@ -using System; - -namespace AutoMapper.UnitTests.Projection -{ - namespace NullableItemsTests - { - using System.Linq; - using QueryableExtensions; - using Should; - using Should.Core.Assertions; - using Xunit; - - public class NullChildItemTest - { - private MapperConfiguration _config; - - public NullChildItemTest() - { - _config = new MapperConfiguration(cfg => { - cfg.CreateMap(); - cfg.AllowNullCollections = true; - }); - } - - [Fact] - public void Should_project_null_value() - { - var items = new[] - { - new Parent - { - Value = 5 - } - }; - - var projected = items.AsQueryable().ProjectTo(_config).ToList(); - - projected[0].Value.ShouldEqual(5); - projected[0].ChildValue.ShouldBeNull(); - projected[0].ChildGrandChildValue.ShouldBeNull(); - projected[0].Nephews.ShouldBeNull(); - } - - - public class ParentDto - { - public int? Value { get; set; } - public int? ChildValue { get; set; } - public int? ChildGrandChildValue { get; set; } - public DateTime? Date { get; set; } - public Child[] Nephews { get; set; } - } - - - public class Parent - { - public int Value { get; set; } - public Child Child { get; set; } - public Child[] Nephews { get; set; } - } - - public class Child - { - public int Value { get; set; } - public GrandChild GrandChild { get; set; } - } - - public class GrandChild - { - public int Value { get; set; } - } - } - - public class CustomMapFromTest - { - private MapperConfiguration _config; - - public class Parent - { - public int Value { get; set; } - - } - - public class ParentDto - { - public int? Value { get; set; } - public DateTime? Date { get; set; } - } - public CustomMapFromTest() - { - _config = new MapperConfiguration(cfg => cfg.CreateMap() - .ForMember(dto => dto.Date, opt => opt.MapFrom(src => DateTime.UtcNow))); - } - - [Fact] - public void Should_not_fail() - { - var items = new[] - { - new Parent - { - Value = 5 - } - }; - - var projected = items.AsQueryable().ProjectTo(_config).ToList(); - - typeof(NullReferenceException).ShouldNotBeThrownBy(() => items.AsQueryable().ProjectTo(_config).ToList()); - Assert.NotNull(projected[0].Date); - } - } - } +using System; + +namespace AutoMapper.UnitTests.Projection +{ + namespace NullableItemsTests + { + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class NullChildItemTest + { + private MapperConfiguration _config; + + public NullChildItemTest() + { + _config = new MapperConfiguration(cfg => { + cfg.CreateMap(); + cfg.AllowNullCollections = true; + }); + } + + [Fact] + public void Should_project_null_value() + { + var items = new[] + { + new Parent + { + Value = 5 + } + }; + + var projected = items.AsQueryable().ProjectTo(_config).ToList(); + + projected[0].Value.ShouldBe(5); + projected[0].ChildValue.ShouldBeNull(); + projected[0].ChildGrandChildValue.ShouldBeNull(); + projected[0].Nephews.ShouldBeNull(); + } + + + public class ParentDto + { + public int? Value { get; set; } + public int? ChildValue { get; set; } + public int? ChildGrandChildValue { get; set; } + public DateTime? Date { get; set; } + public Child[] Nephews { get; set; } + } + + + public class Parent + { + public int Value { get; set; } + public Child Child { get; set; } + public Child[] Nephews { get; set; } + } + + public class Child + { + public int Value { get; set; } + public GrandChild GrandChild { get; set; } + } + + public class GrandChild + { + public int Value { get; set; } + } + } + + public class CustomMapFromTest + { + private MapperConfiguration _config; + + public class Parent + { + public int Value { get; set; } + + } + + public class ParentDto + { + public int? Value { get; set; } + public DateTime? Date { get; set; } + } + public CustomMapFromTest() + { + _config = new MapperConfiguration(cfg => cfg.CreateMap() + .ForMember(dto => dto.Date, opt => opt.MapFrom(src => DateTime.UtcNow))); + } + + [Fact] + public void Should_not_fail() + { + var items = new[] + { + new Parent + { + Value = 5 + } + }; + + var projected = items.AsQueryable().ProjectTo(_config).ToList(); + + typeof(NullReferenceException).ShouldNotBeThrownBy(() => items.AsQueryable().ProjectTo(_config).ToList()); + Assert.NotNull(projected[0].Date); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/ParameterizedQueriesTests.cs b/src/UnitTests/Projection/ParameterizedQueriesTests.cs index 5eedc17561..eb32ea59a3 100644 --- a/src/UnitTests/Projection/ParameterizedQueriesTests.cs +++ b/src/UnitTests/Projection/ParameterizedQueriesTests.cs @@ -1,206 +1,205 @@ -namespace AutoMapper.UnitTests.Projection -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - using QueryableExtensions; - using Should; - using Xunit; - - public class ParameterizedQueriesTests_with_anonymous_object_and_factory : AutoMapperSpecBase - { - private Dest[] _dests; - private IQueryable _sources; - - public class Source - { - } - - public class Dest - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - int value = 0; - - Expression> sourceMember = src => value + 5; - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(sourceMember)); - }); - - protected override void Because_of() - { - _sources = new[] - { - new Source() - }.AsQueryable(); - - _dests = _sources.ProjectTo(Configuration, new { value = 10 }).ToArray(); - } - - [Fact] - public void Should_substitute_parameter_value() - { - _dests[0].Value.ShouldEqual(15); - } - - [Fact] - public void Should_not_cache_parameter_value() - { - var newDests = _sources.ProjectTo(Configuration, new { value = 15 }).ToArray(); - - newDests[0].Value.ShouldEqual(20); - } - } - - public class ParameterizedQueriesTests_with_anonymous_object : AutoMapperSpecBase - { - private Dest[] _dests; - private IQueryable _sources; - - public class Source - { - } - - public class Dest - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - int value = 0; - - Expression> sourceMember = src => value + 5; - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(sourceMember)); - }); - - protected override void Because_of() - { - _sources = new[] - { - new Source() - }.AsQueryable(); - - _dests = _sources.ProjectTo(Configuration, new { value = 10 }).ToArray(); - } - - [Fact] - public void Should_substitute_parameter_value() - { - _dests[0].Value.ShouldEqual(15); - } - - [Fact] - public void Should_not_cache_parameter_value() - { - var newDests = _sources.ProjectTo(Configuration, new {value = 15}).ToArray(); - - newDests[0].Value.ShouldEqual(20); - } - } - - public class ParameterizedQueriesTests_with_dictionary_object : AutoMapperSpecBase - { - private Dest[] _dests; - private IQueryable _sources; - - public class Source - { - } - - public class Dest - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - int value = 0; - - Expression> sourceMember = src => value + 5; - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(sourceMember)); - }); - - protected override void Because_of() - { - _sources = new[] - { - new Source() - }.AsQueryable(); - - _dests = _sources.ProjectTo(Configuration, new Dictionary{{"value", 10}}).ToArray(); - } - - [Fact] - public void Should_substitute_parameter_value() - { - _dests[0].Value.ShouldEqual(15); - } - - [Fact] - public void Should_not_cache_parameter_value() - { - var newDests = _sources.ProjectTo(Configuration, new Dictionary { { "value", 15 } }).ToArray(); - - newDests[0].Value.ShouldEqual(20); - } - } - - public class ParameterizedQueriesTests_with_filter : AutoMapperSpecBase - { - public class User - { - public int Id { get; set; } - public string Name { get; set; } - public DateTime? DateActivated { get; set; } - } - - public class UserViewModel - { - public int Id { get; set; } - public string Name { get; set; } - public DateTime? DateActivated { get; set; } - public int position { get; set; } - } - - public class DB - { - public DB() - { - Users = new List() - { - new User {DateActivated = new DateTime(2000, 1, 1), Id = 1, Name = "Joe Schmoe"}, - new User {DateActivated = new DateTime(2000, 2, 1), Id = 2, Name = "John Schmoe"}, - new User {DateActivated = new DateTime(2000, 3, 1), Id = 3, Name = "Jim Schmoe"}, - }.AsQueryable(); - } - public IQueryable Users { get; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - DB db = null; - - cfg.CreateMap() - .ForMember(a => a.position, - opt => opt.MapFrom(src => db.Users.Count(u => u.DateActivated < src.DateActivated))); - }); - - [Fact] - public void Should_only_replace_outer_parameters() - { - var db = new DB(); - - var user = db.Users.ProjectTo(Configuration, new { db }).FirstOrDefault(a => a.Id == 2); - - user.position.ShouldEqual(1); - } - - } +namespace AutoMapper.UnitTests.Projection +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Linq.Expressions; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class ParameterizedQueriesTests_with_anonymous_object_and_factory : AutoMapperSpecBase + { + private Dest[] _dests; + private IQueryable _sources; + + public class Source + { + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + int value = 0; + + Expression> sourceMember = src => value + 5; + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(sourceMember)); + }); + + protected override void Because_of() + { + _sources = new[] + { + new Source() + }.AsQueryable(); + + _dests = _sources.ProjectTo(Configuration, new { value = 10 }).ToArray(); + } + + [Fact] + public void Should_substitute_parameter_value() + { + _dests[0].Value.ShouldBe(15); + } + + [Fact] + public void Should_not_cache_parameter_value() + { + var newDests = _sources.ProjectTo(Configuration, new { value = 15 }).ToArray(); + + newDests[0].Value.ShouldBe(20); + } + } + + public class ParameterizedQueriesTests_with_anonymous_object : AutoMapperSpecBase + { + private Dest[] _dests; + private IQueryable _sources; + + public class Source + { + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + int value = 0; + + Expression> sourceMember = src => value + 5; + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(sourceMember)); + }); + + protected override void Because_of() + { + _sources = new[] + { + new Source() + }.AsQueryable(); + + _dests = _sources.ProjectTo(Configuration, new { value = 10 }).ToArray(); + } + + [Fact] + public void Should_substitute_parameter_value() + { + _dests[0].Value.ShouldBe(15); + } + + [Fact] + public void Should_not_cache_parameter_value() + { + var newDests = _sources.ProjectTo(Configuration, new {value = 15}).ToArray(); + + newDests[0].Value.ShouldBe(20); + } + } + + public class ParameterizedQueriesTests_with_dictionary_object : AutoMapperSpecBase + { + private Dest[] _dests; + private IQueryable _sources; + + public class Source + { + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + int value = 0; + + Expression> sourceMember = src => value + 5; + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(sourceMember)); + }); + + protected override void Because_of() + { + _sources = new[] + { + new Source() + }.AsQueryable(); + + _dests = _sources.ProjectTo(Configuration, new Dictionary{{"value", 10}}).ToArray(); + } + + [Fact] + public void Should_substitute_parameter_value() + { + _dests[0].Value.ShouldBe(15); + } + + [Fact] + public void Should_not_cache_parameter_value() + { + var newDests = _sources.ProjectTo(Configuration, new Dictionary { { "value", 15 } }).ToArray(); + + newDests[0].Value.ShouldBe(20); + } + } + + public class ParameterizedQueriesTests_with_filter : AutoMapperSpecBase + { + public class User + { + public int Id { get; set; } + public string Name { get; set; } + public DateTime? DateActivated { get; set; } + } + + public class UserViewModel + { + public int Id { get; set; } + public string Name { get; set; } + public DateTime? DateActivated { get; set; } + public int position { get; set; } + } + + public class DB + { + public DB() + { + Users = new List() + { + new User {DateActivated = new DateTime(2000, 1, 1), Id = 1, Name = "Joe Schmoe"}, + new User {DateActivated = new DateTime(2000, 2, 1), Id = 2, Name = "John Schmoe"}, + new User {DateActivated = new DateTime(2000, 3, 1), Id = 3, Name = "Jim Schmoe"}, + }.AsQueryable(); + } + public IQueryable Users { get; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + DB db = null; + + cfg.CreateMap() + .ForMember(a => a.position, + opt => opt.MapFrom(src => db.Users.Count(u => u.DateActivated < src.DateActivated))); + }); + + [Fact] + public void Should_only_replace_outer_parameters() + { + var db = new DB(); + + var user = db.Users.ProjectTo(Configuration, new { db }).FirstOrDefault(a => a.Id == 2); + + user.position.ShouldBe(1); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/PrimitiveArraysTest.cs b/src/UnitTests/Projection/PrimitiveArraysTest.cs index c920725d87..1e98a6424f 100644 --- a/src/UnitTests/Projection/PrimitiveArraysTest.cs +++ b/src/UnitTests/Projection/PrimitiveArraysTest.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using Xunit; -using System.Linq; -using Should; - -namespace AutoMapper.UnitTests.Projection -{ - namespace PrimitiveArrays - { - using QueryableExtensions; - - public class PrimitiveArraysExpressionTest - { - [Fact] - public void Should_not_fail() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - typeof(NullReferenceException).ShouldNotBeThrownBy(() => config.ExpressionBuilder.CreateMapExpression()); - } - - [Fact] - public void Should_map_values() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - var sources = new List - { - new Source - { - Value1 = new byte[] {1, 2, 3}, - Value2 = new[] {4, 5, 6} - } - }; - - var expr = sources.AsQueryable().ProjectTo(config); - - var result = expr.ToList(); - - result[0].Value1.ShouldEqual(sources[0].Value1); - result[0].Value2.ShouldEqual(sources[0].Value2); - } - } - public class Source - { - public byte[] Value1 { get; set; } - public int[] Value2 { get; set; } - } - - public class Destination - { - public byte[] Value1 { get; set; } - public int[] Value2 { get; set; } - } - } +using System; +using System.Collections.Generic; +using Xunit; +using System.Linq; +using Shouldly; + +namespace AutoMapper.UnitTests.Projection +{ + namespace PrimitiveArrays + { + using QueryableExtensions; + + public class PrimitiveArraysExpressionTest + { + [Fact] + public void Should_not_fail() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + typeof(NullReferenceException).ShouldNotBeThrownBy(() => config.ExpressionBuilder.GetMapExpression()); + } + + [Fact] + public void Should_map_values() + { + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + var sources = new List + { + new Source + { + Value1 = new byte[] {1, 2, 3}, + Value2 = new[] {4, 5, 6} + } + }; + + var expr = sources.AsQueryable().ProjectTo(config); + + var result = expr.ToList(); + + result[0].Value1.ShouldBe(sources[0].Value1); + result[0].Value2.ShouldBe(sources[0].Value2); + } + } + public class Source + { + public byte[] Value1 { get; set; } + public int[] Value2 { get; set; } + } + + public class Destination + { + public byte[] Value1 { get; set; } + public int[] Value2 { get; set; } + } + } } \ No newline at end of file diff --git a/src/UnitTests/Projection/ProjectCollectionEnumerableTest.cs b/src/UnitTests/Projection/ProjectCollectionEnumerableTest.cs index ab47395ed8..45a9d78fd1 100644 --- a/src/UnitTests/Projection/ProjectCollectionEnumerableTest.cs +++ b/src/UnitTests/Projection/ProjectCollectionEnumerableTest.cs @@ -1,93 +1,82 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Projection -{ - using System.Collections.Generic; - using System.Linq; - - using AutoMapper; - using QueryableExtensions; - - public class ProjectCollectionEnumerableTest - { - private MapperConfiguration _config; - private const string Street1 = "Street1"; - private const string Street2 = "Street2"; - - public ProjectCollectionEnumerableTest() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - } - - [Fact(Skip = "EF doesn't support null assignments in expressions")] - public void ProjectWithNullCollectionSourceProperty() - { - var customers = new[] { new Customer() }.AsQueryable(); - - var mapped = customers.ProjectTo(_config).SingleOrDefault(); - - mapped.ShouldNotBeNull(); - mapped.Addresses.ShouldBeNull(); - } - - [Fact] - public void ProjectWithAssignedCollectionSourceProperty() - { - var customer = new Customer { Addresses = new List
{ new Address(Street1), new Address(Street2) } }; - var customers = new[] { customer }.AsQueryable(); - - var mapped = customers.ProjectTo(_config).SingleOrDefault(); - - mapped.ShouldNotBeNull(); - - mapped.Addresses.ShouldBeOfLength(2); - mapped.Addresses.ElementAt(0).Street.ShouldEqual(Street1); - mapped.Addresses.ElementAt(1).Street.ShouldEqual(Street2); - } - - public class Customer - { - public IList
Addresses { get; set; } - } - - public class Address - { - public Address(string street) - { - Street = street; - } - - public string Street { get; set; } - } - - public class CustomerDto - { - public IEnumerable Addresses { get; set; } - } - - public class AddressDto - { - public string Street { get; set; } - - public override string ToString() - { - return Street; - } - - public override bool Equals(object obj) - { - return string.Equals(ToString(), obj.ToString()); - } - - public override int GetHashCode() - { - return Street.GetHashCode(); - } - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Projection +{ + using System.Collections.Generic; + using System.Linq; + + using AutoMapper; + using QueryableExtensions; + + public class ProjectCollectionEnumerableTest + { + private MapperConfiguration _config; + private const string Street1 = "Street1"; + private const string Street2 = "Street2"; + + public ProjectCollectionEnumerableTest() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + } + + [Fact] + public void ProjectWithAssignedCollectionSourceProperty() + { + var customer = new Customer { Addresses = new List
{ new Address(Street1), new Address(Street2) } }; + var customers = new[] { customer }.AsQueryable(); + + var mapped = customers.ProjectTo(_config).SingleOrDefault(); + + mapped.ShouldNotBeNull(); + + mapped.Addresses.ShouldBeOfLength(2); + mapped.Addresses.ElementAt(0).Street.ShouldBe(Street1); + mapped.Addresses.ElementAt(1).Street.ShouldBe(Street2); + } + + public class Customer + { + public IList
Addresses { get; set; } + } + + public class Address + { + public Address(string street) + { + Street = street; + } + + public string Street { get; set; } + } + + public class CustomerDto + { + public IEnumerable Addresses { get; set; } + } + + public class AddressDto + { + public string Street { get; set; } + + public override string ToString() + { + return Street; + } + + public override bool Equals(object obj) + { + return string.Equals(ToString(), obj.ToString()); + } + + public override int GetHashCode() + { + return Street.GetHashCode(); + } + } + } +} diff --git a/src/UnitTests/Projection/ProjectCollectionListTest.cs b/src/UnitTests/Projection/ProjectCollectionListTest.cs index 3a43e4ace7..eb9790419a 100644 --- a/src/UnitTests/Projection/ProjectCollectionListTest.cs +++ b/src/UnitTests/Projection/ProjectCollectionListTest.cs @@ -1,112 +1,102 @@ -using Should; -using Xunit; - -namespace AutoMapper.UnitTests.Projection -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using AutoMapper; - using QueryableExtensions; - - - public class ProjectCollectionListTest - { - private MapperConfiguration _config; - private const string Street1 = "Street1"; - private const string Street2 = "Street2"; - - public ProjectCollectionListTest() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - } - - [Fact(Skip = "EF doesn't support null values in expressions")] - public void ProjectWithNullCollectionSourceProperty() - { - var customers = new[] { new Customer() }.AsQueryable(); - - var mapped = customers.ProjectTo(_config).SingleOrDefault(); - mapped.ShouldNotBeNull(); - mapped.Addresses.ShouldBeNull(); - } - - [Fact] - public void ProjectWithAssignedCollectionSourceProperty() - { - var customer = new Customer { Addresses = new List
{ new Address(Street1), new Address(Street2) } }; - - var customers = new[] { customer }.AsQueryable(); - - var mapped = customers.ProjectTo(_config).SingleOrDefault(); - - mapped.ShouldNotBeNull(); - - mapped.Addresses.ShouldBeOfLength(2); - mapped.Addresses[0].Street.ShouldEqual(Street1); - mapped.Addresses[1].Street.ShouldEqual(Street2); - } - - public class Customer - { - public IList
Addresses { get; set; } - } - - public class Address - { - public Address(string street) - { - Street = street; - } - - public string Street { get; set; } - } - - public class CustomerDto - { - public IList Addresses { get; set; } - } - - public class AddressDto : IEquatable - { - public bool Equals(AddressDto other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return string.Equals(Street, other.Street); - } - - public override int GetHashCode() - { - return (Street != null ? Street.GetHashCode() : 0); - } - - public static bool operator ==(AddressDto left, AddressDto right) - { - return Equals(left, right); - } - - public static bool operator !=(AddressDto left, AddressDto right) - { - return !Equals(left, right); - } - - public string Street { get; set; } - - public override string ToString() - { - return Street; - } - - public override bool Equals(object obj) - { - return string.Equals(ToString(), obj.ToString()); - } - } - } -} +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.Projection +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using AutoMapper; + using QueryableExtensions; + + + public class ProjectCollectionListTest + { + private MapperConfiguration _config; + private const string Street1 = "Street1"; + private const string Street2 = "Street2"; + + public ProjectCollectionListTest() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + } + + [Fact] + public void ProjectWithAssignedCollectionSourceProperty() + { + var customer = new Customer { Addresses = new List
{ new Address(Street1), new Address(Street2) } }; + + var customers = new[] { customer }.AsQueryable(); + + var mapped = customers.ProjectTo(_config).SingleOrDefault(); + + mapped.ShouldNotBeNull(); + + mapped.Addresses.ShouldBeOfLength(2); + mapped.Addresses[0].Street.ShouldBe(Street1); + mapped.Addresses[1].Street.ShouldBe(Street2); + } + + public class Customer + { + public IList
Addresses { get; set; } + } + + public class Address + { + public Address(string street) + { + Street = street; + } + + public string Street { get; set; } + } + + public class CustomerDto + { + public IList Addresses { get; set; } + } + + public class AddressDto : IEquatable + { + public bool Equals(AddressDto other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return string.Equals(Street, other.Street); + } + + public override int GetHashCode() + { + return (Street != null ? Street.GetHashCode() : 0); + } + + public static bool operator ==(AddressDto left, AddressDto right) + { + return Equals(left, right); + } + + public static bool operator !=(AddressDto left, AddressDto right) + { + return !Equals(left, right); + } + + public string Street { get; set; } + + public override string ToString() + { + return Street; + } + + public override bool Equals(object obj) + { + return string.Equals(ToString(), obj.ToString()); + } + } + } +} diff --git a/src/UnitTests/Projection/ProjectEnumTest.cs b/src/UnitTests/Projection/ProjectEnumTest.cs index a2c3f0e10c..4147393534 100644 --- a/src/UnitTests/Projection/ProjectEnumTest.cs +++ b/src/UnitTests/Projection/ProjectEnumTest.cs @@ -1,81 +1,82 @@ -namespace AutoMapper.UnitTests.Projection -{ - using QueryableExtensions; - using Should; - using System.Linq; - using Should.Core.Assertions; - using Xunit; - - public class ProjectEnumTest - { - private MapperConfiguration _config; - - public ProjectEnumTest() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap().ProjectUsing(ct => ct.ToString().ToUpper()); - }); - } - - [Fact] - public void ProjectingEnumToString() - { - var customers = new[] { new Customer() { FirstName = "Bill", LastName = "White", CustomerType = CustomerType.Vip } }.AsQueryable(); - - var projected = customers.ProjectTo(_config); - projected.ShouldNotBeNull(); - Assert.Equal(customers.Single().CustomerType.ToString().ToUpper(), projected.Single().CustomerType); - } - - public class Customer - { - public string FirstName { get; set; } - - public string LastName { get; set; } - - public CustomerType CustomerType { get; set; } - } - - public class CustomerDto - { - public string FirstName { get; set; } - - public string LastName { get; set; } - - public string CustomerType { get; set; } - } - - public enum CustomerType - { - Regular, - Vip, - } - } - - public class ProjectionOverrides : NonValidatingSpecBase - { - public class Source - { - - } - - public class Dest - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ProjectUsing(src => new Dest {Value = 10}); - }); - - [Fact] - public void Should_validate_because_of_overridden_projection() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } -} +using System; + +namespace AutoMapper.UnitTests.Projection +{ + using QueryableExtensions; + using Shouldly; + using System.Linq; + using Xunit; + + public class ProjectEnumTest + { + private MapperConfiguration _config; + + public ProjectEnumTest() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap().ConvertUsing(ct => ct.ToString().ToUpper()); + }); + } + + [Fact] + public void ProjectingEnumToString() + { + var customers = new[] { new Customer() { FirstName = "Bill", LastName = "White", CustomerType = CustomerType.Vip } }.AsQueryable(); + + var projected = customers.ProjectTo(_config); + projected.ShouldNotBeNull(); + Assert.Equal(customers.Single().CustomerType.ToString(), projected.Single().CustomerType, StringComparer.OrdinalIgnoreCase); + } + + public class Customer + { + public string FirstName { get; set; } + + public string LastName { get; set; } + + public CustomerType CustomerType { get; set; } + } + + public class CustomerDto + { + public string FirstName { get; set; } + + public string LastName { get; set; } + + public string CustomerType { get; set; } + } + + public enum CustomerType + { + Regular, + Vip, + } + } + + public class ProjectionOverrides : NonValidatingSpecBase + { + public class Source + { + + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ConvertUsing(src => new Dest {Value = 10}); + }); + + [Fact] + public void Should_validate_because_of_overridden_projection() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } +} diff --git a/src/UnitTests/Projection/ProjectEnumerableToArrayTest.cs b/src/UnitTests/Projection/ProjectEnumerableToArrayTest.cs index 33cf60e4b6..1847fecde8 100644 --- a/src/UnitTests/Projection/ProjectEnumerableToArrayTest.cs +++ b/src/UnitTests/Projection/ProjectEnumerableToArrayTest.cs @@ -1,60 +1,60 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Projection -{ - using QueryableExtensions; - - public class ProjectEnumerableToArrayTest - { - private MapperConfiguration _config; - - public ProjectEnumerableToArrayTest() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - } - - [Fact] - public void EnumerablesAreMappedToArrays() - { - var movies = - new List() { - new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 1" }, new Actor() { Name = "Actor 2" } } }, - new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 3" }, new Actor() { Name = "Actor 4" } } } - }.AsQueryable(); - - var mapped = movies.ProjectTo(_config); - - mapped.ElementAt(0).Actors.Length.ShouldEqual(2); - mapped.ElementAt(1).Actors[1].Name.ShouldEqual("Actor 4"); - } - - public class Movie - { - public IEnumerable Actors { get; set; } - } - - public class MovieDto - { - public ActorDto[] Actors { get; set; } - } - - public class Actor - { - public string Name { get; set; } - } - - public class ActorDto - { - public string Name { get; set; } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Projection +{ + using QueryableExtensions; + + public class ProjectEnumerableToArrayTest + { + private MapperConfiguration _config; + + public ProjectEnumerableToArrayTest() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + }); + } + + [Fact] + public void EnumerablesAreMappedToArrays() + { + var movies = + new List() { + new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 1" }, new Actor() { Name = "Actor 2" } } }, + new Movie() { Actors = new Actor[] { new Actor() { Name = "Actor 3" }, new Actor() { Name = "Actor 4" } } } + }.AsQueryable(); + + var mapped = movies.ProjectTo(_config); + + mapped.ElementAt(0).Actors.Length.ShouldBe(2); + mapped.ElementAt(1).Actors[1].Name.ShouldBe("Actor 4"); + } + + public class Movie + { + public IEnumerable Actors { get; set; } + } + + public class MovieDto + { + public ActorDto[] Actors { get; set; } + } + + public class Actor + { + public string Name { get; set; } + } + + public class ActorDto + { + public string Name { get; set; } + } + } +} diff --git a/src/UnitTests/Projection/ProjectTest.cs b/src/UnitTests/Projection/ProjectTest.cs index 9251bb4020..1acfe5d19f 100644 --- a/src/UnitTests/Projection/ProjectTest.cs +++ b/src/UnitTests/Projection/ProjectTest.cs @@ -1,86 +1,101 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Projection -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using AutoMapper; - using QueryableExtensions; - - public class ProjectTest - { - private MapperConfiguration _config; - - public ProjectTest() - { - _config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap(); - }); - } - - [Fact(Skip = "EF doesn't support null values in expressions")] - public void SelectUsingProjectToWithNullComplexSourceProperty() - { - var customers = new[] { new Customer { FirstName = "Bill", LastName = "White" } }.AsQueryable(); - - var projected = customers.ProjectTo(_config).SingleOrDefault(); - projected.ShouldNotBeNull(); - projected.Address.ShouldBeNull(); - } - - [Fact] - public void ProjectToWithUnmappedTypeShouldThrowException() - { - var customers = - new[] { new Customer { FirstName = "Bill", LastName = "White", Address = new Address("Street1") } } - .AsQueryable(); - - IList projected = null; - - typeof(InvalidOperationException).ShouldBeThrownBy(() => projected = customers.ProjectTo(_config).ToList()); - - projected.ShouldBeNull(); - } - - public class Customer - { - public string FirstName { get; set; } - - public string LastName { get; set; } - - public Address Address { get; set; } - } - - public class Address - { - public Address(string street) - { - Street = street; - } - - public string Street { get; set; } - } - - public class CustomerDto - { - public string FirstName { get; set; } - - public AddressDto Address { get; set; } - } - - public class AddressDto - { - public string Street { get; set; } - } - - public class Unmapped - { - public string FirstName { get; set; } - } - } -} +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Projection +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using AutoMapper; + using QueryableExtensions; + + public class ProjectWithFields : AutoMapperSpecBase + { + public class Foo + { + public int A; + } + + public class FooDto + { + public int A; + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void Should_work() + { + new[] { new Foo() }.AsQueryable().ProjectTo(Configuration).Single().A.ShouldBe(0); + } + } + + public class ProjectTest + { + private MapperConfiguration _config; + + public ProjectTest() + { + _config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMissingTypeMaps = false; + }); + } + + [Fact] + public void ProjectToWithUnmappedTypeShouldThrowException() + { + var customers = + new[] { new Customer { FirstName = "Bill", LastName = "White", Address = new Address("Street1") } } + .AsQueryable(); + + IList projected = null; + + typeof(InvalidOperationException).ShouldBeThrownBy(() => projected = customers.ProjectTo(_config).ToList()); + + projected.ShouldBeNull(); + } + + public class Customer + { + public string FirstName { get; set; } + + public string LastName { get; set; } + + public Address Address { get; set; } + } + + public class Address + { + public Address(string street) + { + Street = street; + } + + public string Street { get; set; } + } + + public class CustomerDto + { + public string FirstName { get; set; } + + public AddressDto Address { get; set; } + } + + public class AddressDto + { + public string Street { get; set; } + } + + public class Unmapped + { + public string FirstName { get; set; } + } + } +} diff --git a/src/UnitTests/Projection/ProjectionTests.cs b/src/UnitTests/Projection/ProjectionTests.cs index 88bda95555..2f051f98dc 100644 --- a/src/UnitTests/Projection/ProjectionTests.cs +++ b/src/UnitTests/Projection/ProjectionTests.cs @@ -2,9 +2,68 @@ { using System.Linq; using Xunit; - using Should; + using Shouldly; using AutoMapper; using QueryableExtensions; + using System.Collections.Generic; + using System.Linq.Expressions; + + public class InMemoryMapObjectPropertyFromSubQuery : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Price, o => o.MapFrom(source => source.Articles.Where(x => x.IsDefault && x.NationId == 1 && source.ECommercePublished).FirstOrDefault())); + cfg.CreateMap() + .ForMember(d => d.RegionId, o => o.MapFrom(s => s.NationId)); + }); + + [Fact] + public void Should_cache_the_subquery() + { + var products = new[] { new Product { Id = 1, ECommercePublished = true, Articles = new[] { new Article { Id = 1, IsDefault = true, NationId = 1, ProductId = 1 } } } }.AsQueryable(); + var projection = products.ProjectTo(Configuration); + var productModel = projection.First(); + productModel.Price.RegionId.ShouldBe((short)1); + productModel.Price.IsDefault.ShouldBeTrue(); + productModel.Price.Id.ShouldBe(1); + productModel.Id.ShouldBe(1); + } + + public partial class Article + { + public int Id { get; set; } + public int ProductId { get; set; } + public bool IsDefault { get; set; } + public short NationId { get; set; } + public virtual Product Product { get; set; } + } + + public partial class Product + { + public int Id { get; set; } + public string Name { get; set; } + public bool ECommercePublished { get; set; } + public virtual ICollection
Articles { get; set; } + public int Value { get; } + public int NotMappedValue { get; set; } + public virtual List
OtherArticles { get; } + } + + public class PriceModel + { + public int Id { get; set; } + public short RegionId { get; set; } + public bool IsDefault { get; set; } + } + + public class ProductModel + { + public int Id { get; set; } + public PriceModel Price { get; set; } + } + } + public class ProjectionTests { @@ -14,9 +73,9 @@ public class ProjectionTests [Fact] public void Direct_assignability_shouldnt_trump_custom_projection() { - Mapper.Initialize(x => { + var config = new MapperConfiguration(x => { x.CreateMap() - .ProjectUsing(s => _niceGreeting); + .ConvertUsing(s => _niceGreeting); x.CreateMap(); x.CreateMap(); @@ -24,44 +83,44 @@ public void Direct_assignability_shouldnt_trump_custom_projection() { var target = new[] { new Source() { Greeting = _badGreeting } } .AsQueryable() - .ProjectTo() + .ProjectTo(config) .First(); - target.Greeting.ShouldEqual(_niceGreeting); + target.Greeting.ShouldBe(_niceGreeting); } [Fact] public void Root_is_subject_to_custom_projection() { - Mapper.Initialize(x => { + var config = new MapperConfiguration(x => { x.CreateMap() - .ProjectUsing(s => new Target() { Greeting = _niceGreeting }); + .ConvertUsing(s => new Target() { Greeting = _niceGreeting }); }); var target = new[] { new Source() } .AsQueryable() - .ProjectTo() + .ProjectTo(config) .First(); - target.Greeting.ShouldEqual(_niceGreeting); + target.Greeting.ShouldBe(_niceGreeting); } [Fact] public void Child_nodes_are_subject_to_custom_projection() { - Mapper.Initialize(x => { + var config = new MapperConfiguration(x => { x.CreateMap() - .ProjectUsing(s => new TargetChild() { Greeting = _niceGreeting }); + .ConvertUsing(s => new TargetChild() { Greeting = _niceGreeting }); x.CreateMap(); }); var target = new[] { new Source() } .AsQueryable() - .ProjectTo() + .ProjectTo(config) .First(); - target.Child.Greeting.ShouldEqual(_niceGreeting); + target.Child.Greeting.ShouldBe(_niceGreeting); } diff --git a/src/UnitTests/Projection/ToStringTests.cs b/src/UnitTests/Projection/ToStringTests.cs index a5eb7a129b..8d39b2d264 100644 --- a/src/UnitTests/Projection/ToStringTests.cs +++ b/src/UnitTests/Projection/ToStringTests.cs @@ -1,46 +1,85 @@ -namespace AutoMapper.UnitTests.Projection -{ - using System.Linq; - using QueryableExtensions; - using Should; - using Xunit; - - public class ToStringTests : AutoMapperSpecBase - { - private Dest[] _dests; - - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public string Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - protected override void Because_of() - { - var sources = new[] - { - new Source - { - Value = 5 - } - }.AsQueryable(); - - _dests = sources.ProjectTo(Configuration).ToArray(); - } - - [Fact] - public void Should_convert_to_string() - { - _dests[0].Value.ShouldEqual("5"); - } - } +namespace AutoMapper.UnitTests.Projection +{ + using System.Linq; + using QueryableExtensions; + using Shouldly; + using Xunit; + + public class ToStringTests : AutoMapperSpecBase + { + private Dest[] _dests; + + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var sources = new[] + { + new Source + { + Value = 5 + } + }.AsQueryable(); + + _dests = sources.ProjectTo(Configuration).ToArray(); + } + + [Fact] + public void Should_convert_to_string() + { + _dests[0].Value.ShouldBe("5"); + } + } + + public class NullableToStringTests : AutoMapperSpecBase + { + private Dest[] _dests; + + public class Source + { + public int? Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + protected override void Because_of() + { + var sources = new[] + { + new Source + { + Value = 5 + } + }.AsQueryable(); + + _dests = sources.ProjectTo(Configuration).ToArray(); + } + + [Fact] + public void Should_convert_to_string() + { + _dests[0].Value.ShouldBe("5"); + } + } } \ No newline at end of file diff --git a/src/UnitTests/PropertyMapContexts.cs b/src/UnitTests/PropertyMapContexts.cs deleted file mode 100644 index 4be13042d4..0000000000 --- a/src/UnitTests/PropertyMapContexts.cs +++ /dev/null @@ -1,74 +0,0 @@ -//using System; -//using Xunit; -//using Should; - -//namespace AutoMapper.UnitTests -//{ -// public class CustomValueResolverIsNotSuppliedWithContextPropertyMap -// { - -// public class Source -// { -// public string CodeValue1 { get; set; } -// public string CodeValue2 { get; set; } -// } - - -// public class DestinationDto -// { -// public CodeValueDto CodeValue1 { get; set; } -// public CodeValueDto CodeValue2 { get; set; } -// } - - -// public class CodeValueDto -// { -// public string Code { get; set; } -// public string Title { get; set; } -// public string Type { get; set; } -// } - - -// public class CodeValueDtoResolver : IValueResolver -// { -// public object Resolve(object source, ResolutionContext context) -// { -// var propertyMap = context.PropertyMap; - -// propertyMap.ShouldNotBeNull(); - -// var codeValueTypeId = propertyMap.SourceMember.DeclaringType.Name + ":" + propertyMap.SourceMember.Name; -// return LookupCodeValue(codeValueTypeId, "" + source); -// } - -// private CodeValueDto LookupCodeValue(string codeValueTypeId, string code) -// { -// switch (codeValueTypeId + "==" + code) -// { -// case "Source:CodeValue1==Value1": -// return new CodeValueDto { Code = "" + code, Title = "lookup value for Value1==1" }; -// case "Source:CodeValue2==Value1": -// return new CodeValueDto { Code = "" + code, Title = "lookup value for Value2==1" }; -// default: -// throw new InvalidOperationException(); -// } -// } -// } - - -// [Fact] -// public void CustomValueResolver_Should_Be_Supplied_With_Current_PropertyMap() -// { -// var config = new MapperConfiguration(cfg => cfg.CreateMap() -// .ForMember(x => x.CodeValue1, o => o.ResolveUsing().FromMember(y => y.CodeValue1)) -// .ForMember(x => x.CodeValue2, o => o.ResolveUsing().FromMember(y => y.CodeValue2))); - -// var src = new Source { CodeValue1 = "Value1", CodeValue2 = "Value1" }; - -// var dest = config.CreateMapper().Map(src); - -// dest.CodeValue1.Title.ShouldEqual("lookup value for Value1==1"); -// dest.CodeValue2.Title.ShouldEqual("lookup value for Value2==1"); -// } -// } -//} \ No newline at end of file diff --git a/src/UnitTests/Query/SourceInjectedQuery.cs b/src/UnitTests/Query/SourceInjectedQuery.cs deleted file mode 100644 index df2eae6d3c..0000000000 --- a/src/UnitTests/Query/SourceInjectedQuery.cs +++ /dev/null @@ -1,294 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using Should; -using AutoMapper.QueryableExtensions; -using Xunit; - -namespace AutoMapper.UnitTests.Query -{ - public class SourceInjectedQuery : AutoMapperSpecBase - { - readonly Source[] _source = new[] - { - new Source {SrcValue = 5}, - new Source {SrcValue = 4}, - new Source {SrcValue = 7} - }; - - public class Source - { - public int SrcValue { get; set; } - public string StringValue { get; set; } - public string[] Strings { get; set; } = new string[0]; - } - - public class Destination - { - public int DestValue { get; set; } - public string StringValue { get; set; } - public string[] Strings { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(s => s.SrcValue, opt => opt.MapFrom(d => d.DestValue)) - .ReverseMap() - .ForMember(d => d.DestValue, opt => opt.MapFrom(s => s.SrcValue)); - }); - - [Fact] - public void Shoud_support_const_result() - { - IQueryable result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .Where(s => s.DestValue > 6); - - result.Count().ShouldEqual(1); - result.Any(s => s.DestValue > 6).ShouldBeTrue(); - } - - [Fact] - public void Shoud_use_destination_elementType() - { - IQueryable result = _source.AsQueryable() - .UseAsDataSource(Mapper).For(); - - result.ElementType.ShouldEqual(typeof(Destination)); - - result = result.Where(s => s.DestValue > 3); - result.ElementType.ShouldEqual(typeof(Destination)); - } - - [Fact] - public void Shoud_support_single_item_result() - { - IQueryable result = _source.AsQueryable() - .UseAsDataSource(Mapper).For(); - - result.First(s => s.DestValue > 6).ShouldBeType(); - } - - [Fact] - public void Shoud_support_IEnumerable_result() - { - IQueryable result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .Where(s => s.DestValue > 6); - - List list = result.ToList(); - } - - [Fact] - public void Shoud_convert_source_item_to_destination() - { - IQueryable result = _source.AsQueryable() - .UseAsDataSource(Mapper).For(); - - var destItem = result.First(s => s.DestValue == 7); - var sourceItem = _source.First(s => s.SrcValue == 7); - - destItem.DestValue.ShouldEqual(sourceItem.SrcValue); - } - - [Fact] - public void Shoud_support_order_by_statement_result() - { - IQueryable result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .OrderByDescending(s => s.DestValue); - - result.First().DestValue.ShouldEqual(_source.Max(s => s.SrcValue)); - } - - [Fact] - public void Shoud_support_any_stupid_thing_you_can_throw_at_it() - { - var result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .Where(s => true && 5.ToString() == "5" && s.DestValue.ToString() != "0") - .OrderBy(s => s.DestValue).SkipWhile(d => d.DestValue < 7).Take(1) - .OrderByDescending(s => s.DestValue).Select(s => s.DestValue); - - result.First().ShouldEqual(_source.Max(s => s.SrcValue)); - } - - [Fact] - public void Shoud_support_string_return_type() - { - var result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .Where(s => true && 5.ToString() == "5" && s.DestValue.ToString() != "0") - .OrderBy(s => s.DestValue).SkipWhile(d => d.DestValue < 7).Take(1) - .OrderByDescending(s => s.DestValue).Select(s => s.StringValue); - - result.First().ShouldEqual(null); - } - [Fact] - public void Shoud_support_enumerable_return_type() - { - var result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .Where(s => true && 5.ToString() == "5" && s.DestValue.ToString() != "0") - .OrderBy(s => s.DestValue).SkipWhile(d => d.DestValue < 7).Take(1) - .OrderByDescending(s => s.DestValue).Select(s => s.Strings); - - result.First().Count().ShouldEqual(0); - } - - [Fact] - public void Shoud_support_any_stupid_thing_you_can_throw_at_it_with_annonumus_types() - { - var result = _source.AsQueryable() - .UseAsDataSource(Mapper).For() - .Where(s => true && 5.ToString() == "5" && s.DestValue.ToString() != "0") - .OrderBy(s => s.DestValue).SkipWhile(d => d.DestValue < 7).Take(1) - .OrderByDescending(s => s.DestValue).Select(s => new { A = s.DestValue }); - - result.First().A.ShouldEqual(_source.Max(s => s.SrcValue)); - } - readonly User[] _source2 = new[] - { - new User { UserId = 2, Account = new Account(){ Id = 4,Things = {new Thing(){Bar = "Bar"}, new Thing(){ Bar ="Bar 2"}}}}, - new User { UserId = 1, Account = new Account(){ Id = 3,Things = {new Thing(){Bar = "Bar 3"}, new Thing(){ Bar ="Bar 4"}}}}, - }; - - private static IMapper _mapper; - - [Fact] - public void Map_select_method() - { - SetupAutoMapper(); - var result = _source2.AsQueryable() - .UseAsDataSource(_mapper).For().OrderBy(s => s.Id).ThenBy(s => s.FullName).Select(s => (object)s.AccountModel.ThingModels.Select(b => b.BarModel)); - - (result.First() as IEnumerable).Last().ShouldEqual("Bar 4"); - } - - [Fact] - public void Map_orderBy_thenBy_expression() - { - SetupAutoMapper(); - var result = _source2.AsQueryable() - .UseAsDataSource(_mapper).For().Select(s => (object)s.AccountModel.ThingModels); - - (result.First() as IEnumerable).Last().Bar.ShouldEqual("Bar 2"); - } - - private static void SetupAutoMapper() - { - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Id, opt => opt.MapFrom(s => s.UserId)) - .ForMember(d => d.FullName, opt => opt.MapFrom(s => s.Name)) - .ForMember(d => d.LoggedOn, opt => opt.MapFrom(s => s.IsLoggedOn ? "Y" : "N")) - .ForMember(d => d.IsOverEighty, opt => opt.MapFrom(s => s.Age > 80)) - .ForMember(d => d.AccountName, opt => opt.MapFrom(s => s.Account == null ? string.Empty : string.Concat(s.Account.FirstName, " ", s.Account.LastName))) - .ForMember(d => d.AgeInYears, opt => opt.MapFrom(s => s.Age)) - .ForMember(d => d.IsActive, opt => opt.MapFrom(s => s.Active)) - .ForMember(d => d.AccountModel, opt => opt.MapFrom(s => s.Account)); - - cfg.CreateMap() - .ForMember(d => d.UserId, opt => opt.MapFrom(s => s.Id)) - .ForMember(d => d.Name, opt => opt.MapFrom(s => s.FullName)) - .ForMember(d => d.IsLoggedOn, opt => opt.MapFrom(s => s.LoggedOn.ToUpper() == "Y")) - .ForMember(d => d.Age, opt => opt.MapFrom(s => s.AgeInYears)) - .ForMember(d => d.Active, opt => opt.MapFrom(s => s.IsActive)) - .ForMember(d => d.Account, opt => opt.MapFrom(s => s.AccountModel)); - - cfg.CreateMap() - .ForMember(d => d.Bal, opt => opt.MapFrom(s => s.Balance)) - .ForMember(d => d.DateCreated, opt => opt.MapFrom(s => s.CreateDate)) - .ForMember(d => d.ComboName, opt => opt.MapFrom(s => string.Concat(s.FirstName, " ", s.LastName))) - .ForMember(d => d.ThingModels, opt => opt.MapFrom(s => s.Things)); - - cfg.CreateMap() - .ForMember(d => d.Balance, opt => opt.MapFrom(s => s.Bal)) - .ForMember(d => d.Things, opt => opt.MapFrom(s => s.ThingModels)); - - cfg.CreateMap() - .ForMember(d => d.FooModel, opt => opt.MapFrom(s => s.Foo)) - .ForMember(d => d.BarModel, opt => opt.MapFrom(s => s.Bar)); - - cfg.CreateMap() - .ForMember(d => d.Foo, opt => opt.MapFrom(s => s.FooModel)) - .ForMember(d => d.Bar, opt => opt.MapFrom(s => s.BarModel)); - }); - - - _mapper = config.CreateMapper(); - - //Mapper.CreateMap, IEnumerable>(); - //Mapper.CreateMap, IEnumerable>(); - //Mapper.CreateMap, IEnumerable>(); - //Mapper.CreateMap, IEnumerable>(); - } - - } - - public class Account - { - public Account() - { - Things = new List(); - } - public int Id { get; set; } - public double Balance { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public DateTime CreateDate { get; set; } - public ICollection Things { get; set; } - } - - public class AccountModel - { - public AccountModel() - { - ThingModels = new List(); - } - public int Id { get; set; } - public double Bal { get; set; } - public string ComboName { get; set; } - public DateTime DateCreated { get; set; } - public ICollection ThingModels { get; set; } - } - - public class Thing - { - public int Foo { get; set; } - public string Bar { get; set; } - } - - public class ThingModel - { - public int FooModel { get; set; } - public string BarModel { get; set; } - } - - public class User - { - public int UserId { get; set; } - public string Name { get; set; } - public bool IsLoggedOn { get; set; } - public int Age { get; set; } - public bool Active { get; set; } - public Account Account { get; set; } - } - - public class UserModel - { - public int Id { get; set; } - public string FullName { get; set; } - public string AccountName { get; set; } - public bool IsOverEighty { get; set; } - public string LoggedOn { get; set; } - public int AgeInYears { get; set; } - public bool IsActive { get; set; } - public AccountModel AccountModel { get; set; } - } -} - - diff --git a/src/UnitTests/Regression.cs b/src/UnitTests/Regression.cs index a0aa22f511..e09c32b316 100644 --- a/src/UnitTests/Regression.cs +++ b/src/UnitTests/Regression.cs @@ -1,153 +1,153 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Should; -using Xunit; -using System.Linq; - -namespace AutoMapper.UnitTests -{ - namespace Regression - { - public class TestDomainItem : ITestDomainItem - { - public Guid ItemId { get; set; } - } - - public interface ITestDomainItem - { - Guid ItemId { get; } - } - - public class TestDtoItem - { - public Guid Id { get; set; } - } - public class automapper_fails_to_map_custom_mappings_when_mapping_collections_for_an_interface : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Id, s => s.MapFrom(x => x.ItemId)); - }); - - - [Fact] - public void should_map_the_id_property() - { - var domainItems = new List - { - new TestDomainItem {ItemId = Guid.NewGuid()}, - new TestDomainItem {ItemId = Guid.NewGuid()} - }; - - var dtos = Mapper.Map, TestDtoItem[]>(domainItems); - - domainItems[0].ItemId.ShouldEqual(dtos[0].Id); - } - } - - public class Chris_bennages_nullable_datetime_issue : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public DateTime? SomeDate { get; set; } - } - - public class Destination - { - public MyCustomDate SomeDate { get; set; } - } - - public class MyCustomDate - { - public int Day { get; set; } - public int Month { get; set; } - public int Year { get; set; } - - public MyCustomDate(int day, int month, int year) - { - Day = day; - Month = month; - Year = year; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - cfg.CreateMap() - .ConvertUsing( - src => src.HasValue ? new MyCustomDate(src.Value.Day, src.Value.Month, src.Value.Year) : null); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source { SomeDate = new DateTime(2005, 12, 1) }); - } - - [Fact] - public void Should_map_a_date_with_a_value() - { - _result.SomeDate.Day.ShouldEqual(1); - } - - [Fact] - public void Should_map_null_to_null() - { - var destination = Mapper.Map(new Source()); - destination.SomeDate.ShouldBeNull(); - } - } - - public class TestEnumerable : AutoMapperSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - - [Fact] - public void MapsEnumerableTypes() - { - Person[] personArr = new[] {new Person() {Name = "Name"}}; - People people = new People(personArr); - - var pmc = Mapper.Map>(people); - - pmc.ShouldNotBeNull(); - (pmc.Count == 1).ShouldBeTrue(); - } - - public class People : IEnumerable - { - private readonly Person[] people; - public People(Person[] people) - { - this.people = people; - } - public IEnumerator GetEnumerator() - { - foreach (var person in people) - { - yield return person; - } - } - } - - public class Person - { - public string Name { get; set; } - } - - public class PersonModel - { - public string Name { get; set; } - } - } - - } +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Shouldly; +using Xunit; +using System.Linq; + +namespace AutoMapper.UnitTests +{ + namespace Regression + { + public class TestDomainItem : ITestDomainItem + { + public Guid ItemId { get; set; } + } + + public interface ITestDomainItem + { + Guid ItemId { get; } + } + + public class TestDtoItem + { + public Guid Id { get; set; } + } + public class automapper_fails_to_map_custom_mappings_when_mapping_collections_for_an_interface : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Id, s => s.MapFrom(x => x.ItemId)); + }); + + + [Fact] + public void should_map_the_id_property() + { + var domainItems = new List + { + new TestDomainItem {ItemId = Guid.NewGuid()}, + new TestDomainItem {ItemId = Guid.NewGuid()} + }; + + var dtos = Mapper.Map, TestDtoItem[]>(domainItems); + + domainItems[0].ItemId.ShouldBe(dtos[0].Id); + } + } + + public class Chris_bennages_nullable_datetime_issue : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public DateTime? SomeDate { get; set; } + } + + public class Destination + { + public MyCustomDate SomeDate { get; set; } + } + + public class MyCustomDate + { + public int Day { get; set; } + public int Month { get; set; } + public int Year { get; set; } + + public MyCustomDate(int day, int month, int year) + { + Day = day; + Month = month; + Year = year; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap() + .ConvertUsing( + src => src.HasValue ? new MyCustomDate(src.Value.Day, src.Value.Month, src.Value.Year) : null); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source { SomeDate = new DateTime(2005, 12, 1) }); + } + + [Fact] + public void Should_map_a_date_with_a_value() + { + _result.SomeDate.Day.ShouldBe(1); + } + + [Fact] + public void Should_map_null_to_null() + { + var destination = Mapper.Map(new Source()); + destination.SomeDate.ShouldBeNull(); + } + } + + public class TestEnumerable : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + + [Fact] + public void MapsEnumerableTypes() + { + Person[] personArr = new[] {new Person() {Name = "Name"}}; + People people = new People(personArr); + + var pmc = Mapper.Map>(people); + + pmc.ShouldNotBeNull(); + (pmc.Count == 1).ShouldBeTrue(); + } + + public class People : IEnumerable + { + private readonly Person[] people; + public People(Person[] people) + { + this.people = people; + } + public IEnumerator GetEnumerator() + { + foreach (var person in people) + { + yield return person; + } + } + } + + public class Person + { + public string Name { get; set; } + } + + public class PersonModel + { + public string Name { get; set; } + } + } + + } } \ No newline at end of file diff --git a/src/UnitTests/ReverseMapWithPreserveReferences.cs b/src/UnitTests/ReverseMapWithPreserveReferences.cs new file mode 100644 index 0000000000..3f290ca228 --- /dev/null +++ b/src/UnitTests/ReverseMapWithPreserveReferences.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class ReverseMapWithPreserveReferences : AutoMapperSpecBase + { + UserDto _destination; + + public class UserModel + { + public virtual CategoryModel Category { get; set; } + public virtual UserGroupModel Group { get; set; } + } + + public class CategoryModel + { + public CategoryModel Category { get; set; } + } + + public class UserGroupModel + { + public UserGroupModel() + { + Users = new List(); + } + + public virtual ICollection Users { get; set; } + } + + public class UserDto + { + public virtual CategoryDto Category { get; set; } + public virtual UserGroupDto Group { get; set; } + } + + public class CategoryDto + { + public CategoryDto Category { get; set; } + } + + public class UserGroupDto + { + public UserGroupDto() + { + Users = new List(); + } + + public virtual ICollection Users { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Destination).PreserveReferences().ReverseMap(); + cfg.CreateMap(MemberList.Destination).PreserveReferences().ReverseMap(); + cfg.CreateMap(MemberList.Destination).PreserveReferences().ReverseMap(); + }); + + protected override void Because_of() + { + var categoryModel = new CategoryModel(); + categoryModel.Category = categoryModel; + + var userModel = new UserModel(); + var userGroupModel = new UserGroupModel(); + + userModel.Category = categoryModel; + userModel.Group = userGroupModel; + userGroupModel.Users.Add(userModel); + + _destination = Mapper.Map(userModel); + } + + [Fact] + public void Should_map_ok() + { + _destination.Group.Users.SequenceEqual(new[] { _destination }).ShouldBeTrue(); + } + } +} diff --git a/src/UnitTests/ReverseMapWithoutPreserveReferences.cs b/src/UnitTests/ReverseMapWithoutPreserveReferences.cs new file mode 100644 index 0000000000..321b4e7c84 --- /dev/null +++ b/src/UnitTests/ReverseMapWithoutPreserveReferences.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class ReverseMapWithoutPreserveReferences : AutoMapperSpecBase + { + UserDto _destination; + + public class UserModel + { + public virtual CategoryModel Category { get; set; } + public virtual UserGroupModel Group { get; set; } + } + + public class CategoryModel + { + public CategoryModel Category { get; set; } + } + + public class UserGroupModel + { + public UserGroupModel() + { + Users = new List(); + } + + public virtual ICollection Users { get; set; } + } + + public class UserDto + { + public virtual CategoryDto Category { get; set; } + public virtual UserGroupDto Group { get; set; } + } + + public class CategoryDto + { + public CategoryDto Category { get; set; } + } + + public class UserGroupDto + { + public UserGroupDto() + { + Users = new List(); + } + + public virtual ICollection Users { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Destination).ReverseMap(); + cfg.CreateMap(MemberList.Destination).ReverseMap(); + cfg.CreateMap(MemberList.Destination).ReverseMap(); + }); + + protected override void Because_of() + { + var categoryModel = new CategoryModel(); + categoryModel.Category = categoryModel; + + var userModel = new UserModel(); + var userGroupModel = new UserGroupModel(); + + userModel.Category = categoryModel; + userModel.Group = userGroupModel; + userGroupModel.Users.Add(userModel); + + _destination = Mapper.Map(userModel); + } + + [Fact] + public void Should_map_ok() + { + _destination.Group.Users.SequenceEqual(new[] { _destination }).ShouldBeTrue(); + } + } +} diff --git a/src/UnitTests/ReverseMapping.cs b/src/UnitTests/ReverseMapping.cs index 50e6ddaa46..fd6f6d8e9f 100644 --- a/src/UnitTests/ReverseMapping.cs +++ b/src/UnitTests/ReverseMapping.cs @@ -1,288 +1,598 @@ -using Xunit; -using Should; -using System.Linq; - -namespace AutoMapper.UnitTests -{ - namespace ReverseMapping - { - using System; - using System.Text.RegularExpressions; - - public class ReverseMapConventions : AutoMapperSpecBase - { - Rotator_Ad_Run _destination; - DateTime _startDate = DateTime.Now, _endDate = DateTime.Now.AddHours(2); - - public class Rotator_Ad_Run - { - public DateTime Start_Date { get; set; } - public DateTime End_Date { get; set; } - public bool Enabled { get; set; } - } - - public class RotatorAdRunViewModel - { - public DateTime StartDate { get; set; } - public DateTime EndDate { get; set; } - public bool Enabled { get; set; } - } - - public class UnderscoreNamingConvention : INamingConvention - { - public Regex SplittingExpression { get; } = new Regex(@"\p{Lu}[a-z0-9]*(?=_?)"); - - public string SeparatorCharacter => "_"; - public string ReplaceValue(Match match) - { - return match.Value; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateProfile("MyMapperProfile", prf => - { - prf.SourceMemberNamingConvention = new UnderscoreNamingConvention(); - prf.CreateMap(); - }); - cfg.CreateProfile("MyMapperProfile2", prf => - { - prf.DestinationMemberNamingConvention = new UnderscoreNamingConvention(); - prf.CreateMap(); - }); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new RotatorAdRunViewModel { Enabled = true, EndDate = _endDate, StartDate = _startDate }); - } - - [Fact] - public void Should_apply_the_convention_in_reverse() - { - _destination.Enabled.ShouldBeTrue(); - _destination.End_Date.ShouldEqual(_endDate); - _destination.Start_Date.ShouldEqual(_startDate); - } - } - - public class When_reverse_mapping_classes_with_simple_properties : AutoMapperSpecBase - { - private Source _source; - - public class Source - { - public int Value { get; set; } - } - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ReverseMap(); - }); - - protected override void Because_of() - { - var dest = new Destination - { - Value = 10 - }; - _source = Mapper.Map(dest); - } - - [Fact] - public void Should_create_a_map_with_the_reverse_items() - { - _source.Value.ShouldEqual(10); - } - } - - public class When_validating_only_against_source_members_and_source_matches : NonValidatingSpecBase - { - public class Source - { - public int Value { get; set; } - } - public class Destination - { - public int Value { get; set; } - public int Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(MemberList.Source); - }); - - [Fact] - public void Should_only_map_source_members() - { - var typeMap = ConfigProvider.FindTypeMapFor(); - - typeMap.GetPropertyMaps().Count().ShouldEqual(1); - } - - [Fact] - public void Should_not_throw_any_configuration_validation_errors() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } - - public class When_validating_only_against_source_members_and_source_does_not_match : NonValidatingSpecBase - { - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - public class Destination - { - public int Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(MemberList.Source); - }); - - [Fact] - public void Should_throw_a_configuration_validation_error() - { - typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } - - public class When_validating_only_against_source_members_and_unmatching_source_members_are_manually_mapped : NonValidatingSpecBase - { - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - public class Destination - { - public int Value { get; set; } - public int Value3 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(MemberList.Source) - .ForMember(dest => dest.Value3, opt => opt.MapFrom(src => src.Value2)); - }); - - [Fact] - public void Should_not_throw_a_configuration_validation_error() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } - - public class When_validating_only_against_source_members_and_unmatching_source_members_are_manually_mapped_with_resolvers : NonValidatingSpecBase - { - public class Source - { - public int Value { get; set; } - public int Value2 { get; set; } - } - public class Destination - { - public int Value { get; set; } - public int Value3 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(MemberList.Source) - .ForMember(dest => dest.Value3, opt => opt.ResolveUsing(src => src.Value2)) - .ForSourceMember(src => src.Value2, opt => opt.Ignore()); - }); - - [Fact] - public void Should_not_throw_a_configuration_validation_error() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); - } - } - - public class When_reverse_mapping_and_ignoring_via_method : NonValidatingSpecBase - { - public class Source - { - public int Value { get; set; } - } - - public class Dest - { - public int Value { get; set; } - public int Ignored { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(d => d.Ignored, opt => opt.Ignore()) - .ReverseMap(); - }); - - [Fact] - public void Should_show_valid() - { - typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid()); - } - } - - public class When_reverse_mapping_and_ignoring : SpecBase - { - public class Foo - { - public string Bar { get; set; } - public string Baz { get; set; } - } - - public class Foo2 - { - public string Bar { get; set; } - public string Boo { get; set; } - } - - [Fact] - public void GetUnmappedPropertyNames_ShouldReturnBoo() - { - //Arrange - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - }); - var typeMap = config.GetAllTypeMaps() - .First(x => x.SourceType == typeof(Foo) && x.DestinationType == typeof(Foo2)); - //Act - var unmappedPropertyNames = typeMap.GetUnmappedPropertyNames(); - //Assert - unmappedPropertyNames[0].ShouldEqual("Boo"); - } - - [Fact] - public void WhenSecondCallTo_GetUnmappedPropertyNames_ShouldReturnBoo() - { - //Arrange - var config = new MapperConfiguration(cfg => - { - cfg.CreateMap().ReverseMap(); - }); - var typeMap = config.GetAllTypeMaps() - .First(x => x.SourceType == typeof(Foo2) && x.DestinationType == typeof(Foo)); - //Act - var unmappedPropertyNames = typeMap.GetUnmappedPropertyNames(); - //Assert - unmappedPropertyNames[0].ShouldEqual("Boo"); - } - } - } +using Xunit; +using Shouldly; +using System.Linq; +using System; +using System.Text.RegularExpressions; +using System.Reflection; + +namespace AutoMapper.UnitTests +{ + public class InvalidReverseMap : NonValidatingSpecBase + { + public class One + { + public string Name { get; set; } + public Three2 Three2 { get; set; } + } + + public class Two + { + public string Name { get; set; } + public Three Three { get; set; } + } + + public class Three + { + } + + public class Three2 + { + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMissingTypeMaps = false; + cfg.CreateMap() + .ForMember(d => d.Name, o => o.MapFrom(s => "name")) + .ForMember(d => d.Three, o => o.MapFrom(s => s.Three2)) + .ReverseMap(); + cfg.CreateMap(); + }); + + [Fact] + public void Should_report_the_error() + { + new Action(() => Configuration.AssertConfigurationIsValid()) + .ShouldThrowException(ex => + { + ex.PropertyMap.DestinationMember.ShouldBe(typeof(Two).GetProperty("Three")); + ex.Types.ShouldBe(new TypePair(typeof(One), typeof(Two))); + }); + } + } + + public class MapFromReverseResolveUsing : AutoMapperSpecBase + { + public class Source + { + public int Total { get; set; } + } + + public class Destination + { + public int Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap() + .ForMember(dest => dest.Total, opt => opt.MapFrom(x => x.Total)) + .ReverseMap() + .ForMember(dest => dest.Total, opt => opt.MapFrom()); + }); + + public class CustomResolver : IValueResolver + { + public int Resolve(Source source, Destination destination, int member, ResolutionContext context) + { + return Int32.MaxValue; + } + } + + [Fact] + public void Should_use_the_resolver() + { + Mapper.Map(new Source()).Total.ShouldBe(int.MaxValue); + } + } + + public class MethodsWithReverse : AutoMapperSpecBase + { + class Order + { + public OrderItem[] OrderItems { get; set; } + } + + class OrderItem + { + public string Product { get; set; } + } + + class OrderDto + { + public int OrderItemsCount { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c=> + { + c.CreateMap().ReverseMap(); + }); + + [Fact] + public void ShouldMapOk() + { + Mapper.Map(new OrderDto()); + } + } + + public class ReverseForPath : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForPath(o => o.CustomerHolder.Customer.Name, o => o.MapFrom(s => s.CustomerName)) + .ForPath(o => o.CustomerHolder.Customer.Total, o => o.MapFrom(s => s.Total)) + .ReverseMap(); + }); + + [Fact] + public void Should_flatten() + { + var model = new Order { + CustomerHolder = new CustomerHolder { + Customer = new Customer { Name = "George Costanza", Total = 74.85m } + } + }; + var dto = Mapper.Map(model); + dto.CustomerName.ShouldBe("George Costanza"); + dto.Total.ShouldBe(74.85m); + } + } + + public class ReverseMapFrom : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder CustomerHolder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + } + + public class OrderDto + { + public string CustomerName { get; set; } + public decimal Total { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.CustomerName, o => o.MapFrom(s => s.CustomerHolder.Customer.Name)) + .ForMember(d => d.Total, o => o.MapFrom(s => s.CustomerHolder.Customer.Total)) + .ReverseMap(); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerName = "George Costanza", Total = 74.85m }; + var model = Mapper.Map(dto); + model.CustomerHolder.Customer.Name.ShouldBe("George Costanza"); + model.CustomerHolder.Customer.Total.ShouldBe(74.85m); + } + } + + public class ReverseDefaultFlatteningWithIgnoreMember : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder Customerholder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + } + + public class OrderDto + { + public string CustomerholderCustomerName { get; set; } + public decimal CustomerholderCustomerTotal { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ReverseMap() + .ForMember(d=>d.Customerholder, o=>o.Ignore()) + .ForPath(d=>d.Customerholder.Customer.Total, o=>o.MapFrom(s=>s.CustomerholderCustomerTotal)); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerholderCustomerName = "George Costanza", CustomerholderCustomerTotal = 74.85m }; + var model = Mapper.Map(dto); + model.Customerholder.Customer.Name.ShouldBeNull(); + model.Customerholder.Customer.Total.ShouldBe(74.85m); + } + } + + public class ReverseDefaultFlattening : AutoMapperSpecBase + { + public class Order + { + public CustomerHolder Customerholder { get; set; } + } + + public class CustomerHolder + { + public Customer Customer { get; set; } + } + + public class Customer + { + public string Name { get; set; } + public decimal Total { get; set; } + } + + public class OrderDto + { + public string CustomerholderCustomerName { get; set; } + public decimal CustomerholderCustomerTotal { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ReverseMap(); + }); + + [Fact] + public void Should_unflatten() + { + var dto = new OrderDto { CustomerholderCustomerName = "George Costanza", CustomerholderCustomerTotal = 74.85m }; + var model = Mapper.Map(dto); + model.Customerholder.Customer.Name.ShouldBe("George Costanza"); + model.Customerholder.Customer.Total.ShouldBe(74.85m); + } + } + + public class ReverseMapConventions : AutoMapperSpecBase + { + Rotator_Ad_Run _destination; + DateTime _startDate = DateTime.Now, _endDate = DateTime.Now.AddHours(2); + + public class Rotator_Ad_Run + { + public DateTime Start_Date { get; set; } + public DateTime End_Date { get; set; } + public bool Enabled { get; set; } + } + + public class RotatorAdRunViewModel + { + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public bool Enabled { get; set; } + } + + public class UnderscoreNamingConvention : INamingConvention + { + public Regex SplittingExpression { get; } = new Regex(@"\p{Lu}[a-z0-9]*(?=_?)"); + + public string SeparatorCharacter => "_"; + public string ReplaceValue(Match match) + { + return match.Value; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateProfile("MyMapperProfile", prf => + { + prf.SourceMemberNamingConvention = new UnderscoreNamingConvention(); + prf.CreateMap(); + }); + cfg.CreateProfile("MyMapperProfile2", prf => + { + prf.DestinationMemberNamingConvention = new UnderscoreNamingConvention(); + prf.CreateMap(); + }); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new RotatorAdRunViewModel { Enabled = true, EndDate = _endDate, StartDate = _startDate }); + } + + [Fact] + public void Should_apply_the_convention_in_reverse() + { + _destination.Enabled.ShouldBeTrue(); + _destination.End_Date.ShouldBe(_endDate); + _destination.Start_Date.ShouldBe(_startDate); + } + } + + public class When_reverse_mapping_classes_with_simple_properties : AutoMapperSpecBase + { + private Source _source; + + public class Source + { + public int Value { get; set; } + } + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ReverseMap(); + }); + + protected override void Because_of() + { + var dest = new Destination + { + Value = 10 + }; + _source = Mapper.Map(dest); + } + + [Fact] + public void Should_create_a_map_with_the_reverse_items() + { + _source.Value.ShouldBe(10); + } + } + + public class When_validating_only_against_source_members_and_source_matches : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + public class Destination + { + public int Value { get; set; } + public int Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source); + }); + + [Fact] + public void Should_only_map_source_members() + { + var typeMap = ConfigProvider.FindTypeMapFor(); + + typeMap.PropertyMaps.Count().ShouldBe(1); + } + + [Fact] + public void Should_not_throw_any_configuration_validation_errors() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_validating_only_against_source_members_and_source_does_not_match : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + public class Destination + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source); + }); + + [Fact] + public void Should_throw_a_configuration_validation_error() + { + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_validating_only_against_source_members_and_unmatching_source_members_are_manually_mapped : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + public class Destination + { + public int Value { get; set; } + public int Value3 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source) + .ForMember(dest => dest.Value3, opt => opt.MapFrom(src => src.Value2)); + }); + + [Fact] + public void Should_not_throw_a_configuration_validation_error() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_validating_only_against_source_members_and_unmatching_source_members_are_manually_mapped_with_resolvers : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + public int Value2 { get; set; } + } + public class Destination + { + public int Value { get; set; } + public int Value3 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(MemberList.Source) + .ForMember(dest => dest.Value3, opt => opt.MapFrom(src => src.Value2)) + .ForSourceMember(src => src.Value2, opt => opt.DoNotValidate()); + }); + + [Fact] + public void Should_not_throw_a_configuration_validation_error() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(Configuration.AssertConfigurationIsValid); + } + } + + public class When_reverse_mapping_and_ignoring_via_method : NonValidatingSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + public int Ignored { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Ignored, opt => opt.Ignore()) + .ReverseMap(); + }); + + [Fact] + public void Should_show_valid() + { + typeof(AutoMapperConfigurationException).ShouldNotBeThrownBy(() => Configuration.AssertConfigurationIsValid()); + } + } + + public class When_reverse_mapping_and_ignoring : SpecBase + { + public class Foo + { + public string Bar { get; set; } + public string Baz { get; set; } + } + + public class Foo2 + { + public string Bar { get; set; } + public string Boo { get; set; } + } + + [Fact] + public void GetUnmappedPropertyNames_ShouldReturnBoo() + { + //Arrange + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + }); + var typeMap = config.GetAllTypeMaps() + .First(x => x.SourceType == typeof(Foo) && x.DestinationType == typeof(Foo2)); + //Act + var unmappedPropertyNames = typeMap.GetUnmappedPropertyNames(); + //Assert + unmappedPropertyNames[0].ShouldBe("Boo"); + } + + [Fact] + public void WhenSecondCallTo_GetUnmappedPropertyNames_ShouldReturnBoo() + { + //Arrange + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap().ReverseMap(); + }); + var typeMap = config.GetAllTypeMaps() + .First(x => x.SourceType == typeof(Foo2) && x.DestinationType == typeof(Foo)); + //Act + var unmappedPropertyNames = typeMap.GetUnmappedPropertyNames(); + //Assert + unmappedPropertyNames[0].ShouldBe("Boo"); + } + } + + public class When_reverse_mapping_open_generics : AutoMapperSpecBase + { + private Source _source; + + public class Source + { + public T Value { get; set; } + } + public class Destination + { + public T Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source<>), typeof(Destination<>)) + .ReverseMap(); + }); + + protected override void Because_of() + { + var dest = new Destination + { + Value = 10 + }; + _source = Mapper.Map, Source>(dest); + } + + [Fact] + public void Should_create_a_map_with_the_reverse_items() + { + _source.Value.ShouldBe(10); + } + } } \ No newline at end of file diff --git a/src/UnitTests/SeparateConfiguration.cs b/src/UnitTests/SeparateConfiguration.cs index c59a5d0970..0dd4d1517c 100644 --- a/src/UnitTests/SeparateConfiguration.cs +++ b/src/UnitTests/SeparateConfiguration.cs @@ -1,7 +1,7 @@ namespace AutoMapper.UnitTests { using Configuration; - using Should; + using Shouldly; using Xunit; public class SeparateConfiguration : NonValidatingSpecBase @@ -33,7 +33,7 @@ public void Should_use_passed_in_configuration() var source = new Source {Value = 5}; var dest = Mapper.Map(source); - dest.Value.ShouldEqual(source.Value); + dest.Value.ShouldBe(source.Value); } } } \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Assertions/Assert.cs b/src/UnitTests/Should/Should.Core/Assertions/Assert.cs deleted file mode 100644 index 95c7286ca0..0000000000 --- a/src/UnitTests/Should/Should.Core/Assertions/Assert.cs +++ /dev/null @@ -1,941 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using Should.Core.Exceptions; - -namespace Should.Core.Assertions -{ - /// - /// Contains various static methods that are used to verify that conditions are met during the - /// process of running tests. - /// - public class Assert - { - /// - /// Used by the Throws and DoesNotThrow methods. - /// - public delegate void ThrowsDelegate(); - - /// - /// Used by the Throws and DoesNotThrow methods. - /// - public delegate object ThrowsDelegateWithReturn(); - - /// - /// Initializes a new instance of the class. - /// - protected Assert() { } - - /// - /// Verifies that a collection contains a given object. - /// - /// The type of the object to be verified - /// The object expected to be in the collection - /// The collection to be inspected - /// Thrown when the object is not present in the collection - public static void Contains(T expected, - IEnumerable collection) - { - Contains(expected, collection, GetEqualityComparer()); - } - - /// - /// Verifies that a collection contains a given object, using an equality comparer. - /// - /// The type of the object to be verified - /// The object expected to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is not present in the collection - public static void Contains(T expected, IEnumerable collection, IEqualityComparer comparer) - { - foreach (T item in collection) - if (comparer.Equals(expected, item)) - return; - - throw new ContainsException(expected); - } - - /// - /// Verifies that a string contains a given sub-string, using the current culture. - /// - /// The sub-string expected to be in the string - /// The string to be inspected - /// Thrown when the sub-string is not present inside the string - public static int Contains(string expectedSubString, - string actualString) - { - return Contains(expectedSubString, actualString, StringComparison.CurrentCulture); - } - - /// - /// Verifies that a string contains a given sub-string, using the given comparison type. - /// - /// The sub-string expected to be in the string - /// The string to be inspected - /// The type of string comparison to perform - /// Thrown when the sub-string is not present inside the string - public static int Contains(string expectedSubString, - string actualString, - StringComparison comparisonType) - { - int indexOf = actualString.IndexOf(expectedSubString, comparisonType); - - if (indexOf < 0) - throw new ContainsException(expectedSubString); - - return indexOf; - } - - /// - /// - /// - /// - /// - /// Thrown when the sub-string is not present at the start of the string - public static void StartsWith(string expectedStartString, string actualString) - { - if (actualString.StartsWith(expectedStartString) == false) - throw new StartsWithException(expectedStartString, actualString); - } - - /// - /// Verifies that a collection does not contain a given object. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// Thrown when the object is present inside the container - public static void DoesNotContain(T expected, - IEnumerable collection) - { - DoesNotContain(expected, collection, GetEqualityComparer()); - } - - /// - /// Verifies that a collection does not contain a given object, using an equality comparer. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is present inside the container - public static void DoesNotContain(T expected, IEnumerable collection, IEqualityComparer comparer) - { - foreach (T item in collection) - if (comparer.Equals(expected, item)) - throw new DoesNotContainException(expected); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The sub-string which is expected not to be in the string - /// The string to be inspected - /// Thrown when the sub-string is present inside the string - public static void DoesNotContain(string expectedSubString, - string actualString) - { - DoesNotContain(expectedSubString, actualString, StringComparison.CurrentCulture); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The sub-string which is expected not to be in the string - /// The string to be inspected - /// The type of string comparison to perform - /// Thrown when the sub-string is present inside the given string - public static void DoesNotContain(string expectedSubString, - string actualString, - StringComparison comparisonType) - { - if (actualString.IndexOf(expectedSubString, comparisonType) >= 0) - throw new DoesNotContainException(expectedSubString); - } - - ///// - ///// Verifies that a block of code does not throw any exceptions. - ///// - ///// A delegate to the code to be tested - //public static void DoesNotThrow(ThrowsDelegate testCode) - //{ - // Exception ex = Record.Exception(testCode); - - // if (ex != null) - // throw new DoesNotThrowException(ex); - //} - - /// - /// Verifies that a collection is empty. - /// - /// The collection to be inspected - /// Thrown when the collection is null - /// Thrown when the collection is not empty - public static void Empty(IEnumerable collection) - { - if (collection == null) throw new ArgumentNullException("collection", "cannot be null"); - -#pragma warning disable 168 - foreach (object @object in collection) - throw new EmptyException(); -#pragma warning restore 168 - } - - /// - /// Verifies that two objects are equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual) - { - Equal(expected, actual, GetEqualityComparer()); - } - - /// - /// Verifies that two objects are equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The user message to be shown on failure - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual, - string userMessage) - { - Equal(expected, actual, GetEqualityComparer(), userMessage); - } - - /// - /// Verifies that two objects are equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The comparer used to compare the two objects - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual, - IEqualityComparer comparer) - { - if (!comparer.Equals(expected, actual)) - throw new EqualException(expected, actual); - } - - /// - /// Verifies that two objects are equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The comparer used to compare the two objects - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual, - IEqualityComparer comparer, - string userMessage) - { - if (!comparer.Equals(expected, actual)) - throw new EqualException(expected, actual, userMessage); - } - - /// - /// Verifies that two doubles are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - public static void Equal(double expected, double actual, double tolerance) - { - var difference = Math.Abs(actual - expected); - if (difference > tolerance) - throw new EqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two doubles are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - /// The user message to be shown on failure - public static void Equal(double expected, double actual, double tolerance, string userMessage) - { - var difference = Math.Abs(actual - expected); - if (difference > tolerance) - throw new EqualException(expected + " +/- " + tolerance, actual, userMessage); - } - - /// - /// Verifies that two values are not equal, using a default comparer. - /// - /// The expected value - /// The actual value - /// The +/- value for where the expected and actual are considered to be equal - /// Thrown when the objects are equal - public static void NotEqual(double expected, double actual, double tolerance) - { - var difference = Math.Abs(actual - expected); - if (difference <= tolerance) - throw new NotEqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two values are not equal, using a default comparer. - /// - /// The expected value - /// The actual value - /// The +/- value for where the expected and actual are considered to be equal - /// The user message to be shown on failure - /// Thrown when the objects are equal - public static void NotEqual(double expected, double actual, double tolerance, string userMessage) - { - var difference = Math.Abs(actual - expected); - if (difference <= tolerance) - throw new NotEqualException(expected + " +/- " + tolerance, actual, userMessage); - } - - /// - /// Verifies that two dates are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - public static void Equal(DateTime expected, DateTime actual, TimeSpan tolerance) - { - var difference = Math.Abs((actual - expected).Ticks); - if (difference > tolerance.Ticks) - throw new EqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two dates are not equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - public static void NotEqual(DateTime expected, DateTime actual, TimeSpan tolerance) - { - var difference = Math.Abs((actual - expected).Ticks); - if (difference <= tolerance.Ticks) - throw new NotEqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two dates are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The level of precision to use when making the comparison - public static void Equal(DateTime expected, DateTime actual, DatePrecision precision) - { - if (precision.Truncate(expected) != precision.Truncate(actual)) - throw new EqualException(precision.Truncate(actual), precision.Truncate(actual)); - } - - /// - /// Verifies that two doubles are not equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The level of precision to use when making the comparison - public static void NotEqual(DateTime expected, DateTime actual, DatePrecision precision) - { - if (precision.Truncate(expected) == precision.Truncate(actual)) - throw new NotEqualException(precision.Truncate(actual), precision.Truncate(actual)); - } - - /// Do not call this method. - [Obsolete("This is an override of Object.Equals(). Call Assert.Equal() instead.", true)] - public new static bool Equals(object a, - object b) - { - throw new InvalidOperationException("Assert.Equals should not be used"); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// Thrown if the condition is not false - public static void False(bool condition) - { - False(condition, null); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// The message to show when the condition is not false - /// Thrown if the condition is not false - public static void False(bool condition, - string userMessage) - { - if (condition) - throw new FalseException(userMessage); - } - - static IEqualityComparer GetEqualityComparer() - { - return new AssertEqualityComparer(); - } - - static IComparer GetComparer() - { - return new AssertComparer(); - } - - /// Verifies that an object is greater than the exclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive minimum value of paramref name="value"/>. - public static void GreaterThan(T left, T right) - { - GreaterThan(left, right, GetComparer()); - } - - /// Verifies that an object is greater than the exclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive minimum value of paramref name="value"/>. - /// An used to compare the objects. - public static void GreaterThan(T left, T right, IComparer comparer) - { - if (comparer.Compare(left, right) <= 0) - throw new GreaterThanException(left, right); - } - - /// Verifies that an object is greater than the inclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive minimum value of paramref name="value"/>. - public static void GreaterThanOrEqual(T left, T right) - { - GreaterThanOrEqual(left, right, GetComparer()); - } - - /// Verifies that an object is greater than the inclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive minimum value of paramref name="value"/>. - /// An used to compare the objects. - public static void GreaterThanOrEqual(T left, T right, IComparer comparer) - { - if (comparer.Compare(left, right) < 0) - throw new GreaterThanOrEqualException(left, right); - } - - /// - /// Verifies that a value is within a given range. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is not in the given range - public static void InRange(T actual, - T low, - T high) - { - InRange(actual, low, high, GetComparer()); - } - - /// - /// Verifies that a value is within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is not in the given range - public static void InRange(T actual, - T low, - T high, - IComparer comparer) - { - if (comparer.Compare(low, actual) > 0 || comparer.Compare(actual, high) > 0) - throw new InRangeException(actual, low, high); - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T IsAssignableFrom(object @object) - { - IsAssignableFrom(typeof(T), @object); - return (T)@object; - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The object to be evaluated - /// Thrown when the object is not the given type - public static void IsAssignableFrom(Type expectedType, object @object) - { - if (@object == null || !expectedType.IsAssignableFrom(@object.GetType())) - throw new IsAssignableFromException(expectedType, @object); - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The object to be evaluated - /// The user message to show on failure - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T IsAssignableFrom(object @object, string userMessage) - { - IsAssignableFrom(typeof(T), @object, userMessage); - return (T)@object; - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The user message to show on failure - /// The object to be evaluated - /// Thrown when the object is not the given type - public static void IsAssignableFrom(Type expectedType, object @object, string userMessage) - { - if (@object == null || !expectedType.IsAssignableFrom(@object.GetType())) - throw new IsAssignableFromException(expectedType, @object, userMessage); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public static void IsNotType(object @object) - { - IsNotType(typeof(T), @object); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public static void IsNotType(Type expectedType, - object @object) - { - if (expectedType.Equals(@object.GetType())) - throw new IsNotTypeException(expectedType, @object); - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T IsType(object @object) - { - IsType(typeof(T), @object); - return (T)@object; - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// Thrown when the object is not the given type - public static void IsType(Type expectedType, - object @object) - { - if (@object == null || !expectedType.Equals(@object.GetType())) - throw new IsTypeException(expectedType, @object); - } - - /// Verifies that an object is less than the exclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive maximum value of paramref name="value"/>. - public static void LessThan(T left, T right) - { - LessThan(left, right, GetComparer()); - } - - /// Verifies that an object is less than the exclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive maximum value of paramref name="value"/>. - /// An used to compare the objects. - public static void LessThan(T left, T right, IComparer comparer) - { - if (comparer.Compare(left, right) >= 0) - throw new LessThanException(left, right); - } - - /// Verifies that an object is less than the inclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive maximum value of paramref name="value"/>. - public static void LessThanOrEqual(T left, T right) - { - LessThanOrEqual(left, right, GetComparer()); - } - - /// Verifies that an object is less than the inclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive maximum value of paramref name="value"/>. - /// An used to compare the objects. - public static void LessThanOrEqual(T left, T right, IComparer comparer) - { - if (comparer.Compare(left, right) > 0) - throw new LessThanOrEqualException(left, right); - } - - /// - /// Verifies that a collection is not empty. - /// - /// The collection to be inspected - /// Thrown when a null collection is passed - /// Thrown when the collection is empty - public static void NotEmpty(IEnumerable collection) - { - if (collection == null) throw new ArgumentNullException("collection", "cannot be null"); - -#pragma warning disable 168 - foreach (object @object in collection) - return; -#pragma warning restore 168 - - throw new NotEmptyException(); - } - - /// - /// Verifies that two objects are not equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected object - /// The actual object - /// Thrown when the objects are equal - public static void NotEqual(T expected, - T actual) - { - NotEqual(expected, actual, GetEqualityComparer()); - } - - /// - /// Verifies that two objects are not equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected object - /// The actual object - /// The comparer used to examine the objects - /// Thrown when the objects are equal - public static void NotEqual(T expected, - T actual, - IEqualityComparer comparer) - { - if (comparer.Equals(expected, actual)) - throw new NotEqualException(expected, actual); - } - - /// - /// Verifies that a value is not within a given range, using the default comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is in the given range - public static void NotInRange(T actual, - T low, - T high) - { - NotInRange(actual, low, high, GetComparer()); - } - - /// - /// Verifies that a value is not within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is in the given range - public static void NotInRange(T actual, - T low, - T high, - IComparer comparer) - { - if (comparer.Compare(low, actual) <= 0 && comparer.Compare(actual, high) <= 0) - throw new NotInRangeException(actual, low, high); - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// Thrown when the object is not null - public static void NotNull(object @object) - { - if (@object == null) - throw new NotNullException(); - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// Thrown when the object is not null - public static void NotNull(object @object, string message) - { - if (@object == null) - throw new NotNullException(message); - } - - /// - /// Verifies that two objects are not the same instance. - /// - /// The expected object instance - /// The actual object instance - /// Thrown when the objects are the same instance - public static void NotSame(object expected, - object actual) - { - if (object.ReferenceEquals(expected, actual)) - throw new NotSameException(); - } - - /// - /// Verifies that an object reference is null. - /// - /// The object to be inspected - /// Thrown when the object reference is not null - public static void Null(object @object) - { - if (@object != null) - throw new NullException(@object); - } - - /// - /// Verifies that two objects are the same instance. - /// - /// The expected object instance - /// The actual object instance - /// Thrown when the objects are not the same instance - public static void Same(object expected, - object actual) - { - if (!object.ReferenceEquals(expected, actual)) - throw new SameException(expected, actual); - } - - /// - /// Verifies that the given collection contains only a single - /// element of the given type. - /// - /// The collection. - /// The single item in the collection. - /// Thrown when the collection does not contain - /// exactly one element. - public static object Single(IEnumerable collection) - { - if (collection == null) - throw new ArgumentNullException("collection"); - - int count = 0; - object result = null; - - foreach (object item in collection) - { - result = item; - ++count; - } - - if (count != 1) - throw new SingleException(count); - - return result; - } - - /// - /// Verifies that the given collection contains only a single - /// element of the given type. - /// - /// The collection type. - /// The collection. - /// The single item in the collection. - /// Thrown when the collection does not contain - /// exactly one element. - public static T Single(IEnumerable collection) - { - if (collection == null) - throw new ArgumentNullException("collection"); - - int count = 0; - T result = default(T); - - foreach (T item in collection) - { - result = item; - ++count; - } - - if (count != 1) - throw new SingleException(count); - - return result; - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(ThrowsDelegate testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// The message to be shown if the test fails - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(string userMessage, - ThrowsDelegate testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// Generally used to test property accessors. - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(ThrowsDelegateWithReturn testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// Generally used to test property accessors. - /// - /// The type of the exception expected to be thrown - /// The message to be shown if the test fails - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(string userMessage, - ThrowsDelegateWithReturn testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static Exception Throws(Type exceptionType, - ThrowsDelegate testCode) - { - Exception exception = Record.Exception(testCode); - - if (exception == null) - throw new ThrowsException(exceptionType); - - if (!exceptionType.Equals(exception.GetType())) - throw new ThrowsException(exceptionType, exception); - - return exception; - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// Generally used to test property accessors. - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static Exception Throws(Type exceptionType, - ThrowsDelegateWithReturn testCode) - { - Exception exception = Record.Exception(testCode); - - if (exception == null) - throw new ThrowsException(exceptionType); - - if (!exceptionType.Equals(exception.GetType())) - throw new ThrowsException(exceptionType, exception); - - return exception; - } - - /// - /// Verifies that a block of code does not throw any exceptions. - /// - /// A delegate to the code to be tested - public static void DoesNotThrow(ThrowsDelegate testCode) - { - Exception ex = Record.Exception(testCode); - - if (ex != null) - throw new DoesNotThrowException(ex); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// Thrown when the condition is false - public static void True(bool condition) - { - True(condition, null); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// The message to be shown when the condition is false - /// Thrown when the condition is false - public static void True(bool condition, - string userMessage) - { - if (!condition) - throw new TrueException(userMessage); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Assertions/AssertComparer.cs b/src/UnitTests/Should/Should.Core/Assertions/AssertComparer.cs deleted file mode 100644 index 8da45035f6..0000000000 --- a/src/UnitTests/Should/Should.Core/Assertions/AssertComparer.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace Should.Core.Assertions -{ - using AutoMapper; - - internal class AssertComparer : IComparer - { - public int Compare(T x, T y) - { - Type type = typeof(T); - - // Null? - if (!type.IsValueType() || (type.IsGenericType() && type.GetGenericTypeDefinition().IsAssignableFrom(typeof(Nullable<>)))) - { - if (Equals(x, default(T))) - { - return Equals(y, default(T)) ? 0 : 1; - } - - if (Equals(y, default(T))) - return -1; - } - - var xIsAssignableFromY = x.GetType().IsAssignableFrom(y.GetType()); - var yIsAssignableFromX = y.GetType().IsAssignableFrom(x.GetType()); - - if (!xIsAssignableFromY && !yIsAssignableFromX) - throw new InvalidOperationException(string.Format("Cannot compare objects of type {0} and {1} because neither is assignable from the other.", x.GetType().Name, y.GetType().Name)); - - // x Implements IComparable? - IComparable comparable1 = x as IComparable; - - if (comparable1 != null && xIsAssignableFromY) - return comparable1.CompareTo(y); - - // y Implements IComparable? - IComparable comparable2 = y as IComparable; - - if (comparable2 != null && yIsAssignableFromX) - return comparable2.CompareTo(x) * -1; - - // x Implements IComparable? - IComparable comparable3 = x as IComparable; - - if (comparable3 != null && xIsAssignableFromY) - return comparable3.CompareTo(y); - - // y Implements IComparable? - IComparable comparable4 = y as IComparable; - - if (comparable4 != null && yIsAssignableFromX) - return comparable4.CompareTo(x) *-1; - - if (new AssertEqualityComparer().Equals(x, y)) - { - return 0; - } - - if (xIsAssignableFromY) - { - var result = CompareUsingOperators(x, y, x.GetType()); - if (result.HasValue) - { - return result.Value; - } - } - - if (yIsAssignableFromX) - { - var result = CompareUsingOperators(x, y, y.GetType()); - if (result.HasValue) - { - return result.Value; - } - } - - throw new InvalidOperationException(string.Format("Cannot compare objects of type {0} and {1} because neither implements IComparable or IComparable nor overloads comparison operators.", x.GetType().Name, y.GetType().Name)); - } - - //Note: Handles edge case of a class where operators are overloaded but niether IComparable or IComparable are implemented - private int? CompareUsingOperators(T x, T y, Type type) - { - var greaterThan = type.GetMethod("op_GreaterThan"); - if (greaterThan != null) - { - var lessThan = type.GetMethod("op_LessThan"); - return (bool)greaterThan.Invoke(null, new object[] { x, y }) - ? 1 - : (bool)lessThan.Invoke(null, new object[] { x, y }) ? -1 : 0; - } - var greaterThanOrEqual = type.GetMethod("op_GreaterThanOrEqual"); - if (greaterThanOrEqual != null) - { - var lessThanOrEqual = type.GetMethod("op_LessThanOrEqual"); - return (bool)greaterThanOrEqual.Invoke(null, new object[] { x, y }) - ? (bool)lessThanOrEqual.Invoke(null, new object[] { x, y }) ? 0 : 1 - : -1; - } - return null; - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Assertions/AssertEqualityComparer.cs b/src/UnitTests/Should/Should.Core/Assertions/AssertEqualityComparer.cs deleted file mode 100644 index 35e327a884..0000000000 --- a/src/UnitTests/Should/Should.Core/Assertions/AssertEqualityComparer.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -namespace Should.Core.Assertions -{ - using AutoMapper; - - internal class AssertEqualityComparer : IEqualityComparer - { - public bool Equals(T x, T y) - { - Type type = typeof(T); - - // Null? - if (!type.IsValueType() || (type.IsGenericType() && type.GetGenericTypeDefinition().IsAssignableFrom(typeof(Nullable<>)))) - { - if (Object.Equals(x, default(T))) - return Object.Equals(y, default(T)); - - if (Object.Equals(y, default(T))) - return false; - } - - //x implements IEquitable and is assignable from y? - var xIsAssignableFromY = x.GetType().IsAssignableFrom(y.GetType()); - if (xIsAssignableFromY && x is IEquatable) - return ((IEquatable)x).Equals(y); - - //y implements IEquitable and is assignable from x? - var yIsAssignableFromX = y.GetType().IsAssignableFrom(x.GetType()); - if (yIsAssignableFromX && y is IEquatable) - return ((IEquatable)y).Equals(x); - - // Enumerable? - IEnumerable enumerableX = x as IEnumerable; - IEnumerable enumerableY = y as IEnumerable; - - if (enumerableX != null && enumerableY != null) - { - return new EnumerableEqualityComparer().Equals(enumerableX, enumerableY); - } - - // Last case, rely on Object.Equals - return Object.Equals(x, y); - } - - public int GetHashCode(T obj) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Assertions/Assertions.cs b/src/UnitTests/Should/Should.Core/Assertions/Assertions.cs deleted file mode 100644 index bcc9283385..0000000000 --- a/src/UnitTests/Should/Should.Core/Assertions/Assertions.cs +++ /dev/null @@ -1,503 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Should.Core.Exceptions; - -namespace Should.Core.Assertions -{ - /// - /// A wrapper for Assert which is used by . - /// - public class Assertions - { - /// - /// Verifies that a collection contains a given object. - /// - /// The type of the object to be verified - /// The object expected to be in the collection - /// The collection to be inspected - /// Thrown when the object is not present in the collection - public void Contains(T expected, IEnumerable collection) - { - Assert.Contains(expected, collection); - } - - /// - /// Verifies that a collection contains a given object, using a comparer. - /// - /// The type of the object to be verified - /// The object expected to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is not present in the collection - public void Contains(T expected, IEnumerable collection, IEqualityComparer comparer) - { - Assert.Contains(expected, collection, comparer); - } - - /// - /// Verifies that a string contains a given sub-string, using the current culture. - /// - /// The sub-string expected to be in the string - /// The string to be inspected - /// Thrown when the sub-string is not present inside the string - public void Contains(string expectedSubString, string actualString) - { - Assert.Contains(expectedSubString, actualString); - } - - /// - /// Verifies that a string contains a given sub-string, using the given comparison type. - /// - /// The sub-string expected to be in the string - /// The string to be inspected - /// The type of string comparison to perform - /// Thrown when the sub-string is not present inside the string - public void Contains(string expectedSubString, string actualString, StringComparison comparisonType) - { - Assert.Contains(expectedSubString, actualString, comparisonType); - } - - /// - /// Verifies that a collection does not contain a given object. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// Thrown when the object is present inside the container - public void DoesNotContain(T expected, IEnumerable collection) - { - Assert.DoesNotContain(expected, collection); - } - - /// - /// Verifies that a collection does not contain a given object, using a comparer. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is present inside the container - public void DoesNotContain(T expected, IEnumerable collection, IEqualityComparer comparer) - { - Assert.DoesNotContain(expected, collection, comparer); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The sub-string which is expected not to be in the string - /// The string to be inspected - /// Thrown when the sub-string is present inside the string - public void DoesNotContain(string expectedSubString, string actualString) - { - Assert.DoesNotContain(expectedSubString, actualString); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The sub-string which is expected not to be in the string - /// The string to be inspected - /// The type of string comparison to perform - /// Thrown when the sub-string is present inside the given string - public void DoesNotContain(string expectedSubString, string actualString, StringComparison comparisonType) - { - Assert.DoesNotContain(expectedSubString, actualString, comparisonType); - } - - ///// - ///// Verifies that a block of code does not throw any exceptions. - ///// - ///// A delegate to the code to be tested - //public void DoesNotThrow(Assert.ThrowsDelegate testCode) - //{ - // Assert.DoesNotThrow(testCode); - //} - - /// - /// Verifies that a collection is empty. - /// - /// The collection to be inspected - /// Thrown when the collection is null - /// Thrown when the collection is not empty - public void Empty(IEnumerable collection) - { - Assert.Empty(collection); - } - - /// - /// Verifies that two objects are equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// Thrown when the objects are not equal - public void Equal(T expected, T actual) - { - Assert.Equal(expected, actual); - } - - /// - /// Verifies that two objects are equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The comparer used to compare the two objects - /// Thrown when the objects are not equal - public void Equal(T expected, T actual, IEqualityComparer comparer) - { - Assert.Equal(expected, actual, comparer); - } - - /// Do not call this method. Call Assert.Equal() instead. - public override bool Equals(object obj) - { - throw new NotImplementedException(); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// Thrown if the condition is not false - public void False(bool condition) - { - Assert.False(condition); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// The message to show when the condition is not false - /// Thrown if the condition is not false - public void False(bool condition, string userMessage) - { - Assert.False(condition, userMessage); - } - - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current . - public override int GetHashCode() - { - return 42; - } - - /// Verifies that an object is greater than the exclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive minimum value of paramref name="value"/>. - public static void GreaterThan(T value, T maxValue) - { - Assert.GreaterThan(value, maxValue); - } - - /// Verifies that an object is greater than the exclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive minimum value of paramref name="value"/>. - /// An used to compare the objects. - public static void GreaterThan(T value, T minValue, IComparer comparer) - { - Assert.GreaterThan(value, minValue, comparer); - } - - /// Verifies that an object is greater than the inclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive minimum value of paramref name="value"/>. - public static void GreaterThanOrEqual(T value, T minValue) - { - Assert.GreaterThanOrEqual(value, minValue); - } - - /// Verifies that an object is greater than the inclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive minimum value of paramref name="value"/>. - /// An used to compare the objects. - public static void GreaterThanOrEqual(T value, T minValue, IComparer comparer) - { - Assert.GreaterThanOrEqual(value, minValue, comparer); - } - - /// - /// Verifies that a value is within a given range. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is not in the given range - public void InRange(T actual, T low, T high) - { - Assert.InRange(actual, low, high); - } - - /// - /// Verifies that a value is within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is not in the given range - public void InRange(T actual, T low, T high, IComparer comparer) - { - Assert.InRange(actual, low, high, comparer); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public void IsNotType(object @object) - { - Assert.IsNotType(@object); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public void IsNotType(Type expectedType, object @object) - { - Assert.IsNotType(expectedType, @object); - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public T IsType(object @object) - { - return Assert.IsType(@object); - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// Thrown when the object is not the given type - public void IsType(Type expectedType, object @object) - { - Assert.IsType(expectedType, @object); - } - - /// Verifies that an object is less than the exclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive maximum value of paramref name="value"/>. - public static void LessThan(T value, T maxValue) - { - Assert.LessThan(value, maxValue); - } - - /// Verifies that an object is less than the exclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the exclusive maximum value of paramref name="value"/>. - /// An used to compare the objects. - public static void LessThan(T value, T maxValue, IComparer comparer) - { - Assert.LessThan(value, maxValue, comparer); - } - - /// Verifies that an object is less than the inclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive maximum value of paramref name="value"/>. - public static void LessThanOrEqual(T value, T maxValue) - { - Assert.LessThanOrEqual(value, maxValue); - } - - /// Verifies that an object is less than the inclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated. - /// An object representing the inclusive maximum value of paramref name="value"/>. - /// An used to compare the objects. - public static void LessThanOrEqual(T value, T maxValue, IComparer comparer) - { - Assert.LessThanOrEqual(value, maxValue, comparer); - } - - /// - /// Verifies that a collection is not empty. - /// - /// The collection to be inspected - /// Thrown when a null collection is passed - /// Thrown when the collection is empty - public void NotEmpty(IEnumerable collection) - { - Assert.NotEmpty(collection); - } - - /// - /// Verifies that two objects are not equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected object - /// The actual object - /// Thrown when the objects are equal - public void NotEqual(T expected, T actual) - { - Assert.NotEqual(expected, actual); - } - - /// - /// Verifies that two objects are not equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected object - /// The actual object - /// The comparer used to examine the objects - /// Thrown when the objects are equal - public void NotEqual(T expected, T actual, IEqualityComparer comparer) - { - Assert.NotEqual(expected, actual, comparer); - } - - /// - /// Verifies that a value is not within a given range, using the default comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is in the given range - public void NotInRange(T actual, T low, T high) - { - Assert.NotInRange(actual, low, high); - } - - /// - /// Verifies that a value is not within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is in the given range - public void NotInRange(T actual, T low, T high, IComparer comparer) - { - Assert.NotInRange(actual, low, high, comparer); - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// Thrown when the object is not null - public void NotNull(object @object) - { - Assert.NotNull(@object); - } - - /// - /// Verifies that two objects are not the same instance. - /// - /// The expected object instance - /// The actual object instance - /// Thrown when the objects are the same instance - public void NotSame(object expected, object actual) - { - Assert.NotSame(expected, actual); - } - - /// - /// Verifies that an object reference is null. - /// - /// The object to be inspected - /// Thrown when the object reference is not null - public void Null(object @object) - { - Assert.Null(@object); - } - - /// - /// Verifies that two objects are the same instance. - /// - /// The expected object instance - /// The actual object instance - /// Thrown when the objects are not the same instance - public void Same(object expected, object actual) - { - Assert.Same(expected, actual); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public T Throws(Assert.ThrowsDelegate testCode) - where T : Exception - { - return Assert.Throws(testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// The message to be shown if the test fails - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public T Throws(string userMessage, Assert.ThrowsDelegate testCode) - where T : Exception - { - return Assert.Throws(userMessage, testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public Exception Throws(Type exceptionType, Assert.ThrowsDelegate testCode) - { - return Assert.Throws(exceptionType, testCode); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// Thrown when the condition is false - public void True(bool condition) - { - Assert.True(condition); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// The message to be shown when the condition is false - /// Thrown when the condition is false - public void True(bool condition, string userMessage) - { - Assert.True(condition, userMessage); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Assertions/EnumerableEqualityComparer.cs b/src/UnitTests/Should/Should.Core/Assertions/EnumerableEqualityComparer.cs deleted file mode 100644 index 5884b710af..0000000000 --- a/src/UnitTests/Should/Should.Core/Assertions/EnumerableEqualityComparer.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; - -namespace Should.Core.Assertions -{ - internal class EnumerableEqualityComparer : IEqualityComparer - { - public int Position { get; set; } - - public bool Equals(IEnumerable x, IEnumerable y) - { - IEnumerator enumeratorX = x.GetEnumerator(); - IEnumerator enumeratorY = y.GetEnumerator(); - - Position = 0; - - while (true) - { - bool hasNextX = enumeratorX.MoveNext(); - bool hasNextY = enumeratorY.MoveNext(); - - if (!hasNextX || !hasNextY) - return hasNextX == hasNextY; - - if (enumeratorX.Current != null || enumeratorY.Current != null) - { - if (enumeratorX.Current != null && enumeratorY.Current == null) - return false; - - if (enumeratorX.Current == null) - return false; - - var xType = enumeratorX.Current.GetType(); - var yType = enumeratorY.Current.GetType(); - - if (xType.IsAssignableFrom(yType)) - { - if (!Equals(enumeratorX.Current, enumeratorY.Current, xType)) - return false; - } - else if (yType.IsAssignableFrom(xType)) - { - if (!Equals(enumeratorY.Current, enumeratorX.Current, yType)) - return false; - } - else - { - return false; - } - } - Position++; - } - } - - public int GetHashCode(IEnumerable obj) - { - throw new NotImplementedException(); - } - - private bool Equals(object a, object b, Type baseType) - { - var assertComparerType = typeof(AssertEqualityComparer<>).MakeGenericType(baseType); - var assertComparer = Activator.CreateInstance(assertComparerType); - var compareMethod = assertComparerType.GetMethod("Equals", new [] { baseType, baseType }); - return (bool)compareMethod.Invoke(assertComparer, new[] { a, b }); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Assertions/Record.cs b/src/UnitTests/Should/Should.Core/Assertions/Record.cs deleted file mode 100644 index 84d6a556a4..0000000000 --- a/src/UnitTests/Should/Should.Core/Assertions/Record.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; - -namespace Should.Core.Assertions -{ - /// - /// Allows the user to record actions for a test. - /// - public class Record - { - /// - /// Records any exception which is thrown by the given code. - /// - /// The code which may thrown an exception. - /// Returns the exception that was thrown by the code; null, otherwise. - public static Exception Exception(Assert.ThrowsDelegate code) - { - try - { - code(); - return null; - } - catch (Exception ex) - { - return ex; - } - } - - /// - /// Records any exception which is thrown by the given code that has - /// a return value. Generally used for testing property accessors. - /// - /// The code which may thrown an exception. - /// Returns the exception that was thrown by the code; null, otherwise. - public static Exception Exception(Assert.ThrowsDelegateWithReturn code) - { - try - { - code(); - return null; - } - catch (Exception ex) - { - return ex; - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/DatePrecision.cs b/src/UnitTests/Should/Should.Core/DatePrecision.cs deleted file mode 100644 index 4c850b55c5..0000000000 --- a/src/UnitTests/Should/Should.Core/DatePrecision.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -namespace Should.Core -{ - public abstract class DatePrecision - { - public static DatePrecision Second = new SecondPrecision(); - public static DatePrecision Minute = new MinutePrecision(); - public static DatePrecision Hour = new HourPrecision(); - public static DatePrecision Date = new DayPrecision(); - public static DatePrecision Month = new MonthPrecision(); - public static DatePrecision Year = new YearPrecision(); - - public abstract DateTime Truncate(DateTime date); - - public class SecondPrecision : DatePrecision - { - public override DateTime Truncate(DateTime date) - { - return new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second); - } - } - - public class MinutePrecision : DatePrecision - { - public override DateTime Truncate(DateTime date) - { - return new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, 0); - } - } - - public class HourPrecision : DatePrecision - { - public override DateTime Truncate(DateTime date) - { - return new DateTime(date.Year, date.Month, date.Day, date.Hour, 0, 0); - } - } - - public class DayPrecision : DatePrecision - { - public override DateTime Truncate(DateTime date) - { - return new DateTime(date.Year, date.Month, date.Day, 0, 0, 0); - } - } - - public class MonthPrecision : DatePrecision - { - public override DateTime Truncate(DateTime date) - { - return new DateTime(date.Year, date.Month, 0, 0, 0, 0); - } - } - - public class YearPrecision : DatePrecision - { - public override DateTime Truncate(DateTime date) - { - return new DateTime(date.Year, 0, 0, 0, 0, 0); - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/AssertActualExpectedException.cs b/src/UnitTests/Should/Should.Core/Exceptions/AssertActualExpectedException.cs deleted file mode 100644 index 229cc9d230..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/AssertActualExpectedException.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Should.Core.Assertions; - -namespace Should.Core.Exceptions -{ - /// - /// Base class for exceptions that have actual and expected values - /// - public class AssertActualExpectedException : AssertException - { - readonly string actual; - readonly string differencePosition = ""; - readonly string expected; - - /// - /// Creates a new instance of the class. - /// - /// The expected value - /// The actual value - /// The user message to be shown - public AssertActualExpectedException(object expected, - object actual, - string userMessage) - : this(expected, actual, userMessage, false) { } - - /// - /// Creates a new instance of the class. - /// - /// The expected value - /// The actual value - /// The user message to be shown - /// Set to true to skip the check for difference position - public AssertActualExpectedException(object expected, - object actual, - string userMessage, - bool skipPositionCheck) - : base(userMessage) - { - if (!skipPositionCheck) - { - IEnumerable enumerableActual = actual as IEnumerable; - IEnumerable enumerableExpected = expected as IEnumerable; - - if (enumerableActual != null && enumerableExpected != null) - { - var comparer = new EnumerableEqualityComparer(); - comparer.Equals(enumerableActual, enumerableExpected); - - differencePosition = "Position: First difference is at position " + comparer.Position + Environment.NewLine; - } - } - - this.actual = actual == null ? null : ConvertToString(actual); - this.expected = expected == null ? null : ConvertToString(expected); - - if (actual != null && - expected != null && - actual.ToString() == expected.ToString() && - actual.GetType() != expected.GetType()) - { - this.actual += String.Format(" ({0})", actual.GetType().FullName); - this.expected += String.Format(" ({0})", expected.GetType().FullName); - } - } - - /// - /// Gets the actual value. - /// - public string Actual - { - get { return actual; } - } - - /// - /// Gets the expected value. - /// - public string Expected - { - get { return expected; } - } - - /// - /// Gets a message that describes the current exception. Includes the expected and actual values. - /// - /// The error message that explains the reason for the exception, or an empty string(""). - /// 1 - public override string Message - { - get - { - return string.Format("{0}{4}{1}Expected: {2}{4}Actual: {3}", - base.Message, - differencePosition, - FormatMultiLine(Expected ?? "(null)"), - FormatMultiLine(Actual ?? "(null)"), - Environment.NewLine); - } - } - - static string ConvertToString(object value) - { - Array valueArray = value as Array; - if (valueArray == null) - return value.ToString(); - - List valueStrings = new List(); - - foreach (object valueObject in valueArray) - valueStrings.Add(valueObject == null ? "(null)" : valueObject.ToString()); - - return value.GetType().FullName + " { " + String.Join(", ", valueStrings.ToArray()) + " }"; - } - - static string FormatMultiLine(string value) - { - return value.Replace(Environment.NewLine, Environment.NewLine + " "); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/AssertException.cs b/src/UnitTests/Should/Should.Core/Exceptions/AssertException.cs deleted file mode 100644 index 386f89fdb7..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/AssertException.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace Should.Core.Exceptions -{ - /// - /// The base assert exception class - /// - public class AssertException : Exception - { - public static string FilterStackTraceAssemblyPrefix = "Should."; - - readonly string stackTrace; - - /// - /// Initializes a new instance of the class. - /// - public AssertException() { } - - /// - /// Initializes a new instance of the class. - /// - /// The user message to be displayed - public AssertException(string userMessage) - : base(userMessage) - { - this.UserMessage = userMessage; - } - - /// - /// Initializes a new instance of the class. - /// - /// The user message to be displayed - /// The inner exception - public AssertException(string userMessage, Exception innerException) - : base(userMessage, innerException) { } - - /// - /// Initializes a new instance of the class. - /// - /// The user message to be displayed - /// The stack trace to be displayed - protected AssertException(string userMessage, string stackTrace) - : base(userMessage) - { - this.stackTrace = stackTrace; - } - - /// - /// Gets a string representation of the frames on the call stack at the time the current exception was thrown. - /// - /// A string that describes the contents of the call stack, with the most recent method call appearing first. - public override string StackTrace - { - get { return FilterStackTrace(stackTrace ?? base.StackTrace); } - } - - /// - /// Gets the user message - /// - public string UserMessage { get; protected set; } - - /// - /// Filters the stack trace to remove all lines that occur within the testing framework. - /// - /// The original stack trace - /// The filtered stack trace - protected static string FilterStackTrace(string stackTrace) - { - if (stackTrace == null) - return null; - - List results = new List(); - - foreach (string line in SplitLines(stackTrace)) - { - string trimmedLine = line.TrimStart(); - if (!trimmedLine.StartsWith( "at " + FilterStackTraceAssemblyPrefix) ) - results.Add(line); - } - - return string.Join(Environment.NewLine, results.ToArray()); - } - - // Our own custom String.Split because Silverlight/CoreCLR doesn't support the version we were using - static IEnumerable SplitLines(string input) - { - while (true) - { - int idx = input.IndexOf(Environment.NewLine); - - if (idx < 0) - { - yield return input; - break; - } - - yield return input.Substring(0, idx); - input = input.Substring(idx + Environment.NewLine.Length); - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/ComparisonException.cs b/src/UnitTests/Should/Should.Core/Exceptions/ComparisonException.cs deleted file mode 100644 index 28899c759e..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/ComparisonException.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - public abstract class ComparisonException : AssertException - { - public string Left { get; private set; } - public string Right { get; private set; } - - protected ComparisonException(object left, object right, string methodName, string operation) - : base(string.Format("Assert.{0}() Failure:\r\n\tExpected: {1} {2} {3}\r\n\tbut it was not", methodName, Format(right), operation, Format(left))) - { - Left = left != null ? left.ToString() : null; - Right = right != null ? right.ToString() : null; - } - - protected ComparisonException(object left, object right, string message) : base(message) - { - Left = left != null ? left.ToString() : null; - Right = right != null ? right.ToString() : null; - } - - public static string Format(object value) - { - if (value == null) - { - return "(null)"; - } - var type = value.GetType(); - return type == typeof(string) // || type == typeof(DateTime) || type == typeof(DateTime?) - ? string.Format("\"{0}\"", value) - : value.ToString(); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/ContainsException.cs b/src/UnitTests/Should/Should.Core/Exceptions/ContainsException.cs deleted file mode 100644 index fb2d8485ba..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/ContainsException.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a collection unexpectedly does not contain the expected value. - /// - public class ContainsException : AssertException - { - /// - /// Creates a new instance of the class. - /// - /// The expected object value - public ContainsException(object expected) - : base(string.Format("Assert.Contains() failure: Not found: {0}", expected)) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/DoesNotContainException.cs b/src/UnitTests/Should/Should.Core/Exceptions/DoesNotContainException.cs deleted file mode 100644 index 59de99770d..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/DoesNotContainException.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a collection unexpectedly contains the expected value. - /// - public class DoesNotContainException : AssertException - { - /// - /// Creates a new instance of the class. - /// - /// The expected object value - public DoesNotContainException(object expected) - : base(string.Format("Assert.DoesNotContain() failure: Found: {0}", expected)) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/DoesNotThrowException.cs b/src/UnitTests/Should/Should.Core/Exceptions/DoesNotThrowException.cs deleted file mode 100644 index f2a5de3559..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/DoesNotThrowException.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when code unexpectedly throws an exception. - /// - public class DoesNotThrowException : AssertActualExpectedException - { - readonly string stackTrace; - - /// - /// Creates a new instance of the class. - /// - /// Actual exception - public DoesNotThrowException(Exception actual) - : base("(No exception)", - actual.GetType().FullName + (actual.Message == null ? "" : ": " + actual.Message), - "Assert.DoesNotThrow() failure", - true) - { - stackTrace = actual.StackTrace; - } - - /// - /// Gets a string representation of the frames on the call stack at the time the current exception was thrown. - /// - /// A string that describes the contents of the call stack, with the most recent method call appearing first. - public override string StackTrace - { - get { return FilterStackTrace(stackTrace ?? base.StackTrace); } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/EmptyException.cs b/src/UnitTests/Should/Should.Core/Exceptions/EmptyException.cs deleted file mode 100644 index 8be488136c..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/EmptyException.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a collection is unexpectedly not empty. - /// - public class EmptyException : AssertException - { - /// - /// Creates a new instance of the class. - /// - public EmptyException() - : base("Assert.Empty() failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/EqualException.cs b/src/UnitTests/Should/Should.Core/Exceptions/EqualException.cs deleted file mode 100644 index 109c93432b..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/EqualException.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when two values are unexpectedly not equal. - /// - public class EqualException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// The expected object value - /// The actual object value - public EqualException(object expected, - object actual) - : this(expected, actual, "Assert.Equal() Failure") { } - - /// - /// Creates a new instance of the class. - /// - /// The expected object value - /// The actual object value - /// The user message to be shown on failure - public EqualException(object expected, object actual, string userMessage) - : base(expected, actual, userMessage) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/FalseException.cs b/src/UnitTests/Should/Should.Core/Exceptions/FalseException.cs deleted file mode 100644 index fe493b2716..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/FalseException.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a value is unexpectedly true. - /// - public class FalseException : AssertException - { - /// - /// Creates a new instance of the class. - /// - /// The user message to be display, or null for the default message - public FalseException(string userMessage) - : base(userMessage ?? "Assert.False() Failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/GreaterThanException.cs b/src/UnitTests/Should/Should.Core/Exceptions/GreaterThanException.cs deleted file mode 100644 index 41ff4eb1dc..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/GreaterThanException.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// Exception thrown when a value is not greater than the expected minimum. - public class GreaterThanException : ComparisonException - { - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive minimum allowed value. - public GreaterThanException(object left, object right) - : base(right, left, "GreaterThan", ">") - { } - - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive minimum allowed value. - public GreaterThanException(object left, object right, string message) - : base(left, right, message) - { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/GreaterThanOrEqualException.cs b/src/UnitTests/Should/Should.Core/Exceptions/GreaterThanOrEqualException.cs deleted file mode 100644 index c095562a0d..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/GreaterThanOrEqualException.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// Exception thrown when a value is not greater than the expected minimum. - public class GreaterThanOrEqualException : ComparisonException - { - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive minimum allowed value. - public GreaterThanOrEqualException(object left, object right) - : base(right, left, "GreaterThanOrEqual", ">=") - { } - - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive minimum allowed value. - public GreaterThanOrEqualException(object left, object right, string message) - : base(left, right, message) - { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/InRangeException.cs b/src/UnitTests/Should/Should.Core/Exceptions/InRangeException.cs deleted file mode 100644 index ea612232a2..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/InRangeException.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a value is unexpectedly not in the given range. - /// - public class InRangeException : AssertException - { - readonly string actual; - readonly string high; - readonly string low; - - /// - /// Creates a new instance of the class. - /// - /// The actual object value - /// The low value of the range - /// The high value of the range - public InRangeException(object actual, - object low, - object high) - : base("Assert.InRange() Failure") - { - this.low = low == null ? null : low.ToString(); - this.high = high == null ? null : high.ToString(); - this.actual = actual == null ? null : actual.ToString(); - } - - /// - /// Gets the actual object value - /// - public string Actual - { - get { return actual; } - } - - /// - /// Gets the high value of the range - /// - public string High - { - get { return high; } - } - - /// - /// Gets the low value of the range - /// - public string Low - { - get { return low; } - } - - /// - /// Gets a message that describes the current exception. - /// - /// The error message that explains the reason for the exception, or an empty string(""). - public override string Message - { - get - { - return string.Format("{0}\r\nRange: ({1} - {2})\r\nActual: {3}", - base.Message, Low, High, Actual ?? "(null)"); - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/IsAssignableFromException.cs b/src/UnitTests/Should/Should.Core/Exceptions/IsAssignableFromException.cs deleted file mode 100644 index a5e8c39fb4..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/IsAssignableFromException.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when the value is unexpectedly not of the given type or a derived type. - /// - public class IsAssignableFromException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// The expected type - /// The actual object value - public IsAssignableFromException(Type expected, object actual) : this(expected, actual, "Assert.IsAssignableFrom() Failure") { } - - /// - /// Creates a new instance of the class. - /// - /// The expected type - /// The actual object value - /// A custom message to prepend to the default Assert.IsAssignableFrom() failure message - public IsAssignableFromException(Type expected, object actual, string userMessage) - : base(expected, actual == null ? null : actual.GetType(), userMessage) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/IsNotTypeException.cs b/src/UnitTests/Should/Should.Core/Exceptions/IsNotTypeException.cs deleted file mode 100644 index ee62a92574..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/IsNotTypeException.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when the value is unexpectedly of the exact given type. - /// - public class IsNotTypeException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// The expected type - /// The actual object value - public IsNotTypeException(Type expected, - object actual) - : base(expected, actual == null ? null : actual.GetType(), "Assert.IsNotType() Failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/IsTypeException.cs b/src/UnitTests/Should/Should.Core/Exceptions/IsTypeException.cs deleted file mode 100644 index 98c54cc61b..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/IsTypeException.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when the value is unexpectedly not of the exact given type. - /// - public class IsTypeException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// The expected type - /// The actual object value - public IsTypeException(Type expected, - object actual) - : base(expected, actual == null ? null : actual.GetType(), "Assert.IsType() Failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/LessThanException.cs b/src/UnitTests/Should/Should.Core/Exceptions/LessThanException.cs deleted file mode 100644 index f30011b3e7..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/LessThanException.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// Exception thrown when a value is not less than the expected maximum. - public class LessThanException : ComparisonException - { - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive maximum allowed value. - public LessThanException(object left, object right) - : base(right, left, "LessThan", "<") - { } - - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive maximum allowed value. - public LessThanException(object left, object right, string message) - : base(left, right, message) - { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/LessThanOrEqualException.cs b/src/UnitTests/Should/Should.Core/Exceptions/LessThanOrEqualException.cs deleted file mode 100644 index 13d8fcc11d..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/LessThanOrEqualException.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// Exception thrown when a value is not less than or equal to the expected maximum. - public class LessThanOrEqualException : ComparisonException - { - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive maximum allowed value. - public LessThanOrEqualException(object left, object right) - : base(right, left, "LessThanOrEqual", "<=") - { } - - /// Initializes a new instance of the class. - /// The value being tested. - /// The exclusive maximum allowed value. - public LessThanOrEqualException(object left, object right, string message) - : base(left, right, message) - { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/NotEmptyException.cs b/src/UnitTests/Should/Should.Core/Exceptions/NotEmptyException.cs deleted file mode 100644 index 2bb0181e23..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/NotEmptyException.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a collection is unexpectedly empty. - /// - public class NotEmptyException : AssertException - { - /// - /// Creates a new instance of the class. - /// - public NotEmptyException() - : base("Assert.NotEmpty() failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/NotEqualException.cs b/src/UnitTests/Should/Should.Core/Exceptions/NotEqualException.cs deleted file mode 100644 index 2ef6a10db4..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/NotEqualException.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when two values are unexpectedly equal. - /// - public class NotEqualException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// The expected object value - /// The actual object value - public NotEqualException(object expected, - object actual) - : this(expected, actual, "Assert.NotEqual() Failure") { } - - /// - /// Creates a new instance of the class. - /// - /// The expected object value - /// The actual object value - /// The user message to be shown on failure - public NotEqualException(object expected, object actual, string userMessage) - : base(expected, actual, userMessage) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/NotInRangeException.cs b/src/UnitTests/Should/Should.Core/Exceptions/NotInRangeException.cs deleted file mode 100644 index 2ebcee277d..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/NotInRangeException.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a value is unexpectedly in the given range. - /// - public class NotInRangeException : AssertException - { - readonly string actual; - readonly string high; - readonly string low; - - /// - /// Creates a new instance of the class. - /// - /// The actual object value - /// The low value of the range - /// The high value of the range - public NotInRangeException(object actual, - object low, - object high) - : base("Assert.NotInRange() Failure") - { - this.low = low == null ? null : low.ToString(); - this.high = high == null ? null : high.ToString(); - this.actual = actual == null ? null : actual.ToString(); - } - - /// - /// Gets the actual object value - /// - public string Actual - { - get { return actual; } - } - - /// - /// Gets the high value of the range - /// - public string High - { - get { return high; } - } - - /// - /// Gets the low value of the range - /// - public string Low - { - get { return low; } - } - - /// - /// Gets a message that describes the current exception. - /// - /// The error message that explains the reason for the exception, or an empty string(""). - public override string Message - { - get - { - return string.Format("{0}\r\nRange: ({1} - {2})\r\nActual: {3}", - base.Message, Low, High, Actual ?? "(null)"); - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/NotNullException.cs b/src/UnitTests/Should/Should.Core/Exceptions/NotNullException.cs deleted file mode 100644 index c4e19c1deb..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/NotNullException.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when an object is unexpectedly null. - /// - public class NotNullException : AssertException - { - /// - /// Creates a new instance of the class. - /// - public NotNullException() - : this("Assert.NotNull() Failure") { } - - /// - /// Creates a new instance of the class with the given failure . - /// - public NotNullException(string message) - : base(message) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/NotSameException.cs b/src/UnitTests/Should/Should.Core/Exceptions/NotSameException.cs deleted file mode 100644 index 8adadfc524..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/NotSameException.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when two values are unexpected the same instance. - /// - public class NotSameException : AssertException - { - /// - /// Creates a new instance of the class. - /// - public NotSameException() - : base("Assert.NotSame() Failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/NullException.cs b/src/UnitTests/Should/Should.Core/Exceptions/NullException.cs deleted file mode 100644 index 5b66c5171e..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/NullException.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when an object reference is unexpectedly not null. - /// - public class NullException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// - public NullException(object actual) - : base(null, actual, "Assert.Null() Failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/ParameterCountMismatchException.cs b/src/UnitTests/Should/Should.Core/Exceptions/ParameterCountMismatchException.cs deleted file mode 100644 index b74904e198..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/ParameterCountMismatchException.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Should.Core.Exceptions -{ - /// - /// Exception to be thrown from when the number of - /// parameter values does not the test method signature. - /// - public class ParamterCountMismatchException : Exception - { - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/SameException.cs b/src/UnitTests/Should/Should.Core/Exceptions/SameException.cs deleted file mode 100644 index f011c8daca..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/SameException.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when two object references are unexpectedly not the same instance. - /// - public class SameException : AssertActualExpectedException - { - /// - /// Creates a new instance of the class. - /// - /// The expected object reference - /// The actual object reference - public SameException(object expected, - object actual) - : base(expected, actual, "Assert.Same() Failure", true) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/SingleException.cs b/src/UnitTests/Should/Should.Core/Exceptions/SingleException.cs deleted file mode 100644 index 52ddb72b60..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/SingleException.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when the collection did not contain exactly one element. - /// - public class SingleException : AssertException - { - /// - /// Initializes a new instance of the class. - /// - /// The numbers of items in the collection. - public SingleException(int count) - : base(String.Format("The collection contained {0} elements instead of 1.", count)) { } - } -} diff --git a/src/UnitTests/Should/Should.Core/Exceptions/StartsWithException.cs b/src/UnitTests/Should/Should.Core/Exceptions/StartsWithException.cs deleted file mode 100644 index 8ed35826fe..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/StartsWithException.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a collection unexpectedly does not contain the expected value. - /// - public class StartsWithException : AssertException - { - /// - /// Creates a new instance of the class. - /// - /// The expected object value - /// The actual object value - public StartsWithException(object expectedStartString, object actual) - : base(string.Format("Assert.StartsWith() failure: '{0}' not found at the beginning of '{1}'", expectedStartString, actual)) { } - } -} diff --git a/src/UnitTests/Should/Should.Core/Exceptions/ThrowsException.cs b/src/UnitTests/Should/Should.Core/Exceptions/ThrowsException.cs deleted file mode 100644 index b840b85ded..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/ThrowsException.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when code unexpectedly fails to throw an exception. - /// - public class ThrowsException : AssertActualExpectedException - { - readonly string stackTrace = null; - - /// - /// Creates a new instance of the class. Call this constructor - /// when no exception was thrown. - /// - /// The type of the exception that was expected - public ThrowsException(Type expectedType) - : this(expectedType, "(No exception was thrown)", null, null) { } - - /// - /// Creates a new instance of the class. Call this constructor - /// when an exception of the wrong type was thrown. - /// - /// The type of the exception that was expected - /// The actual exception that was thrown - public ThrowsException(Type expectedType, - Exception actual) - : this(expectedType, actual.GetType().FullName, actual.Message, actual.StackTrace) { } - - ThrowsException(Type expected, - string actual, - string actualMessage, - string stackTrace) - : base(expected, - actual + (actualMessage == null ? "" : ": " + actualMessage), - "Assert.Throws() Failure") - { - this.stackTrace = stackTrace; - } - - /// - /// Gets a string representation of the frames on the call stack at the time the current exception was thrown. - /// - /// A string that describes the contents of the call stack, with the most recent method call appearing first. - public override string StackTrace - { - get { return FilterStackTrace(stackTrace ?? base.StackTrace); } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/TimeoutException.cs b/src/UnitTests/Should/Should.Core/Exceptions/TimeoutException.cs deleted file mode 100644 index 26e24b7f24..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/TimeoutException.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a test method exceeds the given timeout value - /// - public class TimeoutException : AssertException - { - /// - /// Creates a new instance of the class. - /// - /// The timeout value, in milliseconds - public TimeoutException(long timeout) - : base(string.Format("Test execution time exceeded: {0}ms", timeout)) { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/TraceAssertException.cs b/src/UnitTests/Should/Should.Core/Exceptions/TraceAssertException.cs deleted file mode 100644 index 1496ae0571..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/TraceAssertException.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; - -namespace Should.Core.Exceptions -{ - /// - /// Exception that is thrown when a call to Debug.Assert() fails. - /// - public class TraceAssertException : AssertException - { - readonly string assertDetailedMessage; - readonly string assertMessage; - - /// - /// Creates a new instance of the class. - /// - /// The original assert message - public TraceAssertException(string assertMessage) - : this(assertMessage, "") { } - - /// - /// Creates a new instance of the class. - /// - /// The original assert message - /// The original assert detailed message - public TraceAssertException(string assertMessage, - string assertDetailedMessage) - { - this.assertMessage = assertMessage ?? ""; - this.assertDetailedMessage = assertDetailedMessage ?? ""; - } - - /// - /// Gets the original assert detailed message. - /// - public string AssertDetailedMessage - { - get { return assertDetailedMessage; } - } - - /// - /// Gets the original assert message. - /// - public string AssertMessage - { - get { return assertMessage; } - } - - /// - /// Gets a message that describes the current exception. - /// - public override string Message - { - get - { - string result = "Debug.Assert() Failure"; - - if (AssertMessage != "") - { - result += " : " + AssertMessage; - - if (AssertDetailedMessage != "") - result += Environment.NewLine + "Detailed Message:" + Environment.NewLine + AssertDetailedMessage; - } - - return result; - } - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/Should.Core/Exceptions/TrueException.cs b/src/UnitTests/Should/Should.Core/Exceptions/TrueException.cs deleted file mode 100644 index 5698cf2d59..0000000000 --- a/src/UnitTests/Should/Should.Core/Exceptions/TrueException.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Should.Core.Exceptions -{ - /// - /// Exception thrown when a value is unexpectedly false. - /// - public class TrueException : AssertException - { - /// - /// Creates a new instance of the class. - /// - /// The user message to be displayed, or null for the default message - public TrueException(string userMessage) - : base(userMessage ?? "Assert.True() Failure") { } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/should/ActionAssertionExtensions.cs b/src/UnitTests/Should/should/ActionAssertionExtensions.cs deleted file mode 100644 index ef98d5dc49..0000000000 --- a/src/UnitTests/Should/should/ActionAssertionExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Should.Core.Assertions; - -namespace Should -{ - public static class ActionAssertionExtensions - { - /// Verifies that the throws the specified exception type. - /// The type of exception expected to be thrown. - /// The action which should throw the exception. - /// Additional checks on the exception object. - public static void ShouldThrow(this Action action, Action exceptionChecker = null) where T : Exception - { - ShouldThrow(new Assert.ThrowsDelegate(action), exceptionChecker); - } - - /// Verifies that the throws the specified exception type. - /// The type of exception expected to be thrown. - /// A which represents the action which should throw the exception. - /// Additional checks on the exception object. - public static void ShouldThrow(this Assert.ThrowsDelegate @delegate, Action exceptionChecker = null) where T : Exception - { - var exception = Assert.Throws(@delegate); - exceptionChecker?.Invoke(exception); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/should/BooleanAssertionExtensions.cs b/src/UnitTests/Should/should/BooleanAssertionExtensions.cs deleted file mode 100644 index 52484653fe..0000000000 --- a/src/UnitTests/Should/should/BooleanAssertionExtensions.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should -{ - /// - /// Extensions which provide assertions to classes derived from . - /// - public static class BooleanAssertionExtensions - { - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// Thrown if the condition is not false - public static void ShouldBeFalse(this bool condition) - { - Assert.False(condition); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// The message to show when the condition is not false - /// Thrown if the condition is not false - public static void ShouldBeFalse(this bool condition, - string userMessage) - { - Assert.False(condition, userMessage); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// Thrown when the condition is false - public static void ShouldBeTrue(this bool condition) - { - Assert.True(condition); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// The message to be shown when the condition is false - /// Thrown when the condition is false - public static void ShouldBeTrue(this bool condition, - string userMessage) - { - Assert.True(condition, userMessage); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/should/CollectionAssertionExtensions.cs b/src/UnitTests/Should/should/CollectionAssertionExtensions.cs deleted file mode 100644 index 79af20fb5b..0000000000 --- a/src/UnitTests/Should/should/CollectionAssertionExtensions.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should -{ - /// - /// Extensions which provide assertions to classes derived from and . - /// - public static class CollectionAssertExtensions - { - /// - /// Verifies that a collection is empty. - /// - /// The collection to be inspected - /// Thrown when the collection is null - /// Thrown when the collection is not empty - public static void ShouldBeEmpty(this IEnumerable collection) - { - Assert.Empty(collection); - } - - /// - /// Verifies that a collection contains a given object. - /// - /// The type of the object to be verified - /// The collection to be inspected - /// The object expected to be in the collection - /// Thrown when the object is not present in the collection - public static void ShouldContain(this IEnumerable collection, - T expected) - { - Assert.Contains(expected, collection); - } - - /// - /// Verifies that a collection contains a given object, using a comparer. - /// - /// The type of the object to be verified - /// The collection to be inspected - /// The object expected to be in the collection - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is not present in the collection - public static void ShouldContain(this IEnumerable collection, - T expected, - IEqualityComparer comparer) - { - Assert.Contains(expected, collection, comparer); - } - - /// - /// Verifies that a collection is not empty. - /// - /// The collection to be inspected - /// Thrown when a null collection is passed - /// Thrown when the collection is empty - public static void ShouldNotBeEmpty(this IEnumerable collection) - { - Assert.NotEmpty(collection); - } - - /// - /// Verifies that a collection does not contain a given object. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// Thrown when the object is present inside the container - public static void ShouldNotContain(this IEnumerable collection, - T expected) - { - Assert.DoesNotContain(expected, collection); - } - - /// - /// Verifies that a collection does not contain a given object, using a comparer. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is present inside the container - public static void ShouldNotContain(this IEnumerable collection, - T expected, - IEqualityComparer comparer) - { - Assert.DoesNotContain(expected, collection, comparer); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/should/DateAssertionExtensions.cs b/src/UnitTests/Should/should/DateAssertionExtensions.cs deleted file mode 100644 index 318a709da6..0000000000 --- a/src/UnitTests/Should/should/DateAssertionExtensions.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Should.Core; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should -{ - /// - /// Extensions which provide assertions to classes derived from . - /// - public static class DateAssertionExtensions - { - /// - /// Verifies that two values are equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The +/- value for where the expected and actual are considered to be equal - /// Thrown when the objects are not equal - public static void ShouldEqual(this DateTime actual, DateTime expected, TimeSpan tolerance) - { - Assert.Equal(expected, actual, tolerance); - } - - /// - /// Verifies that two values are not equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The +/- value for where the expected and actual are considered to be equal - /// Thrown when the objects are equal - public static void ShouldNotEqual(this DateTime actual, DateTime expected, TimeSpan tolerance) - { - Assert.NotEqual(expected, actual, tolerance); - } - - /// - /// Verifies that two values are equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The level of precision to use when making the comparison - /// Thrown when the objects are not equal - public static void ShouldEqual(this DateTime actual, DateTime expected, DatePrecision precision) - { - Assert.Equal(expected, actual, precision); - } - - /// - /// Verifies that two values are not equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The level of precision to use when making the comparison - /// Thrown when the objects are equal - public static void ShouldNotEqual(this DateTime actual, DateTime expected, DatePrecision precision) - { - Assert.NotEqual(expected, actual, precision); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/should/DoubleAssertionExtensions.cs b/src/UnitTests/Should/should/DoubleAssertionExtensions.cs deleted file mode 100644 index 5d8d11872a..0000000000 --- a/src/UnitTests/Should/should/DoubleAssertionExtensions.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should -{ - /// - /// Extensions which provide assertions to classes derived from . - /// - public static class DoubleAssertionExtensions - { - /// - /// Verifies that two values are equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The +/- value for where the expected and actual are considered to be equal - /// Thrown when the objects are not equal - public static void ShouldEqual(this double actual, double expected, double tolerance) - { - Assert.Equal(expected, actual, tolerance); - } - - /// - /// Verifies that two values are equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The +/- value for where the expected and actual are considered to be equal - /// The user message to show on failure - /// Thrown when the objects are not equal - public static void ShouldEqual(this double actual, double expected, double tolerance, string message) - { - Assert.Equal(expected, actual, tolerance, message); - } - - /// - /// Verifies that two values are not equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The +/- value for where the expected and actual are considered to be equal - /// Thrown when the objects are equal - public static void ShouldNotEqual(this double actual, double expected, double tolerance) - { - Assert.NotEqual(expected, actual, tolerance); - } - - /// - /// Verifies that two values are not equal within a given tolerance. - /// - /// The value to be compared against - /// The expected value - /// The +/- value for where the expected and actual are considered to be equal - /// The user message to show on failure - /// Thrown when the objects are equal - public static void ShouldNotEqual(this double actual, double expected, double tolerance, string message) - { - Assert.NotEqual(expected, actual, tolerance, message); - } - } -} diff --git a/src/UnitTests/Should/should/ObjectAssertExtensions.cs b/src/UnitTests/Should/should/ObjectAssertExtensions.cs deleted file mode 100644 index b2c6c916db..0000000000 --- a/src/UnitTests/Should/should/ObjectAssertExtensions.cs +++ /dev/null @@ -1,380 +0,0 @@ -using System; -using System.Collections.Generic; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should -{ - /// - /// Extensions which provide assertions to classes derived from . - /// - public static class ObjectAssertExtensions - { - /// Verifies that an object is greater than the exclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (exclusive) minimum value of the . (The right side of the comparison.) - public static void ShouldBeGreaterThan(this T @object, T value) - { - Assert.GreaterThan(@object, value); - } - - /// Verifies that an object is greater than the exclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (exclusive) minimum value of the . (The right side of the comparison.) - /// An used to compare the objects. - public static void ShouldBeGreaterThan(this T @object, T value, IComparer comparer) - { - Assert.GreaterThan(@object, value, comparer); - } - - /// Verifies that an object is greater than the inclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (inclusive) minimum value of the . (The right side of the comparison.) - public static void ShouldBeGreaterThanOrEqualTo(this T @object, T value) - { - Assert.GreaterThanOrEqual(@object, value); - } - - /// Verifies that an object is greater than the inclusive minimum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (inclusive) minimum value of the . (The right side of the comparison.) - /// An used to compare the objects. - public static void ShouldBeGreaterThanOrEqualTo(this T @object, T value, IComparer comparer) - { - Assert.GreaterThanOrEqual(@object, value, comparer); - } - - /// - /// Verifies that a value is within a given range. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is not in the given range - public static void ShouldBeInRange(this T actual, - T low, - T high) - { - Assert.InRange(actual, low, high); - } - - /// - /// Verifies that a value is within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is not in the given range - public static void ShouldBeInRange(this T actual, - T low, - T high, - IComparer comparer) - { - Assert.InRange(actual, low, high, comparer); - } - - /// Verifies that an object is less than the exclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (exclusive) maximum value of the . (The right side of the comparison.) - public static void ShouldBeLessThan(this T @object, T value) - { - Assert.LessThan(@object, value); - } - - /// Verifies that an object is less than the exclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (exclusive) maximum value of the . (The right side of the comparison.) - /// An used to compare the objects. - public static void ShouldBeLessThan(this T @object, T value, IComparer comparer) - { - Assert.LessThan(@object, value, comparer); - } - - /// Verifies that an object is less than the inclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (inclusive) maximum value of the . (The right side of the comparison.) - public static void ShouldBeLessThanOrEqualTo(this T @object, T value) - { - Assert.LessThanOrEqual(@object, value); - } - - /// Verifies that an object is less than the inclusive maximum value. - /// The type of the objects to be compared. - /// The object to be evaluated (left side of the comparison). - /// The (inclusive) maximum value of the . (The right side of the comparison.) - /// An used to compare the objects. - public static void ShouldBeLessThanOrEqualTo(this T @object, T value, IComparer comparer) - { - Assert.LessThanOrEqual(@object, value, comparer); - } - - /// - /// Verifies that an object reference is null. - /// - /// The object to be inspected - /// Thrown when the object reference is not null - public static void ShouldBeNull(this object @object) - { - Assert.Null(@object); - } - - /// - /// Verifies that two objects are the same instance. - /// - /// The actual object instance - /// The expected object instance - /// Thrown when the objects are not the same instance - public static void ShouldBeSameAs(this object actual, - object expected) - { - Assert.Same(expected, actual); - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T ShouldBeType(this object @object) - { - return Assert.IsType(@object); - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The object to be evaluated - /// The type the object should be - /// Thrown when the object is not the given type - public static void ShouldBeType(this object @object, - Type expectedType) - { - Assert.IsType(expectedType, @object); - } - - /// - /// Verifies that an object is of the given type or a derived type - /// - /// The type the object should implement - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T ShouldImplement(this object @object) - { - return Assert.IsAssignableFrom(@object); - } - - /// - /// Verifies that an object is of the given type or a derived type - /// - /// The object to be evaluated - /// The type the object should implement - /// Thrown when the object is not the given type - public static void ShouldImplement(this object @object, - Type expectedType) - { - Assert.IsAssignableFrom(expectedType, @object); - } - - /// - /// Verifies that an object is of the given type or a derived type - /// - /// The type the object should implement - /// The object to be evaluated - /// The user message to show on failure - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T ShouldImplement(this object @object, string userMessage) - { - return Assert.IsAssignableFrom(@object, userMessage); - } - - /// - /// Verifies that an object is of the given type or a derived type - /// - /// The object to be evaluated - /// The type the object should implement - /// The user message to show on failure - /// Thrown when the object is not the given type - public static void ShouldImplement(this object @object, - Type expectedType, - string userMessage) - { - Assert.IsAssignableFrom(expectedType, @object, userMessage); - } - - /// - /// Verifies that two objects are equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The value to be compared against - /// The expected value - /// Thrown when the objects are not equal - public static void ShouldEqual(this T actual, - T expected) - { - Assert.Equal(expected, actual); - } - - /// - /// Verifies that two objects are equal, using a default comparer, with a custom error message - /// - /// The type of the objects to be compared - /// The value to be compared against - /// The expected value - /// The user message to show on failure - /// Thrown when the objects are not equal - public static void ShouldEqual(this T actual, - T expected, - string userMessage) - { - Assert.Equal(expected, actual, userMessage); - } - - /// - /// Verifies that two objects are equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The value to be compared against - /// The expected value - /// The comparer used to compare the two objects - /// Thrown when the objects are not equal - public static void ShouldEqual(this T actual, - T expected, - IEqualityComparer comparer) - { - Assert.Equal(expected, actual, comparer); - } - - /// - /// Verifies that a value is not within a given range, using the default comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is in the given range - public static void ShouldNotBeInRange(this T actual, - T low, - T high) - { - Assert.NotInRange(actual, low, high); - } - - /// - /// Verifies that a value is not within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is in the given range - public static void ShouldNotBeInRange(this T actual, - T low, - T high, - IComparer comparer) - { - Assert.NotInRange(actual, low, high, comparer); - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// Thrown when the object is not null - public static T ShouldNotBeNull(this T @object) where T : class - { - Assert.NotNull(@object); - return @object; - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// The message to show on failure - /// Thrown when the object reference is null - public static T ShouldNotBeNull(this T @object, string message) where T : class - { - Assert.NotNull(@object, message); - return @object; - } - - - /// - /// Verifies that two objects are not the same instance. - /// - /// The actual object instance - /// The expected object instance - /// Thrown when the objects are the same instance - public static void ShouldNotBeSameAs(this object actual, - object expected) - { - Assert.NotSame(expected, actual); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public static void ShouldNotBeType(this object @object) - { - Assert.IsNotType(@object); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The object to be evaluated - /// The type the object should not be - /// Thrown when the object is the given type - public static void ShouldNotBeType(this object @object, - Type expectedType) - { - Assert.IsNotType(expectedType, @object); - } - - /// - /// Verifies that two objects are not equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The actual object - /// The expected object - /// Thrown when the objects are equal - public static void ShouldNotEqual(this T actual, - T expected) - { - Assert.NotEqual(expected, actual); - } - - /// - /// Verifies that two objects are not equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The actual object - /// The expected object - /// The comparer used to examine the objects - /// Thrown when the objects are equal - public static void ShouldNotEqual(this T actual, - T expected, - IEqualityComparer comparer) - { - Assert.NotEqual(expected, actual, comparer); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/Should/should/StringAssertionExtensions.cs b/src/UnitTests/Should/should/StringAssertionExtensions.cs deleted file mode 100644 index 9432135f21..0000000000 --- a/src/UnitTests/Should/should/StringAssertionExtensions.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should -{ - /// - /// Extensions which provide assertions to classes derived from . - /// - public static class StringAssertionExtensions - { - /// - /// Verifies that a string contains a given sub-string, using the current culture. - /// - /// The string to be inspected - /// The sub-string expected to be in the string - /// Thrown when the sub-string is not present inside the string - public static int ShouldContain(this string actualString, - string expectedSubString) - { - return Assert.Contains(expectedSubString, actualString); - } - - /// - /// Verifies that a string contains a given sub-string, using the given comparison type. - /// - /// The string to be inspected - /// The sub-string expected to be in the string - /// The type of string comparison to perform - /// Thrown when the sub-string is not present inside the string - public static void ShouldContain(this string actualString, - string expectedSubString, - StringComparison comparisonType) - { - Assert.Contains(expectedSubString, actualString, comparisonType); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The string to be inspected - /// The sub-string which is expected not to be in the string - /// Thrown when the sub-string is present inside the string - public static void ShouldNotContain(this string actualString, - string expectedSubString) - { - Assert.DoesNotContain(expectedSubString, actualString); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The string to be inspected - /// The sub-string which is expected not to be in the string - /// The type of string comparison to perform - /// Thrown when the sub-string is present inside the given string - public static void ShouldNotContain(this string actualString, - string expectedSubString, - StringComparison comparisonType) - { - Assert.DoesNotContain(expectedSubString, actualString, comparisonType); - } - - public static void ShouldStartWith(this string actualString, - string expectedStartString) - { - Assert.StartsWith(expectedStartString, actualString); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/ShouldMapMethod.cs b/src/UnitTests/ShouldMapMethod.cs new file mode 100644 index 0000000000..6f404dfb16 --- /dev/null +++ b/src/UnitTests/ShouldMapMethod.cs @@ -0,0 +1,141 @@ +using Xunit; +using Shouldly; +using System; + +namespace AutoMapper.UnitTests +{ + public class ShouldMapMethodInstanceMethods : NonValidatingSpecBase + { + public int SomeValue = 2354; + public int AnotherValue = 6798; + + private Destination _destination; + + class Source + { + private int _someValue; + private int _anotherValue; + + public Source(int someValue, int anotherValue) + { + _someValue = someValue; + anotherValue = _anotherValue; + } + + public int SomeNumber() + { + return _someValue; + } + + public int AnotherNumber() { + return _anotherValue; + } + } + + class Destination + { + public int SomeNumber { get; set; } + public int AnotherNumber { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ShouldMapMethod = (m => m.Name != nameof(Source.AnotherNumber)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source(SomeValue, AnotherValue)); + } + + [Fact] + public void Should_report_unmapped_property() + { + new Action(() => Configuration.AssertConfigurationIsValid()) + .ShouldThrowException(ex => + { + ex.Errors.ShouldNotBeNull(); + ex.Errors.ShouldNotBeEmpty(); + ex.Errors[0].UnmappedPropertyNames.ShouldNotBeNull(); + ex.Errors[0].UnmappedPropertyNames.ShouldNotBeEmpty(); + ex.Errors[0].UnmappedPropertyNames[0].ShouldBe(nameof(Destination.AnotherNumber)); + }); + } + + [Fact] + public void Should_not_map_another_number_method() + { + _destination.SomeNumber.ShouldBe(SomeValue); + _destination.AnotherNumber.ShouldNotBe(AnotherValue); + } + } + + + static class SourceExtensions + { + public static int SomeNumber(this ShouldMapMethodExtensionMethods.Source source) + { + return source.SomeValue; + } + + public static int AnotherNumber(this ShouldMapMethodExtensionMethods.Source source) + { + return source.AnotherValue; + } + } + + public class ShouldMapMethodExtensionMethods : NonValidatingSpecBase + { + public int SomeValue = 4698; + public int AnotherValue = 2374; + + private Destination _destination; + + public class Source + { + public int SomeValue { get; set; } + public int AnotherValue { get; set; } + } + + public class Destination + { + public int SomeNumber { get; set; } + public int AnotherNumber { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.IncludeSourceExtensionMethods(typeof(SourceExtensions)); + cfg.ShouldMapMethod = (m => m.Name != nameof(SourceExtensions.AnotherNumber)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { SomeValue = SomeValue, AnotherValue = AnotherValue }); + } + + [Fact] + public void Should_report_unmapped_property() + { + new Action(() => Configuration.AssertConfigurationIsValid()) + .ShouldThrowException(ex => + { + ex.Errors.ShouldNotBeNull(); + ex.Errors.ShouldNotBeEmpty(); + ex.Errors[0].UnmappedPropertyNames.ShouldNotBeNull(); + ex.Errors[0].UnmappedPropertyNames.ShouldNotBeEmpty(); + ex.Errors[0].UnmappedPropertyNames[0].ShouldBe(nameof(Destination.AnotherNumber)); + }); + } + + [Fact] + public void Should_not_map_another_number_method() + { + _destination.SomeNumber.ShouldBe(SomeValue); + _destination.AnotherNumber.ShouldNotBe(AnotherValue); + } + } + +} \ No newline at end of file diff --git a/src/UnitTests/ShouldUseConstructor.cs b/src/UnitTests/ShouldUseConstructor.cs new file mode 100644 index 0000000000..474e56971a --- /dev/null +++ b/src/UnitTests/ShouldUseConstructor.cs @@ -0,0 +1,160 @@ +using System.Linq; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class ShouldUseConstructorInternal : NonValidatingSpecBase + { + class Destination + { + internal Destination(int a, string b) + { + } + + public int A { get; } + + public string B { get; } + + public Destination(int a) + { + + } + + private Destination() + { + } + } + + class Source + { + public int A { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration( + cfg => + { + cfg.ShouldUseConstructor = c => c.IsAssembly; + cfg.CreateMap(); + }); + + [Fact] + public void Should_only_map_internal_ctor() + { + Should.Throw(() => + Configuration.AssertConfigurationIsValid()); + } + } + + public class ShouldUseConstructorPrivate : NonValidatingSpecBase + { + + class Destination + { + private Destination(int a, string b) + { + } + + public int A { get; } + + public string B { get; } + + internal Destination(int a) + { + + } + + public Destination() + { + } + } + + class Source + { + public int A { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration( + cfg => + { + cfg.ShouldUseConstructor = c => c.IsPrivate; + cfg.CreateMap(); + }); + + [Fact] + public void Should_only_map_private_ctor() + { + Should.Throw(() => + Configuration.AssertConfigurationIsValid()); + } + } + + public class ShouldUseConstructorPublic : NonValidatingSpecBase + { + class Destination + { + public Destination(int a, string b) + { + } + + public int A { get; } + + public string B { get; } + + internal Destination(int a) + { + + } + + private Destination() + { + } + } + + class Source + { + public int A { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration( + cfg => + { + cfg.ShouldUseConstructor = c => c.IsPublic; + cfg.CreateMap(); + }); + + [Fact] + public void Should_only_map_public_ctor() + { + Should.Throw(() => + Configuration.AssertConfigurationIsValid()); + } + } + + + public class ShouldUseConstructorDefault : AutoMapperSpecBase + { + class Destination + { + public Destination(int a, string b) + { + } + + public int A { get; } + + public string B { get; } + + private Destination() + { + } + } + + class Source + { + public int A { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = + new MapperConfiguration(cfg => { cfg.CreateMap(); }); + } +} diff --git a/src/UnitTests/StaticMapping.cs b/src/UnitTests/StaticMapping.cs index b2d7dc97c3..1db2265295 100644 --- a/src/UnitTests/StaticMapping.cs +++ b/src/UnitTests/StaticMapping.cs @@ -1,12 +1,58 @@ namespace AutoMapper.UnitTests { using System.Linq; - using Should; + using Shouldly; using Xunit; using QueryableExtensions; + using System; + [Collection(nameof(StaticMapping))] public class StaticMapping { + public class ModelObject + { + public string Foo { get; set; } + public string Barr { get; set; } + } + + public class ModelDto + { + public string Foo { get; set; } + public string Bar { get; set; } + } + + public class ModelObject2 + { + public string Foo { get; set; } + public string Barr { get; set; } + } + + public class ModelDto2 + { + public string Foo { get; set; } + public string Bar { get; set; } + public string Bar1 { get; set; } + public string Bar2 { get; set; } + public string Bar3 { get; set; } + public string Bar4 { get; set; } + } + + public class ModelObject3 + { + public string Foo { get; set; } + public string Bar { get; set; } + public string Bar1 { get; set; } + public string Bar2 { get; set; } + public string Bar3 { get; set; } + public string Bar4 { get; set; } + } + + public class ModelDto3 + { + public string Foo { get; set; } + public string Bar { get; set; } + } + public class Source { public int Value { get; set; } @@ -17,36 +63,77 @@ public class Dest public int Value { get; set; } } + private void InitializeMapping() + { + lock (this) + { + Mapper.Reset(); + Mapper.Initialize(cfg => + { + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(MemberList.Source); + }); + } + } + [Fact] public void Can_map_statically() { - Mapper.Initialize(cfg => - { - cfg.CreateMap(); - }); + InitializeMapping(); var source = new Source {Value = 5}; var dest = Mapper.Map(source); - dest.Value.ShouldEqual(source.Value); + dest.Value.ShouldBe(source.Value); } [Fact] public void Can_project_statically() { - Mapper.Initialize(cfg => - { - cfg.CreateMap(); - }); + InitializeMapping(); var source = new Source {Value = 5}; var sources = new[] {source}.AsQueryable(); var dests = sources.ProjectTo().ToArray(); - dests.Length.ShouldEqual(1); - dests[0].Value.ShouldEqual(source.Value); - } + dests.Length.ShouldBe(1); + dests[0].Value.ShouldBe(source.Value); + } + + [Fact] + public void Should_fail_a_configuration_check() + { + InitializeMapping(); + + typeof(AutoMapperConfigurationException).ShouldBeThrownBy(Mapper.AssertConfigurationIsValid); + } + + [Fact] + public void Should_throw_when_initializing_twice() + { + typeof(InvalidOperationException).ShouldBeThrownBy(() => + { + Mapper.Initialize(_ => { }); + Mapper.Initialize(_ => { }); + }); + } + + [Fact] + public void Should_not_throw_when_resetting() + { + var action = new Action(() => + { + Mapper.Reset(); + Mapper.Initialize(cfg => { }); + Mapper.Reset(); + Mapper.Initialize(cfg => { }); + }); + action.ShouldNotThrow(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/TesterExtensions.cs b/src/UnitTests/TesterExtensions.cs index a3b1a16e5a..7b9b241afa 100644 --- a/src/UnitTests/TesterExtensions.cs +++ b/src/UnitTests/TesterExtensions.cs @@ -1,15 +1,15 @@ -using System.Collections.Generic; -using System.Linq; -using Should; - -namespace AutoMapper.UnitTests -{ - public static class StopgapNBehaveExtensions - { - public static void ShouldBeOfLength(this IEnumerable collection, int length) - { - collection.ShouldNotBeNull(); - collection.Count().ShouldEqual(length); - } - } +using System.Collections.Generic; +using System.Linq; +using Shouldly; + +namespace AutoMapper.UnitTests +{ + public static class StopgapNBehaveExtensions + { + public static void ShouldBeOfLength(this IEnumerable collection, int length) + { + collection.ShouldNotBeNull(); + collection.Count().ShouldBe(length); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Tests/MapToTest.cs b/src/UnitTests/Tests/MapToTest.cs new file mode 100644 index 0000000000..4124a59099 --- /dev/null +++ b/src/UnitTests/Tests/MapToTest.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections; +using Xunit; + +namespace AutoMapper.UnitTests.Tests +{ + /// + /// 对象扩展类 + /// + public static class ObjectExtensions + { + /// + /// 对象映射 + /// + /// 映射到指定类型 + /// 对象 + /// + public static T MapTo(this object source) + { + if (source == null) + { + throw new System.ArgumentNullException(nameof(source)); + } + var cfg = new MapperConfiguration(config => + { + if (source is IEnumerable listSource) + { + foreach (var item in listSource) + { + config.CreateMap(item.GetType(), typeof(T)); + break; + } + } + else + { + config.CreateMap(source.GetType(), typeof(T)); + } + + config.CreateMissingTypeMaps = true; + config.ValidateInlineMaps = false; + + //? 目标测试属性 + config.AllowNullDestinationValues = false; + }); + + var mapper = cfg.CreateMapper(); + + return mapper.Map(source); + } + } + /// + /// 字符串映射对象 + /// + public class StringPropMap + { + /// + /// 主键 + /// + public long Id { get; set; } + /// + /// 名称 + /// + public string Name { get; set; } + } + + /// + /// MapTo测试 + /// + public class MapToTest + { + [Fact] + public void MapTo() + { + var source = new + { + Id = DateTime.Now.Ticks + }; + + var value = source.MapTo(); + } + } +} diff --git a/src/UnitTests/Tests/MapperTests.cs b/src/UnitTests/Tests/MapperTests.cs index 763e60828f..512b2c9966 100644 --- a/src/UnitTests/Tests/MapperTests.cs +++ b/src/UnitTests/Tests/MapperTests.cs @@ -1,26 +1,26 @@ -using Xunit; -using Should; - -namespace AutoMapper.UnitTests.Tests -{ - public class MapperTests : SpecBase - { - public class Source - { - - } - - public class Destination - { - - } - - [Fact] - public void Should_find_configured_type_map_when_two_types_are_configured() - { - var config = new MapperConfiguration(cfg => cfg.CreateMap()); - - config.FindTypeMapFor().ShouldNotBeNull(); - } - } +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.Tests +{ + public class MapperTests : SpecBase + { + public class Source + { + + } + + public class Destination + { + + } + + [Fact] + public void Should_find_configured_type_map_when_two_types_are_configured() + { + var config = new MapperConfiguration(cfg => cfg.CreateMap()); + + config.FindTypeMapFor().ShouldNotBeNull(); + } + } } \ No newline at end of file diff --git a/src/UnitTests/Tests/TypeInfoSpecs.cs b/src/UnitTests/Tests/TypeInfoSpecs.cs index 22b30083e9..a8398ea9cb 100644 --- a/src/UnitTests/Tests/TypeInfoSpecs.cs +++ b/src/UnitTests/Tests/TypeInfoSpecs.cs @@ -1,7 +1,7 @@ -namespace AutoMapper.UnitTests.Tests -{ - public class TypeInfoSpecs - { - - } +namespace AutoMapper.UnitTests.Tests +{ + public class TypeInfoSpecs + { + + } } \ No newline at end of file diff --git a/src/UnitTests/Tests/TypeMapFactorySpecs.cs b/src/UnitTests/Tests/TypeMapFactorySpecs.cs index e4de6da28e..ae200ca75b 100644 --- a/src/UnitTests/Tests/TypeMapFactorySpecs.cs +++ b/src/UnitTests/Tests/TypeMapFactorySpecs.cs @@ -1,235 +1,223 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text.RegularExpressions; -using Xunit; -using Should; -using AutoMapper.Configuration.Conventions; - -namespace AutoMapper.UnitTests.Tests -{ - using System; - using Assembly = System.Reflection.Assembly; - - public class StubNamingConvention : INamingConvention - { - private readonly Func _replaceFunc; - - public StubNamingConvention(Func replaceFunc) - { - _replaceFunc = replaceFunc; - SeparatorCharacter = ""; - } - - public Regex SplittingExpression { get; set; } - public string SeparatorCharacter { get; set; } - - public string ReplaceValue(Match match) - { - return _replaceFunc(match); - } - } - - public class When_constructing_type_maps_with_matching_property_names : SpecBase - { - private TypeMapFactory _factory; - - public class Source - { - public int Value { get; set; } - public int SomeOtherValue { get; set; } - } - - public class Destination - { - public int Value { get; set; } - public int SomeOtherValue { get; set; } - } - - protected override void Establish_context() - { - _factory = new TypeMapFactory(); - } - - private class TestProfile : Profile - { - public override string ProfileName => "Test"; - - protected override void Configure() - { - - } - } - - [Fact] - public void Should_map_properties_with_same_name() - { - var mappingOptions = new TestProfile(); - //mappingOptions.SourceMemberNamingConvention = new PascalCaseNamingConvention(); - //mappingOptions.DestinationMemberNamingConvention = new PascalCaseNamingConvention(); - - var typeMap = _factory.CreateTypeMap(typeof(Source), typeof(Destination), mappingOptions, MemberList.Destination); - - var propertyMaps = typeMap.GetPropertyMaps(); - - propertyMaps.Count().ShouldEqual(2); - } - } - - public class When_using_a_custom_source_naming_convention : SpecBase - { - private TypeMapFactory _factory; - private TypeMap _map; - private Profile _mappingOptions; - - private class Source - { - public SubSource some__source { get; set; } - } - - private class SubSource - { - public int value { get; set; } - } - - private class Destination - { - public int SomeSourceValue { get; set; } - } - - private class TestProfile : Profile - { - public override string ProfileName => "Test"; - - protected override void Configure() - { - - } - } - protected override void Establish_context() - { - var namingConvention = new StubNamingConvention(s => s.Value.ToLower()){SeparatorCharacter = "__", SplittingExpression = new Regex(@"[\p{Ll}\p{Lu}0-9]+(?=__?)")}; - - _mappingOptions = new TestProfile(); - _mappingOptions.AddMemberConfiguration().AddMember(_ => - { - _.SourceMemberNamingConvention = namingConvention; - _.DestinationMemberNamingConvention = new PascalCaseNamingConvention(); - }); - - _factory = new TypeMapFactory(); - - } - - protected override void Because_of() - { - _map = _factory.CreateTypeMap(typeof(Source), typeof(Destination), _mappingOptions, MemberList.Destination); - } - - [Fact] - public void Should_split_using_naming_convention_rules() - { - _map.GetPropertyMaps().Count().ShouldEqual(1); - } - } - - public class When_using_a_custom_destination_naming_convention : SpecBase - { - private TypeMapFactory _factory; - private TypeMap _map; - private Profile _mappingOptions; - - private class Source - { - public SubSource SomeSource { get; set; } - } - - private class SubSource - { - public int Value { get; set; } - } - - private class Destination - { - public int some__source__value { get; set; } - } - - private class TestProfile : Profile - { - public override string ProfileName => "Test"; - - protected override void Configure() - { - - } - } - - protected override void Establish_context() - { - var namingConvention = new StubNamingConvention(s => s.Value.ToLower()) { SeparatorCharacter = "__", SplittingExpression = new Regex(@"[\p{Ll}\p{Lu}0-9]+(?=__?)") }; - - _mappingOptions = new TestProfile(); - _mappingOptions.AddMemberConfiguration().AddMember(_ => - { - _.SourceMemberNamingConvention = new PascalCaseNamingConvention(); - _.DestinationMemberNamingConvention = namingConvention; - }); - - _factory = new TypeMapFactory(); - } - - protected override void Because_of() - { - _map = _factory.CreateTypeMap(typeof(Source), typeof(Destination), _mappingOptions, MemberList.Destination); - } - - [Fact] - public void Should_split_using_naming_convention_rules() - { - _map.GetPropertyMaps().Count().ShouldEqual(1); - } - } - - public class When_using_a_source_member_name_replacer : SpecBase - { - private TypeMapFactory _factory; - - public class Source - { - public int Value { get; set; } - public int vator { get; set; } - public int SubAirlinaFlight { get; set; } - } - - public class Destination - { - public int Value { get; set; } - public int Aviator { get; set; } - public int SubAirlineFlight { get; set; } - } - - protected override void Establish_context() - { - _factory = new TypeMapFactory(); - } - - [Fact] - public void Should_map_properties_with_different_names() - { - var config = new MapperConfiguration(cfg => - { - cfg.ReplaceMemberName("A", ""); - cfg.ReplaceMemberName("i", ""); - cfg.ReplaceMemberName("Airline", "Airlina"); - cfg.CreateMap(); - }); - - var mapper = config.CreateMapper(); - var dest = mapper.Map(new Source {vator = 3, SubAirlinaFlight = 4, Value = 5}); - dest.Aviator.ShouldEqual(3); - dest.SubAirlineFlight.ShouldEqual(4); - dest.Value.ShouldEqual(5); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; +using Xunit; +using Shouldly; +using AutoMapper.Configuration.Conventions; + +namespace AutoMapper.UnitTests.Tests +{ + using System; + using Assembly = System.Reflection.Assembly; + + public class StubNamingConvention : INamingConvention + { + private readonly Func _replaceFunc; + + public StubNamingConvention(Func replaceFunc) + { + _replaceFunc = replaceFunc; + SeparatorCharacter = ""; + } + + public Regex SplittingExpression { get; set; } + public string SeparatorCharacter { get; set; } + + public string ReplaceValue(Match match) + { + return _replaceFunc(match); + } + } + + public class When_constructing_type_maps_with_matching_property_names : SpecBase + { + private TypeMapFactory _factory; + + public class Source + { + public int Value { get; set; } + public int SomeOtherValue { get; set; } + } + + public class Destination + { + public int Value { get; set; } + public int SomeOtherValue { get; set; } + } + + protected override void Establish_context() + { + _factory = new TypeMapFactory(); + } + + private class TestProfile : Profile + { + public override string ProfileName => "Test"; + } + + [Fact] + public void Should_map_properties_with_same_name() + { + var mappingOptions = new TestProfile(); + //mappingOptions.SourceMemberNamingConvention = new PascalCaseNamingConvention(); + //mappingOptions.DestinationMemberNamingConvention = new PascalCaseNamingConvention(); + var profile = new ProfileMap(mappingOptions); + + var typeMap = _factory.CreateTypeMap(typeof(Source), typeof(Destination), profile); + + var propertyMaps = typeMap.PropertyMaps; + + propertyMaps.Count().ShouldBe(2); + } + } + + public class When_using_a_custom_source_naming_convention : SpecBase + { + private TypeMapFactory _factory; + private TypeMap _map; + private ProfileMap _mappingOptions; + + private class Source + { + public SubSource some__source { get; set; } + } + + private class SubSource + { + public int value { get; set; } + } + + private class Destination + { + public int SomeSourceValue { get; set; } + } + + private class TestProfile : Profile + { + public override string ProfileName => "Test"; + } + protected override void Establish_context() + { + var namingConvention = new StubNamingConvention(s => s.Value.ToLower()){SeparatorCharacter = "__", SplittingExpression = new Regex(@"[\p{Ll}\p{Lu}0-9]+(?=__?)")}; + + var profile = new TestProfile(); + profile.AddMemberConfiguration().AddMember(_ => + { + _.SourceMemberNamingConvention = namingConvention; + _.DestinationMemberNamingConvention = new PascalCaseNamingConvention(); + }); + _mappingOptions = new ProfileMap(profile); + + _factory = new TypeMapFactory(); + + } + + protected override void Because_of() + { + _map = _factory.CreateTypeMap(typeof(Source), typeof(Destination), _mappingOptions); + } + + [Fact] + public void Should_split_using_naming_convention_rules() + { + _map.PropertyMaps.Count().ShouldBe(1); + } + } + + public class When_using_a_custom_destination_naming_convention : SpecBase + { + private TypeMapFactory _factory; + private TypeMap _map; + private ProfileMap _mappingOptions; + + private class Source + { + public SubSource SomeSource { get; set; } + } + + private class SubSource + { + public int Value { get; set; } + } + + private class Destination + { + public int some__source__value { get; set; } + } + + private class TestProfile : Profile + { + public override string ProfileName => "Test"; + } + + protected override void Establish_context() + { + var namingConvention = new StubNamingConvention(s => s.Value.ToLower()) { SeparatorCharacter = "__", SplittingExpression = new Regex(@"[\p{Ll}\p{Lu}0-9]+(?=__?)") }; + + var profile = new TestProfile(); + profile.AddMemberConfiguration().AddMember(_ => + { + _.SourceMemberNamingConvention = new PascalCaseNamingConvention(); + _.DestinationMemberNamingConvention = namingConvention; + }); + _mappingOptions = new ProfileMap(profile); + + _factory = new TypeMapFactory(); + } + + protected override void Because_of() + { + _map = _factory.CreateTypeMap(typeof(Source), typeof(Destination), _mappingOptions); + } + + [Fact] + public void Should_split_using_naming_convention_rules() + { + _map.PropertyMaps.Count().ShouldBe(1); + } + } + + public class When_using_a_source_member_name_replacer : SpecBase + { + private TypeMapFactory _factory; + + public class Source + { + public int Value { get; set; } + public int 膙韆tor { get; set; } + public int SubAirlinaFlight { get; set; } + } + + public class Destination + { + public int Value { get; set; } + public int Aviator { get; set; } + public int SubAirlineFlight { get; set; } + } + + protected override void Establish_context() + { + _factory = new TypeMapFactory(); + } + + [Fact] + public void Should_map_properties_with_different_names() + { + var config = new MapperConfiguration(cfg => + { + cfg.ReplaceMemberName("A", "Ä"); + cfg.ReplaceMemberName("i", "í"); + cfg.ReplaceMemberName("Airline", "Airlina"); + cfg.CreateMap(); + }); + + var mapper = config.CreateMapper(); + var dest = mapper.Map(new Source {膙韆tor = 3, SubAirlinaFlight = 4, Value = 5}); + dest.Aviator.ShouldBe(3); + dest.SubAirlineFlight.ShouldBe(4); + dest.Value.ShouldBe(5); + } + } +} diff --git a/src/UnitTests/TypeConverters.cs b/src/UnitTests/TypeConverters.cs index d7c577c8fe..ffe09b5398 100644 --- a/src/UnitTests/TypeConverters.cs +++ b/src/UnitTests/TypeConverters.cs @@ -1,285 +1,456 @@ -using System; -using System.ComponentModel; -using System.Reflection; -using Should; -using Xunit; - -namespace AutoMapper.UnitTests -{ - namespace CustomMapping - { - public class When_specifying_type_converters : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public string Value1 { get; set; } - public string Value2 { get; set; } - public string Value3 { get; set; } - } - - public class Destination - { - public int Value1 { get; set; } - public DateTime Value2 { get; set; } - public Type Value3 { get; set; } - } - - public class DateTimeTypeConverter : ITypeConverter - { - public DateTime Convert(string source, ResolutionContext context) - { - return System.Convert.ToDateTime(source); - } - } - - public class TypeTypeConverter : ITypeConverter - { - public Type Convert(string source, ResolutionContext context) - { - Type type = Assembly.GetExecutingAssembly().GetType(source); - return type; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ConvertUsing((string arg) => Convert.ToInt32(arg)); - cfg.CreateMap().ConvertUsing(new DateTimeTypeConverter()); - cfg.CreateMap().ConvertUsing(); - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var source = new Source - { - Value1 = "5", - Value2 = "01/01/2000", - Value3 = "AutoMapper.UnitTests.CustomMapping.When_specifying_type_converters+Destination" - }; - - _result = Mapper.Map(source); - } - - [Fact] - public void Should_convert_type_using_expression() - { - _result.Value1.ShouldEqual(5); - } - - [Fact] - public void Should_convert_type_using_instance() - { - _result.Value2.ShouldEqual(new DateTime(2000, 1, 1)); - } - - [Fact] - public void Should_convert_type_using_Func_that_returns_instance() - { - _result.Value3.ShouldEqual(typeof(Destination)); - } - } - - public class When_specifying_type_converters_on_types_with_incompatible_members : AutoMapperSpecBase - { - private ParentDestination _result; - - public class Source - { - public string Foo { get; set; } - } - - public class Destination - { - public int Type { get; set; } - } - - public class ParentSource - { - public Source Value { get; set; } - } - - public class ParentDestination - { - public Destination Value { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ConvertUsing(arg => new Destination {Type = Convert.ToInt32(arg.Foo)}); - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - var source = new ParentSource - { - Value = new Source { Foo = "5", } - }; - - _result = Mapper.Map(source); - } - - [Fact] - public void Should_convert_type_using_expression() - { - _result.Value.Type.ShouldEqual(5); - } - } - -#if !PORTABLE - public class When_specifying_mapping_with_the_BCL_type_converter_class : NonValidatingSpecBase - { - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); - - [TypeConverter(typeof(CustomTypeConverter))] - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int OtherValue { get; set; } - } - - public class CustomTypeConverter : TypeConverter - { - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - return destinationType == typeof (Destination); - } - - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) - { - return new Destination - { - OtherValue = ((Source) value).Value + 10 - }; - } - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof(Destination); - } - public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) - { - return new Source {Value = ((Destination) value).OtherValue - 10}; - } - } - - [Fact] - public void Should_convert_from_type_using_the_custom_type_converter() - { - var source = new Source - { - Value = 5 - }; - var destination = Mapper.Map(source); - - destination.OtherValue.ShouldEqual(15); - } - - [Fact] - public void Should_convert_to_type_using_the_custom_type_converter() - { - var source = new Destination() - { - OtherValue = 15 - }; - var destination = Mapper.Map(source); - - destination.Value.ShouldEqual(5); - } - } -#endif - - public class When_specifying_a_type_converter_for_a_non_generic_configuration : NonValidatingSpecBase - { - private Destination _result; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int OtherValue { get; set; } - } - - public class CustomConverter : ITypeConverter - { - public Destination Convert(Source source, ResolutionContext context) - { - return new Destination - { - OtherValue = source.Value + 10 - }; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof (Source), typeof (Destination)).ConvertUsing(); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Value = 5}); - } - - [Fact] - public void Should_use_converter_specified() - { - _result.OtherValue.ShouldEqual(15); - } - } - - public class When_specifying_a_non_generic_type_converter_for_a_non_generic_configuration : AutoMapperSpecBase - { - private Destination _result; - - public class Source - { - public int Value { get; set; } - } - - public class Destination - { - public int OtherValue { get; set; } - } - - public class CustomConverter : ITypeConverter - { - public Destination Convert(Source source, ResolutionContext context) - { - return new Destination - { - OtherValue = source.Value + 10 - }; - } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(typeof (Source), typeof (Destination)).ConvertUsing(typeof (CustomConverter)); - }); - - protected override void Because_of() - { - _result = Mapper.Map(new Source {Value = 5}); - } - - [Fact] - public void Should_use_converter_specified() - { - _result.OtherValue.ShouldEqual(15); - } - } - - } -} +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Reflection; +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests.CustomMapping +{ + public class NullableConverter : AutoMapperSpecBase + { + public enum GreekLetters + { + Alpha = 11, + Beta = 12, + Gamma = 13 + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.CreateMap().ConvertUsing(n => n == null ? GreekLetters.Beta : GreekLetters.Gamma); + }); + + [Fact] + public void Should_map_nullable() + { + Mapper.Map(null).ShouldBe(GreekLetters.Beta); + Mapper.Map(42).ShouldBe(GreekLetters.Gamma); + } + } + + public class MissingConverter : AutoMapperSpecBase + { + protected override MapperConfiguration Configuration => new MapperConfiguration(c => + { + c.ConstructServicesUsing(t => null); + c.CreateMap().ConvertUsing>(); + }); + + [Fact] + public void Should_report_the_missing_converter() + { + new Action(()=>Mapper.Map(0)) + .ShouldThrowException(e=>e.Message.ShouldBe("Cannot create an instance of type AutoMapper.ITypeConverter`2[System.Int32,System.Int32]")); + } + } + + public class DecimalAndNullableDecimal : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public decimal Value1 { get; set; } + public decimal? Value2 { get; set; } + public decimal? Value3 { get; set; } + } + + class Destination + { + public decimal? Value1 { get; set; } + public decimal Value2 { get; set; } + public decimal? Value3 { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap().ConvertUsing(source => source ?? decimal.MaxValue); + cfg.CreateMap().ConvertUsing(source => source == decimal.MaxValue ? new decimal?() : source); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Value1 = decimal.MaxValue }); + } + + + [Fact] + public void Should_treat_max_value_as_null() + { + _destination.Value1.ShouldBeNull(); + _destination.Value2.ShouldBe(decimal.MaxValue); + _destination.Value3.ShouldBeNull(); + } + } + + public class When_converting_to_string : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public Id TheId { get; set; } + } + + class Destination + { + public string TheId { get; set; } + } + + interface IId + { + string Serialize(); + } + + class Id : IId + { + public string Prefix { get; set; } + + public string Value { get; set; } + + public string Serialize() + { + return Prefix + "_" + Value; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.CreateMap().ConvertUsing(id => id.Serialize()); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { TheId = new Id { Prefix = "p", Value = "v" } }); + } + + [Fact] + public void Should_use_the_type_converter() + { + _destination.TheId.ShouldBe("p_v"); + } + } + + public class When_specifying_type_converters_for_object_mapper_types : AutoMapperSpecBase + { + Destination _destination; + + class Source + { + public IDictionary Values { get; set; } + } + + class Destination + { + public IDictionary Values { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(IDictionary<,>), typeof(IDictionary<,>)).ConvertUsing(typeof(DictionaryConverter<,>)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source { Values = new Dictionary() }); + } + + [Fact] + public void Should_override_the_built_in_mapper() + { + _destination.Values.ShouldBeSameAs(DictionaryConverter.Instance); + } + + private class DictionaryConverter : ITypeConverter, IDictionary> + { + public static readonly IDictionary Instance = new Dictionary(); + + public IDictionary Convert(IDictionary source, IDictionary destination, ResolutionContext context) + { + return Instance; + } + } + } + + public class When_specifying_type_converters : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } + } + + public class Destination + { + public int Value1 { get; set; } + public DateTime Value2 { get; set; } + public Type Value3 { get; set; } + } + + public class DateTimeTypeConverter : ITypeConverter + { + public DateTime Convert(string source, DateTime destination, ResolutionContext context) + { + return System.Convert.ToDateTime(source); + } + } + + public class TypeTypeConverter : ITypeConverter + { + public Type Convert(string source, Type destination, ResolutionContext context) + { + Type type = typeof(TypeTypeConverter).Assembly().GetType(source); + return type; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing((string arg) => Convert.ToInt32(arg)); + cfg.CreateMap().ConvertUsing(new DateTimeTypeConverter()); + cfg.CreateMap().ConvertUsing(); + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var source = new Source + { + Value1 = "5", + Value2 = "01/01/2000", + Value3 = "AutoMapper.UnitTests.CustomMapping.When_specifying_type_converters+Destination" + }; + + _result = Mapper.Map(source); + } + + [Fact] + public void Should_convert_type_using_expression() + { + _result.Value1.ShouldBe(5); + } + + [Fact] + public void Should_convert_type_using_instance() + { + _result.Value2.ShouldBe(new DateTime(2000, 1, 1)); + } + + [Fact] + public void Should_convert_type_using_Func_that_returns_instance() + { + _result.Value3.ShouldBe(typeof(Destination)); + } + } + + public class When_specifying_type_converters_on_types_with_incompatible_members : AutoMapperSpecBase + { + private ParentDestination _result; + + public class Source + { + public string Foo { get; set; } + } + + public class Destination + { + public int Type { get; set; } + } + + public class ParentSource + { + public Source Value { get; set; } + } + + public class ParentDestination + { + public Destination Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing(arg => new Destination {Type = Convert.ToInt32(arg.Foo)}); + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + var source = new ParentSource + { + Value = new Source { Foo = "5", } + }; + + _result = Mapper.Map(source); + } + + [Fact] + public void Should_convert_type_using_expression() + { + _result.Value.Type.ShouldBe(5); + } + } + public class When_specifying_mapping_with_the_BCL_type_converter_class : NonValidatingSpecBase + { + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => { }); +#if NET461 + public When_specifying_mapping_with_the_BCL_type_converter_class() + { + // only needed for the xUnitRunner without AppDomains + AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => + { + return args.Name == typeof(CustomTypeConverter).Assembly.FullName ? typeof(CustomTypeConverter).Assembly : null; + }; + } +#endif + [TypeConverter(typeof(CustomTypeConverter))] + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int OtherValue { get; set; } + } + + public class CustomTypeConverter : TypeConverter + { + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (Destination); + } + + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) + { + return new Destination + { + OtherValue = ((Source) value).Value + 10 + }; + } + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(Destination); + } + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + { + return new Source {Value = ((Destination) value).OtherValue - 10}; + } + } + + [Fact] + public void Should_convert_from_type_using_the_custom_type_converter() + { + var source = new Source + { + Value = 5 + }; + var destination = Mapper.Map(source); + + destination.OtherValue.ShouldBe(15); + } + + [Fact] + public void Should_convert_to_type_using_the_custom_type_converter() + { + var source = new Destination() + { + OtherValue = 15 + }; + var destination = Mapper.Map(source); + + destination.Value.ShouldBe(5); + } + } + public class When_specifying_a_type_converter_for_a_non_generic_configuration : NonValidatingSpecBase + { + private Destination _result; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int OtherValue { get; set; } + } + + public class CustomConverter : ITypeConverter + { + public Destination Convert(Source source, Destination destination, ResolutionContext context) + { + return new Destination + { + OtherValue = source.Value + 10 + }; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing(); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Value = 5}); + } + + [Fact] + public void Should_use_converter_specified() + { + _result.OtherValue.ShouldBe(15); + } + } + + public class When_specifying_a_non_generic_type_converter_for_a_non_generic_configuration : AutoMapperSpecBase + { + private Destination _result; + + public class Source + { + public int Value { get; set; } + } + + public class Destination + { + public int OtherValue { get; set; } + } + + public class CustomConverter : ITypeConverter + { + public Destination Convert(Source source, Destination destination, ResolutionContext context) + { + return new Destination + { + OtherValue = source.Value + 10 + }; + } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof (Source), typeof (Destination)).ConvertUsing(typeof (CustomConverter)); + }); + + protected override void Because_of() + { + _result = Mapper.Map(new Source {Value = 5}); + } + + [Fact] + public void Should_use_converter_specified() + { + _result.OtherValue.ShouldBe(15); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/TypeExtensionsTests.cs b/src/UnitTests/TypeExtensionsTests.cs index 91b74ce288..5b0c1070ca 100644 --- a/src/UnitTests/TypeExtensionsTests.cs +++ b/src/UnitTests/TypeExtensionsTests.cs @@ -1,30 +1,30 @@ -namespace AutoMapper.UnitTests -{ - using Should; - using Xunit; - - public class TypeExtensionsTests - { - public class Foo - { - public Foo() - { - Value2 = "adsf"; - Value4 = "Fasdfadsf"; - } - - public string Value1 { get; set; } - public string Value2 { get; private set; } - protected string Value3 { get; set; } - private string Value4 { get; set; } - public string Value5 => "ASDf"; - public string Value6 { set { Value4 = value; } } - - [Fact] - public void Should_recognize_public_members() - { -// typeof(Foo).GetProperties().Length.ShouldEqual(4); - } - } - } +namespace AutoMapper.UnitTests +{ + using Shouldly; + using Xunit; + + public class TypeExtensionsTests + { + public class Foo + { + public Foo() + { + Value2 = "adsf"; + Value4 = "Fasdfadsf"; + } + + public string Value1 { get; set; } + public string Value2 { get; private set; } + protected string Value3 { get; set; } + private string Value4 { get; set; } + public string Value5 => "ASDf"; + public string Value6 { set { Value4 = value; } } + + [Fact] + public void Should_recognize_public_members() + { +// typeof(Foo).GetProperties().Length.ShouldBe(4); + } + } + } } \ No newline at end of file diff --git a/src/UnitTests/UnitTests.Net4.csproj b/src/UnitTests/UnitTests.Net4.csproj deleted file mode 100644 index 3807c2d532..0000000000 --- a/src/UnitTests/UnitTests.Net4.csproj +++ /dev/null @@ -1,367 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {002075C5-6517-4794-BC99-9B17B9E884E7} - Library - Properties - AutoMapper.UnitTests - AutoMapper.UnitTests.Net4 - v4.5 - v4.5 - 512 - false - - - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - ..\ - true - 67828423 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET4 - prompt - 4 - AllRules.ruleset - false - - - pdbonly - true - bin\Release\ - TRACE;NET4 - prompt - 4 - AllRules.ruleset - false - - - - ..\packages\Fixie.1.0.0.41\lib\net45\Fixie.dll - True - - - - False - ..\..\lib\Rhino.Mocks.dll - - - - 3.5 - - - - - - - TypeExtensions.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - - - - - - - - - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - {8c955148-fa96-4f0d-880d-abb6770f54e9} - AutoMapper.Net4 - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/UnitTests/UsingEngineInsideMap.cs b/src/UnitTests/UsingEngineInsideMap.cs index c83314ea88..ba8a4bfa66 100644 --- a/src/UnitTests/UsingEngineInsideMap.cs +++ b/src/UnitTests/UsingEngineInsideMap.cs @@ -1,49 +1,49 @@ -namespace AutoMapper.UnitTests -{ - using Should; - using Xunit; - - public class UsingEngineInsideMap : AutoMapperSpecBase - { - private Dest _dest; - - public class Source - { - public int Foo { get; set; } - } - - public class Dest - { - public int Foo { get; set; } - public ChildDest Child { get; set; } - } - - public class ChildDest - { - public int Foo { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap() - .ForMember(dest => dest.Child, - opt => - opt.ResolveUsing( - (src, context) => - context.Mapper.Map(src, context.DestinationValue, typeof (Source), typeof (ChildDest), context))); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _dest = Mapper.Map(new Source {Foo = 5}); - } - - [Fact] - public void Should_map_child_property() - { - _dest.Child.ShouldNotBeNull(); - _dest.Child.Foo.ShouldEqual(5); - } - } +namespace AutoMapper.UnitTests +{ + using Shouldly; + using Xunit; + + public class UsingEngineInsideMap : AutoMapperSpecBase + { + private Dest _dest; + + public class Source + { + public int Foo { get; set; } + } + + public class Dest + { + public int Foo { get; set; } + public ChildDest Child { get; set; } + } + + public class ChildDest + { + public int Foo { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(dest => dest.Child, + opt => + opt.MapFrom( + (src, dest, destMember, context) => + context.Mapper.Map(src, destMember, typeof (Source), typeof (ChildDest), context))); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _dest = Mapper.Map(new Source {Foo = 5}); + } + + [Fact] + public void Should_map_child_property() + { + _dest.Child.ShouldNotBeNull(); + _dest.Child.Foo.ShouldBe(5); + } + } } \ No newline at end of file diff --git a/src/UnitTests/ValueConverters.cs b/src/UnitTests/ValueConverters.cs new file mode 100644 index 0000000000..20dd1c57a1 --- /dev/null +++ b/src/UnitTests/ValueConverters.cs @@ -0,0 +1,644 @@ +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class ValueConverters + { + public class When_specifying_value_converter_for_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } + public string Value4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value1, opt => opt.ConvertUsing()) + .ForMember(d => d.Value2, opt => opt.ConvertUsing()) + .ForMember(d => d.Value3, opt => opt.ConvertUsing()) + .ForMember(d => d.Value4, opt => opt.ConvertUsing()); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.Value1.ShouldBe("00000001"); + dest.Value2.ShouldBe("00000002"); + dest.Value3.ShouldBe("0003"); + dest.Value4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_for_non_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string ValueFoo1 { get; set; } + public string ValueFoo2 { get; set; } + public string ValueFoo3 { get; set; } + public string ValueFoo4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.ValueFoo1, opt => opt.ConvertUsing(src => src.Value1)) + .ForMember(d => d.ValueFoo2, opt => opt.ConvertUsing(src => src.Value2)) + .ForMember(d => d.ValueFoo3, opt => opt.ConvertUsing(src => src.Value3)) + .ForMember(d => d.ValueFoo4, opt => opt.ConvertUsing(src => src.Value4)); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.ValueFoo1.ShouldBe("00000001"); + dest.ValueFoo2.ShouldBe("00000002"); + dest.ValueFoo3.ShouldBe("0003"); + dest.ValueFoo4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_for_string_based_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } + public string Value4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember("Value1", opt => opt.ConvertUsing()) + .ForMember("Value2", opt => opt.ConvertUsing()) + .ForMember("Value3", opt => opt.ConvertUsing()) + .ForMember("Value4", opt => opt.ConvertUsing()); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.Value1.ShouldBe("00000001"); + dest.Value2.ShouldBe("00000002"); + dest.Value3.ShouldBe("0003"); + dest.Value4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_for_string_based_non_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string ValueFoo1 { get; set; } + public string ValueFoo2 { get; set; } + public string ValueFoo3 { get; set; } + public string ValueFoo4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember("ValueFoo1", opt => opt.ConvertUsing("Value1")) + .ForMember("ValueFoo2", opt => opt.ConvertUsing("Value2")) + .ForMember("ValueFoo3", opt => opt.ConvertUsing("Value3")) + .ForMember("ValueFoo4", opt => opt.ConvertUsing("Value4")); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.ValueFoo1.ShouldBe("00000001"); + dest.ValueFoo2.ShouldBe("00000002"); + dest.ValueFoo3.ShouldBe("0003"); + dest.ValueFoo4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_for_type_and_string_based_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } + public string Value4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source), typeof(Dest)) + .ForMember("Value1", opt => opt.ConvertUsing(typeof(EightDigitIntToStringConverter))) + .ForMember("Value2", opt => opt.ConvertUsing(typeof(EightDigitIntToStringConverter))) + .ForMember("Value3", opt => opt.ConvertUsing(typeof(FourDigitIntToStringConverter))) + .ForMember("Value4", opt => opt.ConvertUsing(typeof(FourDigitIntToStringConverter))); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.Value1.ShouldBe("00000001"); + dest.Value2.ShouldBe("00000002"); + dest.Value3.ShouldBe("0003"); + dest.Value4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_for_type_and_string_based_non_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string ValueFoo1 { get; set; } + public string ValueFoo2 { get; set; } + public string ValueFoo3 { get; set; } + public string ValueFoo4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(typeof(Source), typeof(Dest)) + .ForMember("ValueFoo1", opt => opt.ConvertUsing(typeof(EightDigitIntToStringConverter), "Value1")) + .ForMember("ValueFoo2", opt => opt.ConvertUsing(typeof(EightDigitIntToStringConverter), "Value2")) + .ForMember("ValueFoo3", opt => opt.ConvertUsing(typeof(FourDigitIntToStringConverter), "Value3")) + .ForMember("ValueFoo4", opt => opt.ConvertUsing(typeof(FourDigitIntToStringConverter), "Value4")); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.ValueFoo1.ShouldBe("00000001"); + dest.ValueFoo2.ShouldBe("00000002"); + dest.ValueFoo3.ShouldBe("0003"); + dest.ValueFoo4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_instance_for_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } + public string Value4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.Value1, opt => opt.ConvertUsing(new EightDigitIntToStringConverter())) + .ForMember(d => d.Value2, opt => opt.ConvertUsing(new EightDigitIntToStringConverter())) + .ForMember(d => d.Value3, opt => opt.ConvertUsing(new FourDigitIntToStringConverter())) + .ForMember(d => d.Value4, opt => opt.ConvertUsing(new FourDigitIntToStringConverter())); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.Value1.ShouldBe("00000001"); + dest.Value2.ShouldBe("00000002"); + dest.Value3.ShouldBe("0003"); + dest.Value4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_instance_for_non_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string ValueFoo1 { get; set; } + public string ValueFoo2 { get; set; } + public string ValueFoo3 { get; set; } + public string ValueFoo4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember(d => d.ValueFoo1, opt => opt.ConvertUsing(new EightDigitIntToStringConverter(), src => src.Value1)) + .ForMember(d => d.ValueFoo2, opt => opt.ConvertUsing(new EightDigitIntToStringConverter(), src => src.Value2)) + .ForMember(d => d.ValueFoo3, opt => opt.ConvertUsing(new FourDigitIntToStringConverter(), src => src.Value3)) + .ForMember(d => d.ValueFoo4, opt => opt.ConvertUsing(new FourDigitIntToStringConverter(), src => src.Value4)); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.ValueFoo1.ShouldBe("00000001"); + dest.ValueFoo2.ShouldBe("00000002"); + dest.ValueFoo3.ShouldBe("0003"); + dest.ValueFoo4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_instance_for_string_based_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string Value1 { get; set; } + public string Value2 { get; set; } + public string Value3 { get; set; } + public string Value4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember("Value1", opt => opt.ConvertUsing(new EightDigitIntToStringConverter())) + .ForMember("Value2", opt => opt.ConvertUsing(new EightDigitIntToStringConverter())) + .ForMember("Value3", opt => opt.ConvertUsing(new FourDigitIntToStringConverter())) + .ForMember("Value4", opt => opt.ConvertUsing(new FourDigitIntToStringConverter())); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.Value1.ShouldBe("00000001"); + dest.Value2.ShouldBe("00000002"); + dest.Value3.ShouldBe("0003"); + dest.Value4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_instance_for_string_based_non_matching_member : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + public class FourDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d4"); + } + + public class Source + { + public int Value1 { get; set; } + public int Value2 { get; set; } + public int Value3 { get; set; } + public int Value4 { get; set; } + } + + public class Dest + { + public string ValueFoo1 { get; set; } + public string ValueFoo2 { get; set; } + public string ValueFoo3 { get; set; } + public string ValueFoo4 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .ForMember("ValueFoo1", opt => opt.ConvertUsing(new EightDigitIntToStringConverter(), "Value1")) + .ForMember("ValueFoo2", opt => opt.ConvertUsing(new EightDigitIntToStringConverter(), "Value2")) + .ForMember("ValueFoo3", opt => opt.ConvertUsing(new FourDigitIntToStringConverter(), "Value3")) + .ForMember("ValueFoo4", opt => opt.ConvertUsing(new FourDigitIntToStringConverter(), "Value4")); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value1 = 1, + Value2 = 2, + Value3 = 3, + Value4 = 4 + }; + + var dest = Mapper.Map(source); + + dest.ValueFoo1.ShouldBe("00000001"); + dest.ValueFoo2.ShouldBe("00000002"); + dest.ValueFoo3.ShouldBe("0003"); + dest.ValueFoo4.ShouldBe("0004"); + } + } + + public class When_specifying_value_converter_for_all_members : AutoMapperSpecBase + { + public class EightDigitIntToStringConverter : IValueConverter + { + public string Convert(int sourceMember, ResolutionContext context) + => sourceMember.ToString("d8"); + } + + public class Source + { + public int Value { get; set; } + } + + public class OtherSource + { + public int Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + public class OtherDest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ForAllPropertyMaps + (pm => pm.SourceType == typeof(int) && pm.DestinationType == typeof(string), + (pm, opt) => opt.ConvertUsing(new EightDigitIntToStringConverter())); + }); + + [Fact] + public void Should_apply_converters() + { + var source = new Source + { + Value = 1, + }; + var otherSource = new OtherSource + { + Value = 2, + }; + + var dest = Mapper.Map(source); + var otherDest = Mapper.Map(otherSource); + + dest.Value.ShouldBe("00000001"); + otherDest.Value.ShouldBe("00000002"); + } + } + + } +} \ No newline at end of file diff --git a/src/UnitTests/ValueTransformers.cs b/src/UnitTests/ValueTransformers.cs new file mode 100644 index 0000000000..8b083f9e52 --- /dev/null +++ b/src/UnitTests/ValueTransformers.cs @@ -0,0 +1,323 @@ +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + namespace ValueTransformers + { + public class BasicTransforming : AutoMapperSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + + [Fact] + public void Should_transform_value() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy is straight up dope"); + } + } + + public class StackingTransformers : AutoMapperSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ValueTransformers.Add(dest => dest + " is straight up dope"); + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + }); + + [Fact] + public void Should_stack_transformers_in_order() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy is straight up dope! No joke!"); + } + } + + public class DifferentProfiles : AutoMapperSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.ValueTransformers.Add(dest => dest + " is straight up dope"); + cfg.CreateProfile("Other", p => p.ValueTransformers.Add(dest => dest + "! No joke!")); + }); + + [Fact] + public void Should_not_apply_other_transform() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy is straight up dope"); + } + } + + public class StackingRootConfigAndProfileTransform : AutoMapperSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + cfg.CreateProfile("Other", p => + { + p.CreateMap(); + p.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + }); + + [Fact] + public void ShouldApplyProfileFirstThenRoot() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy is straight up dope! No joke!"); + } + } + + public class TransformingValueTypes : AutoMapperSpecBase + { + public class Source + { + public int Value { get; set; } + } + + public class Dest + { + public int Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest * 2); + cfg.CreateProfile("Other", p => + { + p.CreateMap(); + p.ValueTransformers.Add(dest => dest + 3); + }); + }); + + [Fact] + public void ShouldApplyProfileFirstThenRoot() + { + var source = new Source + { + Value = 5 + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe((5 + 3) * 2); + } + } + + public class StackingRootAndProfileAndMemberConfig : AutoMapperSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + cfg.CreateProfile("Other", p => + { + p.CreateMap() + .ValueTransformers.Add(dest => dest + ", for real,"); + p.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + }); + + [Fact] + public void ShouldApplyTypeMapThenProfileThenRoot() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy, for real, is straight up dope! No joke!"); + } + } + + public class StackingTypeMapAndRootAndProfileAndMemberConfig : AutoMapperSpecBase + { + public class Source + { + public string Value { get; set; } + } + + public class Dest + { + public string Value { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.ValueTransformers.Add(dest => dest + "! No joke!"); + cfg.CreateProfile("Other", p => + { + p.CreateMap() + .AddTransform(dest => dest + ", for real,") + .ForMember(d => d.Value, opt => opt.AddTransform(d => d + ", seriously")); + p.ValueTransformers.Add(dest => dest + " is straight up dope"); + }); + }); + + [Fact] + public void ShouldApplyTypeMapThenProfileThenRoot() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy, seriously, for real, is straight up dope! No joke!"); + } + } + } + public class TransformingInheritance : AutoMapperSpecBase + { + public class SourceBase + { + public string Value { get; set; } + } + + public class DestBase + { + public string Value { get; set; } + } + + public class Source : SourceBase + { + } + + public class Dest : DestBase + { + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().Include().AddTransform(dest => dest + " was cool"); + cfg.CreateMap().AddTransform(dest => dest + " and now is straight up dope"); + }); + + [Fact] + public void Should_transform_value() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy was cool and now is straight up dope"); + } + } + + public class TransformingInheritanceForMember : AutoMapperSpecBase + { + public class SourceBase + { + public string Value { get; set; } + } + + public class DestBase + { + public string Value { get; set; } + } + + public class Source : SourceBase + { + } + + public class Dest : DestBase + { + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().Include().ForMember(d => d.Value, o => o.AddTransform(dest => dest + " was cool")); + cfg.CreateMap().ForMember(d=>d.Value, o=>o.AddTransform(dest => dest + " and now is straight up dope")); + }); + + [Fact] + public void Should_transform_value() + { + var source = new Source + { + Value = "Jimmy" + }; + var dest = Mapper.Map(source); + + dest.Value.ShouldBe("Jimmy was cool and now is straight up dope"); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/ValueTypes.cs b/src/UnitTests/ValueTypes.cs index 5db828737d..fde6ac51ec 100644 --- a/src/UnitTests/ValueTypes.cs +++ b/src/UnitTests/ValueTypes.cs @@ -1,93 +1,162 @@ -using System; -using Xunit; -using Should; - -namespace AutoMapper.UnitTests -{ - namespace ValueTypes - { - public class When_destination_type_is_a_value_type : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public int Value1 { get; set; } - public string Value2 { get; set; } - } - - public struct Destination - { - public int Value1 { get; set; } - public string Value2; - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap(); - - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Value1 = 4, Value2 = "hello"}); - } - - [Fact] - public void Should_map_property_value() - { - _destination.Value1.ShouldEqual(4); - } - - [Fact] - public void Should_map_field_value() - { - _destination.Value2.ShouldEqual("hello"); - } - } - - - public class When_destination_type_is_a_nullable_value_type : AutoMapperSpecBase - { - private Destination _destination; - - public class Source - { - public string Value1 { get; set; } - public string Value2 { get; set; } - } - - public struct Destination - { - public int Value1 { get; set; } - public int? Value2 { get; set; } - } - - protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => - { - cfg.CreateMap().ConvertUsing((string s) => Convert.ToInt32(s)); - cfg.CreateMap().ConvertUsing((string s) => (int?) Convert.ToInt32(s)); - cfg.CreateMap(); - }); - - protected override void Because_of() - { - _destination = Mapper.Map(new Source {Value1 = "10", Value2 = "20"}); - } - - [Fact] - public void Should_use_map_registered_for_underlying_type() - { - _destination.Value2.ShouldEqual(20); - } - - [Fact] - public void Should_still_map_value_type() - { - _destination.Value1.ShouldEqual(10); - } - - - } - } -} +using System; +using Xunit; +using Shouldly; + +namespace AutoMapper.UnitTests.ValueTypes +{ + public class When_value_types_are_the_source_of_map_cycles : AutoMapperSpecBase + { + public struct Source + { + public InnerSource Value { get; set; } + } + + public class InnerSource + { + public Source Parent { get; set; } + } + + public struct Destination + { + public InnerDestination Value { get; set; } + } + + public class InnerDestination + { + public Destination Parent { get; set; } + } + + protected override MapperConfiguration Configuration => new MapperConfiguration(cfg=> + { + cfg.CreateMap().MaxDepth(2); + cfg.CreateMap(); + }); + + [Fact] + public void Should_work() + { + var innerSource = new InnerSource(); + var source = new Source { Value = innerSource }; + innerSource.Parent = source; + Mapper.Map(source); + } + } + + public class When_destination_type_is_a_value_type : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public int Value1 { get; set; } + public string Value2 { get; set; } + } + + public struct Destination + { + public int Value1 { get; set; } + public string Value2; + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Value1 = 4, Value2 = "hello"}); + } + + [Fact] + public void Should_map_property_value() + { + _destination.Value1.ShouldBe(4); + } + + [Fact] + public void Should_map_field_value() + { + _destination.Value2.ShouldBe("hello"); + } + } + + public class When_source_struct_config_has_custom_mappings : AutoMapperSpecBase + { + public struct matrixDigiInStruct1 + { + public ushort CNCinfo; + public ushort Reg1; + public ushort Reg2; + } + public class DigiIn1 + { + public ushort CncInfo { get; set; } + public ushort Reg1 { get; set; } + public ushort Reg2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration( + cfg => cfg.CreateMap() + .ForMember(d => d.CncInfo, x => x.MapFrom(s => s.CNCinfo))); + + [Fact] + public void Should_map_correctly() + { + var source = new matrixDigiInStruct1 + { + CNCinfo = 5, + Reg1 = 6, + Reg2 = 7 + }; + var dest = Mapper.Map(source); + + dest.CncInfo.ShouldBe(source.CNCinfo); + dest.Reg1.ShouldBe(source.Reg1); + dest.Reg2.ShouldBe(source.Reg2); + } + } + + + public class When_destination_type_is_a_nullable_value_type : AutoMapperSpecBase + { + private Destination _destination; + + public class Source + { + public string Value1 { get; set; } + public string Value2 { get; set; } + } + + public struct Destination + { + public int Value1 { get; set; } + public int? Value2 { get; set; } + } + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap().ConvertUsing((string s) => Convert.ToInt32(s)); + cfg.CreateMap().ConvertUsing((string s) => (int?) Convert.ToInt32(s)); + cfg.CreateMap(); + }); + + protected override void Because_of() + { + _destination = Mapper.Map(new Source {Value1 = "10", Value2 = "20"}); + } + + [Fact] + public void Should_use_map_registered_for_underlying_type() + { + _destination.Value2.ShouldBe(20); + } + + [Fact] + public void Should_still_map_value_type() + { + _destination.Value1.ShouldBe(10); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/When_using_ConfigurationExpression_Advanced.cs b/src/UnitTests/When_using_ConfigurationExpression_Advanced.cs new file mode 100644 index 0000000000..747bf1835e --- /dev/null +++ b/src/UnitTests/When_using_ConfigurationExpression_Advanced.cs @@ -0,0 +1,36 @@ +using Shouldly; +using Xunit; + +namespace AutoMapper.UnitTests +{ + public class When_using_ConfigurationExpression_Advanced : AutoMapperSpecBase + { + // Nullable so can see a false state + private static bool? _sealed; + + protected override MapperConfiguration Configuration { get; } = new MapperConfiguration(cfg => + { + cfg.CreateMap(); + cfg.Advanced.BeforeSeal(SetSealed); + }); + + private static void SetSealed(IConfigurationProvider cfg) + { + // If sealed _typeMapCache is filled and should be able to Resolve tye TypeMap + // If not sealed _typeMapCache is empty and should return null + _sealed = cfg.FindTypeMapFor(typeof(PlaceHolder), typeof(PlaceHolder)) != null; + } + + [Fact] + public void BeforeSeal_should_be_called_before_Seal() + { + _sealed.ShouldBe(false); + + // Prove that sealed actualy seals + SetSealed(Configuration); + _sealed.ShouldBe(true); + } + + public class PlaceHolder { } + } +} \ No newline at end of file diff --git a/src/UnitTests/XUnitConventions.cs b/src/UnitTests/XUnitConventions.cs deleted file mode 100644 index a2df94836b..0000000000 --- a/src/UnitTests/XUnitConventions.cs +++ /dev/null @@ -1,109 +0,0 @@ -namespace Xunit -{ - using System; - - [AttributeUsage(AttributeTargets.Method)] - public class FactAttribute : Attribute { - public string Skip { get; set; } - } - - public interface IUseFixture where T : new() - { - void SetFixture(T data); - } -} - -namespace AutoMapper.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using Fixie; - using Xunit; - - public class CustomConvention : Convention - { - static readonly Dictionary fixtures = new Dictionary(); - - public CustomConvention() - { - Classes - .Where(HasAnyFactMethods); - - Methods - .HasOrInherits(); - - ClassExecution - .CreateInstancePerCase() - .Wrap() - .ShuffleCases(); - - FixtureExecution - .Wrap(); - - CaseExecution - .Skip(c => c.Method.GetCustomAttributes().Any(fa => !string.IsNullOrEmpty(fa.Skip))); - } - - bool HasAnyFactMethods(Type type) - { - return type.GetMethods(BindingFlags.Public | BindingFlags.Instance).Any(x => x.HasOrInherits()); - } - - class PrepareAndDisposeFixtureData : ClassBehavior - { - public void Execute(Class testClass, Action next) - { - SetUp(testClass); - next(); - TearDown(); - } - - void SetUp(Class testClass) - { - fixtures.Clear(); - - foreach (var @interface in FixtureInterfaces(testClass.Type)) - { - var fixtureDataType = @interface.GetGenericArguments()[0]; - - var fixtureInstance = Activator.CreateInstance(fixtureDataType); - - var method = @interface.GetMethod("SetFixture", new[] { fixtureDataType }); - fixtures[method] = fixtureInstance; - } - } - - void TearDown() - { - foreach (var fixtureInstance in fixtures.Values) - { - var disposable = fixtureInstance as IDisposable; - if (disposable != null) - disposable.Dispose(); - } - - fixtures.Clear(); - } - } - - class InjectFixtureData : FixtureBehavior - { - public void Execute(Fixture fixture, Action next) - { - foreach (var injectionMethod in fixtures.Keys) - injectionMethod.Invoke(fixture.Instance, new[] { fixtures[injectionMethod] }); - - next(); - } - } - - static IEnumerable FixtureInterfaces(Type testClass) - { - return testClass.GetInterfaces() - .Where(@interface => @interface.IsGenericType && - @interface.GetGenericTypeDefinition() == typeof(IUseFixture<>)); - } - } -} \ No newline at end of file diff --git a/src/UnitTests/packages.config b/src/UnitTests/packages.config deleted file mode 100644 index fb49f847f2..0000000000 --- a/src/UnitTests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/tools/7-Zip/7-zip.chm b/tools/7-Zip/7-zip.chm deleted file mode 100644 index 6470319ad7..0000000000 Binary files a/tools/7-Zip/7-zip.chm and /dev/null differ diff --git a/tools/7-Zip/7-zip.dll b/tools/7-Zip/7-zip.dll deleted file mode 100644 index cdded656dd..0000000000 Binary files a/tools/7-Zip/7-zip.dll and /dev/null differ diff --git a/tools/7-Zip/7z.dll b/tools/7-Zip/7z.dll deleted file mode 100644 index e3e843b940..0000000000 Binary files a/tools/7-Zip/7z.dll and /dev/null differ diff --git a/tools/7-Zip/7z.exe b/tools/7-Zip/7z.exe deleted file mode 100644 index b87d07f99b..0000000000 Binary files a/tools/7-Zip/7z.exe and /dev/null differ diff --git a/tools/7-Zip/7z.sfx b/tools/7-Zip/7z.sfx deleted file mode 100644 index ffb1fbed8b..0000000000 Binary files a/tools/7-Zip/7z.sfx and /dev/null differ diff --git a/tools/7-Zip/7zCon.sfx b/tools/7-Zip/7zCon.sfx deleted file mode 100644 index 998f02e8b0..0000000000 Binary files a/tools/7-Zip/7zCon.sfx and /dev/null differ diff --git a/tools/7-Zip/7zFM.exe b/tools/7-Zip/7zFM.exe deleted file mode 100644 index 4253f0948d..0000000000 Binary files a/tools/7-Zip/7zFM.exe and /dev/null differ diff --git a/tools/7-Zip/7zG.exe b/tools/7-Zip/7zG.exe deleted file mode 100644 index ea5a98cb1e..0000000000 Binary files a/tools/7-Zip/7zG.exe and /dev/null differ diff --git a/tools/7-Zip/7za.exe b/tools/7-Zip/7za.exe deleted file mode 100644 index 12b9499a28..0000000000 Binary files a/tools/7-Zip/7za.exe and /dev/null differ diff --git a/tools/7-Zip/History.txt b/tools/7-Zip/History.txt deleted file mode 100644 index cba3ab7075..0000000000 --- a/tools/7-Zip/History.txt +++ /dev/null @@ -1,979 +0,0 @@ -HISTORY of the 7-Zip --------------------- - -9.13 beta 2010-04-15 -------------------------- -- 7-Zip now stores NTFS file timestamps to ZIP archives. -- New additional "Open archive >" item in context menu allows to select - archive type for some files. -- Some bugs were fixed. -- New localization: Uyghur. - - -9.12 beta 2010-03-24 -------------------------- -- ZIP / PPMd compression ratio was improved in Maximum and Ultra modes. -- The BUG in 7-Zip 9.* beta was fixed: LZMA2 codec didn't work, - if more than 10 threads were used (or more than 20 threads in some modes). - - -9.11 beta 2010-03-15 -------------------------- -- 7-Zip now supports PPMd compression in ZIP archives. -- Speed optimizations in PPMd codec. -- The support for archives in installers was improved. -- Some bugs were fixed. -- New localization: Kazakh. - - -9.10 beta 2009-12-22 -------------------------- -- The BUG in 7-Zip 9.09 beta was fixed: - 7-Zip created incorrect ZIP archives, if ZipCrypto encryption was used. - - -9.09 beta 2009-12-12 -------------------------- -- 7-Zip now can unpack Apple Partition Map (APM) disk images. -- Speed optimizations in AES code for Intel's 32nm CPUs. -- Speed optimizations in CRC calculation code for Intel's Atom CPUs. -- Some bugs were fixed. - - -9.07 beta 2009-08-27 -------------------------- -- It's possible to specify Diff program in options (7-Zip File Manager). -- Some bugs were fixed. - - -9.06 beta 2009-08-17 -------------------------- -- 7-Zip now can unpack MSLZ archives. -- Partial parsing for EXE resources, SWF and FLV. -- Some bugs were fixed. - - -9.04 beta 2009-05-30 -------------------------- -- 7-Zip now can update solid .7z archives. -- 7-Zip now supports LZMA2 compression method. -- 7-Zip now supports XZ archives. -- 7-Zip now can unpack NTFS, FAT, VHD and MBR archives. -- 7-Zip now can unpack GZip, BZip2, LZMA, XZ and TAR archives from stdin. -- 7-Zip now can open/copy/compress disk images (like \\.\c:) from \\.\ folder. -- 7-Zip File Manager now doesn't use temp files to open nested archives - stored without compression. -- New -scrc switch to calculate total CRC-32 during extracting / testing. -- New -scc{WIN|DOS|UTF-8} switch to specify charset for console input/output (default = DOS). -- Some bugs were fixed. - - -4.65 2009-02-03 -------------------------- -- 7-Zip File Manager now can calculate SHA-256 checksum. -- Some bugs were fixed. - - -4.64 2009-01-03 -------------------------- -- The bug in 7-Zip 4.63 was fixed: 7-Zip could not decrypt .ZIP archives - encrypted with WinZip-AES method. - - -4.63 2008-12-31 -------------------------- -- 7-Zip now can unpack ZIP archives encrypted with PKWARE-AES. -- Some bugs were fixed. - - -4.62 2008-12-02 -------------------------- -- Some bugs were fixed. - - -4.61 beta 2008-11-23 -------------------------- -- 7-Zip now supports LZMA compression for .ZIP archives. -- Some bugs were fixed. -- New localization: Sinhala. - - -4.60 beta 2008-08-19 -------------------------- -- Some bugs were fixed. - - -4.59 beta 2008-08-13 -------------------------- -- 7-Zip now can unpack UDF, XAR and DMG/HFS archives. -- 7-Zip File Manager now keeps encryption when you edit encrypted file inside archive. -- 7-Zip File Manager now allows to change current folder from the address bar drop-down list. -- It's allowed to use -t switch for "list" and "extract" commands. -- Some bugs were fixed. -- New localizations: Icelandic, Kurdish Sorani. - - -4.58 beta 2008-05-05 -------------------------- -- Some speed optimizations. -- 7-Zip now can unpack .lzma archives. -- Unicode (UTF-8) support for filenames in .ZIP archives. Now there are 3 modes: - 1) Default mode: 7-Zip uses UTF-8, if the local code page doesn't contain required symbols. - 2) -mcu switch: 7-Zip uses UTF-8, if there are non-ASCII symbols. - 3) -mcl switch: 7-Zip uses local code page. -- Now it's possible to store file creation time in 7z and ZIP archives (-mtc switch). -- 7-Zip now can unpack multivolume RAR archives created with - "old style volume names" scheme and names *.001, *.002, ... -- Now it's possible to use -mSW- and -mSW+ switches instead of -mSW=off and -mSW=on -- Some bugs were fixed. -- New localizations: Punjabi (Indian), Pashto. - - -4.57 2007-12-06 -------------------------- -- The BUG in command line version was fixed: -up3 switch - could work incorrectly. - - -4.56 beta 2007-10-24 -------------------------- -- Some bugs were fixed. - - -4.55 beta 2007-09-05 -------------------------- -- Some bugs were fixed. - - -4.54 beta 2007-09-04 -------------------------- -- Decompression speed was increased. - - -4.53 beta 2007-08-27 -------------------------- -- "Test" and "Info" buttons now work for open archives. -- The bug in 7-Zip 4.48 - 4.52 beta was fixed: - 7-Zip could create .ZIP archives with broken files. -- Some bugs were fixed. - - -4.52 beta 2007-08-03 -------------------------- -- 7-Zip now can unpack Compound files (msi, doc, ...). -- Some bugs were fixed. - - -4.51 beta 2007-07-25 -------------------------- -- Bug was fixed: 7-Zip 4.50 beta could not open some .7z archives. - - -4.50 beta 2007-07-24 -------------------------- -- New switch for command line version: - -ssc[-] enables/disables case-sensitive mode for file names. -- Speed optimizations for AES encryption. -- Some bugs were fixed. - - -4.49 beta 2007-07-11 -------------------------- -- 7-Zip now can unpack WIM archives. -- 7-Zip now replaces incorrect characters in filenames during extracting. - - -4.48 beta 2007-06-26 -------------------------- -- Encryption strength for .7z format was increased. - Now it uses random initialization vectors. -- Some bugs were fixed. - - -4.47 beta 2007-05-27 -------------------------- -- Bugs of 7-Zip 4.46 beta were fixed: BZip2 could work incorrectly. - - -4.46 beta 2007-05-25 -------------------------- -- New fast compression mode for Deflate method in Zip and GZip. -- New "Compress shared files" option in GUI and -ssw switch. -- Some bugs were fixed. -- New localization: Norwegian Nynorsk. - - -4.45 beta 2007-04-17 -------------------------- -- Now it's possible to specify the size of solid block and the number - of CPU threads in "Add to archive" dialog box. -- Default dictionary size was increased: Normal: 16 MB, Max: 32 MB. -- Speed optimizations. -- Benchmark was improved (new "b" command in command line version). -- The number of DLL files was reduced. -- Now it's possible to associate 7-zip with combined types like .tbz2 -- switch -mhcf=off is not supported now. -- If -t{Type} switch is not specified, 7-Zip now uses extension of archive to - detect the type of archive. -- Some bugs were fixed. -- New localization: Welsh. - - -4.44 beta 2007-01-20 -------------------------- -- Speed optimizations for LZMA, Deflate, BZip2 and unRAR. -- 7-Zip now supports file pathnames longer than 260 characters. -- Some bugs were fixed. -- New localizations: Bangla, Bashkir, Nepali. - - -4.43 beta 2006-09-15 -------------------------- -- 7-Zip now can use multi-threading mode for compressing to .ZIP archives. -- ZIP format supporting was improved. -- 7-Zip now supports WinZip-compatible AES-256 encryption for .ZIP archives. -- New context menu items for .ZIP archives creating. -- 7-Zip now uses order list (list of extensions) for files sorting for compressing - to .7z archives. It can slightly increase compression ratio in some cases. -- 7-Zip now restores modification time of folders during .7z archives extracting. -- Some bugs were fixed. -- New localizations: Armenian, Marathi. - - - -4.42 2006-05-14 -------------------------- -- Compressing speed and Memory requirements were increased. - Default dictionary size was increased: Fastest: 64 KB, Fast: 1 MB, - Normal: 4 MB, Max: 16 MB, Ultra: 64 MB. -- BZip2 compressing / decompressing now can work in multi-threading mode -- Multi-threading mode now is default for multi-processor systems -- 64-bit version now supports 1 GB dictionary -- 7z/LZMA now can use only these match finders: HC4, BT2, BT3, BT4 -- Compression ratio in Zip/GZip/Deflate in Ultra mode was increased -- 7-Zip now can unpack ISO archives and some installers created by NSIS -- Optional "Flat View" mode in 7-Zip File Manager -- 7-Zip File Manager now can calculate CRC checksums for files -- -x switch with relative paths now affects files specified with absolute paths -- New switch for 7za.exe (console version): -slt. - "l" (list) command with -slt shows technical information for archive. -- New switch: -scs{WIN|DOS|UTF-8} specifies charset for list files. - Default charset for list files is UTF-8 now. -- Some bugs were fixed -- New localizations: Albanian, Kurdish - - -4.32 2005-12-09 -------------------------- -- Bug was fixed: 7-Zip 4.31 didn't work in Windows 95 - - -4.31 2005-12-04 -------------------------- -- Small changes -- New localization: Basque - - -4.30 beta 2005-11-18 -------------------------- -- Files 7zFMn.exe, 7zGn.exe, 7-zipn, 7za.exe, 7zC.sfx were removed from 7-zip package -- 7-Zip now uses uncompressed SFX: 7z.sfx -- Sfx modules 7z.sfx and 7zCon.sfx now use msvcrt.dll -- Speed optimizations in LZMA maximum/ultra compressing. -- LZMA now supports word size up to 273 -- 7-Zip now reduces dictionary size for LZMA, if you compress files - smaller than specified dictionary size. -- 7-Zip now can use large memory pages: - GUI: 7-Zip File Manager / Options / Settings / Use large memory pages. - Command line version: -slp switch. - This feature allows to increase speed of compressing. - But 7-Zip can make some pause at starting of compressing for allocating large pages. - Also Task Manager doesn't show real memory usage of program, if 7-Zip uses large pages. - This feature works only on Windows 2003 / XP x64 / Vista. - Also you must have administrator's rights for your system. - Recommended size of RAM: 1 GB or more. - To install this feature you must run 7-Zip File Manager at least once, - close it and reboot system. -- Some bugs were fixed - - -4.29 beta 2005-09-28 -------------------------- -- Bug was fixed: 7-Zip 4.28 beta worked incorrectly in Windows 95/98/Me - - -4.28 beta 2005-09-27 -------------------------- -- Bug was fixed: 7-Zip 4.27 beta created incorrect multivolume archives. -- "Duplicate filename" collision problem between names with ligatures was fixed. - - -4.27 beta 2005-09-21 -------------------------- -- 7-Zip can unpack CHM/HXS (MS HTML HELP) archives -- 7-Zip can unpack multivolume CAB archives -- Now 7-Zip deletes files to the Recycle Bin by default. - Shift+Delete deletes files permanently. -- Some bugs were fixed -- New localization: Tatarish - - -4.26 beta 2005-08-05 -------------------------- -- LZH format support (extracting only) -- Some bugs were fixed -- New localization: Ido - - -4.25 beta 2005-07-31 -------------------------- -- 7-Zip now doesn't interrupt the compressing when it can not - find specified file as in version 4.24 beta. It just shows warning. -- 7-Zip now supports standard selection mode in the file list -- Some bugs were fixed - - -4.24 beta 2005-07-06 -------------------------- -- 7-Zip now supports right-click Drag and Drop in Explorer -- Command line version now supports short file names (like FILENA~1.TXT) -- If there are no wildcard names and there is no -r switch in command line, - 7-Zip now checks that specified files exist on disk before compressing. -- Some bugs were fixed - - -4.23 2005-06-29 -------------------------- -- Drag and Drop support -- 7-Zip File Manager now can copy files from one archive to another -- Some bugs were fixed -- New localizations: Extremaduran, Malay - - -4.20 2005-05-30 -------------------------- -- No changes - - -4.19 beta 2005-05-21 -------------------------- -- BZip2 code was rewritten. Now it supports 3 modes: Normal, Maximum and - Ultra. In Normal mode it compresses almost as original BZip2 compressor. - Compression ratio in Maximum and Ultra modes is 1-3% better for some files, - but Maximum Mode is about 3 times slower and Ultra Mode is about 8 times - slower than Normal mode. -- Console version now prints all messages to stdout by default, - and if -so switch is specified, 7-Zip prints messages to stderr. -- Some bugs were fixed -- New localizations: Azeri, Georgian - - -4.18 beta 2005-04-19 -------------------------- -- Bug in v4.17 beta was fixed: 7-Zip File Manager could crash - after some operations with archives - - -4.17 beta 2005-04-18 -------------------------- -- To increase protection from viruses, 7-Zip now does not open - files with more than 4 continuous spaces in the name. - And 7-Zip changes such long spaces in name to " ... " in the file list. -- Code size optimization -- Some files were moved from main package to extra package: - - Plugin for FAR Manager - - SFX modules for installers (7zS.sfx and 7zSD.sfx) -- New localizations: Asturian, Indonesian - - -4.16 beta 2005-03-29 -------------------------- -- Speed optimization (5%) for 7z / LZMA -- 7za.exe now supports .Z archives -- -r- switch in command line now is default for all commands -- Some bugs were fixed -- New localization: Uzbek - - -4.15 beta 2005-01-25 -------------------------- -- Z format supporting (extracting only) -- 7-Zip now can extract ZIP archives compressed with "Shrink" method -- 7-Zip now doesn't interrupt the compressing when it can not open file. - 7-Zip just skips that file and shows warning. -- Some bugs were fixed -- New localization: Frisian - - -4.14 beta 2005-01-11 -------------------------- -- 7-Zip installer was created with NSIS. - Now it installs 7-Zip for all users (under Windows 2000/XP). -- Now 7-Zip can create multivolume archives - (switch -v for command line) -- Some bugs were fixed -- New localizations: Breton, Farsi - - -4.13 beta 2004-12-14 -------------------------- -- Switch "--" stops switches parsing -- Some bugs were fixed - - -4.12 beta 2004-11-18 -------------------------- -- Bug in v4.11 beta was fixed: - 7-Zip created incorrect ZIP archives if file size was - from 3.75 GB to 4 GB. - - -4.11 beta 2004-11-16 -------------------------- -- 7-Zip now shows file names during compressing/decompressing -- 7-Zip now supports Zip64 extension of ZIP format. So now it's - possible to compress files bigger than 4 GB to ZIP archives. -- Some bugs were fixed -- New localization: Galician - - -4.10 beta 2004-10-21 -------------------------- -- Bugs in v4.0* were fixed: - - Some commands in command line with "-r" switch worked incorrectly, - so 7-zip could skip some files during compressing - - Some other bugs were fixed -- Small internal changes - - -4.09 beta 2004-10-05 -------------------------- -- Bugs in v4.0* were fixed: - - Renaming inside archives didn't work or worked incorrectly - - GUI SFX didn't show extracting dialog at start -- Small fixes in 7-Zip GUI (7zG.exe) - - -4.08 beta 2004-10-04 -------------------------- -- Bug in installer for v4.07 was fixed: when rebooting - is required, it rebooted without asking user -- Small fixes in 7-Zip GUI (7zG.exe) - - -4.07 beta 2004-10-03 -------------------------- -- Big amount of code was changed in this beta version. - So don't use it for important data compressing. - And test archive after compressing. - -- Unified command line interface to GUI and console versions -- 7-Zip now can extract or test several archives in one command -- 7-Zip now doesn't interrupt the compressing when file is locked by - other application. 7-Zip just skips that file and shows warning. - Note: previous versions of 7-Zip had bug, so they can not unpack - non-solid and some solid 7z archives with such skipped files. -- Command line interface was changed: - - now it's possible to use absolute pathnames - - syntax simplification: - was: 7z a a Folder1\* Folder2\* -r - now: 7z a a Folder1 Folder2 - - now it's possible to use complex wildcard commands, like *\*111*\* -- More smart detection of archive type for files with unusual - file name extensions -- Supporting for RAR archives with encrypted headers -- CPIO format supporting was improved -- For GZip and BZip2 formats you can: - - Compress from stdin (-si switch) - - Compress to stdout (-so switch) - - Extract to stdout (-so switch) -- 7-Zip File Manager: - - Split and Combine commands - - new list view options: Full row select, Show grid lines -- Internal reconstruction -- Some bugs were fixed -- New localizations: Friulian, Macedonian, Mongolian, Tamil, Thai - - -3.13 2003-12-11 -------------------------- -- Some small bugs were fixed - - -3.12 2003-12-10 -------------------------- -- Now you can select compression method, dictionary size - and word size in "Add to archive" dialog box. Also it - shows memory usage. -- 7-Zip File Manager now contains toolbars. -- New "Benchmark" command in 7-Zip File Manager. - It measures compressing and decompressing speeds and - shows rating values. -- Some bugs were fixed. - - -3.11 2003-10-06 -------------------------- -- 7-zip now use limitations for solid block size - for increasing the speed of random file decompressing: - - in Store mode: 0 B - - in Fast mode: 16 MB - - in Normal mode: 256 MB - - in Maximum mode: 1 GB - - in Ultra mode: 4 GB -- 7z.exe, 7za.exe and SFX modules now support Unicode - file names under Windows NT/2000/XP/2003. - 7zn.exe and 7zan.exe were removed from package. -- Some bugs were fixed -- New localization: Afrikaans - - -3.10 2003-09-27 -------------------------- -- Drag-and-Drop from external application -- GUI version (7zG.exe) can compress files with absolute paths -- Compression dialog doesn't suggest bzip2 and gzip2 types when - there are more than one selected file -- Optional auto renaming for existing files during extraction - in command line version (-aot switch). -- Some bugs were fixed - - -3.09.02 2003-09-20 -------------------------- -- Optional limitation for solid block size for increasing - the speed of random file decompressing (-ms switch) - - -3.09.01 beta 2003-09-06 -------------------------- -- Automatic compression filter for executable files: - dll, exe, ocx, sfx, sys, (-mf switch) -- Compression levels in 7z now are: - - Fast: 32 KB dictionary, BCJ filter - - Normal: 2 MB dictionary, BCJ filter - - Maximum: 8 MB dictionary, BCJ filter, max settings - - Ultra: 32 MB dictionary, BCJ2 filter, max settings -- Updating solid 7z archives now is supported, if it doesn't - require repacking solid blocks -- -mhcf switch for 7z format now is default -- Some bugs were fixed - - -3.08.04 beta 2003-08-24 -------------------------- -- Favorites menu in 7-Zip File Manager -- Some bugs were fixed - - -3.08.03 beta 2003-08-21 -------------------------- -- Automatic adding of extension to archive name in Compress Dialog -- Some bugs in previous 3.08.* versions were fixed: - - Storing columns width inside archives in File Manager - - Opening archive inside archive - - Quotes in list files in console version - - -3.08.02 beta 2003-08-20 -------------------------- -- Some bugs were fixed - - -3.08 beta 2003-08-19 -------------------------- -- Compress dialog: - - Supporting fast compressing mode (-mx=1 switch) - - Multi-threading option for Multi-Processor systems - or Pentium 4 with Hyper-Threading - - Encrypt file names option -- New context menu items: - - Extract here - - Extract to - - Compress and email -- Internal reconstruction, registry using was reduced -- New localization: Esperanto - - -2.30 Beta 32 2003-05-15 -------------------------- -- New features in compressing / decompressing window. -- "Show password" option. -- Some other small changes. -- New localization: Valencian. - - -2.30 Beta 31 2003-04-29 -------------------------- -- Some bugs were fixed. - - -2.30 Beta 30 2003-04-19 -------------------------- -- 7-Zip File Manager: - - Showing .. item. - - 1/2 Panels mode switching (F9). -- Supporting Bzip2 compression in ZIP archives. -- Some bugs were fixed. -- Some optimization recompiling for reducing code size. - - -2.30 Beta 29 2003-04-07 -------------------------- -- 7-Zip File Manager: - - "7-Zip" and "System" submenus in "Files" menu. - - Path history and "Browse" button in "Copy" dialog. -- RAR supporting was improved. -- Some bugs were fixed. -- Small changes in LZMA code. -- New localizations: Hebrew, Vietnamese. - - -2.30 Beta 28 2003-02-16 -------------------------- -- Some bugs were fixed: - - Updating 7z archives that are larger than 4 GB. - - Using anti-items in 7z format. - - Compressing empty files with password to zip format. -- In max mode 7z now uses 8 MB dictionary instead of 4 MB. -- 7-Zip File Manager: - - Supporting file comments: Ctrl-Z. - - New key alias for folder bookmarks: [Shift]+Alt+Number. - - -2.30 Beta 27 2003-01-24 -------------------------- -- Two BUGs in two previous beta versions (Beta 25 and Beta 26) - were fixed: - 1. Incorrect compressing to non-solid 7z archive - when files have some very big sizes: - 4 GB, 8 GB, 12 GB, 16 GB, ... - 2. Incorrect percent showing in 7z compressing - when files are bigger than 4 GB. -- Supporting multivolume RAR and SPLIT archives. -- Supporting DEB archives. -- Supporting old version of CPIO format. -- Some bugs were fixed. -- New localizations: Korean, Swedish. - - -2.30 Beta 26 2003-01-12 -------------------------- -- Supporting Deflate64 method in Zip archives. -- Supporting Rar 1.50 archives. -- Some bugs were fixed. - - -2.30 Beta 25 2003-01-02 -------------------------- -- Encryption feature for 7z format (AES-256). -- New optional archive header compressing mode (-mhcf). -- Archive headers now always are compressed with LZMA method. -- Updating non-solid 7z archives without -ms=off now is allowed. -- Folder creating and item renaming inside archive now is supported. -- Supporting encrypted Rar3 archives. -- Supporting Unicode names in Rar3 archives. -- Some bugs were fixed. -- New localizations: Lithuanian, Voro. - - -2.30 Beta 24 2002-11-01 -------------------------- -- Some internal reconstructions. -- -m switch syntax was slightly changed. -- Some bugs were fixed. -- New localizations: Catalan, Norwegian, Romanian. - - -2.30 Beta 23 2002-09-07 -------------------------- -- Encryption feature for zip format. -- Percent indicating for some operations. -- Some bugs were fixed. - - -2.30 Beta 22 2002-08-31 -------------------------- -- New program: 7-Zip File Manager. -- Command line version now doesn't allow absolute paths - for compressing files. -- New localizations: Belarusian, Greek. -- Bug in FAR plugin was fixed: - Incorrect updating when archive has no explicit - directory items for file items. -- Some bugs were fixed. - - -2.30 Beta 21 2002-07-08 -------------------------- -- RAM requirements for LZMA (7z) compression were reduced. -- Small bug in FAR plugin was fixed. - - -2.30 Beta 20 2002-07-01 -------------------------- -- RAM requirements for LZMA (7z) decompression were reduced. -- New localization: Turkish. -- Some bugs were fixed. - - -2.30 Beta 19 2002-04-11 -------------------------- -- Supporting RAR 3.0 archives. -- New localizations: Danish, Ukrainian. - - -2.30 Beta 18 2002-03-25 -------------------------- -- Compressing speed in 7z format was slightly increased. -- New localizations: Estonian, Finnish. -- Some bugs were fixed. - - -2.30 Beta 17 2002-03-03 -------------------------- -- Supporting ARJ archives. -- New localization: Chinese Simplified. - - -2.30 Beta 16 2002-02-24 -------------------------- -- Supporting RPM and CPIO archives. -- New fast compression mode for LZMA: -m0a=0. -- New match finders for LZMA: bt4b, hc3, hc4. -- Some bugs were fixed. - - -2.30 Beta 15 2002-02-17 -------------------------- -- Compression ratio in 7z was slightly improved. -- New localization: Dutch. - - -2.30 Beta 14 2002-02-10 -------------------------- -- Speed optimization for multiprocessor computers (-mmt switch). -- New localizations: Czech, Japanese, Polish. -- Some bugs were fixed. - - -2.30 Beta 13 2002-01-31 -------------------------- -- New SFX module for installers. -- New match finder for LZMA: bt3. -- New localizations: Portuguese, Portuguese Brazil, Serbo-Croatian. -- Some bugs were fixed. - - -2.30 Beta 12 2002-01-16 -------------------------- -- Bug was fixed: memory leak in Beta 11. -- New localization: Hungarian. - - -2.30 Beta 11 2002-01-15 -------------------------- -- Archive testing feature for GUI version. -- Now 7-Zip can use more than 256 MB of RAM in all Windows versions. -- New localizations: Bulgarian, Chinese Traditional, Latvian, Slovak. -- Some bugs were fixed. - - -2.30 Beta 10 2002-01-11 -------------------------- -- Bugs were fixed: - - Updating 7z archives in Beta 8 and 9 didn't work. - - Unicode version in Beta 9 didn't work in Windows NT4. - - Some other bugs were fixed. -- New localizations: Arabic, French, Italian, Slovenian, Spanish. - - -2.30 Beta 9 2002-01-08 -------------------------- -- Program localization: English, German, Russian. -- Additional optimized versions of programs - for Windows NT4/2000/XP. -- Two new match finders for LZMA: pat3h and pat4h. -- Some bugs were fixed. - - -2.30 Beta 8 2001-12-21 -------------------------- -- 7-Zip now supports some zip archives that were not - supported by previous versions. -- 7-Zip now supports new state (-uw switch) for cases - when 7-Zip can not detect whether file is newer or the same. -- Supporting anti-items in 7z format for incremental - update (-u with action #3). -- Some bugs were fixed. - - -2.30 Beta 7 2001-11-04 -------------------------- -- BCJ2: new converter for x86 code. -- Supporting tar archives with very long file names - (GNU extension to 'tar' format). -- Supporting multistream coders in 7z (-mb switch). -- More compressing parameters for zip and gzip - in console version (-m switch). -- Solid compressing option in Windows version. -- Compressing parameters option in Windows version. -- Auto renaming existing files feature for - extracting files. -- Overwrite mode switch for extracting (-ao). -- Some bugs were fixed. - - -2.30 Beta 6 2001-10-13 -------------------------- -- Supporting 7z format in MultiArc plugin for FAR Manager. -- Some bugs were fixed. - - -2.30 Beta 5 2001-10-02 -------------------------- -- Creating SFX archives from explorer. -- 7zWin.sfx: Windows version of SFX module. -- Auto adding .exe extension to SFX archive name. -- 7za.exe now supports 7z, bzip2, gzip, tar, zip. -- Some bugs were fixed. - - -2.30 Beta 4 2001-09-15 -------------------------- -- Self extract capability for 7z format. -- 7z archive format is default for 7z.exe and 7za.exe. -- 7z in default mode now uses bt234 match finder - and solid compression. -- 7z in maximum mode (-mx) now uses 4MB dictionary. - - -2.30 Beta 3 2001-09-10 -------------------------- -- Bug was fixed: decompressing .7z solid archives - containing empty files. -- new 7za.exe: standalone command line version - (only for 7z format). -- Speed of compressing to Deflate format (zip, gzip) - was slightly increased. - - -2.30 Beta 2 2001-08-30 -------------------------- -- Supporting the new 7z format with high compression ratio. -- -bd (Disable percentage indicator) switch in - console version. -- Bug in console version was fixed: - previous versions incorrectly execute compression - commands with non-recursive wildcards in combination - with subfolders. -- Some other bugs were fixed. - - -2.30 Beta 1 2001-05-07 -------------------------- -- Speed of reading of archive contents was increased. -- Bug was fixed: incorrect showing file names with - national charsets in some zip archives. -- Now it is possible to compress files larger than 4GB - to GZip archives. - - -2.24 2001-03-21 -------------------------- -- Bugs in GZip and Cab decoders were fixed. - - -2.23 2001-03-04 -------------------------- -- Opening archive items in Explorer. -- Context menu for archive items in Explorer. -- Automatic adding extension to archive name in console version. -- Some bugs were fixed. - - -2.22 2001-01-21 -------------------------- -- Supporting Zip archives containing more than 65535 files. -- Speed of Plugin for Explorer was increased. -- Searching start position of archive now is limited by - first 1MB part of file. -- Some bugs were fixed. -- Packet now doesn't contain 7zip.exe, far7zip.reg and - far7zip2.reg files. There is new far7z.reg file. - - -2.21 2000-12-21 -------------------------- -- FAR Plugin was improved: - - - Showing process box during opening archives. - - Viewing properties of file by Ctrl-A. - - Alt-F6 in archive now immediately extracts selected files - to current directory. - -- Some bugs were fixed: - - - Entering to archive's subfolders in Explorer by clicking - items in main window didn't work under Windows ME/2000. - - Decompressing solid Rar archives sometimes gave error. - - Console version 7z.exe during list operation incorrectly - showed file names with national (non-english) charsets. - - FAR Plugin didn't execute some operations. - - Showing percents during extracting ZIP archives sometimes - was incorrect. - - -2.20 2000-11-20 -------------------------- -- Supporting BZip2 and Cab. -- New program architecture with external - compression and cryptographic modules. -- Decryption support (Rar and Zip). -- New console client. -- Some bugs were fixed. - - -2.11 2000-06-15 -------------------------- -- Bugs were fixed: - - - FAR Plugin incorrectly processed - names of subdirectories that use national - (non-english) charsets. - - gzip plugin could not compress empty files. - - -2.10 2000-05-16 -------------------------- -- First level 7-Zip Plugin for FAR Manager. -- GUI version with integration to Windows Shell. -- Compression and decompressing GZip and TAR formats. -- Decompression RAR. -- Install & Uninstall support. -- Some bugs were fixed. - - -2.01 1999-09-19 -------------------------- -- Small bug was fixed. -- Compression ratio was improved for some files. - - -2.00 1999-07-18 -------------------------- -- Release. -- Big bug was fixed: previous versions incorrectly worked - during compressing with files that were referred by - direct(without wildcards) paths, containing subdirs parts. -- Compression and decompression speed were improved. -- -mx switch (maXimize compression) was added. -- Small bugs were fixed. - - -2.00 Beta 1 1999-01-02 -------------------------- -- Original beta version. - - -End of document diff --git a/tools/7-Zip/Lang/af.txt b/tools/7-Zip/Lang/af.txt deleted file mode 100644 index 09d9535a2d..0000000000 --- a/tools/7-Zip/Lang/af.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.09 -; Vertaal deur Petri Jooste -; -; -; -; - -00000000="Afrikaans" -00000001="Afrikaans" -00000002="54" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Konfigurasie" - -; Info Page -01000100="Aangaande 7-Zip" -01000103="7-Zip is gratis programmatuur. Indien u egter so baie van 7-Zip hou dat u die verdere ontwikkeling wil ondersteun, registreer dan asb. met 'n geldelike donasie aan die 7-Zip Projek." -01000105="Registreer" - -; Folders Page -01000200="Gidse" -01000210="&Werkgids" -01000211="&TEMP-gids van het stelsel" -01000212="&Huidige gids" -01000213="&Gespesifiseerde gids:" -01000214="Gebruik slegs vir verwisselbare media." - -01000281="Spesifiseer die stoorplek vir tydelyke argieflêers." - -; System Page -01000300="Stelsel" -01000301="Integreer 7-Zip in kontekskeuselys." -01000302="Trapsgewyse kontekskeuselys" -01000310="Kontekskeuselysitems:" - -; Language Page -01000400="Taal" -01000401="Taal:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip opdragte" -02000103="Open" -02000104="Open die geselekteerde argief." -02000105="Pak lêers uit..." -02000106="Pak lêers van geselekteerde argief uit." -02000107="Voeg by argief..." -02000108="Voeg geselekteerde items by argief." -02000109="Toets argief" -0200010A="Toets integriteit van die geselekteerde argief." -0200010B="Pak hier uit" -0200010C="Pak lêers van die geselekteerde argief in die huidige gids uit." -0200010D="Pak uit in {0}" -0200010E="Pak lêers uit in subgids." -0200010F="Voeg by {0}" -02000110="Voeg die geselekteerde items by argief." -02000111="Saampers en e-pos..." -02000112="Pers die geselekteerde items in 'n argief saam en stuur die argief via e-pos." -02000113="Pers saam in {0} en e-pos" -02000114="Pers die geselekteerde items saam in 'n argief en stuur die argief per e-pos." - -02000140="" -02000141="" - -; Properties -02000203="Pad" -02000204="Naam" -02000205="Uitgang" -02000206="Gids" -02000207="Grootte" -02000208="Ingepakte grootte" -02000209="Kenmerke" -0200020A="Gemaak" -0200020B="Laatste toegang" -0200020C="Gewysig" -0200020D="Kompak" -0200020E="Kommentaar" -0200020F="Versleuteld" -02000210="Verdeel Voor" -02000211="Verdeel Na" -02000212="Woordeboek" -02000213="CRC" -02000214="Tipe" -02000215="Anti" -02000216="Metode" -02000217="Gasheer BS" -02000218="Lêersstelsel" -02000219="Gebruiker" -0200021A="Groep" -0200021B="Blok" -0200021C="Kommentaar" -0200021D="Posisie" - -; Status bar -02000301="{0} objekt(e) is geselekteer" -02000302="{0} objekt(e)" - -; List Context Menu -02000401="&Kolomme..." - -02000411="&Open" -02000412="&Uitpak..." - -; ToolBar -02000501="Uitpak" - -; Messages -02000601="Bywerk-funksie word vir hierdie argief nie ondersteun nie." -02000602="Kan argief {0} nie bywerk nie" -02000603="Kan gids '{0}' nie maak nie" -02000604="Hierdie lêer is nie 'n ondersteunde argief nie." -02000605="Fout" -02000606="Te veel items" -02000607="Daar is geen program geassosieer met hierdie lêersnaam-uitgang nie" -02000608="Daar is geen foute nie" - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja vir &almal" -02000709="&Nee" -0200070B="Nee vir a&lmal" - -02000710="Kanselleer" -02000711="&Kanselleer" -02000713="A&fsluit" -02000714="Stop" -02000715="Herbegin" - -02000720="Hulp" - -; Extract dialog -02000800="&Uitpak" -02000801="U&itpak in:" -02000802="&Wagwoord" - -02000810="Pad-metode" -02000811="Volledige padname" -02000812="Huidige padname" -02000813="Geen padname" - -02000820="Vervang lêers" -02000821="Vervang slegs met bevestiging" -02000822="Vervang sonder bevestiging" -02000823="Slaan bestaande lêers oor" -02000824="Hernoem outomaties" -02000825="Hernoem bestaande lêers outomaties" - -02000830="Lêers" -02000831="&Geselekteerde lêers" -02000832="&Alle lêers" - -02000881="Gee 'n bestemming vir uitgepakte lêers." - -02000890="Besig om uit te pak" - -; Overwrite dialog -02000900="Bevestig lêeroorskrywing" -02000901="Doelgids bevat alreeds 'n lêer met hierdie naam." -02000902="Wil u die bestaande lêer vervang" -02000903="deur hierdie lêer ?" - -02000911="O&utomaties hernoem" - -02000982="{0} grepe" -02000983="gewysig op" - -; Messages dialog -02000A00="Diagnostiese boodskappe" - -02000A80="Boodskap" - -02000A91="Nie-ondersteunde saampersmetode vir '{0}'." -02000A92="Datafout in '{0}'. Lêer is beskadig." -02000A93="CRC het misluk in '{0}'. Lêer is beskadig." - -; Password dialog -02000B00="Tik wagwoord in" -02000B01="Tik wagwoord in:" -02000B02="&Wys wagwoord" - -; Progress dialog -02000C00="Bewerk" -02000C01="Tydsduur sovêr:" -02000C02="Oorblywende tyd:" -02000C03="Grootte:" -02000C04="Spoed:" - -02000C10="&Agtergrond" -02000C11="&Voorgrond" -02000C12="&Wag" -02000C13="&Gaan voort" - -02000C20="Wagtend" - -02000C30="Is u seker dat u wil kanselleer?" - -; Compress dialog -02000D00="Voeg by argief" -02000D01="&Argief:" -02000D02="&Bywerkwyse:" -02000D03="Argie&fformaat:" -02000D04="&Saampersmetode:" -02000D05="Maak kom&pakte argief" -02000D06="Pa&rameters:" -02000D07="Opsies" -02000D08="Maak SF&X argief" -02000D09="Multi-uitvoerdraadhantering" -02000D0A="Enkripteer lêer&name" -02000D0B="Saampersingv&lak:" -02000D0C="&Woordeboekgrootte:" -02000D0D="&Woordgrootte:" -02000D0E="Geheuegebruik vir saampersing:" -02000D0F="Geheuegebruik vir uitpakking:" - -02000D40="Verdeel in &volumes, aantal grepe:" - -02000D81="Stoor" -02000D82="Normaal" -02000D83="Maksimum" -02000D84="Vinnig" -02000D85="Vinnigste" -02000D86="Ultra" - -02000D90="Blaai" - -02000DA1="Lêers byvoeg en vervang" -02000DA2="Lêers bywerk en byvoeg" -02000DA3="Verfris bestaande lêers" -02000DA4="Sinkroniseer lêers" - -02000DB1="Alle lêers" - -02000DC0="Besig met saampersing" - -; Columns dialog -02000E00="Kolomme" -02000E01="Merk die kolomme wat u sigbaar wil maak in hierdie gids. Gebruik die op-en-af-pyltjies om die kolomme te rangskik soos u wil." -02000E02="Die gemerkte kolom moet" -02000E03="pixels &breed wees." - -02000E10="&Opskuif" -02000E11="&Afskuif" -02000E12="&Wys" -02000E13="&Verberg" -02000E14="Stel" - -02000E81="Titel" -02000E82="Breedte" - -; Testing -02000F90="Besig om te toets" - - -; File Manager - -03000000="7-Zip Lêerbestuurder" - -; Menu -03000102="&Lêer" -03000103="R&edigeer" -03000104="&Vertoon" -03000105="&Gereedskap" -03000106="&Hulp" -03000107="G&unstelinge" - -; File -03000210="&Open" -03000211="Open &Binne" -03000212="Open B&uite" -03000220="&Wys" -03000221="R&edigeer" -03000230="Her&noem" -03000231="&Kopieer na..." -03000232="&Verskuif na..." -03000233="Ve&rwyder" -03000240="E&ienskappe" -03000241="Komme&ntaar" -03000250="Maak gids" -03000251="Maak lêer" -03000260="A&fsluit" -03000270="Ver&deel lêer..." -03000271="Kom&bineer lêers..." - -; Edit -03000310="&Ontdoen" -03000311="&Herhaal" -03000320="&Knip" -03000321="K&opieer" -03000322="&Plak" -03000323="&Verwyder" -03000330="Selekteer &alles" -03000331="Deselekteer a&lles" -03000332="Keer &seleksie om" -03000333="Selekteer..." -03000334="Deselekteer..." -03000335="Selekteer op Soort" -03000336="Deselekteer op Soort" - -; View -03000410="&Groot ikone" -03000411="&Klein ikone" -03000412="&Lys" -03000413="&Detail" -03000420="Ongesorteer" -03000430="Maak wortelgids oop" -03000431="Een vlak hoër" -03000432="Gidse geskiedenis..." -03000440="&Verfris" -03000450="&2 Panele" -03000451="&Nutsbalke" -03000460="Argiveernutsbalk" -03000461="Standaardnutsbalk" -03000462="Groot knoppies" -03000463="Wys teks op knoppies" - -; Tools -03000510="&Opsies..." -03000511="&Normtoetsing" - -; Help -03000610="&Inhoud..." -03000620="&Aangaande 7-Zip..." - -; Favorites -03000710="Voeg gids by gunstelinge &as" -03000720="Boekmerk" - -; Options Dialog - -03010000="Opsies" - -; Plugins -03010100="Inproppe" -03010101="In&proppe:" -03010110="Opsies..." - -; Edit -03010200="Redigeerder" -03010201="R&edigeerder:" - -; System -03010300="Stelsel" -03010302="Assosieer 7-Zip met:" -03010310="Inprop" - -; Settings -03010400="Instellings" -03010401="Wys \"..\" &item" -03010402="Wys &ware lêerikone" -03010410="Wys &stelselkeuselys" -03010420="Wys seleksie oor &hele ry(e)" -03010421="Wys &roosterlyne" - -; Strings - -03020201="Kopieer" -03020202="Verskuif" -03020203="Kopieer na:" -03020204="Verskuif na:" -03020205="Besig met kopiëring..." -03020206="Besig met verskuiwing..." -03020207="U kan items vir hierdie soort gidse nie verskuif of kopieer nie." -03020208="Bewerking word nie ondersteun nie." - -03020210="Bevestig lêerverwydering" -03020211="Bevestig gidsverwydering" -03020212="Bevestig verwydering van meerdere lêers" -03020213="Is u seker dat u '{0}' wil verwyder?" -03020214="Is u seker dat u gids '{0}' asook die inhoud daarvan wil verwyder?" -03020215="Is u seker dat u hierdie {0} items wil verwyder?" -03020216="Besig met verwydering..." -03020217="Fout by verwydering van lêer of gids" - -03020220="Besig met hernoeming..." -03020221="Fout by hernoeming van lêer of gids" - -03020230="Maak gids" -03020231="Naam van die gids:" -03020232="Nuwe gids" -03020233="Fout by maak van gids" - -03020240="Maak lêer" -03020241="Lêernaam:" -03020242="Nuwe lêer" -03020243="Fout by maak van nuwe lêer" - -03020250="Selekteer" -03020251="Deselekteer" -03020252="Masker:" - -03020260="Gidse-geskiedenis" - -03020280="Lêer '{0}' is gewysig.\nWil u dit bywerk in die argief?" -03020281="Kan lêer\n'{0}' nie bywerk nie" -03020282="Redigeerder nie aan die gang gesit word nie." -03020283="Besig om oop te maak..." - -03020300="Rekenaar" -03020301="Netwerk" - -030202A0="Stelsel" - -03020300="Rekenaar" -03020301="Network" - -03020400="Voeg by" -03020401="Pak uit" -03020402="Toets" - -03020420="Kopiëer" -03020421="Skuif" -03020422="Vee uit" -03020423="Intigting" - -03020500="Verdeel lêer" -03020501="&Verdeel na:" -03020510="Besig met verdeling..." - -03020600="Kombineer lêers" -03020601="&Kombineer na:" -03020610="Besig met kombinering..." - -; Computer -03031100="Totale grootte" -03031101="Vrye ruimte" -03031102="Klustergrootte" -03031103="Etiket" - -; Network -03031200="Plaaslike naam" -03031201="Verskaffer" - -; Benchmark Dialog - -03080000="Meet" -03080001="Geheuegebruik:" -03080002="Inpakking" -03080003="Uitpakking" -03080004="Spoed" -03080005="Gradering" -03080006="Totale gradering" -03080007="Huidige" -03080008="Resultaat" -03080009="Lopies:" -0308000A="Foute:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ar.txt b/tools/7-Zip/Lang/ar.txt deleted file mode 100644 index 1bc881b79d..0000000000 --- a/tools/7-Zip/Lang/ar.txt +++ /dev/null @@ -1,521 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.52 -; 20080215 Reviewed and corrected by Ahmad Gharbeia -; 20070819 Mohammad Deeb - corrected & updated -; 20070522 Awadh A Al-Ghaamdi - corrected & updated -; 20020111 Mohammad Deeb - first issue -; راجعه و صوبه أحمد غربية - -; IMPORTANT: This File contains Unicode control characters necessary to -; present Arabic messages in the right direction. These characters -; are invisible in editors by default. Caution should be taken when -; the file is edited, and the pattern of marking directionality with -; Unicode control characters observed for best results in the UI. -; هام للغاية: يحوي هذا الملف محارف تحكم يونيكود ضرورية لظهور العبارات العربية في الاتجاه الصحيح، و خاصة عند تداخلها مع كلمات بأحرف لاتينية؛ و هذه المحارف لا تكون -; ظاهرة بدئيا في محررات النصوص، لذا يرجى الانتباه عند تحريره و مراعا النسق المتبع في العبارات الموجودة لأجل أفضل نتيجة في واجهة المستخدم.. - -00000000="Arabic" -00000001="العربية" -00000002="1" - -; 7-Zip Configuration - -; Title -01000000="‮تضبيطات ‪7-Zip‬" - -; Info Page -01000100="‮عن ‪7-Zip‬" -01000103="‮هذه برمجية مجانية، لكنها إن أفادتك و أردت دعم تطويرها مستقبلا فيمكنك تسجيل نسختك مقابل مبلغ بسيط." -01000104="الدعم" -01000105="سجّل" - -; Folders Page -01000200="أدلة" -01000210="دليل ال&عمل" -01000211="الدليل المؤ&قت للنظام" -01000212="ال&حالي" -01000213="‮مُ&حدد:" -01000214="استخدمه فقط للوسائط للقابلة للنزع" - -01000281="حدد موضع الملفات المؤقتة للأرشيف." - -; System Page -01000300="نظام" -01000301="‮كامل ‪7-Zip‬ بقائمة سياق القشرة" -01000302="قائمة سياق منسدلة" -01000310="‮عناصر قائمة السياق:" - -; Language Page -01000400="اللغة" -01000401="‮اللغة:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="‮أوامر ‪7-Zip‬" -02000103="افتح الأرشيف" -02000104="يفتح الأرشيف المختار" -02000105="‮استخرج الملفات…" -02000106="يستخرج الملفات من الأرشيف المختار" -02000107="‮أضف إلى أرشيف…" -02000108="يضيف العناصر المختارة إلى أرشيف" -02000109="افحص الأرشيف" -0200010A="يفحص سلامة الأرشيف المختار" -0200010B="استخراج هنا" -0200010C="يستخرج الملفات من الأرشيف المختار إلى الدليل الحالي" -0200010D="استخرج إلى ‪{0}‬" -0200010E="يستخرج الملفات إلى دليل فرعي" -0200010F="أضف إلى ‪{0}‬" -02000110="يضف العناصر المختارة إلى أرشيف" -02000111="‮اضغط و أرسل…" -02000112="يضغط العناصر المختارة في أرشيف ثم يرسله بالبريد الإلكتروني" -02000113="اضغط إلى ‪{0}‬ ثم أرسل" -02000114="يضغط العناصر المختارة في أرشيف تحدده ثم يرسله بالبريد الإلكتروني" - -02000140="‮<دليل>" -02000141="‮<أرشيف>" - -; Properties -02000203="المسار" -02000204="الاسم" -02000205="الامتداد" -02000206="الدليل" -02000207="الحجم" -02000208="الحجم المضغوط" -02000209="خصائص" -0200020A="أنشئ في" -0200020B="فُتح في" -0200020C="عُدِّل في" -0200020D="مصمت" -0200020E="تعليق" -0200020F="مُعمَّى" -02000210="القسم السابق" -02000211="القسم اللاحق" -02000212="المعجم" -02000213="CRC" -02000214="النوع‪" -02000215="عكس" -02000216="الأسلوب" -02000217="النظام المضيف" -02000218="نظام الملفات" -02000219="المستخدم" -0200021A="المجموعة" -0200021B="الكتلة" -0200021C="تعليق" -0200021D="الموضع" -0200021E="بادئة المسار" -0200021F="الأدلة" -02000220="الملفات" -02000221="الإصدارة" -02000222="المجلد" -02000223="متعدد المجلدات" -02000224="إزاحة" -02000225="الروابط" -02000226="الكتل" -02000227="المجلدات" - -; Status bar -02000301="‮{0} عناصر مختارة" -02000302="‮{0} عناصر" - -02000320="‮ملفات:" -02000321="‮أدلة:" -02000322="‮الحجم:" -02000323="‮الحجم المضغوط:" -02000324="‮الأرشيفات:" - -; List Context Menu -02000401="‮أ&عمدة…" - -02000411="ا&فتح" -02000412="‮ا&ستخرج…" - -; ToolBar -02000501="استخرج" - -; Messages -02000601="عمليات التحديث غير مدعومة لنوع الأرشيف هذا." -02000602="‮تعذّر تحديث الأرشيف ‪{0}‬‬" -02000603="‮تعذّر إنشاء الدليل '‪{0}‬'" -02000604="ليس هذا الملف أرشيفا مدعوما." -02000605="عُطل" -02000606="عناصر أكثر من الممكن" -02000607="لا يرتبط امتداد اسم الملف المعطى بأي تطبيق" -02000608="لا أعطاب" -02000609="‮تعذّر فتح الملف '‪{0}‬' كأرشيف" -0200060A="‮تعذّر فتح الأرشيف المُعمَّى '‪{0}‬'. هل كلمة السرّ صحيحة؟" - -; Dialogs -02000702="حسن" -02000705="ن&عم" -02000707="&نعم للكل" -02000709="&لا" -0200070B="لا لل&كل " - -02000710="ألغِ" -02000711="أل&غِ" -02000713="أغل&ق" -02000714="أوقف" -02000715="أبدأ من جديد" - -02000720="مساعدة" - -; Extract dialog -02000800="استخرج" -02000801="‮ا&ستخرج إلى:" -02000802="كلمة السر" - -02000810="طور المسارات" -02000811="مسارات كاملة" -02000812="المسار الحالي" -02000813="بلا مسارات" - -02000820="طور استبدال الملفات" -02000821="اسأل قبل الاستبدال" -02000822="استبدل بلا توكيد" -02000823="تجاوز الملفات الموجودة" -02000824="غير الاسم آليا" -02000825="غير آليا أسماء الملفات الموجودة" - -02000830="الملفات" -02000831="الملفات الم&ختارة" -02000832="&كل الملفات" - -02000881="حدد موضع المفات المستخرجة." - -02000890="يجري الاستخراج" - -; Overwrite dialog -02000900="أكد قبل استبدال ملف" -02000901="الدليل الوجهة يحوي ملف بذات الاسم." -02000902="أتريد استبدال الملف الموجود" -02000903="بهذا الملف؟" - -02000911="&غيّر الاسم آليا" - -02000982="‮{0} بايت" -02000983="عُدِّل في" - -; Messages dialog -02000A00="رسائل الفحص" - -02000A80="رسالة" - -02000A91="‮أسلوب ضغط غير مدعوم في '‪{0}‬'" -02000A92="‮عطب بيانات في '‪{0}‬'؛ الملف مبتور." -02000A93="‮‪CRC‬ غير مطابق في '‪{0}‬'؛ الملف مبتور." -02000A94="‮عطب بيانات في الملف المعمَّى '‪{0}‬'. هل كلمة المرور صحيحة؟" -02000A95="‮فشل فحص ‪CRC‬ في الملف '‪{0}‬'. هل كلمة المرور صحيحة؟" - -; Password dialog -02000B00="أدخل كلمة السر" -02000B01="‮أدخل كلمة السر:" -02000B02="أ&ظهر كلمة السر" -02000B03="أعد إدخال كلمة السر:" -02000B10= "كلمتا المرور لا تطابقان" -02000B11="استخدم فقط أحرفا لاتينية و الأرقام و العلامات خاصة (! و # و $، إلخ…) في كلمة السر" -02000B12="كلمة المرور أطول مما ينبغي" - -; Progress dialog -02000C00="معالجة" -02000C01="‮الزمن المنقضي:" -02000C02="‮الزمن المتبقي:" -02000C03="‮الحجم:" -02000C04="‮السرعة:" -02000C05="الملفات المعالَجة:" -02000C06="نسبة الضغط:" - -02000C10="ال&خلفية" -02000C11="الم&قدمة" -02000C12="&جمِّد" -02000C13="&واصل" - -02000C20="مجمدة" - -02000C30="أمتأكد أنك تريد الإلغاء؟" - -; Compress dialog -02000D00="أضف إلى أرشيف" -02000D01="‮الأر&شيف:" -02000D02="‮طور الت&حديث:" -02000D03="‮صي&غة الأرشيف:" -02000D04="‮أ&سلوب الضغط:" -02000D05="أنشئ أرشيفا م&صمتا" -02000D06="‮معاملا&ت:" -02000D07="خيارات" -02000D08="أنشئ أرشيفا ذاتي الاستخراج" -02000D09="تعددية الخيوط" -02000D0A="&عمِّ أسماء الملفات" -02000D0B="‮&درجة الضغط:" -02000D0C="‮حجم المع&جم:" -02000D0D="‮&طول الكلمة:" -02000D0E="‮الذاكرة اللازمة للضغط:" -02000D0F="‮الذاكرة اللازمة للاستخراج:" -02000D10="التعمية" -02000D11="طريقة التعمية:" -02000D12="عدد خيوط المعالج الماكروي:" -02000D13="حجم الكتلة المصمتة:" -02000D14="غير مصمتة" -02000D15="مصمتة" -02000D16="اضغط الملفات المشتركة" - -02000D40="‮&قسِّم إلى أجزاء أو بايتات:" -02000D41="حجم المجلد غير صحيح" -02000D42="حجم المجلد المعين: ‪{0}‬ بايت\nأمتأكد أنك تريد تقسيم الأرشيف إلى كتل بهذا الحجم؟" - -02000D81="خزن" -02000D82="اعتيادي" -02000D83="الأقصى" -02000D84="سريع" -02000D85="الأسرع" -02000D86="فائق" - -02000D90="تصفح" - -02000DA1="إضافة و استبدال الملفات" -02000DA2="تحديث و إضافة الملفات" -02000DA3="تحديث الملفات الموجودة فقط" -02000DA4="مزامنة الملفات" - -02000DB1="كل الملفات" - -02000DC0="يجري الضغط" - -; Columns dialog -02000E00="الأعمدة" -02000E01="أشر الأعمدة التي تريد إظهارها في هذا الدليل. استخدم أزرار \"حرِّك لأعلى\" و \"حرِّك للأسفل\" لترتيب الأعمدة." -02000E02="يجب أن يكون عرض العمود المختار" -02000E03="عنصورة." - -02000E10="حرِّك لأعلى" -02000E11="حرِّك لأسفل" -02000E12="أ&ظهر" -02000E13="أ&خف" -02000E14="اضبط" - -02000E81="العنوان" -02000E82="العرض" - -; Testing -02000F90="الفحص" - - -; File Manager - -03000000="‮مدير ملفات ‪7-Zip‬" - -; Menu -03000102="&ملف" -03000103="&حرِّر" -03000104="ا&عرض" -03000105="أ&دوات" -03000106="مسا&عدة" -03000107="علامات" - -; File -03000210="ا&فتح" -03000211="افتح &هنا" -03000212="افتح خا&رجا" -03000220="است&عرض" -03000221="&حرِّر" -03000230="&غيِّر الاسم" -03000231="‮ان&سخ إلى…" -03000232="‮ا&نقل إلى…" -03000233="احذ&ف" -03000240="خ&صائص" -03000241="تعل&يق" -03000242="احسب التلبيدة" -03000250="أنشئ دليلا" -03000251="أنشئ ملفا" -03000260="ا&خرج" -03000270="‮&قسِّم الملف…" -03000271="‮ا&دمج الملفات…" - -; Edit -03000310="ت&راجع" -03000311="أ&عد" -03000320="&قص" -03000321="ا&نسخ" -03000322="أ&لصق" -03000323="احذ&ف" -03000330="اخ&تر الكل" -03000331="دع ال&كل" -03000332="اعك&س الاختيار" -03000333="‮اختر…" -03000334="‮دع…" -03000335="اختر حسب النوع" -03000336="دع حسب النوع" - -; View -03000410="أيقونات &كبيرة" -03000411="أيقونات &صغيرة" -03000412="&قائمة" -03000413="&تفصيلي" -03000420="غير مرتبة" -03000430="افتح الدليل الجذر" -03000431="مستوى واحد لأعلى" -03000432="‮تاريخ الأدلة…" -03000440="أن&عش" -03000449="منظور مسطح" -03000450="&لوحتان" -03000451="أشر&طة الأدوات" -03000460="شريط أدوات الأرشيفات" -03000461="شريط الأدوات القياسي" -03000462="أزرار كبيرة" -03000463="أظهر نصوص الأزرار" - -; Tools -03000510="‮&خيارات…" -03000511="الم&عايرة" - -; Help -03000610="‮ال&محتويات…" -03000620="‮&عن ‪7-Zip‬" - -; Favorites -03000710="أ&ضف الدليل إلى العلامات باسم" -03000720="علِّم" - -; Options Dialog - -03010000="خيارات" - -; Plugins -03010100="الملحقات" -03010101="‮المل&حقات:" -03010110="‮خيارات…" - -; Edit -03010200="المحرر" -03010201="‮ال&محرر:" - -; System -03010300="النظام" -03010302="‮اربط ‪7-Zip‬ بامتدادات الأسماء التالية:" -03010310="ملحقة" - -; Settings -03010400="تضبيطات" -03010401="‮أظهر عنصر \"..\"" -03010402="أظهر الأيقونات الفعلية للملفات" -03010410="أظهر قائمة النظام" -03010420="اختيار ال&صف بالكامل" -03010421="أظهر &خطوط الجدول" -03010430="طور الاختيار ال&بديل" -03010440="استخدم صفحات &ذاكرة كبيرة" - -; Strings - -03020201="انسخ" -03020202="انقل" -03020203="‮انسخ إلى:" -03020204="‮انقل إلى:" -03020205="‮يجري النسخ…" -03020206="‮يجري النقل…" -03020207="لا يمكن نسخ/نقل العناصر إلى مثل تلك الأدلة" -03020208="العملية غير مدعومة" -03020209="اختر الدليل الوجهة" - -03020210="تأكيد حذف ملف" -03020211="تأكيد حذف دليل" -03020212="تأكيد حذف عدة ملفات" -03020213="‮أمتأكد أنك تريد حذف '‪{0}‬'؟" -03020214="‮أمتأكد أنك تريد حذف الدليل '‪{0}‬' بكل محتوياته؟" -03020215="‮أمتأكد أنك تريد حذف ‪{0}‬ عناصر هذه؟" -03020216="‮يجري الحذف…" -03020217="عطل في حذف ملف أو دليل" - -03020220="‮يجري تغيير الاسم…" -03020221="عطل في تغيير اسم ملف أو دليل" -03020222="أكد نسخ ملف" -03020223="أمتأكد أنك تريد نسخ ملفات إلى دليل؟" - -03020230="أنشئ دليلا" -03020231="‮اسم الدليل:" -03020232="دليل جديد" -03020233="عطل في إنشاء دليل" - -03020240="أنشئ ملفا" -03020241="‮اسم الملف:" -03020242="ملف جديد" -03020243="عطل في إنشاء ملف" - -03020250="اختر" -03020251="دع" -03020252="القناع" - -03020260="تاريخ الأدلة" - -03020280="‮تغيّر الملف '‪{0}‬'.\nأتريد تحديثه في الأرشيف؟" -03020281="‮تعذّر تحديث الملف\n'‪{0}‬'" -03020282="لا يمكن بدء المحرر" -03020283="‮يجري فتح…" - -03020290="تعليق" -03020291="‮ت&عليق:" - -030202A0="النظام" - -03020300="الحاسوب" -03020301="الشبكة" - -03020400="أضف" -03020401="استخرج" -03020402="افحص" - -03020420="انسخ" -03020421="انقل" -03020422="ألغِ" -03020423="معلومات" - -03020500="‮قسِّم الملف‪" -03020501="‮&قسِّم إلى:" -03020510="‮يجري التقسيم…" -03020520="تأكيد التقسيم" -03020521="أتريد حقا تقسيم الملف إلى ‪{0}‬ قسما؟" -03020522="يجب أن يكون حجم القسم أقل من حجم الملف الأصلي" - -03020600="‮ادمج الملفات‪" -03020601="‮ا&دمج إلى:" -03020610="‮يجري الدمج…" -03020620="حدد الملف الأول فقط" - -03020710="‮يجري حساب التلبيدة…" -03020720="معلومات التلبيدة" -03020721="‮معلومات تلبيدة CRC للبيانات:" -03020722="‮معلومات تلبيدة CRC للبيانات و الأسماء:" - -03020800="‮يجري المسح…" - -03020900="الخصائص" - -; Computer -03031100="الحجم الكلي" -03031101="المساحة الشاغرة" -03031102="حجم العنقود" -03031103="العنوان" - -; Network -03031200="الاسم المحلي" -03031201="الموفِّر" - -; Benchmark Dialog - -03080000="المعايرة" -03080001="‮استغلال الذاكرة" -03080002="الضغط" -03080003="فك ضغط" -03080004="السرعة" -03080005="المستوى" -03080006="المستوى الكلي" -03080007="الحالي" -03080008="الناتج" -03080009="‮المرات" -0308000A="‮الأعطال" -0308000B="استغلال الـمعالج الماكروي" -0308000C="المستوى / الاستغلال" - - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ast.txt b/tools/7-Zip/Lang/ast.txt deleted file mode 100644 index c4d6206369..0000000000 --- a/tools/7-Zip/Lang/ast.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.07 beta -; Translated by Dinamiteru -; -; -; -; - -00000000="Asturian" -00000001="Asturianu" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="Configuración de 7-Zip" - -; Info Page -01000100="Al rodiu 7-Zip" -01000103="7-Zip ye software llibre. De toos moos, tú pues sofitar el desendolcu de 7-Zip rexistrándote." -01000105="Rexistrar" - -; Folders Page -01000200="Carpetes" -01000210="&Carpeta de trabayu" -01000211="Carpeta &temporal de sistema" -01000212="&Actual" -01000213="&Especificar:" -01000214="Usar sólo pa dispositivos estrayibles" - -01000281="Especificar llocalización pa ficheros d´archivos temporales." - -; System Page -01000300="Sistema" -01000301="Integrar 7-Zip nel menú contestual" -01000302="Menú contestual en ´cascada´" -01000310="Artículos del menú contestual:" - -; Language Page -01000400="Llingua" -01000401="Llingua:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Ordes 7-Zip" -02000103="Abrir archivu" -02000104="Abrir l´archivu seleicionáu." -02000105="Estrayer ficheros..." -02000106="Estrayer ficheros dende´l archivu seleicionáu." -02000107="Añedir al archivu..." -02000108="Añedir los oxetos seleicionaos al archivu." -02000109="Probar archivu" -0200010A="Probar integridá del archivu seleicionáu." -0200010B="Estrayer equí" -0200010C="Estrayer ficheros del archivu seleicionáu a la carpeta actual." -0200010D="Estrayer a {0}" -0200010E="Estrayer ficheros a subcarpeta." -0200010F="Añedir a {0}" -02000110="Añedir los oxetos seleicionaos al archivu." -02000111="Comprimir y mandar per correu..." -02000112="Comprimir los oxetos seleicionaos nel archivu y mandalu per correu." -02000113="Comprimir en {0} y mandar per correu" -02000114="Comprimir los oxetos seleicionaos nel archivu y mandalu per correu." - -02000140="" -02000141="" - -; Properties -02000203="Ruta" -02000204="Nome" -02000205="Estensión" -02000206="Carpeta" -02000207="Tamañu" -02000208="Tamañu comprimío" -02000209="Atributos" -0200020A="Creao" -0200020B="Accedío" -0200020C="Cambiao" -0200020D="Sólidu" -0200020E="Comentao" -0200020F="Cifrao" -02000210="Partir antes" -02000211="Partir dempués" -02000212="Diccionariu" -02000213="CRC" -02000214="Tipu" -02000215="Anti" -02000216="Métodu" -02000217="S.O. d´Acoyida" -02000218="Sistema de ficheros" -02000219="Usuariu" -0200021A="Grupu" -0200021B="Bloque" -0200021C="Comentariu" -0200021D="Posición" - -; Status bar -02000301="{0} oxetu(os) seleicionaos" -02000302="{0} oxetu(os)" - -; List Context Menu -02000401="&Columnes..." - -02000411="&Abrir" -02000412="&Estrayer..." - -; ToolBar -02000501="Estrayer" - -; Messages -02000601="Esti archivu nun permite les operaciones d´actualización." -02000602="Nun se puede actualizar l´archivu {0}" -02000603="Nun se puede crear la carpeta '{0}'" -02000604="El ficheru nun ye un archivu permitíu." -02000605="Error" -02000606="Demasiaos artículos" -02000607="Nun hai nengún programa asociau cola estensión del ficheru" -02000608="Ensín errores" - -; Dialogs -02000702="Val" -02000705="&Si" -02000707="Si a &Too" -02000709="&Non" -0200070B="Non a T&oo" - -02000710="Torgar" -02000711="&Torgar" -02000713="&Zarrar" -02000714="Parar" -02000715="Reentamar" - -02000720="Axuda" - -; Extract dialog -02000800="Estrayer" -02000801="E&strayer a:" -02000802="Clave" - -02000810="Mou de ruta" -02000811="Nomes de ruta completos" -02000812="Nomes de ruta actuales" -02000813="Ensín nomes de ruta" - -02000820="Mou de sobreescritura" -02000821="Entrugar enantes de sobreescribir" -02000822="Sobreescribir ensín confirmación" -02000823="Dexar ficheros esistentes" -02000824="Auto renomar" -02000825="Auto renomar ficheros esistentes" - -02000830="Ficheros" -02000831="Ficheros &seleicionaos" -02000832="&Tolos ficheros" - -02000881="Especificar llocalización pa ficheros estrayíos." - -02000890="Estrayendo" - -; Overwrite dialog -02000900="Confirmar sustitución de ficheros" -02000901="La carpeta destín yá tien el ficheru procesáu." -02000902="¿Quiés sustituyir el ficheru esistente" -02000903="con esti otru?" - -02000911="A&uto Renomar" - -02000982="{0} bytes" -02000983="modificao el" - -; Messages dialog -02000A00="Mensaxes de diagnósticu" - -02000A80="Mensax" - -02000A91="Métodu de compresión nun permitíu pa '{0}'." -02000A92="Error de datos en '{0}'. El ficheru ta rotu." -02000A93="El CRC falló en '{0}'. El ficheru ta rotu." - -; Password dialog -02000B00="Introduz clave" -02000B01="Introduz clave:" -02000B02="Amo&sar clave" - -; Progress dialog -02000C00="Procesu" -02000C01="Tiempu trescurríu:" -02000C02="Tiempu pa finar:" -02000C03="Tamañu:" -02000C04="Velocidá:" - -02000C10="&De fondu" -02000C11="&En primer planu" -02000C12="&Posar" -02000C13="&Siguir" - -02000C20="Posao" - -02000C30="¿Tas fixu que quies paralo?" - -; Compress dialog -02000D00="Añedir al archivu" -02000D01="&Archivu:" -02000D02="Mo&u d´actualización:" -02000D03="&Formatu del archivu:" -02000D04="&Métodu de compresión:" -02000D05="Crear archivu &sólidu" -02000D06="&Parámetros:" -02000D07="Opciones" -02000D08="Crear archivu SF&X" -02000D09="Multi-enfile" -02000D0A="Cifrar &nomes de ficheru" -02000D0B="Nive&l de compresión:" -02000D0C="Tamañu del &Diccionariu:" -02000D0D="Tamañu de la pa&llabra:" -02000D0E="Usu de memoria pa la compresión:" -02000D0F="Usu de memoria pa la descompresión:" - -02000D40="Partir en &cachos, bytes:" - -02000D81="Nenguna" -02000D82="Normal" -02000D83="Másima" -02000D84="Rápida" -02000D85="Más rápida" -02000D86="Ultra" - -02000D90="Agüeyar" - -02000DA1="Añedir y sustituyir ficheros" -02000DA2="Actualizar y añedir ficheros" -02000DA3="Actualizar ficheros esistentes" -02000DA4="Sincronizar ficheros" - -02000DB1="Tolos ficheros" - -02000DC0="Comprimiendo" - -; Columns dialog -02000E00="Columnes" -02000E01="Marca les columnes que quieras amosar nesta carpeta. Usa los botones Mover p´arriba y Mover p´abaxo pa reordenar les columnes." -02000E02="La columna selicionada tien de tener" -02000E03="pixels &d´anchu." - -02000E10="Mover &p´arriba" -02000E11="Mover p´a&baxo" -02000E12="Amo&sar" -02000E13="&Esconder" -02000E14="Iguar" - -02000E81="Títulu" -02000E82="Anchu" - -; Testing -02000F90="Probando" - - -; File Manager - -03000000="Xestor de ficheros de 7-Zip" - -; Menu -03000102="F&icheru" -03000103="&Remanar" -03000104="&Ver" -03000105="&Ferramientes" -03000106="A&xuda" -03000107="F&avoritos" - -; File -03000210="&Abrir" -03000211="Abrir &Dientro" -03000212="Abrir F&uera" -03000220="&Ver" -03000221="&Remanar" -03000230="Reno&mar" -03000231="&Copiar a..." -03000232="&Mover a..." -03000233="&Borrar" -03000240="P&ropiedaes" -03000241="Come&ntariu" -03000250="Crear carpeta" -03000251="Crear ficheru" -03000260="Co&lar" -03000270="&Partir ficheru..." -03000271="Com&binar ficheros..." - -; Edit -03000310="&Desfacer" -03000311="&Refacer" -03000320="Cor&tar" -03000321="&Copiar" -03000322="A&pegar" -03000323="&Borrar" -03000330="Seleicionar &Too" -03000331="Deseleicionar too" -03000332="&Invertir seleición" -03000333="Seleicionar..." -03000334="Deseleicionar..." -03000335="Seleicionar por Tipu" -03000336="Deseleicionar por Tipu" - -; View -03000410="Miniatures &Grandes" -03000411="&Miniatures Pequeñes" -03000412="&Llista" -03000413="&Detalles" -03000420="Ensín Ordenar" -03000430="Abrir Carpeta Raiz" -03000431="Xubir Un Nivel" -03000432="Hestorial de Carpetes..." -03000440="Actualiza&r" -03000450="&2 Paneles" -03000451="&Barres de Ferramientes" -03000460="Barra Ferramientes d´Archivu" -03000461="Barra Ferramientes Normal" -03000462="Botones Grandes" -03000463="Amosar Testu nos Botones" - -; Tools -03000510="&Opciones..." -03000511="&Bancu de Pruebes" - -; Help -03000610="&Conteníos..." -03000620="&Al rodiu 7-Zip..." - -; Favorites -03000710="&Añedir carpeta a Favoritos como" -03000720="Marca" - -; Options Dialog - -03010000="Opciones" - -; Plugins -03010100="Gabitos" -03010101="&Gabitos:" -03010110="Opciones..." - -; Edit -03010200="Remanaor" -03010201="&Remanaor:" - -; System -03010300="Sistema" -03010302="Asociar 7-Zip con:" -03010310="Gabitu" - -; Settings -03010400="Igües" -03010401="Amosar \"..\" artículu" -03010402="Amosar les miniatures reales del ficheru" -03010410="Amosar menú del sistema" -03010420="Seleicionar tola &fila" -03010421="Amosar les llinies de la &cuadrícula" - -; Strings - -03020201="Copiar" -03020202="Mover" -03020203="Copiar a:" -03020204="Mover a:" -03020205="Copiando..." -03020206="Moviendo..." -03020207="Nun se pueden mover o copiar aartículos pa ese carpetes." -03020208="La operación nun tá permitía." - -03020210="Confirmar Borráu de Ficheru" -03020211="Confirmar Borráu de Carpeta" -03020212="Confirmar Borráu Múltiple de Ficheros" -03020213="¿Tas fixu que quies borrar '{0}'?" -03020214="¿Tas fixu que quies borrar la carpeta '{0}' y tolos sos conteníos?" -03020215="¿Tas fixu que quies borrar estos {0} artículos?" -03020216="Borrando..." -03020217="Error al borrar el ficheru o carpeta" - -03020220="Renomando..." -03020221="Error al renomar el ficheru o carpeta" - -03020230="Crear Carpeta" -03020231="Nome de la carpeta:" -03020232="Nueva carpeta" -03020233="Error al crear la carpeta" - -03020240="Crear ficheru" -03020241="Nome del ficheru:" -03020242="Nuevu ficheru" -03020243="Error al crear el ficheru" - -03020250="Seleicionar" -03020251="Deseleicionar" -03020252="Mazcarita:" - -03020260="Hestorial de carpetes" - -03020280="El ficheru '{0}' foi modificáu.\nDo ¿Quies actualizalu nel archivu?" -03020281="Nun se pudo actualizar l´archivu\n'{0}'" -03020282="Nun se pudo entamar el Remanaor." -03020283="Abriendo..." - -03020290="Comentariu" -03020291="&Comentariu:" - -030202A0="Sistema" - -03020300="Ordenador" -03020301="Rede de Trabayu" - -03020400="Añedir" -03020401="Estrayer" -03020402="Probar" - -03020420="Copiar" -03020421="Mover" -03020422="Borrar" -03020423="Información" - -03020500="Partir Ficheru" -03020501="&Partir a:" -03020510="Partiendo..." - -03020600="Combinar Ficheros" -03020601="&Combinar a:" -03020610="Combinando..." - -; Computer -03031100="Tamañu total" -03031101="Espaciu llibre" -03031102="Tamañu del clúster" -03031103="Etiqueta" - -; Network -03031200="Nome llocal" -03031201="Suministrador" - -; Benchmark Dialog - -03080000="Bancu de Pruebes" -03080001="Usu de memoria:" -03080002="Comprimiendo" -03080003="Descomprimiendo" -03080004="Velocidá" -03080005="Valoración" -03080006="Valoración total" -03080007="Actual" -03080008="Resultáu" -03080009="Correutos:" -0308000A="Errores:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/az.txt b/tools/7-Zip/Lang/az.txt deleted file mode 100644 index 4fa6812004..0000000000 --- a/tools/7-Zip/Lang/az.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Translated by F@rhad -; -; -; - - -00000000="Azeri" -00000001="Azərbaycanca" -00000002="44" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Nizamlama" - -; Info Page -01000100="7-Zip haqqında" -01000103="7-Zip açıq proqramdır. Ancaq, üzv olaraq 7-zip inkişaf fəaliyyətinə qoşula bilərsiniz." -01000104="Texniki kömək" -01000105="Qeydiyyat" - -; Folders Page -01000200="Qovluqlar" -01000210="İş qovluğu" -01000211="Sistem TEMP qovluğu" -01000212="Cari qovluq" -01000213="Göstərilən qovluq:" -01000214="Yalnız çıxarıla bilən sürücülərlə işlə" - -01000281="Müvəqqəti arxiv sənədləri üçün bir yer göstərin." - -; System Page -01000300="Sistem" -01000301="Tərkib menülərində 7-Zip görünsün" -01000302="Açılan tərkib menüsü" -01000310="Tərkib menüsündəkilər:" - -; Language Page -01000400="Dil" -01000401="Dil:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip əmrləri" -02000103="Arxivi aç" -02000104="Seçilmiş arxivi açar." -02000105="Sənədləri çıxar..." -02000106="Seçilmiş arxivdən sənədləri çıxarar." -02000107="Arxivlə..." -02000108="Seçilənləri arxivə əlavə edər." -02000109="Arxivi sına" -0200010A="Seçilmiş arxivin tamlığını sınayar." -0200010B="Buraya çıxar" -0200010C="Seçilmiş arxivdəki sənədləri cari qovluqda çıxarar." -0200010D="{0} qovluğunda çıxar" -0200010E="Alt qovluğa çıxarar." -0200010F="{0} kimi arxivlə" -02000110="Seçilənləri arxivə əlavə edər." -02000111="Sıxıb e-məktubla göndər..." -02000112="Seçilənləri sıxıb arxivləyər və arxivi e-məktubla göndərər." -02000113="{0} kimi sıx və e-məktubla göndər" -02000114="Seçilənləri sıxıb arxivləyər və arxivi e-məktubla göndərər." - -02000140="" -02000141="" - -; Properties -02000203="Yol" -02000204="Ad" -02000205="Genişləmə" -02000206="Qovluq" -02000207="Ölçü" -02000208="Arxivdəki həcmi" -02000209="Xüsusi kəmiyyətlər" -0200020A="Yaranmış" -0200020B="Müdaxiləli" -0200020C="Dəyişmə" -0200020D="Tam" -0200020E="İzahlı" -0200020F="Kilidli" -02000210="Əvvəlki parça" -02000211="Sonrakı parça" -02000212="Lüğət" -02000213="CRC" -02000214="Tip" -02000215="Anti" -02000216="Sıxılma şəkli" -02000217="Sistem" -02000218="Sənəd Sistemi" -02000219="İstifadəçi" -0200021A="Qrup" -0200021B="Blok" -0200021C="İzah" -0200021D="Mövqe" -0200021E="Yol ön şəkilçisi" -0200021F="Qovluqlar" -02000220="Sənədlər" -02000221="Buraxılış" -02000222="Cild" -02000223="Çox cildli" -02000224="Ofset" -02000225="Körpülər" -02000226="Blok" -02000227="Cild" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Fiziki ölçü" -0200022D="Başlıqların ölçüsü" -0200022E="Checksum" -0200022F="Xarakteristika" -02000230="Xəyali ünvan" - -; Status bar -02000301="{0} ədəd seçildi" -02000302="{0} ədəd" - -02000320="Sənədlər:" -02000321="Qovluqlar:" -02000322="Ölçü:" -02000323="Sıxılmış halda ölçü:" -02000324="Arxivlər:" - -; List Context Menu -02000401="Sütunlar..." - -02000411="Aç" -02000412="Çıxar..." - -; ToolBar -02000501="Çıxar" - -; Messages -02000601="Bu arxivi yeniləyə bilməzsiniz." -02000602="{0} arxivi yenilənmir" -02000603="'{0}' qovluğu yaradıla bilmir" -02000604="Bu sənəd tanınan arxiv deyil." -02000605="Xəta" -02000606="Həddən artıq çoxdur" -02000607="Bu genişləməyə bağlı bir proqram yoxdur" -02000608="Xəta yoxdur." -02000609="'{0}' arxiv kimi açıla bilmir" -0200060A="Şifrlənmiş '{0}'arxivi açıla bilmir. Açar səhvdirmi?" -0200060B="Sistem lazımi qədər yaddaşı işlədə bilmir" -0200060C="Bilinməyən xəta baş verdi" -0200060D="Arxiv tipi tanınmır" - -; Dialogs -02000702="Oldu" -02000705="Bəli" -02000707="Hamısına bəli" -02000709="Xeyr" -0200070B="Hamısına xeyr" - -02000710="Olmadı" -02000711="Olmadı" -02000713="Bağla" -02000714="Saxla" -02000715="Təkrar başla" - -02000720="Kömək" - -; Extract dialog -02000800="Çıxar" -02000801="Çıxarılacaq yer:" -02000802="Açar" - -02000810="Yol adları" -02000811="Tam yol adları" -02000812="Cari yol adları" -02000813="Yol adları olmasın" - -02000820="Üzərinə yazılma" -02000821="Üstünə yazmaq üçün soruş" -02000822="Soruşmadan üstünə yaz" -02000823="Mövcud olanları nəzərə alma" -02000824="Avtomatik yenidən adlandır" -02000825="Mövcud olanları yenidən adlandır" - -02000830="Sənədlər" -02000831="Seçilmiş sənədlər" -02000832="Bütün sənədlər" - -02000881="Çıxarılacaq sənədlər üçün bir yer göstərin." - -02000890="çıxarılır" - -; Overwrite dialog -02000900="Üstünə yazma təsdiqi" -02000901="Hədəf qovluqda eyni adlı sənəd var. Üstünə yazılsın?" -02000902="Mövcud sənəd:" -02000903="bununla dəyişdirilsinmi:" - -02000911="Yenidən adlandır" - -02000982="{0} bayt" -02000983="son dəyişmə " - -; Messages dialog -02000A00="Bildirişlər" - -02000A80="Bildiriş" - -02000A91="'{0}' üçün sıxılma şəkli tanınmadı." -02000A92="'{0}' yararsızdır. (Verilənlər xətası)" -02000A93="'{0}' yararsızdır. (CRC xətası)" -02000A94="Şifrlənmiş '{0}' sənədində verilənlər xətası. Açar səhvdirmi?" -02000A95="Şifrlənmiş '{0}' sənədində CRC xətası. Açar səhvdirmi?" - -; Password dialog -02000B00="Açar" -02000B01="Açarı daxil edin:" -02000B02="Açar görünsün" -02000B03="Açarı təkrarlayın:" -02000B10="Açarlar eyni deyil" -02000B11="Açar üçün yalnız İngilis hərfləri, rəqəm və xüsusi simvollardan (!, #, $, ...) istifadə edin" -02000B12="Açar çox uzundur" - -; Progress dialog -02000C00="İş" -02000C01="Keçən müddət:" -02000C02="Qalan müddət:" -02000C03="Həcm:" -02000C04="Sür'ət:" -02000C05="Yerinə yetirilən:" -02000C06="Sıxılma dərəcəsi:" - -02000C10="Arxa planda" -02000C11="Ön planda" -02000C12="Ara ver" -02000C13="Davam et" - -02000C20="Ara verildi - " - -02000C30="Həqiqətən əməliyyatın dayandırılmasını istəyirsiniz?" - -; Compress dialog -02000D00="Arxivlə" -02000D01="Arxiv:" -02000D02="Yeniləmə şəkli:" -02000D03="Arxiv növü:" -02000D04="Sıxılma şəkli:" -02000D05="Tam olsun" -02000D06="Parametrlər:" -02000D07="Seçmələr" -02000D08="Özü cıxarılan olsun (SFX)" -02000D09="Çox ilməli" -02000D0A="Sənəd adlarını şifrlə" -02000D0B="Sıxılma səviyyəsi:" -02000D0C="Lüğət ölçüsü:" -02000D0D="Söz ölçüsü:" -02000D0E="Yaddaş istifadəsi (Sıxma):" -02000D0F="Yaddaş istifadəsi (Açma):" -02000D10="Şifrləmə" -02000D11="Şifrləmə üsulu:" -02000D12="CPU axın sayı:" -02000D13="Ardıcıl blok ölçüsü:" -02000D14="Qeyri ardıcıl" -02000D15="Ardıcıl" -02000D16="Birgə istifadəyə açıq sənədlər sıxılsın" - -02000D40="Cildlərə böl (Bayt):" -02000D41="Cild ölçüsü düz deyil" -02000D42="Tə'yin edilmiş cild ölçüsü: {0} bayt.\nArxivi bu ölçü ilə cildlərə bölmək istədiyinizə əminsinizmi?" - -02000D81="Sıxılmasız" -02000D82="Normal" -02000D83="Ən yüksək" -02000D84="Sür'ətli" -02000D85="Ən sür'ətli" -02000D86="Ultra" - -02000D90="Göz gəzdir" - -02000DA1="Artır və dəyişdir" -02000DA2="Yenilə və artır" -02000DA3="Yalnız yenilə" -02000DA4="Tutuşdur" - -02000DB1="Bütün sənədlər" - -02000DC0="sıxılır" - -; Columns dialog -02000E00="Sütunlar" -02000E01="Bu qovluqda görünə bilən olmasını istədiyiniz sütunları işarələyin. Sütunları düzmək üçün yuxarı-aşağı düymələrindən istifadə edin." -02000E02="Seçilən sütun genişliyi" -02000E03="nöqtə olsun." - -02000E10="Yuxarı" -02000E11="Aşağı" -02000E12="Göstər" -02000E13="Gizlə" -02000E14="Tə'yin et" - -02000E81="Başlıq" -02000E82="Genişlik" - -; Testing -02000F90="Sınaq" - - -; File Manager - -03000000="7-Zip Sənəd İdarəedicisi" - -; Menu -03000102="Sənəd" -03000103="Düzəliş" -03000104="Baxış" -03000105="Vasitələr" -03000106="Kömək" -03000107="Çox işlədilənlər" - -; File -03000210="Aç" -03000211="Burada aç" -03000212="Pəncərədə aç" -03000220="Göstər" -03000221="Dəyişiklik et" -03000230="Yenidən adlandır" -03000231="Köçür" -03000232="Yerini dəyiş" -03000233="Sil" -03000240="Xüsusiyyətlər" -03000241="Şərh" -03000242="Yoxlama cəmini hesabla" -03000250="Qovluq yarat" -03000251="Sənəd yarat" -03000260="Çıx" -03000270="Böl..." -03000271="Birləşdir..." - -; Edit -03000310="Geri get" -03000311="Təkrarla" -03000320="Kəs" -03000321="Köçür" -03000322="Yapıştır" -03000323="Sil" -03000330="Hamısını seç" -03000331="Heç birin seçmə" -03000332="Tərsini seç" -03000333="Seç..." -03000334="Seçmə..." -03000335="Bu genişləməni seç" -03000336="Genişləmə seçmə" - -; View -03000410="Böyük Simvollar" -03000411="Kiçik Simvollar" -03000412="Siyahı" -03000413="Cədvəl" -03000420="Sırasız" -03000430="Kök qovluğu aç" -03000431="Bir səviyyə yuxarı" -03000432="Qovluq tarixçəsi..." -03000440="Yenilə" -03000449="Müstəvi görünüş" -03000450="2 lövhə" -03000451="Alət çubuğu" -03000460="Arxiv çubuğu" -03000461="Standart çubuq" -03000462="Böyük düymələr" -03000463="Düymə mətni görünsün" - -; Tools -03000510="Seçmələr..." -03000511="FİƏ ölçüsü" - -; Help -03000610="İçindəkilər..." -03000620="7-Zip haqqında..." - -; Favorites -03000710="Cari qovluğu artır" -03000720="Yer" - -; Options Dialog - -03010000="Seçmələr" - -; Plugins -03010100="Əlavə tərkiblər" -03010101="Əlavə tərkiblər:" -03010110="Xüsusiyyətlər" - -; Edit -03010200="Mətn düzəltmə" -03010201="Mətn düzəltmə:" - -; System -03010300="Sistem" -03010302="7-Zip-ə bağla:" -03010310="Əlavə tərkib" - -; Settings -03010400="Tənzimləmələr" -03010401="\"..\" görünsün" -03010402="Sənədlərin həqiqi simvolları görünsün" -03010410="Sistem menüsü görünsün" -03010420="Bütün sətir seçilsin" -03010421="Ayırıcılar görünsün" -03010430="Alternativ seçki rejimi" -03010440="Geniş yaddaş səhifələri işlət" - -; Strings - -03020201="Köçür" -03020202="Yerini dəyiş" -03020203="Köçürüləcək yer:" -03020204="Yer dəyişdiriləcək yer:" -03020205="köçürülür..." -03020206="yer dəyişdirilir..." -03020207="Köçürülmə və ya yer dəyişmə bu cür qovluq üçün mümkün deyil." -03020208="İş mümkün deyil." -03020209="Qovluq seçin." - -03020210="Sənəd silmə təsdiqi" -03020211="Qovluq silmə təsdiqi" -03020212="Birdən çox sənədi silmə təsdiqi" -03020213="\"{0}\" silinsin?" -03020214="\"{0}\" qovluğu və içindəkilər silinsin?" -03020215="Bu {0} ədəd silinənlər geri qaytarılmayacaq, silinsin?" -03020216="silinir..." -03020217="Silmə xətası" -03020218="Sistem uzun yola malik sənədi zibil qutusuna ata bilmir" - -03020220="yeni ad verilir..." -03020221="Adlandırma xətası" -03020222="Sənəd köçürülməsi təsdiqi" -03020223="Sənədləri arxivə köçürmək istədiyinizə əminsinizmi" - -03020230="Qovluq yarat" -03020231="Qovluq adı:" -03020232="Yeni qovluq" -03020233="Qovluq yaratma xətası" - -03020240="Sənəd yarat" -03020241="Sənəd adı:" -03020242="Yeni sənəd" -03020243="Sənəd yaratma xətası" - -03020250="Seç" -03020251="Seçmə" -03020252="Seçmə ifadəsi:" - -03020260="Qovluq tarixçəsi" - -03020280="'{0}' sənədi dəyişmişdir.\nArxivdə yenilənməsini istəyirsinizmi?" -03020281="'{0}' sənədi yenilənmədi" -03020282="Mətn düzəltmə işə düşmədi." -03020283="açılır..." -03020284="Sənəd virusa bənzəyir (sənəd adında çıx sayda simvol işlədilir)." - -03020290="Şərh" -03020291="Şərh:" - -030202A0="Sistem" - -03020300="EHM" -03020301="Şəbəkə" -03020302="Sənədlər" - -03020400="Arxivlə" -03020401="Çıxar" -03020402="Sına" - -03020420="Köçür" -03020421="Yerini dəyiş" -03020422="Sil" -03020423="Mə'lumat" - -03020500="Böl" -03020501="Bu qovluqda böl:" -03020510="bölünür..." -03020520="Bölünmə təsdiqi" -03020521="Sənədi {0} cildə bölmək istədiyinizə əminsinizmi?" -03020522="Cild ölçüsü sənədin ölçüsündən kiçik olmalıdır" - -03020600="Birləşdir" -03020601="Bu qovluqda birləşdir:" -03020610="birləşdirilir..." -03020620="Yalnız birinci sənədi seçin" -03020621="Sənədi bölünmüş sənədin bir hissəsi kimi qəbul etmək olmur" -03020622="Bölünmüş sənədin birdən çox parçası tapıla bilmir" - -03020710="Yoxlama cəmi hesablanır..." -03020720="Yoxlama cəmi" -03020721="Verilənlər üçün CRC yoxlama cəmi:" -03020722="Verilənlər və adlar üçün CRC yoxlama cəmi:" - -03020800="Oxunur..." - -03020900="Xüsusiyyətlər" - -03020A01="Əməliyyat uzun yola malik qovluqdan işə salına bilmir." -03020A02="Bir sənəd seçməlisiniz" -03020A03="Bir və ya daha çox sənəd seçməlisiniz" -03020A04="{0} sənədi mövcuddur" - -; Computer -03031100="Cəmi həcm" -03031101="Boş yer" -03031102="Qism həcmi" -03031103="Açıqlama" - -; Network -03031200="Yerli ad" -03031201="Tə'min edici" - -; Benchmark Dialog - -03080000="FİƏ ölçülməsi" -03080001="Yaddaş istifadəsi:" -03080002="Sıxma" -03080003="Çıxarma" -03080004="Sür'ət" -03080005="Xal" -03080006="Təxmini orta xal" -03080007="Cari" -03080008="Nəticə" -03080009="Müvəffəqiyyət:" -0308000A="Xətalar:" -0308000B="CPU istifadəsi" -0308000C="Üstünlük / İstifadə" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ba.txt b/tools/7-Zip/Lang/ba.txt deleted file mode 100644 index 68902cba7d..0000000000 --- a/tools/7-Zip/Lang/ba.txt +++ /dev/null @@ -1,538 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.65 -; Translated by Farit (Haqmar-www.bashqort.com) -; -; -; -; - -00000000="Bashkir" -00000001="Башҡортса" -00000002="109" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Яйлау" - -; Info Page -01000100="7-Zip тураhында" -01000103="7-Zip – ирекле рәүештә таратылған программа. Шулай ҙа һеҙ теркәлеп был программаның үҫешенә ярҙам итә алаһығыҙ." -01000104="Ярҙам" -01000105="Теркәлеү" - -; Folders Page -01000200="Папкалар" -01000210="&Эш папкаһы" -01000211="&Ваҡытлыса папка (temp)" -01000212="Ғә&мәлдәге" -01000213="&Папка билдәлә:" -01000214="Алмаш ташығыстар өсөн генә ҡулланырға" - -01000281="Вакытлыса архивтар өсөн урын билдәлә." - -; System Page -01000300="Система" -01000301="Контекст менюла 7-Zip күренһен" -01000302="Каскадлы контекст меню" -01000310="Контекст меню элементтары:" - -; Language Page -01000400="Тел һайлау" -01000401="Тел:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip әмерҙәре" -02000103="Архивты асырға" -02000104="Һайланған архивты аса." -02000105="Файлдар сығарыу..." -02000106="Һайланған архивтан файлдарҙы сығара." -02000107="Архивларға..." -02000108="Һайланған матдәләрҙе архивға өҫтәй." -02000109="Архивты һынарға" -0200010A="Һайланған архивтың бөтөнлөгөн тикшерә." -0200010B="Бында сығарырға" -0200010C="Һайланған архивтағы файлдарҙы ғәмәлдәге папкаға сығара." -0200010D="{0} папкаһына сығарырға" -0200010E="Файлдарҙы эс папкаға сығара." -0200010F="{0} итеп архивла" -02000110="Һайланған есемдәрҙе архивға өҫтәй." -02000111="Архивлап, e-mail менән ебәрергә..." -02000112="Һайланған есемдәрҙе архивға өҫтәй һәм архивды e-mail менән ебәрә." -02000113="{0} итеп архивларға һәм e-mail менән ебәрергә" -02000114=" Һайланған есемдәрҙе архивға өҫтәй һәм архивды e-mail менән ебәрә." - -02000140="<Папка>" -02000141="<Архив>" - -; Properties -02000203="Юл" -02000204="Исем" -02000205="Киңәйеүе" -02000206="Папка" -02000207="Күләм" -02000208="Архивдағы күләме" -02000209="Мәғлүмәт" -0200020A="Яһалған" -0200020B="Ирешелгән" -0200020C="Мөхәррирләнгән" -0200020D="Ҡаты" -0200020E="Аңлатма" -0200020F="Серләнгән" -02000210="Алдағы киҫәк" -02000211="Киләһе киҫәк" -02000212="Һүҙлек" -02000213="CRC" -02000214="Төр" -02000215="Анти" -02000216="Ҡыҫыу ысулы" -02000217="Хост ОС" -02000218="Файл системаһы" -02000219="Ҡулланыусы" -0200021A="Tөркөм" -0200021B="Блок" -0200021C="Тасуирлама" -0200021D="Урыны" -0200021E="Юл префиксы" -0200021F="Папкалар" -02000220="Файлдар" -02000221="Версия" -02000222="Том" -02000223="Күпле том" -02000224="Шылыу" -02000225="Һылтанмалар" -02000226="Блоктар" -02000227="Томдар" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="Процессор" -0200022C="Физик күләме" -0200022D="Башлыҡтар күләме" -0200022E="Тикшереү суммаһы" -0200022F="Характеристикалар" -02000230="Виртуаль адрес" - -; Status bar -02000301="{0} есем һайланған" -02000302="{0} есем" - -02000320="Файл:" -02000321="Папка:" -02000322="Күләм:" -02000323="Архивланған:" -02000324="Архивдар:" - -; List Context Menu -02000401="&Бағаналар..." - -02000411="&Асыу" -02000412="&Сығарыу..." - -; ToolBar -02000501="Сығарыу" - -; Messages -02000601="Был архивды яңыртыу ғәмәлен үтәп булмай." -02000602="{0} архивын яңыртып булмай" -02000603="{0} янсығын яһап булмай" -02000604="Был файл танылған архив төрө түгел." -02000605="Хата" -02000606="Бик күп есем" -02000607="Был файл киңәйеүе менән килешкән өҫтәмә юҡ" -02000608="Хата табылманы" -02000609="'{0}' файлын архив һымаҡ асып булмай" -0200060A="Шифрланған '{0}' файлын асып булманы. Хаталы пароль?" -0200060B="Буш хәтер етмәй" -0200060C="Беленмәгән хата" -0200060D="Терәкләнмәгән архив төрө" - -; Dialogs -02000702="Тамам" -02000705="&Эйе" -02000707="Бөтәһенә лә Э&йе" -02000709="&Юҡ" -0200070B=" Бөтәһенә лә Ю&ҡ" - -02000710="Кире ал" -02000711="&Кире ал " -02000713="&Яп" -02000714="Туҡта" -02000715="Яңынан башла" - -02000720="Ярҙам" - -; Extract dialog -02000800="Сығар" -02000801="Бында &сығар:" -02000802="Пароль" - -02000810="Юл исемдәре" -02000811="&Тулы юл исемдәре " -02000812="Ғәмәлдәге юл исемдәре " -02000813="Юл исемдәре булмаһын" - -02000820="Өҫтөнә яҙыу" -02000821="&Өҫтөнә яҙыу алдынан һора" -02000822="&Өҫтөнә яҙыу алдынан һорама" -02000823="Булған файлдарҙы үтеп кит" -02000824="Яңы исем ҡуш" -02000825="Булған файлдарға яңы исем ҡуш" - -02000830="Файлдар" -02000831="Һ&айланған файлдар" -02000832="&Бөтә файлдар " - -02000881="Сығарыласаҡ файлдар өсөн урын һайлағыҙ." - -02000890="Сығарыу бара..." - -; Overwrite dialog -02000900="Файл алмаштырыуҙы раҫлағыҙ" -02000901="Сығарыласаҡ папкала эшкәртелгән файл бар." -02000902="Булған" -02000903="файлын киләһе менән алыштырырғамы?" - -02000911="&Яңы исем ҡушылһын" - -02000982="{0} байт" -02000983="һуңғы мөхәррирләнеүе" - -; Messages dialog -02000A00="Тикшереү белдереүҙәре" - -02000A80="Белдереү" - -02000A91="'{0}' файлын ҡыҫыу ысулын табып булманы." -02000A92="'{0}' файлында мәғлүмәт хатаһы бар. Файл боҙоҡ." -02000A93="'{0}' файлында CRC хатаһы бар. Файл боҙоҡ." -02000A94="Шифрланған '{0}' файлы мәғлүмәттәрендә хата. Хаталы пароль?" -02000A95="Шифрланған '{0}' файлында CRC хатаһы. Хаталы пароль?" - -; Password dialog -02000B00="Пароль керетеү" -02000B01="&Паролде керетегеҙ:" -02000B02="П&ароль күренһен" -02000B03="Па&ролде яңынан керетегеҙ:" -02000B10="Паролдәр тап килмәй" -02000B11="Пароль өсөн тик латин хәрефтәрен, һандарҙы һәм махсус символдарҙы (!, #, $, ...) ҡулланығыҙ" -02000B12="Пароль бик оҙон" - -; Progress dialog -02000C00="Процесс" -02000C01="Үткән ваҡыт:" -02000C02="Ҡалған ваҡыт:" -02000C03="Барыһы:" -02000C04="Тиҙлек:" -02000C05="Күләм:" -02000C06="Ҡыҫыу нисбәте:" - -02000C10="&Артҡы планда" -02000C11="А&лғы планда" -02000C12="&Туҡтатып тор" -02000C13="&Дауам" - -02000C20="Паузала" - -02000C30="Был эште ысынлап та өҙөргә теләйһегеҙме?" - -; Compress dialog -02000D00="Архивлау" -02000D01="&Архив:" -02000D02="&Яңыртыу ысулы:" -02000D03="А&рхив төрө:" -02000D04="Ҡ&ыҫыу ысулы:" -02000D05="Ҡа&ты архив яһа" -02000D06="&Параметрҙар:" -02000D07="&Көйләү" -02000D08="SFX ар&хивын яһау" -02000D09="Күп &элмәкле" -02000D0A="&Файл исемдәрен шифрла" -02000D0B="Ҡыҫыу &дәрәжәһе:" -02000D0C="Һүҙ&лек күләме:" -02000D0D="Һүҙ күлә&ме:" -02000D0E="Ҡыҫҡанда хәтер ҡулланыу:" -02000D0F="Сығарғанда хәтер ҡулланыу:" -02000D10="Шифрлау" -02000D11="Шифрлау методы:" -02000D12="Ағымдар һаны:" -02000D13="Блоктар күләме:" -02000D14="Файл күләме буйынса" -02000D15="Өҙөлмәгән" -02000D16="Яҙыуға асыҡ файлдарҙы ҡыҫырға" - -02000D40="Киҫәк/&байт итеп бүл:" -02000D41="Хаталы том күләме" -02000D42="Том күләме : {0} байт.\nФайлды бындай томдарға бүлеүҙе раҫлайһығыҙмы?" - -02000D81="Ҡыҫыуһыҙ" -02000D82="Ғәҙәти" -02000D83="Максимум" -02000D84="Тиҙ" -02000D85="Бик тиҙ" -02000D86="Ультра" - -02000D90="Ҡарау" - -02000DA1="Өҫтәргә һәм алмаштырырға" -02000DA2="Яңыртырға һәм өҫтәргә" -02000DA3="Яңыртырға" -02000DA4="Синхронларға" - -02000DB1="Бар файлдар" - -02000DC0="Ҡыҫыу бара..." - -; Columns dialog -02000E00="Бағаналар" -02000E01="Был папкала күренәсәк бағаналарҙы билдәләгеҙ. Бағаналарҙы рәтләү өсөн Өҫкә һәм Аҫҡа төймәләрен ҡулланығыҙ" -02000E02="һайланған бағаналарҙың киңлеге" -02000E03="&нөктә булһын." - -02000E10="Өҫ&кә" -02000E11="&Аҫҡа" -02000E12="Кү&рһәт" -02000E13="&Йәшер" -02000E14="Ҡуйырға" - -02000E81="Башлыҡ" -02000E82="Киңлек" - -; Testing -02000F90="hынау" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Файл" -03000103="Һа&йлау" -03000104="&Күренеш" -03000105="&Сервис" -03000106="&Белешмә" -03000107="Һ&айланмалар" - - -; File -03000210="&Асырға" -03000211="&Эсендә асырға" -03000212="&Тышта асырға" -03000220="Ҡа&рау" -03000221="&Мөхәррирләргә" -03000230="&Исемен алыштырырға" -03000231="&Күбәйтергә..." -03000232="Кү&серергә..." -03000233="&Юйырға" -03000240="Мәғ&лүмәт" -03000241="Тас&уирлама" -03000242="Тикшереү һаны" -03000250="Яңы папка..." -03000251="Яңы &файл..." -03000260="С&ығырға" -03000270="Файлды &бүл..." -03000271="Файлдар бер&ләштереү..." - -; Edit -03000310="&Кире ал" -03000311="Ҡ&айтар" -03000320="К&иҫ" -03000321="&Хәтергә ал" -03000322="&Йәбештер" -03000323="&Юй" -03000330="&Бөтәһен дә һайларға" -03000331="Һай&лаузы кире алырға" -03000332="Бил&дәләнгәндәрзе кире әйләндерергә" -03000333="Маска менән һайларға..." -03000334="Һайлаузы ябырға..." -03000335="Төр буйынса һайларға" -03000336="Төр буйынса һайлаузы ябырға" - -; View -03000410="&Эре тамғалар" -03000411="&Бәләкәй тамғалар" -03000412="&Исемлек" -03000413="&Ентекле" -03000420="Тәртип булмаһын" -03000430="Төп папканы ас" -03000431="Бер кимәл юғары" -03000432="Папкалар тарихы..." -03000440="&Яңырт" -03000449="Барыһын да күрһәт" -03000450="&2 Панель" -03000451="&Сервис панеле" -03000460="&Архивлау төймәләре" -03000461="Стандарт төймәләр" -03000462="Эре төймәләр" -03000463="Төймәләр аңлатмалы" - -; Tools -03000510="&Көйләү..." -03000511="&Етештереүсәнлекте үлсәү" - -; Help -03000610="&Эстәлек..." -03000620="7-Zip &тураhында..." - -; Favorites -03000710="Ғәмәлдәге папканы һайланғандарға ал:" -03000720="Урын" - -; Options Dialog - -03010000="Яйлау" - -; Plugins -03010100="Өҫтәмәләр" -03010101="&Өҫтәмәләр:" -03010110="Яйлауҙар..." - -; Edit -03010200="Мөхәррирләүсе" -03010201="&Мөхәррирләүсе:" - -; System -03010300="Система" -03010302="7-Zip менән килештер:" -03010310="Өҫтәмә" - - -; Settings -03010400="Көйләү" -03010401="\"..\" есеме күренһен" -03010402="Файлдарҙың ысын тамғалары күренһен" -03010410="Система менюһы күренһен" -03010420="Бөтә юл һайланһын" -03010421="Һыҙыҡтар күренһен" -03010430="Альтернатив һайлау ысулы" -03010440="Ҙур хәтер биттәрен ҡуллан" - -; Strings - -03020201="Хәтергә ал" -03020202="Күсер" -03020203="Күбәйтеләсәк урын:" -03020204="Күсереләсәк урын:" -03020205="Күбәйтеү..." -03020206="Күсереү..." -03020207="Был папка өсөн есемдәрҙе күбәйтеп йәки күсереп булмай." -03020208="Ғәмәлде үтәп булмай" -03020209="Папканы күрһәтегеҙ." - -03020210="Файл юйыуҙы раҫлау" -03020211="Папка юйыуҙы раҫлау" -03020212="Берҙән күп файл юйыуҙы раҫлау" -03020213="'{0}' юйылһынмы?" -03020214="'{0}' папкаһы һәм эсендәгеләр юйылһынмы?" -03020215="{0} есеме юйылһынмы?" -03020216="Юйыу бара..." -03020217="Файл йәки папка юйыу хатаһы" -03020218="Оҙон юллы файлдарҙы кәрзингә юйыуҙы система терәкләмәй" - -03020220="Яңынан исемләү бара..." -03020221="Файлға йәки папкаға яңы исем биреү хатаһы" -03020222="Файлдарҙы күбәйтеүҙе раҫлау" -03020223="Был файлдар архивға ҡуйылһынмы?" - -03020230="Папка яhа" -03020231="Папка исеме:" -03020232="Яңы папка" -03020233="Папка яһау хатаһы" - -03020240="Файл яhа" -03020241="Файл исеме:" -03020242="Яңы файл" -03020243="Файл яһау хатаһы" - -03020250="hайла" -03020251="Һайлауҙы кире ал" -03020252="Маска:" - -03020260="Папкалар тарихы" - -03020280="'{0}' файлы мөхәррирләнде.\nБыл файл архивта яңыртылһынмы?" -03020281="Файлды яңыртып булманы\n'{0}'" -03020282="Мөхәррирләүсене асып булманы." -03020283="Асыла..." -03020284="Файл вирусҡа оҡшаған (файл исемендә бер-бер артлы килгән күп бушлыҡтар бар)." - -03020290="Тасуирлама" -03020291="&Асыҡлама:" - -030202A0="Система" - -03020300="Компьютер" -03020301="Селтәр" -03020302="Документтар" - -03020400="Архивларға" -03020401="Сығарырға" -03020402="Һынарға" - -03020420="Күбәйтергә" -03020421="Күсерергә" -03020422="Юйырға" -03020423="Мәғлүмәт" - -03020500="Файлды бүл" -03020501="&Ошо папкаға бүл:" -03020510="Бүлеү бара..." -03020520="Бүлеүҙе раҫлау" -03020521="Был файлды {0} киҫәккә бүлеүҙе раҫлайһығыҙмы?" -03020522="Том күләме сығанак файлдан бәләкәй булырға тейеш" - -03020600="Файлдарҙы берләштер " -03020601="&Ошо папкала берләштер:" -03020610="Берләштереү бара..." -03020620="Бүленгән файлдың беренсе киҫәген генә һайлағыҙ" -03020621="Бүленгән файлды танып булманы" -03020622="Бүленгән файлдың берҙән күп киҫәген табып булманы" - - -03020710="Тикшереү һанын иҫәпләү бара..." -03020720="Тикшереү һаны" -03020721="Мәғлүмәттәр өсөн CRC тикшереү һаны:" -03020722=" Мәғлүмәттәр һәм исемдәр өсөн CRC тикшереү һаны:" - -03020800="Тарау бара..." - -03020900="Мәғлүмәт" - -03020A01="Ғәмәлде бындай оҙон юллы папканан үтәп булмай." -03020A02="Бер файлды һайлау кәрәк" -03020A03="Бер йәки күберәк файлды һайлау кәрәк" -03020A04="{0} файлы бар" - - -; Computer -03031100="Бар күләм" -03031101="Буш урын" -03031102="Бөртөк күләме" -03031103="Билдә" - -; Network -03031200="Урындағы Исем" -03031201="Провайдер" - -; Benchmark Dialog - -03080000="Етештереүсәнлекте тикшереү" -03080001="Хәтер ҡулланыу:" -03080002="Ҡыҫыу" -03080003="Сығарыу" -03080004="Тиҙлек" -03080005="Рейтинг" -03080006="Дөйөм рейтинг" -03080007="Хәҙерге" -03080008="Һөҙөмтә" -03080009="Үтеүҙәр:" -0308000A="Хаталар:" -0308000B="Процессор ҡулланыу" -0308000C="Рейтинг / Проц. ҡулл." - -;!@LangEnd@! \ No newline at end of file diff --git a/tools/7-Zip/Lang/be.txt b/tools/7-Zip/Lang/be.txt deleted file mode 100644 index b239e2d0fb..0000000000 --- a/tools/7-Zip/Lang/be.txt +++ /dev/null @@ -1,479 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Translated by Drive DRKA -; Last modification : -; 05-09-2007 15:27 -; -; - -00000000="Belarusian" -00000001="Беларуская" -00000002="35" - -; 7-Zip Configuration -; Title -01000000="7-Zip - Канфігурацыя" - -; Info Page -01000100= "Аб праграме 7-Zip" -01000103= "7-Zip з'яўляецца вольна распаўсюджваемай праграмай. Аднак калі вы жадаеце падтрымаць распрацоўку 7-Zip, вы можаце зарэгістраваць праграму.Праграма перакладена Drive DRKA.Мая электронная скрыня: drka2003@mail.ru.Пераклад зроблен у верасні 2007 года." -01000104= "Падтрымка" -01000105= "Зарэгістраваць" - -; Folders Page -01000200="Папкі" -01000210="&Працоўная Папка" -01000211="&Сістэмная часавая Папка" -01000212="&Бягучая" -01000213="&Задаць:" -01000214="Выкарыстаць толькі для зменных носьбітаў" -01000281="Пакажыце становішча для часавых архіваў." - -; System Page -01000300="Сістэма" -01000301="Убудаваць 7-Zip у кантэкстнае меню абалонкі" -01000302="Каскаднае кантэкстнае меню" -01000310="Элементы кантэкстнага меню:" - -; Language Page -01000400="Мова" -01000401="Мова:" - -; 7-Zip Explorer extension -; Context menu -02000101="7-Zip" -02000102="Каманды 7-Zip." -02000103="Адкрыць архіў" -02000104="Адкрыццё вылучанага архіва." -02000105="Распакаваць" -02000106="Выманне файлаў з вылучанага архіва." -02000107="Дадаць да архіва..." -02000108="Дадаць вылучаныя аб'екты да архіва." -02000109="Тэставаць" -0200010A="Тэставанне вылучанага архіва." -0200010B="Распакаваць тут" -0200010C="Выманне файлаў з вылучанага архіва ў бягучую папку." -0200010D="Распакаваць у {0}" -0200010E="Выманне файлаў у падкаталог." -0200010F="Дадаць да {0}" -02000110="Дадаць вылучаныя аб'екты да архіва." -02000111="Сціснуць і адправіць па email..." -02000112="Сціснуць вылучаныя аб'екты і адправіць архіў па email." -02000113="Сціснуць у {0} і адправіць па email" -02000114="Сціснуць вылучаныя аб'екты і адправіць архіў па email." -02000140="<Папка>" -02000141="<Архіў>" - -; Properties -02000203="Шлях" -02000204="Імя" -02000205="Пашырэнне" -02000206="Папка" -02000207="Памер" -02000208="Сціснуты" -02000209="Атрыбуты" -0200020A="Створаны" -0200020B="Адчынены" -0200020C="Зменены" -0200020D="Бесперапынны" -0200020E="Каментар" -0200020F="Зашыфраваны" -02000210="Пабіты Да" -02000211="Пабіты Пасля" -02000212="Слоўнік" -02000213="CRC" -02000214="Тып" -02000215="Анты" -02000216="Метад" -02000217="Сістэма" -02000218="Файлавая Сістэма" -02000219="Карыстач" -0200021A="Група" -0200021B="Блок" -0200021C="Каментар" -0200021D="Пазіцыя" -0200021E="Шлях" -0200021F="папок" -02000220="Файлаў" -02000221="Версія" -02000222="Тым" -02000223="Шматтомны" -02000224="Зрушэнне" -02000225="Спасылак" -02000226="Блокаў" -02000227="Тамоў" -02000229="64-bit" -0200022A="Big-endian" -0200022B="Працэсар" -0200022C="Фізічны Памер" -0200022D="Памер Загалоўкаў" -0200022E="Кантрольная Сума" -0200022F="Характарыстыкі" -02000230="Віртуальны Адрас" - -; Status bar -02000301="Вылучана аб'ектаў: {0}" -02000302="{0} аб'ект(ов)" -02000320="Файлаў:" -02000321="папок:" -02000322="Памер:" -02000323="Сціснуты:" -02000324="Архіваў:" - -; List Context Menu -02000401="&Слупкі..." -02000411="&Адкрыць" -02000412="&Выняць..." - -; ToolBar -02000501="Выняць" - -; Messages -02000601="Аперацыі змены не падтрымліваюцца для гэтага архіва." -02000602="Не атрымалася змяніць архіў {0}" -02000603="Не атрымалася стварыць папку '{0}'" -02000604="Файл не з'яўляецца падтрымоўваным архівам." -02000605="Памылка" -02000606="Занадта шмат элементаў" -02000607="Няма асацыяванага прыкладання" -02000608="Памылак не знойдзена" -02000609="Не атрымалася адкрыць файл '{0}' як архіў" -0200060A="Не атрымалася адкрыць зашыфраваны архіў '{0}'. Няслушны пароль?" -0200060B="Нядосыць вольнай памяці" -0200060C="Невядомая памылка" -0200060D="Непадтрымоўваны тып архіва" - -; Dialogs -02000702="OK" -02000705="&Так" -02000707="Ды для &усіх" -02000709="&Не" -0200070B="Няма для ў&сех" -02000710="Адмена" -02000711="&Адмена" -02000713="&Зачыніць" -02000714="Стоп" -02000715="Перазапуск" -02000720="Дапамога" - -; Extract dialog -02000800="Выняць" -02000801="&Распакаваць у:" -02000802="&Пароль" -02000810="Шляхі" -02000811="Па&лные шляхі" -02000812="Аб&тносительные шляхі" -02000813="&Без шляхоў" -02000820="Перазапіс" -02000821="&З пацверджаннем" -02000822="Бы&ез пацверджанні" -02000823="Проп&ускать" -02000824="Пераназваць автом." -02000825="Переим. автом. істот." -02000830="Файлы" -02000831="Абраныя файлы" -02000832="Усе файлы" -02000881="Пакажыце становішча для вымаемых файлаў." -02000890="Распакаванне" - -; Overwrite dialog -02000900="Пацверджанне замены файла" -02000901="Папка ўжо ўтрымоўвае апрацоўваны файл." -02000902="Замяніць існы файл" -02000903="наступным файлам?" -02000911="Пераназваць автом." -02000982="{0} байтаў" -02000983="зменены" - -; Messages dialog -02000A00="Паведамленні" -02000A80="Паведамленне" -02000A91="Непадтрымоўваны метад сціску для файла '{0}'." -02000A92="Памылка ў дадзеных у '{0}'. Файл сапсаваны." -02000A93="Памылка CRC у '{0}'. Файл сапсаваны." -02000A94="Памылка ў дадзеных зашыфраванага файла '{0}'. Няслушны пароль?" -02000A95="Памылка CRC для зашыфраванага файла '{0}'. Няслушны пароль?" - -; Password dialog -02000B00="Увод пароля" -02000B01="&Увядзіце пароль:" -02000B02="&Паказаць пароль" -02000B03="&Паўторыце пароль:" -02000B10="Паролі не супадаюць" -02000B11="Для пароля выкарыстайце толькі знакі лацінскага алфавіту, лічбы і адмысловыя знакі (!, #, $, ...)" -02000B12="Пароль занадта доўгі" - -; Progress dialog -02000C00="Працэс" -02000C01="Мінула:" -02000C02="Засталося:" -02000C03="Усяго:" -02000C04="Хуткасць:" -02000C05="Памер:" -02000C06="Ступень сціску:" -02000C10="&Фонам" -02000C11="&На пярэдні план" -02000C12="&Паўза" -02000C13="&Працягнуць" -02000C20="На паўзе" -02000C30="Вы сапраўды жадаеце перапыніць аперацыю?" - -; Compress dialog -02000D00="Дадаць да архіва" -02000D01="&Архіў:" -02000D02="&Рэжым змены:" -02000D03="&Фармат архіва:" -02000D04="&Метад сціску:" -02000D05="Стварыць &Solid архіў" -02000D06="&Параметры:" -02000D07="&Опцыі" -02000D08="Стварыць SF&X-архіў" -02000D09="М&ногопоточность" -02000D0A="&Шыфраваць імёны файлаў" -02000D0B="&Узровень сціску:" -02000D0C="Памер &слоўніка:" -02000D0D="Памер з&лоўлі:" -02000D0E="Аб'ём памяці для пакавання:" -02000D0F="Аб'ём памяці для распакавання:" -02000D10="Шыфраванне" -02000D11="Метад шыфравання:" -02000D12="Лік струменяў:" -02000D13="Памер блока:" -02000D14="Па памеры файла" -02000D15="Бесперапынны" -02000D16="Сціскаць адчыненыя для запісу файлы" -02000D40="Разбіць на &тамы памерам (у байтах):" -02000D41="Памылка ў поле для задання памеру тамоў" -02000D42="Усталяваны памер тома: {0} байтаў.\nВы сапраўды жадаеце разбіць архіў на такія тамы?" -02000D81="Без сціску" -02000D82="Нармалёвы" -02000D83="Максімальны" -02000D84="Хуткі" -02000D85="Хуткасны" -02000D86="Ультра" -02000D90="Прагартаць" -02000DA1="Дадаць і замяніць" -02000DA2="Абнавіць і дадаць" -02000DA3="Абнавіць" -02000DA4="Сінхранізаваць" -02000DB1="Усе файлы" -02000DC0="Кампрэсія" - -; Columns dialog -02000E00="Слупкі" -02000E01="Пазначце слупкі, якія варта адлюстроўваць у гэтай тэчцы. Кнопкамі \"Уверх\" і \"Уніз\" можна задаць парадак прытрымлівання слупкоў." -02000E02="Абраныя слупкі павінны мець шырыню" -02000E03="кропак." -02000E10="&Уверх" -02000E11="У&ніз" -02000E12="П&аказаць" -02000E13="&Схаваць" -02000E14="Усталяваць" -02000E81="Імя" -02000E82="Шырыня" - -; Testing -02000F90="Тэставанне" - -; File Manager -03000000="7-Zip File Manager" - -; Menu -03000102="&Файл" -03000103="&Праўка" -03000104="&Выгляд" -03000105="С&ервіс" -03000106="&Даведка" -03000107="&Абранае" - -; File -03000210="&Адкрыць" -03000211="Адкрыць &усярэдзіне" -03000212="Адкрыць снару&жи" -03000220="Прагляд" -03000221="&Рэдагаваць" -03000230="Переи&меновать" -03000231="&Капіяваць у..." -03000232="&Перамясціць у..." -03000233="&Выдаліць" -03000240="Сво&йства" -03000241="Комме&нтарий" -03000242="Кантрольная сума" -03000250="&Стварыць папку" -03000251="Ств&арыць Файл" -03000260="У&ыход" -03000270="Ра&збить файл..." -03000271="Аб&бъединить файлы..." - -; Edit -03000310="&Адмяніць" -03000311="&Вярнуць" -03000320="&Выразаць" -03000321="&Капіяваць" -03000322="Вст&авить" -03000323="&Выдаліць" -03000330="Вылучыць у&сёе" -03000331="Прыбраць вылучэнне" -03000332="&Звярнуць у&ыделение" -03000333="Вылучыць..." -03000334="Прыбраць вылучэнне..." -03000335="Вылучыць па тыпе" -03000336="Прыбраць вылучэнне па тыпе" - -; View -03000410="&Буйныя значкі" -03000411="&Дробныя значкі" -03000412="Спис&ок" -03000413="&Табліца" -03000420="Без сартавання" -03000430="Адкрыць каранёвую папку" -03000431="Пераход на адзін узровень уверх" -03000432="Гісторыя папок..." -03000440="Аб&бновить" -03000449="Плоскі рэжым" -03000450="&2 Панэлі" -03000451="&Панэлі прылад" -03000460="Панэль кнопак архіватара" -03000461="Стандартная панэль кнопак" -03000462="Вялікія кнопкі" -03000463="Надпісы на кнопках" - -; Tools -03000510="Налады..." -03000511="Тэставанне прадукцыйнасці" - -; Help -03000610="&Змест..." -03000620="Аб &праграме..." - -; Favorites -03000710="Дадаць папку ў &абранае як" -03000720="Закладка" - -; Options Dialog -03010000="Налады" - -; Plugins -03010100="Убудовы" -03010101="&Убудовы:" -03010110="Сво&йства" - -; Edit -03010200="Рэдактар" -03010201="&Рэдактар:" - -; System -03010300="Сістэма" -03010302="Асацыяваць 7-Zip з файламі:" -03010310="Убудова" - -; Settings -03010400="Налады" -03010401="Паказваць элемент \"..\"" -03010402="Паказваць рэальныя абразкі файлаў" -03010410="Паказваць сістэмнае меню" -03010420="Курсор на ўвесь радок" -03010421="Паказваць падзельнікі" -03010430="Альтэрнатыўны рэжым пазнакі" -03010440="Выкарыстаць вялікія старонкі памяці" - -; Strings -03020201="Капіяваць" -03020202="Перамясціць" -03020203="Капіяваць у:" -03020204="Перамясціць у:" -03020205="Капіяванне..." -03020206="Перасоўванне..." -03020207="Нельга скапіяваць аб'екты для такіх папок" -03020208="Аперацыя не падтрымліваецца для гэтай папкі." -03020209="Пакажыце папку." -03020210="Пацверджанне выдалення файла" -03020211="Пацверджанне выдалення папкі" -03020212="Пацверджанне выдалення групы файлаў" -03020213="Вы сапраўды жадаеце выдаліць \"{0}\"?" -03020214="Вы сапраўды жадаеце выдаліць папку \"{0}\" і ўсё яе змесціва?" -03020215="Вы сапраўды жадаеце выдаліць гэтыя аб'екты ({0} шт.)?" -03020216="Выдаленне..." -03020217="Памылка пры выдаленні файла або папкі" -03020218="Сістэма не падтрымлівае аперацыю выдалення файлаў з доўгімі шляхамі ў кошык" -03020220="Пераназванне..." -03020221="Памылка пры пераназванні файла або папкі" -03020222="Пацверджанне капіявання файлаў" -03020223="Вы сапраўды жадаеце скапіяваць гэтыя файлы ў архіў" -03020230="Стварыць папку" -03020231="Імя папкі:" -03020232="Новая Папка" -03020233="Памылка пры стварэнні папкі" -03020240="Стварыць файл" -03020241="Імя файла:" -03020242="Новы файл" -03020243="Памылка пры стварэнні файла" -03020250="Вылучыць" -03020251="Прыбраць вылучэнне" -03020252="Маска:" -03020260="Гісторыя папок" -03020280="Файл '{0}' быў зменены.\nВы жадаеце абнавіць яго ў архіве?" -03020281="Не атрымалася абнавіць файл\n'{0}'" -03020282="Не атрымалася запусціць рэдактар" -03020283="Адкрыццё..." -03020284="Файл падобны на вірус (імя файла ўтрымоўвае доўгую паслядоўнасць прабелаў)." -03020290="Каментар" -03020291="&Каментар:" -030202A0="Сістэма" -03020300="Кампутар" -03020301="Сетка" -03020302="Дакументы" -03020400="Дадаць" -03020401="Выняць" -03020402="Тэставаць" -03020420="Капіяваць" -03020421="Перамясціць" -03020422="Выдаліць" -03020423="Інфармацыя" -03020500="Разбіць файл" -03020501="&Разбіць у:" -03020510="Разбіццё..." -03020520="Пацверджанне разбіцця" -03020521="Вы сапраўды жадаеце разбіць файл на {0} частак?" -03020522="Памер тома павінен быць менш памеру зыходнага файла" -03020600="Аб'яднаць файлы" -03020601="&Аб'яднаць у:" -03020610="Аб'яднанне..." -03020620="Неабходна вылучыць толькі першую частку пабітага файла" -03020621="Не атрымалася распазнаць пабіты файл" -03020622="Не атрымалася знайсці больш адной часткі пабітага файла" -03020710="Вылічэнне кантрольнай сумы..." -03020720="Кантрольная сума" -03020721="Кантрольная сума CRC для дадзеных:" -03020722="Кантрольная сума CRC для дадзеных і імёнаў:" -03020800="Сканаванне..." -03020900="Уласцівасці" -03020A01="Аперацыя не можа быць выкананая з папкі, якая мае доўгі шлях." -03020A02="Вы павінны вылучыць адзін файл" -03020A03="Вы павінны вылучыць адзін або некалькі файлаў" -03020A04="Файл {0} ужо існуе" - -; Computer -03031100="Ёмістасць" -03031101="Вольна" -03031102="Памер кластара" -03031103="Пазнака" - -; Network -03031200="Лакальнае імя" -03031201="Правайдэр" - -; Benchmark Dialog -03080000="Тэставанне прадукцыйнасці" -03080001="Аб'ём памяці:" -03080002="Пакаванне" -03080003="Распакаванне" -03080004="Хуткасць" -03080005="Рэйтынг" -03080006="Агульны рэйтынг" -03080007="Бягучы" -03080008="Выніковы" -03080009="Праходаў:" -0308000A="Памылак:" -0308000B="Нагрузка" -0308000C="Рэйтынг / Нагр." diff --git a/tools/7-Zip/Lang/bg.txt b/tools/7-Zip/Lang/bg.txt deleted file mode 100644 index 0e4a3b3cc6..0000000000 --- a/tools/7-Zip/Lang/bg.txt +++ /dev/null @@ -1,535 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.65 -; Translated by chavv, http://www.angelfire.com/creep/chavvdarrr/ -; icobgr -; Updated for 4.65 - Vassia Atanassova -; -; - -00000000="Bulgarian" -00000001="Български" -00000002="2" - -; 7-Zip Configuration - -; Title -01000000="Конфигурация на 7-Zip" - -; Info Page -01000100="Информация" -01000103="7-Zip се разпространява като свободен софтуер. Все пак, можете да подпомогнете разработката на 7-zip, като се регистрирате." -01000104="Поддръжка" -01000105="Регистрация" - -; Folders Page -01000200="Директории" -01000210="&Работна директория" -01000211="&Системната TEMP директория" -01000212="&Текущата" -01000213="&Друга:" -01000214="Използване само за преносими носители" - -01000281="Указване на място за временните архиви." - -; System Page -01000300="Система" -01000301="Интегриране на 7-Zip в контекстното меню на шела" -01000302="Каскадно контекстно меню" -01000310="Елементи на контекстното меню:" - -; Language Page -01000400="Език" -01000401="Език:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Команди на 7-Zip" -02000103="Отваряне на архив" -02000104="Отваряне на избрания архив" -02000105="Разархивиране на файловете..." -02000106="Разархивиране на файловете от избрания архив." -02000107="Добавяне към архив..." -02000108="Добавяне на избраните файлове към архива " -02000109="Проверка на архива" -0200010A="Проверка на целостта на избрания архив." -0200010B="Разархивиране тук" -0200010C="Разархивиране на избрания архив в текущата директория." -0200010D="Разархивиране в {0}" -0200010E="Разархивиране на файловете в поддиректория." -0200010F="Добавяне в {0}" -02000110="Добавяне на избраните файлове (директории) в архив." -02000111="Архивиране и изпращане..." -02000112="Архивиране на избраните файлове (директории) и изпращане на архива." -02000113="Архивиране в {0} и изпращане" -02000114="Архивиране на избраните файлове (директории) и изпращане на архива." - -02000140="<Директория>" -02000141="<Архив>" - -; Properties -02000203="Път" -02000204="Име" -02000205="Разширение" -02000206="Директория" -02000207="Размер" -02000208="Компресиран размер" -02000209="Атрибути" -0200020A="Създаден" -0200020B="Отварян" -0200020C="Изменен" -0200020D="Солиден" -0200020E="Коментар" -0200020F="Зашифрован" -02000210="Разделен до" -02000211="Разделен след" -02000212="Речник" -02000213="CRC" -02000214="Тип" -02000215="Анти" -02000216="Метод" -02000217="Операционна система" -02000218="Файлова система" -02000219="Потребител" -0200021A="Група" -0200021B="Блок" -0200021C="Коментар" -0200021D="Позиция" -0200021E="Префикс на пътя" -0200021F="Директории" -02000220="Файлове" -02000221="Версия" -02000222="Том" -02000223="Multivolume" -02000224="Offset" -02000225="Links" -02000226="Blocks" -02000227="Томове" - -02000229="64-битов" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Физически размер" -0200022D="Размер на заглавната част" -0200022E="Контролна сума" -0200022F="Характеристики" -02000230="Виртуален адрес" - -; Status bar -02000301="{0} обект(и) избрани" -02000302="{0} обект(и)" - -02000320="Файлове:" -02000321="Директории:" -02000322="Размер:" -02000323="Компресиран размер:" -02000324="Архиви:" - -; List Context Menu -02000401="&Колони..." - -02000411="&Отваряне" -02000412="&Разархивиране..." - -; ToolBar -02000501="Разархивиране" - -; Messages -02000601="Този архив не поддържа операции за изменение." -02000602="Архивът не може да бъде променен! {0}" -02000603="Не може да бъде създадена директория '{0}'" -02000604="Файлът не е архив от поддържан тип." -02000605="Грешка" -02000606="Твърде много обекти" -02000607="Няма програма, асоциирана с указаното файлово разширение" -02000608="Няма грешки в архива" -02000609="Файлът '{0}' не може да се отвори като архив" -0200060A="Криптираният архив '{0}' не може да се отвори. Грешка в паролата?" -0200060B="Системата не може да задели необходимото количество памет." -0200060C="Непозната грешка" -0200060D="Архив от тип, който не се поддържа" - -; Dialogs -02000702="OK" -02000705="&Да" -02000707="Да за &всички" -02000709="&Не" -0200070B="Не за &всички" - -02000710="Отказ" -02000711="&Отказ" -02000713="&Затваряне" -02000714="Стоп" -02000715="От начало" - -02000720="Помощ" - -; Extract dialog -02000800="Разархивиране" -02000801="&Разархивиране в:" -02000802="&Парола" - -02000810="Режим за пътищата" -02000811="Пълни пътища" -02000812="Текущи пътища" -02000813="Без пътища" - -02000820="Режим за презаписване" -02000821="Потвърждение преди презаписване" -02000822="Презаписване без потвърждение" -02000823="Пропускане на съществуващите файлове" -02000824="Автоматично преименуване" -02000825="Автоматично преименуване на съществуващите файлове" - -02000830="Файлове" -02000831="&Избраните файлове" -02000832="&Всички файлове" - -02000881="Избор на място за разархивираните файлове." - -02000890="Разархивиране" - -; Overwrite dialog -02000900="Подтвърдете замяната на файла" -02000901="Директорията вече съдържа файл с такова име." -02000902="Желаете ли да замените съществуващия файл" -02000903="с този файл?" - -02000911="&Автоматично преименуване" - -02000982="{0} байта" -02000983="изменен на" - -; Messages dialog -02000A00="Диагностични съобщения" - -02000A80="Съобщение" - -02000A91="Неподдържан метод за компресия във файл '{0}'." -02000A92="Грешка в данните в '{0}'. Файлът е повреден." -02000A93="Проверката на цикличния остатък даде грешка в '{0}'. Файлът е повреден." -02000A94="Грешка в данните в криптирания файл '{0}'. Грешка в паролата?" -02000A95="Проверката на цикличния остатък даде грешка в криптирания файл '{0}'. Грешка в паролата?" - -; Password dialog -02000B00="Въведете парола" -02000B01="Въведете парола:" -02000B02="&Показване на паролата" -02000B03="Въведете повторно парола:" -02000B10="Двете пароли не съвпадат" -02000B11="За паролата си използвайте само латински букви, цифри и специални символи (!, #, $, ...)" -02000B12="Паролата е твърде дълга" - - -; Progress dialog -02000C00="Обработка" -02000C01="Изминало време:" -02000C02="Оставащо време:" -02000C03="Размер:" -02000C04="Скорост:" -02000C05="Обработени:" -02000C06="Коефициент на компресия:" - -02000C10="&Фонов режим" -02000C11="&Нормален режим" -02000C12="&Пауза" -02000C13="Пр&одължаване" - -02000C20="В пауза" - -02000C30="Наистина ли желаете да прекратите?" - -; Compress dialog -02000D00="Добавяне към архив" -02000D01="&Архив:" -02000D02="Режим за изменение:" -02000D03="Формат на архива:" -02000D04="Метод за компресия:" -02000D05="Създаване на п&лътен архив" -02000D06="&Параметри:" -02000D07="&Опции" -02000D08="Самора&зархивиращ се архив" -02000D09="Нишковидно" -02000D0A="Криптиране на файловите &имена" -02000D0B="&Ниво на компресия:" -02000D0C="Размер на &речника:" -02000D0D="Размер на &думата:" -02000D0E="Използвана памет за архивиране:" -02000D0F="Използвана памет за разархивиране:" -02000D10="Криптиране" -02000D11="Метод за криптиране:" -02000D12="Брой процесорни нишки:" -02000D13="Размер на непрекъснат блок:" -02000D14="Non-solid" -02000D15="Непрекъсната (solid) компресия" -02000D16="Компресирани споделени файлове" - - -02000D40="Разделяне на &томове, байтове:" -02000D41="Невалиден размер на том" -02000D42="Указан размер на том: {0} байта.\nСигурни ли сте, че искате да разделите архива на томове с такъв размер?" - - -02000D81="Без компресия" -02000D82="Нормална" -02000D83="Максимална" -02000D84="Бърза" -02000D85="Най-бърза" -02000D86="Ултра" - -02000D90="Разглеждане" - -02000DA1="Добавяне и замяна на файлове" -02000DA2="Обновяване и добавяне на файлове" -02000DA3="Опресняване на съществуващите файлове" -02000DA4="Синхронизиране на файловете" - -02000DB1="Всички файлове" - -02000DC0="Компресия" - -; Columns dialog -02000E00="Колони" -02000E01="Маркирайте колоните, които искате да се виждат в тази директория. Използвайте бутоните \"Нагоре\" и \"Надолу\", за да промените реда на колоните." -02000E02="Избраните колони трябва да са с " -02000E03="пиксела по ширина." - -02000E10="Нагоре" -02000E11="Надолу" -02000E12="Показване" -02000E13="Скриване" -02000E14="Установяване" - -02000E81="Име" -02000E82="Ширина" - -; Testing -02000F90="Проверка" - - -; File Manager - -03000000="Файлов мениджър 7-Zip" - -; Menu -03000102="&Файл" -03000103="&Редактиране" -03000104="&Показване" -03000105="&Инструменти" -03000106="&Помощ" -03000107="&Любими" - -; File -03000210="&Отваряне" -03000211="Отваряне &в" -03000212="Отваряне &извън" -03000220="&Показване" -03000221="&Редактиране" -03000230="Преи&менуване" -03000231="&Копиране в..." -03000232="Пре&местване в..." -03000233="Из&триване" -03000240="&Свойства" -03000241="Ком&ентар" -03000242="Изчисляване на контролна сума" -03000250="Създаване на директория" -03000251="Създаване на файл" -03000260="Из&ход" -03000270="Р&азделяне на файл..." -03000271="О&бединяване на файлове..." - -; Edit -03000310="О&тмяна" -03000311="Възвр&ъщане" -03000320="&Отрязване" -03000321="&Копиране" -03000322="&Вмъкване" -03000323="&Изтриване" -03000330="&Маркиране на всички" -03000331="&Размаркиране на всички" -03000332="&Обръщане на избора" -03000333="Маркиране..." -03000334="Размаркиране..." -03000335="Маркиране по тип" -03000336="Размаркиране по тип" - -; View -03000410="&Големи икони" -03000411="&Малки икони" -03000412="&Списък" -03000413="&Детайли" -03000420="Несортиран" -03000430="Отваряне на главната директория" -03000431="Едно ниво нагоре" -03000432="История на директориите..." -03000440="&Опресняване" -03000449="Плосък изглед" -03000450="&2 панела" -03000451="&Ленти с инструменти" -03000460="Лента на архива" -03000461="Стандартна лента" -03000462="Големи бутони" -03000463="Показване на текст под бутоните" - -; Tools -03000510="&Настройки..." -03000511="&Статистика" - -; Help -03000610="&Съдържание..." -03000620="&За 7-zip..." - -; Favorites -03000710="&Добавяне на директорията като любима:" -03000720="Отметка" - -; Options Dialog - -03010000="Настройки" - -; Plugins -03010100="Плъгини" -03010101="&Плъгини:" -03010110="Настройки..." - -; Edit -03010200="Редактор" -03010201="&Редактор:" - -; System -03010300="Система" -03010302="Асоцииране на 7-Zip с:" -03010310="Плъгин" - -; Settings -03010400="Настройки" -03010401="Показване на обекта \"..\" " -03010402="Показване на истинските икони на файловете" -03010410="Показване на системното меню" -03010420="&Избор на цял ред" -03010421="Показване на помощни &линии" -03010430="&Алтернативен режим на избор" -03010440="Използване на &големи страници от паметта" - -; Strings - -03020201="Копиране" -03020202="Преместване" -03020203="Копиране в:" -03020204="Преместване в:" -03020205="Копиране..." -03020206="Местене..." -03020207="Не могат да се местят или копират обекти от тези директории." -03020208="Операцията не се поддържа за тази директория." -03020209="Избор на целева директория." - -03020210="Потвърждение за изтриването на файл" -03020211="Потвърждение за изтриването на директория" -03020212="Потвърждение за изтриването на множество файлове" -03020213="Сигурни ли сте, че искате да изтриете '{0}'?" -03020214="Сигурни ли сте, че искате да изтриете диркеторията '{0}' с цялото й съдържание?" -03020215="Сигурни ли сте, че искате да изтриете тези {0} обекта?" -03020216="Изтриване..." -03020217="Грешка при изтриване на файл или директория" -03020218="Системата не може да изтрие файл с толкова дълъг път" - -03020220="Преименуване..." -03020221="Грешка при преименуването на файл или директория" -03020222="Потвърждение за копирането на файл" -03020223="Сигурни ли сте, че искате да копирате файлове към архива?" - -03020230="Създаване на директория" -03020231="Име на директория:" -03020232="Нова директория" -03020233="Грешка при създаване на директория" - -03020240="Създаване на файл" -03020241="Име на файл:" -03020242="Нов файл" -03020243="Грешка при създаване на файл" - -03020250="Маркиране" -03020251="Размаркиране" -03020252="Маска:" - -03020260="История на директориите" - -03020280="Файлът '{0}' е бил променен.\nИскате ли да обновите копието му в архива?" -03020281="Не може да бъде обновен файл \n'{0}'" -03020282="Не може да бъде стартиран редактора." -03020283="Отваряне..." -03020284="Файлът прилича на вирус (името му съдържа дълги поредици интервали)." - -03020290="Коментар" -03020291="&Коментар:" - -030202A0="Система" - -03020300="Компютър" -03020301="Мрежа" -03020302="Документи" - -03020400="Добавяне" -03020401="Извличане" -03020402="Тестване" - -03020420="Копиране" -03020421="Преместване" -03020422="Изтриване" -03020423="Информация" - -03020500="Разделяне на файл" -03020501="&Разделяне на:" -03020510="Разделяне..." -03020520="Потвърждение на разделянето" -03020521="Сигурни ли сте, че искате да разделите файла на {0} тома?" -03020522="Размерът на том трябва да бъде по-малък от размера на оригиналния файл" - -03020600="Обединяване на файлове" -03020601="&Обединяване в:" -03020610="Обединяване..." -03020620="Избиране само на първата част от разделения файл" -03020621="Файлът не се разпознава като част от разделен оригинален файл" -03020622="Не се открива повече от една част от разделения файл" - -03020710="Изчисляване на контролната сума..." -03020720="Информация за контролната сума" -03020721="CRC контролна сума за данни:" -03020722="CRC контролна сума за данни и имена:" - -03020800="Претърсване..." - -03020900="Свойства" - -03020A01="Операцията не може да бъде извикана от директория с толкова дълъг път." -03020A02="Трябва да се избере един файл" -03020A03="Трябва да се изберат един или повече файлове" -03020A04="Файлът {0} вече съществува" - -; Computer -03031100="Пълен размер" -03031101="Свободно пространство" -03031102="Размер на клъстер" -03031103="Етикет" - -; Network -03031200="Локално име" -03031201="Доставчик" - -; Benchmark Dialog - -03080000="Статистика" -03080001="Използвана памет:" -03080002="Архивиране" -03080003="Разархивиране" -03080004="Скорост" -03080005="Оценка" -03080006="Обща оценка" -03080007="Текущо" -03080008="Резултат" -03080009="Успешно преминали:" -0308000A="Грешки:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/bn.txt b/tools/7-Zip/Lang/bn.txt deleted file mode 100644 index 74dd5d7765..0000000000 --- a/tools/7-Zip/Lang/bn.txt +++ /dev/null @@ -1,497 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.46 -; -; Translated by Team Oruddho -; -; web : http://www.oruddho.com -; Translator : Fahad Mohammad Shaon, Mahmud Hassan - -00000000="Bangla" -00000001="বাংলা" -00000002="69" - -; 7-Zip Configuration - -; Title -01000000="7-Zip এর পছন্দনীয়" - -; Info Page -01000100="7-Zip সম্পর্কে" -01000103="7-Zip একটি মুক্ত প্রোগ্রাম কিন্তু এটি 7-Zip এর কতৃপক্ষের কাচে নিবন্ধনের মাধ্যমে আপনি উন্নত সেবা পেতে পারেন " -01000104="সহযোগিতা" -01000105="নিবন্ধন" - -; Folders Page -01000200="ফোল্ডার" -01000210="&কার্যরত ফোল্ডার" -01000211="&অস্থায়ী ফোল্ডার" -01000212="&প্রচলিত" -01000213="&নির্দিষ্ট:" -01000214="অস্থায়ী অংশের জন্য ব্যবহার করা" - -01000281="অস্থায়ী ফোল্ডার নির্বাচন করুন।" - -; System Page -01000300="কম্পিউটার" -01000301="সাহায্যকারী তালিকায় 7-Zip সংযোজন" -01000302="সাহায্যকারী তালিকায় একের ভিতর সব গুটিয়ে ফেলা " -01000310="সাহায্যকারী তালিকার বিষয়সমূহ:" - -; Language Page -01000400="ভাষা" -01000401="ভাষা:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip আদেশ" -02000103="সংকুচিত ফাইল চালু করা" -02000104="নির্বাচিত সংকুচিত ফাইলগুলো চালু করা।" -02000105="ফাইল সম্প্রসারণ..." -02000106="নির্বাচিত সংকুচিত ফাইল থেকে ফাইল সম্প্রসারণ।" -02000107="সংকুচিত ফাইলে সংযোজন..." -02000108="নির্বাচিত ফাইলগুলো সংকুচিত ফাইলে সংযোজন।" -02000109="সংকুচিত ফাইল নিরীক্ষণ" -0200010A="সংকুচিত ফাইলের যথার্থতা নিরীক্ষণ।" -0200010B="এখানেই সম্প্রসারণ" -0200010C="নির্বাচিত সংকুচিত ফাইল থেকে বর্তমান ফোল্ডারে সম্প্রসারণ।" -0200010D="সম্প্রসারণ করা হবে {0}" -0200010E="উপধারকে সম্প্রসারণ করা হবে।" -0200010F="সযোজন করা হবে {0}" -02000110="নির্বাচিত ফাইলসমূহ সংকুচিত ফাইলে সযোজন করা হবে" -02000111="সংকোচন এবং ই-মেইল..." -02000112="নির্বাচিত ফাইলগুলো সংকুচিত করা এবং সংকুচিত ফাইল ই-মেইল করা।" -02000113="সংকোচন - {0} এবং ই-মেইল " -02000114="নির্বাচিত ফাইলগুলো সংকুচিত করা এবং সংকুচিত ফাইল ই-মেইল করা।" - -02000140="<ফোল্ডার>" -02000141="<সংকুচিত ফাইল>" - -; Properties -02000203="অবস্থান" -02000204="নাম" -02000205="পরিচয়" -02000206="ফোল্ডার" -02000207="আকার" -02000208="সংকুচিত আকার" -02000209="বৈশিষ্ট" -0200020A="সৃষ্টি হয়েছে" -0200020B="ব্যবহার হয়েছে" -0200020C="পরিবর্ধন হয়েছে" -0200020D="দৃঢ়" -0200020E="Commented" -0200020F="আটকানো" -02000210="খন্ডনের পূর্বে" -02000211="খন্ডনের পরে" -02000212="অভিধান" -02000213="CRC" -02000214="ধরন" -02000215="বিরোধী" -02000216="পদ্ধতি" -02000217="চলতি অপারেটিং সিস্টেম" -02000218="ফাইল ব্যবস্থা" -02000219="ব্যবহারকারী" -0200021A="দল" -0200021B="বাধা" -0200021C="মন্তব্য" -0200021D="অবস্থান" -0200021E="পথের বিশেষায়ণ (Path Prefix)" - -; Status bar -02000301="{0} ফাইল(সমূহ) নির্বাচিত" -02000302="{0} ফাইল(সমূহ)" - -02000320="ফাইলসমূহ :" -02000321="ফোল্ডারসমূহ :" -02000322="আকার :" - -; List Context Menu -02000401="&কলাম..." - -02000411="&চালু করা" -02000412="&সম্প্রসারন..." - -; ToolBar -02000501="সম্প্রসারন" - -; Messages -02000601="এই সংকোচনের ক্ষেত্রে এই সেবা প্রদান করা সম্ভব হচ্ছে না।" -02000602="এই সংকোচনের ক্ষেত্রে পরিবর্ধন সম্ভব নয় {0}" -02000603="'{0}' ফোল্ডার সৃষ্টি করা সম্ভব হচ্ছেনা" -02000604="ফাইলটি পরিচিত সংকুচিত ফাইল নয়" -02000605="ত্রুটি" -02000606="অনেক বেশী ফাইল" -02000607="এই পরিচয় এর ফাইল গুলোর জন্য কোন নির্ধারিত চালক নেই" -02000608="কোন ত্রুটি নেই" -02000609="'{0}' -কে সংকুচিত ফাইল হিসেবে চালু করা সম্ভব হচ্ছেনা" -0200060A="'{0}' বদ্ধ সংকুচিত ফাইল চালু করা সম্ভব হচ্ছেনা. ভুল পাসওয়ার্ড?" - -; Dialogs -02000702="ঠিক আছে" -02000705="&হ্যাঁ" -02000707="&সবগুলোর জন্য হ্যাঁ" -02000709="&না" -0200070B="স&বগুলোর জন্য না" - -02000710="বাতিল" -02000711="&বাতিল" -02000713="&বন্ধ করা" -02000714="বন্ধ" -02000715="আবার শুরু" - -02000720="সাহায্য" - -; Extract dialog -02000800="সম্প্রসারণ" -02000801="&সম্প্রসারণ করা হবে:" -02000802="পাসওর্য়াড" - -02000810="ঠিকানা নির্বাচন পদ্ধতি" -02000811="পূর্ণ ঠিকানাসমূহ " -02000812="বর্তমান ঠিকানা" -02000813="ঠিকানাবিহীন" - -02000820="প্রতিস্থাপন পদ্ধতি" -02000821="প্রতিস্থাপনের পূর্বাভাস" -02000822="আভাসবিহীন প্রতিস্থাপন" -02000823="একই পরিচয় প্রাপ্ত ফাইল এড়িয়ে চলা " -02000824="স্বয়ংক্রিয় পুঃনামকরণ" -02000825="একই পরিচয় প্রাপ্ত ফাইলের নাম পরিবর্ত্ন" - -02000830="ফাইলসমূহ" -02000831="&নির্বাচিত ফাইলসমূহ" -02000832="&সব ফাইল" - -02000881="ফাইল সম্প্রসারনের ঠিকানা" - -02000890="সম্প্রসারণ করা হচ্ছে" - -; Overwrite dialog -02000900="ফাইল প্রতিস্থাপন নিশ্চিত করণ " -02000901="নির্ধারিত ফোল্ডারে ফাইলটি আগেথেকেই আছে " -02000902="আপনিকি বর্তমান ফাইলটি প্রতিস্থাপন করতে চান?" -02000903="এইটির সাথে?" - -02000911="স্বয়ংক্রিয় পুঃনামকরণ" - -02000982="{0} bytesবাইট" -02000983="পরিবর্তিত করা হয়েছে" - -; Messages dialog -02000A00="সমস্যা নিরাময় আভাস" - -02000A80="আভাস" - -02000A91="অসমর্থিত সংকোচন পদ্ধতি -'{0}'." -02000A92="'{0}' ফাইলে ত্রুটিপূর্ণ তথ্য. ফাইলটি খন্ডিত" -02000A93="'{0}' ফাইলে CRC ব্যর্থ. ফাইলটি খন্ডিত" -02000A94="'{0}' বদ্ধ ফাইলে তথ্যে ত্রুটি. ভুল পাসওয়ার্ড?" -02000A95="'{0}' বদ্ধ ফাইলে CRC ব্যর্থ. ভুল পাসওয়ার্ড?" - -; Password dialog -02000B00="পাসওয়ার্ডটি প্রবেশ করুনঃ" -02000B01="পাসওয়ার্ডটি প্রবেশ করুনঃ" -02000B02="&পাসওয়ার্ড প্রদর্শন" -02000B03="আবার পাসওয়ার্ড প্রবেশ করুনঃ" -02000B10="পাসওয়ার্ড দুটি একই নয়" -02000B11="শুধু ইংলিশ বর্ণ, সংখ্যা এবং বিশেষ বর্ণ (!, #, $, ...) পাসওয়ার্ড হিসেবে ব্যবহার করুন" -02000B12="পাসওয়ার্ডটি খুব বেশী বড় হয়েছে" - -; Progress dialog -02000C00="প্রগতি" -02000C01="অতিবাহিত সময়ঃ" -02000C02="সময় বাকি আছেঃ" -02000C03="আকার:" -02000C04="গতি:" - -02000C10="&পটভূমি" -02000C11="& সামনে" -02000C12="&বিরতি" -02000C13="&চালিয়ে যাওয়া" - -02000C20="বিরতিতে অবস্থানরত" - -02000C30="আপনি বাতিল করতে ইচ্ছুক?" - -; Compress dialog -02000D00="সংকোচনে সংযোজন" -02000D01="&সংকোচন" -02000D02="&পরিমার্জন পদ্ধতি:" -02000D03="সংকোচনের & পরিচয়:" -02000D04="সংকোচন &পদ্ধতি:" -02000D05="Create &Solid archive" -02000D06="&Parameters:" -02000D07="পছন্দনীয়" -02000D08="স্বয়ংক্রিয় সংকোচন প্রোগ্রাম তৈরি" -02000D09="বহুমূখী..." -02000D0A="ফাইলের নাম &আটকে ফেলা" -02000D0B="সংকোচনের &পর্যায়:" -02000D0C="&Dictionary size:" -02000D0D="&Word size:" -02000D0E="সংকোচনের জন্য স্মৃতির ব্যবহার:" -02000D0F="সম্প্রসারনের জন্য স্মৃতির ব্যবহার:" -02000D10="বদ্ধ করা" -02000D11="বদ্ধ করার পদ্ধতি:" -02000D12="CPU-এর thread-এর সংখ্যা:" -02000D13="Solid block size:" -02000D14="Non-solid" -02000D15="Solid" -02000D16="বিনিময়যোগ্য ফাইল সংকোচন" - -02000D40="volumes(খন্ডে), bytes(বাইটস)-এ খন্ডায়নঃ" -02000D41="খন্ডের আকারে ভুল" -02000D42="উল্লেক্ষিত খন্ডের আকার : {0} bytes.\nআপনি কি সংকোচিত ফাইলটিকে এ ভাবেই খন্ডে খন্ডায়ন করতে চান?" - -02000D81="অতি সংকোচায়ন" -02000D82="সাধারন" -02000D83="সর্ব্বোচ্চ" -02000D84="দ্রুত" -02000D85="অতি দ্রুত" -02000D86="পলকের গতি" - -02000D90="বিচরণ" - -02000DA1="সংকোচন ও ফাইল প্রতিস্থাপন" -02000DA2="পরিমার্জন ও ফাইল প্রতিস্থাপন" -02000DA3="উল্লেখিত ফাইলে সতেজতা প্রদান" -02000DA4="ফাইল সাজিয়ে রাখা" - -02000DB1="সকল ফাইল" - -02000DC0="সংকোচায়ন প্রক্রিয়াধীন" - -; Columns dialog -02000E00="পর্যায়" -02000E01="আপনি সেই সকল শ্রেণীসমূহ নির্বাচন করুন যেগুলো আপনি দেখতে চান. আপনি উপরের ও নীচের বোতামে নির্বাচনের মাধ্যমে শ্রেণীসমূহ সুসজ্জিত করতে পারেন।" -02000E02="নির্বাচিত শ্রেণীসমূহ হতে পারে ..." -02000E03="পিক্সেল বৃহদায়ন" - -02000E10="উপরে" -02000E11="নিচে" -02000E12="প্রদর্শন" -02000E13="অদৃশ্য" -02000E14="নিরধারণ" - -02000E81="শিরোনাম" -02000E82="প্রস্থ" - -; Testing -02000F90="নিরক্ষণ করছে ..." - - -; File Manager - -03000000="7-Zip ফাইল ব্যবস্থাপক" - -; Menu -03000102="&ফাইল" -03000103="&পরিবর্তন" -03000104="প্রদর্শন&" -03000105="&দরকারি" -03000106="&সহায়তা" -03000107="&প্রিয়" - -; File -03000210="&উন্মুক্ত করা" -03000211="7-zip-এ উন্মুক্ত করা" -03000212="বাহিরে উন্মুক্ত করা" -03000220="&প্রদর্শন" -03000221="&পরিবর্তন" -03000230="নাম পরিবর্তন" -03000231="&অনুলিপি হবে..." -03000232="প্রতিস্থাপন হবে..." -03000233="&মুছে ফেলা" -03000240="বৈশিষ্টাবলি" -03000241="মন্তব্য" -03000242="Checksum গননা করা" -03000250="ফোল্ডার সৃষ্টি" -03000251="ফাইল সৃষ্টি" -03000260="বাহির" -03000270="&ফাইল খন্ডায়ন..." -03000271="ফাইল সংযোজন..." - -; Edit -03000310="&ফিরিয়ে দেয়া" -03000311="ফিরিয়ে দেয়া রদ করা" -03000320="অনুলিপি গ্রহন এবং মুছে ফেলা" -03000321="অনুলিপি গ্রহন" -03000322="অনুলিপি প্রদান" -03000323="মুছে ফেলা" -03000330="সব নির্বাচন" -03000331="নির্বাচন রদ করা" -03000332="উল্টো নির্বাচন" -03000333="নির্বাচন..." -03000334="নির্বাচন রদ করা..." -03000335="ধরণ অনুযায়ী নির্বাচন" -03000336="ধরণ অনুযায়ী নির্বাচন রদ করা" - -; View -03000410="বৃহৎ প্রতিক" -03000411="ছোট্ট প্রতিক" -03000412="&তালিকা" -03000413="&বিবরণ" -03000420="অসজ্জিত" -03000430="মূল ফোল্ডার উন্মুক্ত করা" -03000431="এক পর্যায় উপরে ..." -03000432="ফোল্ডারের অতীত বিবরণ..." -03000440="&সতেজতা" -03000449="সমতল সজ্জা" -03000450="&ব্যবস্থাপক দ্বিখন্ডন" -03000451="&দরকারিখুটি" -03000460="সংকোচোন ব্যবস্থাপক খুটি" -03000461="সাধারণ খুটি" -03000462="বৃহৎ বোতাম" -03000463="বোতামের শিরোনাম প্রদর্শন" - -; Tools -03000510="&পছন্দগুলো..." -03000511="&বেঞ্চমার্ক" - -; Help -03000610="&সাহায্য..." -03000620="&7-Zip সর্ম্পকে..." - -; Favorites -03000710="&প্রিয় ফোল্ডার হিসাবে সংযোজন ..." -03000720="পছন্দের তালিকা" - -; Options Dialog - -03010000="পছন্দগুলো" - -; Plugins -03010100="সংযোজনযোগ্য প্রোগ্রাম" -03010101="&সংযোজনযোগ্য প্রোগ্রামের তালিকা : " -03010110="পছন্দগুলো..." - -; Edit -03010200="সম্পাদক" -03010201="বর্তমান সম্পাদক : " - -; System -03010300="বর্তমান অবস্থা" -03010302="7-Zip-এর সাথে সম্পর্কিত : " -03010310="সংযোজনযোগ্য প্রোগ্রাম" - -; Settings -03010400="পছন্দগুলো" -03010401="\"..\" ফাইল প্রদর্শন" -03010402="ফাইলের আসল প্রতিক দেখানো" -03010410="কম্পিউটার চালকের তালিকা দেখানো" -03010420="পূর্ণ পর্যায় প্রদর্শন" -03010421="ছকের লাইন প্রদর্শন" -03010430="পরিপূরক নিবাচনের পদ্ধতি" -03010440="বেশি স্মৃতির ব্যবহার" - -; Strings - -03020201="অনুলিপি গ্রহন" -03020202="অনুলিপি গ্রহন এবং মুছে ফেলা" -03020203="অনুলিপি করা হবে:" -03020204="প্রতিস্থাপিত হবে:" -03020205="অনুলিপি করা হচ্ছে..." -03020206="প্রতিস্থাপিত হচ্ছে..." -03020207="আপনি এই ফাইলটি উল্লেখিত ফোল্ডারে অনুলিপি করা বা প্রতিস্থাপিত করা সম্ভব নয়" -03020208="কার্যটি সম্ভব নয়" -03020209="গন্তব্য ফোল্ডার নির্বাচন." - -03020210="ফাইলটি মুছে ফেলতে কি আপনি নিশ্চিত" -03020211="ফোল্ডারটি মুছে ফেলতে কি আপনি নিশ্চিত" -03020212="ফাইলটি মুছে ফেলতে কি আপনি নিশ্চিত" -03020213="মুছে ফেলতে আপনি কি নিশ্চিত - '{0}'?" -03020214="'{0}' ফোল্ডার এবং এর সব ফাইল আপনি কি মুছে ফেলতে নিশ্চিত?" -03020215="নির্বাচিত {0} টি ফাইল আপনি কি মুছে ফেলতে নিশ্চিত?" -03020216="মুছে ফেলা হচ্ছে..." -03020217="ফাইল বা ফোল্ডার মুছে ফেলাতে সমস্যা হচ্ছে" - -03020220="নাম পরিবর্তন..." -03020221="ফাইল বা ফোল্ডারের নাম পরিবর্তনে সম্ভব নয়" -03020222="ফাইল অনুলিপি নিশ্চিতকরণ" -03020223="আপনি কি ফাইলগুলোকে সংকুচিত ফাইলে অনুলিপি গ্রহণ করতে চান।" - -03020230="ফোল্ডার সৃষ্টি" -03020231="ফোল্ডারের নাম:" -03020232="নতুন ফোল্ডার" -03020233="ফোল্ডার সৃষ্টিতে সমস্যা" - -03020240="ফাইল সৃষ্টি" -03020241="ফাইল নাম:" -03020242="নতুন ধারক" -03020243="ফাইল সৃষ্টিতে সমস্যা" - -03020250="নির্বাচন" -03020251="নির্বাচন রদ করা" -03020252="আড়াল করা:" - -03020260="ফোল্ডারের অতিত বিবরন" - -03020280="ফাইলটি '{0}' পরিমার্জিত.\nআপনি সংকুচিত ফাইলটি ও পরিমার্জন করতে চান?" -03020281="পরিমার্জন করা সম্ভব হয়নি\n'{0}'" -03020282="সম্পাদক চালু করা সম্ভব নয়" -03020283="উন্মুক্ত করা হচ্ছে..." - -03020290="মন্তব্য" -03020291="&মন্তব্য:" - -030202A0="কম্পিউটার চালক" - -03020300="কম্পিউটার" -03020301="আন্তঃ সম্পর্ক " - -03020400="সংজোযন" -03020401="সম্প্রসারন" -03020402="নিরীক্ষণ" - -03020420="অনুলিপি গ্রহন" -03020421="প্রতিস্থাপন" -03020422="মুছে ফেলা" -03020423="তথ্য" - -03020500="ফাইল খন্ডায়ন" -03020501="&ফাইল খন্ডায়িত হবে:" -03020510="ফাইল খন্ডায়ন চলছে..." -03020520="ফাইল খন্ডায়ন নিশ্চিতকরণ" -03020521="আপনি কি সংকুচিত ফাইলটিকে {0} খন্ডে খন্ডায়ন করতে চান?" -03020522="খন্ডের আকার অবশ্যই মূল ফাইলের চেয়ে ছোট হতে হবে" - -03020600="ফাইল একীভূতি করণ" -03020601="&একীভূতি করা হবে:" -03020610="একীভূতি চলছে..." -03020620="শুধু প্রথম ফাইলটি নির্বাচন করুন" - -03020710="Checksum গননা চলছে..." -03020720="Checksum তথ্য" -03020721="তথ্যের জন্য CRC checksum:" -03020722="তথ্য এবং নামের জন্য CRC checksum:" - -03020800="তথ্য সংগ্রহ চলছে... (Scanning...)" - -; Computer -03031100="সম্পূর্ণ আকার" -03031101="অবশিষ্ট জায়গা" -03031102="ক্লাস্টারের আকার" -03031103="শিরোনাম" - -; Network -03031200="স্থানীয় নাম" -03031201="বিতরণকারী" - -; Benchmark Dialog - -03080000="বেঞ্চমার্ক" -03080001="ব্যবহৃত স্মৃতি : " -03080002="সংকোচায়ন ..." -03080003="সম্প্রসারণ ..." -03080004="গতি" -03080005="রেটিং" -03080006="মোট রেটিং" -03080007="চলতি" -03080008="ফলাফল" -03080009="সফলতা :" -0308000A="বিফলতা :" -0308000B="CPU ব্যবহার করছে" -0308000C="Rating / ব্যবহার করছে" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/br.txt b/tools/7-Zip/Lang/br.txt deleted file mode 100644 index 63af1876da..0000000000 --- a/tools/7-Zip/Lang/br.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.12 -; Translated by KAD-Korvigelloù An Drouizig (drouizig.org). -; -; And updated since -; -; - -00000000="Breton" -00000001="Brezhoneg" -00000002="126" - -; 7-Zip Configuration - -; Title -01000000="Kefluniañ 7-Zip" - -; Info Page -01000100="Keloù" -01000103="Digoust eo ar meziant 7-Zip. Mar plij deoc'h 7-zip ha mar fell deoc'h skoazellañ ar raktres-mañ e c'hellit donezoniñ argant da 7-Zip." -01000105="Donezoniñ" - -; Folders Page -01000200="Teulioù" -01000210="Teulioù &labour" -01000211="Teul dibadelus ar &reizhiad" -01000212="Teul &red" -01000213="Teul &spisaet :" -01000214="Implijout nemet evit ar mediaoù dilec'hus" - -01000281="Spisait un teul evit lakaat ar restroù diell dibadelus." - -; System Page -01000300="Reizhiad" -01000301="Lakaat 7-Zip el lañser kemperzhel" -01000302="Lañser kemperzhel a-steud" -01000310="Elfennoù al lañser kemperzhel :" - -; Language Page -01000400="Yezh" -01000401="Yezh :" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Arc'hwelioù 7-Zip" -02000103="Digeriñ" -02000104="Digeriñ an diell diuzet." -02000105="Eztennañ ar restroù..." -02000106="Eztennañ ar restroù diouzh an diell diuzet." -02000107="Ouzhpennañ d'an diell..." -02000108="Ouzhpennañ an elfennoù diuzet d'an diell." -02000109="Gwiriañ an diell" -0200010A="Gwiriañ yalc'h an diell diuzet." -0200010B="Eztennañ amañ" -0200010C="Eztennañ restroù an diell diuzet en teul red." -0200010D="Eztennañ diwar {0}" -0200010E="Eztennañ e-barzh un is-teul." -0200010F="Ouzhpennañ da {0}" -02000110="Ouzhpennañ an elfennoù diuzet d'an diell." -02000111="Gwaskañ ha kas dre postel..." -02000112="Gwaskañ an elfennoù diuzet d'an diell a kas anezhi dre postel." -02000113="Gwaskañ diwar {0} ha kas dre postel." -02000114="Gwaskañ an elfennoù diuzet d'an diell ha kas anezhi dre postel." - -02000140="" -02000141="" - -; Properties -02000203="Treug" -02000204="Anv" -02000205="Astenn" -02000206="Teul" -02000207="Ment" -02000208="Gwasket" -02000209="Doareennoù" -0200020A="Savet d'ar" -0200020B="Stoket d'ar" -0200020C="Kemmet d'ar" -0200020D="Solut" -0200020E="Evezhiadenn" -0200020F="Ennodet" -02000210="Rannañ a-raok" -02000211="Rannañ war-lerc'h" -02000212="Geriadur" -02000213="CRC" -02000214="Rizh" -02000215="Enep" -02000216="Hentenn" -02000217="OS ostiz" -02000218="Reizhiad restroù" -02000219="Implijour" -0200021A="Strollad" -0200021B="Bloc'h" -0200021C="Evezhiadenn" -0200021D="Lec'hiadur" - -; Status bar -02000301="{0} elfenn ziuzet" -02000302="{0} elfenn" - -; List Context Menu -02000401="&Bannoù..." - -02000411="&Digeriñ" -02000412="&Eztennañ..." - -; ToolBar -02000501="Eztennañ" - -; Messages -02000601="N'haller ket ober gant an oberiadennoù nevesaat evti an diell-mañ." -02000602="N'haller ket nevesaat an diell '{0}'" -02000603="N'haller ket sevel ar restr '{0}'" -02000604="N'eo ket ur restr diell reizh ar restr-mañ." -02000605="Fazi" -02000606="Re a elfennoù" -02000607="Arload ebet kenstaget gant ar rizh restr-mañ" -02000608="N'eus fazi ebet" - -; Dialogs -02000702="Mat eo" -02000705="&Ya" -02000707="Ya be&pred" -02000709="&Ket" -0200070B="Ket &bepred" - -02000710="Nullañ" -02000711="&Nullañ" -02000713="&Serriñ" -02000714="Paouez" -02000715="Adloc'hañ" - -02000720="Skoazell" - -; Extract dialog -02000800="Eztennañ" -02000801="E&ztennañ diwar :" -02000802="Ger-tremen" - -02000810="Treugoù" -02000811="Treugoù klok" -02000812="Treugoù daveel" -02000813="Treug ebet" - -02000820="Mod erlec'hiañ" -02000821="Goulenn a-raok erlec'hiañ" -02000822="Erlec'hiañ hep goulenn" -02000823="Lakaat ar restroù a zo anezho a-gostez" -02000824="Adenvel ent-emgefre" -02000824="Adenvel ent-emgefre ar restroù a zo anezho" - -02000830="Restroù" -02000831="&Restroù diuzet" -02000832="&An holl restroù" - -02000881="Dibabit un teul evit eztennañ an restroù." - -02000890="Eztennañ" - -; Overwrite dialog -02000900="Kadarnaat a-raok erlec'hiañ ur restr" -02000901="Emañ dija ur restr gant ar memes anv en teul bukenn." -02000902="Ha fellout a ra deoc'h lakaat e-lec'h" -02000903="ar restr da heul ?" - -02000911="Adenvel ent-&emgefre" - -02000982="{0} eizhtet" -02000983="kemmet d'ar" - -; Messages dialog -02000A00="Kemennoù yalc'h" - -02000A80="Kemenn" - -02000A91="Hentenn waskañ direizh evit '{0}'." -02000A92="Stlenn faziet e-barzh '{0}'. Gwastet eo ar restr." -02000A93="Fazi ar reoliñ CRC evit '{0}'. Gwastet eo ar restr." - -; Password dialog -02000B00="Roit ar ger-tremen" -02000B01="Roit ar ger-tremen :" -02000B02="&Diskouez ar ger-tremen" - -; Progress dialog -02000C00="O labourat" -02000C01="Amzer dremenet :" -02000C02="Amzer o chom :" -02000C03="Ment :" -02000C04="Tizh :" - -02000C10="&Drekleur" -02000C11="&Rakleur" -02000C12="&Ehan" -02000C13="&Kenderc'hel" - -02000C20="Ehanet" - -02000C30="Ha fellout a ra deoc'h nullañ ?" - -; Compress dialog -02000D00="Ouzhpennañ d'an diell" -02000D01="&Diell :" -02000D02="&Mod nevesaat :" -02000D03="&Mentrezh an diell :" -02000D04="Rizh &gwaskañ:" -02000D05="Sevel un diell &solut" -02000D06="&Perzhioù:" -02000D07="&Dibaboù" -02000D08="Sevel un diell SF&X" -02000D09="Lies-neudennañ" -02000D0A="Ennodiñ an &anvioù restroù" -02000D0B="L&ive gwaskañ :" -02000D0C="&Ment ar geriadur :" -02000D0D="Me&nt ar gerioù :" -02000D0E="Memor evit ar waskerezh :" -02000D0F="Memor evit an diwaskerezh :" - -02000D40="Troc'hañ e &levrennoù, eizhtetoù :" - -02000D81="Gwaskañ ebet" -02000D82="Reizh" -02000D83="Uhelañ" -02000D84="Prim" -02000D85="Primañ" -02000D86="Gour" - -02000D90="Furchal" - -02000DA1="Ouzhpennañ hag erlec'hiañ ar restroù" -02000DA2="Nevesaat hag ouzhpennañ ar restroù" -02000DA3="Freskaat ar restroù a zo anezho" -02000DA4="Goubredañ ar restroù" - -02000DB1="An holl restroù" - -02000DC0="O waskañ" - -; Columns dialog -02000E00="Bannoù" -02000E01="Merkit ar bannoù a fell deoc'h diskouez. Implijit ar meudellioù Dilec'hiañ a-us hag a-zindan evit kemmañ an urzh." -02000E02="Ret eo bezañ ar bann diuzet" -02000E03="piksel a ledander." - -02000E10="Dil. a-&us" -02000E11="Dil. a-&zindan" -02000E12="&Diskouez" -02000E13="&Kuzhat" -02000E14="Lakaat" - -02000E81="Titl" -02000E82="Ledander" - -; Testing -02000F90="Gwiriañ" - - -; File Manager - -03000000="Ardoer restroù 7-Zip" - -; Menu -03000102="&Restr" -03000103="&Aozañ" -03000104="&Gwelout" -03000105="&Ostilhoù" -03000106="&Skoazell" -03000107="Di&baboù" - -; File -03000210="&Digeriñ" -03000211="Digeriñ a-zia&barzh" -03000212="Digeriñ a-zia&vaez" -03000220="&Gwelout" -03000221="&Aozañ" -03000230="Adenv&el" -03000231="&Kopiañ diwar..." -03000232="&Dilec'hiañ diwar..." -03000233="D&ilemel" -03000240="P&erzhioù" -03000241="Evezhia&denn" -03000250="Sevel un teul" -03000251="Sevel ur restr" -03000260="&Kuitaat" -03000270="&Troc'hañ restr..." -03000271="&Kendeuziñ restroù..." - -; Edit -03000310="&Nullañ" -03000311="&Adober" -03000320="&Troc'hañ" -03000321="Ko&piañ" -03000322="P&egañ" -03000323="Di&lemel" -03000330="Diuz pep &tra" -03000331="Diziuz pe tra" -03000332="Lakaat an &diuzad war an tu gin" -03000333="Diuz..." -03000334="Diziuz..." -03000335="Diuz diouzh ar rizh" -03000336="Diziuz diouzh ar rizh" - -; View -03000410="Arlunioù &bras" -03000411="Arlunioù &bihan" -03000412="&Roll" -03000413="&Munudoù" -03000420="Dirummet" -03000430="Digeriñ an teul gwrizienn" -03000431="Teul kerent" -03000432="Roll istor an teul..." -03000440="Fresk&aat" -03000450="&2 brenestr" -03000451="&Barrennoù ostilhoù" -03000460="Barrenn ziell" -03000461="Barrenn skouerek" -03000462="Meudellioù bras" -03000463="Diskouez an destenn" - -; Tools -03000510="&Dibaboù..." -03000511="&Amprouiñ" - -; Help -03000610="&Roll ar pennadoù..." -03000620="A-&zivout 7-Zip..." - -; Favorites -03000710="&Ouzhpennañ ar c'havlec'h d'ar sinedoù" -03000720="Sined" - -; Options Dialog - -03010000="Dibaboù" - -; Plugins -03010100="Molladoù" -03010101="&Molladoù :" -03010110="Dibaboù..." - -; Edit -03010200="Embanner" -03010201="&Embanner :" - -; System -03010300="Reizhiad" -03010302="Kenstagañ 7-Zip ouzh :" -03010310="Mollad" - -; Settings -03010400="Perzhioù" -03010401="Diskouez an elfenn \"..\"" -03010402="Diskouez arlunioù gwirion ar restroù" -03010410="Diskouez al lañser reizhiad" -03010420="&Diuz ar bannoù a-bezh" -03010421="Diskouez al &linennoù kael" - -; Strings - -03020201="Kopiañ" -03020202="Dilec'hiañ" -03020203="Kopiañ e-barzh :" -03020204="Dilec'hiañ diwar :" -03020205="O kopiañ..." -03020206="O tilec'hiañ..." -03020207="N'hallit ket dilec'hiañ pe gopiañ lod a elfennoù evit ar restroù-se." -03020208="N'haller ket ober an oberiadenn-mañ." - -03020210="Kadarnañ a-raok dilemel ar restr" -03020211="Kadarnañ a-raok dilemel an teul" -03020212="Kadarnañ a-raok dilemel an holl restroù" -03020213="Ha fellout a ra deoc'h dilemel '{0}' ?" -03020214="Ha fellout a ra deoc'h dilemel an teul '{0}' ha pep tra a zo e-barzh ?" -03020215="Ha fellout a ra deoc'h dilemel ar {0} elfenn-mañ ?" -03020216="O tilemel..." -03020217="Fazo o tilemel ar restr pe an teul" - -03020220="Oc'h adenvel..." -03020221="Fazi oc'h adenvel ar restr pe an teul" - -03020230="Sevel un teul" -03020231="Anv an teul :" -03020232="Teul nevez" -03020233="Fazi o sevel an teul" - -03020240="Sevel ur restr" -03020241="Anv restr :" -03020242="Restr nevez" -03020243="Fazi o sevel ar restr" - -03020250="Diuz" -03020251="Diziuz" -03020252="Kuzh :" - -03020260="Roll istor an teulioù" - -03020280="Kemmet ez eo bet ar restr '{0}'.\nHa fellout a ra deoc'h he nevesaat en diell ?" -03020281="N'haller ket nevesaat\n'{0}'" -03020282="N'haller ket loc'hañ an embanner." -03020283="O tigeriñ..." - -03020290="Evezhiadenn" -03020291="&Evezhiadenn :" - -030202A0="Reizhiad" - -03020300="Urzhiataer" -03020301="Rouedad" - -03020400="Ouzhpennañ" -03020401="Eztennañ" -03020402="Amprouiñ" - -03020420="Kopiañ" -03020421="Dilec'hiañ" -03020422="Dilemel" -03020423="Keloù" - -03020500="Troc'hañ restr" -03020501="&Troc'hañ da :" -03020510="O troc'hañ..." - -03020600="Kendeuziñ restroù" -03020601="&Kendeuziñ da :" -03020610="O kendeuziñ..." - -; Computer -03031100="Ment en holl" -03031101="Egor vak" -03031102="Ment ar c'hleusteurioù" -03031103="Skritellig" - -; Network -03031200="Anv lec'hel" -03031201="Pourchaser" - -; Benchmark Dialog - -03080000="Amprouiñ" -03080001="Implij ar vemor :" -03080002="Gwaskerezh" -03080003="Diwaskerezh" -03080004="Tizh" -03080005="Feur" -03080006="Feur en holl" -03080007="Red" -03080008="Da heul" -03080009="Tremenioù :" -0308000A="Fazioù :" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ca.txt b/tools/7-Zip/Lang/ca.txt deleted file mode 100644 index 123ba981c2..0000000000 --- a/tools/7-Zip/Lang/ca.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by Josep Casals and Marc Folch -; -; -; -; - -00000000="Catalan" -00000001="Català" -00000002="3" - -; 7-Zip Configuration - -; Title -01000000="Configuració de 7-Zip" - -; Info Page -01000100="Informació sobre 7-Zip" -01000103="7-Zip és programari lliure. De totes maneres, podeu col.laborar en el seu desenvolupament registrant el programa." -01000104="Suport" -01000105="Registra" - -; Folders Page -01000200="Carpetes" -01000210="Carpeta de &treball" -01000211="Carpeta temporal del &sistema" -01000212="Carpeta a&ctual" -01000213="E&specifica una carpeta:" -01000214="Utilitza únicament per a discs extraïbles" - -01000281="Especifica una carpeta pels fitxers temporals." - -; System Page -01000300="Sistema" -01000301="Integra 7-Zip dins el menú contextual de Windows" -01000302="Menú contextual en cascada" -01000310="Objectes del menú contextual:" - -; Language Page -01000400="Llengua" -01000401="Llengua:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip comandes" -02000103="Obre" -02000104="Obre el fitxer seleccionat." -02000105="Extreu fitxers..." -02000106="Extreu els fitxers de el fitxer seleccionat." -02000107="Afegeix al fitxer..." -02000108="Afegeix els fitxers seleccionats a l'arxiu." -02000109="Comprova el fitxer" -0200010A="Comprova la integritat del fitxer seleccionat." -0200010B="Extreu a aquesta carpeta" -0200010C="Extreu els fitxers de l'arxiu escollit al directori actual." -0200010D="Extreu a {0}" -0200010E="Extreu fitxers a la subcarpeta." -0200010F="Afegeix a {0}" -02000110="Afegeix els fitxers escollits a l'arxiu." -02000111="Comprimeix i envia per correu electrònic..." -02000112="Comprimeix els objectes escollits al fitxer i envia'l per correu electrònic." -02000113="Comprimeix a {0} i envia per correu electrònic" -02000114="Comprimeix els objectes escollits al fitxer i envia'l per correu electrònic.." - -02000140="" -02000141="" - -; Properties -02000203="Adreça" -02000204="Nom" -02000205="Tipus de fitxer" -02000206="Carpeta" -02000207="Mida" -02000208="Mida comprimit" -02000209="Atributs" -0200020A="Creat" -0200020B="Darrer accés" -0200020C="Darrera modificació" -0200020D="Compacte" -0200020E="Comentari" -0200020F="Xifrat" -02000210="Expandit abans" -02000211="Expandit després" -02000212="Diccionari" -02000213="CRC" -02000214="Tipus" -02000215="Anti" -02000216="Mètode" -02000217="SO orígen" -02000218="Sistema de fitxers" -02000219="Usuari" -0200021A="Grup" -0200021B="Bloc" -0200021C="Comentari" -0200021D="Posició" -0200021E="Path Prefix" -0200021F="Carpetes" -02000220="Fitxers" -02000221="Versió" -02000222="Volum" -02000223="Multivolum" -02000224="Desplaçament" -02000225="Enllaços" -02000226="Blocs" -02000227="Volums" - -02000229="64-bits" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Mida física" -0200022D="Mida capçaleres" -0200022E="Suma de verificació" -0200022F="Característiques" -02000230="Adreça virtual" -02000231="ID" -02000232="Nom curt" -02000233="Aplicació creadora" -02000234="Mida del sector" -02000235="Mode" -02000236="Enllaç" - -; Status bar -02000301="{0} objecte(s) seleccionat(s)" -02000302="{0} objecte(s)" - -02000320="Fitxers:" -02000321="Carpetes:" -02000322="Mida:" -02000323="Mida comprimit:" -02000324="Arxius:" - -; List Context Menu -02000401="&Columnes..." - -02000411="&Obre" -02000412="&Extreu..." - -; ToolBar -02000501="Extreure" - -; Messages -02000601="Aquest tipus de fitxer no permet actualització." -02000602="No es pot actualitzar el fitxer {0}" -02000603="No es pot crear la carpeta '{0}'" -02000604="Tipus de fitxer desconegut." -02000605="Error" -02000606="Massa objectes" -02000607="No hi ha cap programa associat amb aquest tipus de fitxer" -02000608="No hi ha errors" -02000609="No es pot obrir el fitxe '{0}' com a arxiu" -0200060A="No es pot obrir el fitxer xifrat '{0}'. La contrasenya és incorrecta?" -0200060B="El sistema no pot assignar la quantitat de memòria requerida" -0200060C="Error desconegut" -0200060D="Tipus d'arxiu no admès" - -; Dialogs -02000702="D'acord" -02000705="&Sí" -02000707="Sí a &tot" -02000709="&No" -0200070B="No a t&ot" - -02000710="Cancel.la" -02000711="&Cancel.la" -02000713="Tan&ca" -02000714="Atura" -02000715="Reinicia" - -02000720="Ajuda" - -; Extract dialog -02000800="Extreu" -02000801="E&xtreu a:" -02000802="Contrasenya" - -02000810="Mode d'adreça" -02000811="Adreça completa" -02000812="Adreça actual" -02000813="Sense adreça" - -02000820="Sobreescriure" -02000821="Amb confirmació" -02000822="Sense confirmació" -02000823="Conserva els fitxers ja existents" -02000824="Reanomena automàticament" -02000825="Auto-reanomena fitxers existents" - -02000830="Fitxers" -02000831="Fitxers &seleccionats" -02000832="Tots els fitxers" - -02000881="Seleccioneu una destinació pels fitxers extrets." - -02000890="Extraient" - -; Overwrite dialog -02000900="Confirmeu substitució de fitxers" -02000901="La carpeta de destí conté un fitxer amb el mateix nom." -02000902="Voleu substituir el fitxer existent" -02000903="per aquest altre?" - -02000911="Renomena a&utomàticament" - -02000982="{0} bytes" -02000983="modificat el" - -; Messages dialog -02000A00="Missatges de diagnosi" - -02000A80="Missatge" - -02000A91="Mètode de compressió no vàlid per a '{0}'." -02000A92="Error de dades en '{0}'. El fitxer és corrupte." -02000A93="CRC ha fallat en '{0}'. El fitxer és corrupte." -02000A94="Error de dades al fitxer xifrat '{0}'. Contrasenya errònia?" -02000A95="CRC ha fallat al fitxer xifrat '{0}'. Contrasenya errònia?" - -; Password dialog -02000B00="Introduïu la contrasenya" -02000B01="Introduïu la contrasenya:" -02000B02="Mo&stra la contrasenya" -02000B03="Torneu a introduir la contrasenya:" -02000B10="Les contrasenyes no coincideixen" -02000B11="Utilitza només lletres (sense accents), números i caràcters especials (!, #, $, ...) a la contrasenya" -02000B12="La contrasenya és massa llarga" - -; Progress dialog -02000C00="Procés" -02000C01="Temps transcorregut:" -02000C02="Temps restant:" -02000C03="Mida:" -02000C04="Taxa:" -02000C05="Processat:" -02000C06="Ràtio de compressió:" - -02000C10="Rerefons" -02000C11="Primer pla" -02000C12="&Pausa" -02000C13="&Continua" - -02000C20="Aturat" - -02000C30="Esteu segur que voleu cancel.lar?" - -; Compress dialog -02000D00="Afegir al fitxer" -02000D01="&Fitxer:" -02000D02="Mode d'act&ualització:" -02000D03="&Format del fitxer:" -02000D04="&Tipus de compressió:" -02000D05="Crea fitxer compacte" -02000D06="&Paràmetres:" -02000D07="Opcions" -02000D08="Crea fitxer SF&X" -02000D09="Multi-threading" -02000D0A="Xifra el nom dels fitxers" -02000D0B="Nivell de &compressió:" -02000D0C="Mida del &diccionari:" -02000D0D="Mida de la paraula:" -02000D0E="Ús de memòria per comprimir:" -02000D0F="Ús de memòria per descomprimir:" -02000D10="Xifrat" -02000D11="Mètode de xifrat:" -02000D12="Nombre de fils de la CPU:" -02000D13="Mida de bloc sòlid:" -02000D14="No sòlid" -02000D15="Sòlid" -02000D16="Comprimeix fitxers compartits" - -02000D40="Divideix en &volums, bytes:" -02000D41="Mida del volum incorrecte" -02000D42="Mida de volum especificada: {0} bytes.\nEsteu segur que voleu dividir el fitxer en aquests volums?" - -02000D81="Sense compressió" -02000D82="Normal" -02000D83="Màxima" -02000D85="Ràpida" -02000D85="La més ràpida" -02000D86="Ultra" - -02000D90="Visualitza" - -02000DA1="Afegeix i substitueix fitxers" -02000DA2="Actualitza i afegeix fitxers" -02000DA3="Actualitza fitxers ja presents" -02000DA4="Sincronitza fitxers" - -02000DB1="Tots els fitxers" - -02000DC0="Comprimint" - -; Columns dialog -02000E00="Columnes" -02000E01="Seleccioneu les columnes que voleu que siguin visibles en aquest mode. Feu servir les tecles AvPg i RePg per a organitzar les columnes." -02000E02="La columna escollida ha de tenir" -02000E03="pixels d'amplària." - -02000E10="Mou cap am&unt" -02000E11="Mou cap avall" -02000E12="Mo&stra" -02000E13="Amaga" -02000E14="Fixa" - -02000E81="Títol" -02000E82="Ample" - -; Testing -02000F90="Provant" - - -; File Manager - -03000000="Gestor de Fitxers 7-Zip" - -; Menu -03000102="&Fitxer" -03000103="&Edita" -03000104="&Visualitza" -03000105="E&ines" -03000106="Aj&uda" -03000107="&Preferits" - -; File -03000210="&Obre" -03000211="Obre d&ins" -03000212="Obre fora" -03000220="&Visualitza" -03000221="&Edita" -03000230="Renom&ena" -03000231="&Copia a..." -03000232="&Moure a..." -03000233="Suprimeix" -03000240="P&ropietats" -03000241="Come&ntari" -03000242="Calcula el checksum" -03000243="Diff" -03000250="Crea carpeta" -03000251="Crea fitxer" -03000260="Surt" -03000270="&Divideix el fitxer..." -03000271="Com&bina el fitxer..." - -; Edit -03000310="Desfés" -03000311="&Refés" -03000320="Re&talla" -03000321="&Copia" -03000322="Enganxa" -03000323="&Suprimeix" -03000330="Seleccion&a-ho tot" -03000331="Deselecciona-ho tot" -03000332="&Inverteix selecció" -03000333="Selecciona..." -03000334="Deselecciona..." -03000335="Selecciona per tipus" -03000336="Deselecciona per tipus" - -; View -03000410="Icones g&rans" -03000411="Icones petites" -03000412="&Llista" -03000413="&Detalls" -03000420="No ordenat" -03000430="Obre carpeta arrel" -03000431="Carpeta pare" -03000432="Historial de carpetes..." -03000440="&Actualitza" -03000449="Vista plana" -03000450="&2 Taules" -03000451="&Barres d'eines" -03000460="Barra d'eines afegeix/extreu" -03000461="Barra d'eines estàndard" -03000462="Botons grans" -03000463="Mostra botons amb text" - -; Tools -03000510="Opcions..." -03000511="&Test de referència" - -; Help -03000610="&Contingut..." -03000620="Quant a 7-Zip..." - -; Favorites -03000710="&Afegeix la carpeta als Preferits com" -03000720="Personal" - -; Options Dialog - -03010000="Opcions" - -; Plugins -03010100="Connectors" -03010101="&Connectors:" -03010110="Opcions..." - -; Edit -03010200="Editor" -03010201="&Editor:" -03010202="&Diff:" - -; System -03010300="Sistema" -03010302="Associa 7-Zip amb:" -03010310="Connector" - -; Settings -03010400="Selecció" -03010401="Mostra l'element \"..\"" -03010402="Mostra icones reals dels fitxers" -03010410="Mostra el menú de sistema" -03010420="&Selecció de columna completa" -03010421="Mostra les línies de &graella" -03010422="Obre amb un sol clic els elements" -03010430="Mode de selecció &alternatiu" -03010440="Usa pàgines de memòria &grans" - -; Strings - -03020201="Copia" -03020202="Mou" -03020203="Copia a:" -03020204="Mou a:" -03020205="Copiant..." -03020206="Movent..." -03020207="No es poden moure o copiar elements d'aquest tipus de carpetes." -03020208="Operació no permesa." -03020209="Seleccioneu una carpeta de destí." - -03020210="Confirmeu la supressió del fitxer" -03020211="Confirmeu la supressió de la carpeta" -03020212="Confirmeu supressió múltiple de fitxers" -03020213="Esteu segur que voleu suprimir '{0}'?" -03020214="Esteu segur que voleu suprimir la carpeta '{0}' i tot el seu contingut?" -03020215="Esteu segur que voleu esborrar aquests {0} elements?" -03020216="Suprimint..." -03020217="Error esborrant fitxer o carpeta" -03020218="El sistema no pot moure un fitxer amb una ruta llarga a la paperea de reciclatge" - -03020220="Renomenant..." -03020221="Error renomenant fitxer o carpeta" -03020222="Confirmeu la còpia del fitxer" -03020223="Esteu segur que voleu copiar els fitxers a l'arxiu" - -03020230="Crea carpeta" -03020231="Nom de carpeta:" -03020232="Carpeta nova" -03020233="Error creant carpeta" - -03020240="Crea arxiu" -03020241="Nom d'arxiu:" -03020242="Fitxer nou" -03020243="Error creant el fitxer" - -03020250="Selecciona" -03020251="No selecciona" -03020252="Màscara:" - -03020260="Historial de carpetes" - -03020280="El fitxer '{0}' ha estat modificat.\nVoleu actualitzar-lo a l'arxiu?" -03020281="No pot actualitzar-se el fitxer\n'{0}'" -03020282="No pot executar-se l'editor." -03020283="Obrint..." -03020284="El fitxer sembla un virus (el nom del fitxer conté espais molt llargs al nom)." - -03020290="Comentari" -03020291="&Comentari:" - -030202A0="Sistema" - -03020300="El meu ordinador" -03020301="Entorn de xarxa" -03020302="Documents" - -03020400="Afegeix" -03020401="Extreu" -03020402="Prova" - -03020420="Copia" -03020421="Mou" -03020422="Suprimeix" -03020423="Info" - -03020500="Divideix fitxer" -03020501="&Divideix a:" -03020510="Dividint..." -03020520="Confirmació de la divisió" -03020521="Esteu segur que voleu dividir el fitxer en {0} volums?" -03020522="La mida del volum ha de ser més petita que la mida del fitxer original" - -03020600="Combina fitxers" -03020601="&Combina a:" -03020610="Combinant..." -03020620="Seleccioneu només el primer fitxer" -03020621="No es pot detectar un fitxer com a una part del fitxer dividit" -03020622="No es pot trobar més d'una part del fitxer dividit" - -03020710="Calculant el checksum..." -03020720="Informació del checksum" -03020721="CRC checksum per les dades:" -03020722="CRC checksum per les dades i els noms:" - -03020800="Scanning..." - -03020900="Properties" - -03020A01="L'operació no es pot cridar des d'una carpeta amb una ruta llarga." -03020A02="Heu de seleccionar un fitxer" -03020A03="Heu de seleccionar un o més fitxers" -03020A04="El fitxer {0} ja existeix" - -; Computer -03031100="Mida total" -03031101="Espai lliure" -03031102="Mida sector" -03031103="Etiqueta" - -; Network -03031200="Nom local" -03031201="Proveïdor" - -; Benchmark Dialog - -03080000="Test de referència" -03080001="Ús de la memòria:" -03080002="Comprimint" -03080003="Decomprimint" -03080004="Velocitat" -03080005="Taxa" -03080006="Taxa total" -03080007="Actual" -03080008="Resultant" -03080009="Passades:" -0308000A="Errors:" -0308000B="Ús de la CPU" -0308000C="Taxa / Ús" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/cs.txt b/tools/7-Zip/Lang/cs.txt deleted file mode 100644 index 65f7b0a04b..0000000000 --- a/tools/7-Zip/Lang/cs.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.30 -; Translated by Milan Hrubý -; Updated for 4.33 version by Michal Molhanec -; 7-Zip 4.57 updated by Jiří Malák -; 7-Zip 9.07 updated by Jiří Malák -; - -00000000="Czech" -00000001="Čeština" -00000002="5" - -; 7-Zip Configuration - -; Title -01000000="7-Zip konfigurace" - -; Info Page -01000100="O programu 7-Zip" -01000103="7-Zip je svobodný software. Nicméně můžete podpořit jeho vývoj registrací." -01000104="Podpora" -01000105="Registrovat" - -; Folders Page -01000200="Složky" -01000210="Pracovní složka" -01000211="&Systémová složka pro dočasné soubory" -01000212="&Aktuální" -01000213="S&ložka:" -01000214="&Používat pouze pro vyjímatelné disky" - -01000281="Vyberte umístění pro dočasné komprimované soubory." - -; System Page -01000300="Systém" -01000301="&Integrovat 7-Zip do kontextového menu" -01000302="S&tupňovité kontextové menu" -01000310="&Položky kontextového menu:" - -; Language Page -01000400="Jazyk" -01000401="Jazyk:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip příkazy" -02000103="Otevřít" -02000104="Otevře vybraný archiv." -02000105="Rozbalit soubory..." -02000106="Rozbalí soubory z vybraného archivu." -02000107="Přidat do archivu..." -02000108="Přidá vybrané položky do archivu." -02000109="Zkontrolovat archiv" -0200010A="Zkontroluje integritu vybraného archivu." -0200010B="Rozbalit zde" -0200010C="Rozbalí soubory z vybraného archivu do aktuální složky." -0200010D="Rozbalit do {0}" -0200010E="Rozbalí soubory do podsložky." -0200010F="Přidat do {0}" -02000110="Přidá vybrané položky do archivu." -02000111="Zkomprimovat a odeslat poštou..." -02000112="Zkomprimuje vybrané položky do archivu a odešle archiv poštou." -02000113="Zkomprimovat do {0} a odeslat poštou" -02000114="Zkomprimuje vybrané položky do archivu a odešle archiv poštou." - -02000140="" -02000141="" - -; Properties -02000203="Cesta" -02000204="Název" -02000205="Přípona" -02000206="Složka" -02000207="Velikost" -02000208="Komprimovaná velikost" -02000209="Atributy" -0200020A="Vytvořen" -0200020B="Použit" -0200020C="Změněn" -0200020D="Pevný" -0200020E="S poznámkou" -0200020F="Zakódovaný" -02000210="Rozdělen do" -02000211="Rozdělen od" -02000212="Slovník" -02000213="CRC" -02000214="Typ" -02000215="Anti" -02000216="Metoda" -02000217="Hostitelský OS" -02000218="Souborový systém" -02000219="Uživatel" -0200021A="Skupina" -0200021B="Blok" -0200021C="Poznámka" -0200021D="Pozice" -0200021E="Cesta" -0200021F="Složky" -02000220="Soubory" -02000221="Verze" -02000222="Díl" -02000223="Vícedílný" -02000224="Offset" -02000225="Odkazy" -02000226="Bloků" -02000227="Dílů" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="Pocesor" -0200022C="Fyzická velikost" -0200022D="Velikost hlaviček" -0200022E="Kontrolní součet" -0200022F="Charakteristiky" -02000230="Virtuální adresa" -02000231="ID" -02000232="Krátké jméno" -02000233="Autor" -02000234="Velikost sektoru" -02000235="Režim" -02000236="Odkaz" - -; Status bar -02000301="vybráno {0} objekt(ů)" -02000302="{0} objekt(ů)" - -02000320="Soubory:" -02000321="Složky:" -02000322="Velikost:" -02000323="Komprimovaná velikost:" -02000324="Archívy:" - -; List Context Menu -02000401="&Sloupce..." - -02000411="&Otevřít" -02000412="&Rozbalit..." - -; ToolBar -02000501="Rozbalit" - -; Messages -02000601="Aktualizace není podporována pro tento archiv." -02000602="Nelze aktualizovat archiv {0}" -02000603="Nelze vytvořit složku '{0}'" -02000604="Soubor není podporovaným archivem." -02000605="Chyba" -02000606="Příliš mnoho položek" -02000607="Žádná aplikace není asociována s touto příponou souboru" -02000608="Nedošlo k žádným chybám" -02000609="Soubor '{0}' nelze otevřít jako archiv" -0200060A="Zakódovaný archiv '{0}' nelze otevřít. Špatné heslo?" -0200060B="Systém nemůže přidělit požadovanou velikost paměti" -0200060C="Neznámá chyba" -0200060D="Nepodporovaný typ archivu" - -; Dialogs -02000702="OK" -02000705="&Ano" -02000707="Ano na &všechno" -02000709="&Ne" -0200070B="N&e na všechno" - -02000710="Storno" -02000711="&Storno" -02000713="Zavří&t" -02000714="Zastavit" -02000715="Spustit znovu" - -02000720="Nápověda" - -; Extract dialog -02000800="Rozbalit" -02000801="&Rozbalit do:" -02000802="Heslo" - -02000810="Cesty" -02000811="Plné cesty" -02000812="Aktuální cesty" -02000813="Bez cesty" - -02000820="Způsob přepisování" -02000821="Zeptat se před přepisem" -02000822="Přepsat bez výzvy" -02000823="Přeskočit existující soubory" -02000824="Automatické přejmenování" -02000825="Automatické přejmenování existujících souborů" - -02000830="Soubory" -02000831="&Vybrané soubory" -02000832="Všechny &soubory" - -02000881="Vyberte umístění pro rozbalené soubory." - -02000890="Rozbalování" - -; Overwrite dialog -02000900="Potvrzení nahrazení souboru" -02000901="Cílová složka již obsahuje zpracovaný soubor." -02000902="Chcete nahradit existující soubor" -02000903="tímto?" - -02000911="A&utomaticky přejmenovat" - -02000982="{0} bajtů" -02000983="změněn" - -; Messages dialog -02000A00="Diagnostické zprávy" - -02000A80="Zpráva" - -02000A91="Nepodporovaná komprimační metoda pro '{0}'." -02000A92="Chyba dat v '{0}'. Soubor je poškozený." -02000A93="Chyba CRC v '{0}'. Soubor je poškozený." -02000A94="Chyba dat v zakódovaném souboru '{0}'. Chybné heslo?" -02000A95="Chyba CRC v zakódovaném souboru '{0}'. Chybné heslo?" - -; Password dialog -02000B00="Vložit heslo" -02000B01="Vložit heslo:" -02000B02="Zobrazit he&slo" -02000B03="Potvrzení hesla:" -02000B10="Heslo nesouhlasí" -02000B11="Pro heslo použíjte pouze anglická písmena, číslice a speciální znaky (!, #, $, ...)" -02000B12="Heslo je příliš dlouhé" - -; Progress dialog -02000C00="Průběh" -02000C01="Uplynulý čas:" -02000C02="Zbývající čas:" -02000C03="Celková velikost:" -02000C04="Rychlost:" -02000C05="Zpracováno:" -02000C06="Komprimační poměr:" - -02000C10="&Pozadí" -02000C11="P&opředí" -02000C12="Po&zastavit" -02000C13="Po&kračovat" - -02000C20="Pozastaveno" - -02000C30="Jste si jistí, že to chcete stornovat?" - -; Compress dialog -02000D00="Přidat do archivu" -02000D01="&Archiv:" -02000D02="Způsob aktualizace:" -02000D03="&Formát archivu:" -02000D04="&Komprimační metoda:" -02000D05="&Vytvořit pevný archiv" -02000D06="&Parametry:" -02000D07="Možnosti" -02000D08="Vytvořit SF&X archiv" -02000D09="Více-vláknový" -02000D0A="Zakódovat &názvy souborů" -02000D0B="Ú&roveň komprese:" -02000D0C="Ve&likost slovníku:" -02000D0D="V&elikost slova:" -02000D0E="Spotřeba paměti pro zabalení:" -02000D0F="Spotřeba paměti pro rozbalení:" -02000D10="Zakódování" -02000D11="Metoda zakódování:" -02000D12="Počet vláken procesoru:" -02000D13="Velikost bloku:" -02000D14="Podle velikosti souboru" -02000D15="Pevný" -02000D16="Zkomprimovat otevřené soubory" - -02000D40="Rozdělit na díly, bajtů:" -02000D41="Nesprávná velikost dílu" -02000D42="Zadaná velikost dílu: {0} bytů.\nJste si jistí, že chcete rozdělit archiv do takových dílů?" - -02000D81="Skladovací" -02000D82="Normální" -02000D83="Maximální" -02000D84="Rychlá" -02000D85="Nejrychlejší" -02000D86="Ultra" - -02000D90="Procházet" - -02000DA1="Přidat a nahradit soubory" -02000DA2="Aktualizovat a přidat soubory" -02000DA3="Aktualizovat existující soubory" -02000DA4="Synchronizovat soubory" - -02000DB1="Všechny soubory" - -02000DC0="Komprimování" - -; Columns dialog -02000E00="Sloupce" -02000E01="Zaškrtněte sloupce, které byste rádi zviditelnili v této složce. Použijte tlačítka Posunout nahoru a Posunout dolů pro uspořádání sloupců." -02000E02="Vybraný sloupec by měl být" -02000E03="pixelů šir&oký." - -02000E10="Posunout &nahoru" -02000E11="Posunout &dolů" -02000E12="&Ukázat" -02000E13="&Skrýt" -02000E14="Nastavit" - -02000E81="Název" -02000E82="Šířka" - -; Testing -02000F90="Konrola" - - -; File Manager - -03000000="7-Zip správce souborů" - -; Menu -03000102="&Soubor" -03000103="Úpr&avy" -03000104="&Zobrazení" -03000105="&Nástroje" -03000106="Nápo&věda" -03000107="&Oblíbené" - -; File -03000210="&Otevřít" -03000211="Otevřít u&vnitř" -03000212="Otevřít &mimo" -03000220="&Zobrazit" -03000221="&Upravit" -03000230="&Přejmenovat" -03000231="Kopírovat &do..." -03000232="Př&esunout do..." -03000233="Vymaza&t" -03000240="Vlast&nosti" -03000241="Poznámk&a" -03000242="Vypočítat kontrolní součet" -03000243="Porovnat soubory" -03000250="Vytvořit složku" -03000251="Vytvořit soubor" -03000260="&Konec" -03000270="&Rozdělit soubor..." -03000271="&Sloučit soubory..." - -; Edit -03000310="&Zpět" -03000311="&Opakovat" -03000320="Vyjmou&t" -03000321="&Kopírovat" -03000322="&Vložit" -03000323="Vym&azat" -03000330="Vybrat &vše" -03000331="Zrušit výběr vše" -03000332="&Invertovat výběr" -03000333="Vybrat..." -03000334="Zrušit výběr..." -03000335="Vybrat podle typu" -03000336="Zrušit výběr podle typu" - -; View -03000410="&Velké ikony" -03000411="&Malé ikony" -03000412="&Seznam" -03000413="&Podrobnosti" -03000420="&Bez třídění" -03000430="Otevřít kořenovou složku" -03000431="O úroveň výš" -03000432="Historie složek..." -03000440="&Obnovit" -03000449="\"Ploché\" zobrazení" -03000450="&2 panely" -03000451="Nástrojové lišty" -03000460="Archivační lišta" -03000461="Standardní lišta" -03000462="Velká tlačítka" -03000463="Zobrazovat text tlačítek" - -; Tools -03000510="&Možnosti..." -03000511="&Zkouška výkonu" - -; Help -03000610="&Obsah..." -03000620="O progr&amu 7-Zip..." - -; Favorites -03000710="&Přidat složku do oblíbených jako" -03000720="Záložka" - -; Options Dialog - -03010000="Možnosti" - -; Plugins -03010100="Pluginy" -03010101="&Pluginy:" -03010110="Možnosti..." - -; Edit -03010200="Editor" -03010201="&Editor:" -03010202="Program pro &porovnání souborů:" - -; System -03010300="Systém" -03010302="Asociovat 7-Zip s:" -03010310="Plugin" - -; Settings -03010400="Nastavení" -03010401="Zobrazovat položku \"..\"" -03010402="Zobrazovat skutečnou ikonu souboru" -03010410="Zobrazovat systémové menu" -03010420="&Vybírat celý řádek" -03010421="Zobrazovat &mřížku" -03010422="Otevřít položku jedním kliknutím" -03010430="&Alternativní způsob výběru" -03010440="&Používat velké stránky paměti" - -; Strings - -03020201="Kopírovat" -03020202="Přesunout" -03020203="Kopírovat do:" -03020204="Přesunout do:" -03020205="Kopírování..." -03020206="Přesouvání..." -03020207="Nemůžete přesunout nebo kopírovat položky do této složky." -03020208="Operace není podporována." -03020209="Vyberte cílovou složku." - -03020210="Potvrdit vymazání souboru" -03020211="Potvrdit vymazání složky" -03020212="Potvrdit mnohonásobné vymazání souboru" -03020213="Jste si jistí, že chcete vymazat '{0}'?" -03020214="Jste si jistí, že chcete vymazat složku '{0}' a všechno co obsahuje?" -03020215="Jste si jistí, že chcete vymazat tyto {0} položky?" -03020216="Mazání..." -03020217="Chyba při mazání souboru nebo složky" -03020218="Systém nepodporuje přesun soubor s dlouhou cestou do Odpadkového koše" - -03020220="Přejmenování..." -03020221="Chyba při přejmenování souboru nebo složky" -03020222="Potvrzení kopírování souborů" -03020223="Jste si jistí, že chcete zkopírovat soubory do archivu" - -03020230="Vytvořit složku" -03020231="Název složky:" -03020232="Nová složka" -03020233="Chyba při vytváření složky" - -03020240="Vytvořit soubor" -03020241="Název souboru:" -03020242="Nový soubor" -03020243="Chyba při vytváření souboru" - -03020250="Vybrat" -03020251="Zrušit výběr" -03020252="Maska:" - -03020260="Historie složek" - -03020280="Soubor '{0}' byl změněn.\nChcete ho aktualizovat v archivu?" -03020281="Nelze aktualizovat soubor\n'{0}'" -03020282="Editor nelze spustit." -03020283="Otevírání..." -03020284="Soubor se jeví jako virus (ve jménu souboru jsou dlouhé mezery)." - -03020290="Poznámka" -03020291="&Poznámka:" - -030202A0="Systém" - -03020300="Počítač" -03020301="Síť" -03020302="Dokumenty" - -03020400="Přidat" -03020401="Rozbalit" -03020402="Zkontrolovat" - -03020420="Kopírovat" -03020421="Přesunout" -03020422="Vymazat" -03020423="Informace" - -03020500="Rozdělit soubor" -03020501="Rozdělit do:" -03020510="Rozdělování..." -03020520="Potvrdit rozdělování" -03020521="Jste si jistí, že chcete rozdělit soubor na {0} dílů?" -03020522="Velikost dílu musí být menší než velikost původního souboru" - -03020600="Sloučit soubory" -03020601="Sloučit do:" -03020610="Slučování..." -03020620="Musí se vybrat pouze první díl rozděleného soubor" -03020621="Nepodařilo se rozpoznat rozdělený soubor" -03020622="Nepodařilo se nalézt více než jeden díl rozděleného souboru" - -03020710="Vypočítávání kontrolního součtu..." -03020720="Informace o kontrolním součtu" -03020721="CRC kontrolní součet pro data:" -03020722="CRC kontrolní součet pro data a jména:" - -03020800="Prohledávání..." - -03020900="Vlastnosti" - -03020A01="Operace nemůže být provedena ze složky s dlouhou cestou." -03020A02="Musíte vybrat jeden soubor" -03020A03="Musíte vybrat jeden nebo více souborů" -03020A04="Soubor {0} již existuje" - -; Computer -03031100="Celková velikost" -03031101="Volné místo" -03031102="Velikost clusteru" -03031103="Označení" - -; Network -03031200="Místní název" -03031201="Poskytovatel" - -; Benchmark Dialog - -03080000="Zkouška výkonu" -03080001="Spotřeba paměti:" -03080002="Komprimování" -03080003="Rozbalování" -03080004="Rychlost" -03080005="Výkon" -03080006="Celkový výkon" -03080007="Aktuální" -03080008="Výsledné" -03080009="Průchodů:" -0308000A="Chyb:" -0308000B="Využití procesoru" -0308000C="Výkon / Využití" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/cy.txt b/tools/7-Zip/Lang/cy.txt deleted file mode 100644 index cce6228e0f..0000000000 --- a/tools/7-Zip/Lang/cy.txt +++ /dev/null @@ -1,482 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.37 -; Translated by Owain Lewis -; -; -; -; - -00000000="Welsh" -00000001="Cymraeg" -00000002="82" - -; 7-Zip Configuration - -; Title -01000000="Ffurfweddiad 7-Zip" - -; Info Page -01000100="Manylion 7-Zip" -01000103="Mae 7-Zip yn meddalwedd am ddim. Ond, gallwch cefnogi y -datblygiad o 7-Zip trwy cofrestru." -01000104="Cefnogi" -01000105="Cofrestri" - -; Folders Page -01000200="Ffolderi" -01000210="Ffolder &gweithio" -01000211="Ffolder tymor byr y &system" -01000212="&Cyfredol" -01000213="&Penodol:" -01000214="Defnyddiwch am gyriant symudadwy yn unig" - -01000281="Nodwch lleoliad am ffeiliau archif tymor byr." - -; System Page -01000300="System" -01000301="Cyfuno 7-Zip mewn i dewislen cyd-destun y cribyn" -01000302="Dewislen cyd-destun wedi'i rhaeadru" -01000310="Eitemau dewislen cyd-destun:" - -; Language Page -01000400="Iaith" -01000401="Iaith:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Gorchymynion 7-Zip" -02000103="Agor archif" -02000104="Agor yr archif dethol." -02000105="Echdynnu ffeiliau..." -02000106="Echdynnu ffeiliau o'r archif dethol." -02000107="Ychwanegu i'r archif..." -02000108="Ychwanegu yr eitemau dethol i'r archif." -02000109="Profi archif" -0200010A="Profi cywirdeb yr archif dethol." -0200010B="Echdynnu Yma" -0200010C="Echdynnu ffeiliau o'r archif dethol i'r ffolder cyfredol." -0200010D="Echdynnu i {0}" -0200010E="Echdynnu ffeiliau i is-ffolder." -0200010F="Ychwanegu i {0}" -02000110="Ychwanegu yr eitemau dethol i'r archif." -02000111="Cywasgu ac e-bostio..." -02000112="Cywasgu yr eitemau dethol i archif a danfon yr archif trwy -e-bost." -02000113="Cywasgu i {0} ac e-bostio" -02000114="Cywasgu yr eitemau dethol i archif a danfon yr archif trwy -e-bost." - -02000140="" -02000141="" - -; Properties -02000203="Llwybr" -02000204="Enw" -02000205="Estyniad" -02000206="Ffolder" -02000207="Maint" -02000208="Maint wedi'i Cywasgu" -02000209="Priodweddau" -0200020A="Crëwyd" -0200020B="Cyrchwyd" -0200020C="Addaswyd" -0200020D="Solet" -0200020E="Sylwad" -0200020F="Amgryptio" -02000210="Hollti Cyn" -02000211="Hollti ar Ôl" -02000212="Geiriadur" -02000213="CRC" -02000214="Math" -02000215="Anti" -02000216="Dull" -02000217="SW Cynnal" -02000218="System Ffeiliau" -02000219="Ddefnyddiwr" -0200021A="Grŵp" -0200021B="Bloc" -0200021C="Sylwad" -0200021D="Safle" -0200021E="Rhagddodiad y Llwybr" - -; Status bar -02000301="{0} gwrthrych(au) dethol" -02000302="{0} gwrthrych(au)" - -02000320="Ffeiliau:" -02000321="Ffolderi:" -02000322="Maint:" - -; List Context Menu -02000401="&Colofnau..." - -02000411="&Agor" -02000412="&Echdynnu..." - -; ToolBar -02000501="Echdynnu" - -; Messages -02000601="Mae gweithrediadau diweddaru ddim yn ateg am yr archif hyn." -02000602="Ddim yn gallu diweddaru yr archif {0}" -02000603="Ddim yn gallu creu y ffolder '{0}'" -02000604="Mae'r ffeil ddim yn archif ateg." -02000605="Gwall" -02000606="Gormod o eitemau" -02000607="Mae na ddim rhaglen wedi'i cysylltu gyda'r estyniad enw ffeil" -02000608="Mae na ddim wallau" - -; Dialogs -02000702="Iawn" -02000705="&Iawn" -02000707="Iawn i'r &Cwbwl" -02000709="&Na" -0200070B="Na i'r C&wbwl" - -02000710="Canslo" -02000711="&Canslo" -02000713="&Cau" -02000714="Stopio" -02000715="Ailgychwyn" - -02000720="Cymorth" - -; Extract dialog -02000800="Echdynnu" -02000801="E&chdynnu i:" -02000802="Cyfrinair" - -02000810="Modd llwybr" -02000811="Enwau llwybr llawn" -02000812="Enwau llwybr gyfredol" -02000813="Dim enwau llwybr" - -02000820="Modd disodli" -02000821="Gofyn cyn disodli" -02000822="Disodli heb awgrymeb" -02000823="Crychneidio ffeiliau presennol" -02000824="Ailenwu yn awtomatig" -02000825="Ailenwu ffeiliau presennol yn awtomatig" - -02000830="Ffeiliau" -02000831="&Ffeiliau dethol" -02000832="&Pob ffeil" - -02000881="Nodwch lleoliad am echdynnu ffeiliau." - -02000890="Echdynnu" - -; Overwrite dialog -02000900="Cadarnhau Disodli Ffeil" -02000901="Mae'r ffolder hon eisioes yn cynnwys y ffeil cyrchfan." -02000902="Hoffech chi ddisodli'r ffeil sy'n bodoli eisioes" -02000903="Gyda hon?" - -02000911="Ailenwi A&wtomatig" - -02000982="{0} beit" -02000983="addaswyd ar" - -; Messages dialog -02000A00="Neges diagnostig" - -02000A80="Neges" - -02000A91="Modd cywasgu ddim yn dilys am '{0}'." -02000A92="Gwall data mewn '{0}'. Ffeil wedi'i torri." -02000A93="CRC wedi'i methu mewn '{0}'. Ffeil wedi'i torri." - -; Password dialog -02000B00="Mewnbynnwch cyfrinair" -02000B01="Mewnbynnwch cyfrinair:" -02000B02="&Dangos cyfrinair" - -; Progress dialog -02000C00="Proses" -02000C01="Wedi treiglo:" -02000C02="Amser a'r ôl:" -02000C03="Maint:" -02000C04="Cyflymder:" - -02000C10="&Cefndir" -02000C11="&Blaendir" -02000C12="&Pwyllo" -02000C13="P&arhau" - -02000C20="Pwyllo" - -02000C30="Ydych chi am canslo?" - -; Compress dialog -02000D00="Ychwanegu i'r archif" -02000D01="&Archif:" -02000D02="Modd &diweddaru:" -02000D03="&Fformat yr archif:" -02000D04="Dull &cywasgu:" -02000D05="Creu archif &Solet" -02000D06="&Paramedrau:" -02000D07="Dewisiadau" -02000D08="Creu archif SF&X" -02000D09="Multi-threading" -02000D0A="Amgryptio &enwau ffeiliau" -02000D0B="&Lefel cywasgu:" -02000D0C="Maint &geiriadur:" -02000D0D="Maint geiria&u:" -02000D0E="Defnydd cof am Cywasgu:" -02000D0F="Defnydd cof am Datgywasgu:" - -02000D40="Hollti i &cyfeintiau, beitiau:" - -02000D81="Storio" -02000D82="Arferol" -02000D83="Uchafswm" -02000D84="Cyflum" -02000D85="Cyflymach" -02000D86="Ultra" - -02000D90="Pori" - -02000DA1="Ychwanegu ac amnewid ffeiliau" -02000DA2="Diweddaru ac ychwanegu ffeiliau" -02000DA3="Adnewyddu y ffeiliau presennol" -02000DA4="Cyfamseru ffeiliau" - -02000DB1="Pob Ffeil" - -02000DC0="Cywasgu" - -; Columns dialog -02000E00="Colofnau" -02000E01="Ticiwch y colofnau byddech yn hoffi gwneud yn gweledig yn y -ffolder hon. Defnyddiwch y botwmau Symud Lan a Symud Lawr i ailtrefnu y -colofnau." -02000E02="Dylid y colofn dethol bod" -02000E03="picseli &llydan." - -02000E10="Symud &Lan" -02000E11="Symud La&wr" -02000E12="&Dangos" -02000E13="&Cuddio" -02000E14="Gosod" - -02000E81="Teitl" -02000E82="Lled" - -; Testing -02000F90="Ymbrofi" - - -; File Manager - -03000000="Rheolwr Ffeil 7-Zip" - -; Menu -03000102="&Ffeil" -03000103="&Golygu" -03000104="Gwe&ld" -03000105="&Offer" -03000106="&Cymorth" -03000107="Ff&efrynnau" - -; File -03000210="&Agor" -03000211="Agor tu &Mewn" -03000212="Agor tu &Fas" -03000220="Gwe&ld" -03000221="&Golygu" -03000230="A&ilenwi" -03000231="&Copïo i..." -03000232="&Symud i..." -03000233="&Dileu" -03000240="&Priodweddau" -03000241="Syl&wad" -03000242="Cyfrifo swm-gwirio" -03000250="Creu Ffolder" -03000251="Creu Ffeil" -03000260="Alla&n" -03000270="&Hollti ffeil..." -03000271="Cy&funo ffeilau..." - -; Edit -03000310="&Dadwneud" -03000311="&Ailwneud" -03000320="&Torri" -03000321="&Copïo" -03000322="&Gludo" -03000323="D&ileu" -03000330="Dewis y C&yfan" -03000331="Dad-ddewis y Cyfan" -03000332="Gwrt&hdroi'r Dewis" -03000333="Dewis..." -03000334="Dad-ddewis..." -03000335="Dewis trwy Math" -03000336="Dad-ddewis trwy Math" - -; View -03000410="Eiconau &Mawr" -03000411="Eiconau &Bach" -03000412="&Rhestr" -03000413="Ma&nylion" -03000420="Dad-dosbarthu" -03000430="Agor Ffolder Gwraidd" -03000431="Lan Un Lefel" -03000432="Hanes Ffolderi..." -03000440="&Adnewyddu" -03000449="Golwg Flat" -03000450="&2 Paneli" -03000451="Bariau &Offer" -03000460="Bar Offer Archif" -03000461="Bar Offer Arferol" -03000462="Botwmau Fawr" -03000463="Dangos Testun Botwmau" - -; Tools -03000510="&Dewisiadau..." -03000511="&Meincnod" - -; Help -03000610="&Cynnwys..." -03000620="&Manylion 7-Zip..." - -; Favorites -03000710="&Ychwanegu ffolder i Ffefrynnau fel" -03000720="Llyfrnod" - -; Options Dialog - -03010000="Dewisiadau" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Dewisiadau..." - -; Edit -03010200="Golygydd" -03010201="&Golygydd:" - -; System -03010300="System" -03010302="Cysylltu 7-Zip gyda:" -03010310="Plugin" - -; Settings -03010400="Gosodiadau" -03010401="Dangos eitem \"..\"" -03010402="Dangos eicon ffeil go iawn" -03010410="Dangos dewislen y system" -03010420="Dethol &holl rhes" -03010421="Dangos llinellau &grid" -03010430="Modd dethol &arallddewisiol" -03010440="Defnyddiwch tudalenau cof &mawr" - -; Strings - -03020201="Copïo" -03020202="Symud" -03020203="Copïo i:" -03020204="Symud i:" -03020205="Copïo..." -03020206="Symud..." -03020207="Rydych ddim yn gallu symud na copïo eitemau am ffolderi o'r -fath." -03020208="Mae'r gweithrediad ddim wedi'i ategu." - -03020210="Cadarnhau Dileu Ffeil" -03020211="Cadarnhau Dileu Ffolder" -03020212="Cadarnhau Dileu Ffeiliau Amryfal" -03020213="Ydych chi'n siŵr eich bod am dileu '{0}'?" -03020214="Ydych chi'n siŵr eich bod am dileu y ffolder '{0}' ac ei holl -cynnwys?" -03020215="Ydych chi'n siŵr eich bod am dileu yr eitemau hyn {0}?" -03020216="Dileu..." -03020217="Gwall Dileu Ffeil neu Ffolder" - -03020220="Ailenwi..." -03020221="Gwall wrth Ailenwi Ffeil neu Ffolder" -03020222="Cadarnhau Copi Ffeil" -03020223="Ydych chi'n siŵr eich bod am copïo'r ffeiliau i'r archif" - -03020230="Creu Ffolder" -03020231="Enw Ffolder:" -03020232="Ffolder Newydd" -03020233="Gwall wrth Creu Ffolder" - -03020240="Creu Ffeil" -03020241="Enw Ffeil:" -03020242="Ffeil Newydd" -03020243="Gwall wrth Creu Ffeil" - -03020250="Dewis" -03020251="Dad-ddewis" -03020252="Mwgwd:" - -03020260="Hanes Ffolderi" - -03020280="Roedd ffeil '{0}' wedi'i addasu.\nWyt ti moen ei diweddaru yn yr -archif?" -03020281="Ddim yn gallu diweddaru ffeil\n'{0}'" -03020282="Ddim yn gallu dechrau golygydd." -03020283="Agor..." - -03020290="Sylwad" -03020291="&Sylwad:" - -030202A0="System" - -03020300="Cyfrifiadur" -03020301="Rhyngrwyd" - -03020400="Ychwanegu" -03020401="Echdynnu" -03020402="Profi" - -03020420="Copïo" -03020421="Symud" -03020422="Dileu" -03020423="Gwybodaeth" - -03020500="Hollti Ffeil" -03020501="&Hollti i:" -03020510="Hollti..." - -03020600="Cyfuno Ffeiliau" -03020601="&Cyfuno i:" -03020610="Cyfuno..." - -03020710="Cyfrifo swm-gwirio..." -03020720="Gwybodaeth swm-gwirio" -03020721="Swm-gwirio CRC am data:" -03020722="Swm-gwirio CRC am data ac enwau:" - -03020800="Sganio..." - -; Computer -03031100="Cyfanswm Maint" -03031101="Lle Rhydd" -03031102="Maint Clwstwr" -03031103="Label" - -; Network -03031200="Enw Lleol" -03031201="Darparwr" - -; Benchmark Dialog - -03080000="Meincnod" -03080001="Defnyddiad cof:" -03080002="Cywasgu" -03080003="Datgywasgu" -03080004="Cyflymdra" -03080005="Amcangyfrif" -03080006="Amcangyfrif llwyr" -03080007="Presennol" -03080008="Canlyniad" -03080009="Pasio:" -0308000A="Gwallau:" - -;!@LangEnd@! - diff --git a/tools/7-Zip/Lang/da.txt b/tools/7-Zip/Lang/da.txt deleted file mode 100644 index 138f7eef92..0000000000 --- a/tools/7-Zip/Lang/da.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Originaly Translated by Jakob Schmidt. -; Updated by Kian Andersen, Jørgen Rasmussen -; -; -; - -00000000="Danish" -00000001="Dansk" -00000002="6" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Indstillinger" - -; Info Page -01000100="Om 7-Zip" -01000103="7-Zip er gratis software, men hvis du kan og vil hjælpe fremtidige udvikling, så vær venlig at registrer." -01000104="Support" -01000105="Registrer" - -; Folders Page -01000200="Mappe" -01000210="&Arbejdsmappe" -01000211="&Systemets temp-mappe" -01000212="&Nuværende" -01000213="&Specificeret:" -01000214="Brug kun til flytbare drev." - -01000281="Angiv adresse til midlertidige filer.." - -; System Page -01000300="System" -01000301="Flet 7-Zip ind i Windows" -01000302="Vis 7-zip ved højreklik" -01000310="Punkter i genvejsmenuen:" - -; Language Page -01000400="Sprog" -01000401="Sprog:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip kommandoer" -02000103="Åbn" -02000104="Åbner det valgte arkiv." -02000105="Udpak filer..." -02000106="Udpak filer fra det valgte arkiv." -02000107="Føj til arkiv..." -02000108="Føj de valgte filer til arkiv." -02000109="Undersøg arkiv" -0200010A="Undersøger integriteten af valgte arkiv." -0200010B="Udpak her" -0200010C="Udpak filer fra det valgte arkiv her." -0200010D="Udpak til {0}" -0200010E="Udpak filer til undermappe." -0200010F="Føj til {0}" -02000110="Føj det valgte til arkiv." -02000111="Pak og e-mail..." -02000112="Pak det valgte til arkiv og send via e-mail." -02000113="Pak til {0} og e-mail" -02000114="Pak det valgte til arkiv og send via e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Sti" -02000204="Navn" -02000205="Filtypenavn" -02000206="Mappe" -02000207="Størrelse" -02000208="Nedpakket størrelse" -02000209="Egenskaber" -0200020A="Oprettet" -0200020B="Åbnet" -0200020C="Ændret" -0200020D="Solid" -0200020E="Kommentar" -0200020F="Krypteret" -02000210="Opdeling før" -02000211="Opdeling efter" -02000212="Leksikon" -02000213="CRC" -02000214="Type" -02000215="Anti" -02000216="Metode" -02000217="Vært OS" -02000218="Filsystem" -02000219="Bruger" -0200021A="Gruppe" -0200021B="Blok" -0200021C="Kommentar" -0200021D="Position" -0200021E="Sti præfiks" -0200021F="Mapper" -02000220="Filer" -02000221="Version" -02000222="Bind" -02000223="Flerbindsarkiv" -02000224="Offset" -02000225="Links" -02000226="Blokke" -02000227="Bind" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Fysisk størrelse" -0200022D="Headerstørrelse" -0200022E="Checksum" -0200022F="Karakteristika" -02000230="Virtuel adresse" -02000231="ID" -02000232="Kort navn" -02000233="Oprettende program" -02000234="Sektorstørrelse" -02000235="Tilstand" -02000236="Link" - -; Status bar -02000301="{0} objekt(er) valgt" -02000302="{0} objekt(er)" - -02000320="Filer:" -02000321="Mapper:" -02000322="Størrelse:" -02000323="Komprimeret størrelse:" -02000324="Arkiver:" - -; List Context Menu -02000401="&Kolonner..." - -02000411="&Åbn" -02000412="&Udpak..." - -; ToolBar -02000501="Udpak" - -; Messages -02000601="Opdater operationer er ikke understøttet for dette arkiv." -02000602="Kan ikke opdatere arkiv {0}" -02000603="Kan ikke oprette mappe '{0}'" -02000604="Filen er ikke et understøttet arkiv." -02000605="Fejl" -02000606="For mange objekter" -02000607="Der er ingen programmer tilknyttet dette filtypenavn" -02000608="Der er ingen fejl" -02000609="Kan ikke åbne filen '{0}' som et arkiv" -0200060A="Kan ikke åbne det krypterede arkiv '{0}'. Forkert adgangskode?" -0200060B="Systemet kan ikke allokere den nødvendige mængde hukommelse" -0200060C="Ukendt fejl" -0200060D="Arkivtypen er ikke understøttet" - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja &til alle" -02000709="&Nej" -0200070B="N&ej til alle" - -02000710="Annuller" -02000711="&Annuller" -02000713="&Luk" -02000714="Stop" -02000715="Genstart" - -02000720="Hjælp" - -; Extract dialog -02000800="Udpak" -02000801="U&dpak til:" -02000802="&Adgangskode" - -02000810="Stitype" -02000811="&Komplette stinavne" -02000812="&Nuværende stinavne" -02000813="&Ingen stinavne" - -02000820="Erstatningsmåde" -02000821="&Spørg før erstatning" -02000822="&Erstat uden advarsel" -02000823="S&pring nuværende filer over" -02000824="A&utomatisk omdøbning" -02000825="&Omdøb automatisk eksisterende filer" - -02000830="Filer" -02000831="&Valgte filer" -02000832="&Alle filer" - -02000881="Vælg en sti for de udpakkede filer." - -02000890="Udpakker" - -; Overwrite dialog -02000900="Bekræft filerstatning" -02000901="Destinationsmappen indeholder allerede behandlede filer." -02000902="Ønsker du at udskifte den eksisterende fil" -02000903="med denne?" - -02000911="A&utomatisk omdøbning af alle" - -02000982="{0} bytes" -02000983="Ændret den" - -; Messages dialog -02000A00="Diagnostiske beskeder" - -02000A80="Besked" - -02000A91="Ikke understøttet pakkemetode for '{0}'." -02000A92="Datafejl i '{0}'. Filen er ødelagt." -02000A93="CRC mislykkedes i '{0}'. Filen er ødelagt." -02000A94="Datafejl i den krypterede fil '{0}'. Forkert adgangskode?" -02000A95="CRC mislykkedes i den krypterede fil '{0}'. Forkert adgangskode?" - -; Password dialog -02000B00="Indtast adgangskode" -02000B01="&Indtast adgangskode:" -02000B02="&Vis adgangskode" -02000B03="Genindtast adgangskode:" -02000B10="Adgangskoderne stemmer ikke overens" -02000B11="Brug kun engelske bogstaver, numre og specialtegn (!, #, $, ...) til adgangskode" -02000B12="Adgangskoden er for lang" - -; Progress dialog -02000C00="Proces" -02000C01="Brugt tid:" -02000C02="Tid tilbage:" -02000C03="Størrelse:" -02000C04="Hastighed:" -02000C05="Behandlet:" -02000C06="Komprimeringsforhold:" - -02000C10="&Baggrund" -02000C11="&Forgrund" -02000C12="&Pause" -02000C13="&Fortsæt" - -02000C20="Pauset" - -02000C30="Er du sikker på du vil annullere?" - -; Compress dialog -02000D00="Føj til arkiv" -02000D01="&Arkiv:" -02000D02="O&pdateringstilstand:" -02000D03="Arkiv&format:" -02000D04="Pakke&metode:" -02000D05="Opret &solid arkiv" -02000D06="Pa&rameter:" -02000D07="Funktioner" -02000D08="Opret selv&udpakkende arkiv (sfx)" -02000D09="Multi-threading" -02000D0A="Kr&ypter filnavne" -02000D0B="Nedpaknings&niveau:" -02000D0C="Ord&bogsstørrelse:" -02000D0D="&Ordstørrelse:" -02000D0E="Hukommelsesbrug for nedpakning:" -02000D0F="Hukommelsesbrug for udpakning:" -02000D10="Kryptering" -02000D11="Krypterin&gsmetode:" -02000D12="Antal &CPU tråde:" -02000D13="&Solid blokstørrelse:" -02000D14="Ikke-solid" -02000D15="Solid" -02000D16="&Komprimer delte filer" - -02000D40="Op&del i bind, bytes:" -02000D41="Ukorrekt bindstørrelse" -02000D42="Specificer bindstørrelse: {0} bytes.\nEr du sikker på du ønsker, at opdele arkivet i sådanne bind?" - -02000D81="Kun gem" -02000D82="Normal" -02000D83="Bedste" -02000D84="Hurtig" -02000D85="Hurtigste" -02000D86="Ultra" - -02000D90="Gennemse" - -02000DA1="Tilføj og erstat filer" -02000DA2="Opdater og tilføj filer" -02000DA3="Opdater eksisterende filer" -02000DA4="Synkroniser filer" - -02000DB1="Alle filer" - -02000DC0="Nedpakker" - -; Columns dialog -02000E00="Kolonner" -02000E01="Tjek kolonnerne som du vil have synlige i denne mappe. Brug pil-op og pil-ned knapperne til at ændre kolonnerne." -02000E02="Den valgte kolonne burde være" -02000E03="pixler &bred." - -02000E10="Flyt &op" -02000E11="Flyt &ned" -02000E12="&Vis" -02000E13="&Skjul" -02000E14="Sæt" - -02000E81="Titel" -02000E82="Bredde" - -; Testing -02000F90="Undersøger" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Fil" -03000103="&Rediger" -03000104="&Vis" -03000105="F&unktioner" -03000106="&Hjælp" -03000107="F&avoriter" - -; File -03000210="&Åbn" -03000211="Å&bn indeni" -03000212="Åbn &udenfor" -03000220="&Vis" -03000221="&Rediger" -03000230="O&mdøb" -03000231="&Kopier til..." -03000232="&Flyt til..." -03000233="S&let" -03000240="&Egenskaber" -03000241="Komme&ntar" -03000242="Udregn &checksum" -03000243="&Sammenlign" -03000250="Opret mappe" -03000251="Opret fil" -03000260="&Afslut" -03000270="&Opdel fil..." -03000271="Kom&biner filer..." - -; Edit -03000310="&Fortryd" -03000311="&Gendan" -03000320="&Klip" -03000321="K&opier" -03000322="Sæt &ind" -03000323="&Slet" -03000330="&Vælg alle" -03000331="&Fravælg alle" -03000332="&Omvendt markering" -03000333="V&ælg..." -03000334="F&ravælg..." -03000335="Vælg &efter type" -03000336="Fravælg efter &type" - -; View -03000410="Sto&re ikoner" -03000411="S&må ikoner" -03000412="&Liste" -03000413="&Detaljer" -03000420="&Usorteret" -03000430="Åbn rodmappe" -03000431="Et niveau op" -03000432="Mappehistorik..." -03000440="&Opdater" -03000449="&Flad visning" -03000450="&2 paneler" -03000451="&Værktøjslinjer" -03000460="Arkivlinje" -03000461="Standardlinje" -03000462="Store knapper" -03000463="Vis knaptekst" - -; Tools -03000510="&Indstillinger..." -03000511="&Benchmark" - -; Help -03000610="&Indhold..." -03000620="&Om 7-Zip..." - -; Favorites -03000710="&Føj mappe til Favoritter som" -03000720="Bogmærke" - -; Options Dialog - -03010000="Indstillinger" - -; Plugins -03010100="Tilføjelser" -03010101="&Tilføjelser:" -03010110="Indstillinger..." - -; Edit -03010200="Editor" -03010201="&Teksteditor:" -03010202="&Sammenligningsværktøj:" - -; System -03010300="System" -03010302="Associer 7-Zip med:" -03010310="Tilføjelse" - -; Settings -03010400="Indstillinger" -03010401="Vis \"..\" element" -03010402="Vis rigtige filikoner" -03010410="Vis systemmenu" -03010420="&Markér hele rækken" -03010421="Vis &gitter" -03010422="Enkeltklik for at åbne et element" -03010430="&Alternativ markeringsmetode" -03010440="Benyt &store hukommelsessider" - -; Strings - -03020201="Kopier" -03020202="Flyt" -03020203="Kopier til:" -03020204="Flyt til:" -03020205="Kopierer..." -03020206="Flytter..." -03020207="Du kan ikke flytte eller kopierer elementer for sådan en mappe." -03020208="Opgaven er ikke understøttet." -03020209="Vælg destinationsmappen." - -03020210="Godkend sletning af fil" -03020211="Godkend sletning af mappe" -03020212="Godkend sletning af flere filer" -03020213="Er du sikker på du vil slette '{0}'?" -03020214="Er du sikker på du vil slette mappen '{0}' og alt indhold?" -03020215="Er du sikker på du vil slette disse {0} elementer?" -03020216="Sletter..." -03020217="Fejl da en fil eller mappe skulle slettes" -03020218="Systemet kan ikke flytte en fil med lang filsti til Papirkurven" - -03020220="Omdøber..." -03020221="Fejl da en fil eller mappe skulle omdøbes" -03020222="Bekræft filkopiering" -03020223="Er du sikker du vil kopiere filer til arkiv?" - -03020230="Opret mappe" -03020231="Mappenavn:" -03020232="Ny mappe" -03020233="Fejl under oprettelse af mappe" - -03020240="Opret fil" -03020241="Filnavn:" -03020242="Ny fil" -03020243="Fejl under oprettelse af fil" - -03020250="Vælg" -03020251="Fravælg" -03020252="Masker:" - -03020260="Mappehistorik" - -03020280="Filen '{0}' er blevet ændret.\nVil du opdatere den i arkivet?" -03020281="Kan ikke opdatere filen\n'{0}'" -03020282="Kan ikke starte tekstbehandler." -03020283="Åbner..." -03020284="Filen ligner en virus (filnavnet indeholder lange mellemrum i navn)." - -03020290="Kommentar" -03020291="&Kommentar:" - -030202A0="System" - -03020300="Computer" -03020301="Netværk" -03020302="Dokumenter" - -03020400="Tilføj" -03020401="Udpak" -03020402="Test" - -03020420="Kopier" -03020421="Flyt" -03020422="Slet" -03020423="Info" - -03020500="Opdel fil" -03020501="&Opdel til:" -03020510="Opdeler..." -03020520="Godkend opdeling" -03020521="Er du sikker på du vil opdele filen i {0} bind?" -03020522="Bindstørrelsen skal være mindre end størrelsen på den oprindelige fil" - -03020600="Kombiner filer" -03020601="&Kombiner til:" -03020610="Kombinerer..." -03020620="Vælg kun første del af opdelt fil" -03020621="Kan ikke genkende fil, som en del af opdelt fil" -03020622="Kan ikke finde mere end én del af opdelt fil" - -03020710="Beregner checksum.." -03020720="Checksum information" -03020721="CRC checksum for data:" -03020722="CRC checksum for data og navne:" - -03020800="Skanner..." - -03020900="Egenskaber" - -03020A01="Handlingen kan ikke kaldes fra en mappe der har en lang sti." -03020A02="Du skal vælge en fil" -03020A03="Du skal vælge en eller flere filer" -03020A04="Filen {0} findes allerede" - -; Computer -03031100="Total størrelse" -03031101="Fri plads" -03031102="Clusterstørrelse" -03031103="Etiket" - -; Network -03031200="Lokalt navn" -03031201="Udbyder" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Hukommelsesbrug:" -03080002="Komprimering" -03080003="Dekomprimering" -03080004="Hastighed" -03080005="Bedømmelse" -03080006="Total bedømmelse" -03080007="Nuværende" -03080008="Resultat" -03080009="Forsøg:" -0308000A="Fejl:" -0308000B="CPU forbrug" -0308000C="Bedømmelse / Forbrug" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/de.txt b/tools/7-Zip/Lang/de.txt deleted file mode 100644 index c6e15cd948..0000000000 --- a/tools/7-Zip/Lang/de.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 2.30 Beta 22 -; Translated by Soeren Finster -; 7-Zip 4.07 beta -; Updated by JAK-Software.DE -; 7-Zip 9.07 beta -; Maintained by Joachim Henke (since 4.12 beta) - -00000000="German" -00000001="Deutsch" -00000002="7" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Einstellungen" - -; Info Page -01000100="Info über 7-Zip" -01000103="7-Zip ist freie Software. Sie können jedoch das Projekt durch eine Registrierung unterstützen." -01000104="techn. Unterstützung" -01000105="Registrieren" - -; Folders Page -01000200="Ordner" -01000210="&Arbeitsverzeichnis" -01000211="&TEMP-Ordner des Systems" -01000212="Aktueller &Ordner" -01000213="&Benutzerdefiniert:" -01000214="Nur bei &Wechselmedien benutzen" - -01000281="Wählen Sie einen Ordner für temporäre Archivdateien:" - -; System Page -01000300="System" -01000301="7-Zip in Kontextmenü integrieren" -01000302="Kontextmenü kaskadieren" -01000310="Einträge im Kontextmenü:" - -; Language Page -01000400="Sprache" -01000401="Sprache:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip Befehle" -02000103="Öffnen" -02000104="Ausgewähltes Archiv öffnen" -02000105="Dateien entpacken..." -02000106="Dateien aus dem gewählten Archiv entpacken" -02000107="Zu einem Archiv hinzufügen..." -02000108="Fügt die markierten Objekte einem Archiv hinzu." -02000109="Archiv überprüfen" -0200010A="Prüft die Integrität des ausgewählten Archivs." -0200010B="Hier entpacken" -0200010C="Entpackt das gewählte Archiv in den aktuellen Ordner." -0200010D="Entpacken nach {0}" -0200010E="Entpackt Dateien in ein Unterverzeichnis." -0200010F="Hinzufügen zu {0}" -02000110="Fügt die markierten Objekte dem Archiv hinzu." -02000111="Archivieren und versenden..." -02000112="Packt die markierten Objekte und verschickt das Archiv per E-Mail." -02000113="Archivieren in {0} und versenden" -02000114="Packt die markierten Objekte und verschickt das Archiv per E-Mail." - -02000140="" -02000141="" - -; Properties -02000203="Pfad" -02000204="Name" -02000205="Erweiterung" -02000206="Ordner" -02000207="Größe" -02000208="Gepackte Größe" -02000209="Attribute" -0200020A="Erstellt am" -0200020B="Letzter Zugriff" -0200020C="Geändert am" -0200020D="Kompakt (solid)" -0200020E="Kommentiert" -0200020F="Verschlüsselt" -02000210="Vorher geteilt" -02000211="Danach geteilt" -02000212="Wörterbuch" -02000213="CRC" -02000214="Typ" -02000215="Anti" -02000216="Verfahren" -02000217="Herkunft" -02000218="Dateisystem" -02000219="Besitzer" -0200021A="Gruppe" -0200021B="Block" -0200021C="Kommentar" -0200021D="Position" -0200021E="Pfad" -0200021F="Ordner" -02000220="Dateien" -02000221="Version" -02000222="Teilarchiv" -02000223="Mehrteiliges Archiv" -02000224="Offset" -02000225="Verknüpfungen" -02000226="Blöcke" -02000227="Teilarchive" - -02000229="64 Bit" -0200022A="Big-Endian" -0200022B="CPU" -0200022C="Gesamtgröße" -0200022D="Header-Größe" -0200022E="Prüfsumme" -0200022F="Kenndaten" -02000230="Virtuelle Adresse" -02000231="ID" -02000232="Kurzname" -02000233="Erstellt durch" -02000234="Sektorgröße" -02000235="Zugriffsrechte" -02000236="Link" - -; Status bar -02000301="{0} Objekt(e) markiert" -02000302="{0} Objekt(e)" - -02000320="Dateien:" -02000321="Ordner:" -02000322="Größe:" -02000323="Komprimierte Größe:" -02000324="Archive:" - -; List Context Menu -02000401="&Spalten..." - -02000411="Ö&ffnen" -02000412="&Entpacken..." - -; ToolBar -02000501="Entpacken" - -; Messages -02000601="Aktualisierungen werden für dieses Archiv nicht unterstützt." -02000602="Kann das Archiv \"{0}\" nicht aktualisieren." -02000603="Kann den Ordner \"{0}\" nicht erstellen." -02000604="Diese Datei ist kein unterstütztes Archiv." -02000605="Fehler" -02000606="Zu viele Objekte" -02000607="Mit dieser Erweiterung ist kein Programm verknüpft." -02000608="Es sind keine Fehler aufgetreten." -02000609="Die Datei \"{0}\" kann nicht als Archiv geöffnet werden." -0200060A="Das verschlüsselte Archiv \"{0}\" kann nicht geöffnet werden. Falsches Passwort?" -0200060B="Das System kann die benötigte Speichermenge nicht bereit stellen." -0200060C="Unbekannter Fehler" -0200060D="Typ des Archives wird nicht unterstützt" - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja für &alle" -02000709="&Nein" -0200070B="Nein für a&lle" - -02000710="Abbrechen" -02000711="&Abbrechen" -02000713="&Schließen" -02000714="Stopp" -02000715="Neustart" - -02000720="Hilfe" - -; Extract dialog -02000800="Entpacken" -02000801="&Entpacken nach:" -02000802="Passwort" - -02000810="Verzeichnisstruktur wiederherstellen" -02000811="Komplette Pfadangaben" -02000812="Relative Pfadangaben" -02000813="Keine Pfadangaben" - -02000820="Dateien überschreiben" -02000821="Nur mit Bestätigung" -02000822="Ohne Bestätigung" -02000823="Vorhandene Dateien überspringen" -02000824="Automatisch umbenennen" -02000825="Vorhandene Dateien umbenennen" - -02000830="Dateien" -02000831="&Markierte Dateien" -02000832="&Alle Dateien" - -02000881="Wählen Sie einen Ordner für die entpackten Dateien:" - -02000890="Entpacken" - -; Overwrite dialog -02000900="Überschreiben bestätigen" -02000901="Der Zielordner beinhaltet bereits eine Datei diesen Namens." -02000902="Wollen Sie diese Datei" -02000903="durch diese ersetzen?" - -02000911="A&utomatisch umbenennen" - -02000982="{0} Bytes" -02000983="geändert am" - -; Messages dialog -02000A00="Diagnosemeldungen" - -02000A80="Meldung" - -02000A91="Das Kompressionsverfahren in \"{0}\" wird nicht unterstützt." -02000A92="Datenfehler in \"{0}\". Die Datei ist beschädigt." -02000A93="CRC-Prüfsummenfehler. Die Datei \"{0}\" ist beschädigt." -02000A94="Datenfehler in der verschlüsselten Datei \"{0}\". Falsches Passwort?" -02000A95="CRC-Prüfsummenfehler bei verschlüsselter Datei \"{0}\". Falsches Passwort?" - -; Password dialog -02000B00="Kennworteingabe" -02000B01="Passwort eingeben:" -02000B02="Passwort an&zeigen" -02000B03="Passwort bestätigen:" -02000B10="Die Passwörter stimmen nicht überein." -02000B11="Bitte nur Buchstaben des englischen Alphabets, Ziffern und Sonderzeichen (!, #, $, ...) im Passwort verwenden!" -02000B12="Das Passwort ist zu lang." - -; Progress dialog -02000C00="Fortschritt" -02000C01="Verstrichene Zeit:" -02000C02="Verbleibende Zeit:" -02000C03="Gesamtdatenmenge:" -02000C04="Geschwindigkeit:" -02000C05="Verarbeitet:" -02000C06="Kompressionsrate:" - -02000C10="&Hintergrund" -02000C11="&Vordergrund" -02000C12="&Pause" -02000C13="&Fortsetzen" - -02000C20="Pause" - -02000C30="Möchten Sie wirklich abbrechen?" - -; Compress dialog -02000D00="Zu Archiv hinzufügen" -02000D01="&Archiv:" -02000D02="Art der Akt&ualisierung:" -02000D03="Archiv&format:" -02000D04="Kompressions&verfahren:" -02000D05="Kompaktes Archiv erstellen (solid)" -02000D06="&Parameter:" -02000D07="Optionen" -02000D08="Selbstentpackendes Archiv (SF&X) erstellen" -02000D09="Multithreading" -02000D0A="Datei&namen verschlüsseln" -02000D0B="&Kompressionsstärke:" -02000D0C="Wörter&buchgröße:" -02000D0D="&Wortgröße:" -02000D0E="Speicherbedarf beim Komprimieren:" -02000D0F="Speicherbedarf beim Entpacken:" -02000D10="Verschlüsselung" -02000D11="Verfahren:" -02000D12="Anzahl &CPU-Threads:" -02000D13="Größe &solider Blöcke:" -02000D14="Nicht solide" -02000D15="Solide" -02000D16="Zum Schreiben &geöffnete Dateien einbeziehen" - -02000D40="In &Teildateien aufsplitten (Bytes):" -02000D41="Ungültiger Wert für Dateigrößen" -02000D42="Angegebene Größe für Teildateien: {0} Bytes.\nSind Sie sicher, dass das Archiv dementsprechend aufgesplittet werden soll?" - -02000D81="Speichern" -02000D82="Normal" -02000D83="Maximum" -02000D84="Schnell" -02000D85="Schnellste" -02000D86="Ultra" - -02000D90="Durchsuchen" - -02000DA1="Hinzufügen und Ersetzen" -02000DA2="Aktualisieren und Hinzufügen" -02000DA3="Vorhandene Dateien aktualisieren" -02000DA4="Synchronisieren" - -02000DB1="Alle Dateien" - -02000DC0="Komprimiere" - -; Columns dialog -02000E00="Spalten" -02000E01="Markieren Sie die Spalten, die Sie in dieser Ansicht sehen wollen. Benutzen Sie die Aufwärts- und Abwärts-Schaltflächen, um die Spalten wie gewünscht anzuordnen." -02000E02="Die markierte Spalte soll" -02000E03="Pixel &breit sein." - -02000E10="&Aufwärts" -02000E11="Ab&wärts" -02000E12="&Zeigen" -02000E13="&Verstecken" -02000E14="Speichern" - -02000E81="Titel" -02000E82="Breite" - -; Testing -02000F90="Überprüfen" - - -; File Manager - -03000000="7-Zip Dateimanager" - -; Menu -03000102="&Datei" -03000103="&Bearbeiten" -03000104="&Ansicht" -03000105="&Extras" -03000106="&?" -03000107="&Favoriten" - -; File -03000210="Ö&ffnen" -03000211="I&ntern öffnen" -03000212="E&xtern öffnen" -03000220="&Ansehen" -03000221="&Bearbeiten" -03000230="&Umbenennen" -03000231="&Kopieren nach..." -03000232="&Verschieben nach..." -03000233="&Löschen" -03000240="E&igenschaften" -03000241="K&ommentieren" -03000242="&Prüfsumme berechnen" -03000243="Ver&gleichen" -03000250="Ordner erstellen" -03000251="Datei erstellen" -03000260="Be&enden" -03000270="Datei auf&splitten..." -03000271="Dateien &zusammenfügen..." - -; Edit -03000310="&Rückgängig" -03000311="&Wiederherstellen" -03000320="&Ausschneiden" -03000321="&Kopieren" -03000322="&Einfügen" -03000323="&Löschen" -03000330="Alles &markieren" -03000331="Alles abwählen" -03000332="Markierung &umkehren" -03000333="Auswählen..." -03000334="Auswahl aufheben..." -03000335="Nach Typ auswählen" -03000336="Nach Typ abwählen" - -; View -03000410="&Große Symbole" -03000411="&Kleine Symbole" -03000412="&Liste" -03000413="&Details" -03000420="Unsortiert" -03000430="Wurzelverzeichnis" -03000431="Übergeordneter Ordner" -03000432="Ordnerverlauf..." -03000440="&Aktualisieren" -03000449="Alles in einer &Ebene" -03000450="&Zweigeteiltes Fenster" -03000451="&Symbolleisten" -03000460="Archivfunktionen" -03000461="Standardfunktionen" -03000462="Große Schaltflächen" -03000463="Schaltflächenbeschriftung" - -; Tools -03000510="&Optionen..." -03000511="&Benchmark" - -; Help -03000610="&Hilfethemen" -03000620="Ü&ber 7-Zip..." - -; Favorites -03000710="&Ordner hinzufügen als" -03000720="Favorit" - -; Options Dialog - -03010000="Optionen" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Optionen..." - -; Edit -03010200="Editor" -03010201="&Editor:" -03010202="Programm zum &Vergleichen:" - -; System -03010300="System" -03010302="7-Zip verknüpfen mit:" -03010310="Plugin" - -; Settings -03010400="Einstellungen" -03010401="&Verzeichniseintrag \"..\" anzeigen" -03010402="Symbole aus &Dateien laden und anzeigen" -03010410="System-Kontext&menü im Dateimenü anzeigen" -03010420="Dateiauswahl markiert ganze &Zeile" -03010421="&Gitternetzlinien anzeigen" -03010422="Einfacher &Klick zum Öffnen" -03010430="&Alternativer Dateiauswahl-Modus" -03010440="Große &Speicherseiten verwenden" - -; Strings - -03020201="Kopieren" -03020202="Verschieben" -03020203="Kopieren nach:" -03020204="Verschieben nach:" -03020205="Kopiere..." -03020206="Verschiebe..." -03020207="Verschieben und Kopieren ist für diesen Ordner nicht möglich." -03020208="Die Operation wird für diesen Ordner nicht unterstützt." -03020209="Zielordner auswählen" - -03020210="Löschen von Datei bestätigen" -03020211="Löschen von Ordner bestätigen" -03020212="Löschen von mehreren Dateien bestätigen" -03020213="Soll \"{0}\" wirklich gelöscht werden?" -03020214="Soll der Ordner \"{0}\" und sein gesamter Inhalt wirklich gelöscht werden?" -03020215="Sollen diese {0} Objekte wirklich gelöscht werden?" -03020216="Lösche..." -03020217="Fehler beim Löschen von Datei oder Ordner" -03020218="Das System kann Dateien mit langem Pfad nicht in den Papierkorb verschieben." - -03020220="Umbenennen..." -03020221="Fehler beim Umbenennen von Datei oder Ordner" -03020222="Kopieren bestätigen" -03020223="Sollen die Dateien wirklich in dieses Archiv kopiert werden:" - -03020230="Ordner erstellen" -03020231="Ordnername:" -03020232="Neuer Ordner" -03020233="Fehler beim Erstellen des Ordners" - -03020240="Datei erstellen" -03020241="Dateiname:" -03020242="Neue Datei" -03020243="Fehler beim Erstellen der Datei" - -03020250="Auswählen" -03020251="Auswahl aufheben" -03020252="Filter:" - -03020260="Ordnerverlauf" - -03020280="Die Datei \"{0}\" wurde geändert.\nSoll sie im Archiv aktualisiert werden?" -03020281="Die Datei konnte nicht aktualisiert werden.\n\"{0}\"" -03020282="Kann Editor nicht starten" -03020283="Öffne..." -03020284="Die Datei scheint ein Virus zu sein (Dateiname enthält lange Reihen von Leerzeichen)." - -03020290="Kommentar" -03020291="&Kommentar:" - -030202A0="System" - -03020300="Arbeitsplatz" -03020301="Netzwerk" -03020302="Dokumente" - -03020400="Hinzufügen" -03020401="Entpacken" -03020402="Überprüfen" - -03020420="Kopieren" -03020421="Verschieben" -03020422="Löschen" -03020423="Eigenschaften" - -03020500="Datei aufsplitten" -03020501="Teildateien &nach:" -03020510="Aufsplitten..." -03020520="Aufsplitten bestätigen" -03020521="Sind Sie sicher, die Datei in {0} Teildateien aufsplitten zu wollen?" -03020522="Die Größe der Teildateien muss kleiner sein als die der ursprünglichen Datei." - -03020600="Dateien zusammenfügen" -03020601="Zieldatei &nach:" -03020610="Zusammenfügen..." -03020620="Bitte nur den ersten Teil der Datei auswählen." -03020621="Datei nicht als Teil einer aufgesplitteten Datei erkannt" -03020622="Kann nicht mehr als eine Teildatei finden." - -03020710="Berechne Prüfsumme..." -03020720="Prüfsummen-Information" -03020721="CRC-Prüfsumme über die Daten:" -03020722="Prüfsumme über Daten und Namen:" - -03020800="Durchsuche..." - -03020900="Eigenschaften" - -03020A01="Die Operation kann nicht aus einem Ordner mit langem Pfad aufgerufen werden." -03020A02="Bitte genau eine Datei auswählen." -03020A03="Bitte mindestens eine Datei auswählen." -03020A04="Die Datei {0} existiert bereits." - -; Computer -03031100="Gesamtgröße" -03031101="Freier Speicherplatz" -03031102="Cluster-Größe" -03031103="Name" - -; Network -03031200="Lokaler Name" -03031201="Provider" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Speichernutzung:" -03080002="Komprimierung" -03080003="Dekomprimierung" -03080004="Geschwindigkeit" -03080005="Bewertung" -03080006="Gesamtwertung" -03080007="Aktuell" -03080008="Ergebnis" -03080009="Durchläufe:" -0308000A="Fehler:" -0308000B="CPU-Nutzung" -0308000C="Bewert./Nutzung" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/el.txt b/tools/7-Zip/Lang/el.txt deleted file mode 100644 index fcefc8ded1..0000000000 --- a/tools/7-Zip/Lang/el.txt +++ /dev/null @@ -1,492 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by SkyHi [HDManiacs Team] -; - -00000000="Greek" -00000001="Ελληνική" -00000002="8" - -; 7-Zip Configuration - -; Title -01000000="Ρυθμίσεις 7-Zip" - -; Info Page -01000100="Πληροφορίες για το 7-Zip" -01000103="Το 7-Zip είναι ελεύθερο λογισμικό. Ωστόσο μπορείτε να υποστηρίξετε την περαιτέρω ανάπτυξη του με την εγγραφή σας." -01000104="Υποστήριξη" -01000105="Εγγραφή" - -; Folders Page -01000200="Φάκελοι" -01000210="&Φάκελος εργασίας" -01000211="&Προσωρινός φάκελος συστήματος" -01000212="&Τρέχων φάκελος" -01000213="&Καθορισμένος:" -01000214="Χρήση μόνο για αφαιρούμενες μονάδες δίσκου" -01000281="Καθορίστε μια τοποθεσία για τα προσωρινά αρχεία συμπίεσης." - -; System Page -01000300="Σύστημα" -01000301="Ενσωμάτωση του 7-Zip στο λειτουργικό" -01000302="Με ομαδοποίηση των επιλογών" -01000310="Στοιχεία του πίνακα επιλογών:" - -; Language Page -01000400="Γλώσσα" -01000401="Γλώσσα:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Εντολές 7-Zip" -02000103="Άνοιγμα" -02000104="Άνοιγμα επιλεγμένου αρχείου συμπίεσης." -02000105="Αποσυμπίεση αρχείων..." -02000106="Αποσυμπίεση επιλεγμένου αρχείου συμπίεσης" -02000107="Προσθήκη σε αρχείο συμπίεσης..." -02000108="Προσθήκη επιλεγμένων στοιχείων σε αρχείο συμπίεσης" -02000109="Έλεγχος αρχείου συμπίεσης" -0200010A="Έλεγχος εγκυρότητας επιλεγμένου αρχείου συμπίεσης" -0200010B="Αποσυμπίεση εδώ" -0200010C="Αποσυμπίεση αρχείων στον τρέχοντα φάκελο" -0200010D="Αποσυμπίεση στο φάκελο {0}" -0200010E="Αποσυμπίεση αρχείων σε υποφάκελο." -0200010F="Προσθήκη στο {0}" -02000110="Προσθήκη επιλεγμένων στοιχείων σε αρχείο συμπίεσης." -02000111="Συμπίεση και αποστολή με e-mail..." -02000112="Συμπίεση επιλεγμένων στοιχείων και αποστολή με e-mail." -02000113="Συμπίεση στο {0} και αποστολή με e-mail" -02000114="Συμπίεση επιλεγμένων στοιχείων και αποστολή με e-mail." -02000140="<Φάκελος>" -02000141="<Αρχείο Συμπίεσης>" - -; Properties -02000203="Θέση" -02000204="Όνομα" -02000205="Τύπος" -02000206="Φάκελος" -02000207="Μέγεθος" -02000208="Συμπιεσμένο μέγεθος" -02000209="Ιδιότητες" -0200020A="Δημιουργήθηκε" -0200020B="Προσπελάστηκε" -0200020C="Τροποποιήθηκε" -0200020D="Συμπαγές" -0200020E="Σχόλιο" -0200020F="Κωδικοποιημένο" -02000210="Τεμαχισμός πριν" -02000211="Τεμαχισμός μετά" -02000212="Λεξικό" -02000213="CRC" -02000214="Τύπος" -02000215="Αντί" -02000216="Μέθοδος" -02000217="Λειτουργικό" -02000218="Σύστημα αρχείων" -02000219="Χρήστης" -0200021A="Ομάδα" -0200021B="Μπλοκ" -0200021C="Σχόλιο" -0200021D="Θέση" -0200021E="Προκαθορισμένη διαδρομή" -0200021F="Φάκελοι" -02000220="Αρχεία" -02000221="Έκδοση" -02000222="Τόμος" -02000223="Πολυτόμος" -02000224="Offset" -02000225="Σύνδεσμοι" -02000226="Μπλοκ" -02000227="Τόμοι" -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Φυσικό μέγεθος" -0200022D="Μέγεθος headers" -0200022E="Άθροισμα ελέγχου" -0200022F="Χαρακτηριστικά" -02000230="Εικονική διεύθυνση" -02000231="ID" -02000232="Σύντομο όνομα" -02000233="Εφαρμογή δημιουργίας" -02000234="Μέγεθος τομέα" -02000235="Κατάσταση λειτουργίας" -02000236="Σύνδεσμος" - -; Status bar -02000301="{0} επιλεγμένα στοιχεία" -02000302="{0} στοιχεία" -02000320="Αρχεία:" -02000321="Φάκελοι:" -02000322="Μέγεθος:" -02000323="Συμπιεσμένο μέγεθος:" -02000324="Αρχεία συμπίεσης:" - -; List Context Menu -02000401="&Στήλες..." -02000411="Άν&οιγμα" -02000412="&Αποσυμπίεση..." - -; ToolBar -02000501="Αποσυμπίεση" - -; Messages -02000601="Οι λειτουργίες ενημέρωσης δεν είναι διαθέσιμες για αυτόν τον τύπο συμπιεσμένου αρχείου." -02000602="Αδυνατή η ενημέρωση του αρχείου συμπίεσης {0}" -02000603="Αδύνατη η δημιουργία του φακέλου '{0}'" -02000604="Η μέθοδος συμπίεσης του αρχείου δεν υποστηρίζεται." -02000605="Σφάλμα" -02000606="Πάρα πολλά στοιχεία" -02000607="Δεν υπάρχει εφαρμογή που να σχετίζεται με τον τύπο του αρχείου." -02000608="Δεν υπάρχουν σφάλματα" -02000609="Δεν μπορεί να ανοιχθεί το αρχείο '{0}' σαν αρχείο συμπίεσης" -0200060A="Δεν μπορεί να ανοιχθεί το κρυπτογραφημένο αρχείο '{0}'. Λάθος κωδικός;" -0200060B="Το σύστημα δεν μπορεί να διαθέσει την απαιτούμενη ποσότητα μνήμης." -0200060C="Άγνωστο σφάλμα" -0200060D="Μη υποστηριζόμενο αρχείο συμπίεσης." - -; Dialogs -02000702="OK" -02000705="&Ναι" -02000707="Ναι σε &όλα" -02000709="Ό&χι" -0200070B="Όχι σε ό&λα" -02000710="Άκυρο" -02000711="&Άκυρο" -02000713="&Κλείσιμο" -02000714="&Διακοπή" -02000715="Επανεκκίνηση" -02000720="Βοήθεια" - -; Extract dialog -02000800="Αποσυμπίεση" -02000801="&Αποσυμπίεση στο φάκελο:" -02000802="Κωδικός πρόσβασης" -02000810="Επιλογές διαδρομών φακέλων " -02000811="Πλήρεις διαδρομές φακέλων" -02000812="Τρέχουσες διαδρομές φακέλων " -02000813="Χωρίς διαδρομές φακέλων" -02000820="Επιλογές αντικατάστασης αρχείων" -02000821="Αντικατάσταση με ερώτηση" -02000822="Αντικατάσταση χωρίς ερώτηση" -02000823="Παράβλεψη των υπαρχόντων αρχείων" -02000824="Αυτόματη μετονομασία" -02000825="Αυτόματη μετονομασία των υπαρχόντων αρχείων" -02000830="Αρχεία" -02000831="&Επιλεγμένα αρχεία" -02000832="&Όλα τα αρχεία" -02000881="Καθορίστε τον φάκελο αποσυμπίεσης." -02000890="Αποσυμπίεση" - -; Overwrite dialog -02000900="Επιβεβαίωση αντικατάστασης του αρχείου" -02000901="Ο φάκελος προορισμού περιέχει ήδη ένα αρχείο με το ίδιο όνομα." -02000902="Θέλετε να αντικαταστήσετε το υπάρχον αρχείο" -02000903="με αυτό;" -02000911="Αυτόματη &μετονομασία" -02000982="{0} bytes" -02000983="τροποποιήθηκε" - -; Messages dialog -02000A00="Διαγνωστικά μηνύματα" -02000A80="Μήνυμα" -02000A91="Μη υποστηριζόμενη μέθοδος συμπίεσης για το '{0}'." -02000A92="Λάθος δεδομένων στο {0}. Το αρχείο είναι φθαρμένο." -02000A93="Ο έλεγχος CRC απέτυχε στο '{0}'. Το αρχείο είναι φθαρμένο." -02000A94="Λάθος δεδομένων στο κρυπτογραφημένο αρχείο '{0}'. Λάθος κωδικός;" -02000A95="Ο έλεγχος CRC απέτυχε στο κρυπτογραφημένο αρχείο '{0}'. Λάθος κωδικός;" - -; Password dialog -02000B00="Εισαγωγή κωδικού πρόσβασης" -02000B01="Κωδικός πρόσβασης:" -02000B02="&Εμφάνιση κωδικού" -02000B03="Επανεισάγετε τον κωδικό πρόσβασης:" -02000B10="Οι κωδικοί δεν ταιριάζουν." -02000B11="Χρησιμοποιήστε μόνο Αγγλικά γράμματα, αριθμούς και ειδικούς χαρακτήρες (!, #, ...) για κωδικό." -02000B12="Ο κωδικός είναι πολύ μεγάλος." - -; Progress dialog -02000C00="Διεργασία" -02000C01="Διανύθηκε:" -02000C02="Απομένει:" -02000C03="Μέγεθος:" -02000C04="Ταχύτητα:" -02000C05="Επεξεργάσθηκαν:" -02000C06="Αναλογία συμπίεσης" -02000C10="Στο &παρασκήνιο" -02000C11="Στο &προσκήνιο" -02000C12="&Διακοπή" -02000C13="&Συνέχεια" -02000C20="Διακόπηκε" -02000C30="Είστε σίγουροι ότι θέλετε να ακυρώσετε;" - -; Compress dialog -02000D00="Προσθήκη σε συμπιεσμένο αρχείο" -02000D01="&Όνομα αρχείου συμπίεσης:" -02000D02="&Τρόπος ενημέρωσης:" -02000D03="Συμπίεση στη μορ&φή:" -02000D04="&Μέθοδος συμπίεσης:" -02000D05="Δημιουργία &συμπαγούς αρχείου" -02000D06="&Παράμετροι:" -02000D07="Επιλογές συμπίεσης" -02000D08="Με αυτόματη αποσυμπίεση (SF&X)" -02000D09="Πολύ-νηματική επεξεργασία" -02000D0A="Κρυπτογράφηση των &ονομάτων" -02000D0B="Επίπεδο συμπίεσης:" -02000D0C="Μέγεθος &λεξικού:" -02000D0D="Μέγεθος &λέξης:" -02000D0E="Χρήση μνήμης για συμπίεση:" -02000D0F="Χρήση μνήμης για αποσυμπίεση:" -02000D10="Κρυπτογράφηση" -02000D11="Μέθοδος κρυπτογράφησης" -02000D12="Αριθμός νημάτων CPU" -02000D13="Μέγεθος συμπαγούς μπλοκ:" -02000D14="Μη-συμπαγές" -02000D15="Συμπαγές" -02000D16="Συμπίεση κοινών αρχείων" -02000D40="Τεμαχισμός σε τόμους:" -02000D41="Λάθος μέγεθος τόμου" -02000D42="Καθορισμένο μέγεθος τόμου: {0} bytes.\nΕίστε σίγουρος ότι θέλετε να χωρίσετε το αρχείο σε τέτοιους τόμους;" -02000D81="Αποθήκευση" -02000D82="Κανονική" -02000D83="Μέγιστη" -02000D84="Γρήγορη" -02000D85="Πολύ γρήγορη" -02000D86="Υπερσυμπίεση" -02000D90="Αναζήτηση" -02000DA1="Προσθήκη και αντικατάσταση αρχείων" -02000DA2="Προσθήκη και ενημέρωση αρχείων" -02000DA3="Ενημέρωση των υπαρχόντων αρχείων" -02000DA4="Συγχρονισμός αρχείων" -02000DB1="Όλα τα αρχεία" -02000DC0="Συμπίεση" - -; Columns dialog -02000E00="Στήλες" -02000E01="Επιλέξτε τις στήλες που θέλετε να φαίνονται σε αυτό το φάκελο. Χρησιμοποιήστε τα πλήκτρα 'πάνω' και 'κάτω' για να επαναδιατάξετε τις στήλες." -02000E02="Η επιλεγμένη στήλη πρέπει να έχει" -02000E03="pixels &πλάτος." -02000E10="Μετακίνηση &πάνω" -02000E11="Μετακίνηση &κάτω" -02000E12="&Εμφάνιση" -02000E13="&Απόκρυψη" -02000E14="Ενεργοποίηση" -02000E81="Τίτλος" -02000E82="Πλάτος" - -; Testing -02000F90="Έλεγχος" - - -; File Manager -03000000="Διαχειριστής αρχείων 7-Zip" - -; Menu -03000102="&Αρχείο" -03000103="&Επεξεργασία" -03000104="Π&ροβολή" -03000105="Εργα&λεία" -03000106="&Βοήθεια" -03000107="Αγα&πημένα" - -; File -03000210="Άν&οιγμα" -03000211="Άνοιγμα στο &ίδιο παράθυρο" -03000212="Άνοιγμα σε &νέο παράθυρο" -03000220="Π&ροβολή" -03000221="Επε&ξεργασία" -03000230="Με&τονομασία" -03000231="Αντι&γραφή..." -03000232="Μετα&κίνηση..." -03000233="Διαγρα&φή" -03000240="&Ιδιότητες" -03000241="Σχόλιο" -03000242="Υπολογισμός αθροίσματος ελέγχου" -03000243="Diff" -03000250="Δημιουργία φακέλου" -03000251="Δημιουργία αρχείου" -03000260="Έ&ξοδος" -03000270="&Τεμαχισμός αρχείου..." -03000271="&Συνένωση αρχείων..." - -; Edit -03000310="Αναίρεσ&η" -03000311="Επανάλη&ψη" -03000320="Απο&κοπή" -03000321="Αντι&γραφή" -03000322="&Επικόλληση" -03000323="Διαγρα&φή" -03000330="Ε&πιλογή όλων" -03000331="Αποεπιλογή όλων" -03000332="Αντιστροφή επιλογής" -03000333="Επιλογή..." -03000334="Αποεπιλογή..." -03000335="Επιλογή σύμφωνα με τον τύπο αρχείου" -03000336="Αποεπιλογή σύμφωνα με τον τύπο αρχείου" - -; View -03000410="Μεγάλα εικονί&δια" -03000411="&Μικρά εικονίδια" -03000412="&Λίστα" -03000413="Λε&πτομέρειες " -03000420="Χωρίς ταξινόμηση" -03000430="Άνοιγμα κεντρικού φακέλου" -03000431="Μετάβαση ένα επίπεδο πάνω" -03000432="&Ιστορικό φακέλων..." -03000440="Α&νανέωση" -03000449="Επίπεδη προβολή" -03000450="Σε &2 τμήματα" -03000451="&Γραμμές εργαλείων" -03000460="Συμπίεσης" -03000461="Βασική" -03000462="Μεγάλα εικονίδια" -03000463="Προβολή κειμένου" - -; Tools -03000510="&Ρυθμίσεις..." -03000511="&Benchmark" - -; Help -03000610="&Περιεχόμενα..." -03000620="Π&ερί του 7-Zip..." - -; Favorites -03000710="&Προσθήκη στα Αγαπημένα ως" -03000720="Σελιδοδείκτης" - -; Options Dialog -03010000="Ρυθμίσεις" - -; Plugins -03010100="Πρόσθετα" -03010101="&Πρόσθετα:" -03010110="Ρυθμίσεις..." - -; Edit -03010200="Πρόγραμμα επεξεργασίας" -03010201="&Πρόγραμμα επεξεργασίας:" -03010202="&Diff:" - -; System -03010300="Σύστημα" -03010302="Συσχέτιση του 7-Zip με τα αρχεία:" -03010310="Πρόσθετο" - -; Settings -03010400="Επιλογές" -03010401="Εμφάνιση αντικειμένου \"..\"" -03010402="Εμφάνιση των κανονικών εικονιδίων των αρχείων" -03010410="Εμφάνιση μενού συστήματος" -03010420="&Επιλογή ολόκληρης διαδρομής" -03010421="Εμφάνιση γραμμών πλέγματος" -03010422="Άνοιγμα αντικειμένου με μονό κλικ" -03010430="Εναλλακτική κατάσταση επιλογής" -03010440="Χρήση μεγάλων &σελίδων μνήμης" - -; Strings -03020201="Αντιγραφή" -03020202="Μετακίνηση" -03020203="Αντιγραφή στο:" -03020204="Μετακίνηση στο:" -03020205="Αντιγραφή..." -03020206="Μετακίνηση..." -03020207="Δεν μπορείτε να μετακινήσετε ή να αντιγράψετε σε τέτοιους φακέλους." -03020208="Η λειτουργία δεν υποστηρίζεται." -03020209="Επιλέξτε φάκελο προορισμού." -03020210="Επιβεβαίωση διαγραφής του αρχείου" -03020211="Επιβεβαίωση διαγραφής του φακέλου" -03020212="Επιβεβαίωση διαγραφής πολλών αρχείων" -03020213="Είστε βέβαιοι ότι θέλετε να διαγράψετε το '{0}' ;" -03020214="Είστε βέβαιοι ότι θέλετε να διαγράψετε το φάκελο '{0}' και όλα τα περιεχόμενα του;" -03020215="Είστε βέβαιοι ότι θέλετε να διαγράψετε αυτά τα {0} στοιχεία;" -03020216="Διαγραφή..." -03020217="Παρουσιάστηκε σφάλμα κατά τη διαγραφή." -03020218="Το σύστημα δεν μπορεί να μετακινήσει ένα αρχείο με μεγάλη διαδρομή στον Κάδο Ανακύκλωσης." -03020220="Μετονομασία..." -03020221="Παρουσιάστηκε σφάλμα κατά τη μετονομασία." -03020222="Επιβεβαίωση αντιγραφής αρχείων" -03020223="Είστε βέβαιος ότι θέλετε να αντιγράψετε τα αρχεία στο αρχείο συμπίεσης;" -03020230="Δημιουργία φακέλου" -03020231="Όνομα φακέλου:" -03020232="Νέος φάκελος" -03020233="Σφάλμα κατά την δημιουργία φακέλου." -03020240="Δημιουργία αρχείου" -03020241="Όνομα αρχείου:" -03020242="Νέο αρχείο" -03020243="Σφάλμα κατά την δημιουργία αρχείου." -03020250="Επιλογή" -03020251="Αποεπιλογή" -03020252="Με όνομα:" -03020260="Ιστορικό φακέλων" -03020280="Το αρχείο '{0}' τροποποιήθηκε.\nΘέλετε να ενημερώσετε το αρχείο συμπίεσης;" -03020281="Αδυνατή η ενημέρωση του αρχείου\n'{0}'" -03020282="Δεν είναι δυνατή η εκκίνηση του προγράμματος επεξεργασίας." -03020283="Άνοιγμα..." -03020284="Το αρχείο μοιάζει με ιό (το όνομα του περιέχει μεγάλα κενά)." -03020290="Σχόλιο" -03020291="&Σχόλιο:" -030202A0="Σύστημα" -03020300="Υπολογιστής" -03020301="Δικτύο" -03020302="Έγγραφα" -03020400="Προσθήκη" -03020401="Αποσυμπίεση" -03020402="Έλεγχος" -03020420="Αντιγραφή" -03020421="Μετακίνηση" -03020422="Διαγραφή" -03020423="Πληροφορίες" -03020500="Τεμαχισμός αρχείου" -03020501="&Τεμαχισμός σε:" -03020510="Τεμαχισμός..." -03020520="Επιβεβαίωση τεμαχισμού" -03020521="Είστε βέβαιος ότι θέλετε να τεμαχίσετε το αρχείο σε {0} τόμους;" -03020522="Το μέγεθος του τόμου πρέπει να είναι μικρότερο από αυτό του αρχικού αρχείου." -03020600="Συνένωση αρχείων" -03020601="&Συνένωση σε:" -03020610="Συνένωση..." -03020620="Επιλέξτε μόνο το πρώτο αρχείο" -03020621="Το αρχείο δεν μπορεί να ανιχνευθεί ως μέρος τεμαχισμένου αρχείου." -03020622="Δεν μπορούν να βρεθούν πάνω από ένα μέρη τεμαχισμένου αρχείου." -03020710="Υπολογισμός αθροίσματος ελέγχου..." -03020720="Πληροφορίες αθροίσματος ελέγχου" -03020721="Άθροισμα ελέγχου CRC για δεδομένα:" -03020722="Άθροισμα ελέγχου CRC για δεδομένα και ονόματα:" -03020800="Σάρωση..." -03020900="Ιδιότητες" -03020A01="Η λειτουργία δεν μπορεί να κληθεί από ένα φάκελο που έχει μεγάλη διαδρομή." -03020A02="Πρέπει να επιλέξετε ένα αρχείο." -03020A03="Πρέπει να επιλέξετε ένα ή περισσότερα αρχεία." -03020A04="Το αρχείο {0} ήδη υπάρχει." - - -; Computer -03031100="Συνολικό μέγεθος" -03031101="Ελεύθερος χώρος" -03031102="Μέγεθος συμπλέγματος" -03031103="Ετικέτα" - -; Network -03031200="Τοπικό όνομα" -03031201="Παροχέας" - -; Benchmark Dialog -03080000="Benchmark" -03080001="Χρήση μνήμης:" -03080002="Συμπίεση" -03080003="Αποσυμπίεση" -03080004="Ταχύτητα" -03080005="Εκτίμηση" -03080006="Συνολ. εκτίμηση" -03080007="Τρέχων πέρασμα" -03080008="Αποτέλεσμα" -03080009="Περάσματα:" -0308000A="Σφάλματα:" -0308000B="Χρήση CPU" -0308000C="Ταξ/μιση/Χρήση" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/en.ttt b/tools/7-Zip/Lang/en.ttt deleted file mode 100644 index c79afde2cd..0000000000 --- a/tools/7-Zip/Lang/en.ttt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by Igor Pavlov -; -; -; -; - -00000000="English" -00000001="English" -00000002="9" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Configuration" - -; Info Page -01000100="About 7-Zip" -01000103="7-Zip is free software. However, you can support development of 7-Zip by registering." -01000104="Support" -01000105="Register" - -; Folders Page -01000200="Folders" -01000210="&Working folder" -01000211="&System temp folder" -01000212="&Current" -01000213="&Specified:" -01000214="Use for removable drives only" - -01000281="Specify a location for temporary archive files." - -; System Page -01000300="System" -01000301="Integrate 7-Zip to shell context menu" -01000302="Cascaded context menu" -01000310="Context menu items:" - -; Language Page -01000400="Language" -01000401="Language:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip commands" -02000103="Open archive" -02000104="Opens the selected archive." -02000105="Extract files..." -02000106="Extracts files from the selected archive." -02000107="Add to archive..." -02000108="Adds the selected items to archive." -02000109="Test archive" -0200010A="Tests integrity of the selected archive." -0200010B="Extract Here" -0200010C="Extracts files from the selected archive to current folder." -0200010D="Extract to {0}" -0200010E="Extracts files to subfolder." -0200010F="Add to {0}" -02000110="Adds the selected items to archive." -02000111="Compress and email..." -02000112="Compresses the selected items to archive and sends archive via email." -02000113="Compress to {0} and email" -02000114="Compresses the selected items to archive and sends archive via email." - -02000140="" -02000141="" - -; Properties -02000203="Path" -02000204="Name" -02000205="Extension" -02000206="Folder" -02000207="Size" -02000208="Packed Size" -02000209="Attributes" -0200020A="Created" -0200020B="Accessed" -0200020C="Modified" -0200020D="Solid" -0200020E="Commented" -0200020F="Encrypted" -02000210="Split Before" -02000211="Split After" -02000212="Dictionary" -02000213="CRC" -02000214="Type" -02000215="Anti" -02000216="Method" -02000217="Host OS" -02000218="File System" -02000219="User" -0200021A="Group" -0200021B="Block" -0200021C="Comment" -0200021D="Position" -0200021E="Path Prefix" -0200021F="Folders" -02000220="Files" -02000221="Version" -02000222="Volume" -02000223="Multivolume" -02000224="Offset" -02000225="Links" -02000226="Blocks" -02000227="Volumes" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Physical Size" -0200022D="Headers Size" -0200022E="Checksum" -0200022F="Characteristics" -02000230="Virtual Address" -02000231="ID" -02000232="Short Name" -02000233="Creator Application" -02000234="Sector Size" -02000235="Mode" -02000236="Link" - -; Status bar -02000301="{0} object(s) selected" -02000302="{0} object(s)" - -02000320="Files:" -02000321="Folders:" -02000322="Size:" -02000323="Compressed size:" -02000324="Archives:" - -; List Context Menu -02000401="&Columns..." - -02000411="&Open" -02000412="&Extract..." - -; ToolBar -02000501="Extract" - -; Messages -02000601="Update operations are not supported for this archive." -02000602="Cannot update archive {0}" -02000603="Cannot create folder '{0}'" -02000604="File is not supported archive." -02000605="Error" -02000606="Too many items" -02000607="There is no application associated with the given file name extension" -02000608="There are no errors" -02000609="Can not open file '{0}' as archive" -0200060A="Can not open encrypted archive '{0}'. Wrong password?" -0200060B="The system cannot allocate the required amount of memory" -0200060C="Unknown error" -0200060D="Unsupported archive type" - -; Dialogs -02000702="OK" -02000705="&Yes" -02000707="Yes to &All" -02000709="&No" -0200070B="No to A&ll" - -02000710="Cancel" -02000711="&Cancel" -02000713="&Close" -02000714="Stop" -02000715="Restart" - -02000720="Help" - -; Extract dialog -02000800="Extract" -02000801="E&xtract to:" -02000802="Password" - -02000810="Path mode" -02000811="Full pathnames" -02000812="Current pathnames" -02000813="No pathnames" - -02000820="Overwrite mode" -02000821="Ask before overwrite" -02000822="Overwrite without prompt" -02000823="Skip existing files" -02000824="Auto rename" -02000825="Auto rename existing files" - -02000830="Files" -02000831="&Selected files" -02000832="&All files" - -02000881="Specify a location for extracted files." - -02000890="Extracting" - -; Overwrite dialog -02000900="Confirm File Replace" -02000901="Destination folder already contains processed file." -02000902="Would you like to replace the existing file" -02000903="with this one?" - -02000911="A&uto Rename" - -02000982="{0} bytes" -02000983="modified on" - -; Messages dialog -02000A00="Diagnostic messages" - -02000A80="Message" - -02000A91="Unsupported compression method for '{0}'." -02000A92="Data error in '{0}'. File is broken." -02000A93="CRC failed in '{0}'. File is broken." -02000A94="Data error in encrypted file '{0}'. Wrong password?" -02000A95="CRC failed in encrypted file '{0}'. Wrong password?" - -; Password dialog -02000B00="Enter password" -02000B01="Enter password:" -02000B02="&Show password" -02000B03="Reenter password:" -02000B10="Passwords do not match" -02000B11="Use only English letters, numbers and special characters (!, #, $, ...) for password" -02000B12="Password is too long" - -; Progress dialog -02000C00="Process" -02000C01="Elapsed time:" -02000C02="Remaining time:" -02000C03="Total size:" -02000C04="Speed:" -02000C05="Processed:" -02000C06="Compression ratio:" - -02000C10="&Background" -02000C11="&Foreground" -02000C12="&Pause" -02000C13="&Continue" - -02000C20="Paused" - -02000C30="Are you sure you want to cancel?" - -; Compress dialog -02000D00="Add to archive" -02000D01="&Archive:" -02000D02="&Update mode:" -02000D03="Archive &format:" -02000D04="Compression &method:" -02000D05="Create &Solid archive" -02000D06="&Parameters:" -02000D07="Options" -02000D08="Create SF&X archive" -02000D09="Multi-threading" -02000D0A="Encrypt file &names" -02000D0B="Compression &level:" -02000D0C="&Dictionary size:" -02000D0D="&Word size:" -02000D0E="Memory usage for Compressing:" -02000D0F="Memory usage for Decompressing:" -02000D10="Encryption" -02000D11="Encryption method:" -02000D12="Number of CPU threads:" -02000D13="Solid block size:" -02000D14="Non-solid" -02000D15="Solid" -02000D16="Compress shared files" - -02000D40="Split to &volumes, bytes:" -02000D41="Incorrect volume size" -02000D42="Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?" - -02000D81="Store" -02000D82="Normal" -02000D83="Maximum" -02000D84="Fast" -02000D85="Fastest" -02000D86="Ultra" - -02000D90="Browse" - -02000DA1="Add and replace files" -02000DA2="Update and add files" -02000DA3="Freshen existing files" -02000DA4="Synchronize files" - -02000DB1="All Files" - -02000DC0="Compressing" - -; Columns dialog -02000E00="Columns" -02000E01="Check the columns that you would like to make visible in this folder. Use the Move Up and Move Down buttons to reorder the columns." -02000E02="The selected column should be" -02000E03="pixels &wide." - -02000E10="Move &Up" -02000E11="Move &Down" -02000E12="&Show" -02000E13="&Hide" -02000E14="Set" - -02000E81="Title" -02000E82="Width" - -; Testing -02000F90="Testing" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&File" -03000103="&Edit" -03000104="&View" -03000105="&Tools" -03000106="&Help" -03000107="F&avorites" - -; File -03000210="&Open" -03000211="Open &Inside" -03000212="Open O&utside" -03000220="&View" -03000221="&Edit" -03000230="Rena&me" -03000231="&Copy To..." -03000232="&Move To..." -03000233="&Delete" -03000240="P&roperties" -03000241="Comme&nt..." -03000242="Calculate checksum" -03000243="Diff" -03000250="Create Folder" -03000251="Create File" -03000260="E&xit" -03000270="&Split file..." -03000271="Com&bine files..." - -; Edit -03000310="&Undo" -03000311="&Redo" -03000320="Cu&t" -03000321="&Copy" -03000322="&Paste" -03000323="&Delete" -03000330="Select &All" -03000331="Deselect All" -03000332="&Invert Selection" -03000333="Select..." -03000334="Deselect..." -03000335="Select by Type" -03000336="Deselect by Type" - -; View -03000410="Lar&ge Icons" -03000411="S&mall Icons" -03000412="&List" -03000413="&Details" -03000420="Unsorted" -03000430="Open Root Folder" -03000431="Up One Level" -03000432="Folders History..." -03000440="&Refresh" -03000449="Flat View" -03000450="&2 Panels" -03000451="&Toolbars" -03000460="Archive Toolbar" -03000461="Standard Toolbar" -03000462="Large Buttons" -03000463="Show Buttons Text" - -; Tools -03000510="&Options..." -03000511="&Benchmark" - -; Help -03000610="&Contents..." -03000620="&About 7-Zip..." - -; Favorites -03000710="&Add folder to Favorites as" -03000720="Bookmark" - -; Options Dialog - -03010000="Options" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Options..." - -; Edit -03010200="Editor" -03010201="&Editor:" -03010202="&Diff:" - -; System -03010300="System" -03010302="Associate 7-Zip with:" -03010310="Plugin" - -; Settings -03010400="Settings" -03010401="Show \"..\" item" -03010402="Show real file icons" -03010410="Show system menu" -03010420="&Full row select" -03010421="Show &grid lines" -03010422="Single-click to open an item" -03010430="&Alternative selection mode" -03010440="Use &large memory pages" - -; Strings - -03020201="Copy" -03020202="Move" -03020203="Copy to:" -03020204="Move to:" -03020205="Copying..." -03020206="Moving..." -03020207="You cannot move or copy items for such folders." -03020208="The operation is not supported for this folder." -03020209="Select destination folder." - -03020210="Confirm File Delete" -03020211="Confirm Folder Delete" -03020212="Confirm Multiple File Delete" -03020213="Are you sure you want to delete '{0}'?" -03020214="Are you sure you want to delete the folder '{0}' and all its contents?" -03020215="Are you sure you want to delete these {0} items?" -03020216="Deleting..." -03020217="Error Deleting File or Folder" -03020218="The system cannot move a file with long path to the Recycle Bin" - -03020220="Renaming..." -03020221="Error Renaming File or Folder" -03020222="Confirm File Copy" -03020223="Are you sure you want to copy files to archive" - -03020230="Create Folder" -03020231="Folder name:" -03020232="New Folder" -03020233="Error Creating Folder" - -03020240="Create File" -03020241="File Name:" -03020242="New File" -03020243="Error Creating File" - -03020250="Select" -03020251="Deselect" -03020252="Mask:" - -03020260="Folders History" - -03020280="File '{0}' was modified.\nDo you want to update it in the archive?" -03020281="Can not update file\n'{0}'" -03020282="Cannot start editor." -03020283="Opening..." -03020284="The file looks like a virus (the file name contains long spaces in name)." - -03020290="Comment" -03020291="&Comment:" - -030202A0="System" - -03020300="Computer" -03020301="Network" -03020302="Documents" - -03020400="Add" -03020401="Extract" -03020402="Test" - -03020420="Copy" -03020421="Move" -03020422="Delete" -03020423="Info" - -03020500="Split File" -03020501="&Split to:" -03020510="Splitting..." -03020520="Confirm Splitting" -03020521="Are you sure you want to split file into {0} volumes?" -03020522="Volume size must be smaller than size of original file" - -03020600="Combine Files" -03020601="&Combine to:" -03020610="Combining..." -03020620="Select only first part of split file" -03020621="Can not detect file as part of split file" -03020622="Can not find more than one part of split file" - -03020710="Checksum calculating..." -03020720="Checksum information" -03020721="CRC checksum for data:" -03020722="CRC checksum for data and names:" - -03020800="Scanning..." - -03020900="Properties" - -03020A01="The operation cannot be called from a folder that has a long path." -03020A02="You must select one file" -03020A03="You must select one or more files" -03020A04="File {0} is already exist" - -; Computer -03031100="Total Size" -03031101="Free Space" -03031102="Cluster Size" -03031103="Label" - -; Network -03031200="Local Name" -03031201="Provider" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Memory usage:" -03080002="Compressing" -03080003="Decompressing" -03080004="Speed" -03080005="Rating" -03080006="Total Rating" -03080007="Current" -03080008="Resulting" -03080009="Passes:" -0308000A="Errors:" -0308000B="CPU Usage" -0308000C="Rating / Usage" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/eo.txt b/tools/7-Zip/Lang/eo.txt deleted file mode 100644 index 2e3f8121af..0000000000 --- a/tools/7-Zip/Lang/eo.txt +++ /dev/null @@ -1,473 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.37 -; Translated by Dmitri Gabinski -; -; -; -; - -00000000="Esperanto" -00000001="Esperanto" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="7-Zip-Konfiguro" - -; Info Page -01000100="Informo" -01000103="7-Zip estas senpaga programo. Tamen, vi povas subteni evoluadon de 7-Zip per enregistriĝo." -01000104="Subteno" -01000105="Enregistriĝo" - -; Folders Page -01000200="Dosierujoj" -01000210="&Kuranta dosierujo" -01000211="&Sistema labora dosierujo" -01000212="&Ĉi tiu" -01000213="&Specifu:" -01000214="&Uzi nur por demeteblaj datumportiloj" - -01000281="Specifu ujon por laboraj dosieroj." - -; System Page -01000300="Sistemo" -01000301="Metu 7-Zip'on en kuntekstan menuon de ŝelo" -01000302="Kaskada kunteksta menuo" -01000310="Punktoj de kunteksta menuo:" - -; Language Page -01000400="Lingvo" -01000401="Lingvo:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Komandoj de 7-Zip" -02000103="Malfermu" -02000104="Malfermu markitan dosieron." -02000105="Elarĥivigu dosierojn..." -02000106="Elarĥivigo de dosieroj el markita arĥivo." -02000107="Enarĥivigu..." -02000108="Enarĥivigu markitajn objektojn." -02000109="Testu arĥivon" -0200010A="Testo de kohero de markita arĥivo." -0200010B="Elarĥivigu ĉi-tien" -0200010C="Elarĥivigo de dosieroj el markita arĥivo en kurantan dosierujon." -0200010D="Elarĥivigu en {0}" -0200010E="Elarĥvigas dosierojn en subdosierujon." -0200010F="Aldonu al {0}" -02000110="Aldonu markitajn aĵojn al arĥivo." -02000111="Enarĥivigu kaj enretpoŝtigu..." -02000112="Enarĥivigu la markitajn aĵojn kaj enretpoŝtigu la arĥivon." -02000113="Enarĥivigu en {0} kaj enretpoŝtigu..." -02000113="Enarĥivigu la markitajn aĵojn kaj enretpoŝtigu la arĥivon." - -02000140="" -02000141="" - -; Properties -02000203="Dosierindiko" -02000204="Nomo" -02000205="Dosiernoma sufikso" -02000206="Dosierujo" -02000207="Grando" -02000208="Enarĥiva grando" -02000209="Atributoj" -0200020A="Kreita" -0200020B="Malfermita" -0200020C="Ŝanĝita" -0200020D="Solida" -0200020E="Komento" -0200020F="Ĉifra" -02000210="Disigita antaŭ" -02000211="Disigita post" -02000212="Vortaro" -02000213="CRC" -02000214="Tipo" -02000215="Kontraŭ" -02000216="Metodo" -02000217="Gastiga operaciumo" -02000218="Dosiersistemo" -02000219="Uzulo" -0200021A="Grupo" -0200021B="Bloko" -0200021C="Komento" -0200021D="Pozicio" -0200021E="Vojprefikso" - -; Status bar -02000301="{0} objekto(j) markita(j)" -02000302="{0} objekto(j)" - -02000320="Dosieroj:" -02000321="Dosierujoj:" -02000322="Grando:" - -; List Context Menu -02000401="&Kolumnoj..." - -02000411="&Malfermu" -02000412="&Elarĥivigu..." - -; ToolBar -02000501="Elarĥivigu" - -; Messages -02000601="Ĝisdatigoperacioj ne estas subtenataj por ĉi-tiu arĥivo." -02000602="Fiaskis ĝisdatigi arĥivon {0}" -02000603="Fiaskis krei dosierujon '{0}'" -02000604="Dosiero ne estas subtenata arĥivo." -02000605="Eraro" -02000606="Troaj elementoj" -02000607="Mankas kunligita programo" -02000608="Eraroj ne trovitaj" - -; Dialogs -02000702="B&one" -02000705="&Jes" -02000707="Jes por ĉ&iuj" -02000709="&Ne" -0200070B="Ne por ĉi&uj" - -02000710="Nuligu" -02000711="&Nuligu" -02000713="&Fermu" -02000714="&Haltu" -02000715="Restartigu" - -02000720="Helpo" - -; Extract dialog -02000800="&Elarĥivigu" -02000801="E&larĥivigu en:" -02000802="&Pasvorto" - -02000810="Dosierindikoj" -02000811="&Absolutaj dosierindikoj" -02000812="&Relativaj dosierindikoj" -02000813="&Sen dosierindikoj" - -02000820="Anstataŭiga skribreĝimo" -02000821="&Kun konfirmo" -02000822="&Sen konfirmo" -02000823="&Preterlasu estantaj dosieroj" -02000824="Aŭtonomŝanĝo" -02000825="Aŭtonomŝanĝo de ekzistantaj dosieroj" - -02000830="Dosieroj" -02000831="&Markitaj dosieroj" -02000832="Ĉ&iuj dosieroj" - -02000881="Specifu ujon por elarĥivendaj dosieroj." - -02000890="Elarĥivigo" - -; Overwrite dialog -02000900="Konfirmo de nomŝanĝo" -02000901="Dosierujo jam enhavas prilaboratan dosieron." -02000902="Anstataŭigu estantan dosieron" -02000903="per ĉi-tiu?" - -02000911="&Aŭtonomŝanĝo." - -02000982="{0} bajtoj" -02000983="anstataŭigitaj per" - -; Messages dialog -02000A00="Diagnozaj mesaĝoj" - -02000A80="Mesaĝo" - -02000A91="Ne estas subtenata densigmetodo por dosiero '{0}'." -02000A92="Datumeraro en '{0}'. Difektiĝinta dosiero." -02000A93="CRC-eraro en '{0}'. Difektiĝinta dosiero." - -; Password dialog -02000B00="Pasvorto" -02000B01="Enigu pasvorton:" -02000B02="&Montru pasvorton" - -; Progress dialog -02000C00="Procezo" -02000C01="Pasinta tempo:" -02000C02="Restanta tempo:" -02000C03="Grando:" -02000C04="Rapideco:" - -02000C10="&Fono" -02000C11="&Malfono" -02000C12="&Paŭzo" -02000C13="&Daŭrigu" - -02000C20="Paŭzita" - -02000C30="Ĉu vi vere volas nuligi?" - -; Compress dialog -02000D00="Enarĥivigu" -02000D01="&Arĥivo:" -02000D02="A&nstataŭigreĝimo:" -02000D03="A&rĥivformato:" -02000D04="&Densigmetodo:" -02000D05="Kreu &solidan arĥivon" -02000D06="&Parametroj:" -02000D07="Agordoj" -02000D08="Kreu SF&X-arĥivon" -02000D09="Disfadenigo" -02000D0A="Ĉifru dosier&nomojn" -02000D0B="Densigo&nivelo" -02000D0C="&Vortarogrando:" -02000D0D="Vo&rtogrando:" -02000D0E="Memoruzo por densigo:" -02000D0F="Memoruzo por maldensigo:" - -02000D40="&Plurvolumigu, bajtoj:" - -02000D81="Sen densigo" -02000D82="Normala densigo" -02000D83="Maksimuma densigo" -02000D84="Rapide" -02000D85="Plej rapide" -02000D86="Ultra" - -02000D90="Foliumu" - -02000DA1="Aldonu kaj anstataŭigu dosierojn" -02000DA2="Ĝisdatigu kaj aldonu dosierojn" -02000DA3="Refreŝigu estantajn dosierojn" -02000DA4="Sinkronigu dosierojn" - -02000DB1="Ĉiuj dosieroj" - -02000DC0="Densigo" - -; Columns dialog -02000E00="Kolumnoj" -02000E01="Marku kolumnojn, enarĥivendaj en ĉi-tiu dosierujo. Per butonoj Supren kaj Suben eblas difini sekvordo de kolumnoj." -02000E02="Markita kolumno devas havi &larĝecon de" -02000E03="rastumeroj." - -02000E10="&Supren" -02000E11="S&uben" -02000E12="&Montru" -02000E13="&Kaŝu" -02000E14="Difinu" - -02000E81="Nomo" -02000E82="Larĝeco" - -; Testing -02000F90="Testado" - - -; File Manager - -03000000="7-Zip-dosieradministrilo" - -; Menu -03000102="&Dosiero" -03000103="&Redakto" -03000104="&Vido" -03000105="&Agordoj" -03000106="&Helpo" -03000107="&Favoritaj" - -; File -03000210="&Malfermu" -03000211="Malfermu &ene" -03000212="Malfermu ek&stere" -03000220="&Vidigu" -03000221="&Redaktu" -03000230="Ŝ&anĝu nomon" -03000231="&Kopiu en..." -03000232="M&ovu en..." -03000233="&Forigu" -03000240="A&tributoj" -03000241="Ko&mentu" -03000242="Kalkulu kontrolsumon" -03000250="Kreu &dosierujon" -03000251="Kre&u dos&ieron" -03000260="E&liru" -03000270="&Erigu dosierojn..." -03000271="Komb&inu dosierojn..." - -; Edit -03000310="&Malfaru" -03000311="&Refaru" -03000320="&Tondu" -03000321="&Kopiu" -03000322="Al&gluu" -03000323="&Forigu" -03000330="M&arku ĉiun" -03000331="Ma&lmarku ĉiun" -03000332="&Inversigu markon" -03000333="Marku..." -03000334="Malmarku..." -03000335="Marku laŭ tipo" -03000336="Malmarku laŭ tipo" - -; View -03000410="&Grandaj bildetoj" -03000411="&Malgrandaj bildetoj" -03000412="&Listo" -03000413="&Detale" -03000420="&Neordigite" -03000430="Malfermu radikan dosierujon" -03000431="Supren je unu nivelo" -03000432="Dosierujhistorio..." -03000440="Ĝ&isdatigu" -03000449="Ununivela vido" -03000450="&2 paneloj" -03000451="&Ilobretoj" -03000460="Arĥivo-ilobreto" -03000461="Norma ilobreto" -03000462="Grandaj bildetoj" -03000463="Montru butontekston" - -; Tools -03000510="&Agordoj..." -03000511="&Etalono" - -; Help -03000610="&Enhavo..." -03000620="&Pri 7-Zip..." - -; Favorites -03000710="&Aldonu dosierujon al favorataj kiel" -03000720="Legosigno" - -; Options Dialog - -03010000="Agordoj" - -; Plugins -03010100="Kromaĵoj" -03010101="&Kromaĵoj:" -03010110="Agordoj" - -; Edit -03010200="Redaktilo" -03010201="&Redaktilo:" - -; System -03010300="Sistemo" -03010302="Asociu 7-Zip-on kun dosieroj:" -03010310="Kromaĵo" - -; Settings -03010400="Agordoj" -03010401="Montru \"..\"-elementon" -03010402="Montru realajn dosierbildetojn" -03010410="Montru sisteman menuon" -03010420="Marku &tutan linion" -03010421="Montru &kradliniojn" -03010430="&Alternativa markreĝimo" -03010440="Uzu &grandajn memorpaĝojn" - -; Strings - -03020201="Kopiu" -03020202="Movu" -03020203="Kopiu en:" -03020204="Movu en:" -03020205="Kopio..." -03020206="Movo..." -03020207="Maleblas kopii objektojn por tiaj dosieroj." -03020208="Operacio ne estas subtenata." - -03020210="Konfirmo de forigo de dosiero" -03020211="Konfirmo de forigo de dosierujo" -03020212="Konfirmo de forigo de dosieraro" -03020213="Ĉu vi vere volas forigi '{0}'?" -03020214="Ĉu vi vere volas forigi dosierujon \"{0}\" kaj tutan ĝian enhavon?" -03020215="Ĉu vi vere volas forigi ĉi tiajn {0} objektojn?" -03020216="Forigo..." -03020217="Eraro dum forigo de dosiero aŭ dosierujo" - -03020220="Nomŝanĝo..." -03020221="Eraro dum nomŝanĝo de dosiero aŭ dosierujo" -03020222="Konfirmu dosierkopion" -03020223="Ĉu vere kopii dosierojn enarĥiven" - -03020230="Kreu dosierujon" -03020231="Dosierujnomo:" -03020232="Nova dosierujo" -03020233="Eraro dum dosierujkreo" - -03020240="Kreu dosieron" -03020241="Dosiernomo:" -03020242="Nova dosiero" -03020243="Eraro dum dosierkreo" - -03020250="Marku" -03020251="Malmarku" -03020252="Masko:" - -03020260="Dosierujhistorio" - -03020280="Dosiero '{0}' ŝanĝiĝis.\nĈu vi volas ĝistadigi ĝin enraĥive?" -03020281="Fiaskis ĝisdatigi dosieron\n'{0}''" -03020282="Fiaskis startigi redaktilon." -03020283="Malfermo..." - -03020290="Komento" -03020291="&Komento:" - -030202A0="Sistemo" - -03020300="Komputilo" -03020301="Reto" - -03020400="Enarĥivigu" -03020401="Elarĥivigu" -03020402="Testu" - -03020420="Kopiu" -03020421="Movu" -03020422="Forigu" -03020423="Informo" - -03020500="Erigu dosieron" -03020501="&Erigu en:" -03020510="Erigo..." - -03020600="Kombinu dosierojn" -03020601="&Kombinu en:" -03020610="Kombino..." - -03020710="Kalkulante kontrolsumon..." -03020720="Informo pri kontrolsumo" -03020721="CRC-kontrolsumo por datumoj:" -03020722="CRC-kontrolsumo por datumoj kaj nomoj:" - -03020800="Analizante..." - -; Computer -03031100="Kapacito" -03031101="Libera" -03031102="Faskogrando" -03031103="Marko" - -; Network -03031200="Loka nomo" -03031201="Provizanto" - -; Benchmark Dialog - -03080000="Etalono" -03080001="Memoruzo:" -03080002="Densigo" -03080003="Maldensigo" -03080004="Rapideco" -03080005="Takso" -03080006="Tuta takso" -03080007="Kuranta" -03080008="Rezulta" -03080009="Pasoj:" -0308000A="Eraroj:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/es.txt b/tools/7-Zip/Lang/es.txt deleted file mode 100644 index 2f56b17c9e..0000000000 --- a/tools/7-Zip/Lang/es.txt +++ /dev/null @@ -1,512 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.08 Beta -; Translated by Jbc25 based in original file of Igor Pavlov -; 7-Zip 4.54 Beta (en.ttt 4.53) -; Updated by Guillermo Gabrielli - 05/09/2007 -; -; - -00000000="Spanish" -00000001="Español" -00000002="10" - -; 7-Zip Configuration - -; Title -01000000="Configuración de 7-Zip" - -; Info Page -01000100="Acerca de 7-Zip" -01000103="7-Zip es un excelente software, además es libre y gratuito. Pero tu puedes apoyar el desarrollo de 7-Zip registrándote, para contribuir a mejorar el programa." -01000104="Soporte" -01000105="Registro" - -; Folders Page -01000200="Directorios" -01000210="Directorio de &trabajo" -01000211="Directorio temporal del &sistema" -01000212="Directorio &actual" -01000213="&Especificar directorio:" -01000214="Usar sólo para discos extraíbles" - -01000281="Especificar un directorio para archivos temporales." - -; System Page -01000300="Sistema" -01000301="Integrar 7-Zip en el menú contextual de Windows" -01000302="Menú contextual en cascada" -01000310="Ítems en el menú contextual:" - -; Language Page -01000400="Idioma" -01000401="Idioma:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandos 7-Zip" -02000103="Abrir comprimido" -02000104="Abre el archivo seleccionado." -02000105="Extraer ficheros..." -02000106="Extrae los ficheros del archivo seleccionado." -02000107="Añadir al archivo..." -02000108="Añade los ficheros seleccionados al archivo." -02000109="Comprobar archivo" -0200010A="Comprueba la integridad del archivo seleccionado." -0200010B="Extraer aquí" -0200010C="Extrae los ficheros del archivo seleccionado a la carpeta actual." -0200010D="Extraer en {0}" -0200010E="Extrae ficheros a una subcarpeta." -0200010F="Añadir a {0}" -02000110="Añade los items seleccionados al archivo." -02000111="Comprimir y enviar por correo..." -02000112="Comprime los items selecionados a un archivo y lo enviar por correo." -02000113="Comprimir a {0} y enviar por correo" -02000114="Comprime los items selecionados a un archivo y lo envía por correo." - -02000140="" -02000141="" - -; Properties -02000203="Dirección" -02000204="Nombre" -02000205="Tipo de archivo" -02000206="Directorio" -02000207="Tamaño" -02000208="Tamaño comprimido" -02000209="Atributos" -0200020A="Creado" -0200020B="Acceso" -0200020C="Modificado" -0200020D="Compacto" -0200020E="Comentado" -0200020F="Encriptado" -02000210="expandido antes" -02000211="expandido después" -02000212="Diccionario" -02000213="CRC" -02000214="Tipo" -02000215="Anti" -02000216="Método" -02000217="SO origen" -02000218="Sistema de archivos" -02000219="Usuario" -0200021A="Grupo" -0200021B="Bloque" -0200021C="Comentario" -0200021D="Posición" -0200021E="Ruta" -0200021F="Directorios" -02000220="Ficheros" -02000221="Versión" -02000222="Volumen" -02000223="Multivolumen" -02000224="Desplazamiento" -02000225="Vínculos" -02000226="Bloques" -02000227="Volúmenes" - -; Status bar -02000301="{0} objeto(s) seleccionado(s)" -02000302="{0} objeto(s)" - -02000320="Ficheros:" -02000321="Directorios:" -02000322="Tamaño:" -02000323="Tamaño Comprimido:" -02000324="Archivos:" - -; List Context Menu -02000401="&Columnas..." - -02000411="&Abrir" -02000412="&Extraer..." - -; ToolBar -02000501="Extraer" - -; Messages -02000601="Este tipo de archivo no permite actualización." -02000602="No se puede actualizar el archivo {0}" -02000603="No se puede crear el directorio '{0}'" -02000604="Tipo de archivo no reconocible." -02000605="Error" -02000606="Demasiados objetos" -02000607="No hay ningún programa asociado a esta extensión de archivo" -02000608="No hay errores" -02000609="No se puede abrir '{0}' como un archivo comprimido" -0200060A="No se puede abrir el archivo encriptado '{0}'. Verifique la contraseña." - -; Dialogs -02000702="Aceptar" -02000705="&Sí" -02000707="Sí a &todo" -02000709="&No" -0200070B="No a t&odo" - -02000710="Cancelar" -02000711="&Cancelar" -02000713="&Cerrar" -02000714="Parar" -02000715="Volver a empezar" - -02000720="Ayuda" - -; Extract dialog -02000800="Extraer" -02000801="E&xtraer a:" -02000802="Contraseña" - -02000810="Modo de directorio" -02000811="Directorio completo" -02000812="Directorio relativo" -02000813="Sin directorio" - -02000820="Sobrescribir" -02000821="Con confirmación" -02000822="Sin confirmación" -02000823="Conservar archivos existentes" -02000824="Renombrar automáticamente" -02000825="Auto-Renombrar archivos existentes" - -02000830="Archivos" -02000831="Archivos &seleccionados" -02000832="&Todos los archivos" - -02000881="Seleccione destino para los archivos extraídos." - -02000890="Extrayendo" - -; Overwrite dialog -02000900="Confirmar sustitución de archivos" -02000901="El directorio ya contiene un archivo con el mismo nombre." -02000902="¿Desea sustituir el archivo existente" -02000903="por este otro?" - -02000911="Renombrar a&utomáticamente" - -02000982="{0} bytes" -02000983="modificado el" - -; Messages dialog -02000A00="Mensajes de diagnóstico" - -02000A80="Mensaje" - -02000A91="Método de compresión no válido para '{0}'." -02000A92="Error de datos en '{0}'. El archivo está dañado." -02000A93="CRC ha fallado en '{0}'. El archivo está dañado." -02000A94="Error de datos en el archivo encriptado '{0}'. Verifique la contraseña." -02000A95="CRC ha fallado en el archivo encriptado '{0}'. Verifique la contraseña." - -; Password dialog -02000B00="Introducir contraseña" -02000B01="E&scriba la contraseña:" -02000B02="&Mostrar contraseña" -02000B03="Escriba nue&vamente la contraseña:" -02000B10="Las contraseñas son diferentes. Por favor vuelva a ingresarlas." -02000B11="Utilice en la contraseña solamente letras del alfabeto inglés, números y caracteres especiales (!, #, $, ...)" -02000B12="La contraseña es demasiado larga." - -; Progress dialog -02000C00="Progreso" -02000C01="Tiempo transcurrido:" -02000C02="Tiempo pendiente:" -02000C03="Tamaño:" -02000C04="Velocidad:" -02000C05="Procesado:" -02000C06="Razón de Compresión:" - -02000C10="Se&gundo Plano" -02000C11="P&rimer plano" -02000C12="&Pausa" -02000C13="&Continuar" - -02000C20="Pausado" - -02000C30="¿Está seguro de que desea cancelar?" - -; Compress dialog -02000D00="Añadir al archivo" -02000D01="&Archivo:" -02000D02="M&odo de actualización:" -02000D03="&Formato de archivo:" -02000D04="&Tipo de compresión:" -02000D05="Crear archivo &compacto" -02000D06="&Parámetros:" -02000D07="Opciones" -02000D08="Crear archivo SF&X (auto-extraíble)" -02000D09="Multi&hilo" -02000D0A="Encriptar &nombres de fichero" -02000D0B="Nive&l de Compresión:" -02000D0C="Tamaño de &Diccionario:" -02000D0D="Tama&ño de la Palabra:" -02000D0E="Memoria usada para Comprimir:" -02000D0F="Memoria usada para Descomprimir:" -02000D10="Encriptación" -02000D11="Método de &Encriptación:" -02000D12="Número de hilos de CPU:" -02000D13="Tamaño de bloque compacto:" -02000D14="No Compacto" -02000D15="Sin Límite" -02000D16="Comprimir archivos abiertos para escritura" - -02000D40="Partir en fra&gmentos, bytes:" -02000D41="Tamaño de fragmento incorrecto" -02000D42="Tamaño de fragmento especificado: {0} bytes.\n¿Está seguro que desea dividir el archivo en fragmentos de dicho tamaño?" - -02000D81="Sin compresión" -02000D82="Normal" -02000D83="Máxima" -02000D84="Rápida" -02000D85="Más rápida" -02000D86="Ultra" - -02000D90="Explorar" - -02000DA1="Añadir y sustituir archivos" -02000DA2="Actualizar y añadir archivos" -02000DA3="Sólo actualizar archivos" -02000DA4="Sincronizar archivos" - -02000DB1="Todos los archivos" - -02000DC0="Comprimiendo" - -; Columns dialog -02000E00="Columnas" -02000E01="Seleccione las columnas que quiere que estén visibles en este modo. Use las teclas AvPg y RePg organizar las columnas como quiera." -02000E02="La columna elegida debe tener" -02000E03="pixels." - -02000E10="Mover hacia &arriba" -02000E11="Mover hacia a&bajo" -02000E12="&Mostrar" -02000E13="&Esconder" -02000E14="Fijar" - -02000E81="Título" -02000E82="Ancho" - -; Testing -02000F90="Probando" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Archivo" -03000103="&Editar" -03000104="&Ver" -03000105="&Herramientas" -03000106="Ay&uda" -03000107="&Favoritos" - -; File -03000210="&Abrir" -03000211="Abrir &dentro" -03000212="Abrir &fuera" -03000220="&Ver" -03000221="&Editar" -03000230="Re&nombrar" -03000231="&Copiar a..." -03000232="&Mover a..." -03000233="&Borrar" -03000240="&Propiedades" -03000241="Comen&tario" -03000242="Suma de verificación" -03000250="Crear carpeta" -03000251="Crear archivo" -03000260="&Salir" -03000270="Di&vidir archivo..." -03000271="C&ombinar archivos..." - -; Edit -03000310="&Deshacer" -03000311="&Rehacer" -03000320="Cor&tar" -03000321="&Copiar" -03000322="&Pegar" -03000323="&Borrar" -03000330="Seleccionar &todo" -03000331="Deseleccionar todo" -03000332="&Invertir selección" -03000333="Seleccionar..." -03000334="Deseleccionar..." -03000335="Seleccionar por tipo" -03000336="Deseleccionar por tipo" - -; View -03000410="Iconos g&randes" -03000411="&Iconos pequeños" -03000412="&Lista" -03000413="&Detalles" -03000420="Desordenado" -03000430="Abrir directorio raíz" -03000431="Un directorio arriba" -03000432="Historia de carpetas..." -03000440="&Actualizar" -03000449="Vista plana (Flat view)" -03000450="&2 paneles" -03000451="&Barras de Herramientas" -03000460="Barra de Herramientas 'Archivo'" -03000461="Barras de Herramientas Estándar" -03000462="Botones grandes" -03000463="Mostrar Texto en los Botones" - -; Tools -03000510="&Opciones..." -03000511="&Pruebas (Benchmark)" - -; Help -03000610="&Contenido..." -03000620="&Acerca de 7-Zip..." - -; Favorites -03000710="&Añadir carpeta a favoritos como" -03000720="Agregar a favoritos" - -; Options Dialog - -03010000="Opciones" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opciones..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistema" -03010302="Asociar 7-Zip con:" -03010310="Plugin" - -; Settings -03010400="Propiedades" -03010401="Mostrar el ítem \"..\"" -03010402="Mostrar iconos propios" -03010410="Mostrar menú del sistema" -03010420="&Seleccionar fila(s) entera(s)" -03010421="Mostrar &Cuadrícula" -03010430="Modo de selección &alternativo" -03010440="Usar páginas &grandes de memoria" - -; Strings - -03020201="Copiar" -03020202="Mover" -03020203="Copiar a:" -03020204="Mover a:" -03020205="Copiando..." -03020206="Moviendo..." -03020207="No se pueden mover o copiar elementos de este tipo de carpetas." -03020208="Operación no permitida." -03020209="Seleccione la carpeta de destino" - -03020210="Confirmar borrado de archivo" -03020211="Confirmar borrado de carpeta" -03020212="Confirmar borrado de ficheros múltiples" -03020213="¿Está seguro de querer borrar '{0}'?" -03020214="¿Está seguro de querer borrar la carpeta '{0}' y todo su contenido?" -03020215="¿Está seguro de querer borrar estos {0} elementos?" -03020216="Borrando..." -03020217="Error borrando fichero o carpeta" - -03020220="Renombrando..." -03020221="Error renombrando fichero o carpeta" -03020222="Confirmar copia de ficheros" -03020223="¿Está seguro que desea copiar los ficheros al archivo" - -03020230="Crear carpeta" -03020231="Nombre de carpeta:" -03020232="Carpeta nueva" -03020233="Error creando carpeta" - -03020240="Crear archivo" -03020241="Nombre de archivo:" -03020242="Archivo nuevo" -03020243="Error creando archivo" - -03020250="Seleccionar" -03020251="Deseleccionar" -03020252="Máscara:" - -03020260="Historial de carpetas" - -03020280="El fichero '{0}' ha sido modificado.\n¿Quiere actualizarlo en el archivo?" -03020281="No puede actualizarse el fichero\n'{0}'" -03020282="No puede ejecutarse el editor." -03020283="Abriendo..." - -03020290="Comentario" -03020291="&Comentario:" - -030202A0="Sistema" - -03020300="Mi PC" -03020301="Entorno de red" - -03020400="Agregar" -03020401="Extraer" -03020402="Probar" - -03020420="Copiar" -03020421="Mover" -03020422="Borrar" -03020423="Información" - -03020500="Dividir Archivo" -03020501="Di&vidir a:" -03020510="Dividiendo..." -03020520="Confirmar División" -03020521="¿Está seguro que desea dividir el archivo en {0} partes?" -03020522="El tamaño de los fragmentos debe ser menor que el del archivo original" - -03020600="Combinar Archivos" -03020601="&Combinar a:" -03020610="Combinando..." -03020620="Seleccione solamente el primer archivo" - -03020710="Calculando suma de verificación..." -03020720="Suma de verificación (CRC)" -03020721="CRC de los datos:" -03020722="CRC de los datos y nombres:" - -03020800="Buscando..." - -03020900="Propiedades" - -; Computer -03031100="Espacio total" -03031101="Espacio libre" -03031102="Tamaño clúster" -03031103="Etiqueta" - -; Network -03031200="Nombre local" -03031201="Proveedor" - -; Benchmark Dialog - -03080000="Pruebas (Benchmark)" -03080001="Uso de Memoria:" -03080002="Compresión" -03080003="Descompresión" -03080004="Velocidad" -03080005="Tasa" -03080006="Tasa Total" -03080007="Actual" -03080008="Resultante" -03080009="Pasos:" -0308000A="Errores:" -0308000B="Uso de CPU" -0308000C="Resultante / Uso" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/et.txt b/tools/7-Zip/Lang/et.txt deleted file mode 100644 index 70775966cf..0000000000 --- a/tools/7-Zip/Lang/et.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Eesti keelde on tõlkinud Kaupo Suviste -; Täiendas Mihkel Tõnnov -; -; -; - -00000000="Estonian" -00000001="eesti keel" -00000002="37" - -; 7-Zip Configuration - -; Title -01000000="7-Zipi suvandid" - -; Info Page -01000100="Teave 7-Zipi kohta" -01000103="7-Zip on vaba tarkvara. Kuid kui soovite toetada 7-Zipi arendamist, siis saate programmi registreerida.\n\n7-Zipi Eesti koduleht:\nhttp://www.hot.ee/somberg/7zip.html" -01000104="Tugi" -01000105="Registreeri" - -; Folders Page -01000200="Kaustad" -01000210="&Töökaust" -01000211="&Süsteemi ajutiste failide kaust" -01000212="&Praegune kaust" -01000213="&Kasutaja määratud:" -01000214="Kasuta ainult irddraivide puhul" - -01000281="Määrake ajutiste arhiivifailide asukoht." - -; System Page -01000300="Süsteem" -01000301="Integreeri 7-Zip kesta hüpikmenüüsse" -01000302="Kaskaad-hüpikmenüü" -01000310="Hüpikmenüü käsud:" - -; Language Page -01000400="Keel" -01000401="Keel:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zipi käsud" -02000103="Ava arhiiv" -02000104="Avab valitud arhiivi." -02000105="Eralda failid..." -02000106="Eraldab failid valitud arhiivist välja." -02000107="Lisa arhiivi..." -02000108="Lisab valitud üksused arhiivi." -02000109="Testi arhiivi" -0200010A="Testib valitud arhiivi terviklust." -0200010B="Eralda siia" -0200010C="Eraldab failid valitud arhiivist välja praegusesse kausta." -0200010D="Eralda kausta {0}" -0200010E="Eraldab failid välja alamkausta." -0200010F="Lisa arhiivi {0}" -02000110="Lisab valitud üksused arhiivi." -02000111="Tihenda ja meili..." -02000112="Tihendab valitud üksused arhiiviks ja saadab arhiivi e-postiga." -02000113="Tihenda arhiiviks {0} ja meili" -02000114="Tihendab valitud üksused arhiiviks ja saadab arhiivi e-postiga." - -02000140="" -02000141="" - -; Properties -02000203="Tee" -02000204="Nimi" -02000205="Laiend" -02000206="Kaust" -02000207="Maht" -02000208="Maht tihendatult" -02000209="Atribuudid" -0200020A="Loodud" -0200020B="Avatud" -0200020C="Muudetud" -0200020D="Ühtne" -0200020E="Kommenteeritud" -0200020F="Krüptitud" -02000210="Tükeldatud enne" -02000211="Tükeldatud pärast" -02000212="Sõnastik" -02000213="CRC" -02000214="Tüüp" -02000215="Anti" -02000216="Meetod" -02000217="Opsüsteem" -02000218="Failisüsteem" -02000219="Kasutaja" -0200021A="Rühm" -0200021B="Plokk" -0200021C="Kommentaar" -0200021D="Koht" -0200021E="Tee prefiks" -0200021F="Kaustu" -02000220="Faile" -02000221="Versioon" -02000222="Köide" -02000223="Mitmeköiteline" -02000224="Nihe" -02000225="Linke" -02000226="Plokke" -02000227="Köiteid" - -02000229="64-bitine" -0200022A="Big-Endian" -0200022B="Protsessor" -0200022C="Füüsiline maht" -0200022D="Päiste maht" -0200022E="Kontrollsumma" -0200022F="Karakteristikud" -02000230="Virtuaalaadress" -02000231="ID" -02000232="Lühinimi" -02000233="Loomisrakendus" -02000234="Sektori maht" -02000235="Režiim" -02000236="Link" - -; Status bar -02000301="{0} üksus(t) valitud" -02000302="{0} üksus(t)" - -02000320="Faile:" -02000321="Kaustu:" -02000322="Maht:" -02000323="Maht tihendatult:" -02000324="Arhiive:" - -; List Context Menu -02000401="&Veerud..." - -02000411="&Ava" -02000412="&Eralda välja..." - -; ToolBar -02000501="Eralda välja" - -; Messages -02000601="Selle arhiivi värskendamistoiminguid ei toetata." -02000602="Ei saa värskendada arhiivi {0}" -02000603="Ei saa luua kausta {0}" -02000604="Programm ei toeta faili vormingut." -02000605="Tõrge" -02000606="Liiga palju üksusi." -02000607="Selle failinime laiendiga pole seostatud ühtki rakendust." -02000608="Vigu ei leitud." -02000609="Ei saa avada faili {0} arhiivina." -0200060A="Ei saa avada krüptitud arhiivi {0}. Kas vale parool?" -0200060B="Süsteem ei saa eraldada nõutavat mälumahtu." -0200060C="Tundmatu tõrge" -0200060D="Toetamata arhiivitüüp." - -; Dialogs -02000702="OK" -02000705="&Jah" -02000707="Kõigile j&ah" -02000709="&Ei" -0200070B="Kõigile e&i" - -02000710="Loobu" -02000711="&Loobu" -02000713="&Sulge" -02000714="Seiska" -02000715="Restardi" - -02000720="Abi" - -; Extract dialog -02000800="Väljaeraldamine" -02000801="&Eralda välja kausta:" -02000802="&Parool" - -02000810="Teed" -02000811="&Täielikud teenimed" -02000812="Su&htelised teenimed" -02000813="Teenime&deta" - -02000820="Ülekirjutus" -02000821="Küsi e&nne ülekirjutamist" -02000822="Ki&rjuta küsimata üle" -02000823="&Jäta olemasolevad failid vahele" -02000824="Nimeta a&utomaatselt ümber" -02000825="Nimeta &olemasolevad f. autom. ümber" - -02000830="Failid" -02000831="&Valitud failid" -02000832="&Kõik failid" - -02000881="Määrake väljaeraldatud failide asukoht." - -02000890="välja eraldatud" - -; Overwrite dialog -02000900="Failiasenduse kinnitamine" -02000901="Sihtkaust juba sisaldab töödeldavat faili." -02000902="Kas soovite asendada olemasoleva faili" -02000903="selle failiga?" - -02000911="Nimeta a&utomaatselt ümber" - -02000982="{0} baiti" -02000983="muudetud" - -; Messages dialog -02000A00="Diagnostikateated" - -02000A80="Teade" - -02000A91="Toetuseta tihendusmeetod failile {0}." -02000A92="Andmeviga failis {0}. Fail on rikutud." -02000A93="Tsükkelkoodkontroll (CRC) failis {0} nurjus. Fail on rikutud." -02000A94="Andmeviga krüptitud failis {0}. Kas vale parool?" -02000A95="Tsükkelkoodkontroll (CRC) krüptitud failis {0} nurjus. Kas vale parool?" - -; Password dialog -02000B00="Parooli sisestamine" -02000B01="Sisestage parool:" -02000B02="&Kuva parool" -02000B03="Parooli kordus:" -02000B10="Paroolid ei kattu." -02000B11="Kasutage paroolis ainult inglise keele tähti, numbreid ja erimärke (!, #, $, ...)." -02000B12="Parool on liiga pikk." - -; Progress dialog -02000C00="Töötlemine" -02000C01="Kulunud aeg:" -02000C02="Järelejäänud aeg:" -02000C03="Kogumaht:" -02000C04="Kiirus:" -02000C05="Töödeldud:" -02000C06="Tihendussuhe:" - -02000C10="&Taustal" -02000C11="&Esiplaanile" -02000C12="&Paus" -02000C13="&Jätka" - -02000C20="Pausiks peatatud" - -02000C30="Kas soovite kindlasti loobuda?" - -; Compress dialog -02000D00="Arhiivi lisamine" -02000D01="&Arhiiv:" -02000D02="Värskend&usrežiim:" -02000D03="Arhiivi&vorming:" -02000D04="Tihendus&meetod:" -02000D05="&Loo ühtne arhiiv" -02000D06="Pa&rameetrid:" -02000D07="Suvandid" -02000D08="Loo is&eavanev arhiiv" -02000D09="Lõimtöötlus" -02000D0A="Krüpti faili&nimed" -02000D0B="&Tihendusaste:" -02000D0C="Sõnaraamatu ma&ht:" -02000D0D="&Sõna maht:" -02000D0E="Mälu hõivatus tihendamisel:" -02000D0F="Mälu hõivatus hõrendamisel:" -02000D10="Krüptimine" -02000D11="Krüptimismeetod:" -02000D12="Protsessorilõimede arv:" -02000D13="Ühtse ploki maht:" -02000D14="Mitteühtne" -02000D15="Ühtne" -02000D16="Tihenda kirjutuseks avatud failid" - -02000D40="&Tükelda köideteks (baitides):" -02000D41="Sobimatu köitemaht." -02000D42="Määratud köitemaht: {0} baiti.\nKas soovite kindlasti tükeldada arhiivi niisugusteks köideteks?" - -02000D81="Tihenduseta" -02000D82="Normaaltihendus" -02000D83="Maksimaaltihendus" -02000D84="Kiirtihendus" -02000D85="Kiireim tihendus" -02000D86="Ultratihendus" - -02000D90="Sirvi" - -02000DA1="Lisa ja asenda failid" -02000DA2="Värskenda ja lisa failid" -02000DA3="Värskenda olemasolevad failid" -02000DA4="Sünkrooni failid" - -02000DB1="Kõik failid" - -02000DC0="tihendatud" - -; Columns dialog -02000E00="Veerud" -02000E01="Märkige veerud, mida soovite selles kaustas kuvada. Soovitud järjestusse saate veerud seada nuppude Nihuta üles ja Nihuta alla abil." -02000E02="Valitud veerg peaks olema" -02000E03="pi&kslit lai." - -02000E10="Ni&huta üles" -02000E11="Nihuta &alla" -02000E12="K&uva" -02000E13="&Peida" -02000E14="Sea" - -02000E81="Tiitel" -02000E82="Laius" - -; Testing -02000F90="Testimine" - - -; File Manager - -03000000="7-Zipi failihaldur" - -; Menu -03000102="&Fail" -03000103="&Redigeeri" -03000104="&Vaade" -03000105="&Tööriistad" -03000106="&Abi" -03000107="&Lemmikud" - -; File -03000210="&Ava" -03000211="Ava s&ees" -03000212="Ava väljasp&ool" -03000220="Vaat&ur" -03000221="&Redigeeri" -03000230="&Nimeta ümber" -03000231="&Kopeeri asukohta..." -03000232="&Teisalda asukohta..." -03000233="Ku&stuta" -03000240="Atri&buudid" -03000241="Ko&mmentaar..." -03000242="Arvuta kontrollsumma" -03000243="Võrdle" -03000250="Loo kaust" -03000251="Loo fail" -03000260="&Välju" -03000270="Tükel&da fail..." -03000271="Ü&henda failid..." - -; Edit -03000310="&Võta tagasi" -03000311="&Tee uuesti" -03000320="&Lõika" -03000321="&Kopeeri" -03000322="Klee&bi" -03000323="Ku&stuta" -03000330="V&ali kõik" -03000331="Tühista kõik valikud" -03000332="&Pööra valik" -03000333="Vali..." -03000334="Tühista valik..." -03000335="Vali tüübi järgi" -03000336="Tühista tüübi järgi valik" - -; View -03000410="&Suured ikoonid" -03000411="Väik&esed ikoonid" -03000412="&Loend" -03000413="Üksikasja&d" -03000420="Sortimata" -03000430="Ava juurkaust" -03000431="Taseme võrra üles" -03000432="Kaustaajalugu..." -03000440="&Värskenda" -03000449="Lame vaade" -03000450="&Kaks paani" -03000451="&Tööriistaribad" -03000460="Arhiiviriistariba" -03000461="Standardnupuriba" -03000462="Suured nupud" -03000463="Kuva nupusildid" - -; Tools -03000510="&Häälestus..." -03000511="&Jõudlustest" - -; Help -03000610="&Sisukord..." -03000620="&Teave 7-Zipi kohta..." - -; Favorites -03000710="&Lisa kaust lemmikute hulka järjehoidjana" -03000720="Järjehoidja" - -; Options Dialog - -03010000="Häälestus" - -; Plugins -03010100="Pluginad" -03010101="&Pluginad:" -03010110="Suvandid..." - -; Edit -03010200="Redaktor" -03010201="&Redaktor:" -03010202="&Võrdlusprogramm:" - -; System -03010300="Süsteem" -03010302="Seosta 7-Zip laienditega:" -03010310="Plugin" - -; Settings -03010400="Sätted" -03010401="Kuva element \"..\"" -03010402="Kuva tegelikud failiikoonid" -03010410="Kuva süsteemimenüü" -03010420="&Vali terve rida" -03010421="Kuva &ruudujooned" -03010422="Ava üksus ühe klõpsuga" -03010430="&Alternatiivne valikurežiim" -03010440="Kasuta &suuri mälulehekülgi" - -; Strings - -03020201="Kopeerimine" -03020202="Teisaldamine" -03020203="Kopeeri asukohta:" -03020204="Teisalda asukohta:" -03020205="Kopeerimine..." -03020206="Teisaldamine..." -03020207="Te ei saa teisaldada või kopeerida üksusi niisugustesse kaustadesse." -03020208="See toiming pole selles kaustas toetatud." -03020209="Valige sihtkaust." - -03020210="Failikustutuse kinnitamine" -03020211="Kaustakustutuse kinnitamine" -03020212="Mitme faili kustutamise kinnitamine" -03020213="Kas soovite kindlasti kustutada faili {0}?" -03020214="Kas soovite kindlasti kustutada kausta {0} ja kogu selle sisu?" -03020215="Kas soovite kindlasti kustutada need {0} üksust?" -03020216="Kustutamine..." -03020217="Tõrge faili või kausta kustutamisel" -03020218="Süsteem ei saa teisaldada prügikasti pika teega faili." - -03020220="Ümbernimetamine..." -03020221="Tõrge faili või kausta ümbernimetamisel" -03020222="Failikopeerimise kinnitamine" -03020223="Kas soovite kindlasti kopeerida arhiivi järgmised failid:" - -03020230="Kausta loomine" -03020231="Kausta nimi:" -03020232="Uus kaust" -03020233="Tõrge kausta loomisel" - -03020240="Faili loomine" -03020241="Faili nimi:" -03020242="Uus fail" -03020243="Tõrge faili loomisel" - -03020250="Valimine" -03020251="Valiku tühistamine" -03020252="Mask:" - -03020260="Kaustaajalugu" - -03020280="Faili {0} on muudetud.\nKas soovite selle arhiivis värskendada?" -03020281="Ei saa värskendada faili\n{0}" -03020282="Ei saa käivitada redaktorit." -03020283="Avamine..." -03020284="See fail sarnaneb viirusega (faili nimi sisaldab pikka tühikute jada)." - -03020290="- kommentaar" -03020291="&Kommentaar:" - -030202A0="Süsteem" - -03020300="Arvuti" -03020301="Võrk" -03020302="Dokumendid" - -03020400="Lisa" -03020401="Eralda välja" -03020402="Testi" - -03020420="Kopeeri" -03020421="Teisalda" -03020422="Kustuta" -03020423="Teave" - -03020500="Faili tükeldamine:" -03020501="&Tükelda asukohta:" -03020510="Tükeldamine..." -03020520="Tükeldamise kinnitamine" -03020521="Kas soovite kindlasti tükeldada faili {0} köiteks?" -03020522="Köite maht peab olema algfaili mahust väiksem." - -03020600="Failide ühendamine:" -03020601="Ü&henda asukohta:" -03020610="Ühendamine..." -03020620="Valige ainult tükeldatud faili esimene osa." -03020621="Ei õnnestu tuvastada, et see fail oleks tükeldatud faili osa." -03020622="Ei leia rohkem kui ühte tükeldatud faili osa." - -03020710="Kontrollsumma arvutamine..." -03020720="Kontrollsumma" -03020721="Andmete CRC-kontrollsumma:" -03020722="Andmete ja nimede CRC-kontrollsumma:" - -03020800="Läbivaatamine..." - -03020900="Atribuudid" - -03020A01="Toimingut ei saa käivitada kaustast, millel on pikk tee." -03020A02="Te peate valima ühe faili." -03020A03="Te peate valima ühe või mitu faili." -03020A04="Fail {0} on juba olemas." - -; Computer -03031100="Kogumaht" -03031101="Vaba ruum" -03031102="Klastri suurus" -03031103="Silt" - -; Network -03031200="Kohalik nimi" -03031201="Teenusepakkuja" - -; Benchmark Dialog - -03080000="Jõudlustest" -03080001="Mälu hõivatus:" -03080002="Tihendamine" -03080003="Hõrendamine" -03080004="Kiirus" -03080005="Hinnang" -03080006="Üldine jõudlushinnang" -03080007="Praegune:" -03080008="Lõpptulemus:" -03080009="Töötiire:" -0308000A="Vigu:" -0308000B="CPU hõivatus" -0308000C="Hinnang/hõivatus" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/eu.txt b/tools/7-Zip/Lang/eu.txt deleted file mode 100644 index d9d8b70a04..0000000000 --- a/tools/7-Zip/Lang/eu.txt +++ /dev/null @@ -1,513 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by Iñigo Salvador Azurmendi -; -; -; -; - -00000000="Basque" -00000001="Euskara" -00000002="45" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Konfiguraketa" - -; Info Page -01000100="7-Zip-eri buruz" -01000103="7-Zip software askea da. Hala ere, erregistratuz, 7-Zip garatzen lagundu dezakezu." -01000104="Euskarria" -01000105="Erregistratu" - -; Folders Page -01000200="Karpetak" -01000210="Laneko &Karpetak" -01000211="&Sistemaren aldiuneko karpeta" -01000212="&Unekoa" -01000213="&Zehaztutakoa:" -01000214="Erabili unitate eramangarriekin soilik" - -01000281="Zehaztu kokaleku bat aldiuneko artxibu fitxategientzako." - -; System Page -01000300="Sistema" -01000301="Bateratu 7-Zip maskorraren testuinguru menura" -01000302="Testuinguru menua turrustan" -01000310="Testuinguru menuaren zerrenda:" - -; Language Page -01000400="Hizkuntza" -01000401="Hizkuntza:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip aginduak" -02000103="Artxibua ireki" -02000104="Aukeratutako artxiboa irekitzen du." -02000105="Fitxategiak atera..." -02000106="Aukeratutako artxibuko fitxategiak ateratzen ditu." -02000107="Artxibura erantsi..." -02000108="Aukeratutako gaiak artxibura eransten ditu." -02000109="Artxibua egiaztatu" -0200010A="Aukeratutako artxibuaren osotasuan egiaztatzen du." -0200010B="Atera hona" -0200010C="Fitxategiak aukeratutako artxibutik uneko karpetara ateratzen ditu." -0200010D="Atera {0}-(e)ra" -0200010E="Atera fitxategiak azpikarpetara." -0200010F="Erantsi {0}-(e)ra" -02000110="Aukeratutako gaiak artxibura eransten ditu." -02000111="Konprimatu eta post@z bidali..." -02000112="Aukeratutako gaiak artxibura konprimatu eta post@ bitartez bidaltzen du." -02000113="Konprimatu {0}-(e)ra eta post@z bidali" -02000114="Aukeratutako gaiak artxibura konprimatu eta post@ bitartez bidaltzen du." - -02000140="" -02000141="" - -; Properties -02000203="Bidea" -02000204="Izena" -02000205="Luzapena" -02000206="Karpeta" -02000207="Neurria" -02000208="Neurria konprimatuta" -02000209="Ezaugarriak" -0200020A="Sortu" -0200020B="Atzitua" -0200020C="Aldatu" -0200020D="Trinko" -0200020E="Azalpena" -0200020F="Zifratuta" -02000210="Banatu Lehenago" -02000211="Banatu Ondoren" -02000212="Hiztegia" -02000213="CRC" -02000214="Mota" -02000215="Anti" -02000216="Metodoa" -02000217="Ostalariaren SE" -02000218="Fitxategi Sistema" -02000219="Erabiltzailea" -0200021A="Taldea" -0200021B="Blokeatu" -0200021C="Aipamena" -0200021D="Kokapena" -0200021E="Bide Aurrizkia" -0200021F="Karpetak" -02000220="Fitxategiak" -02000221="Bertsioa" -02000222="Bolumena" -02000223="Bolumen anizkoitza" -02000224="Kokapen zuzenketa" -02000225="Estekak" -02000226="Blokeak" -02000227="Bolumenak" - -; Status bar -02000301="{0} objektu aukeratuta" -02000302="{0} objektu" - -02000320="Fitxategiak:" -02000321="Karpetak:" -02000322="Neurria:" -02000323="Neurria trinkotuta:" -02000324="Artxibuak:" - -; List Context Menu -02000401="&Zutabeak..." - -02000411="&Ireki" -02000412="&Atera..." - -; ToolBar -02000501="Atera" - -; Messages -02000601="Eguneraketa eragiketak ez dira onartzen artxibu honekin." -02000602="Ezin da {0} artxibua eguneratu" -02000603="Ezin da '{0}' artxibua sortu" -02000604="Fitxategia ez da onartutako artxibua." -02000605="Akatsa" -02000606="Gai gehiegi" -02000607="Ez dago fitxategi luzapen horrekin elkartutako aplikaziorik" -02000608="Ez dago akatsik" -02000609="Ezin da '{0}' fitxategia artxibu bezala ireki" -0200060A="Ezin da da '{0}' zifratutako artxibua ireki. Pasahitz okerra?" - -; Dialogs -02000702="Ados" -02000705="&Bai" -02000707="&Guztiari Bai" -02000709="&Ez" -0200070B="G&uztiari Ez" - -02000710="Uzi" -02000711="&Utzi" -02000713="&Itxi" -02000714="Gelditu" -02000715="Berrasi" - -02000720="Laguntza" - -; Extract dialog -02000800="Atera" -02000801="Atera &Hona:" -02000802="Pasahitza" - -02000810="Bide modua" -02000811="Bideizen osoak" -02000812="Uneko bideizenak" -02000813="Bideizenik ez" - -02000820="Gainidatzi modua" -02000821="Galdetu gainidatzi aurretik" -02000822="Gainidatzi abisatu gabe" -02000823="Jauzi existitzen diren fitxategiak" -02000824="Berez berrizendatu" -02000825="Berez berrizendatu existitzen diren fitxategiak" - -02000830="Fitxategiak" -02000831="&Aukeratutako fitxategiak" -02000832="Fitxategi &Guztiak" - -02000881="Zehaztu fitxategiak ateratzeko lekua." - -02000890="Ateratzen" - -; Overwrite dialog -02000900="Onetsi Fitxategi Ordezkapena" -02000901="Helburu karpetak prozesatutako fitxategia dauka dagoeneko." -02000902="Existitzen den fitxategia ordezkatu nahi duzu" -02000903="beste honekin?" - -02000911="&Berez Berrizedatu" - -02000982="{0} byte" -02000983="aldatua" - -; Messages dialog -02000A00="Diagnosi mezuak" - -02000A80="Mezua" - -02000A91="'{0}'-rentzako onartugabeko konpresio metodoa ." -02000A92="Datuen akatsa '{0}'-n. Fitxategia hondatuta dago." -02000A93="CRC akatsa '{0}'-n. Fitxategia hondatuta dago." -02000A94="Datuen akatsa zifratutako '{0}' fitxategian. Pasahitz okerra?" -02000A95="CRC okerra zifratutako '{0}' fitxategian. Pasahitz okerra?" - -; Password dialog -02000B00="Sartu pasahitza" -02000B01="Sartu pasahitza:" -02000B02="&Erakutsi pasahitza" -02000B03="Pasahitza berriz sartu:" -02000B10="Pasahitzak ez datoz bat" -02000B11="Erabili soilik hizki ingelesak, zenbakiak eta karaktere bereziak (!, #, $, ...) pasahitzetan" -02000B12="Pasahitza luzeegia da" - -; Progress dialog -02000C00="Prozesua" -02000C01="Irangandako denbora:" -02000C02="Falta den denbora:" -02000C03="Neurria:" -02000C04="Abiadura:" -02000C05="Prozesatuta:" -02000C06="Trinkoketa ratioa:" - -02000C10="&Atzealdean" -02000C11="&Aurrealdean" -02000C12="&Eten" -02000C13="&Jarraitu" - -02000C20="Etenda" - -02000C30="Ziur zaude galarazi nahi duzula?" - -; Compress dialog -02000D00="Erantsi artxibura" -02000D01="&Artxibua:" -02000D02="&Eguneratzeko modua:" -02000D03="Artxibu &formatua:" -02000D04="Konpresio &metodoa:" -02000D05="Sortu artxibu &Trinkoak" -02000D06="&Parametroak:" -02000D07="Aukerak" -02000D08="Sortu SF&X artxibua" -02000D09="Harilkatze-anitza" -02000D0A="Zifratu fitxategi &izenak" -02000D0B="Konpresio &maila:" -02000D0C="&Hiztegi neurria:" -02000D0D="&Hitz neurria:" -02000D0E="Konpresiorako Memoria erabilera:" -02000D0F="Deskonpresiorako Memoria erabilera:" -02000D10="Zifraketa" -02000D11="Zifraketa metodoa:" -02000D12="PUZ hari kopurua:" -02000D13="Bloke solidoaren neurria:" -02000D14="Ez-solidoa" -02000D15="Solidoa" -02000D16="Trinkotu partekatutako fitxategiak" - -02000D40="Zatitu &bolumenetan, byte-ak:" -02000D41="Bolumen zati baliogabea" -02000D42="Zehaztutako bolumen neurria: {0} byte.\nZiur zaude artxibua holako bolumenetan zatitu nahi duzula?" - -02000D81="Gorde" -02000D82="Arrunta" -02000D83="Gehienezkoa" -02000D84="Azkarra" -02000D85="Azkarrena" -02000D86="Ultra" - -02000D90="Arakatu" - -02000DA1="Erantsi eta ordezkatu fitxategiak" -02000DA2="Eguneratu eta erantsi fitxategiak" -02000DA3="Berritu existitzen diren fitxategiak" -02000DA4="Fitxategiak sinkronizatu" - -02000DB1="Fitxategi Guztiak" - -02000DC0="Konprimatzen" - -; Columns dialog -02000E00="Zutabeak" -02000E01="Egiaztatu karpeta honetan ikusgarri egin nahi zenituzkeen zutabeak. Erabili Mugitu Gora eta Mugitu Behera botoiak zutabeak berrantolatzeko." -02000E02="Aukeratutako zutabeak izan behar lituzke" -02000E03="pixel &zabalera." - -02000E10="Mugitu &Gora" -02000E11="Mugitu &Behera" -02000E12="&Erakuts" -02000E13="&Ezkutatu" -02000E14="Ezarri" - -02000E81="Izenburua" -02000E82="Zabalera" - -; Testing -02000F90="Egiaztatzen" - - -; File Manager - -03000000="7-Zip Fitxategi Kudeatzailea" - -; Menu -03000102="&Fitxategia" -03000103="&Editatu" -03000104="&Ikusi" -03000105="&Tresnak" -03000106="&Laguntza" -03000107="&Gogokoak" - -; File -03000210="&Ireki" -03000211="Ireki &Barruan" -03000212="Ireki &Kanpoaldean" -03000220="&Ikusi" -03000221="&Editatu" -03000230="&Berrizendatu" -03000231="&Kopiatu Hona..." -03000232="&Mugitu Hona..." -03000233="&Ezabatu" -03000240="&Propietateak" -03000241="&Azalpena" -03000242="Kontroleko batura kalkulatu" -03000250="Karpeta Sortu" -03000251="Fitxategia Sortu" -03000260="&Irten" -03000270="Fitxategia &zatitu..." -03000271="Fitxategiak E&lkartu..." - -; Edit -03000310="&Desegin" -03000311="&Berregin" -03000320="&Ebaki" -03000321="&Kopiatu" -03000322="&Itsatsi" -03000323="E&zabatu" -03000330="&Guztia Aukeratu" -03000331="Guztia Ezaukeratu" -03000332="Aukeraketa &Alderantzikatu" -03000333="Aukeratu..." -03000334="Ezaukeratu..." -03000335="Aukeratu Motaren arabera" -03000336="Ezaukeratu Motaren arabera" - -; View -03000410="Ikono &Haundiak" -03000411="Ikono &Txikiak" -03000412="&Zerrenda" -03000413="&Xehetasunak" -03000420="Antolatugabe" -03000430="Ireki Erroko Karpeta" -03000431="Maila Bat Gora" -03000432="Karpeten Historia..." -03000440="&Freskatu" -03000449="Ikuspegi laua" -03000450="&2 Panel" -03000451="&Tresnabarrak" -03000460="Fitxategi Tresnabarra" -03000461="Tresnabarra Estandarra" -03000462="Botoi Haundiak" -03000463="Erakutsi Testua Botoietan" - -; Tools -03000510="&Aukerak..." -03000511="&Erreferentzi puntua (Benchmark)" - -; Help -03000610="&Edukia..." -03000620="&7-Zip-eri Buruz..." - -; Favorites -03000710="&Erantsi karpeta Gogokoetara honela" -03000720="Liburumarka" - -; Options Dialog - -03010000="Aukerak" - -; Plugins -03010100="Pluginak" -03010101="&Pluginak:" -03010110="Aukerak..." - -; Edit -03010200="Editorea" -03010201="&Editorea:" - -; System -03010300="Sistema" -03010302="Elkartu 7-Zip hauekin:" -03010310="Plugin" - -; Settings -03010400="Ezarpenak" -03010401="Erakutsi \"..\" gaia" -03010402="Erakutsi benetako fitxategi ikonoak" -03010410="Erakutsi sistemaren menua" -03010420="&Lerro oso aukeraketa" -03010421="Erakutsi &saretaren lerroak" -03010430="&Ordezko aukeraketa modua" -03010440="Memoria orrialde &luzeak erabili" - -; Strings - -03020201="Kopiatu" -03020202="Mugitu" -03020203="Kopiatu hona:" -03020204="Mugitu hona:" -03020205="Kopiatzen..." -03020206="Mugitzen..." -03020207="Ezin dituzu mugitu edo kopiatu gaiak horrelako karpetetan." -03020208="Eragiketa ez da onartzen." -03020209="Hautatu helburu karpeta." - -03020210="Onetsi Fitxategi Ezabaketa" -03020211="Onetsi Karpeta Ezabaketa" -03020212="Onetsi Fitxategi Anitzen Ezabaketa" -03020213="Ziur zaude '{0}' ezabatu nahi duzula?" -03020214="Ziur zaude '{0}' karpeta eta bere eduki guztia ezabatu nahi duzula?" -03020215="Ziur zaude {0} gai hauek ezabatu nahi dituzula?" -03020216="Ezabatzen..." -03020217="Akatsa Fitxategia edo Karpeta Ezabatzerakoan" - -03020220="Berrizendatzen..." -03020221="Akatsa Fitxategia edo Karpeta Berrizendatzerakoan" -03020222="Onetsi Fitxategi Kopiaketa" -03020223="Ziur zaude fitxategiak artxibura kopiatu nahi dituzula" - -03020230="Karpeta Sortu" -03020231="Karpeta izena:" -03020232="Karpeta Berria" -03020233="Akatsa Karpeta Sortzerakoan" - -03020240="Fitxategia Sortu" -03020241="Fitxategi Izena:" -03020242="Fitxategi Berria" -03020243="Akatsa Fitxategia Sortzerakoan" - -03020250="Aukeratu" -03020251="Ezaukeratu" -03020252="Maskara:" - -03020260="Karpeten Historia" - -03020280="'{0}' fitxategia aldatu egin da.\nArtxibuan eguneratu nahi duzu?" -03020281="Ezin da fitxategia eguneratu\n'{0}'" -03020282="Ezin da editorea abiatu." -03020283="Irekitzen..." - -03020290="Azalpena" -03020291="&Azalpena:" - -030202A0="Sistema" - -03020300="Konputagailua" -03020301="Sarea" - -03020400="Erantsi" -03020401="Atera" -03020402="Egiaztatu" - -03020420="Kopiatu" -03020421="Mugitu" -03020422="Ezabatu" -03020423="Info" - -03020500="Fitxategia Zatitu" -03020501="&Zatitu hona:" -03020510="Zatitzen..." -03020520="Zatiketa berretsi" -03020521="Ziur zaude fitxategia {0} bolumenetan zatitau nahi duzula?" -03020522="Bolumen neurria jatorrizko fitxategiarena baino txikiago izan behar da" - -03020600="Fitxategiak Elkartu" -03020601="&Elkartu honekin:" -03020610="Elkartzen..." -03020620="Hautau soilik lehenengo fitxategia" - -03020710="Kontroleko batura kalkulatzen..." -03020720="Kontroleko baturaren gaineko informazioa" -03020721="Datuentzako CRC kontroleko batura:" -03020722="Datuak eta izenentzako CRC kontroleko batura:" - -03020800="Aztertzen..." - -03020900="Propietateak" - -; Computer -03031100="Neurri Osoa" -03031101="Leku Askea" -03031102="Cluster Neurria" -03031103="Etiketa" - -; Network -03031200="Bertako Izena" -03031201="Hornitzailea" - -; Benchmark Dialog - -03080000="Erreferentzi puntua (Benchmark)" -03080001="Memoria erabilera:" -03080002="Konprimatzen" -03080003="Deskonprimatzen" -03080004="Abiadura" -03080005="Balorazioa" -03080006="Balorazio Osoa" -03080007="Unekoa" -03080008="Emaitza" -03080009="Zuzenak:" -0308000A="Akatsak:" -0308000B="PUZ erabilera" -0308000C="Balioztatze / Erabilera" - - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ext.txt b/tools/7-Zip/Lang/ext.txt deleted file mode 100644 index dd0c6cd16f..0000000000 --- a/tools/7-Zip/Lang/ext.txt +++ /dev/null @@ -1,512 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by Purgossu -; -; -; -; - -00000000="Extremaduran" -00000001="Estremeñu" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="Cunfigurazión de 7-Zip" - -; Info Page -01000100="Azerca e 7-Zip" -01000103="7-Zip es 'software' libri i a gastus pagus. Peru puei apoyal el desarrollu e 7-Zip meyanti'l rehistru el pograma." -01000104="Soporti" -01000105="Rehistral" - -; Folders Page -01000200="Direhtorius" -01000210="Direhtoriu e labu&tu" -01000211="Direhtoriu temporal del &sistema" -01000212="Direhtoriu &ahtual" -01000213="&Espezifical:" -01000214="Usal sólu pa dispositivus estrayíbris" - -01000281="Espezifical ruta pa ficherus d'archivus temporalis." - -; System Page -01000300="Sistema" -01000301="Integral 7-Zip nel menú contestual" -01000302="Menú contestual en cascá" -01000310="Elementus del menú contestual:" - -; Language Page -01000400="Idioma" -01000401="Idioma:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandus de 7-Zip" -02000103="Abril archivu" -02000104="Abril archivu selezionáu." -02000105="Estrayel ficherus..." -02000106="Estrayel ficherus del archivu selezionáu." -02000107="Añíl al archivu..." -02000108="Añíl lus elementus selezionáus al archivu." -02000109="Comprebal archivu" -0200010A="Comprebal l'integriá l'archivu selezionáu." -0200010B="Estrayel aquina" -0200010C="Estrayel ficherus del archivu selezionáu nel direhtoriu ahtual." -0200010D="Estrayel en {0}" -0200010E="Estrayel ficherus nun sudirehtoriu." -0200010F="Añíl a {0}" -02000110="Añíl lus elementus selezionaus al archivu." -02000111="Comprimil i envial pol correu-e..." -02000112="Comprimil archivus selezionaus nel ficheru i enbialu pol correu-e." -02000113="Comprimil en {0} i enbial pol correu" -02000114="Comprimil elementus selezionaus nel ficheru i enbialu pol correu-e." - -02000140="" -02000141="" - -; Properties -02000203="Ruta" -02000204="Nombri" -02000205="Estensión" -02000206="Direhtoriu" -02000207="Tamañu" -02000208="Tamañu comprimíu" -02000209="Atributus" -0200020A="Creáu'l" -0200020B="Úrtimu azesu" -0200020C="Moificáu'l" -0200020D="Sóliu" -0200020E="Comentáu" -0200020F="Encrihtáu" -02000210="Desapartáu enantis" -02000211="Desapartáu endispués" -02000212="Izionariu" -02000213="CRC" -02000214="Tipu" -02000215="Anti" -02000216="Métou" -02000217="S.O. d'orihin" -02000218="Sistema d'archivus" -02000219="Usuariu" -0200021A="Grupu" -0200021B="Broqui" -0200021C="Comentariu" -0200021D="Posición" -0200021E="Prefiju la ruta" -0200021F="Direhtorius" -02000220="Ficherus" -02000221="Versión" -02000222="Volumin" -02000223="Multivolumin" -02000224="'Offset'" -02000225="Enlazis" -02000226="Broquis" -02000227="Volúmenis" - -; Status bar -02000301="{0} elementu(s) selezionaus" -02000302="{0} elementu(s)" - -02000320="Ficherus:" -02000321="Direhtorius:" -02000322="Tamañu:" -02000323="Tamañu comprimíu:" -02000324="Archivus:" - -; List Context Menu -02000401="&Colunas..." - -02000411="&Abril" -02000412="&Estrayel..." - -; ToolBar -02000501="Estrayel" - -; Messages -02000601="Nu se puei ahtualizal esti tipu d'archivu." -02000602="Nu s'á puíu ahtualizal l'archivu {0}" -02000603="Nu s'á puíu creal el direhtoriu '{0}'" -02000604="Tipu d'archivu nu soportáu." -02000605="Yerru" -02000606="Elementus en demasía" -02000607="Nu ái nengún pograma asoziáu con esta estensión d'archivu" -02000608="Sin yerrus" -02000609="Nu s'á puíu abril '{0}' comu archivu" -0200060A="Nu s'a puíu abril l'archivu encrihtáu '{0}'. Conseña yerrónia?" - -; Dialogs -02000702="Azehtal" -02000705="&Sí" -02000707="Sí &a tó" -02000709="&Nu" -0200070B="Nu a &tó" - -02000710="Canzelal" -02000711="&Canzelal" -02000713="&Fechal" -02000714="Paral" -02000715="Reinizial" - -02000720="Ayúa" - -; Extract dialog -02000800="Estrayel" -02000801="E&strayel a:" -02000802="Conseña" - -02000810="Móu e ruta" -02000811="Ruta compreta" -02000812="Ruta relativa" -02000813="Sin ruta" - -02000820="Móu e sobrescrebil" -02000821="Preguntal enantis" -02000822="Sobrescrebil sin preguntal" -02000823="Conserbal ficherus esistentis" -02000824="Renombral de horma automática" -02000825="Autu-renombral ficherus esistentis" - -02000830="Ficherus" -02000831="Ficherus &selezionaus" -02000832="&Tolos ficherus" - -02000881="Espezifical destinu pa lus ficherus estrayíus." - -02000890="Estrayendu" - -; Overwrite dialog -02000900="Confirmal remprazu de ficherus" -02000901="El direhtoriu ya contieni un ficheru del mesmu nombri." -02000902="Sustituyil el ficheru esistenti" -02000903="pol esti otru?" - -02000911="Eccambial nombri e horma a&utomática" - -02000982="{0} 'bytes'" -02000983="moificáu'l" - -; Messages dialog -02000A00="Mensahis de dianósticu" - -02000A80="Mensahi" - -02000A91="Métou e compresión nu soportáu '{0}'." -02000A92="Yerru e datus en '{0}'. El ficheru está changarráu." -02000A93="Yerru e CRC '{0}'. El ficheru stá changarráu." -02000A94="Yerru e datus nel ficheru encrihtáu '{0}'. Conseña yerrónia?" -02000A95="Yerru e CRC nel ficheru encrihtáu '{0}'. Conseña yerrónia?" - -; Password dialog -02000B00="Introuzil conseña" -02000B01="Introuzil conseña:" -02000B02="Mue&stral conseña" -02000B03="Repitil conseña:" -02000B10="Las cunseñas nu coincín" -02000B11="Usi sólu letras ingresas, númirus i caráhteris especialis (!, #, $, ...) pala conseña" -02000B12="La conseña tieni largura'n demasía" - -; Progress dialog -02000C00="Progresu" -02000C01="Tiempu trascurríu:" -02000C02="Tiempu restanti:" -02000C03="Tamañu total:" -02000C04="Veloziá:" -02000C05="Prucesáu:" -02000C06="Tasa e compresión:" - -02000C10="Se&gundu pranu" -02000C11="&Primel pranu" -02000C12="&Paral" -02000C13="A&continal" - -02000C20="Paráu" - -02000C30="De siguru que quieri canzelal la operazión?" - -; Compress dialog -02000D00="Añíl a archivu" -02000D01="&Archivu:" -02000D02="&Móu d'ahtualizazión:" -02000D03="&Hormatu d'archivu:" -02000D04="Mé&tou e compresión:" -02000D05="&Creal archivu sóliu" -02000D06="&Parámetrus:" -02000D07="Ozionis" -02000D08="Creal archivu 'SF&X'" -02000D09="Multi-ilu" -02000D0A="Encrihtal &nombris de ficheru" -02000D0B="Nive&l de compresión:" -02000D0C="Tamañu el i&zionariu:" -02000D0D="Tama&ñu e parabra:" -02000D0E="Usu e memoria pa compresión:" -02000D0F="Usu e memoria pa dehcompresión:" -02000D10="Encrihtazión" -02000D11="Métou encrihtazión:" -02000D12="Númiru ilus e la UCP:" -02000D13="Tamañu el broqui sóliu:" -02000D14="Nu sóliu" -02000D15="Sóliu" -02000D16="Comprimil ficherus compartíus" - -02000D40="Desapartal en &balandronis, 'bytes':" -02000D41="Tamañu el volumin nu váliu" -02000D42="Introuza'l tamañu el volumin: {0} 'bytes'.\nDe siguru que quieri desapartal l'archivu'n tantus volúmenis?" - -02000D81="Almacenal" -02000D82="Normal" -02000D83="Másima" -02000D84="Respahila" -02000D85="La más respahila" -02000D86="Ultra" - -02000D90="Esproral" - -02000DA1="Añíl i remprazal ficherus" -02000DA2="Ahtualizal i añíl ficherus" -02000DA3="Ahtualizal sólu ficherus esistentis" -02000DA4="Sincronizal ficherus" - -02000DB1="Tolos ficherus" - -02000DC0="Comprimiendu" - -; Columns dialog -02000E00="Colunas" -02000E01="Selezioni las colunas que quiera muestral n'esti direhtoriu. Pa reordinal las colunas usi las tecras AvPg o RePg." -02000E02="La coluna selezioná debi tenel una &anchura e" -02000E03="'pixels'." - -02000E10="Movel pa &zimará" -02000E11="Movel pa em&bahu" -02000E12="Mue&stral" -02000E13="&Escuendel" -02000E14="Fihal" - -02000E81="Títulu" -02000E82="Anchura" - -; Testing -02000F90="Comprebandu" - - -; File Manager - -03000000="7-Zip - hestol de ficherus" - -; Menu -03000102="&Archivu" -03000103="&Eital" -03000104="&Vel" -03000105="&Herramientas" -03000106="A&yúa" -03000107="A&melgaoris" - -; File -03000210="&Abril" -03000211="Abril &dentru" -03000212="Abril &huera" -03000220="&Vel" -03000221="&Eital" -03000230="Renom&bral" -03000231="&Copial a..." -03000232="&Movel pa..." -03000233="&Eliminal" -03000240="P&ropieais" -03000241="Come&ntariu" -03000242="Calculal 'checksum'" -03000250="Creal direhtoriu" -03000251="Creal ficheru" -03000260="&Salil" -03000270="De&sapartal ficheru..." -03000271="Com&binal ficherus..." - -; Edit -03000310="&Deshadel" -03000311="&Rehadel" -03000320="Cor&tal" -03000321="&Copial" -03000322="&Pegal" -03000323="&Eliminal" -03000330="Selezional &tó" -03000331="Deselezional tó" -03000332="&Invertil selezión" -03000333="Selezional..." -03000334="Deselezional..." -03000335="Selezional pol tipu" -03000336="Deselezional pol tipu" - -; View -03000410="Iconus g&randis" -03000411="Iconus caquerus" -03000412="&Listáu" -03000413="&Detallis" -03000420="Nu soportáu" -03000430="Abril direhtoriu raíz" -03000431="Subil un nivel" -03000432="Historial de direhtorius..." -03000440="&Ahtualizal" -03000449="Vista prana" -03000450="&2 panelis" -03000451="Barra e herramien&tas" -03000460="Barra e heramientas 'archivu'" -03000461="Barra e heramientas estándal" -03000462="Botonis grandis" -03000463="Muestral testu enus botonis" - -; Tools -03000510="&Ozionis..." -03000511="Pre&ba el patrón de compresión" - -; Help -03000610="&Conteníus..." -03000620="&Azerca e 7-Zip..." - -; Favorites -03000710="&Añíl direhtoriu a Amelgaoris comu" -03000720="Amelgaol" - -; Options Dialog - -03010000="Ozionis" - -; Plugins -03010100="'Plugins'" -03010101="'&Plugins':" -03010110="Ozionis..." - -; Edit -03010200="Eitol" -03010201="&Eitol:" - -; System -03010300="Sistema" -03010302="Asozial 7-Zip con hormatus:" -03010310="'Plugin'" - -; Settings -03010400="Configurazión" -03010401="Muestral l'elementu \..\"" -03010402="Muestral icunus propius del ficheru" -03010410="Muestral menú el sistema" -03010420="&Selezional fila(s) enteriza(s)" -03010421="Muestral líneas e la &cuairícula" -03010430="Móu e selezión &alternativu" -03010440="Usa&l páhinas de memoria grandis" - -; Strings - -03020201="Copial" -03020202="Movel" -03020203="Copial a:" -03020204="Movel pa:" -03020205="Copiandu..." -03020206="Moviendu..." -03020207="Nu se puein movel u copial elementus pa esti tipu e direhtorius." -03020208="Operazión nu soportá." -03020209="Selezional direhtoriu destinu." - -03020210="Confirmal eliminazión del ficheru" -03020211="Confirmal eliminazión del direhtoriu" -03020212="Confirmal eliminazión de varius ficherus" -03020213="De siguru que quieri eliminal '{0}'?" -03020214="De siguru que quieri eliminal el direhtoriu '{0}' i tol su conteníu?" -03020215="De siguru que quieri eliminal estus {0} elementus?" -03020216="Eliminandu..." -03020217="S'alcuentráu'n yerru al eliminal el ficheru u direhtoriu" - -03020220="Renombrandu..." -03020221="S'alcuentráu'n yerru al renombral el ficheru u direhtoriu" -03020222="Confirmal copia el ficheru" -03020223="De siguru que quieri copiar estus ficherus al archivu?" - -03020230="Creal direhtoriu" -03020231="Nombri e direhtoriu:" -03020232="Nuevu direhtoriu" -03020233="S'alcuentráu'n yerru al creal el direhtoriu" - -03020240="Creal ficheru" -03020241="Nombri el ficheru:" -03020242="Nuevu ficheru" -03020243="S'alcuentráu'n yerru al creal el ficheru" - -03020250="Selezional" -03020251="Deselezional" -03020252="Máscara:" - -03020260="Historial de direhtorius" - -03020280="El ficheru '{0}' á síu moificáu.\nAhtualizalu nel archivu?" -03020281="Nu s'a puíu ahtualizal l'archivu\n'{0}'" -03020282="Nu s'a puíu ehecutal l'eitol." -03020283="Abriendu..." - -03020290="Comentariu" -03020291="&Comentariu:" - -030202A0="Sistema" - -03020300="'Mi PC'" -03020301="'Entorno de red'" - -03020400="Añíl" -03020401="Estrayel" -03020402="Comprebal" - -03020420="Copial" -03020421="Movel" -03020422="Eliminal" -03020423="Inhormazión" - -03020500="Desapartal ficheru" -03020501="&Desapartal a:" -03020510="Desapartandu..." -03020520="Confirmal desapartamientu" -03020521="De siguru que quieri desapartal el ficheru'n {0} volúmenis?" -03020522="El tamañu e lus volúmenis debi sel mas caqueru que'l del ficheru orihinal" - -03020600="Unil ficherus" -03020601="&Unil en:" -03020610="Uniendu..." -03020620="Selezional sólu'l primel ficheru" - -03020710="Calculandu'l 'checksum'..." -03020720="Inhormazión de 'checksum'" -03020721="'Checksum' de 'CRC' pala inhormazión:" -03020722="'Checksum' de 'CRC' pala inhormazión i lus nombris:" - -03020800="Escaneandu..." - -03020900="Propieais" - -; Computer -03031100="Tamañu total" -03031101="Espaziu dispunibri" -03031102="Tamañu el 'cluster'" -03031103="Etiqueta" - -; Network -03031200="Nombri local" -03031201="Proveol" - -; Benchmark Dialog - -03080000="'Benchmark'" -03080001="Usu e memoria:" -03080002="Comprimiendu" -03080003="Comprimiendu" -03080004="Veloziá" -03080005="Razón" -03080006="Razón total" -03080007="Ahtual" -03080008="Resurtáu" -03080009="Pasis:" -0308000A="Yerrus:" -0308000B="Usu e CPU" -0308000C="Razón / Usu" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/fa.txt b/tools/7-Zip/Lang/fa.txt deleted file mode 100644 index a635211904..0000000000 --- a/tools/7-Zip/Lang/fa.txt +++ /dev/null @@ -1,512 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by Edris Naderan -; Changed and updated by Mehdi Farhadi (since 4.30) -; -; -; - -00000000="Farsi" -00000001="فارسی" -00000002="41" - -; 7-Zip Configuration - -; Title -01000000="پیکربندی ‎7-Zip" - -; Info Page -01000100="درباره ‎7-Zip" -01000103="برنامه‌ای که در پیش رو دارید یک برنامه مجانی است، اما شما می توانید با پرداخت مبلغی جزئی به توسعه این نرم‌افزار کمک کنید." -01000104="پشتيباني" -01000105="ثبت کردن" - -; Folders Page -01000200="پوشه‌ها" -01000210="پوشه در حال کار" -01000211="پوشه موقت سیستم" -01000212="جاری" -01000213="تعیین:" -01000214="فقط برای درایوهای قابل جابجایی استفاده شود" - -01000281="جهت ذخیره فایل‌های موقتی مکانی را تعیین کنید." - -; System Page -01000300="سیستم" -01000301="نمایش گزینه‌های مربوط به فشرده‌سازی در منوی ویندوز" -01000302="نمایش همه گزینه‌ها در یک زیرمنو" -01000310="گزینه‌های منو:" - -; Language Page -01000400="زبان" -01000401="زبان:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="فرمان‌های ‎7-Zip" -02000103="بازکردن آرشیو" -02000104="آرشیو انتخاب شده را باز می‌کند." -02000105="استخراج فایل‌ها..." -02000106="فایل‌ها را از آرشیو انتخاب شده استخراج می‌کند." -02000107="افزودن به آرشیو..." -02000108="گزینه‌های انتخاب شده را به آرشیو اضافه می‌کند." -02000109="بررسی آرشیو" -0200010A="جامعیت آرشیو انتخاب شده را بررسی می‌کند." -0200010B="استخراج در اینجا" -0200010C="فایل‌ها را از آرشیو انتخاب شده به پوشه جاری استخراج می‌کند." -0200010D="استخراج به {0}" -0200010E="فایل‌ها را به زیرپوشه استخراج می‌کند." -0200010F="افزودن به {0}" -02000110="گزینه‌های انتخاب شده را به آرشیو اضافه می‌کند." -02000111="فشرده‌سازی و ارسال با ایمیل..." -02000112="گزینه‌های انتخاب شده را فشرده‌ می‌سازد و آرشیو را توسط ایمیل ارسال می‌کند." -02000113="فشرده‌سازی در {0} و ارسال با ایمیل" -02000114="گزینه‌های انتخاب شده را فشرده‌ می‌سازد و آرشیو را توسط ایمیل ارسال می‌کند." - -02000140="<پوشه>" -02000141="<آرشیو>" - -; Properties -02000203="مسیر" -02000204="نام" -02000205="Extension" -02000206="پوشه" -02000207="اندازه" -02000208="اندازه فشرده" -02000209="صفات" -0200020A="ساخته شده" -0200020B="دستیابی شده" -0200020C="تغییر یافته" -0200020D="Solid" -0200020E="توضیح‌دار" -0200020F="رمزگذاری شده" -02000210="قسمت قبلی" -02000211="قسمت بعدی" -02000212="لغت‌نامه" -02000213="CRC" -02000214="نوع" -02000215="Anti" -02000216="روش" -02000217="سیستم میزبان" -02000218="سیستم فایل" -02000219="کاربر" -0200021A="گروه" -0200021B="قطعه" -0200021C="توضيح‌" -0200021D="مکان" -0200021E="پيشوند مسير" -0200021F="پوشه‌ها" -02000220="فایل‌ها" -02000221="Version" -02000222="Volume" -02000223="Multivolume" -02000224="Offset" -02000225="Links" -02000226="قطعات" -02000227="Volumes" - -; Status bar -02000301="{0} گزینه انتخاب شده" -02000302="{0} گزینه" - -02000320="فایل‌ها:" -02000321="پوشه‌ها:" -02000322="اندازه:" -02000323="اندازه فشرده:" -02000324="آرشیو‌ها:" - -; List Context Menu -02000401="ستون‌ها..." - -02000411="بازکردن" -02000412="استخراج..." - -; ToolBar -02000501="استخراج" - -; Messages -02000601="عملیات بروزرسانی برای این آرشیو پشتیبانی نمی‌شود." -02000602="بروز رسانی آرشیو {0} ممکن نیست" -02000603="ایجاد پوشه '{0}' ممکن نیست" -02000604="اين فایل یک آرشیو پشتیبانی شده نيست." -02000605="خطا" -02000606="تعداد گزینه‌ها بسیار زیاد است" -02000607="هیچ برنامه‌ای برای باز کردن این فایل منتسب نشده است" -02000608="خطایی وجود ندارد" -02000609="فايل '{0}' يك آرشيو شناخته شده نيست" -0200060A="برنامه قادر به بازكردن آرشيو رمزگذارى شده '{0}' نيست. كلمه عبور اشتباه است؟" - -; Dialogs -02000702="تایید" -02000705="&بلی" -02000707="بلی همه را" -02000709="&خیر" -0200070B="خیر هیچ کدام" - -02000710="انصراف" -02000711="انصراف" -02000713="بستن" -02000714="توقف" -02000715="اجرای مجدد" - -02000720="راهنما" - -; Extract dialog -02000800="استخراج" -02000801="استخراج به:" -02000802="کلمه عبور" - -02000810="نوع مسیر" -02000811="نام کامل مسیر" -02000812="نام مسیر جاری" -02000813="بدون نام مسیر" - -02000820="شيوه جایگزینی" -02000821="قبل از جایگزینی سوال شود" -02000822="جایگزینی بدون اخطار" -02000823="نادیده گرفتن فایل‌های موجود" -02000824="تغییر نام خودکار" -02000825="تغییر نام خودکار فایل‌های موجود" - -02000830="فایل‌ها" -02000831="فایل‌های انتخاب شده" -02000832="همه فایل‌ها" - -02000881="مکانی را جهت استخراج فایل‌ها تعیین کنيد." - -02000890="در حال استخراج" - -; Overwrite dialog -02000900="تایید جایگزینی فایل" -02000901="پوشه مقصد حاوی فایلی با نام فایل در حال پردازش می‌باشد." -02000902="آیا شما مایل به جایگزینی این فایل" -02000903="با این فایل هستید؟" - -02000911="تغییر نام خودکار" - -02000982="{0} بایت" -02000983="تغییر کرده در" - -; Messages dialog -02000A00="پیغام‌های تشخيصی" - -02000A80="پیغام" - -02000A91="روش فشرده‌سازی پشتیبانی نشده برای '{0}'." -02000A92="خطای داده‌ها در '{0}'. اين فايل دچار مشكل است." -02000A93="خطای CRC در '{0}'. اين فايل دچار مشكل است." -02000A94="خطای داده‌ها در فايل رمزگذارى شده '{0}'. كلمه عبور اشتباه است؟" -02000A95="خطای CRC در فايل رمزگذارى شده '{0}'. كلمه عبور اشتباه است؟" - -; Password dialog -02000B00="کلمه عبور" -02000B01="کلمه عبور:" -02000B02="نمایش کلمه عبور" -02000B03="تكرار كلمه عبور:" -02000B10="دو كلمه عبور يكسان نيستند" -02000B11="فقط از حروف انگليسى، اعداد و علامت‌هاى خاص (!، #، $، ...) در كلمه عبور استفاده كنيد" -02000B12="كلمه عبور خيلی بلند است" - -; Progress dialog -02000C00="پردازش" -02000C01="زمان سپری شده:" -02000C02="زمان باقی مانده:" -02000C03="اندازه:" -02000C04="سرعت:" -02000C05="پردازش شده:" -02000C06="نسبت فشردگى:" - -02000C10="پس زمینه" -02000C11="پیش زمینه" -02000C12="توقف" -02000C13="ادامه" - -02000C20="متوقف" - -02000C30="آیا شما قصد لغو عملیات را دارید؟" - -; Compress dialog -02000D00="افزودن به آرشیو" -02000D01="آرشیو:" -02000D02="شيوه بروزرسانی:" -02000D03="قالب آرشیو:" -02000D04="روش فشرده‌سازی:" -02000D05="ایجاد آرشیو يکپارچه (&Solid)" -02000D06="پارامترها" -02000D07="تنظیمات" -02000D08="ایجاد آرشیو قابل اجرا (SF&X)" -02000D09="Multi-threading" -02000D0A="رمزگذاری نام فایل‌ها" -02000D0B="ميزان فشرده‌سازی:" -02000D0C="اندازه لغت‌نامه:" -02000D0D="اندازه کلمه:" -02000D0E="مقدار حافظه لازم جهت فشرده‌سازی:" -02000D0F="مقدار حافظه لازم جهت استخراج:" -02000D10="رمزگذاری" -02000D11="شيوه رمزگذاری:" -02000D12="Number of CPU threads:" -02000D13="Solid block size:" -02000D14="Non-solid" -02000D15="Solid" -02000D16="فشرده‌سازی فایل‌هاى در حال استفاده ديگر برنامه‌ها" - -02000D40="تقسیم به چندين قسمت، بر حسب بايت:" -02000D41="اندازه تقسیم نادرست است" -02000D42="اندازه تقسیم تعيين شده: {0} بايت.\nآیا شما قصد دارید آرشيو را به قسمتهاى به اين اندازه تقسيم كنيد؟" - -02000D81="ذخیره" -02000D82="متوسط" -02000D83="حداکثر" -02000D84="سریع" -02000D85="خیلی سریع" -02000D86="مافوق" - -02000D90="آدرس‌دهی" - -02000DA1="افزودن و جایگزینی فایل‌ها" -02000DA2="بروزرسانی و افزودن فایل‌ها" -02000DA3="تازه کردن فایل‌های موجود" -02000DA4="سنکرون کردن فایل‌ها" - -02000DB1="همه فایل‌ها" - -02000DC0="فشرده‌سازی" - -; Columns dialog -02000E00="ستون‌ها" -02000E01="ستون‌هایی را که می‌خواهید نمایش داده شوند انتخاب کنید. از کليدهای انتقال به بالا و پایین برای جابجایی ستون‌ها استفاده کنيد." -02000E02="ستون‌ انتخاب شده باید" -02000E03="پیکسل عرض داشته باشد." - -02000E10="انتقال به بالا" -02000E11="انتقال به پایین" -02000E12="نمایش" -02000E13="مخفی" -02000E14="Set" - -02000E81="عنوان" -02000E82="عرض" - -; Testing -02000F90="بررسی" - - -; File Manager - -03000000="برنامه مدیریت فایل ‎7-Zip" - -; Menu -03000102="فایل" -03000103="ویرایش" -03000104="نمایش" -03000105="ابزارها" -03000106="راهنما" -03000107="برگزیده‌ها" - -; File -03000210="باز کردن" -03000211="باز کردن درونی" -03000212="باز کردن بیرونی" -03000220="نمایش" -03000221="ویرایش" -03000230="تغییر نام" -03000231="کپی به..." -03000232="انتقال به..." -03000233="حذف" -03000240="اطلاعات" -03000241="توضيح" -03000242="محاسبه checksum" -03000250="ایجاد پوشه" -03000251="ایجاد فایل" -03000260="خروج" -03000270="تقسیم فایل..." -03000271="ترکیب فایل‌ها..." - -; Edit -03000310="عقب" -03000311="جلو" -03000320="بریدن" -03000321="کپی" -03000322="چسباندن" -03000323="حذف" -03000330="انتخاب همه" -03000331="لغو انتخاب‌ها" -03000332="معکوس كردن انتخاب‌ها" -03000333="انتخاب..." -03000334="لغو انتخاب..." -03000335="انتخاب بر حسب نوع" -03000336="لغو انتخاب بر حسب نوع" - -; View -03000410="آیکون‌های بزرگ" -03000411="آیکون‌های کوچک" -03000412="فهرست‌وار" -03000413="با جزئیات" -03000420="نامرتب" -03000430="باز کردن شاخه اصلی" -03000431="یک مرحله به بالا" -03000432="تاریخچه پوشه‌ها..." -03000440="از نو چیدن" -03000449="Flat View" -03000450="2 پانل" -03000451="منوهای ابزار" -03000460="منوی ابزار آرشیو" -03000461="منوی ابزار استانداد" -03000462="کلید‌های بزرگ" -03000463="نمایش برچسب کلید‌ها" - -; Tools -03000510="تنظیمات..." -03000511="سنجش" - -; Help -03000610="محتویات..." -03000620="درباره ‎7-Zip..." - -; Favorites -03000710="افزودن پوشه به برگزیده‌ها به عنوان" -03000720="علامت" - -; Options Dialog - -03010000="تنظیمات" - -; Plugins -03010100="ماژول‌ها" -03010101="ماژول‌ها:" -03010110="تنظیمات..." - -; Edit -03010200="ویرایشگر" -03010201="ویرایشگر:" - -; System -03010300="سیستم" -03010302="انتساب ‎7-Zip با:" -03010310="مودول" - -; Settings -03010400="تنظیمات" -03010401="نمایش گزینه \"..\"" -03010402="نمایش آیکون واقعی فایل‌ها" -03010410="نمایش منوی سیستم" -03010420="انتخاب سطر به صورت کامل" -03010421="نمایش خطوط جدولی" -03010430="شيوه انتخاب جايگزين" -03010440="استفاده از شیوه حافظه هنگفت" - -; Strings - -03020201="کپی" -03020202="انتقال" -03020203="کپی به:" -03020204="انتقال به:" -03020205="در حال کپی..." -03020206="در حال انتقال..." -03020207="شما نمی‌توانید گزینه‌هایی را در پوشه خودشان کپی کنید یا انتقال دهید." -03020208="عملیات پشتیبانی نمی‌شود." -03020209="پوشه مقصد را انتخاب كنيد." - -03020210="تایید حذف فایل" -03020211="تایید حذف پوشه" -03020212="تایید حذف فایل‌ها" -03020213="آیا شما قصد دارید '{0}' را حذف کنید؟" -03020214="آیا شما قصد دارید پوشه '{0}' و تمام محتویات آن را حذف کنید؟" -03020215="آیا شما قصد دارید اين '{0}' گزینه را حذف کنید؟" -03020216="در حال حذف..." -03020217="خطا هنگام حذف فایل یا پوشه" - -03020220="تغییر نام..." -03020221="خطای تغییر نام فایل یا پوشه" -03020222="تایید کپی فایل" -03020223="آیا شما قصد دارید فایل‌ها را به آرشیو کپی کنید" - -03020230="ایجاد پوشه" -03020231="نام پوشه:" -03020232="پوشه جدید" -03020233="خطای ایجاد پوشه" - -03020240="ایجاد فایل" -03020241="نام فایل:" -03020242="فایل جدید" -03020243="خطای ایجاد فایل" - -03020250="انتخاب" -03020251="لغو انتخاب" -03020252="ماسك:" - -03020260="تاریخچه پوشه‌ها" - -03020280="فایل '{0}' تغییر کرده است.\n آیا میل دارید فایل مذکور در آرشیو بروزرسانی شود؟" -03020281="این فایل قابل بروزرسانی نمی‌باشد\n'{0}'" -03020282="ویرایشگر اجرا نمی‌شود." -03020283="در حال باز کردن..." - -03020290="توضيح" -03020291="توضيح:" - -030202A0="سیستم" - -03020300="کامپیوتر" -03020301="شبکه" - -03020400="افزودن" -03020401="استخراج" -03020402="بررسی" - -03020420="کپی" -03020421="انتقال" -03020422="حذف" -03020423="اطلاعات" - -03020500="تقسیم فایل" -03020501="تقسیم درون:" -03020510="در حال تقسیم..." -03020520="تاييد تقسیم فایل" -03020521="آیا شما قصد دارید اين فايل را به {0} قسمت تقسيم كنيد؟" -03020522="اندازه قسمت‌ها بايد كوچكتر از اندازه فايل اصلى باشد" - -03020600="ترکیب فایل‌ها" -03020601="ترکیب درون:" -03020610="در حال ترکیب..." -03020620="فقط اولين فايل را انتخاب كنيد" - -03020710="در حال محاسبه Checksum..." -03020720="اطلاعات Checksum" -03020721="CRC checksum for data:" -03020722="CRC checksum for data and names:" - -03020800="در حال پويش..." - -03020900="مشخصات" - -; Computer -03031100="اندازه کل" -03031101="فضای خالی" -03031102="سایز کلاستر" -03031103="برچسب" - -; Network -03031200="نام محلی" -03031201="مهياكننده" - -; Benchmark Dialog - -03080000="سنجش" -03080001="حافظه مصرفی:" -03080002="فشرده‌سازی" -03080003="استخراج" -03080004="سرعت" -03080005="درجه‌بندی" -03080006="درجه‌بندی کلی" -03080007="جاری" -03080008="دستاورد" -03080009="تعداد عبور:" -0308000A="خطاها:" -0308000B="CPU Usage" -0308000C="Rating / Usage" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/fi.txt b/tools/7-Zip/Lang/fi.txt deleted file mode 100644 index 9112b17492..0000000000 --- a/tools/7-Zip/Lang/fi.txt +++ /dev/null @@ -1,544 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.57 -; Translated by Ari Ryynanen -; Updated by Jarko P. (3.08.04 beta -->4.30) -; Updated by Juhani Valtasalmi (4.30 --> 4.42) -; Updated with light modifications by T.Sakkara (4.42 --> 9.07 beta) 1.9.2009 -; - -00000000="Finnish" -00000001="Suomi" -00000002="11" - -; 7-Zip Asetukset - -; Title -01000000="Lisäsetukset" - -; Info Page; Tietoja Ohjelmasta -01000100="Tietoja" -01000103="7-Zip on ilmainen ohjelmisto. Halutessasi voit kuitenkin tukea kehitystyötä rekisteröitymällä." -01000104="Tuki (engl.)" -01000105="Rekisteröidy (engl.)" - -; Folders Page; Asetukset/Kansiot -01000200="Kansiot" -01000210="&Työkansio" -01000211="&Järjestelmän väliaikaiskansio" -01000212="&Nykyinen kansio" -01000213="&Valittu kansio:" -01000214="Käytä vain siirrettäville tietovälineille" - -01000281="Määritä väliaikaistiedostojen sijainti." - -; System Page; Asetukset/Järjestelmäliitännät -01000300="Järjestelmä" -01000301="Liitä 7-Zip järjestelmän valikoihin." -01000302="Ryhmitetty järjestelmävalikko" -01000310="Järjestelmävalikon sisältö:" - -; Language Page; Asetukset/Kieli -01000400="Kieli" -01000401="Kieli:" - - -; 7-Zip Explorer extension; 7-Zip Järjestelmäkytkennät - -; Context menu; Järjestelmämenu -02000101="7-Zip" -02000102="7-Zip komennot" -02000103="Avaa" -02000104="Avaa valittu paketti." -02000105="Purkaa..." -02000106="Purkaa valitun paketin." -02000107="Lisää pakettiin..." -02000108="Lisää tiedostot valittuun pakettiin." -02000109="Eheystarkastus" -0200010A="Tarkistaa valitun paketin eheyden." -0200010B="Purkaa tänne" -0200010C="Purkaa tiedostot valitusta paketista nykyiseen kansioon." -0200010D="Purkaa kansioon {0}" -0200010E="Purkaa tiedostot alikansioon." -0200010F="Lisää pakettiin {0}" -02000110="Lisää valitut tiedostot pakettiin." -02000111="Pakkaa tiedostot ja lähetä..." -02000112="Pakkaa valitut ja lähetä sähköpostilla." -02000113="Lisää pakettiin {0} ja lähetä" -02000114="Lisää valitut tiedostot pakettiin ja lähetä sähköpostilla." - -02000140="" -02000141="" - -; Properties; Ominaisuudet -02000203="Polku" -02000204="Nimi" -02000205="Tiedostomuoto" -02000206="Kansio" -02000207="Koko" -02000208="Pakattu koko" -02000209="Määritteet" -0200020A="Luotu" -0200020B="Käytetty" -0200020C="Muokattu" -0200020D="Kiinteä" -0200020E="Kommentoitu" -0200020F="Suojaus" -02000210="Pilko ennen" -02000211="Pilko jälkeen" -02000212="Sanakirja" -02000213="CRC" -02000214="Tyyppi" -02000215="Anti" -02000216="Menetelmä" -02000217="Isäntäjärjestelmä" -02000218="Tiedostojärjestelmä" -02000219="Käyttäjä" -0200021A="Ryhmä" -0200021B="Lohko" -0200021C="Kuvaus" -0200021D="Kohta" -0200021E="Polun etuliite" -0200021F="Kansioita" -02000220="Tiedostoja" -02000221="Versio" -02000222="Nimi" -02000223="Pilkottu" -02000224="Siirtymä" -02000225="Linkit" -02000226="Lohkot" -02000227="Nimet" - -02000229="64-bittinen" -0200022A="Koodaus: UCS Big-endian" -0200022B="Suoritin" -0200022C="Fyysinen koko" -0200022D="Otsikon koko" -0200022E="Tarkistussumma" -0200022F="Ominaisuudet" -02000230="Virtuaaliosoite" -02000231="ID" -02000232="Lyhytnimi" -02000233="Creator Application" -02000234="Sektorikoko" -02000235="Moodi" -02000236="Linkki" - -; Status bar; Tilarivi -02000301="{0} tiedosto(a) valittu" -02000302="{0} tiedosto(a)" - -02000320="Tiedostoja:" -02000321="Kansioita:" -02000322="Koko:" -02000323="Pakattu koko:" -02000324="Paketteja:" - -; List Context Menu -02000401="&Sarakkeet..." - -02000411="&Avaa" -02000412="&Purkaa..." - -; ToolBar; Työkalut -02000501="Purkaa" - -; Messages; Viestit -02000601="Tätä pakettia ei voi päivittää." -02000602="Pakettia '{0}' ei voida päivittää." -02000603="Ei voida luoda kansioita '{0}.'" -02000604="Tiedoston pakkaustapaa ei tueta." -02000605="Virhe!" -02000606="Liian monta kohdetta." -02000607="Tiedostotyyppiin ei ole liitetty mitään ohjelmaa." -02000608="Ei virheitä." -02000609="Tiedoston '{0}' pakkausta ei voi purkaa." -0200060A="Ei voi avata suojattua pakettia '{0}'. Onko salasana oikea?" -0200060B="Ei riittävästi muistia toimintoa varten" -0200060C="Tuntematon virhe" -0200060D="Pakkaustapaa ei tueta" - -; Dialogs; Ikkunat -02000702="OK" -02000705="&Kyllä" -02000707="Kyllä k&aikkiin" -02000709="&Ei" -0200070B="E&i kaikkiin" - -02000710="Peruuta" -02000711="&Peruuta" -02000713="&Sulje" -02000714="Pysäytä" -02000715="Aloita uudelleen" - -02000720="Ohje" - -; Extract dialog; Purkuikkuna -02000800="Purkaa" -02000801="&Purkaa kansioon" -02000802="Salasana" - -02000810="Polkujen sisällytys:" -02000811="Sisällytä koko polku" -02000812="Nykyiset nimet" -02000813="Älä sisällytä polkuja" - -02000820="Samannimiset tiedostot:" -02000821="Kysy tapauskohtaisesti" -02000822="Korvaa" -02000823="Ohita" -02000824="Uudelleennimeä" -02000825="Uudelleennimeä aiemmat" - -02000830="Tiedostot" -02000831="&Valitut" -02000832="&Kaikki" - -02000881="Purkaa kansioon" - -02000890="Puretaan paketti" - -; Overwrite dialog; Korvausikkuna -02000900="Vahvista tiedoston korvaus" -02000901="Tämä kansio sisältää jo samannimisen tiedoston." -02000902="Haluatko korvata tiedoston" -02000903="tällä tiedostolla?" - -02000911="&Uudelleennimeä automaattisesti" - -02000982="{0} tavua" -02000983="muokattu" - -; Viesti-ikkuna -02000A00="Tietoja" - -02000A80="Viesti" - -02000A91="Tukematon pakkausmenetelmä tiedostolle '{0}'." -02000A92="Tietovirhe tiedostossa '{0}'. Tiedosto on viottunut." -02000A93="Tiedoston '{0}' eheystarkistus epäonnistui. Tiedosto on vioittunut." -02000A94="Virhe avattaessa suojattua pakettia '{0}'. Onko salasana oikea?" -02000A95="CRC-virhe avattaessa suojattua pakettia '{0}'. Onko salasana oikea?" - -; Salasanaikkuna -02000B00="Anna salasana" -02000B01="Anna salasana:" -02000B02="Näytä &salasana" -02000B03="Toista salasana:" -02000B10="Salasanat eivät täsmää" -02000B11="Salasanassa voi käyttää numeroita ja erikoismerkkejä, mutta EI skandinaavisia kirjaimia." -02000B12="Liian pitkä salasana" - -; Progress dialog; Edistymisikkuna -02000C00="Käsitellään" -02000C01="Aikaa kulunut:" -02000C02="Aikaa jäljellä:" -02000C03="Koko:" -02000C04="Nopeus:" -02000C05="Käsitelty:" -02000C06="Pakkaussuhde:" - -02000C10="&Tausta-ajona" -02000C11="&Normaali prioriteetti" -02000C12="&Pysäytä" -02000C13="&Jatka" - -02000C20="Pysäytetty" - -02000C30="Keskeytetäänkö toiminto?" - -; Compress dialog; Pakkausikkuna -02000D00="Lisää pakettiin" -02000D01="&Paketti:" -02000D02="&Päivitystapa:" -02000D03="Pakkaus&:" -02000D04="Pakkaus&menetelmä:" -02000D05="Luo Kiinte&ä paketti" -02000D06="&Parametrit:" -02000D07="Asetukset" -02000D08="Luo itsepurkautuva paketti" -02000D09="Prosessorisäikeet" -02000D0A="Tiedosto&nimien suojaus" -02000D0B="Pakkauksen &taso:" -02000D0C="&Sanakirjan koko:" -02000D0D="&Sanan koko:" -02000D0E="Pakkauksessa tarvittava muistimäärä:" -02000D0F="Purkauksessa tarvittava muistimäärä:" -02000D10="Suojaus" -02000D11="Salausalgoritmi" -02000D12="Prosessorisäikeet" -02000D13="Kiinteä lohkokoko" -02000D14="Muuttuva" -02000D15="Kiinteä" -02000D16="Pakkaa yhteiset tiedostot" - -02000D40="&Osien koko pilkottaessa:" -02000D41="Pilkotun osan koko epäkelpo" -02000D42="Pilkottavien osien koko: {0} tavua.\nPilkotaanko paketti edellämainitun kokoisiin osiin?" - -02000D81="Ei pakkausta" -02000D82="Normaali" -02000D83="Täysi" -02000D84="Nopea" -02000D85="Nopein" -02000D86="Ultra" - -02000D90="Selaa" - -02000DA1="Lisää ja korvaa tiedostoja" -02000DA2="Päivitä ja lisää tiedostoja" -02000DA3="Päivitä olemassaolevat tiedostot" -02000DA4="Synkronoi tiedostot" - -02000DB1="Kaikki tiedostot" - -02000DC0="Lisätään pakettiin" - -; Columns dialog; Sarakeikkuna -02000E00="Sarakkeet" -02000E01="Valitse tässä kansiossa näytettävät sarakkeet. Käytä uudelleenjärjestelyyn painikkeita 'Siirrä ylös' ja 'Siirrä alas'" -02000E02="Aseta valitun sarakkeen &leveydeksi" -02000E03="pikseliä." - -02000E10="Siirrä &ylös" -02000E11="Siirrä &alas" -02000E12="&Näytä" -02000E13="&Piilota" -02000E14="Aseta" - -02000E81="Otsikko" -02000E82="Leveys" - -; Tarkistus -02000F90="Eheystarkistus" - - -; File Manager; Tiedostonhallinta - -03000000="7-Zip Tiedostonhallinta" - -; Menu; Päävalikko -03000102="&Tiedosto" -03000103="&Muokkaa" -03000104="&Näytä" -03000105="Työ&kalut" -03000106="&Ohje" -03000107="&Suosikit" - -; File; Tiedosto-valikko -03000210="&Avaa" -03000211="Avaa sisäisesti" -03000212="Avaa &ulkoisesti" -03000220="&Näytä" -03000221="&Muokkaa" -03000230="Nim&eä uudelleen" -03000231="&Kopioi..." -03000232="&Siirrä..." -03000233="&Poista" -03000240="Ominais&uudet" -03000241="Ku&vaus" -03000242="Laske tarkistussummat" -03000243="Eroavaisuudet" -03000250="Luo kansio" -03000251="Luo tiedosto" -03000260="&Lopeta" -03000270="&Pilko tiedosto..." -03000271="&Yhdistä pilkotut..." - -; Edit; Muokkaa-valikko -03000310="&Kumoa" -03000311="&Toista" -03000320="&Leikkaa" -03000321="K&opioi" -03000322="L&iitä" -03000323="&Poista" -03000330="V&alitse kaikki" -03000331="Poista &valinnat" -03000332="&Käänteinen valinta" -03000333="Valitse..." -03000334="Poista valinta..." -03000335="Valitse tyypin mukaan" -03000336="Poista valinnat tyypin mukaan" - -; View; Näytä-valikko -03000410="Suu&ret kuvakkeet" -03000411="&Pienet kuvakkeet" -03000412="&Luettelo" -03000413="&Tiedot" -03000420="Alkuperäinen järjestys" -03000430="Avaa pääkansio" -03000431="Avaa yläkansio" -03000432="Kansiohistoria..." -03000440="P&äivitä" -03000449="Kansioiden sisältö luetteloituna" -03000450="&Kaksi panelia" -03000451="&Työkalupalkki" -03000460="Pakettipalkki" -03000461="Vakiopalkki" -03000462="Suuret painikkeet" -03000463="Näytä painikkeiden tekstit" - -; Tools; Työkalut-valikko -03000510="&Asetukset..." -03000511="&Nopeustesti" - -; Help; Ohje-valikko -03000610="&Sisältö..." -03000620="&Tietoja ohjelmasta" - -; Favorites; Suosikit -03000710="&Lisää Suosikit-kansioon" -03000720="Kirjanmerkki" - -; Options Dialog; Asetukset-ikkuna - -03010000="Asetukset" - -; Plugins; Lisäosat -03010100="Lisäosat" -03010101="&Lisäosat:" -03010110="Lisäsetukset..." - -; Edit; Muokkaus -03010200="Muokkausohjelmat" -03010201="&Tekstieditori:" -03010202="&Eroavaisuuksien etsintä:" - -; System; Järjestelmäliitännät -03010300="Järjestelmäliitännät" -03010302="Liitä 7-Zip seuraaviin tiedostotyypeihin:" -03010310="Lisäosa" - -; Settings; Asetukset -03010400="Tiedostoikkuna" -03010401="Näytä &yläkansion symboli" -03010402="Näytä &aidot tiedostokuvakkeet" -03010410="Näytä &järjestelmävalikko" -03010420="&Valitse koko rivi" -03010421="Näytä &ruudukko" -03010422="Avaa &kertanapsautuksella" -03010430="Vaihtoehtoinen valintojen &esitystapa" -03010440="Käytä &suuria muistisivuja" - -; Strings; Merkkijonot - -03020201="Kopioi" -03020202="Siirrä" -03020203="Kopioi kansioon:" -03020204="Siirrä kansioon:" -03020205="Kopioidaan..." -03020206="Siirretään..." -03020207="Ei voida siirtää tai kopioida tiedostoja kyseiseen kansioon." -03020208="Toiminto ei ole tuettu." -03020209="Valitse kohdekansio." - -03020210="Vahvista tiedoston poisto" -03020211="Vahvista kansion poisto" -03020212="Vahvista useiden kohteiden poisto" -03020213="Poistetaanko tiedosto '{0}'?" -03020214="Poistetaanko kansio '{0}' ja kaiken sen sisällön?" -03020215="Poistetaanko nämä {0} kohdetta?" -03020216="Poistetaan..." -03020217="Virhe poistettaessa tiedostoa tai kansiota" -03020218="Roskakoriin ei voida siirtää tiedostoa, jolla on pitkä nimi" - -03020220="Nimetään uudelleen..." -03020221="Virhe uudelleennimettäessä tiedostoa tai kansiota" -03020222="Vahvista tiedoston kopioiminen" -03020223="Kopioidaanko tiedostot pakettiin?" - -03020230="Luo uusi kansio" -03020231="Kansion nimi:" -03020232="Uusi kansio" -03020233="Virhe luotaessa kansiota" - -03020240="Luo uusi tiedosto" -03020241="Tiedostonimi:" -03020242="Uusi tiedosto" -03020243="Virhe luotaessa tiedostoa" - -03020250="Valitse" -03020251="Poista valinta" -03020252="Maski:" - -03020260="Kansiohistoria" - -03020280="Tiedostoa '{0}' on muutettu.\nHaluatko päivittää paketin?" -03020281="Ei voida päivittää tiedostoa \n'{0}'." -03020282="Editoria ei voida käynnistää." -03020283="Avataan..." -03020284="Tiedosto vaikuttaa haittaohjelmalta, sillä sen nimi sisältää peräkkäisiä välilyöntejä." - -03020290="" -03020291="&Kuvaus:" - -030202A0="Järjestelmä" - -03020300="Tietokone" -03020301="Verkko" -03020302="Dokumentit" - -03020400="Lisää" -03020401="Purkaa" -03020402="Tarkista eheys" - -03020420="Kopioi" -03020421="Siirrä" -03020422="Poista" -03020423="Ominaisuudet" - -03020500="Pilko tiedosto" -03020501="&Pilko kansioon:" -03020510="Pilkotaan..." -03020520="Vahvista pilkkominen" -03020521="Pilkotaanko tiedosto {0} osaan?" -03020522="Pilkotun osan koon pitää olla pienempi kuin alkuperäisen tiedoston." - -03020600="Yhdistä pilkotut tiedostot" -03020601="&Yhdistä kansioon:" -03020610="Yhdistetään..." -03020620="Valitse vain ensimmäinen tiedosto" -03020621="Tiedostoa ei tunnisteta pilkotuksi" -03020622="Vain yksi pilkottu osatiedosto löytyi" - -03020710="Laskee tarkistussummaa..." -03020720="Tarkistussummat" -03020721="Sisällön CRC-tarkistussumma:" -03020722="Sisällön ja tiedostonimien CRC-tarkistussumma:" - -03020800="Etsitään..." - -03020900="Ominaisuudet" - -03020A01="Toimintoa ei voi suorittaa kansiosta, jonka nimi on pitkä." -03020A02="Valitse yksi tiedosto" -03020A03="Valitse vähintään yksi tiedosto" -03020A04="Tiedosto {0} on jo olemassa" - -; Computer; Tietokone -03031100="Aseman koko" -03031101="Vapaata tilaa" -03031102="Varausyksikön koko" -03031103="Nimi" - -; Network; Verkko -03031200="Paikallinen nimi" -03031201="Palveluntarjoja" - -; Benchmark Dialog; Nopeustesti - -03080000="Nopeustesti" -03080001="Muistin käyttö:" -03080002="Pakkaaminen" -03080003="Purkaminen" -03080004="Nopeus" -03080005="Teho" -03080006="Teho yhteensä" -03080007="Tämänhetkinen" -03080008="Tulos" -03080009="Läpäisyt:" -0308000A="Virheitä:" -0308000B="Suoritinkäyttö" -0308000C="Teho / käyttö" - -;!@LangEnd@! - diff --git a/tools/7-Zip/Lang/fr.txt b/tools/7-Zip/Lang/fr.txt deleted file mode 100644 index ff66fdcd10..0000000000 --- a/tools/7-Zip/Lang/fr.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.62 -; Translated by Nicolas Sierro -; Updated to 7-Zip 4.62 beta by Philippe Berthault -; -; -; - -00000000="French" -00000001="Français" -00000002="12" - -; 7-Zip Configuration - -; Title -01000000="Configuration de 7-Zip" - -; Info Page -01000100="A propos de 7-Zip" -01000103="7-Zip est un logiciel libre. Cependant vous pouvez soutenir son développement en vous enregistrant." -01000104="Support" -01000105="S'enregistrer" - -; Folders Page -01000200="Dossiers" -01000210="Dossier de &travail" -01000211="Dossier temporaire du &système" -01000212="Dossier &courant" -01000213="Dossier s&pécifié:" -01000214="N'utiliser que pour les médias amovibles" - -01000281="Spécifiez un dossier pour les fichiers d'archive temporaires." - -; System Page -01000300="Système" -01000301="Intégrer 7-Zip au menu contextuel" -01000302="Menu contextuel en cascade" -01000310="Eléments du menu contextuel :" - -; Language Page -01000400="Langue" -01000401="Langue :" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Commandes 7-Zip" -02000103="Ouvrir" -02000104="Ouvrir l'archive sélectionnée." -02000105="Extraire les fichiers..." -02000106="Extraire les fichiers de l'archive sélectionnée." -02000107="Ajouter à l'archive..." -02000108="Ajouter les objets sélectionnés à l'archive." -02000109="Contrôler l'archive" -0200010A="Contrôler l'intégrité de l'archive sélectionnée." -0200010B="Extraire ici" -0200010C="Extraire les fichiers de l'archive sélectionnée dans le dossier actuel." -0200010D="Extraire vers {0}" -0200010E="Extraire dans un sous dossier." -0200010F="Ajouter à {0}" -02000110="Ajouter les éléments sélectionnés à l'archive." -02000111="Compresser et envoyer par mail..." -02000112="Compresser les éléments sélectionnés à l'archive et l'envoyer par mail." -02000113="Compresser vers {0} et envoyer par mail." -02000114="Compresser les éléments sélectionnés à l'archive et l'envoyer par mail." - -02000140="" -02000141="" - -; Properties -02000203="Chemin" -02000204="Nom" -02000205="Extension" -02000206="Dossier" -02000207="Taille" -02000208="Compressé" -02000209="Attributs" -0200020A="Créé le" -0200020B="Accédé le" -0200020C="Modifié le" -0200020D="Solide" -0200020E="Commentaire" -0200020F="Crypté" -02000210="Diviser avant" -02000211="Diviser après" -02000212="Dictionnaire" -02000213="CRC" -02000214="Type" -02000215="Anti" -02000216="Méthode" -02000217="OS hôte" -02000218="Système de fichiers" -02000219="Utilisateur" -0200021A="Groupe" -0200021B="Bloc" -0200021C="Commentaire" -0200021D="Position" -0200021E="Préfixe" -0200021F="Dossiers" -02000220="Fichiers" -02000221="Version" -02000222="Volume" -02000223="Multivolume" -02000224="Offset" -02000225="Liens" -02000226="Blocs" -02000227="Volumes" - -02000229="64 bits" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Taille physique" -0200022D="Taille des en-têtes" -0200022E="Somme de contrôle" -0200022F="Caractéristiques" -02000230="Adresse virtuelle" - -; Status bar -02000301="{0} objet(s) sélectionné(s)" -02000302="{0} objet(s)" - -02000320="Fichiers:" -02000321="Dossiers:" -02000322="Taille:" -02000323="Taille compressée:" -02000324="Archives:" - -; List Context Menu -02000401="&Colonnes..." - -02000411="&Ouvrir" -02000412="&Extraire..." - -; ToolBar -02000501="Extraire" - -; Messages -02000601="Les opérations de mise à jour ne sont pas disponibles pour cette archive." -02000602="L'archive '{0}' ne peut pas être mise à jour" -02000603="Le dossier '{0}' ne peut pas être créé" -02000604="Le fichier n'est pas une archive valide." -02000605="Erreur à l'invocation de la commande" -02000606="Trop d'objets" -02000607="Aucune application n'est associée avec ce type de fichier" -02000608="Il n'y a pas d'erreurs" -02000609="Le fichier '{0}' ne peut être ouvert comme une archive" -0200060A="L'archive cryptée '{0}' ne peut être ouverte. Mauvais mot de passe?" -0200060B="Le système ne peut allouer la quantité de mémoire nécessaire" -0200060C="Erreur d'origine inconnue" -0200060D="Ce type d'archive n'est pas supporté" - -; Dialogs -02000702="OK" -02000705="&Oui" -02000707="Oui pour tous" -02000709="&Non" -0200070B="Non pour tous" - -02000710="Annuler" -02000711="&Annuler" -02000713="&Fermer" -02000714="Stop" -02000715="Redémarrer" - -02000720="Aide" - -; Extract dialog -02000800="Extraire" -02000801="E&xtraire vers:" -02000802="Mot de passe" - -02000810="Chemins" -02000811="Chemins complets" -02000812="Chemins relatifs" -02000813="Pas de chemin" - -02000820="Mode de remplacement" -02000821="Confirmer avant de remplacer" -02000822="Remplacer sans demander" -02000823="Ignorer les fichiers existants" -02000824="Renommer automatiquement" -02000825="Renommer les fichiers existants" - -02000830="Fichiers" -02000831="&Fichiers sélectionnés" -02000832="&Tous les fichiers" - -02000881="Choisissez un dossier pour l'extraction des fichiers." - -02000890="Extraction" - -; Overwrite dialog -02000900="Confirmer le remplacement de fichier" -02000901="Le dossier de destination contient déjà un fichier avec ce nom." -02000902="Voulez-vous remplacer le fichier existant" -02000903="par celui-ci ?" - -02000911="Renommer &automatiquement" - -02000982="{0} octets" -02000983="modifié le" - -; Messages dialog -02000A00="Messages de diagnostic" - -02000A80="Message" - -02000A91="Méthode de compression non valide pour '{0}'." -02000A92="Donnée erronée dans le fichier '{0}'. Le fichier est corrompu." -02000A93="Échec du contrôle CRC dans le fichier '{0}'. Le fichier est corrompu." -02000A94="Donnée erronée dans le fichier crypté '{0}'. Mauvais mot de passe?" -02000A95="Échec du contrôle CRC dans le fichier crypté '{0}'. Mauvais mot de passe?" - -; Password dialog -02000B00="Entrez le mot de passe" -02000B01="Entrez le mot de passe:" -02000B02="&Afficher le mot de passe" -02000B03="Entrez le mot de passe à nouveau:" -02000B10="Les mots de passe ne correspondent pas" -02000B11="Pour le mot de passe, n'utilisez que des lettres non accentuées, des chiffres et des caractères spéciaux (!, #, $, ...)" -02000B12="Le mot de passe est trop long" - -; Progress dialog -02000C00="Procède" -02000C01="Temps écoulé:" -02000C02="Temps restant:" -02000C03="Taille:" -02000C04="Vitesse:" -02000C05="Traité:" -02000C06="Taux de compression:" - -02000C10="&Arrière plan" -02000C11="&Avant plan" -02000C12="&Pause" -02000C13="&Continuer" - -02000C20="En pause" - -02000C30="Etes vous sur de vouloir annuler ?" - -; Compress dialog -02000D00="Ajouter à l'archive" -02000D01="&Archive:" -02000D02="&Mode de mise à jour:" -02000D03="&Format de l'archive:" -02000D04="Type de &compression:" -02000D05="Créer une archive &solide" -02000D06="&Paramètres:" -02000D07="Options" -02000D08="Créer une archive SF&X" -02000D09="Multi-threading" -02000D0A="Crypter les &noms de fichiers" -02000D0B="N&iveau de compression :" -02000D0C="&Taille du dictionnaire :" -02000D0D="Tai&lle des mots :" -02000D0E="Mémoire pour la compression :" -02000D0F="Mémoire pour la décompression :" -02000D10="Cryptage" -02000D11="Méthode de cryptage:" -02000D12="Nombre de threads CPU:" -02000D13="Taille de bloc solide:" -02000D14="Non-solide" -02000D15="Solide" -02000D16="Compresser des fichiers partagés" - -02000D40="Découper en &volumes, octets:" -02000D41="Taille de volume incorrecte" -02000D42="Taille de volume spécifiée: {0} octets.\nÊtes vous sûr de vouloir découper l'archive dans de tels volumes?" - -02000D81="Aucune" -02000D82="Normale" -02000D83="Maximum" -02000D84="Rapide" -02000D85="Le plus rapide" -02000D86="Ultra" - -02000D90="Choisir" - -02000DA1="Ajouter et remplacer les fichiers" -02000DA2="Mettre à jour et ajouter les fichiers" -02000DA3="Rafraîchir les fichiers existants" -02000DA4="Synchroniser les fichiers" - -02000DB1="Tous les fichiers" - -02000DC0="Compression" - -; Columns dialog -02000E00="Colonnes" -02000E01="Marquez les colonnes que vous désirez afficher. Utilisez les boutons Monter et Descendre pour modifier leur ordre." -02000E02="La colonne sélectionnée doit faire" -02000E03="pixels de &large." - -02000E10="Mon&ter" -02000E11="&Descendre" -02000E12="&Afficher" -02000E13="&Masquer" -02000E14="Sauver" - -02000E81="Titre" -02000E82="Largeur" - -; Testing -02000F90="Contrôle" - - -; File Manager - -03000000="Gestionnaire de fichier de 7-Zip" - -; Menu -03000102="&Fichier" -03000103="&Edition" -03000104="Affic&hage" -03000105="&Outils" -03000106="&Aide" -03000107="Fa&voris" - -; File -03000210="&Ouvrir" -03000211="Ouvrir à l'&intérieur" -03000212="Ouvrir à l'e&xtérieur" -03000220="&Voir" -03000221="&Edition" -03000230="Reno&mmer" -03000231="&Copier vers..." -03000232="&Déplacer vers..." -03000233="S&upprimer" -03000240="P&ropriétés" -03000241="Comme&ntaire" -03000242="Somme de contrôle" -03000250="Créer un dossier" -03000251="Créer un fichier" -03000260="&Quitter" -03000270="Diviser le &fichier ..." -03000271="Combiner les fic&hiers ..." - -; Edit -03000310="&Annuler" -03000311="&Refaire" -03000320="&Couper" -03000321="Co&pier" -03000322="C&oller" -03000323="S&upprimer" -03000330="Sélectionner &tout" -03000331="Désélectionner tout" -03000332="&Inverser la sélection" -03000333="Sélectionner..." -03000334="Désélectionner..." -03000335="Sélectionner par type" -03000336="Désélectionner par type" - -; View -03000410="&Grandes icônes" -03000411="&Petites icônes" -03000412="&Liste" -03000413="&Détails" -03000420="Non trié" -03000430="Ouvrir le dossier racine" -03000431="Dossier parent" -03000432="Historique des dossiers..." -03000440="Actualis&er" -03000449="Vue à plat" -03000450="&2 Fenêtres" -03000451="&Barres d'outils" -03000460="Barre d'archive" -03000461="Barre standard" -03000462="Grands boutons" -03000463="Montrer le texte" - -; Tools -03000510="&Options..." -03000511="Test de performance" - -; Help -03000610="&Contenu..." -03000620="À &propos de 7-Zip..." - -; Favorites -03000710="&Ajouter le répertoire aux favoris" -03000720="Signet" - -; Options Dialog - -03010000="Options" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Options..." - -; Edit -03010200="Editeur" -03010201="&Editeur:" - -; System -03010300="Système" -03010302="Associer 7-Zip avec:" -03010310="Plugin" - -; Settings -03010400="Paramètres" -03010401="Afficher l'élément \"..\"" -03010402="Afficher les icônes réelles des fichiers" -03010410="Afficher le menu système" -03010420="Sélectionner toute la ligne" -03010421="Afficher la grille" -03010430="Utiliser la sélection alternative" -03010440="Utiliser des grosses pages mémoire" - -; Strings - -03020201="Copier" -03020202="Déplacer" -03020203="Copier dans:" -03020204="Déplacer vers:" -03020205="Copie..." -03020206="Déplacement..." -03020207="Vous ne pouvez pas déplacer ou copier des objets pour de tels dossiers." -03020208="L'opération n'est pas possible." -03020209="Sélectionnez le dossier de destination." - -03020210="Confirmer la suppression du fichier" -03020211="Confirmer la suppression du dossier" -03020212="Confirmer la suppression de tous les fichiers" -03020213="Êtes-vous sûr de vouloir supprimer '{0}'?" -03020214="Êtes-vous sûr de vouloir supprimer le dossier '{0}' et tout ce qu'il contient ?" -03020215="Êtes-vous sûr de vouloir supprimer ces {0} objets ?" -03020216="Suppression..." -03020217="Erreur durant la suppression du fichier ou du dossier" -03020218="Le système ne peut mettre à la corbeille un fichier avec un trop long chemin d'accès" - -03020220="Renommage..." -03020221="Erreur durant le renommage du fichier ou du dossier" -03020222="Confirmation de la copie de fichiers" -03020223="Confirmer la copie du(des) fichier(s)" - -03020230="Créer un dossier" -03020231="Nom du dossier:" -03020232="Nouveau dossier" -03020233="Erreur durant la création du dossier" - -03020240="Créer un fichier" -03020241="Nom du fichier:" -03020242="Nouveau fichier" -03020243="Erreur durant la création du fichier" - -03020250="Sélectionner" -03020251="Désélectionner" -03020252="Masque:" - -03020260="Historique des dossiers" - -03020280="Le fichier '{0}' a été modifié.\nVoulez-vous le mettre à jour dans l'archive ?" -03020281="Impossible de mettre à jour\n'{0}'" -03020282="Impossible de démarrer l'éditeur." -03020283="Ouverture..." -03020284="Le fichier est peut-être un virus (le nom contient des grands espacements pour masquer l'extension)." - -03020290="Commentaire" -03020291="&Commentaire:" - -030202A0="Système" - -03020300="Ordinateur" -03020301="Réseau" -03020302="Documents" - -03020400="Ajouter" -03020401="Extraire" -03020402="Tester" - -03020420="Copier" -03020421="Déplacer" -03020422="Supprimer" -03020423="Informations" - -03020500="Diviser le fichier" -03020501="&Diviser en :" -03020510="Division..." -03020520="Confirmez le découpage" -03020521="Êtes vous sûr de vouloir découper le fichier en {0} volumes?" -03020522="La taille de volume doit être inférieure à la taille du fichier d'origine" - -03020600="Combiner les fichiers" -03020601="&Combiner en :" -03020610="Combinaison..." -03020620="Ne sélectionnez que le premier fichier" -03020621="Ne trouve aucun fichier faisant partie d'une archive divisée" -03020622="Ne trouve qu'un seul fichier faisant partie d'une archive divisée" - -03020710="Calcul de la somme de contrôle..." -03020720="Informations sur la somme de contrôle" -03020721="Somme de contrôle des données" -03020722="Somme de contrôle des données et des noms" - -03020800="Exploration..." - -03020900="Propriétés" - -03020A01="Cette opération ne peut être effectuée depuis un dossier ayant un trop long chemin d'accès" -03020A02="Vous devez sélectionner un fichier" -03020A03="Vous devez sélectionner un ou plusieurs fichiers" -03020A04="Le fichier {0} existe déjà" - -; Computer -03031100="Taille totale" -03031101="Espace libre" -03031102="Taille des clusters" -03031103="Nom de volume" - -; Network -03031200="Nom local" -03031201="Fournisseur" - -; Benchmark Dialog - -03080000="Test de performance" -03080001="Utilisation de la mémoire :" -03080002="Compression" -03080003="Décompression" -03080004="Vitesse" -03080005="Taux" -03080006="Taux total" -03080007="Actuel" -03080008="Résultant" -03080009="Passes:" -0308000A="Erreurs:" -0308000B="Utilisation CPU" -0308000C="Estim.. / Usage" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/fur.txt b/tools/7-Zip/Lang/fur.txt deleted file mode 100644 index 5481e260d2..0000000000 --- a/tools/7-Zip/Lang/fur.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.60 beta -; Translated by Andrea Decorte (Klenje) -; http://softfurlan.altervista.org -; secont l'ortografie uficiâl de Provincie di Udin -; -; - -00000000="Friulian" -00000001="Furlan" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="Configurazion di 7-Zip" - -; Info Page -01000100="Informazions su 7-Zip" -01000103="7-Zip al è un program libar. Purpûr, tu puedis supuartâ il disvilup di 7-Zip cu la regjistrazion. I utents regjistrâts a podaran otignî supuart tecnic." -01000104="Supuart tecnic" -01000105="Regjistre" - -; Folders Page -01000200="Cartelis" -01000210="Cartele di &vore" -01000211="Cartele &provisorie dal sisteme" -01000212="&Corinte" -01000213="&Specificade:" -01000214="Dopre dome pai drives che si puedin gjavâ" - -01000281="Specifiche une posizion pai files provisoris di un archivi." - -; System Page -01000300="Sisteme" -01000301="Integre 7-Zip intal menù contestuâl de shell" -01000302="Menù contestuâl in discjadude" -01000310="Elements dal menù contestuâl:" - -; Language Page -01000400="Lenghe" -01000401="Lenghe:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comants di 7-Zip" -02000103="Viarç archivi" -02000104="Viarç l'archivi selezionât." -02000105="Tire fûr files..." -02000106="Tire fûr files dal archivi selezionât." -02000107="Zonte a un archivi..." -02000108="Zonte i elements selezionâts a un archivi." -02000109="Prove archivi" -0200010A="Prove l'integritât dal archivi selezionât." -0200010B="Tire fûr ca" -0200010C="Tire fûr files dal archivi selezionât inte cartele corinte." -0200010D="Tire fûr in {0}" -0200010E="Tire fûr i files intune sotcartele." -0200010F="Zonte a {0}" -02000110="Zonte i elements selezionâts a un archivi." -02000111="Comprim e mande par email..." -02000112="Comprim i elements selezionâts e mande l'archivi par email." -02000113="Comprim in {0} e mande par email" -02000114="Comprim i elements selezionâts e mande l'archivi par email." - -02000140="" -02000141="" - -; Properties -02000203="Percors" -02000204="Non" -02000205="Estension" -02000206="Cartele" -02000207="Dimension" -02000208="Dimension comprimude" -02000209="Atribûts" -0200020A="Creât" -0200020B="Ultin acès" -0200020C="Modificât" -0200020D="Solit" -0200020E="Comentât" -0200020F="Cifrât" -02000210="Divît prin di" -02000211="Divît daspò di" -02000212="Dizionari" -02000213="CRC" -02000214="Gjenar" -02000215="Anti" -02000216="Metodi" -02000217="SO di origjin" -02000218="Sisteme dai files" -02000219="Utent" -0200021A="Grup" -0200021B="Bloc" -0200021C="Coment" -0200021D="Posizion" -0200021E="Prefìs dal troi" -0200021F="Cartelis" -02000220="Files" -02000221="Version" -02000222="Volum" -02000223="Multivolum" -02000224="Offset" -02000225="Leams" -02000226="Blocs" -02000227="Volums" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Dimension fisiche" -0200022D="Dimension intestazions" -0200022E="Some di control" -0200022F="Caracteristichis" -02000230="Direzion virtuâl" - -; Status bar -02000301="{0} ogjet(s) selezionât(s)" -02000302="{0} ogjet(s)" - -02000320="Files:" -02000321="Cartelis:" -02000322="Dimension:" -02000323="Dimension comprimude:" -02000324="Archivis:" - -; List Context Menu -02000401="&Colonis..." - -02000411="&Viarç" -02000412="&Tire fûr..." - -; ToolBar -02000501="Tire fûr" - -; Messages -02000601="Lis operazions di atualizazion no son supuartadis par chest archivi." -02000602="No si pues atualizâ l'archivi {0}" -02000603="No si pues creâ la cartele '{0}'" -02000604="Il file nol è un archivi supuartât." -02000605="Erôr" -02000606="Masse elements" -02000607="Nissune aplicazion e je associade cu la estension di chest file" -02000608="Nissun erôr cjatât" -02000609="No si pues viarzi il file '{0}' come archivi" -0200060A="No si pues viarzi l'archivi cifrât '{0}'. Ise sbaliade la peraule clâf?" -0200060B="Il sisteme nol rive a cjoli la cuantitât di memorie che e covente" -0200060C="Erôr no cognossût" -0200060D="Gjenar di archivi no supuartât" - -; Dialogs -02000702="Va ben" -02000705="&Sì" -02000707="Sì &a ducj" -02000709="&No" -0200070B="No a &ducj" - -02000710="Scancele" -02000711="S&cancele" -02000713="&Siare" -02000714="Ferme" -02000715="Torne a inviâ" - -02000720="&Jutori" - -; Extract dialog -02000800="Tire fûr" -02000801="Tir&e fûr in:" -02000802="Peraule clâf" - -02000810="Struture des cartelis" -02000811="Percors intîrs" -02000812="Percors corints" -02000813="Nissun percors" - -02000820="Sore scriture" -02000821="Domande prin di scrivi parsore" -02000822="Scrîf parsore cence domandâ" -02000823="Salte i files che esistin" -02000824="Gambie nons in automatic" -02000825="Gambie nons in automatic se a esistin" - -02000830="Files" -02000831="Files &selezionâts" -02000832="Duc&j i files" - -02000881="Specifiche une posizion pai files tirâts fûr." - -02000890="Daûr a tirâ fûr..." - -; Overwrite dialog -02000900="Conferme de sostituzion dal file" -02000901="Inte cartele di destinazion al è za il file processât." -02000902="Vuelistu sostituî il file esistint" -02000903="cun chest file?" - -02000911="&Gambie non in automatic" - -02000982="{0} bytes" -02000983="modificât ai" - -; Messages dialog -02000A00="Messaçs diagnostics" - -02000A80="Messaç" - -02000A91="Il metodi di compression nol è supuartât par '{0}'." -02000A92="Erôr di dâts in '{0}'. Il file al è corot." -02000A93="CRC falît in '{0}'. Il file al è corot." -02000A94="Erôr di dâts tal file cifrât '{0}'. Peraule clâf sbaliade?" -02000A95="CRC falît tal file cifrât '{0}'. Peraule clâf sbaliade?" - -; Password dialog -02000B00="Scrîf peraule clâf" -02000B01="Scrîf la peraule clâf:" -02000B02="&Mostre la peraule clâf" -02000B03="Torne a inserî la peraule clâf:" -02000B10="Lis peraulis clâfs no son compagnis" -02000B11="Dopre dome lis letaris inglesis (no acentadis), i numars e i caratars speciâi (!, #, $, ...) inte peraule clâf" -02000B12="La peraule clâf e je masse lungje" - -; Progress dialog -02000C00="Procès" -02000C01="Timp passât:" -02000C02="Timp restant:" -02000C03="Dimension:" -02000C04="Sveltece:" -02000C05="Elaborât:" -02000C06="Tas di compression:" - -02000C10="&Sfont" -02000C11="P&rin plan" -02000C12="&Pause" -02000C13="&Continue" - -02000C20="In pause" - -02000C30="Sêstu sigûr di volê scancelâ?" - -; Compress dialog -02000D00="Zonte a un archivi" -02000D01="&Archivi:" -02000D02="Mût di at&ualizazion:" -02000D03="&Formât archivi:" -02000D04="&Metodi di compression:" -02000D05="Cree archivi &solit" -02000D06="&Parametris:" -02000D07="Opzions" -02000D08="Cree archivi SF&X" -02000D09="Multi-threading" -02000D0A="Cifre i &nons dai files" -02000D0B="Nive&l di compression:" -02000D0C="&Dimension dizionari:" -02000D0D="Dimension &peraule:" -02000D0E="Utilizazion memorie comprimint:" -02000D0F="Utilizazion memorie decomprimint:" -02000D10="Ciframent" -02000D11="Metodi di ciframent:" -02000D12="Numar di threads de CPU:" -02000D13="Dimension bloc solit:" -02000D14="No-solit" -02000D15="Solit" -02000D16="Comprim i files condividûts" - -02000D40="Divît in &volums, grandece in bytes:" -02000D41="Dimension dai volums sbaliade" -02000D42="Dimension dai volums volude: {0} bytes.\nSêstu sigûr di volê dividi l'archivi in tocs di cheste dimension?" - -02000D81="Cence compression" -02000D82="Normâl" -02000D83="Massim" -02000D84="Svelt" -02000D85="Il pi svelt" -02000D86="Super" - -02000D90="Sgarfe" - -02000DA1="Zonte e sostituìs files" -02000DA2="Atualize e zonte files" -02000DA3="Atualize i files che esistin" -02000DA4="Sincronize i files" - -02000DB1="Ducj i files" - -02000DC0="Daûr a comprimi" - -; Columns dialog -02000E00="Colonis" -02000E01="Selezione lis colonis che tu vuelis rindi visibilis in cheste cartele. Dopre i botons Pare sù e Pare jù par gambiâ l'ordin des colonis." -02000E02="La colone selezionade e à di jessi" -02000E03="pixels &largje." - -02000E10="Par&e sù" -02000E11="Pare &jù" -02000E12="&Mostre" -02000E13="&Plate" -02000E14="Configure" - -02000E81="Titul" -02000E82="Largjece" - -; Testing -02000F90="Daûr a provâ" - - -; File Manager - -03000000="7-Zip - Aministradôr di files" - -; Menu -03000102="&File" -03000103="&Modifiche" -03000104="&Viodude" -03000105="&Imprescj" -03000106="&Jutori" -03000107="&Preferîts" - -; File -03000210="&Viarç" -03000211="Viarç dentri 7-&Zip" -03000212="V&iarç fûr di 7-Zip" -03000220="&Mostre" -03000221="M&odifiche" -03000230="Gambie &non" -03000231="&Copie in..." -03000232="Mô&f in..." -03000233="&Elimine" -03000240="P&ropietâts" -03000241="Comen&t" -03000242="Calcole so&me di control" -03000250="Cree cartele" -03000251="Cree file" -03000260="V&a fûr" -03000270="&Divît file..." -03000271="Torne a &unî files..." - -; Edit -03000310="&Anule" -03000311="Torne a &fâ" -03000320="&Taie" -03000321="&Copie" -03000322="Tac&he" -03000323="&Elimine" -03000330="Selezione d&ut" -03000331="&Deselezione dut" -03000332="&Invertìs selezion" -03000333="Selezione..." -03000334="Deselezione..." -03000335="Selezione par gjenar" -03000336="Deselezione par gjenar" - -; View -03000410="Iconis &grandis" -03000411="Iconis &piçulis" -03000412="&Liste" -03000413="&Detais" -03000420="Cence ordin" -03000430="Viarç cartele principâl" -03000431="Parsore di un nivel" -03000432="Storic des cartelis..." -03000440="&Atualize" -03000449="Viodude plane" -03000450="&2 panei" -03000451="Sbaris dai impresc&j" -03000460="Sbare dai imprescj par l'archivi" -03000461="Sbare dai imprescj standard" -03000462="Botons larcs" -03000463="Mostre test dai botons" - -; Tools -03000510="&Opzions..." -03000511="&Banc di prove" - -; Help -03000610="&Argoments..." -03000620="&Informazions su 7-Zip..." - -; Favorites -03000710="&Zonte cartele ai Preferîts sicu" -03000720="Preferît" - -; Options Dialog - -03010000="Opzions" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opzions..." - -; Edit -03010200="Editôr" -03010201="&Editôr:" - -; System -03010300="Sisteme" -03010302="Associe 7-Zip cun:" -03010310="Plugin" - -; Settings -03010400="Configurazion" -03010401="Mostre l'element \"..\"" -03010402="Mostre lis veris iconis dai files" -03010410="Mostre il menù dal sisteme" -03010420="&Selezione la rie intire" -03010421="Mostre les liniis de &gridele sot" -03010430="Mût di selezion &alternatîf" -03010440="Dopre pagjinis di memorie &largjis" - -; Strings - -03020201="Copie" -03020202="Môf" -03020203="Copie in:" -03020204="Môf in:" -03020205="Daûr a copiâ..." -03020206="Daûr a movi..." -03020207="No si pues movi o copiâ elements di chest gjenar di cartelis." -03020208="L'operazion no je supuartade." -03020209="Sielç la cartele di destinazion." - -03020210="Conferme de eliminazion dal file" -03020211="Conferme de eliminazion de cartele" -03020212="Conferme de eliminazion di plui files" -03020213="Sêstu sigûr di volê eliminâ '{0}'?" -03020214="Sêstu sigûr di volê eliminâ la cartele '{0}' e dut ce ch'al è lì dentri?" -03020215="Sêstu sigûr di volê eliminâ chescj {0} elements?" -03020216="Daûr a eliminâ..." -03020217="Erôr eliminant un file o une cartele" -03020218="Il sisteme nol pues movi un file cuntun troi lunc te Scovacere" - -03020220="Daûr a gambiâ non..." -03020221="Erôr gambiant non a un file o une cartele" -03020222="Conferme de copie dai files" -03020223="Sêstu sigûr di volê copiâ i files tal archivi" - -03020230="Cree cartele" -03020231="Non de cartele:" -03020232="Gnove cartele" -03020233="Erôr inte creazion de cartele" - -03020240="Cree file" -03020241="Non dal file:" -03020242="Gnûf file" -03020243="Erôr inte creazion dal file" - -03020250="Selezione" -03020251="Deselezione" -03020252="Filtri:" - -03020260="Storic des cartelis" - -03020280="Il file '{0}' al è stât modificât.\nVuelistu atualizâlu intal archivi?" -03020281="No si pues atualizâ il file\n'{0}'" -03020282="No si pues inviâ l'editôr." -03020283="Daûr a viarzi..." -03020284="Il file al samee un virus (il non al à dentri un grum di spazis)." - -03020290="Coment" -03020291="&Coment:" - -030202A0="Sisteme" - -03020300="Ordenadôr" -03020301="Rêt" -03020302="Documents" - -03020400="Zonte" -03020401="Tire fûr" -03020402="Prove" - -03020420="Copie" -03020421="Môf" -03020422="Elimine" -03020423="Info" - -03020500="Divît file" -03020501="&Divît in:" -03020510="Daûr a dividi..." -03020520="Conferme de division" -03020521="Sêstu sigûr di volê dividi il file in {0} tocs?" -03020522="La dimension di un volum e à di jessi plui piçule di chê dal file origjinâl" - -03020600="Torne a unî files" -03020601="&Torne a unî in:" -03020610="Daûr a tornâ a unî..." -03020620="Sielç dome il prin file" -03020621="No si pues rilevâ il file come toc di un file dividût" -03020622="No son stâts cjatâts plui tocs di file dividûts" - -03020710="Daûr a calcolâ la some di control..." -03020720="Informazions su la some di control" -03020721="Some di control CRC pai dâts:" -03020722="Some di control CRC pai dâts e i nons:" - -03020800="Daûr a scandaiâ..." - -03020900="Propietâts" - -03020A01="Cheste operazion no pues jessi clamade di une cartele cuntun troi lunc." -03020A02="Tu scugnis sielzi un file" -03020A03="Tu scugnis sielzi un o plui files" -03020A04="Il file {0} al esist za" - -; Computer -03031100="Dimension totâl" -03031101="Puest libar" -03031102="Dimension setôr" -03031103="Etichete" - -; Network -03031200="Non locâl" -03031201="Furnidôr" - -; Benchmark Dialog - -03080000="Banc di prove" -03080001="Utilizazion memorie:" -03080002="Comprimint" -03080003="Decomprimint" -03080004="Sveltece" -03080005="Valutazion" -03080006="Valutazion totâl" -03080007="Corint" -03080008="Risultant" -03080009="Passaçs:" -0308000A="Erôrs:" -0308000B="Utilizazion CPU" -0308000C="Judizi / Utilizazion" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/fy.txt b/tools/7-Zip/Lang/fy.txt deleted file mode 100644 index f2ac05c15e..0000000000 --- a/tools/7-Zip/Lang/fy.txt +++ /dev/null @@ -1,514 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by Berend Ytsma -; -; -; - -00000000="Frisian" -00000001="Frysk" -00000002="98" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Konfiguraasje" - -; Info Page -01000100="7-Zip it hoe en het" -01000103="7-Zip is fergees. Mar, jo kinne de ûntwikkeling stypje troch jo te registrearjen." -01000104="Stipe" -01000105="Registrearje" - -; Folders Page -01000200="Mappen" -01000210="&Wurkmap" -01000211="&Tydlikesysteemmap" -01000212="&Aktive" -01000213="&Oantsjutte:" -01000214="Allinnich brûke foar útnimbere skiven" - -01000281="ynfiere fan de lokaasje foar tydlike argyftriemmen." - -; System Page -01000300="Systeem" -01000301="Yntegraasje fan 7-Zip yn ferbânmenu" -01000302="Ferbânmenu yn trepfoarm" -01000310="Ferbânmenu-items:" - -; Language Page -01000400="Taal" -01000401="Taal:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip kommando" -02000103="Argyf iepenje" -02000104="Iepenet it selektearre argyf." -02000105="Triemmen útpakke..." -02000106="Triemmen út it selektearre argyf útpakke." -02000107="Oan argyf taheakje..." -02000108="De selektearre items wurde oan argyf taheakke." -02000109="Argyf teste" -0200010A="Besjocht de yntegriteit fan it selektearre argyf." -0200010B="Hjir útpakke" -0200010C="Triemmen út it selektearre argyf yn de aktive map útpakke." -0200010D="Utpakke yn {0}" -0200010E="Utpakke fan triemmen yn ûndermap." -0200010F="Oan {0} taheakje" -02000110="Foeget de selektearre items ta oan argyf." -02000111="komprimearje en ferstjoere..." -02000112="Komprimearret de selektearre items nei argyf en stjoerd argyf fuort mei e-post." -02000113="Komprimearje nei {0} en poste" -02000114="komprimearret de selektearre items nei argyf en stjoerd argyf fuort mei e-post." - -02000140="" -02000141="" - -; Properties -02000203="Paad" -02000204="Namme" -02000205="Taheaksel" -02000206="Map" -02000207="Grutte" -02000208="Ynpakte grutte" -02000209="Skaaimerk" -0200020A="Makke" -0200020B="Lêste tagong" -0200020C="Feroare" -0200020D="Kompakt" -0200020E="Kommentaar" -0200020F="Fersifere" -02000210="Spjalt foar" -02000211="Spjalt efter" -02000212="Wurdboek" -02000213="CRC" -02000214="Type" -02000215="Anty" -02000216="Metoade" -02000217="Host OS" -02000218="Triemsysteem" -02000219="Brûker" -0200021A="Keppel" -0200021B="Blok" -0200021C="Kommentaar" -0200021D="Posysje" -0200021E="Paad foarheaksel" -0200021F="Mappen" -02000220="Triemmen" -02000221="Ferzje" -02000222="Folume" -02000223="Multifolume" -02000224="Offset" -02000225="Links" -02000226="Blokken" -02000227="Folumes" - -; Status bar -02000301="{0} objekt(en) selektearre" -02000302="{0} objekt(en)" - -02000320="Triemmen:" -02000321="Mappen:" -02000322="Grutte:" -02000323="Komprimearregrutte:" -02000324="Argiven:" - -; List Context Menu -02000401="&Kolommen..." - -02000411="&Iepenje" -02000412="&Utpakke..." - -; ToolBar -02000501="Utpakke" - -; Messages -02000601="Bywurk operaasje waard net stipe troch dit argyf." -02000602="Kin argyf {0} net bywurkje" -02000603="Kin map '{0}' net meitsje " -02000604="Triem is in net stipe argyf." -02000605="Flater" -02000606="Tefolle items" -02000607="Der is gjin applikaasje ferbûn oan dit triem taheaksel" -02000608="Der binne gjin flaters" -02000609="Kin triem '{0} net as argyf iepenje" -0200060A="Kin fersifere argyf '{0}' net iepenje. Ferkeard wachtwurd?" - -; Dialogs -02000702="Okee" -02000705="&Jawis" -02000707="Jawis foar &Alles" -02000709="&Nee" -0200070B="Nee foar A&lles" - -02000710="Ofbrekke" -02000711="&Ofbrekke" -02000713="&Slute" -02000714="Stopje" -02000715="Opnij begjinne" - -02000720="Help" - -; Extract dialog -02000800="Utpakke" -02000801="U&tpakke nei:" -02000802="Wachtwurd" - -02000810="Paad modus" -02000811="Folsleine paadnammen" -02000812="Aktive paadnammen" -02000813="Gjin paadnammen" - -02000820="Oerskriuw modus" -02000821="Freegje foardat jo oerskriuwe" -02000822="Oerskriuwe sûnder pront" -02000823="Besteande triemmen oerslaan" -02000824="Automatysk omneame" -02000825="Automatysk ek by besteande triemmen" - -02000830="Triemmen" -02000831="&Selektearre triemmen" -02000832="&Alle triemmen" - -02000881="De lokaasje om nei út te pakken oantsjutte." - -02000890="Utpakke" - -; Overwrite dialog -02000900="It ferfangen fan de triem befêstigje" -02000901="Bestimmingsmap befettet al in triem mei dizze namme." -02000902="Wolle jo de triem ferfange" -02000903="Mei dizze?" - -02000911="A&utomatysk omneame" - -02000982="{0} bytes" -02000983="Feroare op" - -; Messages dialog -02000A00="Diagnostyk berjocht" - -02000A80="Berjocht" - -02000A91="Net stipe kompresjemetoade foar '{0}'." -02000A92="Data flater yn '{0}'. Triem is beskeadige." -02000A93="CRC mislearre yn '{0}'. Triem is beskeadige." -02000A94="Data flater yn fersifere triem '{0}'. Ferkeard wachtwurd?" -02000A95="CRC mislearre yn fersifere triem '{0}'. Ferkeard wachtwurd?" - -; Password dialog -02000B00="Wachtwurd ynfiere" -02000B01="Wachtwurd ynfiere:" -02000B02="Wachtwurd &sjen litte" -02000B03="Wachwurd opnij ynfiere:" -02000B10="Wachtwurden komme net oerien" -02000B11="Brûk allinne ingelske letters, nûmers en spesjale karakters (!, #, $, ...) foar it wachtwurd" -02000B12="Wachtwurd is te lang" - -; Progress dialog -02000C00="Proses" -02000C01="Ferstrutsen tiid:" -02000C02="Tiid noch te gean:" -02000C03="Totale grutte:" -02000C04="Fluggens:" -02000C05="Ferwurke:" -02000C06="Kompresje nivo:" - -02000C10="&Eftergrûn" -02000C11="&Foargrûn" -02000C12="&Skoftsje" -02000C13="&Ferfetsje" - -02000C20="Skoft" - -02000C30="Binne jo wis dat jo ôfbrekke wolle?" - -; Compress dialog -02000D00="Oan argyf taheakje" -02000D01="&Argyf:" -02000D02="&Bywurkmodus:" -02000D03="Argyf &formaat:" -02000D04="Kompresje&metoade:" -02000D05="&Kompakt argyf meitsje" -02000D06="&Parameters:" -02000D07="Opsjes" -02000D08="Meitsje SF&X-argyf" -02000D09="Meardere streamen" -02000D0A="Fersiferje triem&nammen" -02000D0B="Kompresje&nivo:" -02000D0C="&Wurdboekgrutte:" -02000D0D="&Wurdgrutte:" -02000D0E="Unthâld gebrûk by komprimearjen:" -02000D0F="Unthâld gebrûk by ûntkomprimearjen:" -02000D10="Fersifering" -02000D11="Fersiferingmetoade:" -02000D12="Tal CPU trieden:" -02000D13="Kompakte blokgrutte:" -02000D14="net-kompakt" -02000D15="Kompakt" -02000D16="Dielde triemmen komprimearje" - -02000D40="Spjalte nei &folumes, bytes:" -02000D41="Net juste folumegrutte" -02000D42="Oantsjutte folumegrutte: {0} bytes.\nWolle jo it argyf yn sokke folumes spjalte?" - - -02000D81="Bewarje" -02000D82="Normaal" -02000D83="Maksimum" -02000D84="Fluch" -02000D85="Fluchst" -02000D86="Ultra" - -02000D90="Blêdzje" - -02000DA1="Triemmen taheakje en ferfange" -02000DA2="Triemmen taheakje en bywurkje" -02000DA3="Besteande triemmen ferfarskje" -02000DA4="Triemmen lyk rinne litte" - -02000DB1="Alle triemmen" - -02000DC0="Oan it komprimearjen" - -; Columns dialog -02000E00="Kolommen" -02000E01="Kontrolearje de kolommen dy't jo yn dizze map sichtber meitsje wolle. Brûk de omheech en omleech knoppen om de kolommen te oarderjen." -02000E02="De selektearre kolom soe" -02000E03="Piksels &breed wêze moatte." - -02000E10="Om&heech ferpleatse" -02000E11="Om&leech ferpleatse" -02000E12="&Sjen litte" -02000E13="&Fertopje" -02000E14="Set" - -02000E81="Titel" -02000E82="Breedte" - -; Testing -02000F90="Oan it Testen" - - -; File Manager - -03000000="7-Zip Triembehearder" - -; Menu -03000102="&Triem" -03000103="&Bewurkje" -03000104="&Byld" -03000105="&Ark" -03000106="&Help" -03000107="B&lêdwizers" - -; File -03000210="&Iepenje" -03000211="Iepenje &yn" -03000212="Iepenje bû&ten" -03000220="&Byld" -03000221="&Bewurkje" -03000230="Omne&ame" -03000231="&Kopiearje nei..." -03000232="&Ferpleats nei..." -03000233="&Wiskje" -03000240="E&igenskippen" -03000241="Komme&ntaar" -03000242="Kontrôlesom berekenje" -03000250="Map meitsje" -03000251="Triem meitsje" -03000260="U&tgong" -03000270="Triemmen &spjalte..." -03000271="Triemmen Kom&binearje..." - -; Edit -03000310="&Ungedien meitsje" -03000311="&Opnij" -03000320="Kni&ppe" -03000321="&Kopiearje" -03000322="&Plakke" -03000323="&Wiskje" -03000330="&Alles selektearje" -03000331="Alles net selektearje" -03000332="&Seleksje omdraaien" -03000333="Selektearje..." -03000334="Net selektearje..." -03000335="Selektearje neffens type" -03000336="Net selektearje neffens type" - -; View -03000410="Gru&tte Ikoanen" -03000411="L&ytse Ikoanen" -03000412="&List" -03000413="&Details" -03000420="Net Sortearre" -03000430="Haadmap iepenje" -03000431="Ien nivo omheech" -03000432="Maphistoarje..." -03000440="&Ferfarskje" -03000449="Platte werjefte" -03000450="&2 Panielen" -03000451="&Arkbalke" -03000460="Argyf arkbalke" -03000461="Standert arkbalke" -03000462="Grutte knoppen" -03000463="Knoptekst sjen litte" - -; Tools -03000510="&Opsjes..." -03000511="&Ykpunt" - -; Help -03000610="&Ynhâld..." -03000620="&7-Zip it hoe en het..." - -; Favorites -03000710="Map oan blêdwizers &taheakje as" -03000720="Blêdwizer meitsje" - -; Options Dialog - -03010000="Opsjes" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opsjes..." - -; Edit -03010200="Bewurker" -03010201="&Bewurker:" - -; System -03010300="Systeem" -03010302="Ferbyn 7-Zip Mei:" -03010310="Plugin" - -; Settings -03010400="Ynstellings" -03010401="\"..\" item sjen litte" -03010402="Echte triem ikoanen sjen litte" -03010410="Systeemmenu sjen litte" -03010420="&Folsleine rige selektearje" -03010421="&Roaster sjen litte" -03010430="&Alternative seleksje modus" -03010440="Brûk &grut ûnthâld siden" - -; Strings - -03020201="Kopiearje" -03020202="Ferpleatse" -03020203="Kopiearje nei:" -03020204="Ferpleats nei:" -03020205="Oan it kopiearren..." -03020206="Oan it ferpleatsen..." -03020207="Jo kinne net foar sokke mappen items kopiearje of ferpleatse" -03020208="Operaasje wurdt net stipe." -03020209="Bestimmingsmap selektearje." - -03020210="It wiskjen fan de triem befêstigje" -03020211="It wiskjen fan de map befêstigje" -03020212="It wiskjen fan meardere triemmen befêstigje" -03020213="Binne jo wis dat jo '{0}' wiskje wolle?" -03020214="Binne jo wis dat jo de map '{0}' en al syn ynhâld wiskje wolle?" -03020215="Binne jo wis dat jo {0} items wiskje wolle?" -03020216="Oan it wiskjen" -03020217="Flater by it wiskjen fan triem of map" - -03020220="Omneame..." -03020221="Flater by it omneamen fan triem of map" -03020222="Triem kopiearje befêstigje" -03020223="Binne jo wis dat jo de triemmen nei it argyf kopiearje wolle?" - -03020230="Map meitsje" -03020231="Mapnamme:" -03020232="Nije map" -03020233="Flater by it meitsjen fan map" - -03020240="Triem meitsje" -03020241="Triem namme:" -03020242="Nije triem" -03020243="Flater by’t meitsjen fan triem" - -03020250="Selektearje" -03020251="Net Selektearje" -03020252="Masker:" - -03020260="Maphistoarje" - -03020280="Triem '{0}' is wizige.\nWolle jo it bywurkje yn it argyf?" -03020281="Kin triem '{0}'\nnet bywurkje" -03020282="Kin bewurker net starte." -03020283="Oan it iepenjen..." - -03020290="Kommentaar" -03020291="&Kommentaar:" - -030202A0="Systeem" - -03020300="Kompjûter" -03020301="Netwurk" - -03020400="Taheakje" -03020401="Utpakke" -03020402="Test" - -03020420="Kopiearje" -03020421="Ferpleatse" -03020422="Wiskje" -03020423="Ynformaasje" - -03020500="Triem spjalte" -03020501="&Spjalt nei:" -03020510="Oan it Spjalten..." -03020520="Spjalte befêstigje" -03020521="Wolle jo de triem spjalte yn {0} dielen?" -03020522="Folumegrutte moat lytser wêze dan de grutte fan it orizjineel" - - -03020600="Triemmen kombinearje" -03020601="&Kombinearje nei:" -03020610="Oan it kombinearjen..." -03020620="Allinne earste triem selektearje" - -03020710="Kontrôlesom oan it berekenjen..." -03020720="Kontrôlesom ynformaasje" -03020721="CRC kontrôlesom foar data:" -03020722="CRC kontrôlesom foar data en nammen:" - -03020800="Oan it skennen..." - -03020900="Eigenskippen" - -; Computer -03031100="Totale grutte" -03031101="Frije romte" -03031102="Kluster grutte" -03031103="Kaartsje" - - -; Network -03031200="Lokale namme" -03031201="Ferskaffer" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Unthâld gebrûk:" -03080002="Oan it komprimearren" -03080003="Oan it ûntkomprimearren" -03080004="Fluggens" -03080005="Wurdearring" -03080006="Totale Wurdearring" -03080007="Hjoeddeiske" -03080008="Resultaat" -03080009="Kear foarbei:" -0308000A="Flaters:" -0308000B="CPU brûkens" -0308000C="Beoardieling / Brûkens" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/gl.txt b/tools/7-Zip/Lang/gl.txt deleted file mode 100644 index 76e867bee0..0000000000 --- a/tools/7-Zip/Lang/gl.txt +++ /dev/null @@ -1,440 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.12 -; Translated by Xosé Calvo -; -; -; -; - -00000000="Galician" -00000001="Galego" -00000002="101" - -; 7-Zip Configuration - -; Title -01000000="Configuración do 7-Zip" - -; Info Page -01000100="Sobre o 7-Zip" -01000103="7-Zip é un programa gratuito. Contodo, pode contribuir co seu desenvolvimento rexistrándose. Se se rexistrar, terá direito a receber apoio técnico." -01000105="Rexistrar" - -; Folders Page -01000200="Cartafois" -01000210="&cartafol de traballo" -01000211="Cartafol &temporario do sistema" -01000212="Cartafol a&ctual" -01000213="&Especificar:" -01000214="Usar só discos removíveis" - -01000281="Especificar unha localización para os ficheiros de arquivo temporarios." - -; System Page -01000300="Sistema" -01000301="Integratar 7-Zip no menú de contexto" -01000302="Menú de contexto en cascata" -01000310="Elementos do Menú de contexto:" - -; Language Page -01000400="Idioma" -01000401="Idioma:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandos do 7-Zip" -02000103="Abrir arquivo" -02000104="Abre o arquivo seleccionado." -02000105="Extrair ficheiros..." -02000106="Extrae ficheiros do arquivo seleccionado." -02000107="Adicionar ao arquivo..." -02000108="Engade os elementos seleccionados ao arquivo." -02000109="Comprobar arquivo" -0200010A="Comproba a integridade do arquivo seleccionado." -0200010B="Extrair Aquí" -0200010C="Extrae ficheiros do arquivo seleccionado para o cartafol actual." -0200010D="Extrair para {0}" -0200010E="Extrae ficheiros para o sub-cartafol." -0200010F="Adicionar a {0}" -02000110="Engade os elementos seleccionados ao arquivo." -02000111="Comprimir e enviar por correo..." -02000112="Comprime os elementos seleccionados para un arquivo e envía o arquivo mediante correo electrónico." -02000113="Comprimir a {0} e enviar por correo" -02000114="Comprime os elementos seleccionados para ese arquivo e envía o arquivo mediante correo electrónico." - -02000140="" -02000141="" - -; Properties -02000203="Camiño" -02000204="Nome" -02000205="Extensión" -02000206="Cartafol" -02000207="Tamaño" -02000208="Tamaño comprimido" -02000209="Atributos" -0200020A="Creado" -0200020B="Último acceso" -0200020C="Modificado" -0200020D="Sólido" -0200020E="Comentado" -0200020F="Encriptado" -02000210="Partir Antes" -02000211="Partir Depois" -02000212="Dicionario" -02000213="CRC" -02000214="Tipo" -02000215="Anti" -02000216="Método" -02000217="OS do Servidor" -02000218="Sistema de Ficheiros" -02000219="Usario" -0200021A="Grupo" -0200021B="Bloco" -0200021C="Comentario" - -; Status bar -02000301="{0} obxecto(s) seleccionados" -02000302="{0} obxecto(s)" - -; List Context Menu -02000401="&Columnas..." - -02000411="&Abrir" -02000412="&Extrair..." - -; ToolBar -02000501="Extrair" - -; Messages -02000601="Este tipo de arquivo non permite actualizacións." -02000602="Non é posíbel actualizar o arquivo {0}" -02000603="Non é posíbel crear o cartafol '{0}'" -02000604="Formato de ficheiro descoñecido." -02000605="Erro" -02000606="Demasiados elementos" -02000607="Non existe nengunha apliación asociada con esta extensión de ficheiro" -02000608="Non se produciron erross" - -; Dialogs -02000702="Dacordo" -02000705="&Si" -02000707="Si a &Todo" -02000709="&Non" -0200070B="Non a T&odo" - -02000710="Cancelar" -02000711="&Cancelar" -02000713="&Fechar" -02000714="Parar" -02000715="Reiniciar" - -02000720="Axuda" - -; Extract dialog -02000800="Extrair" -02000801="E&xtrair para:" -02000802="Contrasinal" - -02000810="Modo nome de cartafol" -02000811="Camiños completos" -02000812="Camiños actuais" -02000813="Sen camiños" - -02000820="Modo sobreposición" -02000821="Con confirmación" -02000822="Sen confirmación" -02000823="Manter os ficheiros existentes" -02000824="Renomear automaticamente" - -02000830="Ficheiros" -02000831="&Ficheiros seleccionados" -02000832="&Todos os ficheiros" - -02000881="Especificar unha localización de destino para os ficheiros extraídos." - -02000890="Extraindo" - -; Overwrite dialog -02000900="Confirmar a Substitución dos Ficheiros" -02000901="O cartafol de destino xa contén un ficheiro co mesmo nome." -02000902="Desexa substituir o ficheiro co mesmo nome" -02000903="por este?" - -02000911="Renomear &automaticamente" - -02000982="{0} bytes" -02000983="modificado en" - -; Messages dialog -02000A00="mensaxes de diagnóstico" - -02000A80="Mensaxe" - -02000A91="Método de compresión non válido para '{0}'." -02000A92="Erro de datos en '{0}'. O ficheiro está mal." -02000A93="CRC fallou en '{0}'. O ficheiro está mal." - -; Password dialog -02000B00="Introduza o contrasinal" -02000B01="Introduza o contrasinal:" -02000B02="&Mostrar o contrasinal" - -; Progress dialog -02000C00="Procesamento" -02000C01="Tempo pasado:" -02000C02="Tempo restante:" -02000C03="Tamaño:" -02000C04="Velocidade:" - -02000C10="&Fondo" -02000C11="&Letras" -02000C12="&Pausa" -02000C13="&Continuar" - -02000C20="Parado" - -02000C30="Ten a certeza de que quer cancelar?" - -; Compress dialog -02000D00="Adicionar ao arquivo" -02000D01="&Arquivo:" -02000D02="&Modo de actualización:" -02000D03="&Format do arquivo:" -02000D04="&Tipo de compresión:" -02000D05="Crar arquvivo &Sólido" -02000D06="&Parámetros:" -02000D07="Opcións" -02000D08="Crear un arquivo SF&X" -02000D09="Múltiples fíos" -02000D0A="Encriptar os &nomes dos ficheiros" -02000D0B="&Nível de compresión:" -02000D0C="Tamaño do &dicionario:" -02000D0D="Tamaño das &palabras:" -02000D0E="Uso da memoria para a Compresión:" -02000D0F="Uso da memoria para a Decompresión:" - -02000D40="Partir en &volumes, bytes:" - -02000D81="Sen compresión" -02000D82="Normal" -02000D83="Máxima" -02000D84="Rápida" -02000D85="Máis rápida" -02000D86="Ultra" - -02000D90="Ver" - -02000DA1="Adicionar e substituir os ficheiros" -02000DA2="Actualizar e adicionar os ficheiros" -02000DA3="Só actualizar os ficheiros existentes" -02000DA4="Sincronizar os ficheiros" - -02000DB1="Todos os ficheiros" - -02000DC0="Comprimir" - -; Columns dialog -02000E00="Columnas" -02000E01="Seleccione as columnas que pretende facer visíbeis neste modo. Use as teclas RePág e AvPág para reordenar as columnas ao seu gosto." -02000E02="A columna seleccionada debería ter" -02000E03="pixeis de &ancho." - -02000E10="Mover para &Arriba" -02000E11="Mover para &Baixo" -02000E12="&Mostrar" -02000E13="&Ocultar" -02000E14="Fixar" - -02000E81="Título" -02000E82="Lonxitude" - -; Testing -02000F90="Proba" - - -; File Manager - -03000000="Xestor de Ficheiros do 7-Zip" - -; Menu -03000102="&Ficheiro" -03000103="&Modificar" -03000104="&Ver" -03000105="&Ferramentas" -03000106="&Axuda" -03000107="F&avoritos" - -; File -03000210="&Abrir" -03000211="Abrir &Dentro" -03000212="Abrir &Fora" -03000220="&Ver" -03000221="&Modificar" -03000230="Reno&mear" -03000231="&Copiar Para..." -03000232="&Mover Para..." -03000233="&Eliminar" -03000240="&Propriedades" -03000241="Come&ntario" -03000250="Crear Cartafol" -03000251="Crear Ficheiro" -03000260="Sa&ir" - -; Edit -03000310="&Desfacer" -03000311="&Refacer" -03000320="Cor&tar" -03000321="&Copiar" -03000322="&Pegar" -03000323="&Eliminar" -03000330="Seleccionar &Todo" -03000331="De-seleccionar Todo" -03000332="&Inverter a Selección" -03000333="Seleccionar..." -03000334="De-seleccionar..." -03000335="Seleccionar por Tipo" -03000336="De-select por Tipo" - -; View -03000410="Icones &Grandes" -03000411="Icones &Pequenos" -03000412="&Lista" -03000413="&Detalles" -03000420="Sen Orde" -03000430="Abrir o Cartafol Raíz" -03000431="Subir un Nível" -03000432="Histórico de Cartafois..." -03000440="&Refrescar" -03000450="&Dous Paineis" -03000451="&Barras de Ferramentas" -03000460="Barra de Ferramentas de arquivos" -03000461="Barra de Ferramentas normal" -03000462="Botóns grandes" -03000463="Mostrar o Texto dos Botóns" - -; Tools -03000510="&Opcións..." -03000511="&Análise" - -; Help -03000610="&Contido..." -03000620="&Acerca do 7-Zip..." - -; Favorites -03000710="&Adicionar o cartafol aos Favoritos como" -03000720="Marcador" - -; Options Dialog - -03010000="Opciós" - -; Plugins -03010100="Extensións" -03010101="&Extensións:" -03010110="Opcións..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistema" -03010302="Asociar 7-Zip con:" -03010310="Extensión" - -; Settings -03010400="Axustes" -03010401="Mostrar o elemento \"..\"" -03010402="Mostrar os icones reais dos ficheiros" -03010410="Mostrar o menú do sistema" - -; Strings - -03020201="Copiar" -03020202="Mover" -03020203="Copiar para:" -03020204="Mover para:" -03020205="A copiar..." -03020206="a mover..." -03020207="Non é posíbel mover ou copiar os elementos para eses cartafois." -03020208="Non é posíbel efectuar esta operación." - -03020210="Confirmar Eliminar Ficheiro" -03020211="Confirmar Eliminar Cartafol" -03020212="Confirmar Eliminar Múltiplos Ficheiros" -03020213="Ten a certeza de que desexa eliminar '{0}'?" -03020214="Ten a certeza de que desexa eliminar o cartafol '{0}' e todo o seu contido?" -03020215="Ten a certeza de que desexa eliminar estes {0} elementos?" -03020216="A eliminar..." -03020217="Erro ao eliminar Ficheiro ou Cartafol" - -03020220="A renomear..." -03020221="Erro ao Renomear Ficheiro ou Cartafol" - -03020230="Crear Cartafol" -03020231="Nome do cartafol:" -03020232="Novo Cartafol" -03020233="Erro ao crear o Cartafol" - -03020240="Crear Ficheiro" -03020241="Nome do Ficheiro:" -03020242="Novo Ficheiro" -03020243="Erro ao crear o Ficheiro" - -03020250="Seleccionar" -03020251="De-seleccionar" -03020252="Máscara:" - -03020260="Histórico dos Cartafois" - -03020280="Modificouse o Ficheiro '{0}'.\nQuéreo actualizar no arquivo?" -03020281="Non é posíbel actualizar o ficheiro\n'{0}'" -03020282="Non se pode iniciar o editor." -03020283="Abrindo..." - -03020290="Comentario" -03020291="&Comentario:" - -030202A0="Sistema" - -03020300="Computador" -03020301="Rede" - -03020400="Adicionar" -03020401="Extrair" -03020402="Probar" - -03020420="Copiar" -03020421="Mover" -03020422="Eliminar" -03020423="Información" - -; Computer -03031100="Tamaño total" -03031101="Tamaño disponíbel" -03031102="Tamaño co cluster" -03031103="Etiqueta" - -; Network -03031200="Nome local" -03031201="Fornecedor" - -; Benchmark Dialog - -03080000="Análise" -03080001="Uso da memoria:" -03080002="Compresión" -03080003="Decompresión" -03080004="Rapidez" -03080005="Relación" -03080006="Relación total" -03080007="Actual" -03080008="Resultante" -03080009="Pases:" -0308000A="Erros:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/he.txt b/tools/7-Zip/Lang/he.txt deleted file mode 100644 index 7bf5989d86..0000000000 --- a/tools/7-Zip/Lang/he.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.65 -; Translated by Jonathan Lahav, updated by peterg (last update: 6 February 2009) -; -; -; -; - -00000000="Hebrew" -00000001="עברית" -00000002="13" - -; 7-Zip Configuration - -; Title -01000000="7-Zip תצורת" - -; Info Page -01000100="7-Zip אודות" -01000103="זו היא תוכנה חופשית. עם זאת, ביכולתך לתמוך בפיתוח התוכנה על ידי הרשמה" -01000104="תמיכה" -01000105="הרשמה" - -; Folders Page -01000200="תיקיות" -01000210="&תיקיית עבודה" -01000211="של המ&ערכת \"Temp\" תיקיית ה" -01000212="&נוכחית" -01000213="&בחר תיקייה:" -01000214="השתמש בהגדרות אלו עבור כוננים ניידים בלבד" - -01000281=".בחר מיקום לקבצי ארכיון זמניים" - -; System Page -01000300="מערכת" -01000301="שלב את התוכנה בתפריט-ההקשר הכללי" -01000302="תפריט מדורג" -01000310="פריטי תפריט:" - -; Language Page -01000400="Language / שפה" -01000401="Language / שפה:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip פקודות" -02000103="פתח ארכיון" -02000104=".פותח את הארכיון שנבחר" -02000105="...חלץ קבצים" -02000106=".מחלץ קבצים מהארכיון שנבחר" -02000107="...הוסף לארכיון" -02000108=".מוסיף את הקבצים שנבחרו לארכיון" -02000109="בדוק ארכיון" -0200010A=".בודק את תקינות הארכיון שנבחר" -0200010B="חלץ לכאן" -0200010C=".מחלץ קבצים מהארכיון שנבחר לתיקייה הנוכחית" -0200010D="{0} -חלץ ל" -0200010E=".מחלץ קבצים לתיקיות משנה" -0200010F="{0} -הוסף ל" -02000110=".מוסיף את הפריטים שנבחרו לארכיון" -02000111="דחוס ושלח בדואר אלקטרוני" -02000112=".דחוס את הפריטים שנבחרו לארכיון ושולח בדואר אלקטרוני" -02000113="דחוס ל- {0} ושלח בדואר אלקטרוני" -02000114=".דוחס את הפריטים שנבחרו לארכיון ושולח בדואר אלקטרוני" - -02000140="<תיקייה>" -02000141="<ארכיון>" - -; Properties -02000203="נתיב" -02000204="שם" -02000205="סיומת" -02000206="תיקייה" -02000207="גודל" -02000208="גודל דחוס" -02000209="תכונות" -0200020A="נוצר" -0200020B="נצפה" -0200020C="השתנה" -0200020D="רצוף" -0200020E="נרשמה הערה" -0200020F="הוצפן" -02000210="פצל לפני" -02000211="פצל אחרי" -02000212="מילון" -02000213="בדיקת סכום הנתונים" -02000214="סוג" -02000215="אנטי" -02000216="שיטה" -02000217="מערכת הפעלה" -02000218="מערכת קבצים" -02000219="משתמש" -0200021A="קבוצה" -0200021B="קטע" -0200021C="הערה" -0200021D="מיקום" -0200021E="תחילית נתיב" -0200021F="תיקיות" -02000220="קבצים" -02000221="גירסה" -02000222="חלק" -02000223="ריבוי חלקים" -02000224="קיזוז" -02000225="קישורים" -02000226="קטעים" -02000227="חלקים" - -02000229="64ביט" -0200022A="אחסון בסדר חשיבות יורד" -0200022B="משאבי מערכת/מעבד" -0200022C="גודל פיזי" -0200022D="גודל כותרת עליונה" -0200022E="בדיקת סיכום" -0200022F="מאפיינים" -02000230="כתובת וירטואלית" - -; Status bar -02000301="(נבחרו {0} פריט(ים" -02000302="{פריטים: {0" - -02000320="קבצים:" -02000321="תיקיות:" -02000322="גודל:" -02000323="הגודל הדחוס:" -02000324="ארכיונים:" - -; List Context Menu -02000401="&...טורים" - -02000411="&פתח" -02000412="&...חלץ" - -; ToolBar -02000501="חלץ" - -; Messages -02000601=".פעולות עדכון לא נתמכות עבור ארכיון זה" -02000602="'{0} אין אפשרות לעדכן את הארכיון" -02000603="'{0}' אין אפשרות ליצור את התיקייה" -02000604=".הקובץ אינו ארכיון הנתמך ע\"י התוכנה" -02000605="שגיאה" -02000606="יותר מדי פריטים" -02000607="סיומת שם הקובץ הנתון לא משוייכת לאף תוכנה" -02000608="אין שגיאות" -02000609="'לא היה ניתן לפתוח את הקובץ '{0}' כארכיון" -0200060A="'?לא היה ניתן לפתוח את הארכיון המקודד '{0}'. סיסמא שגוייה" -0200060B="המערכת אינה יכולה להקצוות את כמות הזיכרון הדרושה" -0200060C="שגיאה לא מוכרת" -0200060D="סוג ארכיון אינו נתמך" - -; Dialogs -02000702="אישור" -02000705="&כן" -02000707="כן ל&הכל" -02000709="&לא" -0200070B="ל&א להכל" - -02000710="ביטול" -02000711="&ביטול" -02000713="&סגור" -02000714="עצור" -02000715="אתחל" - -02000720="עזרה" - -; Extract dialog -02000800="חלץ" -02000801="&חלץ ל:" -02000802="סיסמא" - -02000810="שיטת הנתיבים" -02000811="נתיבים מלאים" -02000812="נתיבים נוכחיים" -02000813="ללא נתיבים" - -02000820="מצב שכתוב קבצים" -02000821="שאל לפני השכתוב" -02000822="שכתב בלי לשאול" -02000823="דלג על קבצים קיימים" -02000824="שינוי שם אוטומטי" -02000825="שינוי שם אוטומטי לקבצים קיימים" - -02000830="קבצים" -02000831="קבצים שנ&בחרו" -02000832="&כל הקבצים" - -02000881=".ציין יעד לחילוץ הקבצים" - -02000890="מחלץ" - -; Overwrite dialog -02000900="אשר החלפת קובץ" -02000901=".תיקיית היעד מכילה כבר קובץ בשם זה" -02000902="האם ברצונך להחליף את הקובץ הקיים" -02000903="?בקובץ הזה" - -02000911="שינוי שם &אוטומטי" - -02000982="{בתים: {0" -02000983="השתנה ב" - -; Messages dialog -02000A00="הודעות איבחון" - -02000A80="הודעה" - -02000A91=".'{0}' שיטת הדחיסה אינה נתמכת עבור" -02000A92=".שגיאת מידע ב '{0}'. הקובץ אינו תקין" -02000A93=".בדיקת סכום הנתונים נכשלה ב '{0}'. הקובץ אינו תקין" -02000A94="'?שגיאת נתון בקובץ המקודד '{0}'. סיסמא שגוייה" -02000A95="'?שגיאה בבדיקת סכום הנתונים בקובץ המקודד '{0}'. סיסמא שגוייה" - -; Password dialog -02000B00="הכנס סיסמא" -02000B01="הכנס סיסמא:" -02000B02="&הצג סיסמא" -02000B03="הכנס שנית את הסיסמא:" -02000B10="הסיסמאות אינן תואמות" -02000B11="(!, #, $, ...) ליצירת הסיסמא תשתמש רק באותיות אנגליות, מספרים או תווים מיוחדים" -02000B12="הסיסמא ארוכה מידי" - -; Progress dialog -02000C00="תהליך" -02000C01="הזמן שעבר:" -02000C02="הזמן שנותר:" -02000C03="גודל כולל:" -02000C04="מהירות:" -02000C05="התקדמות:" -02000C06="יחס דחיסה:" - -02000C10="&רקע" -02000C11="&קדמה" -02000C12="ה&שהה" -02000C13="ה&משך" - -02000C20="מושהה" - -02000C30="?האם את/ה בטוח/ה שברצונך לבטל" - -; Compress dialog -02000D00="הוסף לארכיון" -02000D01="&ארכיון:" -02000D02="מצב &עדכון:" -02000D03="&פורמט הארכיון:" -02000D04="&שיטת דחיסה:" -02000D05="צור קובץ &רצוף" -02000D06="&פרמטרים:" -02000D07="אפשרויות" -02000D08="צור ארכיון &חילוץ-עצמי" -02000D09="ריבוי תהליכים" -02000D0A="&קדד שמות קבצים" -02000D0B="רמת &דחיסה:" -02000D0C="גודל מי&לון:" -02000D0D="גודל &מילה:" -02000D0E="זיכרון הדרוש לדחיסה:" -02000D0F="זיכרון הדרוש לחילוץ:" -02000D10="הצפנה" -02000D11="שיטת הצפנה:" -02000D12="כמות הליכי מעבד/מערכת:" -02000D13="גודל קטע רצוף:" -02000D14="לא רצוף" -02000D15="רצוף" -02000D16="דחוס קבצים שבשיתוף" - -02000D40="פצל לחלקים, בתים:" -02000D41="גודל החלק שגוי" -02000D42="?האם את/ה בטוח/ה שברצונך לפצל את הארכיון לחלקים אלה\nגודל החלק המוגדר: {0} בתים " - -02000D81="אחסון" -02000D82="רגילה" -02000D83="מקסימאלית" -02000D84="מהירה" -02000D85="הכי מהירה" -02000D86="אולטרה" - -02000D90="עיון" - -02000DA1="הוסף והחלף קבצים" -02000DA2="עדכן והוסף קבצים" -02000DA3="רענן קבצים קיימים" -02000DA4="סנכרן קבצים" - -02000DB1="כל הקבצים" - -02000DC0="מבצע דחיסה" - -; Columns dialog -02000E00="עמודות" -02000E01="סמן את העמודות שברצונך שיופיעו בתיקייה זו. השתמש בלחצנים הזז למעלה/למטה כדי לסדר מחדש את העמודות" -02000E02="העמודה שנבחרה תהיה ברוחב" -02000E03=".&פיקסלים" - -02000E10="הזז &למעלה" -02000E11="הזז &למטה" -02000E12="ה&צג" -02000E13="ה&סתר" -02000E14="קבע" - -02000E81="כותרת" -02000E82="רוחב" - -; Testing -02000F90="בודק" - - -; File Manager - -03000000="7-Zip מנהל הקבצים של" - -; Menu -03000102="&קובץ" -03000103="&עריכה" -03000104="&תצוגה" -03000105="&כלים" -03000106="ע&זרה" -03000107="&מועדפים" - -; File -03000210="&פתח" -03000211="פתח ב&תוכנה" -03000212="פתח ב&חלון" -03000220="&הצג" -03000221="&ערוך" -03000230="&שנה שם" -03000231="...העתק ל&" -03000232="...העבר ל&" -03000233="&מחק" -03000240="מ&אפיינים" -03000241="הערה" -03000242="חשב סיכום ביקורת" -03000250="צור תיקייה" -03000251="צור קובץ" -03000260="י&ציאה" -03000270="...פצץ קובץ&" -03000271="...מזג קבצים&" - -; Edit -03000310="&בטל" -03000311="ב&צע מחדש" -03000320="&גזור" -03000321="&העתק" -03000322="&הדבק" -03000323="&מחק" -03000330="בח&ר הכל" -03000331="בטל בחירה" -03000332="ה&פוך בחירה" -03000333="...בחר" -03000334="...בטל בחירה" -03000335="בחר לפי סוג" -03000336="בטל בחירה לפי סוג" - -; View -03000410="סמלים &גדולים" -03000411="סמלים &קטנים" -03000412="&רשימה" -03000413="&פרטים" -03000420="לא מסודר" -03000430="פתח תיקיית שורש" -03000431="חזור שלב אחד" -03000432="...היסטוריית תיקיות" -03000440="ר&ענן" -03000449="תצוגה בפריסה מלאה" -03000450="&שני חלונות" -03000451="&סרגלי כלים" -03000460="סרגל ארכיון" -03000461="סרגל רגיל" -03000462="כפתורים גדולים" -03000463="הצג את פעולת הכפתור מתחתיו" - -; Tools -03000510="&...אפשרויות" -03000511="&מבחן ביצועים" - -; Help -03000610="&...תוכן" -03000620="&...7-Zip אודות" - -; Favorites -03000710="&הוסף תיקייה למועדפים כ" -03000720="סימנייה" - -; Options Dialog - -03010000="אפשרויות" - -; Plugins -03010100="תוספים" -03010101="&תוספים:" -03010110="...אפשרויות" - -; Edit -03010200="עורך" -03010201="&עורך:" - -; System -03010300="מערכת" -03010302="7-Zip שייך ל :" -03010310="תוסף" - -; Settings -03010400="הגדרות" -03010401="\"..\" הצג את הפריט" -03010402="הצג סמלי קבצים אמיתיים" -03010410="הצג את תפריט המערכת" -03010420="בחר את כל ה&שורה" -03010421="הצג קווי &טבלה" -03010430="שיטת &בחירה חלופית" -03010440="השתמש בקטעי זיכרון &גדולים יותר" - -; Strings - -03020201="העתק" -03020202="העבר" -03020203="העתק ל:" -03020204="העבר ל:" -03020205="...מעתיק" -03020206="...מעביר" -03020207=".אין אפשרות להעתיק/להעביר פריטים לתיקיות כאלה" -03020208="הפעולה אינה נתמכת עבור תיקייה זו " -03020209="בחר תיקיית יעד." - -03020210="אשר מחיקת קובץ" -03020211="אשר מחיקת תיקייה" -03020212="אשר מחיקת מספר קבצים" -03020213="?'{0}' האם את/ה בטוח/ה שברצונך למחוק את" -03020214="?האם את/ה בטוח/ה שברצונך למחוק את התיקייה '{0}' ואת כל תוכנה" -03020215="?האם את/ה בטוח/ה שברצונך למחוק את {0} הפריטים האלה" -03020216="...מוחק" -03020217="אירעה שגיאה במהלך מחיקת קובץ או תיקייה" -03020218="המערכת אינה יכולה להעביר קובץ עם נתיב ארוך לפח המחזור" - -03020220="...משנה שם" -03020221="אירעה שגיאה בשינוי שם של קובץ או תיקייה" -03020222="אשר העתקת קובץ" -03020223="?האם את/ה בטוח/ה שברצונך להעתיק קבצים לארכיון" - -03020230="צור תיקייה" -03020231="שם התיקייה:" -03020232="תיקייה חדשה" -03020233="שגיאה ביצירת תיקייה" - -03020240="צור קובץ" -03020241="שם הקובץ:" -03020242="קובץ חדש" -03020243="שגיאה ביצירת קובץ" - -03020250="בחר" -03020251="בטל בחירה" -03020252="מיסוך:" - -03020260="היסטוריית תיקיות" - -03020280="?האם ברצונך לעדכן אותו בארכיון\n.הקובץ '{0}' שונה" -03020281="'{0}'\nאין אפשרות לעדכן את הקובץ" -03020282=".אין אפשרות להפעיל את העורך" -03020283="...פותח" -03020284="(ייתכן והקובץ היינו וירוס (ישנם רווחים גדולים בשם הקובץ" - -03020290="הערה" -03020291="&הערה:" - -030202A0="מערכת" - -03020300="מחשב" -03020301="רשת" -03020302="מסמכים" - -03020400="הוסף" -03020401="חלץ" -03020402="בדוק" - -03020420="העתק" -03020421="העבר" -03020422="מחק" -03020423="מידע" - -03020500="פצל קובץ" -03020501="&פצל ל:" -03020510="...מפצל" -03020520="אשר פיצול" -03020521=" ? האם את/ה בטוח/ה שברצונך לפצל את הקובץ ל{0} חלקים" -03020522="גודל החלק חייב להיות קטן יותר מהקובץ המקורי" - -03020600="מזג קבצים" -03020601="&מזג ל:" -03020610="...מבצע מיזוג" -03020620="בחר רק את החלק הראשון של הקובץ המפוצל" -03020621="לא היה ניתן למצוא קובץ שהוא חלק מהקובץ המפוצל" -03020622="לא ניתן למצוא יותר מחלק אחד של הקובץ המפוצל" - -03020710="...מחשב סיכום ביקורת" -03020720="תוצאות סיכום ביקורת" -03020721="עבור הנתונים CRC בדיקת סיכום ביקורת :" -03020722="עבור הנתונים ושמות CRC בדיקת סיכום ביקורת :" - -03020800="...סורק" - -03020900="מאפיינים" - -03020A01=".הפעולה אינה יכולה להתבצע מתיקייה בעלת נתיב ארוך" -03020A02="הינך חייב/ת לבחור קובץ אחד" -03020A03="הינך חייב לבחור קובץ אחד או יותר" -03020A04="הקובץ {0} כבר קיים" - -; Computer -03031100="גודל כללי" -03031101="שטח פנוי" -03031102="גודל קלסטר/יחידת אחסון " -03031103="תווית" - -; Network -03031200="שם מקומי" -03031201="ספק" - -; Benchmark Dialog - -03080000="מבחן ביצועים" -03080001="זיכרון בשימוש:" -03080002="דוחס" -03080003="מחלץ" -03080004="מהירות" -03080005="קצב" -03080006="סיכום הקצב" -03080007="נוכחי" -03080008="סופי" -03080009="הצלחות:" -0308000A="שגיאות:" -0308000B="משאבי מערכת/מעבד" -0308000C="קצב / שימוש" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/hr.txt b/tools/7-Zip/Lang/hr.txt deleted file mode 100644 index 672d20b0aa..0000000000 --- a/tools/7-Zip/Lang/hr.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.12 -; Translated by Alan Šimek -; 7-Zip 4.53 -; Corrected and updated by Hasan Osmanagić -; 7-Zip 9.07 beta -; Corrected and updated by Stjepan Treger - -00000000="Croatian" -00000001="Hrvatski" -00000002="26-1" - -; 7-Zip Configuration - -; Title -01000000="7-Zip postavke" - -; Info Page -01000100="O 7-Zip-u" -01000103="7-Zip je besplatan. Međutim, možete podržati daljnji razvoj 7-Zipa registriranjem. Kao registriranom korisniku biti će Vam omogućena tehnička podrška." -01000104="Podrška" -01000105="Registriraj se" - -; Folders Page -01000200="Mape" -01000210="&Radna mapa" -01000211="&Privremena sistemska mapa" -01000212="&Trenutna" -01000213="&Navedena:" -01000214="Koristi samo za izmjenjive diskove" - -01000281="Lokaciju za smještaj privremenih datoteka." - -; System Page -01000300="Sustav" -01000301="Integriraj 7-Zip u padajući kontekstni izbornik" -01000302="Padajući kontekstni izbornik" -01000310="Stavke kontekstnog izbornika:" - -; Language Page -01000400="Jezik" -01000401="Jezik:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip naredbe" -02000103="Otvori arhiv" -02000104="Otvori izabranu arhiv" -02000105="Raspakiraj datoteke..." -02000106="Raspakiraj datoteke odabrane arhive" -02000107="Dodaj u arhiv..." -02000108="Dodaj izabrane stavke u arhiv" -02000109="Testiraj arhiv" -0200010A="Testiraj integritet odabrane arhive" -0200010B="Raspakiraj ovdje" -0200010C="Raspakiraj podatke iz odabrane arhive u trenutnu mapu" -0200010D="Raspakiraj u{0}" -0200010E="Raspakiraj podatke u pod-mapu" -0200010F="Dodaj u {0}" -02000110="Dodaj odabrane podatke u arhiv" -02000111="Sažimanje i slanje e-poštom" -02000112="Sažimanje odabranih podataka u arhiv i slanje e-poštom" -02000113="Sažimanje u {0} i slanje e-poštom" -02000114="Sažimanje odabranih podataka u arhiv i slanje e-poštom" - -02000140="" -02000141="" - -; Properties -02000203="Putanja" -02000204="Prema nazivu" -02000205="Tip" -02000206="Mapa" -02000207="Prema veličini" -02000208="Sažeta veličina" -02000209="Atributi" -0200020A="Kreirano" -0200020B="Pristupano" -0200020C="Prema mijenjanju" -0200020D="Zbijeno" -0200020E="Komentar" -0200020F="Enkripcija" -02000210="Podjeli prije" -02000211="Podjeli poslije" -02000212="Rječnik" -02000213="CRC" -02000214="Prema tipu" -02000215="Anti" -02000216="Način" -02000217="Glavni OS" -02000218="Sustav datoteka" -02000219="Korisnik" -0200021A="Grupa" -0200021B="Zbijeno" -0200021C="Komentar" -0200021D="Pozicija" -0200021E="U datoteci" -0200021F="Mape" -02000220="Datoteke" -02000221="Inačica" -02000222="Dio" -02000223="Višedijelni" -02000224="Razmak" -02000225="Veza" -02000226="Blokovi" -02000227="Dijelova" - -02000229="64-bitno" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Fizička veličina" -0200022D="Veličina zaglavlja" -0200022E="Kontrolni zbroj" -0200022F="Karakteristike" -02000230="Virtualna adresa" -02000231="Jedinstvena oznaka" -02000232="Kratko ime" -02000233="Aplikacija stvaranja" -02000234="Veličina sektora" -02000235="Način" -02000236="Poveznica" - -; Status bar -02000301="{0} objekt(a) izabrano" -02000302="{0} objekt(a)" - -02000320="Datoteka(e):" -02000321="Mapa(e):" -02000322="Veličina:" -02000323="Sažeta veličina:" -02000324="Arhive:" - -; List Context Menu -02000401="&Stupci..." - -02000411="&Otvori" -02000412="&Raspakiraj..." - -; ToolBar -02000501="Raspakiraj" - -; Messages -02000601="Obnova nije podržana za ovaj arhiv." -02000602="Ne mogu obnoviti arhiv {0}" -02000603="Ne mogu kreirati mapu '{0}'" -02000604="Datoteka nije podržan arhiv." -02000605="Greška" -02000606="Previše stavki" -02000607="Ni jedan program nije vezan uz navedeni tip" -02000608="Nema grešaka" -02000609="Nemoguće otvoriti datoteku '{0}' kao arhiv" -0200060A="Nemoguće otvoriti kriptiranu arhivu '{0}'. Kriva lozinka?" -0200060B="Sustav ne može pripremiti potrebnu količinu memorije" -0200060C="Nepoznata greška" -0200060D="Tip arhive nije podržan" - -; Dialogs -02000702="U redu" -02000705="&Da" -02000707="Da za &Sve" -02000709="&Ne" -0200070B="Ne za Sv&e" - -02000710="Odustajem" -02000711="&Odustajem" -02000713="&Zatvori" -02000714="&Stani" -02000715="Ponovi" - -02000720="Pomoć" - -; Extract dialog -02000800="Raspakiraj" -02000801="&Raspakiraj u:" -02000802="&Lozinka" - -02000810="Putanja mapa" -02000811="Potpuni tokovi" -02000812="Trenutni tokovi" -02000813="Bez tokova" - -02000820="Natpiši postojeće" -02000821="Pitaj prije natpisivanja postojećeg" -02000822="Natpiši postojeće bez upozorenja" -02000823="Preskoči postojeće datoteke" -02000824="Automatska promjena naziva" -02000825="Automatska promjena naziva postojećih datoteka" - -02000830="Datoteke" -02000831="&Izabrane datoteke" -02000832="&Sve datoteke" - -02000881="Lokacija za raspakiranje datoteka." - -02000890="Raspakiranje" - -; Overwrite dialog -02000900="Potvrdite zamjenu datoteka" -02000901="Ciljana mapa već sadrži datoteku koja se trenutno obrađuje." -02000902="Zamijeniti postojeću" -02000903="datoteku s ovom?" - -02000911="A&utomatska promjena naziva" - -02000982="{0} bajte" -02000983="Izmijenjeno" - -; Messages dialog -02000A00="Dijagnostičke poruke" - -02000A80="Poruka" - -02000A91="Nije podržan način sažimanja za '{0}'." -02000A92="Podatkovna greška u '{0}'. Datoteka je neispravna." -02000A93="CRC greška u '{0}'. Datoteka je neispravna." -02000A94="Greška u kriptiranoj datoteci '{0}'. Kriva lozinka?" -02000A95="CRC greška u kriptiranoj datoteci '{0}'. Kriva lozinka?" - -; Password dialog -02000B00="Unesite lozinku" -02000B01="Unesite lozinku:" -02000B02="&Prikaži lozinku" -02000B03="Ponovite lozinku:" -02000B10="Lozinka nije jednaka" -02000B11="Koristite samo engleska slova, brojeve i specijalne znake (!, #, $, ...) za lozinku" -02000B12="Lozinka je preduga" - -; Progress dialog -02000C00="Obrada" -02000C01="Utrošeno vrijeme:" -02000C02="Preostalo vrijeme:" -02000C03="Veličina:" -02000C04="Brzina:" -02000C05="Obrađeno:" -02000C06="Omjer kompresije:" - -02000C10="U pozadini" -02000C11="U prvom planu" -02000C20="&Pauza" -02000C13="Nastavi" - -02000C20="Pauza" - -02000C30="Poništiti?" - -; Compress dialog -02000D00="Dodavanje u arhiv ili stvaranje novog arhiva" -02000D01="&Arhiv:" -02000D02="&Način obnove:" -02000D03="&Format arhiva:" -02000D04="&Metoda sažimanja:" -02000D05="Kreiraj &zbijeni arhiv" -02000D06="&Parametri:" -02000D07="&Mogućnosti" -02000D08="Kreiraj E&XE arhiv" -02000D09="Višenitnost" -02000D0A="Enkripcija naziva datoteka" -02000D0B="Stupanj sažimanja" -02000D0D="Veličina rječnika:" -02000D0D="&Veličina riječi:" -02000D0E="Korištenje memorije za sažimanje:" -02000D0F="Korištenje memorije za raspakiranje:" -02000D10="Kriptiranje" -02000D11="Metoda kriptiranja:" -02000D12="Broj niti u CPU:" -02000D13="Veličina bloka u zbijenom:" -02000D14="Bez-zbijanja" -02000D15="Zbijeno" -02000D16="Sažmi i datoteke u upotrebi" - -02000D40="Razdvajanje na dijelove, bajta:" -02000D41="Netočna veličina bloka" -02000D42="Veličina bloka: {0} bajtova.\nJeste li sigurni da želite podijeliti u takve dijelove?" - -02000D81="Bez sažimanja" -02000D82="Uobičajeno" -02000D83="Najjače" -02000D84="Brzo" -02000D85="Vrlo brzo" -02000D86="Ultra" - -02000D90="Traži" - -02000DA1="Dodaj i zamjeni datoteke" -02000DA2="Obnovi i dodaj datoteke" -02000DA3="Osvježi postojeće datoteke" -02000DA4="Sinkroniziraj datoteke" - -02000DB1="Sve datoteke" - -02000DC0="Sažimanje u arhiv" - -; Columns dialog -02000E00="Stupci" -02000E01="Označavanje vidljivih stupaca u ovom pogledu. Koristite tipke Page UP i Page Down za uređivanje stupaca po vlastitom izboru." -02000E02="Odabrani stupac treba biti" -02000E03="točaka širo&k." - -02000E10="Pomakni &Gore" -02000E11="Pomakni &Dolje" -02000E12="&Prikaži" -02000E13="&Skriveno" -02000E14="Postavi" - -02000E81="Naslov" -02000E82="Širina" - -; Testing -02000F90="Testiranje" - - -; File Manager - -03000000="7-Zip upravljač datoteka" - -; Menu -03000102="&Datoteke" -03000103="&Uređivanje" -03000104="&Izgled" -03000105="&Alati" -03000106="&Pomoć" -03000107="Omiljene mape" - -; File -03000210="&Otvori" -03000211="Ot&vori mapu" -03000212="Otvori u &sustavu" -03000220="Iz&gled" -03000221="&Uređivanje" -03000230="Prei&menuj" -03000231="&Kopiraj u..." -03000232="Premje&sti u..." -03000233="O&briši" -03000240="Svojs&tva" -03000241="Komentar" -03000242="Izračun kontrolnog zbroja" -03000243="Uspoređivanje" -03000250="Stvo&ri mapu" -03000251="Stvori &datoteku" -03000260="&Izlaz" -03000270="Podije&li datoteku..." -03000271="Spo&ji datoteke..." - -; Edit -03000310="&Poništi" -03000311="Po&novi" -03000320="Od&reži" -03000321="&Kopiraj" -03000322="&Zalijepi" -03000323="O&briši" -03000330="Odaberi &sve" -03000331="Poništi odabir" -03000332="&Obrni odabir" -03000333="Odaberi..." -03000334="Poništi odabir..." -03000335="Odabir po tipu" -03000336="Poništi odabir tipa" - -; View -03000410="&Velike ikone" -03000411="&Male ikone" -03000412="&Popis" -03000413="&Detalji" -03000420="Neso&rtirano" -03000430="&Korijen" -03000431="&Nadmapa" -03000432="Proš&le mape..." -03000440="O&svježi" -03000449="Sadržaj mapa" -03000450="&2 okna" -03000451="Alatne &trake" -03000460="Alatna traka arhiva" -03000461="Standardna alatna traka" -03000462="Velike tipke" -03000463="Prikaži tekst" - -; Tools -03000510="&Mogućnosti..." -03000511="M&jerenje" - -; Help -03000610="&7-Zip pomoć..." -03000620="&O programu..." - -; Favorites -03000710="Dodaj u popis omiljenih uz" -03000720="prečicu" - -; Options Dialog - -03010000="Mogućnosti" - -; Plugins -03010100="Dodaci" -03010101="&Dodaci:" -03010110="Mogućnosti..." - -; Edit -03010200="Uređivač" -03010201="&Program za uređivanje:" -03010202="Program za uspoređivanje:" - -; System -03010300="Sustav" -03010302="Poveži 7-Zip sa:" -03010310="Dodatak" - -; Settings -03010400="Postavke" -03010401="Nadmapa \"..\" " -03010402="Prikaži prave ikone datoteka" -03010410="Prikaži sistemski izbornik" -03010420="&Označi cijeli redak" -03010421="Prikaži &linije mreže" -03010422="Jedan klik za otvaranje stavke" -03010430="Drugi n&ačin označavanja" -03010440="Koristi raspo&loživu memoriju" - -; Strings - -03020201="Kopiraj" -03020202="Premjesti" -03020203="Kopiraj u:" -03020204="Premjesti u:" -03020205="Kopiranje u tijeku..." -03020206="Premještanje u tijeku..." -03020207="Nije moguće pomaknuti ili kopirati podatke ove mape." -03020208="Operacija nije podržana." -03020209="Odabir odredišne mape." - -03020210="Potvrdite brisanje datoteke" -03020211="Potvrdite brisanje mape" -03020212="Potvrdite višestruko brisanje datoteka" -03020213="Obrisati '{0}'?" -03020214="Obrisati mapu '{0}' i sav njezin sadržaj?" -03020215="Obrisati ove {0} podatke?" -03020216="Brisanje u tijeku..." -03020217="Greška pri brisanju datoteke ili mape" -03020218="Sustav ne može premjestiti datoteku sa dugačkom putanjom u Kantu za recikliranje" - -03020220="Preimenovanje u tijeku..." -03020221="Greška pri preimenovanju datoteke ili mape" -03020222="Potvrdite kopiranje datoteka" -03020223="Kopiranje datoteka u arhiv?" - -03020230="Kreiraj mapu" -03020231="Naziv mape:" -03020232="Nova mapa" -03020233="Greška pri kreiranju mape" - -03020240="Kreiraj datoteku" -03020241="Naziv datoteke:" -03020242="Nova datoteka" -03020243="Greška pri kreiranju datoteka" - -03020250="Odaberi" -03020251="Poništi odabir" -03020252="Maska:" - -03020260="Kronologija mapa" - -03020280="Datoteka '{0}' je izmijenjena.\nObnoviti arhiv?" -03020281="Nije moguće obnoviti datoteku\n'{0}'" -03020282="Nije moguće započeti uređivanje." -03020283="Otvaranje u tijeku..." -03020284="Datoteka izgleda kao virus (naziv datoteke sadrži dugačke razmake)." - -03020291="Komentar" -03020291="&Komentar:" - -030202A0="Sustav" - -03020300="Računalo" -03020301="Mreža" -03020302="Dokumenti" - -03020400="Dodaj" -03020401="Raspakiraj" -03020402="Testiraj" - -03020420="Kopiraj" -03020421="Premjesti" -03020422="Obriši" -03020423="Svojstva" - -03020500="Podijeli datoteku" -03020501="&Podijeli u:" -03020510="Dioba..." -03020520="Potvrdite diobu" -03020521="Podijeliti datoteku u {0} dijelova?" -03020522="Veličina diobenog dijela mora biti manja od izvorne datoteke" - -03020600="Spoji datoteke" -03020601="&Spoji u:" -03020610="Spajanje..." -03020620="Označite samo prvu datoteku" -03020621="Nije pronađena datoteka koja je dio razdijeljenih datoteka" -03020622="Pronađena samo jedna datoteka od razdijeljenih datoteka" - -03020710="Izračunavanje kontrolnog zbroja..." -03020720="Info kontrolni zbroj" -03020721="CRC kontrolni zbroj za podatke:" -03020722="CRC kontrolni zbroj za podatke i nazive:" - -03020800="Skeniram..." - -03020900="Svojstva" - -03020A01="Operaciju nemoguće pozvati iz mape koja ima dugačku putanju." -03020A02="Morate obilježiti jednu datoteku" -03020A03="Morate obilježiti jednu ili više datoteka" -03020A04="Datoteka {0} već postoji" - -; Computer -03031100="Ukupni kapacitet" -03031101="Slobodni prostor" -03031102="Veličina klastera" -03031103="Naziv" - -; Network -03031200="Lokalni naziv" -03031201="Pružatelj" - -; Benchmark Dialog - -03080000="Mjerenje" -03080001="Korištenje memorije:" -03080002="Sažimanje" -03080003="Raspakiranje" -03080004="Brzina" -03080005="Ocjena" -03080006="Ukupna ocjena" -03080007="Trenutno" -03080008="Rezultat" -03080009="Prolazi:" -0308000A="Greške:" -0308000B="CPU zauzeće" -0308000C="Ocjena / Zauzeće" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/hu.txt b/tools/7-Zip/Lang/hu.txt deleted file mode 100644 index afe72169c0..0000000000 --- a/tools/7-Zip/Lang/hu.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.07 beta -; Translated by Jozsef Tamas Herczeg -; -; -; -; - -00000000="Hungarian" -00000001="Magyar" -00000002="14" - -; 7-Zip Configuration - -; Title -01000000="7-Zip beállítása" - -; Info Page -01000100="Névjegy" -01000103="A 7-Zip ingyenes szoftver. Ha elnyerte a tetszését, s mégis szeretné támogatni a további fejlesztését, regisztrálja 20 US$ áron, fizethet hitelkártyval vagy más módon." -01000105="Regisztráció" - -; Folders Page -01000200="Mappák" -01000210="&Munkamappa" -01000211="A &rendszer ideiglenes mappája" -01000212="&Jelenlegi" -01000213="&Meghatározott:" -01000214="Csak cserélhető meghajtókhoz" - -01000281="Válassza ki az ideiglenes archív fájlok mappáját." - -; System Page -01000300="Rendszer" -01000301="Hozzáadás a parancsértelmező helyi menüjéhez" -01000302="Lépcsőzetes helyi menü" -01000310="Helyi menü elemek:" - -; Language Page -01000400="Nyelvek" -01000401="Nyelv:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip parancsai" -02000103="Megnyitás" -02000104="Megnyitja a kijelölt archívumot." -02000105="Fájlok kibontása..." -02000106="Kibontja a fájlokat a kijelölt archívumból." -02000107="Behelyezés archívumba..." -02000108="Behelyezi a kijelölt elemeket az archívumba." -02000109="Archívum tesztelése" -0200010A="Ellenőrzi a kijelölt archívum állapotát." -0200010B="Kibontás ide" -0200010C="Fájlok kibontása a kijelölt archívumból a jelenlegi mappába." -0200010D="Kibontás ide: {0}" -0200010E="A fájlok kibontása almappába." -0200010F="Behelyezés: {0}" -02000110="Archívumba helyezi a kijelölt elemeket." -02000111="Tömörítés és küldés..." -02000112="Archívumba tömöríti a kijelölt elemeket és e-mailben elküldi az archívumot." -02000113="Tömörítés {0} archívumba és küldés" -02000114="Archívumba tömöríti a kijelölt elemeket és e-mailben elküldi az archívumot." - -02000140="" -02000141="" - -; Properties -02000203="Útvonal" -02000204="Név" -02000205="Kiterjesztés" -02000206="Mappa" -02000207="Méret" -02000208="Tömörtve" -02000209="Attribútumok" -0200020A="Létrehozva" -0200020B="Hozzáférés" -0200020C="Módosítva" -0200020D="Tömör" -0200020E="Megjegyzés" -0200020F="Titkosított" -02000210="Feldarabolás előtt" -02000211="Feldarabolás után" -02000212="Szótár" -02000213="CRC" -02000214="Típus" -02000215="Anti" -02000216="Módszer" -02000217="Gazda OS" -02000218="Fájlrendszer" -02000219="Felhasználó" -0200021A="Csoport" -0200021B="Blokk" -0200021C="Megjegyzés" -0200021D="Pozíció" - -; Status bar -02000301="{0} objektum kijelölve" -02000302="{0} objektum" - -; List Context Menu -02000401="&Oszlopok..." - -02000411="M&egnyitás" -02000412="&Kibontás..." - -; ToolBar -02000501="Kibontás" - -; Messages -02000601="Az aktualizálás ennél az archívumtípusnál nem támogatott." -02000602="A(z) {0} archívum nem aktualizálható" -02000603="A(z) '{0}' mappát nem lehet létrehozni" -02000604="A fájl nem támogatott archívum." -02000605="Hiba" -02000606="Túl sok elem" -02000607="Nem társított alkalmazást az adott fájlkiterjesztéshez" -02000608="Az archívum hibamentes" - -; Dialogs -02000702="OK" -02000705="&Igen" -02000707="Igen, &mindet" -02000709="&Nem" -0200070B="Egyet &sem" - -02000710="Mégse" -02000711="&Mégse" -02000713="&Bezárás" -02000714="Leállítás" -02000715="Újraindítás" - -02000720="Súgó" - -; Extract dialog -02000800="Kibontás" -02000801="&Kibontás ide:" -02000802="Jelszó" - -02000810="Útvonal" -02000811="Teljes útvonal" -02000812="Jelenlegi útvonal" -02000813="Nincs útvonal" - -02000820="Felülírás" -02000821="Rákérdezés felülírás előtt" -02000822="Felülírás rákérdezés nélkül" -02000823="A létező fájlok kihagyása" -02000824="Automatikus átnevezés" -02000825="A létező fájlok automatikus átnevezése" - -02000830="Fájlok" -02000831="&Kijelölt fájlok" -02000832="&Minden fájl" - -02000881="Határozza meg a kibontott fájlok tárolómappáját." - -02000890="Kibontás" - -; Overwrite dialog -02000900="Fájlcsere megerősítése" -02000901="A célmappa már tartalmazza a feldolgozott fájlt." -02000902="Kívánja lecserélni a létező fájlt" -02000903="ezzel a fájllal?" - -02000911="A&utomatikus átnevezés" - -02000982="{0} bájt" -02000983="módosítva" - -; Messages dialog -02000A00="Diagnosztikai üzenetek" - -02000A80="Üzenet" - -02000A91="A(z) '{0}' tömörítési módja nem támogatott." -02000A92="Adathiba a következőben: '{0}'. A fjl srlt." -02000A93="CRC-hiba a következőben: '{0}'. A fjl srlt." - -; Password dialog -02000B00="Jelszó beírása" -02000B01="Írja be a jelszót:" -02000B02="A &jelszó megjelenítése" - -; Progress dialog -02000C00="Folyamat" -02000C01="Eltelt idő:" -02000C02="Hátralévő idő:" -02000C03="Méret:" -02000C04="Sebesség:" - -02000C10="&Háttérben" -02000C11="&Előtérben" -02000C12="&Szünet" -02000C13="&Folytatás" - -02000C20="Szünet" - -02000C30="Biztos, hogy megszakítja a folyamatot?" - -; Compress dialog -02000D00="Behelyezés archívumba" -02000D01="&Archívum:" -02000D02="Akt&ualizálás módja:" -02000D03="Arcíhvum &formátuma:" -02000D04="Tömörítés &módja:" -02000D05="&Tömör archívum létrehozása" -02000D06="&Tulajdonságok:" -02000D07="Beállítások" -02000D08="SF&X archívum létrehozása" -02000D09="Többszálas" -02000D0A="Fájlnevek &titkosítása" -02000D0B="Tömörítés &foka:" -02000D0C="&Címtár mérete:" -02000D0D="&Szó mérete:" -02000D0E="A tömörítés memóriahasználata:" -02000D0F="A kitömörítés memóriahasználata:" - -02000D40="Darabolás &kötetekre, bájt:" - -02000D81="Raktár" -02000D82="Normál" -02000D83="Legnagyobb" -02000D84="Gyors" -02000D85="Leggyorsabb" -02000D86="Ultra" - -02000D90="Tallózás" - -02000DA1="Fájlok behelyezése és cseréje" -02000DA2="Fájlok aktualizálása és behelyezése" -02000DA3="Létező fájlok frissítése" -02000DA4="Fájlok szinkronizálása" - -02000DB1="Minden fájl" - -02000DC0="Tömörítés" - -; Columns dialog -02000E00="Oszlopok" -02000E01="Jelölje be azokat az oszlopokat melyeket ebben a nézetben megjeleníteni kíván. A Fel s a Le gombbal tetszés szerint átrendezheti az oszlopokat." -02000E02="A kijelölt oszlop legyen " -02000E03="képpont &széles." - -02000E10="&Fel" -02000E11="&Le" -02000E12="&Megjelenítés" -02000E13="&Elrejtés" -02000E14="Beállítás" - -02000E81="Cím" -02000E82="Széles" - -; Testing -02000F90="Tesztelés" - - -; File Manager - -03000000="7-Zip fájlkezelő" - -; Menu -03000102="&Fájl" -03000103="S&zerkesztés" -03000104="&Nézet" -03000105="&Eszközök" -03000106="&Súgó" -03000107="Ked&vencek" - -; File -03000210="M&egnyitás" -03000211="Megnyitás &belül" -03000212="Megnyitás kí&vül" -03000220="&Nézet" -03000221="S&zerkesztés" -03000230="Átn&evezés" -03000231="Más&olás mappába..." -03000232="Át&helyezés mappába..." -03000233="&Törlés" -03000240="T&ulajdonságok" -03000241="&Megjegyzés" -03000250="Mappa létrehozása" -03000251="Fájl létrehozása" -03000260="&Kilépés" -03000270="Fájl&darabolás..." -03000271="Fájl&egyesítés..." - -; Edit -03000310="&Visszavonás" -03000311="&Ismét" -03000320="&Kivágás" -03000321="&Másolás" -03000322="&Beillesztés" -03000323="&Törlés" -03000330="Min&d kijelölése" -03000331="Kijelölés megszüntetése" -03000332="Kijelölés &megfordítása" -03000333="Kijelölés..." -03000334="Megszüntetés..." -03000335="Kijelölés típus alapján" -03000336="Megszüntetés típus alapján" - -; View -03000410="&Nagy ikonok" -03000411="&Kis ikonok" -03000412="&Lista" -03000413="&Részletek" -03000420="Rendezetlen" -03000430="Gyökérmappa megnyitása" -03000431="Egy szinttel följebb" -03000432="Mappa előzmények..." -03000440="&Frissítés" -03000450="&2 panel" -03000451="&Eszköztárak" -03000460="Archiválás eszköztár" -03000461="Szokásos eszköztár" -03000462="Nagy gombok" -03000463="Szövegcímkék megjelenítése" - -; Tools -03000510="&Beállítások..." -03000511="&Teljesítménymérés" - -; Help -03000610="&Tartalomjegyzék..." -03000620="7-Zip &névjegye..." - -; Favorites -03000710="Mappa &hozzáadása a Kedvencekhez mint" -03000720="Könyvjelző" - -; Options Dialog - -03010000="Beállítások" - -; Plugins -03010100="Beépülő modulok" -03010101="&Beépülő modulok:" -03010110="Beállítások..." - -; Edit -03010200="Szerkesztő" -03010201="&Szerkesztő:" - -; System -03010300="Rendszer" -03010302="7-Zip társítása:" -03010310="Beépülő modul" - -; Settings -03010400="Beállítások" -03010401="A \"..\" elem látható" -03010402="Az eredeti fájlikonok láthatók" -03010410="Látható a rendszermenü" -03010420="&Teljes soros kijelölés" -03010421="&Rácsvonalak kijelzése" - -; Strings - -03020201="Másolás" -03020202="Áthelyezés" -03020203="Másolás ide:" -03020204="Áthelyezés ide:" -03020205="Másolás..." -03020206="Áthelyezés..." -03020207="Ilyen mappák esetén az elemek nem helyezhetők át vagy másolhatók." -03020208="A művelet nem támogatott." - -03020210="Fájltörlés megerősítése" -03020211="Mappatörlés megerősítése" -03020212="Több fájltörlés megerősítése" -03020213="Biztos, hogy törölni akarja a következőt: '{0}'?" -03020214="Biztos, hogy törölni akarja a(z) '{0}' mappát és annak teljes tartalmát?" -03020215="Biztos, hogy törölni akarja ezt a(z) {0} elemet?" -03020216="Törlés..." -03020217="Hiba történt a fájl vagy a mappa törlésekor" - -03020220="Átnevezés..." -03020221="Hiba történt a fájl vagy a mappa átnevezésekor" - -03020230="Mappa létrehozása" -03020231="Mappa neve:" -03020232="Új mappa" -03020233="Hiba történt a mappa létrehozásakor" - -03020240="Fájl létrehozása" -03020241="Fájlnév:" -03020242="Új fájl" -03020243="Hiba történt a fájl létrehozásakor" - -03020250="Kijelölés" -03020251="Megszüntetés" -03020252="Maszk:" - -03020260="Mappa előzmények" - -03020280="'{0}'\nA fájl tartalma megváltozott.\nKívánja aktualizálni az archívumban?" -03020281="A fájl nem aktualizálható:\n'{0}'" -03020282="A szerkesztő nem indítható." -03020283="Megnyitás..." - -03020290="Megjegyzés" -03020291="&Megjegyzés:" - -030202A0="Rendszer" - -03020300="Sajátgép" -03020301="Hálózati helyek" - -03020400="Hozzáadás" -03020401="Kibontás" -03020402="Teszt" - -03020420="Másolás" -03020421="Áthelyezés" -03020422="Törlés" -03020423="Tulajdonságok" - -03020500="Fájldarabolás" -03020501="&Darabolás ide:" -03020510="Darabolás..." - -03020600="Fájlegyesítés" -03020601="&Egyesítés ide:" -03020610="Egyesítés..." - -; Computer -03031100="Teljes méret" -03031101="Szabad terület" -03031102="Kluszterméret" -03031103="Címke" - -; Network -03031200="Helyi név" -03031201="Szolgáltató" - -; Benchmark Dialog - -03080000="Teljesítménymérés" -03080001="Memóriahasználat:" -03080002="Tömörítés" -03080003="Kitömörítés" -03080004="Sebesség" -03080005="Értékelés" -03080006="Összértékelés" -03080007="Jelenlegi" -03080008="Eredmény" -03080009="Menetek:" -0308000A="Hibák:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/hy.txt b/tools/7-Zip/Lang/hy.txt deleted file mode 100644 index 68c996a14e..0000000000 --- a/tools/7-Zip/Lang/hy.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.65 -; Translated by Hrant Ohanyan http://www.heyerensoft.narod.ru -; -; -; -; - -00000000="Armenian" -00000001="Հայերեն" -00000002="43" - -; 7-Zip Configuration - -; Title -01000000="7-Zip - Կազմաձևում" - -; Info Page -01000100="7-Zip ծրագրի մասին" -01000103="7-Zip հանդիսանում է ազատ տարածվող ծրագիր: Սակայն եթե գանկանում եք աջակցել 7-Zip-ի զարգացմանը Դուք կարող եք գրանցել ծրագիրը:" -01000104="Աջակցել" -01000105="Գրանցել" - -; Folders Page -01000200="Թղթապանակներ" -01000210="&Աշխատանքային թղթապանակ" -01000211="&Համակարգային ժամանակավոր թղթապանակ" -01000212="&Ընթացիկ" -01000213="&Նշանակել." -01000214="Օգտագործել միայն շարժական կրիչների համար" - -01000281="Նշեք ժամանակավոր արխիվների համար տեղ" - -; System Page -01000300="Համակարգ" -01000301="Ներդնել 7-Zip-ը համատեքստային ընտրացանկում" -01000302="Կասկադային համատեքստային ընտրացանկ" -01000310="Համատեքստային ընտրացանկի բաղադրիչները" - -; Language Page -01000400="Լեզուն" -01000401="Լեզուն." - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip-ի հրամանները" -02000103="Բացել արխիվը" -02000104="Բացել նշված արխիվը" -02000105="Բացել" -02000106="Նշված արխիվից ֆայլերի հանում" -02000107="Ավելացնել արխիվին..." -02000108="Ընդգրկել ընտրված ֆայլերը արխիվում" -02000109="Թեսթավորում" -0200010A="Թեսթավորել ընտրված արխիվը" -0200010B="Բացել այստեղ" -0200010C="Ընտրված արխիվից ֆայլերը բացել տվյալ թղթապանակում:" -0200010D="Բացել{0}-ում" -0200010E="Բացել ֆայլերը ենթամատյանում" -0200010F="Ավելացնել {0}-ին" -02000110="Ավելացնել ընտրված ֆայլերը արխիվին" -02000111="Սեղմել և ուղարկել email-ով..." -02000112="Սեղմել ընտրված ֆայլերը և ուղարկել արխիվը email-ով" -02000113="Սեղմել {0}-ում և ուղարկել email-ով" -02000114="Սեղմել ընտրված ֆայլերը և ուղարկել email-ով:" - -02000140="«Թղթապանակ»" -02000141="«Արխիվ»" - -; Properties -02000203="Ճանապարհը" -02000204="Անունը" -02000205="Ընդլայնումը" -02000206="Թղթապանակ" -02000207="Չափը" -02000208="Սեղմված" -02000209="Հատկություններ" -0200020A="Ստեղծվել է " -0200020B="Բացել" -0200020C="Փոփոխվել է" -0200020D="Անընդհատ" -0200020E="Մեկնաբանություններ" -0200020F="Կոդավորված է" -02000210="Բաժանված է մինչ" -02000211="Բաժանված է" -02000212="Բառարան" -02000213="CRC" -02000214="Տեսակը" -02000215="Հակա" -02000216="Մեթոդը" -02000217="Համակարգը" -02000218="Ֆայլային համակարգ" -02000219="Օգտագործող" -0200021A="Խումբ" -0200021B="Կողփում" -0200021C="Մեկնաբանություններ" -0200021D="Դիրքը" -0200021E="Ճանապարհը" -0200021F="Թղթապանակներ" -02000220="Ֆայլեր" -02000221="Տարբերակը" -02000222="Չափը" -02000223="Բազմահատոր" -02000224="Տեղափոխում" -02000225="Հղումներ" -02000226="Հատվածներ" -02000227="Հատորներ" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Ֆիզիկական չափը" -0200022D="Գլխագրերի չափը" -0200022E="Գումարը" -0200022F="Բնութագրություններ" -02000230="Վիրտուալ հասցեն" - -; Status bar -02000301="Ընտրված են {0} ֆայլեր" -02000302="{0} ֆայլ(եր)" - -02000320="Ֆայլեր." -02000321="Թղթապանակներ." -02000322="Չափը." -02000323="Սեղմված չափը." -02000324="Արխիվներ." - -; List Context Menu -02000401="&Սյուներ..." - -02000411="&Բացել" -02000412="&Հանել..." - -; ToolBar -02000501="Հանել" - -; Messages -02000601="Փոփոխման գործողությունը այս արխիվը չի աջակցում:" -02000602="Հնարավոր չեղավ փոփոխել {0} արխիվը" -02000603="Հնարավոր չէ ստեղծել '{0}' թղթապանակը:" -02000604="Տվյալ ֆայլը արխիվ չէ" -02000605="Սխալ" -02000606="Շատ են էլեմենտները" -02000607="Չկա ասոցացված ծրագիր" -02000608="Սխալներ չկան" -02000609="Հնարավոր չէ բացել '{0}' ֆայլը որպես արխիվ" -0200060A="Հնարավոր չէ բացել '{0}' կողփված արխիվը:Մուտքագրեք գաղտնաբառը:" -0200060B="Բավարար չէ ազատ տեղը" -0200060C="Անհայտ սխալ" -0200060D="Արխիվի չաջակցվող ձևաչափ" - -; Dialogs -02000702="ԼԱՎ" -02000705="&Այո" -02000707="Այո բոլորի &համար" -02000709="&Ոչ" -0200070B="Ոչ բոլորի &համա" - -02000710="Մերժել" -02000711="&Մերժել" -02000713="&Փակել" -02000714="Կանգնեցնել" -02000715="Վերաբեռնել" - -02000720="Օգնություն" - -; Extract dialog -02000800="Հանել" -02000801="&Բացել." -02000802="&Գաղտնագիրը." - -02000810="Ճանապարհ" -02000811="Ամբողջական& ճանապարհ" -02000812="Հա&րաբերական ճանապարհ" -02000813="&Առանց ճանապարհների" - -02000820="Վերագրանցում" -02000821="&Հաստատմամբ" -02000822="Ա&ռանց հաստատման" -02000823="Բաց &թողնել" -02000824="Անվանափոխել" -02000825="Անվանափոխել ինքնուրույնաբար" - -02000830="Ֆայլեր" -02000831="Ընտրված ֆայլեր" -02000832="Բոլոր ֆայլերը" - -02000881="Նշեք հանվող ֆայլերի տեղադրությունը:" - -02000890="Բացվում է" - -; Overwrite dialog -02000900="Հաստատեք ֆայլի փոխարինումը" -02000901="Թղթապանակում արդեն կա մշակված ֆայլ:" -02000902="Փոխարինե՞լ ֆայլը" -02000903="տվյալ ֆայլով:" - -02000911="Անվանափոխել ինքն." - -02000982="{0} բայթ" -02000983="փոփոխված" - -; Messages dialog -02000A00="Հաղորդագրություն" - -02000A80="Հաղորդագրություն" - -02000A91="'{0}' ֆայլի համար սեղման մեթոդը չի աջակցվում" -02000A92="Տվյալների սխալ'{0}'-ում: Ֆայլը վնասված է:" -02000A93="CRC սխալ'{0}'-ում: Ֆայլը վնասված է:" -02000A94="Սխալ '{0}' ֆայլի կոդավորման տվյալներում:Գաղտնագիրը սխա՞լ է:" -02000A95="CRC սխալ '{0}' կոդավորված ֆայլի համար: Գաղտնագիրը սխա՞լ է:" - -; Password dialog -02000B00="Գրեք գաղտնագիրը" -02000B01="&Գրեք գաղտնագիրը." -02000B02="&Ցույց տալ գաղտնագիրը" -02000B03="&Ցույց տալ գաղտնագիրը." -02000B10="Գաղտնագիրը չի համապատասխանում" -02000B11="Գաղտնագրի համար օգտագործեք միայն լատինական այբուբենը, թվեր և հատուկ նշաններ (!, #, $, ...)" -02000B12="Գաղտնագիրը չափազանց երկար է" - -; Progress dialog -02000C00="Գործողությունը" -02000C01="Անցել է." -02000C02="Մնացել է." -02000C03="Չափը." -02000C04="Արագությունը." -02000C05="Ընթացքը." -02000C06="Սեղղման հաճախականությունը" - -02000C10="&Հետևում" -02000C11="&Առջևում" -02000C12="&Դադար" -02000C13="&Շարունակել" - -02000C20="Դադարի մեջ է" - -02000C30="Ընդհատե՞լ գործողությունը:" - -; Compress dialog -02000D00="Ավելացնել արխիվին" -02000D01="&Արխիվը." -02000D02="&Փոփոխման կարգը." -02000D03="&Արխիվի ձևաչափը." -02000D04="&Սեղման մեթոդը." -02000D05="Ստեղծել &Solid արխիվ" -02000D06="&Չափանիշները." -02000D07="&Ընտրանքներ" -02000D08="Ստեղծել SF&X արխիվ" -02000D09="Բ&ազմաշարան" -02000D0A="&Կոդավորել ֆայլերի անունները" -02000D0B="&Սեղման աստիճանը." -02000D0C="Բառարանի &չափը." -02000D0D="Բառի չ&ափը." -02000D0E="Հիշողության ծավալը սեղման համար." -02000D0F="Հիշողության ծավալը բացելու համար." -02000D10="Կոդավորում" -02000D11="Կոդավորման եղանակը." -02000D12="CPU հոսանքների քանակը." -02000D13="Չափը." -02000D14="Ֆայլի չափով" -02000D15="Անդադար" -02000D16="Սեղմել բացված ֆայլերը" - -02000D40="Բաժանել &մասերի` (բայթերով)." -02000D41="Սխալ գործողությունը կատարելիս" -02000D42="Հատորի նշված չափը. {0} բայթ:\nԲաժանե˚լ արխիվը նշված հատորների:" - -02000D81="Առանց սեղման" -02000D82="Նորմալ" -02000D83="Մաքսիմալ" -02000D84="Արագ" -02000D85="Արագ" -02000D86="Ուլտրա" - -02000D90="Դիտել" - -02000DA1="Ավելացնել և սեղմել" -02000DA2="Թարմացնել և ավելացնել" -02000DA3="Թարմացնել" -02000DA4="Սինխրոնիզացնել" - -02000DB1="Բոլոր ֆայլերը" - -02000DC0="Սեղմվում է" - -; Columns dialog -02000E00="Սյուներ" -02000E01="Նշեք սյուները, որոնք պետք է երևան այս թղթապանակում:Կոճակներով` \"Վերև\" և \"Ներքև\" կարող եք նշել սյուների տրման հաջորդականությունը:" -02000E02="Ընտրված սյունները կարող են ունենալ լայնություն" -02000E03="կետեր:" - -02000E10="&Վերև" -02000E11="Ն&երքև" -02000E12="Ցույց &տալ" -02000E13="&Թաքցնել" -02000E14="Տեղակայել" - -02000E81="Անունը" -02000E82="Լայոնւթյունը" - -; Testing -02000F90="Թեսթավորում" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Ֆայլ" -03000103="&Խմբագրել" -03000104="&Տեսքը" -03000105="Գ&ործիքներ" -03000106="&Օգնություն" -03000107="&Ընտրյալները" - -; File -03000210="&Բացել" -03000211="Բացել &ներսում" -03000212="Բացել դրս&ում" -03000220="Դիտել" -03000221="&Խմբագրել" -03000230="Անվա&նափոխել" -03000231="&Պատճենել..." -03000232="&Տեղափոխել..." -03000233="&Ջնջել" -03000240="Հատկու&թյուններ" -03000241="Մեկնաբա&նություններ" -03000242="Արդյունքը" -03000250="&Ստեղծել թղթապանակ" -03000251="Ստեղծել &ֆայլ" -03000260="Դուրս &գալ" -03000270="Բաժանել& ֆայլը..." -03000271="Միացնել& ֆայլը..." - -; Edit -03000310="&Հրաժարվել" -03000311="&Վերադարձնել" -03000320="&Կտրել" -03000321="&Պատճենել" -03000322="Տեղա&դրել" -03000323="&Ջնջել" -03000330="Ընտրել &բոլորը" -03000331="Հանել ընտրումը" -03000332="&Ետարկել &ընտրումը" -03000333="Ընտրել..." -03000334="Հանել ընտրումը..." -03000335="Ընտրել ըստ տեսակի" -03000336="Հանել ըստ տեսակի ընտրումը " - -; View -03000410="&Մեծ նշաններ" -03000411="&Փոքր նշաններ" -03000412="Ցուց&ակ" -03000413="&Աղյուսակ" -03000420="Առանց դասավորման" -03000430="Բոլոր գործող պնակները" -03000431="Անցնել մեկ մակարդակ վերև" -03000432="Թղթապանակների պատմությունը..." -03000440="Թ&արմացնել" -03000449="Հարթ եղանակ" -03000450="&2 վահանակ" -03000451="&Գործիքների վահանակ" -03000460="Ծրագրի կոճակների վահանակ" -03000461="Կոճակների ստանդարտ վահանակ" -03000462="Մեծ կոճակներ" -03000463="Կոճակների անունը" - -; Tools -03000510="Կարգավորումներ..." -03000511="Արտադրողականության թեսթավորում" - -; Help -03000610="&Բովանդակությունը..." -03000620="Ծրագրի &մասին..." - -; Favorites -03000710="Ավելացնել թղթապանակը &ընտրյալներին որպես" -03000720="Էջանիշ" - -; Options Dialog - -03010000="Կարգավորումներ" - -; Plugins -03010100="Ընդլայնումներ" -03010101="&Ընդլայնումներ." -03010110="Հատկու&թյուններ" - -; Edit -03010200="Խմբագիր" -03010201="&Խմբագիր" - -; System -03010300="Համակարգը" -03010302="Ասոցացնել 7-Zip-ի հետ" -03010310="Ընդլայնումներ" - -; Settings -03010400="Կարգավորումներ" -03010401="Ցույց տալ \"..\"" -03010402="Ցույց տալ ֆայլերի իրական պատկերները" -03010410="Ցույց տալ համակարգային ընտրացանկը" -03010420="Կուրսորը ամբողջ տողով" -03010421="Ցույց տալ բաժանարարները" -03010430="Նշման այլընտրանքային եղանակ" -03010440="Օգտագործել հիշողության մեծ ծավալներ" - -; Strings - -03020201="Պատճենել" -03020202="Տեղափոխել" -03020203="Պատճենել." -03020204="Տեղափոխել." -03020205="Պատճենում...." -03020206="Տեղափոխում..." -03020207="Հնարավոր չէ պատճենել ֆայլեր տվյալ թղթապանակների համար" -03020208="Գործողությունը չի աջակցվում" -03020209="Ընտրեք թղթապանակը" - -03020210="Հաստատեք ֆայլի ջնջումը" -03020211="Հաստատեք թղթապանակի ջնջումը" -03020212="Հաստատեք ֆայլերի ջնջումը" -03020213="Իրո՞ք ցանկանում եք ջնջել \"{0}\" " -03020214="Իրո՞ք ցանկանում եք ջնջել \"{0}\" թղթապանակը և նրա պարունակությունը:" -03020215="Իրո՞ք ցանկանում եք ջնջել ({0} հատ) ֆայլերը:" -03020216="Ջնջվում է..." -03020217="Սխալ` ֆայլը կամ թղթապանակը ջնջելիս:" -03020218="Հնարավոր չէ Աղբարկղ տեղափոխել երկար անուններով ֆայլեր:" - -03020220="Անվանափոխում..." -03020221="Սխալ` ֆայլը կամ թղթապանակը անվանափոխելիս:" -03020222="Հաստատեք ֆայլերի պատճենումը" -03020223="Պատճենե՞լ այս ֆայլերը արխիվի մեջ:" - -03020230="Ստեղծել թղթապանակ" -03020231="Թղթապանակի անունը." -03020232="Նոր թղթապանակ" -03020233="Սխալ` թղթապանակ ստեղծելիս" - -03020240="Ստեղծել ֆայլ" -03020241="Ֆայլի անունը." -03020242="Նոր ֆայլ" -03020243="Սխալ` ֆայլի ստեղծման ժամանակ" - -03020250="Ընտրել" -03020251="Հանել ընտրումը" -03020252="Դիմակ." - -03020260="Թղթապանակների պատմությունը" - -03020280="'{0}' ֆայլը փոփոխվել է:\n Թարմացնե՞լ այն արխիվում:" -03020281="Հնարավոր չէ թարմացնել ֆայլը \n'{0}' արխիվում:" -03020282="Հնարավոր չէ բացել խմբագիրը:" -03020283="Բացվում է..." -03020284="Ֆայլը նման է վիրուսի:" - -03020290="Մեկնաբանություններ" -03020291="&Մեկնաբանություններ" - -030202A0="Համակարգը" - -03020300="Համակարգիչը" -03020301="Ցանցը" -03020302="Documents" - -03020400="Ավելացնել" -03020401="Հանել" -03020402="Թեսթավորում" - -03020420="Պատճենել" -03020421="Տեղափոխել" -03020422="Ջնջել" -03020423="Տեղեկություն" - -03020500="Բաժանել ֆայլը" -03020501="&Բաժանել." -03020510="Բաժանվում է..." -03020520="Հաստատեք բաժանումը" -03020521="Իրո˚ք բաժանել ֆայլը {0} հատորների" -03020522="Հատորի չափը պետք է փոքր լինի բաժանվող ֆայլի չափից" - -03020600="Միացնել ֆայլը" -03020601="&Միացնել." -03020610="Միացում..." -03020620="Ընտրեք բաժանված ֆայլի միայն առաջին մասը" -03020621="Հնարավոր չեղավ ճանաչել բաժանված ֆայլը" -03020622="Հնարավոր չեղավ գտնել բաժանված ֆայլի մասերը" - -03020710="Վերջնական գումարի հաշվում..." -03020720="Վերջնական արդյունքը" -03020721="CRC Վերջնական արդյունքը ֆայլերի համար. " -03020722="CRC Վերջնական արդյունքը ֆայլերի և անունների համար." - -03020800="Սկանավորում..." - -03020900="Հատկություններ" - -03020A01="Գործողությունը չի կարող կատարվել այն թղթապանակից, որը ունի երկար ճանապարհ:" -03020A02="Ընտրեք մեկ ֆայլ" -03020A03="Ընտրեք մեկ կամ մի քանի ֆայլեր" -03020A04="{0} ֆայլը արդեն գոյություն ունի" - -; Computer -03031100="Ծավալը" -03031101="Ազատ է" -03031102="Կլաստերի չափը" -03031103="Նշանը" - -; Network -03031200="Լոկալ անունը" -03031201="Սպասարկողը" - -; Benchmark Dialog - -03080000="Արտադրողականության թեսթավորում" -03080001="Հիշողության ծավալը." -03080002="Սեղմվում է" -03080003="Բացում" -03080004="Արագությունը" -03080005="Վարկանիշը" -03080006="Ընդհանուր վարկանիշը" -03080007="Տվյալ" -03080008="Արդյունքում" -03080009="Անցումներ." -0308000A="Սխալներ." -0308000B="CPU Usage" -0308000C="Վարկանիշը / Օգտ." - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/id.txt b/tools/7-Zip/Lang/id.txt deleted file mode 100644 index 9d7fa8f7f7..0000000000 --- a/tools/7-Zip/Lang/id.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.10 beta -; Diterjemahkan oleh Frans Liando -; -; Sumber: http://ikc.dinus.ac.id/bukuputih/istilah-ti-indonesia.txt -; -; - -00000000="Indonesian" -00000001="Bahasa Indonesia" -00000002="33" - -; 7-Zip Configuration - -; Title -01000000="Konfigurasi 7-Zip" - -; Info Page -01000100="Mengenai 7-Zip" -01000103="7-Zip merupakan perangkat lunak gratis. Bagaimanapun, Anda bisa mendukung pengembangan 7-Zip dengan mendaftar.\n\nTerjemahan oleh Frans Liando." -01000104="Dukung" -01000105="Daftar" - -; Folders Page -01000200="Pelipat" -01000210="&Pelipat kerja" -01000211="Pelipat temporer &sistem" -01000212="S&ekarang" -01000213="&Ditentukan:" -01000214="Hanya untuk penggerak bisa pindah" - -01000281="Tetapkan lokasi untuk berkas arsip temporer." - -; System Page -01000300="Sistem" -01000301="Integrasikan 7-Zip ke cangkang menu konteks" -01000302="Menu konteks dikaskade" -01000310="Butir-butir pada menu konteks:" - -; Language Page -01000400="Bahasa" -01000401="Bahasa:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Perintah-perintah 7-Zip" -02000103="Buka arsip" -02000104="Buka arsip terpilih." -02000105="Ekstrak berkas..." -02000106="Ekstrak berkas arsip terpilih." -02000107="Tambah ke arsip..." -02000108="Tambah butir terpilih ke arsip." -02000109="Uji arsip" -0200010A="Uji integritas dari arsip terpilih." -0200010B="Ekstrak di sini" -0200010C="Ekstrak berkas arsip terpilih ke pelipat ini." -0200010D="Ekstrak ke {0}" -0200010E="Ekstrak berkas ke sub pelipat." -0200010F="Tambah ke {0}" -02000110="Tambah butir terpilih ke arsip." -02000111="Mampat dan surat kawat..." -02000112="Mampat butir terpilih ke arsip dan kirim via surat kawat." -02000113="Mampat ke {0} dan surat kawat" -02000114="Mampat butir terpilih ke arsip dan kirim via surat kawat." - -02000140="" -02000141="" - -; Properties -02000203="Lintasan" -02000204="Nama" -02000205="Ekstensi" -02000206="Pelipat" -02000207="Ukuran" -02000208="Ukuran Dikemas" -02000209="Atribut" -0200020A="Dibuat" -0200020B="Diakses" -0200020C="Dimodifikasi" -0200020D="Padat" -0200020E="Komentar" -0200020F="Terenkripsi" -02000210="Belah Sebelum" -02000211="Belah Setelah" -02000212="Kamus" -02000213="CRC" -02000214="Tipe" -02000215="Anti" -02000216="Metode" -02000217="SO Host" -02000218="Sistem Berkas" -02000219="Pengguna" -0200021A="Grup" -0200021B="Blok" -0200021C="Komentar" -0200021D="Posisi" -0200021E="Awalan Lintasan" -0200021F="Pelipat" -02000220="Berkas" -02000221="Versi" -02000222="Volume" -02000223="Multivolume" -02000224="Ofset" -02000225="Tautan" -02000226="Blok" -02000227="Volume" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Ukuran Fisik" -0200022D="Ukuran Tajuk" -0200022E="Ceksum" -0200022F="Karakteristik" -02000230="Alamat Maya" -02000231="ID" -02000232="Nama Singkat" -02000233="Aplikasi Pembuat" -02000234="Ukuran Sektor" -02000235="Ragam" -02000236="Taut" - -; Status bar -02000301="{0} objek terpilih" -02000302="{0} objek" - -02000320="Berkas:" -02000321="Pelipat:" -02000322="Ukuran:" -02000323="Ukuran terkompres:" -02000324="Arsip:" - -; List Context Menu -02000401="&Kolom..." - -02000411="&Buka" -02000412="&Ekstrak..." - -; ToolBar -02000501="Ekstrak" - -; Messages -02000601="Operasi pembaruan tidaklah didukung untuk arsip ini." -02000602="Tak bisa perbarui arsip {0}" -02000603="Tak bisa membuat pelipat '{0}'" -02000604="Berkas arsip tak didukung." -02000605="Kesalahan" -02000606="Terlalu banyak butir" -02000607="Tak ada aplikasi yang diasosiasikan dengan ekstensi dari nama berkas yang diberikan" -02000608="Tidak ada kesalahan" -02000609="Tak bisa membuka berkas arsip '{0}'" -0200060A="Tak bisa membuka arsip terenkripsi '{0}'. Salah kata sandi?" -0200060B="Sistem tak bisa mengalokasikan jumlah memori yang diperlukan" -0200060C="Kesalahan tak dikenal" -0200060D="Tipe arsip tak didukung" - -; Dialogs -02000702="Oke" -02000705="&Ya" -02000707="Ya untuk &semua" -02000709="&Tidak" -0200070B="Tidak untuk s&emua" - -02000710="Batal" -02000711="&Batal" -02000713="&Tutup" -02000714="Henti" -02000715="Start Ulang" - -02000720="Bantuan" - -; Extract dialog -02000800="Ekstrak" -02000801="E&kstrak ke:" -02000802="Kata sandi" - -02000810="Ragam lintasan" -02000811="Nama lengkap lintasan" -02000812="Nama lintasan sekarang" -02000813="Tidak ada nama lintasan" - -02000820="Ragam tulis timpa" -02000821="Konfirmasikan sebelum tulis timpa" -02000822="Tulis timpa tanpa konfirmasi" -02000823="Lewati berkas yang ada" -02000824="Penamaan ulang automatis" -02000825="Penamaan ulang automatis terhadap berkas yang ada" - -02000830="Berkas" -02000831="&Berkas terpilih" -02000832="&Semua berkas" - -02000881="Tetapkan lokasi untuk berkas yang diekstrak." - -02000890="Mengekstrak" - -; Overwrite dialog -02000900="Konfirmasi Penggantian Berkas" -02000901="Pelipat tujuan telah berisi berkas yang terproses." -02000902="Maukah Anda mengganti berkas yang ada" -02000903="dengan yang satu ini?" - -02000911="Nama &Ulang Automatis" - -02000982="{0} bita" -02000983="dimodifikasi pada" - -; Messages dialog -02000A00="Pesan Diagnosa" - -02000A80="Pesan" - -02000A91="Metode kompresi untuk '{0}' tak didukung." -02000A92="Kesalahan data di '{0}'. Berkas ini rusak." -02000A93="CRC gagal di '{0}'. Berkas ini rusak." -02000A94="Kesalahan data di berkas terenkripsi '{0}'. Salah kata sandi?" -02000A95="CRC gagal di berkas terenkripsi '{0}'. Salah kata sandi?" - -; Password dialog -02000B00="Masukkan kata sandi" -02000B01="Masukkan kata sandi:" -02000B02="&Perlihatkan kata sandi" -02000B03="Konfirmasi kata sandi:" -02000B10="Kata sandi tidak cocok" -02000B11="Gunakanlah hanya huruf Indonesia, nomor dan karakter khusus (!, #, $, ...) untuk kata sandi" -02000B12="Kata sandi terlalu panjang" - -; Progress dialog -02000C00="Proses" -02000C01="Waktu terpakai:" -02000C02="Sisa waktu:" -02000C03="Jumlah ukuran:" -02000C04="Kecepatan:" -02000C05="Terproses:" -02000C06="Rasio kompresi:" - -02000C10="Latar &Belakang" -02000C11="Latar &Depan" -02000C12="&Jeda" -02000C13="&Lanjut" - -02000C20="Jeda" - -02000C30="Anda yakin ingin membatalkannya?" - -; Compress dialog -02000D00="Tambah ke arsip" -02000D01="&Arsip:" -02000D02="Ragam perbar&u:" -02000D03="&Format arsip:" -02000D04="&Metode kompresi:" -02000D05="Buat ar&sip padat" -02000D06="&Parameter:" -02000D07="Pilihan" -02000D08="Buat arsip SF&X" -02000D09="Multi-rangkaian" -02000D0A="Enkripsi &nama berkas" -02000D0B="&Level kompresi:" -02000D0C="Ukuran &kamus:" -02000D0D="Ukuran ka&ta:" -02000D0E="Pemakaian memori untuk Pemampatan:" -02000D0F="Pemakaian memori untuk Pengawamampatan:" -02000D10="Enkripsi" -02000D11="Metode enkripsi:" -02000D12="Jumlah CPU:" -02000D13="Ukuran blok padat:" -02000D14="Non-padat" -02000D15="Padat" -02000D16="Kompres berkas bersama" - -02000D40="Belah ke &volume, bita:" -02000D41="Ukuran volume salah" -02000D42="Tentukan ukuran volume: {0} bita.\nAnda Yakin ingin membelah arsip menjadi volume demikian?" - -02000D81="Simpan" -02000D82="Normal" -02000D83="Maksimum" -02000D84="Cepat" -02000D85="Tercepat" -02000D86="Ultra" - -02000D90="Ramban" - -02000DA1="Tambah dan ganti berkas" -02000DA2="Perbarui dan tambah berkas" -02000DA3="Segarkan ulang berkas yang ada" -02000DA4="Sinkronisasikan berkas" - -02000DB1="Semua Berkas" - -02000DC0="Pemampatan" - -; Columns dialog -02000E00="Kolom" -02000E01="Cek kolom yang ingin ditampakkan dalam pelipat ini. Gunakan tombol Pindah ke Atas dan Pindah ke Bawah untuk mengurutkan kolom." -02000E02="Kolom yang terpilih harus" -02000E03="ber-piksel &lebar." - -02000E10="Pindah ke &Atas" -02000E11="Pindah ke &Bawah" -02000E12="Per&lihatkan" -02000E13="&Sembunyikan" -02000E14="Set" - -02000E81="Judul" -02000E82="Lebar" - -; Testing -02000F90="Pengujian" - - -; File Manager - -03000000="Manager Berkas 7-Zip" - -; Menu -03000102="&Berkas" -03000103="&Sunting" -03000104="Tam&pilan" -03000105="P&eralatan" -03000106="Ban&tuan" -03000107="&Kesukaan" - -; File -03000210="&Buka" -03000211="Buka Sisi &Dalam" -03000212="Buka Sisi L&uar" -03000220="&Pandangan" -03000221="&Sunting" -03000230="&Nama Ulang" -03000231="S&alin Ke..." -03000232="P&indahkan Ke..." -03000233="&Hapus" -03000240="P&roperti" -03000241="K&omentari" -03000242="Hitung Ceksum" -03000243="Beda" -03000250="Buat Pelipat" -03000251="Buat Berkas" -03000260="&Keluar" -03000270="Be&lah Berkas..." -03000271="Gabun&g Berkas..." - -; Edit -03000310="&Ulangi" -03000311="&Batalkan" -03000320="Po&tong" -03000321="S&alin" -03000322="Tem&pel" -03000323="&Hapus" -03000330="Pi&lih Semua" -03000331="Tak Memilih Semua" -03000332="Pilih Kebal&ikannya" -03000333="Pilih..." -03000334="Tak Memilih..." -03000335="Pilih Berdasarkan Tipe" -03000336="Tak Memilih Berdasarkan Tipe" - -; View -03000410="Ikon &Besar" -03000411="Ikon &Kecil" -03000412="&Daftar" -03000413="&Rincian" -03000420="Tak Beraturan" -03000430="Buka Akar Pelipat" -03000431="Naik Satu Tingkat" -03000432="Histori Pelipat..." -03000440="&Segarkan Ulang" -03000449="Pandangan Datar" -03000450="&2 Panel" -03000451="Ba&tang Peralatan" -03000460="Batang Peralatan Arsip" -03000461="Ba&tang Peralatan Standar" -03000462="Tombol Besar" -03000463="Perlihatkan Teks Tombol" - -; Tools -03000510="&Pilihan..." -03000511="&Tolok" - -; Help -03000610="Petun&juk..." -03000620="Mengen&ai 7-Zip..." - -; Favorites -03000710="Tambah pelipat ke Kesukaan sebagai" -03000720="Marka Buku" - -; Options Dialog - -03010000="Pilihan" - -; Plugins -03010100="Tambahan" -03010101="&Tambahan:" -03010110="Pilihan..." - -; Edit -03010200="Penyunting" -03010201="P&enyunting:" -03010202="Be&da:" - -; System -03010300="Sistem" -03010302="Asosiasikan 7-Zip dengan:" -03010310="Tambahan" - -; Settings -03010400="Setelan" -03010401="Perlihatkan butir \"..\"" -03010402="Perlihatkan ikon asli berkas" -03010410="Perlihatkan menu sistem" -03010420="&Memilih baris penuh" -03010421="Perlihatkan &garis kisi-kisi" -03010422="Sekali klik untuk membuka" -03010430="Ragam pemilihan &alternatif" -03010440="Gunakan halaman memori &besar" - -; Strings - -03020201="Salin" -03020202="Pindah" -03020203="Salin ke:" -03020204="Pindah ke:" -03020205="Menyalin..." -03020206="Memindah..." -03020207="Anda tak bisa memindah atau menyalin butir untuk pelipat demikian." -03020208="Pengoperasian tak didukung untuk pelipat demikian." -03020209="Pilih pelipat tujuan." - -03020210="Konfirmasi Hapus Berkas" -03020211="Konfirmasi Hapus Pelipat" -03020212="Konfirmasi Hapus Berkas-berkas" -03020213="Anda yakin ingin hapus '{0}'?" -03020214="Anda yakin ingin hapus pelipat '{0}' dan semua isinya?" -03020215="Anda yakin ingin hapus {0} butir?" -03020216="Menghapus..." -03020217="Kesalahan Ketika Menghapus Berkas atau Pelipat" -03020218="Sistem tak bisa memindah suatu berkas yang berlintasan panjang ke Recycle Bin" - -03020220="Nama Ulang..." -03020221="Kesalahan Ketika Penamaan Ulang Berkas atau Pelipat" -03020222="Konfirmasi Salin Berkas" -03020223="Anda yakin ingin menyalin berkas ke arsip?" - -03020230="Buat Pelipat" -03020231="Nama pelipat:" -03020232="Pelipat Baru" -03020233="Kesalahan Membuat Pelipat" - -03020240="Buat Berkas" -03020241="Nama berkas:" -03020242="Berkas Baru" -03020243="Kesalahan Pembuatan Berkas" - -03020250="Pilih" -03020251="Tak Memilih" -03020252="Masker:" - -03020260="Histori Pelipat" - -03020280="Berkas '{0}' telah termodifikasi.\nApakah Anda ingin perbarui berkas dalam arsip?" -03020281="Tak bisa perbarui berkas\n'{0}'" -03020282="Tak bisa memulai penyunting." -03020283="Membuka..." -03020284="Berkas ini tampaknya seperti virus (pada nama berkas berisi spasi yang panjang)." - -03020290="Komentar" -03020291="&Komentari:" - -030202A0="Sistem" - -03020300="Komputer" -03020301="Jaringan" -03020302="Dokumen" - -03020400="Tambah" -03020401="Ekstrak" -03020402="Uji" - -03020420="Salin" -03020421="Pindah" -03020422="Hapus" -03020423="Info" - -03020500="Belah Berkas" -03020501="&Belah ke:" -03020510="Membelah..." -03020520="Konfirmasi Membelah" -03020521="Anda yakin ingin membelah berkas menjadi {0} volume?" -03020522="Ukuran volume seharusnya lebih kecil dari pada ukuran asli berkas" - -03020600="Gabung Berkas" -03020601="&Gabung ke:" -03020610="Menggabung..." -03020620="Pilih bagian pertama saja dari berkas belahan" -03020621="Tak bisa mendeteksi berkas sebagai bagian berkas belahan" -03020622="Tak bisa menemukan lebih dari satu bagian berkas belahan" - -03020710="Hitung ceksum..." -03020720="Informasi ceksum" -03020721="Ceksum CRC untuk data:" -03020722="Ceksum CRC untuk data dan nama:" - -03020800="Memindai..." - -03020900="Properti" - -03020A01="Pengoperasian tak bisa memanggil dari pelipat yang berlintasan panjang." -03020A02="Anda harus memilih satu berkas" -03020A03="Anda harus memilih satu atau lebih berkas" -03020A04="Berkas {0} telah ada" - -; Computer -03031100="Ukuran Total" -03031101="Ruang Kosong" -03031102="Ukuran Gugus" -03031103="Label" - -; Network -03031200="Nama Lokal" -03031201="Penyelenggara" - -; Benchmark Dialog - -03080000="Tolok" -03080001="Pemakaian memori:" -03080002="Pemampatan" -03080003="Pengawamampatan" -03080004="Kecepatan" -03080005="Penilaian" -03080006="Jumlah Penilaian" -03080007="Sekarang" -03080008="Hasil" -03080009="Lewat:" -0308000A="Kesalahan:" -0308000B="Pemakaian CPU" -0308000C="Penilaian/Pemakaian" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/io.txt b/tools/7-Zip/Lang/io.txt deleted file mode 100644 index 4d4951ea58..0000000000 --- a/tools/7-Zip/Lang/io.txt +++ /dev/null @@ -1,453 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.08 beta8 -; Translated by iZoom -; -; -; -; - -00000000="Ido" -00000001="Ido" - -; 7-Zip Configuration - -; Title -01000000="7-Zip-Ajusto" - -; Info Page -01000100="Pri progamo..." -01000103="7-Zip esas gratuita programo. Tamen, vu povas mantenar developado di 7-Zip per enregistrigesar." -01000105="Enregistrigesar" - -; Folders Page -01000200="Dosieruyi" -01000210="&Laborala dosieruyo" -01000211="&Sistemala provizora dosieruyo" -01000212="&Nuna" -01000213="&Definez:" -01000214="&Uzar nur por deprenebla datumportili" - -01000281="Definar loko por provizora arkiva dosieri." - -; System Page -01000300="Sistemo" -01000301="Pozar 7-Zip'o en kuntexta menuo di shelo" -01000302="Kaskada kuntexta menuo" -01000310="Elementi di kuntexta menuo:" - -; Language Page -01000400="Linguo" -01000401="Linguo:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Komandi di 7-Zip" -02000103="Apertar" -02000104="Apertar merkita dosiero." -02000105="Extraktar dosieri..." -02000106="Extraktar dosieri ek merkita arkivo." -02000107="Adjuntar ad arkivo..." -02000108="Adjuntar merkita objekti." -02000109="Verifikar arkivo" -0200010A="Verifiko di integreso di merkita arkivo." -0200010B="Extraktez hike" -0200010C="Extraktar dosieri ek merkita arkivo aden nuna dosieruyo." -0200010D="Extraktez aden {0}" -0200010E="Extraktar dosieri aden subdosieruyo." -0200010F="Adjuntar ad {0}" -02000110="Adjuntar merkita objekti ad arkivo." -02000111="Enarkivigar ed sendar elk-posto..." -02000112="Enarkivigar la merkita objekti e sendar la arkivo." -02000113="Enarkivigar aden {0} e sendar elk-posto..." -02000113="Enarkivigar la merkita objekti e sendar la arkivo." - -02000140="" -02000141="" - -; Properties -02000203="Dosiervoyo" -02000204="Nomo" -02000205="Dosiernoma sufixo" -02000206="Dosieruyo" -02000207="Grandeso" -02000208="Enarkiva grandeso" -02000209="Atributi" -0200020A="Kreita" -0200020B="Acesita" -0200020C="Chanjita" -0200020D="Solida" -0200020E="Komentita" -0200020F="Chifrita" -02000210="Fendita ante" -02000211="Fendita pos" -02000212="Vortaro" -02000213="CRC" -02000214="Tipo" -02000215="Kontre" -02000216="Metodo" -02000217="Operacala sistemo" -02000218="Dosiersistemo" -02000219="Uzero" -0200021A="Grupo" -0200021B="Bloko" -0200021C="Komenturo" -0200021D="Poziciono" - -; Status bar -02000301="{0} objekt(o|i) merkita" -02000302="{0} objekt(o|i)" - -; List Context Menu -02000401="&Kolumni..." - -02000411="&Apertar" -02000412="&Extraktez..." - -; ToolBar -02000501="Extraktar" - -; Messages -02000601="Rinovigo ne suportesas por ica arkivo." -02000602="Rinovigo dil arkivo {0} faliis" -02000603="Krear dosieruyo '{0}' neposiblesis" -02000604="Dosiero ne esas suportata arkivo." -02000605="Eroro" -02000606="Tro multa objekti" -02000607="Programo asociita kun tala tipo dosierala mankas" -02000608="Erori ne es trovita" - -; Dialogs -02000702="B&one" -02000705="&Yes" -02000707="Yes por &omni" -02000709="&No" -0200070B="No por o&mni" - -02000710="Abandonar" -02000711="&Abandonez" -02000713="&Klozez" -02000714="Haltez" -02000715="Ristartez" - -02000720="Helpo" - -; Extract dialog -02000800="&Extraktar" -02000801="E&xtraktar aden:" -02000802="&Pasovorto" - -02000810="Dosiervoyi" -02000811="&Absoluta dosiervoyi" -02000812="&Relativa dosiervoyi" -02000813="&Sen dosiervoyi" - -02000820="Remplasala skribmodo" -02000821="&Kun konfirmo" -02000822="&Sen konfirmo" -02000823="&Omisar existanta dosieri" -02000824="Automata nomchanjo" -02000825="Automata nomchanjo de existanta dosieri" - -02000830="Dosieri" -02000831="&Merkita dosieri" -02000832="&Omna dosieri" - -02000881="Definez loko por dosieri extraktenda." - -02000890="Extrakto" - -; Overwrite dialog -02000900="Konfirmo di nomchanjo" -02000901="Dosieruyo ja kontenas operacata dosiero." -02000902="Kad remplasor esanta dosiero" -02000903="per la ica?" - -02000911="&Automata nomchanjo." - -02000982="{0} bayti*" -02000983="chanjita per" - -; Messages dialog -02000A00="Diagnozala mesaji" - -02000A80="Mesajo" - -02000A91="Kompresmetodo ne esas suportata por dosiero '{0}'." -02000A92="Datumeroro en '{0}'. Dosiero es fushita." -02000A93="CRC-eroro en '{0}'. Dosiero es fushita." - -; Password dialog -02000B00="Pasovorto" -02000B01="Sugestez pasovorto:" -02000B02="&Montrar pasovorto" - -; Progress dialog -02000C00="Proceso" -02000C01="Pasinta tempo:" -02000C02="Restanta tempo:" -02000C03="Grandeso:" -02000C04="Rapideso:" - -02000C10="&Fono" -02000C11="&Avanajo" -02000C12="&Pauzo" -02000C13="&Durez" - -02000C20="Pauzita" - -02000C30="Kad vu ya volas abortar?" - -; Compress dialog -02000D00="Adjuntar aden arkivo" -02000D01="&Arkivo:" -02000D02="R&emplasomodo:" -02000D03="A&rkiva formato:" -02000D04="&Kompresometodo:" -02000D05="Kreor &solida arkivo" -02000D06="&Parametri:" -02000D07="Ajustaji" -02000D08="Krear SF&X-arkivo" -02000D09="Disfiligo" -02000D0A="Chifrar dosier&nomi" -02000D0B="Kompreso&grado" -02000D0C="&Vortarograndeso:" -02000D0D="Vo&rtograndeso:" -02000D0E="Memoruzo por kompresar:" -02000D0F="Memoruzo por extraktar:" - -02000D40="&Fendar por volumini, bayti:" - -02000D81="Sen kompresar" -02000D82="Normala kompreso" -02000D83="Maxim granda kompreso" -02000D84="Rapide" -02000D85="Maxim rapide" -02000D86="Extreme" - -02000D90="Inspektar" - -02000DA1="Adjuntar e remplasar dosieri" -02000DA2="Rinovigar e adjuntar dosieri" -02000DA3="Rifreshigar existanta dosieri" -02000DA4="Sinkronizar dosieri" - -02000DB1="Omna dosieri" - -02000DC0="Kompreso" - -; Columns dialog -02000E00="Kolumni" -02000E01="Merkez kolumni qui es spektenda en ca dosieruyo. Per butoni \"Ad-Supre\" ed \"Ad-Infre\" es posibla riaranjar sekquordino dil kolumni." -02000E02="Merkita kolumno devas havar &larjeso di" -02000E03="punti." - -02000E10="Ad-&Supre" -02000E11="Ad-&Infre" -02000E12="&Montrez" -02000E13="&Celez" -02000E14="Definez" - -02000E81="Nomo" -02000E82="Larjeso" - -; Testing -02000F90="Probado" - - -; File Manager - -03000000="7-Zip-dosieradministrilo" - -; Menu -03000102="&Dosiero" -03000103="&Redakto" -03000104="&Aspekto" -03000105="&Utensili" -03000106="&Helpo" -03000107="&Favoraji" - -; File -03000210="&Apertigar" -03000211="Apertigar int&erne" -03000212="Apertigar e&xter" -03000220="&Vidigar" -03000221="&Redaktar" -03000230="Ch&anjar nomo" -03000231="Ko&piar aden..." -03000232="Transp&ozar aden..." -03000233="E&facar" -03000240="In&heraji" -03000241="Ko&mentar" -03000250="Krear &dosieruyo" -03000251="Krear dos&iero" -03000260="E&kirar" -03000270="F&endar dosiero..." -03000271="Komb&inar dosieri..." - -; Edit -03000310="&Abolisar" -03000311="&Rifacar" -03000320="&Tranchar" -03000321="&Kopiar" -03000322="In&sertar" -03000323="E&facar" -03000330="Merk&ar omno" -03000331="Des&merkar omno" -03000332="&Inversigar merko" -03000333="Merkar..." -03000334="Desmerkar..." -03000335="Merkar segun tipo" -03000336="Desmerkar segun tipo" - -; View -03000410="&Granda ikoneti" -03000411="&Mikra ikoneti" -03000412="&Listo" -03000413="&Tabelo" -03000420="&Nearanjite" -03000430="Apertigar radika dosieruyo" -03000431="Ad-supre ye un nivelo" -03000432="Dosieruya historio..." -03000440="R&inovigar" -03000450="&2 paneli" -03000451="Utens&ila paneli" -03000460="Utensila panelo di arkivo" -03000461="Norma utensila panelo" -03000462="Granda ikoneti" -03000463="Videbla butontexto" - -; Tools -03000510="&Ajusti..." -03000511="&Experienco dil rapideso" - -; Help -03000610="&Konteno..." -03000620="&Pri 7-Zip..." - -; Favorites -03000710="&Adjuntar dosieruyo ad la favorata quale" -03000720="Lektomerkajo" - -; Options Dialog - -03010000="Ajusti" - -; Plugins -03010100="Extraji" -03010101="&Extraji:" -03010110="Ajusti" - -; Edit -03010200="Redaktilo" -03010201="&Redaktilo:" - -; System -03010300="Sistemo" -03010302="Asociar 7-Zip-o kun dosieru:" -03010310="Extrajo" - -; Settings -03010400="Ajusti" -03010401="Montrar \"..\"-elemento" -03010402="Montrar reala dosier-ikoneti" -03010410="Montrar sistemala menuo" -03010420="Merkar &tota lineo" -03010421="Montrar &streki separanta" - -; Strings - -03020201="Kopiar" -03020202="Transpozar" -03020203="Kopiez aden:" -03020204="Transpozez aden:" -03020205="Kopio..." -03020206="Transpozo..." -03020207="Onu ne povas kopiar objekti por tala dosieruyi." -03020208="Operaco ne suportesas." - -03020210="Konfirmo dil efaco di dosiero" -03020211="Konfirmo dil efaco di dosieruyo" -03020212="Konfirmo dil efaco di dosieraro" -03020213="Ka vu ya volas efacar '{0}'?" -03020214="Ka vu ya volas efacar dosieruyo \"{0}\" e omna lua kontenaji?" -03020215="Ka vu ya volas efacar ita {0} objekti?" -03020216="Efaco..." -03020217="Eroro dum efacar di dosiero o dosieruyo" - -03020220="Nomchanjo..." -03020221="Eroro dum nomchanjo di dosiero o dosieruyo" - -03020230="Krear dosieruyo" -03020231="Dosieruynomo:" -03020232="Nova dosieruyo" -03020233="Eroro dum dosieruykreo" - -03020240="Krear dosiero" -03020241="Dosiernomo:" -03020242="Nova dosiero" -03020243="Eroro dum dosierkreo" - -03020250="Merkar" -03020251="Desmerkar" -03020252="Masko:" - -03020260="Dosieruyhistorio" - -03020280="Dosiero '{0}' chanjesis.\nKa vu volas rinovigar lu enarkive?" -03020281="Rinovigo dil dosiero\n'{0}' faliis" -03020282="Startigo dil redaktilo." -03020283="Aperto..." - -03020290="Komento" -03020291="&Komento:" - -030202A0="Sistemo" - -03020300="Komputilo" -03020301="Reto" - -03020400="Adjuntar" -03020401="Extraktar" -03020402="Verifikar" - -03020420="Kopiar" -03020421="Transpozar" -03020422="Efacar" -03020423="Informo" - -03020500="Fendar dosiero" -03020501="&Fendez aden:" -03020510="Fendo..." - -03020600="Kombinar dosieri" -03020601="&Kombinar aden:" -03020610="Kombino..." - -; Computer -03031100="Tota kapacivo" -03031101="Vakanta" -03031102="Faskogrando" -03031103="Etiketo" - -; Network -03031200="Lokala nomo" -03031201="Provizanto" - -; Benchmark Dialog - -03080000="Experienco dil rapideso" -03080001="Memoruzo:" -03080002="Kompresado" -03080003="Extraktado" -03080004="Rapideso" -03080005="Aprecuro" -03080006="Tota aprecuro" -03080007="Kuranta" -03080008="Rezulta" -03080009="Pasi:" -0308000A="Erori:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/is.txt b/tools/7-Zip/Lang/is.txt deleted file mode 100644 index b731399bcc..0000000000 --- a/tools/7-Zip/Lang/is.txt +++ /dev/null @@ -1,514 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by bjossi -; -; -; -; - -00000000="Icelandic" -00000001="Íslenska" -00000002="15" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Stillingar" - -; Info Page -01000100="Um 7-Zip" -01000103="7-Zip er ókeypis forrit. En þú getur stutt þróun 7-Zip með því að skrá þig." -01000104="Aðstoð" -01000105="Skráning" - -; Folders Page -01000200="Möppur" -01000210="&Mappa notuð til vinnslu:" -01000211="&Tímabundin kerfismappa" -01000212="&Núverandi mappa" -01000213="&Skilgreindu möppu:" -01000214="Nota aðeins með flash drifum" - -01000281="Skilgreindu staðsetningu fyir tímabundin gagnasöfn." - -; System Page -01000300="Kerfi" -01000301="Innleiða 7-Zip í flýtivalmynd" -01000302="Lagskipt flýtivalmynd" -01000310="Hlutir í flýtivalmynd:" - -; Language Page -01000400="Tungumál" -01000401="Tungumál:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip skipanir" -02000103="Opna gagnasafn" -02000104="Opnar valið gagnasafn." -02000105="Afþjappa gögn..." -02000106="Afþjappar gögnum frá völdu gagnasafni." -02000107="Bæta við gagnasafn..." -02000108="Bætir skjölum í gagnasafn." -02000109="Prófa gagnasafn" -0200010A="Prófar stöðugleika gagnasafns." -0200010B="Afþjappa hér" -0200010C="Afþjappar gögnum frá gagnasafni í núverandi möppu." -0200010D="Afþjappa í {0}" -0200010E="Afþjappar gögn í hliðar-möppur." -0200010F="Bæta við {0}" -02000110="Bætir gögnum við gagnasafn." -02000111="Þjappa og senda..." -02000112="Þjappar saman gögnum í gagnasafn og sendir það með tölvupósti." -02000113="Þjappa til {0} og senda" -02000114="Þjappar saman gögnum í gagnasafn og sendir það með tölvupósti." - -02000140="" -02000141="" - -; Properties -02000203="Slóð" -02000204="Nafn" -02000205="Tegund skráar" -02000206="Mappa" -02000207="Stærð" -02000208="Þjöppuð stærð" -02000209="Eiginleikar" -0200020A="Búið til" -0200020B="Opnað" -0200020C="Breytt" -0200020D="Þétt" -0200020E="Umsögn" -0200020F="Lykilorð" -02000210="Bútuð niður fyrir" -02000211="Bútuð niður eftir" -02000212="Orðasafn" -02000213="CRC" -02000214="Tegund" -02000215="Anti" -02000216="Aðferð" -02000217="Stýrikerfi" -02000218="Gagnakerfi" -02000219="Notandi" -0200021A="Hópur" -0200021B="Kubbur" -0200021C="Umsögn" -0200021D="Staðsetning" -0200021E="Prefix slóðar" -0200021F="Möppur" -02000220="Skrár" -02000221="Útgáfa" -02000222="Kerfi" -02000223="Fjölkerfi" -02000224="Staðsetning" -02000225="Slóðar" -02000226="Kubbar" -02000227="Kerfi" - -; Status bar -02000301="{0} hlutir valdir" -02000302="{0} hlutir" - -02000320="Skrár:" -02000321="Möppur:" -02000322="Stærð:" -02000323="Þjöppuð stærð:" -02000324="Gagnasöfn:" - -; List Context Menu -02000401="&Runur..." - -02000411="&Opna" -02000412="&Afþjappa..." - -; ToolBar -02000501="Afþjappa" - -; Messages -02000601="Þessi tegund gagnasafns styður ekki uppfærsluskipanir." -02000602="Get ekki uppfært gagnasafn {0}" -02000603="Get ekki búið til möppu '{0}'" -02000604="Viðkomandi skrá er ekki gagnasafn." -02000605="Villa" -02000606="Of margar skrár" -02000607="Það er ekkert forrit í boði fyrir viðkomandi tegund skráar" -02000608="Það eru engar villur" -02000609="Get ekki opnað skrá '{0}' sem gagnasafn" -0200060A="Get ekki opnað læst gagnasafn '{0}'. Rangt lykilorð?" - -; Dialogs -02000702="OK" -02000705="&Já" -02000707="Já við &Öllu" -02000709="&Nei" -0200070B="Nei við &Öllu" - -02000710="Hætta við" -02000711="&Hætta við" -02000713="&Loka" -02000714="Hætta" -02000715="Endurræsa" - -02000720="Hjálp" - -; Extract dialog -02000800="Afþjappa" -02000801="&Afþjappa í:" -02000802="Lykilorð" - -02000810="Slóðar" -02000811="Full slóða-nöfn" -02000812="Núverandi slóða-nöfn" -02000813="Engin slóða-nöfn" - -02000820="Yfirfærsla" -02000821="Spyrja fyrir yfirfærslu" -02000822="Yfirfæra án viðvörunar" -02000823="Sleppa öðrum skrám" -02000824="Endurnefna sjálfkrafa" -02000825="Endurnefna aðrar skrár" - -02000830="Skrár" -02000831="&Valdar skrár" -02000832="&Allar skrár" - -02000881="Skilgreindu staðsetningu fyrir afþjappaðar skrár." - -02000890="Afþjappa" - -; Overwrite dialog -02000900="Staðfesta Yfirfærslu Skráar" -02000901="Skilgreind mappa inniheldur unna skrá nú þegar." -02000902="Vilt þú yfirfæra fyrrverandi skrá" -02000903="með þessari?" - -02000911="&Endurnefna Sjálfkrafa" - -02000982="{0} bæti" -02000983="Breytt þann" - -; Messages dialog -02000A00="Prufuskilaboð" - -02000A80="Skilaboð" - -02000A91="Óstutt samþjöppunaraðferð fyrir '{0}'." -02000A92="Gagnavilla í '{0}'. Skrá er biluð." -02000A93="CRC gekk ekki í '{0}'. Skrá er biluð." -02000A94="Gagnavilla í læstu skjali '{0}'. Rangt lykilorð?" -02000A95="CRC gekk ekki í læstu skjali '{0}'. Rangt lykilorð?" - -; Password dialog -02000B00="Skrifaðu lykilorð" -02000B01="Skrifaðu lykilorð:" -02000B02="&Sýna lykilorð" -02000B03="Skrifaðu lykilorð aftur:" -02000B10="Lykilorðin eru ekki eins" -02000B11="Notaðu aðeins enska stafi, tölur og sérstaka stafi (!, #, $, ...) í lykilorðum" -02000B12="Lykilorðið er of langt" - -; Progress dialog -02000C00="Vinna" -02000C01="Áætlaður tími:" -02000C02="Tími eftir:" -02000C03="Heildarstærð:" -02000C04="Hraði:" -02000C05="Unnið:" -02000C06="Samþjöppunarstuðull:" - -02000C10="&Bakgrunnur" -02000C11="&Fyrirgrunnur" -02000C12="&Bíða" -02000C13="&Halda áfram" - -02000C20="Bíður" - -02000C30="Ertu viss um að þú viljir hætta við?" - -; Compress dialog -02000D00="Bæta við gagnasafn" -02000D01="&Gagnasafn:" -02000D02="&Uppfærsla:" -02000D03="&Tegund gagnasafns:" -02000D04="&Styrkur samþjöppunar:" -02000D05="Gera &þétt gagnasafn" -02000D06="&Skipanir:" -02000D07="Stillingar" -02000D08="Gera &SFX gagnasafn" -02000D09="Fjölvinnsla" -02000D0A="Rugla &skráarnöfn" -02000D0B="Samþjöppun &stig:" -02000D0C="&Stærð orðasafns:" -02000D0D="&Orðastærð:" -02000D0E="Vinnsluminnisnotkun fyrir samþjöppun:" -02000D0F="Vinnsluminnisnotkun fyrir afþjöppun:" -02000D10="Læsing" -02000D11="Aðferð læsingar:" -02000D12="Fjöldi örgjörvakjarna:" -02000D13="Stærð þétts kubbs:" -02000D14="Óþétt" -02000D15="Þétt" -02000D16="Þjappa deildum skrám" - -02000D40="Skipta skráarsafni í &hluta, bæti:" -02000D41="Vitlaus stærð hluts" -02000D42="Skilgreind stærð hluta: {0} bæti.\nErtu viss um að þú viljir skipta gagnasafni í þessa hluta?" - -02000D81="Geyma" -02000D82="Meðallag" -02000D83="Hámark" -02000D84="Hratt" -02000D85="Hraðast" -02000D86="Ultra" - -02000D90="Skoða" - -02000DA1="Bæta við og yfirfæra skrár" -02000DA2="Uppfæra og bæta við skrám" -02000DA3="Lífga upp á núverandi skrár" -02000DA4="Samrýma skrár" - -02000DB1="Allar Skrár" - -02000DC0="Samþjappa" - -; Columns dialog -02000E00="Runur" -02000E01="Veldu runurnar sem þú vilt gera sýnilegar í þessari möppu. Notaðu Fara Upp og Fara Niður takkana til að endurraða rununum." -02000E02="Valda runan ætti að vera" -02000E03="pixlar &vítt." - -02000E10="Fara &Upp" -02000E11="Fara &Niður" -02000E12="&Sýna" -02000E13="&Fela" -02000E14="Setja" - -02000E81="Titill" -02000E82="Vídd" - -; Testing -02000F90="Prófa" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Skrá" -03000103="&Skipanir" -03000104="&Útlit" -03000105="&Tól" -03000106="&Hjálp" -03000107="&Uppáhald" - -; File -03000210="&Opna" -03000211="Opna &inni" -03000212="Opna &úti" -03000220="&Skoða" -03000221="&Breyta" -03000230="&Endurnefna" -03000231="&Afrita í..." -03000232="&Færa til..." -03000233="&Eyða" -03000240="&Stillingar" -03000241="&Umsögn" -03000242="Reikna út checksummu" -03000250="Búa til möppu" -03000251="Búa til skrá" -03000260="&Hætta" -03000270="&Búta niður skrá..." -03000271="&Sameina skrár..." - -; Edit -03000310="&Bakka" -03000311="&Gera aftur" -03000320="&Klippa" -03000321="&Afrita" -03000322="&Líma" -03000323="&Eyða" -03000330="Velja &allt" -03000331="Afvelja allt" -03000332="&Öfugsnúið val" -03000333="Velja..." -03000334="Afvelja..." -03000335="Velja eftir tegund" -03000336="Afvelja eftir tegund" - -; View -03000410="&Stórar myndir" -03000411="&Smáar myndir" -03000412="&Listi" -03000413="&Smáatriði" -03000420="Óflokkað" -03000430="Opna aðalmöppu" -03000431="Til baka" -03000432="Yfirlit yfir notkun" -03000440="&Uppfæra" -03000449="Birta heildarinnihald möppu" -03000450="&2 Vinnsluborð" -03000451="&Tólaröð" -03000460="Tólaröð gagnasafns" -03000461="Eðlileg tólaröð" -03000462="Stórir Takkar" -03000463="Sýna texta á tökkum" - -; Tools -03000510="&Stillingar" -03000511="&Hraðaprufa" - -; Help -03000610="&Leiðarvísir" -03000620="&Um 7-Zip..." - -; Favorites -03000710="&Bæta möppu við uppáhald sem" -03000720="Bókarmerki" - -; Options Dialog - -03010000="Stillingar" - -; Plugins -03010100="Viðbætur" -03010101="&Viðbætur:" -03010110="Stillingar..." - -; Edit -03010200="Breytir" -03010201="&Breytir:" - -; System -03010300="Stýrikerfi" -03010302="Innleiða 7-Zip í:" -03010310="Viðbót" - -; Settings -03010400="Stillingar" -03010401="Sýna \"..\" hluti" -03010402="Sýna réttar skráarmyndir" -03010410="Sýna kerfisvalmynd" -03010420="&Fullt raðaval" -03010421="Sýna &hnitalínur" -03010430="&Öðruvísi valstilling" -03010440="Nota &stórar minnissíður" - -; Strings - -03020201="Afrita" -03020202="Færa" -03020203="Afrita í:" -03020204="Færa skrá/möppu til:" -03020205="Afrita..." -03020206="Færa..." -03020207="Þú getur ekki fært eða afritað svona skrár fyrir þessar möppur." -03020208="Skipun er ekki studd." -03020209="Veldu staðsetningarmöppu." - -03020210="Staðfestu Eyðingu Skráar" -03020211="Staðfestu Eyðingu Möppu" -03020212="Staðfestu Fjöldaeyðingu Skráa" -03020213="Ertu viss um að þú viljir eyða '{0}'?" -03020214="Ertu viss um að þú viljir eyða möppunni '{0}' og öllu innihaldi hennar?" -03020215="Ertu viss um að þú viljir eyða þessum {0} skrám?" -03020216="Eyða..." -03020217="Ekki tókst að eyða Skrá eða Möppu" - -03020220="Endurnefna..." -03020221="Villa við endurnafn Skráar eða Möppu" -03020222="Staðfestu Afritun Skráar" -03020223="Ertu viss um að þú viljir afrita þessa skrá í gagnasafn?" - -03020230="Gera Möppu" -03020231="Nafn möppu:" -03020232="Ný Mappa" -03020233="Villa við gerð möppu" - -03020240="Gera Skrá" -03020241="Nafn Skráar:" -03020242="Ný Skrá" -03020243="Villa við gerð skráar" - -03020250="Velja" -03020251="Afvelja" -03020252="Skyggja:" - -03020260="Yfirlit yfir notkun" - -03020280="Skrá '{0}' var breytt.\nViltu uppfæra hana í gagnasafninu?" -03020281="Get ekki uppfært skrá\n'{0}'" -03020282="Get ekki opnað breyti." -03020283="Opna..." - -03020290="Umsögn" -03020291="&Umsögn:" - -030202A0="Kerfi" - -03020300="Tölva" -03020301="Internet" - -03020400="Bæta við" -03020401="Afþjappa" -03020402="Prófa" - -03020420="Afrita" -03020421="Færa" -03020422="Eyða" -03020423="Upplýsingar" - -03020500="Skipta Skrá" -03020501="&Skipta í:" -03020510="Skipta..." -03020520="Staðfestu skiptingu" -03020521="Ertu viss um að þú viljir skipta skránni í {0} hluta?" -03020522="Stærð hluta verður að vera smærri en stærð upprunalegu skrárinnar" - -03020600="Sameina skrár" -03020601="&Sameina í:" -03020610="Sameina..." -03020620="Veldu aðeins fyrstu skránna" - -03020710="Checksumma í vinnslu..." -03020720="Upplýsingar um checksummu" -03020721="CRC checksumma fyrir gögn:" -03020722="CRC checksumma fyrir gögn og nöfn:" - -03020800="Skanna..." - -03020900="Stillingar" - -; Computer -03031100="Heildarstærð" -03031101="Laust pláss" -03031102="Stærð hóps" -03031103="Titill" - -; Network -03031200="Nafn Hér" -03031201="Þjónustugjafi" - -; Benchmark Dialog - -03080000="Hraðaprufa" -03080001="Vinnsluminnisnotkun:" -03080002="Samþjöppun" -03080003="Afþjöppun" -03080004="Hraði" -03080005="Útkoma" -03080006="Heildarútkoma" -03080007="Núverandi" -03080008="Niðurstaða" -03080009="Fjöldi prufa:" -0308000A="Villur:" -0308000B="Örgjörvanotkun" -0308000C="Útkoma / Notkun" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/it.txt b/tools/7-Zip/Lang/it.txt deleted file mode 100644 index 69bfa7b04d..0000000000 --- a/tools/7-Zip/Lang/it.txt +++ /dev/null @@ -1,544 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.07 Beta -; Translated by Leandro Spagnol -; -; Updated to 7-Zip v9.07 -; by TJL73 -; Some corrections by Vincenzo Reale -; - -00000000="Italian" -00000001="Italiano" -00000002="16" - -; 7-Zip Configuration - -; Title -01000000="Configurazione di 7-Zip " - -; Info Page -01000100="Informazioni" -01000103="7-Zip è un software gratuito e libero. Come utente registrato, potrai aiutare lo sviluppo di 7-Zip e usufruire del supporto tecnico.\n\nLocalizzazione italiana a cura di:\nTJL73 " -01000104="Supporto tecnico" -01000105="Registra" - -; Folders Page -01000200="Cartelle" -01000210="Cartella di lavoro" -01000211="Cartella &TEMP di sistema" -01000212="&Corrente" -01000213="&Specificata:" -01000214="&Utilizza solo per dischi rimovibili" - -01000281="Specifica una cartella per i file temporanei." - -; System Page -01000300="Shell di sistema" -01000301="Integra 7-Zip nel menu contestuale della shell" -01000302="Menu contestuale a cascata" -01000310="Elementi del menu contestuale:" - -; Language Page -01000400="Lingua" -01000401="Lingua:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandi 7-Zip" -02000103="Apri" -02000104="Apre l'archivio selezionato." -02000105="Estrai i file..." -02000106="Estrae i file dall'archivio selezionato." -02000107="Aggiungi all'archivio..." -02000108="Aggiunge i file selezionati all'archivio." -02000109="Verifica l'archivio" -0200010A="Verifica l'integrità dell'archivio selezionato." -0200010B="Estrai qui" -0200010C="Estrae i file dall'archivio selezionato, nella cartella corrente." -0200010D="Estrai in {0}" -0200010E="Estrae i file nella sottocartella specificata." -0200010F="Aggiungi a {0}" -02000110="Aggiunge gli elementi selezionati all'archivio specificato." -02000111="Comprimi ed invia per email..." -02000112="Comprime i file selezionati in un archivio e lo invia per email." -02000113="Comprimi in {0} ed invia per email" -02000114="Comprime i file selezionati nell'archivio specificato e lo invia per email." - -02000140="" -02000141="" - -; Properties -02000203="Percorso" -02000204="Nome" -02000205="Estensione" -02000206="Cartella" -02000207="Dimensione" -02000208="Dimensione compressa" -02000209="Attributi" -0200020A="Creato" -0200020B="Ultimo accesso" -0200020C="Ultima modifica" -0200020D="Solido" -0200020E="Commentato" -0200020F="Cifrato" -02000210="Dividi prima" -02000211="Dividi dopo" -02000212="Dizionario" -02000213="CRC" -02000214="Tipo" -02000215="Anti" -02000216="Metodo" -02000217="OS destinatario" -02000218="File system" -02000219="Utente" -0200021A="Gruppo" -0200021B="Blocco" -0200021C="Commento" -0200021D="Posizione" -0200021E="Percorso completo" -0200021F="Cartelle" -02000220="File" -02000221="Versione" -02000222="Unità" -02000223="Unità multiple" -02000224="Offset" -02000225="Collegamenti" -02000226="Blocchi" -02000227="Unità" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Dimensione fisica" -0200022D="Dimensione intestazioni" -0200022E="Checksum" -0200022F="Caratteristiche" -02000230="Indirizzo virtuale" -02000231="ID" -02000232="Nome breve" -02000233="Applicativo origine" -02000234="Dimensione settore" -02000235="Modalità" -02000236="Collegamento" - -; Status bar -02000301="Oggetti selezionati: {0}" -02000302="{0} oggetti" - -02000320="File:" -02000321="Cartelle:" -02000322="Dimensione:" -02000323="Dimensione compressa:" -02000324="Archivi:" - -; List Context Menu -02000401="&Colonne..." - -02000411="&Apri" -02000412="&Estrai..." - -; ToolBar -02000501="Estrai" - -; Messages -02000601="Non è possibile effettuare aggiornamenti su questo archivio." -02000602="Impossibile aggiornare l'archivio {0}" -02000603="Impossibile creare la cartella '{0}'" -02000604="Questo file non è un archivio supportato." -02000605="Errore" -02000606="Troppi elementi" -02000607="L'estensione del file scelto non è associata a nessun programma." -02000608="Nessun errore." -02000609="Impossibile aprire il file '{0}' come archivio." -0200060A="Impossibile aprire l'archivio cifrato '{0}'. Password errata?" -0200060B="Non è possibile allocare la quantità di memoria richiesta" -0200060C="Errore sconosciuto" -0200060D="Archivio non supportato" - -; Dialogs -02000702="OK" -02000705="&Sì" -02000707="Sì per &tutti" -02000709="&No" -0200070B="No per t&utti" - -02000710="Annulla" -02000711="&Annulla" -02000713="&Chiudi" -02000714="Ferma" -02000715="Riavvia" - -02000720="Aiuto" - -; Extract dialog -02000800="Estrai" -02000801="E&strai in:" -02000802="Password" - -02000810="Struttura delle cartelle" -02000811="Percorsi completi" -02000812="Percorsi attuali" -02000813="Nessun percorso" - -02000820="Sovrascrittura" -02000821="Chiedi prima di sovrascrivere" -02000822="Sovrascrivi senza chiedere" -02000823="Non sovrascrivere i file esistenti" -02000824="Rinomina automaticamente" -02000825="Rinomina autom. i file esistenti" - -02000830="File" -02000831="File &selezionati" -02000832="&Tutti i file" - -02000881="Specifica una cartella in cui estrarre i file." - -02000890="Estrazione in corso..." - -; Overwrite dialog -02000900="Conferma la sovrascrittura del file" -02000901="File già esistente nella cartella di destinazione." -02000902="Vuoi sostituire il file esistente" -02000903="con questo?" - -02000911="&Rinomina automaticamente" - -02000982="{0} byte" -02000983="modificato il" - -; Messages dialog -02000A00="Messaggi di diagnostica" - -02000A80="Messaggio" - -02000A91="Metodo di compressione non supportato per '{0}'." -02000A92="Errore nei dati in '{0}'. Il file è danneggiato." -02000A93="CRC non corretto in '{0}'. Il file è danneggiato." -02000A94="Errore nel file cifrato '{0}'. Password errata?" -02000A95="CRC errato nel file cifrato '{0}'. Password errata?" - -; Password dialog -02000B00="Inserisci password" -02000B01="&Inserisci password:" -02000B02="Mostra pass&word" -02000B03="&Reinserisci password:" -02000B10="Password differenti" -02000B11="Per la password, utilizzare solo lettere ASCII, numeri e caratteri speciali (!, #, $, ...)" -02000B12="La password è troppo lunga" - -; Progress dialog -02000C00="Processo" -02000C01="Tempo trascorso:" -02000C02="Tempo rimanente:" -02000C03="Dimensione totale:" -02000C04="Velocità:" -02000C05="Elaborato:" -02000C06="Rapporto compressione:" - -02000C10="&In background" -02000C11="&In primo piano" -02000C12="&Pausa" -02000C13="&Riprendi" - -02000C20="In pausa" - -02000C30="Sei sicuro di voler annullare?" - -; Compress dialog -02000D00="Aggiungi all'archivio" -02000D01="Nome &archivio:" -02000D02="Modalità a&ggiornamento:" -02000D03="&Formato dell'archivio:" -02000D04="&Metodo di compressione:" -02000D05="Crea archivio &solido" -02000D06="Parametri &opzionali:" -02000D07="Opzioni" -02000D08="Crea archivio auto-&estraente" -02000D09="Usa multi-threading" -02000D0A="Cifra anche il &nome dei file" -02000D0B="&Livello di compressione:" -02000D0C="Dimensione &Dizionario:" -02000D0D="Dimensioni &Parola:" -02000D0E="Quantità memoria per compressione:" -02000D0F="Quantità memoria per decompressione:" -02000D10="Cifratura" -02000D11="Metodo &cifratura:" -02000D12="N&umero di flussi (thread) CPU:" -02000D13="Dimensione del &blocco solido:" -02000D14="Non-solido" -02000D15="Solido" -02000D16="Comprimi file condivisi" - -02000D40="Di&vidi in più file (dimensione in byte):" -02000D41="Dimensione non corretta" -02000D42="Dimensione specificata: {0} byte.\nSicuro di voler dividere l'archivio in questo modo?" - -02000D81="Nessuna" -02000D82="Normale" -02000D83="Massima" -02000D84="Veloce" -02000D85="Velocissima" -02000D86="Ultra" - -02000D90="Sfoglia" - -02000DA1="Aggiungi e sostituisci i file" -02000DA2="Aggiorna e aggiungi i file" -02000DA3="Aggiorna i file esistenti" -02000DA4="Sincronizza i file" - -02000DB1="Tutti i file" - -02000DC0="Compressione in corso..." - -; Columns dialog -02000E00="Colonne" -02000E01="Segna le colonne che vuoi rendere visibili in questa cartella. Usa i pulsanti Sposta in alto ed in basso per riordinare le colonne." -02000E02="Le colonne selezionate dovrebbero essere larghe" -02000E03="pixel." - -02000E10="Sposta in &alto" -02000E11="Sposta in &basso" -02000E12="&Mostra" -02000E13="&Nascondi" -02000E14="Imposta" - -02000E81="Titolo" -02000E82="Larghezza" - -; Testing -02000F90="Verifica archivio..." - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&File" -03000103="&Modifica" -03000104="&Visualizza" -03000105="&Strumenti" -03000106="&Aiuto" -03000107="&Preferiti" - -; File -03000210="&Apri" -03000211="Apri in &7-Zip File Manager" -03000212="Apri in E&xplorer" -03000220="&Visualizza" -03000221="Apri con l'&editor predefinito" -03000230="Rino&mina" -03000231="&Copia in..." -03000232="&Sposta in..." -03000233="&Elimina" -03000240="&Proprietà" -03000241="Comme&nto..." -03000242="Calcola chec&ksum" -03000243="Comparazione differenze (Diff)" -03000250="Crea cartella" -03000251="Crea file" -03000260="E&sci" -03000270="&Dividi il file..." -03000271="&Unisci i file..." - -; Edit -03000310="&Annulla" -03000311="&Ripeti" -03000320="Tag&lia" -03000321="&Copia" -03000322="&Incolla" -03000323="&Elimina" -03000330="&Seleziona tutto" -03000331="&Deseleziona tutto" -03000332="In&verti selezione" -03000333="Seleziona..." -03000334="Deseleziona..." -03000335="Seleziona per tipo" -03000336="Deseleziona per tipo" - -; View -03000410="Icone &grandi" -03000411="Icone &piccole" -03000412="&Elenco" -03000413="&Dettagli" -03000420="Nessun ordine" -03000430="Apri cartella principale" -03000431="Livello superiore" -03000432="Cronologia..." -03000440="&Aggiorna" -03000449="Vista non strutturata" -03000450="Interfaccia a &2 pannelli" -03000451="Barre degli &strumenti" -03000460="Barra archivio" -03000461="Barra standard" -03000462="Icone grandi" -03000463="Mostra etichette di testo" - -; Tools -03000510="&Opzioni..." -03000511="&Benchmark" - -; Help -03000610="&Guida..." -03000620="&Informazioni su 7-Zip..." - -; Favorites -03000710="&Aggiungi la cartella ai Preferiti come" -03000720="Collegamento" - -; Options Dialog - -03010000="Opzioni" - -; Plugins -03010100="Plugin" -03010101="Plugin:" -03010110="&Opzioni..." - -; Edit -03010200="Editor" -03010201="&Editor predefinito:" -03010202="Comparatore &differenze (Diff):" - -; System -03010300="Sistema" -03010302="Associa 7-Zip a:" -03010310="Plugin" - -; Settings -03010400="Impostazioni" -03010401="Mostra l'elemento \"..\"" -03010402="Mostra le icone dei file" -03010410="Mostra le icone di sistema" -03010420="Selezione a &riga intera" -03010421="Mostra &griglia" -03010422="Click singolo per aprire una voce" -03010430="Modalità di selezione &alternativa" -03010440="Utilizza pagine &larghe di memoria" - -; Strings - -03020201="Copia" -03020202="Sposta" -03020203="Copia in:" -03020204="Sposta in:" -03020205="Copia in corso..." -03020206="Spostamento in corso..." -03020207="Non è possibile spostare o copiare file in queste cartelle." -03020208="Operazione non supportata per questa cartella." -03020209="Selezionare la cartella di destinazione." - -03020210="Conferma l'eliminazione del file" -03020211="Conferma l'eliminazione della cartella" -03020212="Conferma l'eliminazione di più elementi" -03020213="Sei certo di voler eliminare '{0}'?" -03020214="Sei certo di voler eliminare la cartella '{0}' e tutto il suo contenuto?" -03020215="Sei certo di voler eliminare questi {0} elementi?" -03020216="Eliminazione in corso..." -03020217="Errore nell'eliminazione del file o della cartella" -03020218="Impossibile spostare un file con percorso lungo nel Cestino" - -03020220="Rinomina in corso..." -03020221="Errore nella rinomina del file o cartella" -03020222="Conferma copia" -03020223="Sei sicuro di voler copiare questi file nell'archivio" - -03020230="Crea cartella" -03020231="Nome cartella:" -03020232="Nuova cartella" -03020233="Errore nella creazione della cartella" - -03020240="Crea file" -03020241="Nome file:" -03020242="Nuovo file" -03020243="Errore nella creazione del file" - -03020250="Seleziona" -03020251="Deseleziona" -03020252="Filtro:" - -03020260="Cronologia" - -03020280="Il file '{0}' è stato modificato.\nVuoi aggiornare l'archivio?" -03020281="Impossibile aggiornare il file\n'{0}'" -03020282="Impossibile avviare l'editor." -03020283="Apertura in corso... " -03020284="Il file sembra essere un virus (contiene molti spazi nel nome)." - -03020290="Commento" -03020291="&Commento:" - -030202A0="Sistema" - -03020300="Computer" -03020301="Rete" -03020302="Documenti" - -03020400="Aggiungi" -03020401="Estrai" -03020402="Verifica" - -03020420="Copia" -03020421="Sposta" -03020422="Elimina" -03020423="Proprietà" - -03020500="Dividi file" -03020501="&Dividi in:" -03020510="Dividi in..." -03020520="Conferma divisione" -03020521="Sicuro di voler dividere l'archivio in {0} porzioni?" -03020522="La dimensione di ciascuna porzione deve essere più piccola della dimensione totale dell'archivio originale" - -03020600="Unisci i file" -03020601="&Unisci in:" -03020610="Unisci..." -03020620="Seleziona solo la prima parte del file diviso" -03020621="Impossibile riconoscere il file come archivio diviso" -03020622="Impossibile trovare più di una parte dell'archivio diviso" - -03020710="Calcolo del checksum..." -03020720="Informazioni sul checksum" -03020721="CRC checksum sui dati:" -03020722="CRC checksum su dati e nomi:" - -03020800="Scansione..." - -03020900="Proprietà" - -03020A01="L'operazione non può essere richiamata da una cartella con percorso lungo." -03020A02="Devi selezionare un file" -03020A03="Devi selezionare almeno un file" -03020A04="Il file {0} è già presente" - -; Computer -03031100="Capacità" -03031101="Disponibili" -03031102="Dimensione dei cluster" -03031103="Etichetta" - -; Network -03031200="Nome locale" -03031201="Rete" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Utilizzo memoria:" -03080002="Compressione in corso" -03080003="Decompressione in corso" -03080004="Velocità" -03080005="Valutazione" -03080006="Valutazione totale" -03080007="Attuale" -03080008="Risultante" -03080009="Passaggi:" -0308000A="Errori:" -0308000B="Utilizzo CPU" -0308000C="Stima / Utilizzo" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ja.txt b/tools/7-Zip/Lang/ja.txt deleted file mode 100644 index d578dfad37..0000000000 --- a/tools/7-Zip/Lang/ja.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 beta -; Translated by Komuro, Mick, 2chBBS-software -; Additions and minor fixes by Stepanushkin Dmitry -; Some fixes by Crus Mitsuaki -; -; - -00000000="Japanese" -00000001="日本語" -00000002="17" - -; 7-Zip Configuration - -; Title -01000000="7-Zip設定" - -; Info Page -01000100="7-Zipについて" -01000103="7-Zipはフリーウェアです。しかし、7-Zipに有料で登録し開発を支援する事が出来ます。登録したユーザーは技術的なサポートを受ける事が出来ます。" -01000104="サポート" -01000105="登録(&R)" - -; Folders Page -01000200="フォルダ(&F)" -01000210="作業フォルダ(&W)" -01000211="一時フォルダ(&S)" -01000212="カレントフォルダ(&C)" -01000213="フォルダ指定(&P):" -01000214="リムーバブルドライブのみ使用する(&R)" - -01000281="作業フォルダ指定" - -; System Page -01000300="システム" -01000301="右クリックに7-Zip登録(シェルに統合)(&I)" -01000302="7-Zipをサブメニュー化する" -01000310="メニュー項目:" - -; Language Page -01000400="言語" -01000401="言語設定:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zipコマンド" -02000103="開く(&O)" -02000104="選択した書庫を開く" -02000105="解凍(&E)..." -02000106="選択した書庫を解凍..." -02000107="圧縮(&C)..." -02000108="選択したファイルを圧縮" -02000109="書庫をテスト(&T)" -0200010A="選択した書庫をテスト" -0200010B="ここに解凍(&H)" -0200010C="選択した書庫をここに解凍" -0200010D="{0} に解凍" -0200010E="サブフォルダに解凍" -0200010F="{0} に圧縮" -02000110="選択したファイルを圧縮..." -02000111="圧縮して電子メール送信..." -02000112="選択したファイルを圧縮して電子メール送信..." -02000113="{0} に圧縮して電子メール送信" -02000114="選択したファイルを圧縮して電子メール送信..." - -02000140="<フォルダ>" -02000141="<書庫>" - -; Properties -02000203="パス" -02000204="名前" -02000205="拡張子" -02000206="フォルダ" -02000207="サイズ" -02000208="圧縮後サイズ" -02000209="属性" -0200020A="作成日時" -0200020B="アクセス日時" -0200020C="更新日時" -0200020D="ソリッド" -0200020E="コメント済み" -0200020F="暗号化" -02000210="分割前" -02000211="分割後" -02000212="辞書" -02000213="CRC" -02000214="種類" -02000215="逆" -02000216="圧縮方法" -02000217="ホストOS" -02000218="ファイルシステム" -02000219="ユーザー" -0200021A="グループ" -0200021B="ブロック" -0200021C="コメント" -0200021D="ポジション" -0200021E="パスプレフィックス" -0200021F="フォルダ数" -02000220="ファイル数" -02000221="バージョン" -02000222="ボリューム" -02000223="多重ボリューム書庫" -02000224="オフセット" -02000225="リンク数" -02000226="使用ブロック数" -02000227="ボリューム数" - -02000229="64ビット" -0200022A="ビッグエンディアン" -0200022B="CPU" -0200022C="物理サイズ" -0200022D="ヘッダーサイズ" -0200022E="チェックサム" -0200022F="特性" -02000230="仮想アドレス" -02000231="ID" -02000232="省略名" -02000233="作成アプリケーション" -02000234="セクターサイズ" -02000235="モード" -02000236="リンク" - -; Status bar -02000301="{0} 個のオブジェクト選択" -02000302="{0} 個のオブジェクト" - -02000320="ファイル数:" -02000321="フォルダ数:" -02000322="サイズ:" -02000323="圧縮済みサイズ:" -02000324="書庫数:" - -; List Context Menu -02000401="項目(&C)" - -02000411="開く(&O)" -02000412="解凍(&E)" - -; ToolBar -02000501="解凍" - -; Messages -02000601="この書庫は更新機能がサポートされていません" -02000602="{0} 書庫が更新出来ません" -02000603="\"{0}\"フォルダが作成出来ません" -02000604="対応してない圧縮形式です" -02000605="エラー" -02000606="アイテムが多過ぎます" -02000607="与えられたファイルに関連付けられたアプリケーションはありません" -02000608="正常です" -02000609="ファイル\"{0}\"は書庫として開くことが出来ません" -0200060A="暗号化された書庫\"{0}\"を開くことが出来ません。パスワードが間違っていませんか?" -0200060B="メモリを割り当て出来ません" -0200060C="不明なエラー" -0200060D="書庫形式が未対応です" - -; Dialogs -02000702="OK(&O)" -02000705="はい(&Y)" -02000707="全てに はい(&A)" -02000709="いいえ(&N)" -0200070B="全てに いいえ(&L)" - -02000710="キャンセル(&C)" -02000711="キャンセル(&C)" -02000713="閉じる(&C)" -02000714="停止(&S)" -02000715="再開(&R)" - -02000720="ヘルプ" - -; Extract dialog -02000800="解凍(&E)" -02000801="解凍先(&X):" -02000802="パスワード(&W)" - -02000810="パス名出力方法" -02000811="絶対パス(&F)" -02000812="相対パス(&C)" -02000813="パス無し(&N)" - -02000820="上書き方法" -02000821="上書きするときは確認する(&B)" -02000822="常に上書き(&O)" -02000823="ファイルが存在するときはスキップ(&E)" -02000824="自動的にリネーム(&U)" -02000825="ファイルが存在するときは自動リネーム(&T)" - -02000830="ファイル" -02000831="選択したファイル(&S)" -02000832="全てのファイル(&A)" - -02000881="解凍先指定" - -02000890="解凍中" - -; Overwrite dialog -02000900="ファイル上書き確認" -02000901="このフォルダには既に以下の同じファイルが存在します" -02000902="現在のファイル" -02000903="に次の新しいファイルを上書きしますか?" - -02000911="自動的にリネーム(&U)" - -02000982="{0} バイト" -02000983="更新日時:" - -; Messages dialog -02000A00="診断結果" - -02000A80="メッセージ" - -02000A91="\"{0}\"はサポートされていない圧縮形式です" -02000A92="\"{0}\"でデータエラーが発生しました。ファイルは壊れています" -02000A93="\"{0}\"のCRCが違います。 ファイルは壊れています" -02000A94="暗号化されたファイル\"{0}\"でデータエラーが発生しました。パスワードが間違っていませんか?" -02000A95="暗号化されたファイル\"{0}\"のCRCが違います。パスワードが間違っていませんか?" - -; Password dialog -02000B00="パスワード入力" -02000B01="パスワード入力(&W):" -02000B02="パスワードを表示する(&H)" -02000B03="パスワード再入力 :" -02000B10="パスワードが一致しません" -02000B11="パスワードには半角英数記号(!, #, $, ...)のみを使用して下さい。" -02000B12="パスワードがあまりに長過ぎます。" - -; Progress dialog -02000C00="処理" -02000C01="経過時間:" -02000C02="残り時間:" -02000C03="サイズ:" -02000C04="速度:" -02000C05="処理済み:" -02000C06="圧縮率:" - -02000C10="バックグラウンド(&B)" -02000C11="フォアグラウンド(&F)" -02000C12="一時停止(&P)" -02000C13="続行(&C)" - -02000C20="一時停止" - -02000C30="本当に圧縮を取りやめますか?" - -; Compress dialog -02000D00="ファイル圧縮" -02000D01="圧縮先(&A):" -02000D02="更新方法(&U):" -02000D03="書庫形式(&F):" -02000D04="圧縮メソッド(&M):" -02000D05="ソリッド書庫作成(&S)" -02000D06="パラメータ(&P):" -02000D07="オプション" -02000D08="自己解凍書庫作成(&X)" -02000D09="マルチスレッド利用(&L)" -02000D0A="ファイル名を暗号化(&N)" -02000D0B="圧縮レベル(&L):" -02000D0C="辞書サイズ(&D):" -02000D0D="ワードサイズ(&W):" -02000D0E="圧縮に必要なメモリ:" -02000D0F="解凍に必要なメモリ:" -02000D10="暗号化" -02000D11="暗号化メソッド:" -02000D12="CPUスレッド数:" -02000D13="ソリッドブロックサイズ:" -02000D14="ソリッドなし" -02000D15="無制限" -02000D16="共有されたファイル圧縮" - -02000D40="書庫を分割(&V):" -02000D41="不正なボリュームサイズ" -02000D42="選択されたボリュームサイズ : {0} バイトです。\n書庫をこのサイズに分割しますか?" - -02000D81="無圧縮" -02000D82="標準" -02000D83="最高" -02000D84="高速" -02000D85="最速" -02000D86="超圧縮" - -02000D90="閲覧" - -02000DA1="全てのファイル上書き" -02000DA2="ファイル追加と更新" -02000DA3="変更したファイルのみ更新" -02000DA4="ファイルを同期させる" - -02000DB1="全てのファイル" - -02000DC0="圧縮" - -; Columns dialog -02000E00="項目" -02000E01="表示したい項目をチェックしてください。表示したい項目の順番を変えるには移動ボタンで変えます" -02000E02="選択した項目の表示幅を設定します" -02000E03="ピクセル幅(&W)" - -02000E10="上に移動(&U)" -02000E11="下に移動(&D)" -02000E12="表示(&S)" -02000E13="隠す(&H)" -02000E14="設定(&S)" - -02000E81="タイトル" -02000E82="幅" - -; Testing -02000F90="テスト中" - - -; File Manager - -03000000="7-Zipファイルマネージャ" - -; Menu -03000102="ファイル(&F)" -03000103="編集(&E)" -03000104="表示(&V)" -03000105="ツール(&T)" -03000106="ヘルプ(&H)" -03000107="お気に入り(&A)" - -; File -03000210="開く(&O)" -03000211="開くインサイド(&I)" -03000212="開くアウトサイド(&U)" -03000220="表示(&V)" -03000221="編集(&E)" -03000230="名前の変更(&M)" -03000231="コピー(&C)..." -03000232="移動(&M)..." -03000233="削除(&D)" -03000240="プロパティ(&R)" -03000241="コメント(&N)" -03000242="チェックサムの計算" -03000243="比較" -03000250="フォルダ作成(&F)" -03000251="ファイル作成(&L)" -03000260="閉じる(&X)" -03000270="ファイル分割(&S)..." -03000271="ファイル結合(&B)..." - -; Edit -03000310="元に戻す(&U)" -03000311="やり直す(&R)" -03000320="切り取り(&T)" -03000321="コピー(&C)" -03000322="貼り付け(&P)" -03000323="削除(&D)" -03000330="全て選択(&A)" -03000331="全て選択解除(&L)" -03000332="選択切り替え(&I)" -03000333="選択(&S)..." -03000334="選択解除(&E)..." -03000335="同一形式選択(&T)" -03000336="同一形式選択解除(&Y)" - -; View -03000410="大きいアイコン(&G)" -03000411="小さいアイコン(&M)" -03000412="一覧(&L)" -03000413="詳細(&D)" -03000420="アンソート(&N)" -03000430="ルートフォルダを開く(&O)" -03000431="一つ上の階層へ(&U)" -03000432="フォルダ履歴(&H)..." -03000440="リフレッシュ(&R)" -03000449="フラットビュー" -03000450="&2分割画面" -03000451="ツールバー(&T)" -03000460="書庫ツールバー(&A)" -03000461="標準ツールバー(&S)" -03000462="大きなボタン(&L)" -03000463="テキスト表示(&T)" - -; Tools -03000510="オプション(&O)..." -03000511="ベンチマーク(&B)" - -; Help -03000610="ヘルプ内容(&C)..." -03000620="7-Zipについて(&A)..." - -; Favorites -03000710="フォルダをお気に入りに追加(&A)" -03000720="ブックマーク" - -; Options Dialog - -03010000="オプション" - -; Plugins -03010100="プラグイン" -03010101="プラグイン(&P):" -03010110="オプション..." - -; Edit -03010200="外部ツール" -03010201="エディタ(&E):" -03010202="ファイル比較ツール(&D):" - -; System -03010300="システム" -03010302="7-Zipに関連付けるファイル:" -03010310="プラグイン" - -; Settings -03010400="設定" -03010401="\"..\"を表示する" -03010402="本来アイコンを表示する" -03010410="エクスプローラのメニューを表示する" -03010420="どの列をクリックしても選択出来るようにする(&F)" -03010421="グリッド線を表示する(&G)" -03010422="シングルクリックで開く(&S)" -03010430="代替選択モード(&A)" -03010440="多量メモリページを使用する(&L)" - -; Strings - -03020201="コピー" -03020202="移動" -03020203="フォルダへコピー:" -03020204="フォルダへ移動:" -03020205="コピーしています..." -03020206="移動しています..." -03020207="そのフォルダにはコピー&移動が出来ません。" -03020208="その操作はサポートされていません。" -03020209="対象のフォルダ選択" - -03020210="ファイル削除の確認" -03020211="フォルダ削除の確認" -03020212="複数ファイル削除の確認" -03020213="\"{0}\"を本当に削除しますか?" -03020214="フォルダ\"{0}\"とフォルダ内の全てのファイルを削除しますか?" -03020215="これらの{0}個の項目を本当に削除しますか?" -03020216="削除中..." -03020217="ファイル又はフォルダ削除エラー" -03020218="ファイルのパスが長すぎる為、ファイルをごみ箱に移動出来ません" - -03020220="リネームしています..." -03020221="ファイル又はフォルダ名前変更エラー" -03020222="ファイルコピー確認" -03020223="本当にファイルを書庫に追加しますか?" - -03020230="フォルダ作成" -03020231="フォルダ名:" -03020232="新しいフォルダ" -03020233="フォルダ作成エラー" - -03020240="ファイル作成" -03020241="ファイル名:" -03020242="新しいファイル" -03020243="ファイル作成エラー" - -03020250="選択" -03020251="選択解除" -03020252="マスク:" - -03020260="フォルダ履歴" - -03020280="ファイル\"{0}\"の内容は変更されています。\n書庫を更新しますか?" -03020281="ファイル\"{0}\"の更新出来ません。" -03020282="エディタ起動出来ません。" -03020283="開いています..." -03020284="ファイル名は大量のスペースを含んでいる為、ウイルスのようなファイルです。" - -03020290="コメント" -03020291="コメント(&C):" - -030202A0="システム" - -03020300="コンピュータ" -03020301="ネットワーク" -03020302="ドキュメント" - -03020400="追加" -03020401="解凍" -03020402="テスト" - -03020420="コピー" -03020421="移動" -03020422="削除" -03020423="情報" - -03020500="ファイル分割" -03020501="分割先(&S):" -03020510="分割中..." -03020520="分割確認" -03020521="{0} 個にファイルを分割してもよろしいですか?" -03020522="分割後のサイズは元のファイルサイズより小さいサイズを指定して下さい。" - -03020600="ファイル結合" -03020601="結合先(&C):" -03020610="結合中..." -03020620="先頭のファイルだけ選択して下さい" -03020621="分割されているファイルの部分として一部を検出する事が出来ません" -03020622="分割されているファイルの一部しか見つかりません" - -03020710="チェックサム計算中..." -03020720="チェックサム情報" -03020721="データのCRC チェックサム:" -03020722="データと名前のCRC チェックサム:" - -03020800="スキャン中..." - -03020900="プロパティ" - -03020A01="現行フォルダのパスが長すぎる為、コマンド実行出来ません。" -03020A02="一つのファイルを選択して下さい" -03020A03="一つ以上のファイルを選択して下さい" -03020A04="\"{0}\"のファイルは既に存在します" - -; Computer -03031100="トータルサイズ" -03031101="空き領域" -03031102="クラスタサイズ" -03031103="ラベル" - -; Network -03031200="ローカル名" -03031201="プロバイダ" - -; Benchmark Dialog - -03080000="ベンチマーク" -03080001="必要メモリ:" -03080002="圧縮中" -03080003="解凍中" -03080004="スピード" -03080005="評価" -03080006="総合評価" -03080007="現在" -03080008="結果" -03080009="テスト回数:" -0308000A="エラー:" -0308000B="CPU使用率" -0308000C="評価 / 使用率" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/ka.txt b/tools/7-Zip/Lang/ka.txt deleted file mode 100644 index b92e2831c4..0000000000 --- a/tools/7-Zip/Lang/ka.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.07 beta -; Translated by Dimitri Gogelia -; -; -; -; - -00000000="Georgian" -00000001="ქართული" -00000002="55" - -; 7-Zip Configuration - -; Title -01000000="7-Zip-ის კონფიგურირება " - -; Info Page -01000100="7-Zip-ის შესახებ" -01000103="7-Zip თავისუფალად გავრცელებადი პროგრამული უზრუნველყოფაა. თუ გსურთ, რომ მხარი დაუჭიროთ 7-Zip-ის შექმნას, შეგიძლიათ დაარეგისტრიროთ პროგრამა. როგორც რეგისტრირებულ მომხმარებელს, თქვენ გექნებათ ტექნიკური მხარდაჭერა." -01000105="რეგისტრაცია" - -; Folders Page -01000200="საქაღალდეები" -01000210="მუშა საქაღალდე" -01000211="სისტემური დროებითი საქაღალდე" -01000212="მიმდინარე" -01000213="ამორჩევა:" -01000214="გამოიყენება მხოლოდ ცვლადი მატარებლებისათვის" - -01000281="მიუთითეთ ადგილმდებარეობა დროებითი არქივებისათვის." - -; System Page -01000300="სისტემა" -01000301="7-Zip-ის გარსის კონტექსტურ მენიუში ჩადგმა" -01000302="კასკადური კონტექსტური მენიუ" -01000310="კონტექსტური მენიუს ელემენტები:" - -; Language Page -01000400="ენა" -01000401="ენა:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip-ის ბრძანებები" -02000103="არქივის გახსნა" -02000104="მონიშნული არქივის გახსნა." -02000105="გახსნა..." -02000106="ფაილების გახსნა მონიშნული არქივიდან." -02000107="არქივში დამატება..." -02000108="მონიშნული ობიექტების არქივში დამატება." -02000109="ტესტირება" -0200010A="მონიშნული არქივის ტესტირება." -0200010B="გახსნა აქ" -0200010C="ფაილების გახსნა მონიშნული არქივიდან მიმდინარე საქაღალდეში." -0200010D="გახსნა {0}-ში" -0200010E="ფაილების გახსნა ქვე-საქაღალდეში." -0200010F="{0}-ში დამატება" -02000110="მონიშნული ობიექტების არქივში დამატება." -02000111="შეიკუმშოს და გაიგზავნოს ელ-ფოსტით..." -02000112="შეიკუმშოს მონიშნული ობიექტები არქივში და გაიგზავნოს ელ-ფოსტით." -02000113="შეიკუმშოს {0} და გაიგზავნოს ელ-ფოსტით" -02000114="შეიკუმშოს მონიშნული ობიექტები არქივში და გაიგზავნოს ელ-ფოსტით." - -02000140="<საქაღალდე>" -02000141="<არქივი>" - -; Properties -02000203="გზა" -02000204="სახელი" -02000205="გაფართოება" -02000206="საქაღალდე" -02000207="ზომა" -02000208="შეკუმშულის ზომა" -02000209="ატრიბუტები" -0200020A="შექმნილია" -0200020B="გახსნილია" -0200020C="მოდიფიცირებულია" -0200020D="უწყვეტი" -0200020E="კომენტარი" -0200020F="დაშიფრულია" -02000210="Split Before" -02000211="Split After" -02000212="ლექსიკონი" -02000213="CRC" -02000214="ტიპი" -02000215="ანტი" -02000216="მეთოდი" -02000217="სისტემა" -02000218="ფაილური სისტემა" -02000219="მომხმარებელი" -0200021A="ჯგუფი" -0200021B="ბლოკი" -0200021C="კომენტარი" -0200021D="პოზიცია" - -; Status bar -02000301="მონიშნულია {0} ობიექტი" -02000302="{0} ობიექტი" - -; List Context Menu -02000401="სვეტები..." - -02000411="გახსნა" -02000412="ამოღება..." - -; ToolBar -02000501="ამოღება" - -; Messages -02000601="ამ ტიპის არქივისათვის ცვლილების ოპერაცია ხელმიუწვდომელია." -02000602="ვერ შევცვალე არქივი {0}" -02000603="ვერ შევქმენი საქაღალდე '{0}'" -02000604="ფაილი არ წარმოადგენს არქივს." -02000605="შეცდომა" -02000606="ძალზე ბევრი ელემენტი" -02000607="ასეთი ტიპის ფაილის გაფართოებასთან არ არის ასოცირებული არცერთი პროგრამა" -02000608="შეცდომები არ არის ნაპოვნი" - -; Dialogs -02000702="OK" -02000705="დიახ" -02000707="დიახ ყველასათვის" -02000709="არა" -0200070B="არა ყველასათვის" - -02000710="გაუქმება" -02000711="გაუქმება" -02000713="დახურვა" -02000714="სტოპ" -02000715="გადატვირთვა" - -02000720="ცნობარი" - -; Extract dialog -02000800="ამოღება" -02000801="ამოღება:" -02000802="პაროლი" - -02000810="გზა" -02000811="სრული გზა" -02000812="შეფარდებითი გზა" -02000813="გზის გარეშე" - -02000820="თავზე გადაწერის მეთოდი" -02000821="თავზე გადაწერა თანხმობით" -02000822="თავზე გადაწერა თანხმობის გარეშე" -02000823="გამოტოვება" -02000824="ავტონ. გადარქმევა" -02000825="გახსნილი ფაილების ავტონ. გადარქმევა" - -02000830="ფაილები" -02000831="მონიშნული ფაილები" -02000832="ყველა ფაილი" - -02000881="მიუთითეთ ადგილი ამოსაღები ფაილებისათვის." - -02000890="ამოღება" - -; Overwrite dialog -02000900="ფაილის შეცვლის დასტური" -02000901="საქაღალდე უკვე შეიცავს დამუშავებად ფაილს." -02000902="შეიცვალოს მიმდინარე ფაილი" -02000903="შემდეგი ფაილით?" - -02000911="ავტონ. გადარქმევა" - -02000982="{0} ბაიტი" -02000983="შეცვლილია" - -; Messages dialog -02000A00="დიაგნოსტიკური შეტყობინება" - -02000A80="შეტყობინება" - -02000A91="შეკუმშვის შეუთავსებადი მეთოდი '{0}'-თვის." -02000A92="მონაცემების შეცდომა '{0}'-ში. ფაილი დაზიანებულია." -02000A93="CRC-ის შეცდომა '{0}'-ში. ფაილი დაზიანებულია." - -; Password dialog -02000B00="პაროლის შეტანა" -02000B01="შეიყვანეთ პაროლი:" -02000B02="პაროლის ჩვენება" - -; Progress dialog -02000C00="პროცესი" -02000C01="გასული დრო:" -02000C02="დარჩენილი დრო:" -02000C03="ზომა:" -02000C04="სიჩქარე:" - -02000C10="ფონურად" -02000C11="წინა პლანზე" -02000C12="პაუზა" -02000C13="გაგრძელება" - -02000C20="დაპაუზებულია" - -02000C30="დარწმუნებული ხართ, რომ გინდათ შეწყვიტოთ ოპერაცია?" - -; Compress dialog -02000D00="არქივში დამატება" -02000D01="არქივი:" -02000D02="განახლების რეჟიმი:" -02000D03="არქივის ფორმატი:" -02000D04="შეკუმშვის მეთოდი:" -02000D05="შეიქმნას უწყვეტი არქივი" -02000D06="პარამეტრები:" -02000D07="ოფციები" -02000D08="შეიქმნას SFX-არქივი" -02000D09="მრავალნაკადიანი" -02000D0A="ფაილების სახელების დაშიფვრა" -02000D0B="შეკუმშვის დონე:" -02000D0C="ლექსიკონის ზომა:" -02000D0D="სიტყვის ზომა:" -02000D0E="მეხსიერების ზომა შეკუმშვისათვის:" -02000D0F="მეხსიერების ზომა გახსნისათვის:" - -02000D40="დაიყოს ტომებად:" - -02000D81="შეკუმშვის გარეშე" -02000D82="ნორმალური" -02000D83="მაქსიმუმი" -02000D84="სწრაფი" -02000D85="უსწრაფესი" -02000D86="ულტრა" - -02000D90="ნახვა" - -02000DA1="დამატება და შეცვლა" -02000DA2="განახლება და დამატება" -02000DA3="განახლება" -02000DA4="ფაილების სინქრონიზაცია" - -02000DB1="ყველა ფაილი" - -02000DC0="შეკუმშვა" - -; Columns dialog -02000E00="სვეტები" -02000E01="მონიშნეთ სვეტები, რომლებიც უნდა გამოჩნდეს ამ საქაღალდეში. ღილაკებით ”ზევით” და ”ქვევით” შეიძლება დაყენდეს სვეტების მსველობის თანმიმდევრობა." -02000E02="მონიშნული სვეტების სიგანე უნდა იყოს" -02000E03="წერტილი." - -02000E10="ზევით" -02000E11="ქვევით" -02000E12="ჩვენება" -02000E13="დამალვა" -02000E14="დაყენება" - -02000E81="სახელი" -02000E82="სიგანე" - -; Testing -02000F90="ტესტირება" - - -; File Manager - -03000000="7-Zip ფაილების მმართველი" - -; Menu -03000102="ფაილი" -03000103="რედაქტირება" -03000104="ნახვა" -03000105="სერვისი" -03000106="ცნობარი" -03000107="სანიშნეები" - -; File -03000210="გახსნა" -03000211="გაიხსნას შიგნით" -03000212="გაიხსნას გარეთ" -03000220="დათვალიერება" -03000221="რედაქტირება" -03000230="სახელის გადარქმევა" -03000231="ასლი..." -03000232="გადატანა..." -03000233="წაშლა" -03000240="თვისებები" -03000241="კომენტარი" -03000250="საქაღალდის შექმნა" -03000251="ფაილის შექმნა" -03000260="გამოსვლა" -03000270="ფაილის დაშლა..." -03000271="ფაილების გაერთიანება..." - -; Edit -03000310="გაუქმება" -03000311="აღდგენა" -03000320="ამოჭრა" -03000321="ასლი" -03000322="ჩასმა" -03000323="წაშლა" -03000330="სრული მონიშვნა" -03000331="მონიშვნის გაუქმება" -03000332="მონიშვნის უკუცვლა" -03000333="მოინიშნოს..." -03000334="მოიხსნას მონიშვნა..." -03000335="მოინიშნოს ტიპის მიხედვით" -03000336="მონიშვნის მოხსნა ტიპის მიხედვით" - -; View -03000410="მსხვილი პიქტოგრამები" -03000411="პატარა პიქტოგრამები" -03000412="სია" -03000413="ცხრილი" -03000420="არასორტირებული" -03000430="ძირეული საქაღალდის გახსნა" -03000431="ერთი დონით ზევით" -03000432="საქაღალდეების ისტორია..." -03000440="განახლება" -03000450="2 პანელი" -03000451="ინსტრუმენტების პანელი" -03000460="არქივირების პანელი" -03000461="ძირითადი პანელი" -03000462="მსხვილი პანელები" -03000463="წარწერები ღილაკებზე" - -; Tools -03000510="აწყობა..." -03000511="წარმადობის ტესტირება" - -; Help -03000610="თავფურცელი..." -03000620="7-Zip-ის შესახებ..." - -; Favorites -03000710="დაემატოს საქაღალდე სანიშნეებში როგორც" -03000720="სანიშნე" - -; Options Dialog - -03010000="აწყობა" - -; Plugins -03010100="ჩადგმები" -03010101="ჩადგმები:" -03010110="თვისებები..." - -; Edit -03010200="რედაქტორი" -03010201="რედაქტორი:" - -; System -03010300="სისტემა" -03010302="ასოციაცია 7-Zip-თან:" -03010310="ჩადგმა" - -; Settings -03010400="აწყობა" -03010401="\"..\" ელემენტის ჩვენება" -03010402="ფაილების რეალური პიქტოგრამების ჩვენება" -03010410="სისტემური მენიუს ჩვენება" -03010420="კურსორი მთელ სტრიქონზე" -03010421="გამყოფის ჩვენება" - -; Strings - -03020201="ასლის აღება" -03020202="გადატანა" -03020203="ასლი:" -03020204="გადატანა:" -03020205="ასლის აღება..." -03020206="გადატანა..." -03020207="ამ საქაღალდეებისათვის ობიექტების ასლირება დაუშვებელია." -03020208="ოპერაცია არ ხორციელდება." - -03020210="ფაილის წაშლის თანხმობა" -03020211="საქაღალდის წაშლის თანხმობა" -03020212="რამდენიმე ფაილის წაშლის თანხმობა" -03020213="დარწმუნებული ხართ, რომ გინდათ წაშალოთ '{0}'?" -03020214="დარწმუნებული ხართ, რომ გინდათ წაშალოთ '{0}' საქაღალდე და მთელი მისი შიგთავსი?" -03020215="დარწმუნებული ხართ, რომ გინდათ წაშალოთ {0} ელემენტები?" -03020216="იშლება..." -03020217="ფაილის ან საქაღალდის წაშლის შეცდომა" - -03020220="გადარქმევა..." -03020221="ფაილის ან საქაღალდის გადარქმევის შეცდომა" - -03020230="საქაღალდის შექმნა" -03020231="საქაღალდის სახელი:" -03020232="ახალი საქაღალდე" -03020233="შეცდომა საქაღალდის შექმნისას" - -03020240="ფაილის შექმნა" -03020241="ფაილის სახელი:" -03020242="ახალი ფაილი" -03020243="ფაილის შექმნის შეცდომა" - -03020250="მონიშვნა" -03020251="მონიშვნის გაუქმება" -03020252="ნიღაბი:" - -03020260="საქაღალდეების ისტორია" - -03020280="ფაილი '{0}' შეიცვალა.\nგნებავთ მისი არქივში განახლება?" -03020281="შეუძლებელია \n'{0}'-ის განახლება" -03020282="შეუძლებელია რედაქტორის გაშვება." -03020283="იხსნება..." - -03020290="კომენტარი" -03020291="კომენტარი:" - -030202A0="სისტემა" - -03020300="კომპიუტერი" -03020301="ქსელი" - -03020400="დამატება" -03020401="ამოღება" -03020402="ტესტირება" - -03020420="ასლი" -03020421="გადაადგილება" -03020422="წაშლა" -03020423="ინფორმაცია" - -03020500="ფაილის დაშლა" -03020501="დაიშალოს:" -03020510="დაშლა..." - -03020600="Combine Files" -03020601="&Combine to:" -03020610="Combining..." - -; Computer -03031100="მოცულობა" -03031101="თავისუფალი სივრცე" -03031102="კლასტერის ზომა" -03031103="ჭდე" - -; Network -03031200="ლოკალური სახელი" -03031201="პროვაიდერი" - -; Benchmark Dialog - -03080000="წარმადობის ტესტირება" -03080001="გამოყენებული მეხსიერების ზომა:" -03080002="შეკუმშვა" -03080003="გაშლა" -03080004="სიჩქარე" -03080005="რეიტინგი" -03080006="საერთო რეიტინგი" -03080007="მიმდინარე" -03080008="შემაჯამებელი" -03080009="გატარება:" -0308000A="შეცდომა:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/kk.txt b/tools/7-Zip/Lang/kk.txt deleted file mode 100644 index 34a7a0e56f..0000000000 --- a/tools/7-Zip/Lang/kk.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by Arslan, Arman Beisenov's -; -; -; -; - -00000000="Kazakh" -00000001="Қазақша" -00000002="63" - -; 7-Zip Configuration - -; Title -01000000="7-Zip - Конфигурациясы" - -; Info Page -01000100="7-Zip туралы" -01000103="7-Zip - тегін таратылатын бағдарлама." -01000104="Қолдау" -01000105="Тіркелу" - -; Folders Page -01000200="Қалта" -01000210="&Жұмыс қалтасы" -01000211="&Жүйелік уақытша қалта" -01000212="&Ағымдық" -01000213="&Сұрау:" -01000214="Тек алмалы тасығыштарға ғана пайдалану" - -01000281="Уақытша мұрағаттардың орнын нұсқаңыз." - -; System Page -01000300="Жүйе" -01000301="Мұқабаның мәтінміндің мәзіріне 7-Zip қою" -01000302="Каскадты мәтінмәндік мәзір" -01000310="Мәтінміндік мәзірдің элементтері:" - -; Language Page -01000400="Тіл" -01000401="Тіл:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip әмірлері." -02000103="Мұрағат ашу" -02000104="Ерекшеленген мұрағатты ашу." -02000105="Бумадан шешу" -02000106="Файлды ерекшеленген мұрағатан шығару." -02000107="Мұрағатқа үстеу..." -02000108="Ерекшеленген нысанды мұрағатқа үстеу." -02000109="Тестілеу" -0200010A="Ерекшеленген мұрағатты тестілеу." -0200010B="Мұнда шешу" -0200010C="Ерекшеленген мұрағаттағы файлды ағымдық қалтаға шығару." -0200010D="{0} дегенде шешу" -0200010E="Файлды каталог астында шығару." -0200010F="{0} дегенге үстеу" -02000110="Ерекшеленген нысандарды мұрағатқа үстеу." -02000111="Сығып э-поштамен жіберу..." -02000112="Ерекшеленген нысанды сығып, мұрағатты э-поштамен жіберу." -02000113="{0} дегенде сығып, э-поштамен жіберу" -02000114="Ерекшеленген нысанды сығып, мұрағатты э-поштамен жіберу." - -02000140="<Қалта>" -02000141="<Мұрағат>" - -; Properties -02000203="Жол" -02000204="Аты" -02000205="Кеңейтімі" -02000206="Қалта" -02000207="Көлем" -02000208="Сығылған" -02000209="Атрибут" -0200020A="Жасалған" -0200020B="Ашылған" -0200020C="Өзгерген" -0200020D="Үзіліссіз" -0200020E="Комментарий" -0200020F="Шифрланған" -02000210="дейін бөлінген" -02000211="кейін бөлінген" -02000212="Сөздік" -02000213="CRC" -02000214="Түрі" -02000215="Анти" -02000216="Тәсіл" -02000217="Жүйе" -02000218="Файлдық жүйе" -02000219="Пайдаланушы" -0200021A="Топ" -0200021B="Блок" -0200021C="Комментарий" -0200021D="Орны" -0200021E="Жолы" -0200021F="Қалта" -02000220="Файл" -02000221="Нұсқа" -02000222="Том" -02000223="Көп томды" -02000224="Жылжу" -02000225="Сілтеме" -02000226="Блок" -02000227="Том" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="Процессор" -0200022C="Физикалық көлемі" -0200022D="Тақырып көлемі" -0200022E="Бақылау сомасы" -0200022F="Характеристика" -02000230="Виртуальды мекен-жай" -02000231="ID" -02000232="Қысқа аты" -02000233="Жасаушы" -02000234="Сектор көлемі" -02000235="Режим" -02000236="Сілтеме" - -; Status bar -02000301="Ерекшеленген нысан: {0}" -02000302="{0} нысан" - -02000320="Файл:" -02000321="Қалта:" -02000322="Көлем:" -02000323="Сығылған:" -02000324="Мұрағат:" - -; List Context Menu -02000401="&Баған..." - -02000411="&Ашу" -02000412="&Шығару..." - -; ToolBar -02000501="Шығару" - -; Messages -02000601="Көтермейтін мұрағат үшін операция өзгертіледі." -02000602="{0} мұрағатын өзгерту мүмкін емес" -02000603="'{0}' қалтасын жасау мүмкін емес" -02000604="Файл көтеретін мұрағат емес" -02000605="Қателік" -02000606="Өте көп элемент" -02000607="Бағдарлама ассоцирациясы жоқ" -02000608="Қателік табылған жоқ" -02000609="'{0}' файлды мұрағат ретінде ашу мүмкін емес" -0200060A="Шифрланған '{0}' мұрағатты ашу мүмкін емес. Кілтсөз дұрыс емес пе?" -0200060B="Бос жад жоқ" -0200060C="Белгісіз қателік" -0200060D="Көтермейтін мұрағат түрі" - -; Dialogs -02000702="Жарайды" -02000705="&Иә" -02000707="Бәріне &ия" -02000709="&Жоқ" -0200070B="Бәріне &жоқ" - -02000710="Болдырмау" -02000711="&Болдырмау" -02000713="&Жабу" -02000714="Тоқтату" -02000715="Қайта іске қосу" - -02000720="Анықтама" - -; Extract dialog -02000800="Шығару" -02000801="&Мұнда шешу:" -02000802="&Кілтсөз" - -02000810="Жолдар" -02000811="&Толық жол" -02000812="&Қатысы бар жол" -02000813="&Жолсыз" - -02000820="Қайта жазу" -02000821="&Растаумен" -02000822="&Растаусыз" -02000823="Өткізіп &жіберу" -02000824="Автоматты қайта атау." -02000825="Бар файлды автом. қайта атау" - -02000830="Файл" -02000831="Таңдалған файл" -02000832="Барлық файл" - -02000881="Шығарылатын файл орнын нұсқаңыз." - -02000890="Шешу" - -; Overwrite dialog -02000900="Файлды ауыстыру растау" -02000901="Қалтада іс жүргізілетін файл бар." -02000902="Файлды ауыстыру" -02000903="келесі файлмен ба?" - -02000911="Автоматты қайта атау" - -02000982="{0} байт" -02000983="өзгерген" - -; Messages dialog -02000A00="Хабарлама" - -02000A80="Хабарлама" - -02000A91="'{0}' файлы үшін сығу әдісін көтермейді." -02000A92="'{0}' мәліметінде қателік. Файл зақымдалған." -02000A93="'{0}' CRC қателік. Файл зақымдалған." -02000A94="Шифрланған '{0}' файлында мәліміт қате. Кілтсөз дұрыс емес пе?" -02000A95="Шифрланған '{0}' файлында CRС қате. Кілтсөз дұрыс емес пе?" - -; Password dialog -02000B00="Кілтсөзді енгізу" -02000B01="&Кілтсөзді енгізіңіз:" -02000B02="&Кілтсөзді көрсету" -02000B03="&Кілтсөзді қайталаңыз:" -02000B10="Кілтсөздер сәйкес емес" -02000B11="Кілтсөзге тек ағылшын әліпбиін пайдаланыңыз, сандар және арнайы нышандар (!, #, $, ...)" -02000B12="Кілтсөз өте ұзақ" - -; Progress dialog -02000C00="Процесс" -02000C01="Өтті:" -02000C02="Қалды:" -02000C03="Барлығы:" -02000C04="Жылд.:" -02000C05="Көлем:" -02000C06="Сығу дәрежесі:" - -02000C10="&Фонды" -02000C11="&Алдыңғы жоспарға" -02000C12="&Үізілс" -02000C13="&Жалғастыру" - -02000C20="Үзілісте" - -02000C30="Операцияны тоқтату керек пе?" - -; Compress dialog -02000D00="Мұрағатқа үстеу" -02000D01="&Мұрағат:" -02000D02="&Өзгерту режимі:" -02000D03="&Мұрағат пішімі:" -02000D04="&Сығу тәсілі:" -02000D05="&Solid мұрағат жасау" -02000D06="&Параметр:" -02000D07="&Баптау" -02000D08="SF&X-мұрағат жасау" -02000D09="&Көп ағымды" -02000D0A="&Файлдың атын шифрлау" -02000D0B="&Сығу деңгейі:" -02000D0C="Сөздік &көлемі:" -02000D0D="Сөз &көлемі:" -02000D0E="Бууға арналған көлем:" -02000D0F="Шешуге арналған көлем:" -02000D10="Шифрлау" -02000D11="Шифрлау тәсілі:" -02000D12="Ағым саны:" -02000D13="Блог көлемі:" -02000D14="Файл көлемі б-ша" -02000D15="Үзіліссіз" -02000D16="Ашылған файд жазу үшін сығу" - -02000D40="Томға бөлшектеу (байтқа):" -02000D41="Томның көлемін енгізу қате" -02000D42="Томның орнатылған көлемі: {0} байт.\nМұрағатты томға бөлшектеу керек пе?" - -02000D81="Сығусыз" -02000D82="Кәдімгі" -02000D83="Ең жоғарғы" -02000D84="Шапшаң" -02000D85="Жылдам" -02000D86="Ультра" - -02000D90="Сапыру" - -02000DA1="Үстеу, ауыстыру" -02000DA2="Жаңарту, үстеу" -02000DA3="Жаңату" -02000DA4="Теңестіру" - -02000DB1="Барлық файл" - -02000DC0="Компрессия" - -; Columns dialog -02000E00="Бағандар" -02000E01="Осы қалтада көрсетілетін бағандарды белгілеңіз. \"Жоғары\" және \"Төмен\" пернелерімен бағандардың орнын реттеуге болады." -02000E02="Таңдалған бағандарда ен болуы керек" -02000E03="нүкте." - -02000E10="Жоғары" -02000E11="Төмен" -02000E12="Көрсету" -02000E13="Жасыру" -02000E14="Орнату" - -02000E81="Аты" -02000E82="Ені" - -; Testing -02000F90="Тестілеу" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Файл" -03000103="&Өңдеу" -03000104="&Көрініс" -03000105="С&ервис" -03000106="&Анықтама" -03000107="&Таңдаулы" - -; File -03000210="&Ашу" -03000211="Ішінен &ашу" -03000212="Сыртынан ашу" -03000220="Қарау" -03000221="&Өңдеу" -03000230="Қайта атау" -03000231="&Көшіру..." -03000232="&Жылжыту..." -03000233="&Жою" -03000240="Сипаттар" -03000241="Комме&нтарий..." -03000242="Бақылау сомасы" -03000243="Diff" -03000250="&Қалта жасау" -03000251="Файл жасау" -03000260="Шығу" -03000270="Файлды бөлшектеу..." -03000271="Файлды біріктіру..." - -; Edit -03000310="&Болдырмау" -03000311="&Қайтару" -03000320="&Қиып алу" -03000321="&Көшіру" -03000322="Қою" -03000323="&Жою" -03000330="Бәрін ерекшелеу" -03000331="Ерекшелеуді аластау" -03000332="&Ерекшелеуді көрсету" -03000333="Ерекшелеу..." -03000334="Ерекшедеужі аластау..." -03000335="Түрі б-ша ерекшелеу" -03000336="Түрі б-ша ерекшелеуді аластау" - -; View -03000410="&Үлкен таңбаша" -03000411="&Кішк. таңбаша" -03000412="Тізім" -03000413="&Кесте" -03000420="Сұрыптаусыз" -03000430="Негізгі қалтады ашу" -03000431="Бір деңгей жоғары өту" -03000432="Қалта тарихы..." -03000440="Жаңарту" -03000449="Жалпақ режим" -03000450="&2 тақта" -03000451="&Құралдар тақтасы" -03000460="Мұрағаттауыш батырма тақтасы" -03000461="Батырманың кәдімгі тақтасы" -03000462="Үлкен батырмалар" -03000463="Батырмада жазулар" - -; Tools -03000510="Баптау..." -03000511="Өнімді тестілеу" - -; Help -03000610="&Басты..." -03000620="Бағдарламада..." - -; Favorites -03000710="Қалтаны таңдаулыға басқаша үстеу" -03000720="Таңдаулы" - -; Options Dialog - -03010000="Баптау" - -; Plugins -03010100="Плагин" -03010101="&Плагин:" -03010110="Сипаттар" - -; Edit -03010200="Өңдегіш" -03010201="&Өңдегіш:" -03010202="&Diff:" - -; System -03010300="Жүйе" -03010302="7-Zip файлмен ассорциялау:" -03010310="Плагин" - -; Settings -03010400="Баптау" -03010401="\"..\" элементті көрсету" -03010402="Файлдың шынайы таңбашасын көрсету" -03010410="Жүйелік мәзірді көрсету" -03010420="Барлық жолаққа меңзер" -03010421="Бөлгіштерді көрсету" -03010422="Бір шерткеннен ашу" -03010430="Белгілеудің альтернативті режимі" -03010440="Жадтың үлкен беттерін пайдалану" - -; Strings - -03020201="Көшіру" -03020202="Жылжыту" -03020203="Мұнда көшіру:" -03020204="Мұнда жылжыту:" -03020205="Көшіру..." -03020206="Жылжыту..." -03020207="Мұндай қалтаға нысандарыд көшіруге болмайды" -03020208="Бұл қалтаға операция көтермейді." -03020209="Қалтаны нұсқаңыз" - -03020210="Файлды жоюды растау" -03020211="Қалтаны жоюды растау" -03020212="Бірнеше файлды жоюды растау" -03020213="\"{0}\" дегенді жою керек пе?" -03020214="\"{0}\" қалтасын және оның ішіндегілерін жою керек пе?" -03020215="({0} дана) нысандарды жою керек пе?" -03020216="Жойылу..." -03020217="Файл не қалтаны жою қате" -03020218="Ұзақ жолды файлдарды себетке жоюды жүйе көтермейді" - -03020220="Атын өзгерту..." -03020221="Файл не қалтаның атын өзгерту мүмкін емес" -03020222="Файлды көшіруді растау" -03020223="Мына файлдарды мұрағатқа көшіру керек пе" - -03020230="Қалта жасау" -03020231="Қалта аты:" -03020232="Жаңа қалта" -03020233="Қалтаны жасау қате" - -03020240="Файл жасау" -03020241="Файл аты:" -03020242="Жаңа файл" -03020243="Файлды жасау кезінде қателік болды" - -03020250="Ерекшелеу" -03020251="Аластау" -03020252="Маска:" - -03020260="Қалта тарихы" - -03020280="'{0}' файлы өзгерді.\nОны мұрағатта жаңарту керек пе?" -03020281="\n'{0}' файлды жаңарту мүмкін емес" -03020282="Өңдегішті ашу мүмкін емес" -03020283="Ашылу..." -03020284="Файл вирусқа ұқсайды (файл аты ұзақ жолды мәселені құрайды)." - -03020290="Комментарий" -03020291="&Комментарий:" - -030202A0="Жүйе" - -03020300="Компьютер" -03020301="Желі" -03020302="Құжаттар" - -03020400="Үстеу" -03020401="Шығару" -03020402="Тестілеу" - -03020420="Көшіру" -03020421="Жылжыту" -03020422="Жою" -03020423="Ақпарат" - -03020500="Файлды бөлшектеу" -03020501="&Бөлшектеу:" -03020510="Бөлшектеу..." -03020520="Бөлшектеуді растау" -03020521="Файлд {0} бөлікке бөлшектеу керек пе?" -03020522="Том көлемі файлдың кіріс көлемінен аз болу керек" - -03020600="Файлдарды біріктіру" -03020601="&Мұнда біріктіру:" -03020610="Біріктіру..." -03020620="Бөлшектенген файлдың бірінші бөлігін таңдау керек" -03020621="Бөлшектенген файлды тану мүмкін емес" -03020622="Бөлшектенген файлдың бөліктерін табу мүмкін емес" - -03020710="Бақылау сомасын есептеу..." -03020720="Бақылау сомасы" -03020721="Мәлімет үшін CRC бақылау сомасы:" -03020722="Мәлімет және атау үшін CRC бақылау сомасы:" - -03020800="Сканерлеу..." - -03020900="Сипаттар" - -03020A01="Операция қалтаға жолдың ұзақтығынан орындалмайды" -03020A02="Сізге бір файл таңдау керек" -03020A03="Сізге бір не бірнеше файл таңдау керек" -03020A04="{0} деген файл бар" - -; Computer -03031100="Сыйымы" -03031101="Бос" -03031102="Кластер көлемі" -03031103="Белгі" - -; Network -03031200="Жергілікті аты" -03031201="Провайдер" - -; Benchmark Dialog - -03080000="Өнімділікке тестілеу" -03080001="Жад көлемі:" -03080002="Буу" -03080003="Шешу" -03080004="Жылдамдық" -03080005="Рейтинг" -03080006="Жалпы рейтинг" -03080007="Ағымдық" -03080008="Нәтижесі" -03080009="Өтулер:" -0308000A="Қате:" -0308000B="Ауырлық" -0308000C="Рейтинг / Жеңіс." - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ko.txt b/tools/7-Zip/Lang/ko.txt deleted file mode 100644 index ae77896e71..0000000000 --- a/tools/7-Zip/Lang/ko.txt +++ /dev/null @@ -1,536 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59b -; Translated by -; 4.53~4.59b: Dong-yoon Han (한동윤) -; ~4.52 beta: Hyeong il Kim(kurt Sawyer) -; Orignal: ZannyLim(임재형), -; - -00000000="Korean" -00000001="한국어" -00000002="18" - -; 7-Zip Configuration - -; Title -01000000="7-Zip 환경설정" - -; Info Page -01000100="7-Zip 정보" -01000103="7-Zip 은 무료 소프트웨어입니다. 원하신다면, 등록을 통해 7-Zip 개발을 지원하실 수 있습니다." -01000104="기술지원" -01000105="등록" - -; Folders Page -01000200="폴더" -01000210="작업 폴더(&W)" -01000211="시스템 임시 폴더(&S)" -01000212="현재 폴더(&C)" -01000213="지정 폴더(&S):" -01000214="이동식 드라이브에서만 사용" - -01000281="압축에 관계된 파일이 임시적으로 사용할 위치 지정." - -; System Page -01000300="시스템" -01000301="7-Zip 을 쉘 컨텍스트 메뉴에 통합" -01000302="계단식 컨텍스트 메뉴" -01000310="컨텍스트 메뉴 항목:" - -; Language Page -01000400="언어" -01000401="언어:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip 명령" -02000103="압축파일 열기" -02000104="선택한 압축파일을 엽니다." -02000105="압축 풀기..." -02000106="선택한 압축파일의 압축을 풉니다." -02000107="압축파일에 추가..." -02000108="선택한 항목을 압축파일에 추가합니다." -02000109="압축파일 테스트" -0200010A="선택한 압축파일의 무결성을 테스트합니다." -0200010B="여기에 압축 풀기" -0200010C="선택한 압축파일을 현재 폴더에 풉니다." -0200010D="{0}에 풀기" -0200010E="하위 폴더에 파일을 풉니다." -0200010F="{0}에 추가" -02000110="선택한 항목을 압축파일에 추가합니다." -02000111="압축해서 이메일 보내기" -02000112="선택한 항목을 압축파일로 만들어 이메일을 통해 보냅니다." -02000113="{0}로 압축해서 이메일 보내기" -02000114="선택한 항목을 압축파일로 만들어 이메일을 통해 보냅니다." - -02000140="<폴더>" -02000141="<압축파일>" - -; Properties -02000203="경로" -02000204="이름" -02000205="확장자" -02000206="폴더" -02000207="크기" -02000208="압축된 크기" -02000209="속성" -0200020A="만든 날짜" -0200020B="액세스한 날짜" -0200020C="수정한 날짜" -0200020D="솔리드" -0200020E="설명" -0200020F="암호화" -02000210="나누기 이전" -02000211="나누기 후" -02000212="사전" -02000213="CRC" -02000214="형식" -02000215="안티" -02000216="압축 방식" -02000217="생성한 OS" -02000218="파일 시스템" -02000219="사용자" -0200021A="그룹" -0200021B="블럭" -0200021C="설명" -0200021D="위치" -0200021E="경로 접두" -0200021F="폴더" -02000220="파일" -02000221="버전" -02000222="볼륨" -02000223="다중볼륨" -02000224="오프셋" -02000225="링크" -02000226="블록" -02000227="볼륨" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="물리적 크기" -0200022D="해더 크기" -0200022E="체크섬" -0200022F="특성" -02000230="가상 주소" - -; Status bar -02000301="{0} 항목이 선택됨" -02000302="{0} 항목" - -02000320="파일:" -02000321="폴더:" -02000322="크기:" -02000323="압축된 크기:" -02000324="압축파일:" - -; List Context Menu -02000401="열(&C)..." - -02000411="열기(&O)" -02000412="압축 풀기(&E)..." - -; ToolBar -02000501="압축 풀기" - -; Messages -02000601="업데이트 작업이 이 압축파일에서는 지원되지 않습니다." -02000602="압축파일 {0}을(를) 업데이트 할 수 없음" -02000603="'{0}' 폴더를 생성할 수 없음" -02000604="파일이 지원되지 않는 압축파일 입니다." -02000605="오류" -02000606="항목이 너무 많음" -02000607="주어진 파일 이름 확장자에 연결된 프로그램이 없음" -02000608="오류 없음" -02000609="파일 '{0}'을(를) 압축파일로 열 수 없음" -0200060A="암호화된 압축파일 '{0}'을(를) 열 수 없습니다. 암호가 틀리나요?" -0200060B="시스템이 필요한 양의 메모리를 할당할 수 없음" -0200060C="알 수 없는 오류" -0200060D="지원되지 않는 압축파일 유형" - -; Dialogs -02000702="확인" -02000705="예(&Y)" -02000707="모두 예(&A)" -02000709="아니오(&N)" -0200070B="모두 아니오(&L)" - -02000710="취소" -02000711="취소(&C)" -02000713="닫기(&C)" -02000714="중지" -02000715="다시 시작" - -02000720="도움말" - -; Extract dialog -02000800="압축 풀기" -02000801="압축 풀기(&X):" -02000802="암호" - -02000810="경로 모드" -02000811="전체 경로명" -02000812="현재 경로명" -02000813="경로명 없음" - -02000820="덮어쓰기 모드" -02000821="덮어쓰기 전에 물어봄" -02000822="물어보지 않고 덮어쓰기" -02000823="존재하는 파일 건너뛰기" -02000824="자동으로 이름 바꾸기" -02000825="존재하는 파일 이름 바꾸기" - -02000830="파일" -02000831="선택된 파일(&S)" -02000832="모든 파일(&A)" - -02000881="압축 풀린 파일의 위치를 지정합니다." - -02000890="압축 푸는 중" - -; Overwrite dialog -02000900="파일 교체시 확인" -02000901="대상 폴더에 이미 파일이 존재합니다." -02000902="존재하는 파일을" -02000903="이것으로 교체하시겠습니까?" - -02000911="자동으로 이름 바꾸기(&U)" - -02000982="{0} 바이트" -02000983="수정한 날짜" - -; Messages dialog -02000A00="진단 메시지" - -02000A80="메시지" - -02000A91="'{0}'은 지원하지 않는 압축 방식입니다." -02000A92="'{0}'에 데이터 오류가 있습니다. 파일이 손상되었습니다." -02000A93="'{0}'의 CRC 검사를 실패했습니다. 파일이 손상되었습니다." -02000A94="암호화 파일 '{0}'에 데이터 오류가 있습니다. 암호가 틀리나요?" -02000A95="암호화 파일 '{0}'의 CRC 검사를 실패했습니다. 암호가 틀리나요?" - -; Password dialog -02000B00="암호 입력" -02000B01="암호 입력:" -02000B02="암호 보여주기(&S)" -02000B03="암호 다시 입력:" -02000B10="암호가 일치하지 않음" -02000B11="암호로는 영문자, 숫자 그리고 특수 문자 (!, #, $, ...)만 사용" -02000B12="패스워드가 너무 김" - -; Progress dialog -02000C00="처리" -02000C01="경과 시간:" -02000C02="남은 시간:" -02000C03="전체 크기:" -02000C04="속도:" -02000C05="처리됨:" -02000C06="압축 효율:" - -02000C10="낮은 순위로(&B)" -02000C11="우선 순위로(&F)" -02000C12="일시정지(&P)" -02000C13="계속(&C)" - -02000C20="일시정지 됨" - -02000C30="정말로 취소하시겠습니까?" - -; Compress dialog -02000D00="압축파일에 추가" -02000D01="압축파일(&A):" -02000D02="업데이트 모드(&U):" -02000D03="압축파일 형식(&F):" -02000D04="압축 방식(&M):" -02000D05="솔리드 압축 파일 만들기(&S)" -02000D06="매개변수(&P):" -02000D07="옵션" -02000D08="자동(SFX) 압축파일 생성(&X)" -02000D09="다중 스레딩" -02000D0A="파일 이름 암호화(&N)" -02000D0B="압축 레벨(&L):" -02000D0C="사전 크기(&D):" -02000D0D="단어(word) 크기(&W):" -02000D0E="압축시 사용 메모리:" -02000D0F="압축 풀기시 사용 메모리:" -02000D10="암호화" -02000D11="암호화 방식:" -02000D12="CPU 스레드 수:" -02000D13="솔리드 블록 크기:" -02000D14="솔리드 사용 않함" -02000D15="솔리드" -02000D16="공유하고있는 파일 압축" - -02000D40="볼륨 나누기, 바이트(&V):" -02000D41="볼륨 크기가 부적절합니다." -02000D42="지정된 볼륨 크기: {0} 바이트.\n이 볼륨 크기로 분할 하시겠습니까?" - -02000D81="저장" -02000D82="보통" -02000D83="최고" -02000D84="빠름" -02000D85="가장 빠름" -02000D86="극한" - -02000D90="찾아보기" - -02000DA1="파일을 추가하고 교체" -02000DA2="파일을 업데이트하고 추가" -02000DA3="존재하는 파일만 새롭게 하기" -02000DA4="압축파일 내용을 동기화" - -02000DB1="모든 파일" - -02000DC0="압축하는 중" - -; Columns dialog -02000E00="열" -02000E01="이 폴더에서 보고 싶은 열을 체크하세요. 열의 순서를 바꾸려면 위로 그리고 아래로 버튼을 사용하세요." -02000E02="선택한 열은 반드시 넓이는" -02000E03="픽셀이 되어야 합니다. (&W)" - -02000E10="위로 이동(&U)" -02000E11="아래로 이동(&D)" -02000E12="보여주기(&S)" -02000E13="숨기기(&H)" -02000E14="설정" - -02000E81="제목" -02000E82="폭" - -; Testing -02000F90="검사 중" - - -; File Manager - -03000000="7-Zip 파일 매니저" - -; Menu -03000102="파일(&F)" -03000103="편집(&E)" -03000104="보기(&V)" -03000105="도구(&T)" -03000106="도움말(&H)" -03000107="즐겨찾기(&A)" - -; File -03000210="열기(&O)" -03000211="내부 열기(&I)" -03000212="외부 열기(&U)" -03000220="보기(&V)" -03000221="편집(&E)" -03000230="새 이름(&M)" -03000231="복사(&C)..." -03000232="이동(&M)..." -03000233="삭제(&D)" -03000240="속성(&R)" -03000241="설명(&N)" -03000242="체크섬 계산" -03000250="폴더 만들기" -03000251="파일 만들기" -03000260="끝내기(&X)" -03000270="파일 나누기(&S)" -03000271="파일 합치기(&B)" - -; Edit -03000310="실행 취소(&U)" -03000311="다시 실행(&R)" -03000320="잘라내기(&T)" -03000321="복사(&C)" -03000322="붙여넣기(&P)" -03000323="삭제(&D)" -03000330="모두 선택(&A)" -03000331="모두 선택 취소" -03000332="선택 항목 반전(&I)" -03000333="선택..." -03000334="선택 취소..." -03000335="파일 형식으로 선택" -03000336="파일 형식으로 선택 취소" - -; View -03000410="큰 아이콘(&G)" -03000411="작은 아이콘(&M)" -03000412="목록(&L)" -03000413="자세히(&S)" -03000420="정렬 안함" -03000430="최상위 폴더 열기" -03000431="한단계 위로" -03000432="폴더 히스토리..." -03000440="새로 고침(&R)" -03000449="펼쳐 보기" -03000450="2 패널(&2)" -03000451="도구 모음(&T)" -03000460="압축 도구 모음" -03000461="표준 도구 모음" -03000462="큰 버튼" -03000463="버튼 텍스트 보여주기" - -; Tools -03000510="옵션(&P)..." -03000511="벤치마크(&B)..." - -; Help -03000610="도움말 항목(&C)..." -03000620="7-Zip 정보(&A)..." - -; Favorites -03000710="즐겨찾기에 폴더 추가(&A)" -03000720="북마크" - -; Options Dialog - -03010000="옵션" - -; Plugins -03010100="플러그인" -03010101="플러그인(&P):" -03010110="옵션" - -; Edit -03010200="편집기" -03010201="편집기(&E):" - -; System -03010300="시스템" -03010302="7-Zip으로 연결:" -03010310="플러그 인" - -; Settings -03010400="설정" -03010401="\"..\" 항목 보여주기" -03010402="실재 파일 아이콘 보여주기" -03010410="시스템 메뉴 보여주기" -03010420="행 전체 선택(&F)" -03010421="눈금선 보여주기(&G)" -03010430="대체 선택 모드" -03010440="큰 메모리 페이지 사용" - -; Strings - -03020201="복사" -03020202="이동" -03020203="폴더로 복사:" -03020204="폴더로 이동:" -03020205="복사 중..." -03020206="이동 중..." -03020207="해당 폴더에 항목을 이동 또는 복사할 수 없습니다." -03020208="지원되지 않는 작업입니다." -03020209="대상 폴더를 선택하세요." - -03020210="파일 삭제 확인" -03020211="폴더 삭제 확인" -03020212="여러 파일 지우기 확인" -03020213="'{0}'을(를) 삭제하시겠습니까?" -03020214="폴더 '{0}'와 그 모든 내용을 삭제하시겠습니까?" -03020215="이 {0} 항목들을 삭제하시겠습니까?" -03020216="삭제 중..." -03020217="파일 또는 폴더 삭제 실패" -03020218="시스템이 긴 경로의 파일을 휴지통으로 이동할 수 없음" - -03020220="이름 바꾸는 중..." -03020221="파일 또는 폴더 이름 바꾸기 실패" -03020222="파일 복사 확인" -03020223="파일을 압축파일로 복사 하시겠습니까?" - -03020230="폴더 만들기" -03020231="폴더 이름:" -03020232="새 폴더" -03020233="폴더 만들기 오류" - -03020240="파일 만들기" -03020241="파일 이름:" -03020242="새 파일" -03020243="파일 만들기 오류" - -03020250="선택" -03020251="선택 취소" -03020252="마스크:" - -03020260="폴더 히스토리" - -03020280="파일 '{0}'이 수정되었습니다.\n압축파일에 업데이트 하시겠습니까?" -03020281="'{0}' 파일을 업데이트 할 수 없습니다." -03020282="편집기를 시작할 수 없습니다." -03020283="여는 중..." -03020284="해당 파일이 바이러스 같습니다 (파일 이름에 길다란 공백이 들어있음)." - -03020290="설명" -03020291="설명(&C):" - -030202A0="시스템" - -03020300="컴퓨터" -03020301="네트워크" -03020302="문서" - -03020400="추가" -03020401="압축 풀기" -03020402="테스트" - -03020420="복사" -03020421="이동" -03020422="삭제" -03020423="정보" - -03020500="파일 분할하기" -03020501="분할하기(&S):" -03020510="분할하는 중..." -03020520="분할 확인" -03020521="정말 {0} 볼륨들로 분할 하시겠습니까?" -03020522="볼륨 크기가 원본 파일보다 작아야만 합니다." - -03020600="파일 합치기" -03020601="합치기(&B):" -03020610="파일 합치는 중..." -03020620="첫번째 파일만 선택하시오" -03020621="분할한 파일의 한 부분으로 인식할 수 없음" -03020622="분할 파일의 한 부분 이상을 찾을 수 없음" - -03020710="체크섬 계산중..." -03020720="체크섬 정보" -03020721="데이터용 CRC 체크섬:" -03020722="데이터와 이름용 CRC 체크섬:" - -03020800="검색 중..." - -03020900="속성" - -03020A01="긴 경로로된 폴더에서 해당 작업을 호출할 수 없습니다." -03020A02="반드시 한 개의 파일을 선택해야함" -03020A03="반드시 한 개 이상의 파일을 선택해야 함" -03020A04="{0} 파일은 이미 존재함" - -; Computer -03031100="전체 크기" -03031101="여유 공간" -03031102="클러스터 크기" -03031103="라벨" - -; Network -03031200="로컬 이름" -03031201="제공자" - -; Benchmark Dialog - -03080000="벤치마크" -03080001="메모리 사용량:" -03080002="압축 중" -03080003="압축 푸는 중" -03080004="속도" -03080005="평가" -03080006="전체 평가" -03080007="현재" -03080008="결과" -03080009="통과:" -0308000A="오류:" -0308000B="CPU 사용량" -0308000C="평가 / 사용량" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/ku-ckb.txt b/tools/7-Zip/Lang/ku-ckb.txt deleted file mode 100644 index 8d80ac6a0d..0000000000 --- a/tools/7-Zip/Lang/ku-ckb.txt +++ /dev/null @@ -1,536 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.66 -; Translated by Ara Qadir. -; http://www.chawg.org -; -; -; - -00000000="Kurdish - Sorani" -00000001="کوردی" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="سازدانی 7-Zip" - -; Info Page -01000100="7-Zip دەربارەی" -01000103="7-Zip پڕۆگرامێکی خۆڕایە. لەگەڵ ئەوەشدا، ئەتوانی پاڵپشت بیت لە پەرەپێدانی 7-Zip." -01000104="پاڵپشتی" -01000105="تۆمارکردن" - -; Folders Page -01000200="بوخچەکان" -01000210="بوخچەی &کارکردن" -01000211="بوخچەی کاتی &سیستەم" -01000212="&ئێستایی" -01000213="&دیاریکراو:" -01000214="تەنها بۆ ئەو وەگەڕخەرانە بەکاری بهێنە کە توانای لابردنیان هەیە (removable disk)" - -01000281="شوێنێک دیاری بکە بۆ پەڕگە کاتییەکانی ئەرشیڤ." - -; System Page -01000300="سیستەم" -01000301="7-Zip بکە نێو لیستەی مێنیوەوە" -01000302="مێنیو بکە بە یەک هاوپۆل" -01000310="کەرەستەکانی نێو مێنیو:" - -; Language Page -01000400="زمان" -01000401="زمان:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="فرمانەکانی 7-Zip" -02000103="کردنەوەی ئەشیڤ" -02000104="ئەرشیڤە دیاریکراوەکان ئەکاتەوە." -02000105="دەرکێشانی پەڕگەکان" -02000106="پەڕگەکان دەرئەکێشێت لە ئەرشیڤە دیاریکراوەکەدا." -02000107="زیادکردن بۆ ئەرشیڤ" -02000108="دیاریکراوەکان بۆ ئەرشیڤ زیاد بکە" -02000109="تاقیکردنەوەی ئەرشیڤ" -0200010A= "گشت ئەرشیڤە دیاریکراوەکە تاقیدەکاتەوە" -0200010B="لێرە دەریبکێشە" -0200010C="پەڕگەکانی ئەرشیڤی دیاریکراو دەردەکێشێ بۆ بوخچەی ئێستایی." -0200010D="دەرکێشان بۆ {0}" -0200010E="پەڕگەکان دەردەکێشێ بۆ ژێربوخچە." -0200010F="زیادکردنی بۆ {0}" -02000110="دیاریکراوەکان زیاد دەکات بۆ ئەرشیڤ." -02000111="پەستاندن و پەیامی ئەلیکترۆنی..." -02000112="پەڕگە دیاریکراوەکان بپەستێنە بۆ ئەرشیڤ و ئەرشیڤەکەش بە پەیامی ئەلیکترۆنی بنێرە." -02000113="بیپەستێنە بۆ {0} و بە پەیامی ئەلیکترۆنی بینێرە" -02000114="پەڕگە دیاریکراوەکان بپەستێنە بۆ ئەرشیڤ و ئەرشیڤەکەش بە پەیامی ئەلیکترۆنی بنێرە." - -02000140="<بوخچە>" -02000141="<ئەرشیڤ>" - -; Properties -02000203="ڕێڕەو" -02000204="ناو" -02000205="پاشگر" -02000206="بوخچە" -02000207="قەبارە" -02000208="قەبارەی پێچراو" -02000209="تایبەتمەندی" -0200020A="دروستکراوە" -0200020B="بینراوە" -0200020C="دەستکاریکراوە" -0200020D="ڕەق" -0200020E="لێدوانی لەسەر دراوە" -0200020F="پارێزراو" -02000210="لەتکردن پێش" -02000211="لەتکردن پاش" -02000212="فەرهەنگ" -02000213="CRC" -02000214="جۆر" -02000215="دژ" -02000216="ڕێباز" -02000217="سیستەمی خانەخوێ" -02000218="سیستەمی پەڕگە" -02000219="بەکارهێنەر" -0200021A="گوروپ" -0200021B="بلۆک" -0200021C="لێدوان" -0200021D="جێگە" -0200021E="ـی ڕێڕەو Prefix" -0200021F="بوخچەکان" -02000220="پەڕگەکان" -02000221="وەشان" -02000222="قەبارەکان" -02000223="فرە قەبارە" -02000224="Offset" -02000225="بەستەرەکان" -02000226="بلۆکەکان" -02000227="قەبارەکان" - -02000229="٦٤-بت" -0200022A="Big-endian" -0200022B="CPU" -0200022C="قەبارەی فیزیکی" -0200022D="قەبارەی سەر" -0200022E="کۆپشکنین" -0200022F="تایبەتمەندی" -02000230="ناونیشانی ڕاستی" - -; Status bar -02000301="{0} شت دیاریکراوە" -02000302="{0} شت" - -02000320="پەڕگەکان:" -02000321="بوخچەکان:" -02000322="قەبارە" -02000323="قەبارەی پەستێنراو:" -02000324="ئەرشیڤەکان:" - -; List Context Menu -02000401="&ستوونەکان..." - -02000411="&کردنەوە" -02000412="&دەرکێشان..." - -; ToolBar -02000501="دەرکێشان" - -; Messages -02000601="کارپێکردنی نوێکاری پاڵپشت نەکراوە بۆ ئەم ئەرشیڤە." -02000602="ناتوانرێ ئەرشیڤی {0} نوێبکرێتەوە" -02000603="ناتوانرێ بوخچەی '{0}' دروستبکرێت." -02000604="پەڕگە ئەرشیڤێکی پاڵپشتیکراو نییە." -02000605="هەڵە" -02000606="شتی(item) زۆر هەن" -02000607="هیچ پەڕگەیەک نییە پەیوەست بێت بە پاشگری پەڕگەی دراوەوە." -02000608="هیچ هەڵەیەک نییە" -02000609="ناتوانرێت پەڕگەی '{0}' بکرێتەوە وەک ئەرشیڤ." -0200060A="ناتوانرێت ئەرشیڤی پارێزراوی '{0}' بکرێتەوە. ئایا تێپەڕەوشە هەڵەیە؟" -0200060B="سیستەم ناتوانێت بڕی پێویست لە بیرگە دابین بکات" -0200060C="هەڵەیەکی نەزانراو" -0200060D="جۆری ئەرشیڤ پاڵپشتی نەکراوە" - -; Dialogs -02000702="باشە" -02000705="&بەڵێ" -02000707="بەڵێ بۆ &هەموو" -02000709="&نەخێر" -0200070B="نەخێر بۆ هە&موو" - -02000710="پاشگەزبوونەوە" -02000711="&پاشگەزبوونەوە" -02000713="&داخستن" -02000714="وەستاندن" -02000715="دەستپێکردنەوە" - -02000720="یارمەتی" - -; Extract dialog -02000800="دەرکێشان" -02000801="&دەرکێشان بۆ:" -02000802="تێپەڕەوشە" - -02000810="جۆری ڕێڕەو" -02000811="ناوی ڕێڕەوی تەواوەتی" -02000812="ناوی ڕێڕەوە هەنووکەییەکان" -02000813="ناوی ڕێڕەو نییە" - -02000820="جۆری بەسەردا نووسینەوە" -02000821="بپرسە پێش بەسەردا نووسینەوە" -02000822="بەسەردا بنووسەوە بەبێ ڕەزامەندی" -02000823="پەڕگە هەبووەکان بپەڕێنە" -02000824="خۆکار ناوگۆڕین" -02000825="خۆکار ناوگۆڕینی پەڕگە هەبووەکان" - -02000830="پەڕگەکان" -02000831="پەڕگە &دیاریکراوەکان" -02000832="&هەموو پەڕگەکان" - -02000881="شوێنێک دیاری بکە بۆ پەڕگە دەرکێشراوەکان" - -02000890="دەری دەکێشێ" - -; Overwrite dialog -02000900="دڵنیابە لە جێگرتنەوەی پەڕگە" -02000901="بوخچەی مەبەست پەڕگەیەکی تیادایە بە هەمان ناو." -02000902="ئەتەوێت پەڕگە هەبووەکان جێبگیردرێتەوە؟" -02000903="لەگەڵ ئەم دانەیە؟" - -02000911="ناوگۆڕینی &خۆکار" - -02000982="{0} بایت" -02000983="دەستکاریکراوە لە" - -; Messages dialog -02000A00="پەیامی لێکۆڵینەوە/ پشکنین" - -02000A80="پەیام" - -02000A91="ڕێبازێکی پاڵپشتی نەکراوی پەستاندن بۆ '{0}'. " -02000A92="زانیاری '{0}' هەڵەیە. پەڕگە تێکشکاوە." -02000A93="CRC سەرکەوتوو نەبوو. پەڕگە تێکشکاوە." -02000A94="زانیاری هەڵەیە لە پەڕگەی پارێزراودا '{0}'. ئایا تێپەڕەوشە هەڵەیە؟" -02000A95="CRC هەڵەیە لە پەڕگەی پارێزراودا '{0}'. ئایا تێپەڕەوشە هەڵەیە؟" - -; Password dialog -02000B00="نووسینی تێپەڕەوشە:" -02000B01="تێپەڕەوشە بنووسە:" -02000B02="&پیشاندانی تێپەڕەوشە" -02000B03="تێپەڕەوشە بنووسەوە:" -02000B10="تێپەڕەوشەکان وەک یەک نین" -02000B11="تەنها پیتە ئینگلیزییەکان، ژمارە و نووسە تیبەتییەکان ($، %، #) بۆ تێپەڕەوشە بەکاربهێنە" -02000B12="تێپەڕەوشە زۆر درێژە" - -; Progress dialog -02000C00="جێبەجێکردن" -02000C01="ک. دەستپێکردوو:" -02000C02="کاتی ماوە:" -02000C03="سەرجەمی قەبارە:" -02000C04="خێرایی:" -02000C05="جێبەجێکراوە:" -02000C06="ڕێژەی پەستاندن:" - -02000C10="&پاشەبنەما" -02000C11="پ&ێشەبنەما" -02000C12="&ڕاگرتن" -02000C13="&بەردەوامبوون" - -02000C20="ڕاگیردرا" - -02000C30="دڵنیایت لە پاشگەزبوونەوە؟" - -; Compress dialog -02000D00="زیادکردن بۆ ئەرشیڤ" -02000D01="&ئەرشیڤ:" -02000D02="&جۆری نوێکاری:" -02000D03="&فۆڕماتی ئەرشیڤ:" -02000D04="&ڕێبازی پەستاندن:" -02000D05="دروستکردنی ئەرشیڤی &ڕەق/ پتەو" -02000D06="&هاوکۆڵکەکان:" -02000D07="هەڵبژاردنەکان" -02000D08="دروستکردنی ئەرشیڤی SF&X" -02000D09="فرەدەزوو" -02000D0A="&ناوی پەڕگەکان بپارێزە (encrypt)" -02000D0B="&ئاستی پەستاندن:" -02000D0C="قەبارەی &فەرەەنگ:" -02000D0D="قەبارەی &وشە:" -02000D0E="ڕێژەی بەکارهێنانی بیرگە بۆ پەستاندان:" -02000D0F="ڕێژەی بەکارهێنانی بیرگە بۆ کردنەوەی پەستێنراو:" -02000D10="پاراستن" -02000D11="ڕێبازی پاراستن" -02000D12="ژمارەی دەزووەکانی CPU:" -02000D13="قەبارەی بلۆکی ڕەق:" -02000D14="نا-ڕەق" -02000D15="ڕەق" -02000D16="پەستاندنی پەڕگە ئاڵوگۆڕکراوەکان" - -02000D40="لەتی بکە بۆ &قەبارە و بایت:‌" -02000D41="قەبارەی لەتکراوەکە هەڵەیە" -02000D42="قەبارەی دیاریکراوی لەتکراوەکە: {0} بایت.\nدڵنیایت لە لەتکردنی ئەرشیڤەکە بۆ ئەو قەبارانە؟" - -02000D81="پاشەکەوت" -02000D82="ئاسایی" -02000D83="زۆرترین" -02000D84="خێرا" -02000D85="خێراترین" -02000D86="سەروو" - -02000D90="هەڵدەوە/ Browse" - -02000DA1="زیادکردن و جێگرتنەوەی پەڕگەکان" -02000DA2="نوێکردنەوە و زیادکردنی پەڕگە" -02000DA3="بووژاندنەوەی پەڕگە هەبووەکان" -02000DA4="ـکردنی پەڕگەکان Synchronize" - -02000DB1="هەموو پەڕگەکان" - -02000DC0="دەی پەستێنێ..." - -; Columns dialog -02000E00="ستوونەکان" -02000E01="ئەو ستوونەکان بپشکنە کە ئەتەوێت دیاربن لەم بوخچەیەدا. دوگمەی جوڵان بۆ سەرەوە و جوڵان بۆ خوارەوە بەکارببە بۆ پێش و پاشخستنی ستوونەکان." -02000E02="ستوونی دیاریکراو پێویستە" -02000E03="خاڵ &پان بێت." - -02000E10="جوڵان بۆ &خوارەوە" -02000E11="جوڵان بۆ &سەرەوە" -02000E12="&پیشاندان" -02000E13="&شاردنەوە" -02000E14="ڕێکبخە" - -02000E81="ناونیشان" -02000E82="پانی" - -; Testing -02000F90="تاقیدەکاتەوە" - - -; File Manager - -03000000="7-Zip بەڕێوەبەرایەتی پەڕگەی" - -; Menu -03000102="&فایل" -03000103="&دەستکاری" -03000104="&بینین" -03000105="&ئامڕازەکان" -03000106="&یارمەتی" -03000107="د&ڵخوازەکان" - -; File -03000210="&کردنەوە" -03000211="کردنەوە لە&ناو خۆدا" -03000212="کردنەوە لە &دەرەوە" -03000220="&بینین" -03000221="&دەستکاری" -03000230="&ناوگۆڕین" -03000231="&لەبەرگرتنەوە بۆ..." -03000232="&گواستنەوە بۆ..." -03000233="&سڕینەوە" -03000240="&تایبەتمەندییەکان" -03000241="ل&ێدوان" -03000242="ژماردنی checksum" -03000250="دروستکردنی بوخچە" -03000251="دروستکردنی پەڕگە" -03000260="دەر&چوون" -03000270="&لەتکردنی پەڕگە..." -03000271="&پێکەوە لکاندنی پەڕگەکان..." - -; Edit -03000310="&پاشگەزبوونەوە" -03000311="&کردن-ەوە" -03000320="&بڕین" -03000321="&لەبەرگرتنەوە" -03000322="&لکا&ندن" -03000323="&سڕینەوە" -03000330="هەمووی دیاری بکە" -03000331="هەموو دیاریکراوەکان لاببە" -03000332="%پێچەوانەکردنەوەی دیاریکراو" -03000333="دیاری بکە..." -03000334="دیاری مەکە..." -03000335="بە پێی جۆر دیاری بکە" -03000336="لابردنی دیاریکراوەکان بەپێ جۆر" - -; View -03000410="ئایکۆنی &گەورە" -03000411="ئایکۆنی &بچوک" -03000412="&لیست" -03000413="&وردەکاری" -03000420="ڕیزنەکراو" -03000430="کردنەوەی بوخچەی ڕەگ" -03000431="یەک ئاست بۆ سەرەوە" -03000432="مێژووی بوخچەکان..." -03000440="&بووژاندنەوە" -03000449="بینین بەشێوەی فلات" -03000450="&2 پانێڵ" -03000451="&جێ ئامڕاز" -03000460="جێ ئامڕازی ئەرشیڤ" -03000461="جی ئامڕازی بنچینە" -03000462="دوگمەی گەورە" -03000463="پیشاندانی دەقی دوگمەکان" - -; Tools -03000510="&هەڵبژاردنەکان" -03000511="&نیشانەی پێوان" - -; Help -03000610="&ناوەڕۆکەکان..." -03000620="&دەربارەی 7-Zip..." - -; Favorites -03000710="&زیادکردنی بوخچە بۆ دڵخوازەکان وەک" -03000720="دڵخوازی" - -; Options Dialog - -03010000="ەەڵبژاردنەکان" - -; Plugins -03010100="پێوەکراوەکان" -03010101="&پێوەکراوەکان:" -03010110="هەڵبژاردنەکان" - -; Edit -03010200="دەستکاریکەر" -03010201="&دەستکاریکەر:" - -; System -03010300="سیستەم" -03010302="7-Zip پەیوەست بکە بە:" -03010310="پێوەکراوە" - -; Settings -03010400="ڕێکخستەکان" -03010401="شتەکانی \"..\" پیشانبدە" -03010402="ئایکۆنی ڕاستەقینەی پەڕگەکان پیشانبدە" -03010410="مێنیوی سیستەم پیشانبدە" -03010420="دیاریکردنی هەموو &ڕیزەکە" -03010421="پیشاندانی هێڵە &grid ـەکان" -03010430="جۆری دیاریکردنی &جێگرەوە/ ئەڵتەرناتیڤ" -03010440="پەڕەی بیرگەی &گەورە بەکارببە" - -; Strings - -03020201="لەبەرگرتنەوە" -03020202="گواستنەوە" -03020203="لەبەرگتنەوە بۆ:" -03020204="گواستنەوە بۆ:" -03020205="لەبەری دەگرێتەوە..." -03020206="دەیگوازێتەوە بۆ..." -03020207="ناتوانی شتەکان لەبەربگریتەوە یان بگوازیتەوە بۆ ئەو بوخچانە." -03020208="ئەو کارە پاڵپشتی نەکراوە" -03020209="بوخچەی مەبەست دیاری بکە." - -03020210="دڵنیابە لە سڕینەوەی پەڕگە" -03020211="دڵنیابە لە سڕینەوەی بوخچە" -03020212="دڵنیابە لە سڕینەوەی هەموو پەڕگەکان" -03020213="دڵنیایت لە سڕینەوەی '{0}'؟" -03020214="دڵنیایت لە سڕینەوەی بوخچەی '{0}' و هەموو ناوەڕۆکەکانی؟" -03020215="دڵنیایت لە سڕینەوەی ئەم {0} شتە؟" -03020216="دەی سڕێتەوە..." -03020217="هەڵە هەیە لە سڕینەوەی پەڕگەکان یا بوخچەکان" -03020218="سیستەم ناتوانێت پەڕگەیەک بگوێزێتەوە بۆ تەنەکەی خۆڵ بە ڕێڕەوی درێژەوە" - -03020220="ناوی دەگۆڕێ..." -03020221="هەڵە هەیە لە ناو گۆڕینی پەڕگە یان بوخچەکان. " -03020222="دڵنیابە لە لەبەرگرتنەوەی پەڕگە" -03020223="دڵنیایت لە لەبەرگرتنەوەی پەڕگەکان بۆ ئەرشیڤ؟" - -03020230="دروستکردنی بوخچە" -03020231="ناوی بوخچە:" -03020232="بەخچەی نوێ" -03020233="هەڵە هەیە لە دروستکردنی بوخچە " - -03020240="دروستکردنی پەڕگە" -03020241="ناوی پەڕگە:" -03020242="پەڕگەی نوێ" -03020243="هەڵە هەیە لە دروستکردنی پەڕگەدا" - -03020250="دیاری بکە" -03020251="دیاری مەکە" -03020252="دەمامک:" - -03020260="مێژووی بوخچەکان" - -03020280="پەڕگەی '{0}' دەستکاریکراوە. ئەتەوێت لە ئەرشیڤەکەدا نوێی بکەیتەوە؟" -03020281="ناتوانرێ پەڕگەی \n'{0}' نوێبکرێتەوە" -03020282="ناتوانرێ دەستکاریکەر دەستپێبکرێت." -03020283="دەیکاتەوە..." -03020284="پەڕگەکە لە ڤایرۆس دەچێت (ناوی پەڕگەکە بۆشایی زۆری تیادایە)." - -03020290="لێدوان" -03020291="&لێدوان:" - -030202A0="سیستەم" - -03020300="کۆمپیوتەر" -03020301="ڕایەڵە" -03020302="بەڵگەنامەکان" - -03020400="زیادکردن" -03020401="دەرکێشان" -03020402="تاقیکردنەوە" - -03020420="لەبەرگرتنەوە" -03020421="گواستنەوە" -03020422="سڕینەوە" -03020423="زانیاری" - -03020500="لەتکردنی پەڕگە" -03020501="&لەتی بکە بۆ:" -03020510="لەتی دەکات..." -03020520="دڵنیابە لە لەتکردن" -03020521="دڵنیایت لە لەتکردنی پەڕگەی {0} بۆ دوو قەبارە؟" -03020522="پێویستە قەبارەی هەر یەک لە لەتەکان بچوکتربێت لە قەبارەی پەڕگە لەتکراوەکە" - -03020600="پێکەوەلکاندنی پەڕگەکان" -03020601="%پێکەوەی بلکێنە بۆ:" -03020610="پێکەوەی دەلکێنێت..." -03020620="تەنها پەڕگەی یەکەم دیاری بکە" -03020621="ناتوانێت پەڕگە بدۆزێتەوە وەک بەشێک لە پەڕگە لەتکراوەکە" -03020622="ناتوانێت لە بەشێک زیاتر بدۆزێتەوە لە پەڕگە لەتکراوەکە" - -03020710="ژماردنی کۆپشکنین..." -03020720="زانیاری کۆپشکنین" -03020721="کۆپشکنینی CRC بۆ دراوە:" -03020722="کۆپشکنینی CRC بۆ دراوە و ناوەکان:" - -03020800="دەی پشکنێت..." - -03020900="تایبەتمەندییەکان" - -03020A01="ناتوانرێت ئەو کردارە بانگبکرێت لە بوخچەیەکەوە کە ڕێڕەوێکی درێژی ەەیە." -03020A02="پێویستە پەڕگەیەک دیاریبکەیت" -03020A03="پێویستە پەڕگەیەک یان زیاتر دیاریبکەیت" -03020A04="پەڕگەی {0} پێشتر ەەیە" - -; Computer -03031100="سەرجەمی قەبارە" -03031101="بۆشایی بەتاڵ" -03031102="قەبارەی کۆمەڵەکە" -03031103="نیشان" - -; Network -03031200="ناوی ناوخۆیی" -03031201="دابینکەر" - -; Benchmark Dialog - -03080000="نیشانەی پێوان" -03080001="ڕێژەی بەکارهێنراوی بیرگە:" -03080002="پەستاندن" -03080003="کردنەوەی پەستێنراو" -03080004="خێرایی" -03080005="هەڵسەنگاندن" -03080006="سەرجەمی هەڵسەنگاندن" -03080007="ئێستایی" -03080008="ئەنجام" -03080009="دەرچوونەکان:" -0308000A="هەڵەکان:" -0308000B="CPU ڕێژەی بەکارهێنراوی" -0308000C="ڕێژەی بەکارەێنراو / هەڵسەنگاندن" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/ku.txt b/tools/7-Zip/Lang/ku.txt deleted file mode 100644 index 2c25b8fecb..0000000000 --- a/tools/7-Zip/Lang/ku.txt +++ /dev/null @@ -1,473 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.37 -; Translated by Rizoyê Xerzî -; -; -; -; - -00000000="Kurdish" -00000001="Kurdî" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Sazkirin" - -; Info Page -01000100="Der barê 7-Zip de" -01000103="7-Zip nivîsbariyeke azad e. Lê, tu dikarî wekî tomarkirin desteka pêşxistina 7-zip bibî." -01000104="Destek" -01000105="Tomarkirin" - -; Folders Page -01000200="Peldank" -01000210="Peldanka &Xebatê" -01000211="&Peldanka TEMP a Pergalê" -01000212="P&eldanka Derbasdar" -01000213="Pe&ldanka Navborî:" -01000214="Bi tenê ji bo ajokarên derketî bi kar bîne" - -01000281="Ji bo dosiyên demdemî yên arşîvê cih belî bike." - -; System Page -01000300="Pergal" -01000301="Bila di pêşekên naverokê de 7-Zip bixuye" -01000302="Pêşeka naverokê ya sûlavî" -01000310="Hêmanên peşeka naverokê:" - -; Language Page -01000400="Ziman" -01000401="Ziman:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Fermanên 7-Zip" -02000103="Arşîvê veke" -02000104="Arşîva hilbijartî vedike." -02000105="Dosiyan derxe..." -02000106="Dosiyan ji arşîva hilbijartî derdixe." -02000107="Bike Arşîv..." -02000108="Hêmanên hilbijartî dixe arşîvê." -02000109="Arşîvê bihêçîne" -0200010A="Tevahiya arşîva hilbijartî diceribîne." -0200010B="Valake vir" -0200010C="Dosiyên arşîva hilbijartî derdixe peldanka derbasdar." -0200010D="Peldanka {0} derxe" -0200010E="Derdixe bin-peldankê." -0200010F="Wekî {0} bike arşîv" -02000110="Hêmanên hilbijartî dike arşîv." -02000111="Bişidîne û bişîne..." -02000112="Hêman hilbijartî dişidîne û arşîvê bi e-peyamê re dişîne." -02000113="Wekî {0} bişidîne û bişîne" -02000114="Hêmanên hilbijartî dişidîne û dike arşîv û arşîvê bi e-peyamê re dişîne." - -02000140="" -02000141="" - -; Properties -02000203="Rê" -02000204="Nav" -02000205="Cure" -02000206="Peldank" -02000207="Mezinahî" -02000208="Mezinahiya di arşîvê de" -02000209="Taybetiyên xweser" -0200020A="Çêbûyî" -0200020B="Gihaştî" -0200020C="Guhertî" -0200020D="Hişk" -0200020E="Daxuyankirî" -0200020F="Şîfrekirî" -02000210="Parçeyê borî" -02000211="Parçeyê piştre" -02000212="Ferheng" -02000213="CRC" -02000214="Cure" -02000215="Dij" -02000216="Awayê şidandinê" -02000217="Platform" -02000218="Pergala Dosiyê" -02000219="Bikarhêner" -0200021A="Kom" -0200021B="Stûn" -0200021C="Daxuyanî" -0200021D="Cih" -0200021E="Path Prefix" - -; Status bar -02000301="{0} heb hêman hilbijartî ne" -02000302="{0} heb hêman" - -02000320="Pel:" -02000321="Peldank:" -02000322="Mezinahî:" - -; List Context Menu -02000401="&Stûn..." - -02000411="&Veke" -02000412="&Derxe..." - -; ToolBar -02000501="Derxe" - -; Messages -02000601="Tu nikarî vê arşîvê rojane bikî." -02000602="Arşîva {0} nayê rojanekirin" -02000603="Peldanka '{0}' nayê çêkirin" -02000604="Ev dosya ne arşîveke naskirî ye." -02000605="Çewtî" -02000606="Hêman zêde ne" -02000607="Sepaneke têkildarî vî cureyê dosiyê nîn e" -02000608="Çewtî nîn e." - -; Dialogs -02000702="Temam" -02000705="&Erê" -02000707="&Ji Bo Hemûyî Erê" -02000709="&Na" -0200070B="Ji &Bo Hemûyî Na" - -02000710="Betal" -02000711="B&etal" -02000713="Bi&gire" -02000714="Raweste" -02000715="Dîsa Destpêke" - -02000720="Alîkarî" - -; Extract dialog -02000800="Derxe" -02000801="&Cihê Dê Derkevê:" -02000802="Şîfre" - -02000810="Navê Rê" -02000811="Navê tevahî yên rê" -02000812="Navê derbasdar ên rê" -02000813="Bila navên rê tune bin" - -02000820="Dosiyên heyî" -02000821="Ji bo li ser binivîse bipirse" -02000822="Bê pirs li ser binivîse" -02000823="Derxistin" -02000824="Navekî nû li yên di arşîvê de bike" -02000825="Navekî nû li yên heyî bike" - -02000830="Dosya" -02000831="D&osiyên hilbijartî" -02000832="He&mû Dosya" - -02000881="Ji bo dosya derkevinê cihekî belî bike." - -02000890="Tên derxistin" - -; Overwrite dialog -02000900="Rewla Lisernivîsandinê" -02000901="Di dosiya armanckirî de bi vî navî dosiyek heye. Bila li ser bête nivîsîn?" -02000902="Dosiya heyî:" -02000903="Dosiya tê derxistin:" - -02000911="Na&vekî nû lê bike" - -02000982="{0} bayt" -02000983="guhertina dawî " - -; Messages dialog -02000A00="Peyamên haydariyê" - -02000A80="Peyam" - -02000A91="Ji bo '{0}' awayê şidandinê nehate nasîn." -02000A92="'{0}' xerabe ye. (Çewtiya daneyê)" -02000A93="'{0}' xerabe ye. (Çewtiya CRC)" - -; Password dialog -02000B00="Têketina Şîfreyê" -02000B01="Şîfreyê binivîse:" -02000B02="Bi&la şîfre bixuye" - -; Progress dialog -02000C00="bixebite" -02000C01="Dema borî:" -02000C02="Dema mayî:" -02000C03="Mezinahî:" -02000C04="Lez:" - -02000C10="L%i Pişt" -02000C11="Li &Pêş" -02000C12="&Rawestîne" -02000C13="Bi&domîne" - -02000C20="Rawestiya - " - -02000C30="Ma bila betal bibe?" - -; Compress dialog -02000D00="Bike Arşîv" -02000D01="&Arşîv:" -02000D02="A&wayê rojanekirinê:" -02000D03="Awa&yê arşîvê:" -02000D04="Awayê şi&dandinê:" -02000D05="Bila &hişk be" -02000D06="&Parametre:" -02000D07="Vebijêrk" -02000D08="Bila ew bixwe derxe (SFX)" -02000D09="Pir&girêkî" -02000D0A="Navên dosiyê bike şîfre" -02000D0B="A&sta şidandinê:" -02000D0C="Me&zinahiya ferhengê:" -02000D0D="M&ezinahiya bêjeyê:" -02000D0E="Bikaranîna bîrê (Şidandin):" -02000D0F="Bikaranîna bîrê (Vekirin):" - -02000D40="Wekî Bayt/&cilt bike parçe:" - -02000D81="Bêyî şidandin" -02000D82="Asayî" -02000D83="Herî Pir" -02000D84="Bi Lez" -02000D85="Leztirîn" -02000D86="Ultra" - -02000D90="Bibîne" - -02000DA1="Dosiyan têxê, yên heyî derxe" -02000DA2="Dosiyan têxê, yên kevin rojane bike" -02000DA3="Bi tenê yên kevin rojane bike" -02000DA4="Dosiyan bike wekî hev" - -02000DB1="Hemû dosya" - -02000DC0="tên şidandin" - -; Columns dialog -02000E00="Stûn" -02000E01="Stûnên tu dixwazî di vê peldankê de xuya bibin nîşan bike. Ji bo rêzkirina stûnan bişkojkên berjor-berjêr bi kar bîne." -02000E02="Firehiya stûna hilbijartî" -02000E03="Bila &piksel be." - -02000E10="B&erjor" -02000E11="&Berjêr" -02000E12="&Nîşan Bide" -02000E13="&Veşêre" -02000E14="Peywirdar bike" - -02000E81="Sernivîs" -02000E82="Firehî" - -; Testing -02000F90="tê hêçandin" - - -; File Manager - -03000000="7-Zip Gerînendeyê Dosiyan" - -; Menu -03000102="&Dosya" -03000103="&Bipergalîne" -03000104="&Nîşan Bide" -03000105="&Amûr" -03000106="A&lîkarî" -03000107="Bi&jare" - -; File -03000210="&Veke" -03000211="&Di Panelê De Veke" -03000212="Di &Paceyê De Veke" -03000220="&Nîşan Bide" -03000221="&Sererast bike" -03000230="&Navekî Nû Bidê" -03000231="&Ji Ber Bigire" -03000232="B&ar Bike" -03000233="Jê B&ibe" -03000240="&Taybetî" -03000241="Da&xuyanî" -03000242="checksum heseb bike" -03000250="Pe&ldankeke Nû" -03000251="Do&siyeke Nû" -03000260="De&rkeve" -03000270="Parçe Bi&ke..." -03000271="Bike &Yek..." - -; Edit -03000310="&Vegere" -03000311="&Nû Bike" -03000320="&Bibire" -03000321="&Ji Ber Bigire" -03000322="&Pêveke" -03000323="Jê Bib&e" -03000330="&Hemûyî hilbijêre" -03000331="He&mû hilijartinê rake" -03000332="Be&revajî wê hilbijêre" -03000333="&Hilbijêre..." -03000334="Hilbijarti&nê Rake..." -03000335="Vî cureyî hilbijêre" -03000336="Hilbijartina cure rake" - -; View -03000410="&Dawêrên Mezin" -03000411="D&awêrên Biçûk" -03000412="&Lîste" -03000413="&Hûragahî" -03000420="Bê Dor" -03000430="Peldanka Kok Veke" -03000431="Astekê Berjor" -03000432="Dîroka Peldankê..." -03000440="&Nû Bike" -03000449="xuyakirina sade" -03000450="&2 Panelan veke" -03000451="Da&rikê amûran" -03000460="Darikê arşîvê" -03000461="Darikê standart" -03000462="Bişkojkên mezin" -03000463="Bila nivîsa bişkojkan bixuye" - -; Tools -03000510="&Vebijêrk..." -03000511="&Pîvana Çalakbûnê" - -; Help -03000610="&Naverok..." -03000620="D&er barê 7-Zip de..." - -; Favorites -03000710="Pe&ldanka derbasdar veke" -03000720="Cih" - -; Options Dialog - -03010000="Vebijêrk" - -; Plugins -03010100="Leqêq" -03010101="&Hemû Lehêq:" -03010110="Mîheng..." - -; Edit -03010200="Per&galker" -03010201="Pergalkerê De&qê:" - -; System -03010300="Pergal" -03010302="Bi 7-Zip re têkildar bike:" -03010310="Leqêq" - -; Settings -03010400="Mîheng" -03010401="Bila hêmana \"..\" xuya bike" -03010402="Bila dawêrên dosiyên rastî xuya bikin" -03010410="Bila pêşeka pergalê xuya bike" -03010420="Bila &hemû rêzikê bibore" -03010421="Bila &xêzên tabloyê xuya bike" -03010430="&Kipa hilbijartina alternatîf" -03010440="bîra berfireh bikar bîne" - -; Strings - -03020201="Ji Ber Bigire" -03020202="Bar Bike" -03020203="Cihê Dê Were Jibergirtin:" -03020204="Cihê Dê Were Barkirin:" -03020205="tê jibergirtin..." -03020206="tê barkirin..." -03020207="Jibergirtin û barkirin ji bo vê peldankê nabe." -03020208="Kirin ne pêkan e." - -03020210="Erêkirina jêbirina dosiyê" -03020211="Erêkirina jêbirina peldankê" -03020212="Erêkirina jêbirina gelek dosiyan" -03020213="Ma bila dosiya '{0}' bête jêbirin?" -03020214="Ma bila peldanka '{0}' û yên tê de bên jêbirin?" -03020215="Ma bila hêmana {0} bête jêbirin?" -03020216="tê jêbirin..." -03020217="Çewtiya Jêbirinê" - -03020220="navekî nû tê lêkirin..." -03020221="Çewtiya Navlêkirinê" -03020222="Erêkirina Jibergirtinê" -03020223="Ma bila dosî ji bo arşîvê bên jibergirtin" - -03020230="Peldankeke nû" -03020231="Navê peldankê:" -03020232="Peldankeke Nû" -03020233="Çewtiya Çêkirina peldankê" - -03020240="Dosiyeke Nû" -03020241="Navê Dosiyê:" -03020242="Dosiyeke Nû" -03020243="Çewtiya çêkirina Dosiyê" - -03020250="Hilbijêre" -03020251="Hilbijartinê rake" -03020252="Derbirîna hilbijartinê:" - -03020260="Rabirdûya Peldankê" - -03020280="Dosiya '{0}' hatiye guhartin.\nMa bila di arşîvê bête rojanekirin?" -03020281="Dosiya '{0}' nehate rojanekirin" -03020282="Pergalkerê deqê nehate destpêkirin." -03020283="vedibe..." - -03020290="Daxuyanî" -03020291="&Daxuyanî:" - -030202A0="Pergal" - -03020300="Komputer" -03020301="Tor" - -03020400="Bike Arşîv" -03020401="Derxe" -03020402="Bihêçîne" - -03020420="Ji Ber Bigire" -03020421="Bar Bike" -03020422="Jê Bibe" -03020423="Agahî" - -03020500="Bike Parçe" -03020501="Di &vê peldankê de parçe bike:" -03020510="tê parçekirin..." - -03020600="Bike Yek" -03020601="Di vê &peldankê de bike yek:" -03020610="tê yekirin..." - -03020710="Hesabê sererastkirî..." -03020720="Agahiyên hesabê sererast" -03020721="CRC hesabê sererast bo data:" -03020722="CRC hesabê sererast bo data û nav:" - -03020800="Tê raguhestin" - -; Computer -03031100="Hemû Mezinahî" -03031101="Cihê Vala" -03031102="Mezinahiya telpikî" -03031103="Etîket" - -; Network -03031200="Navê Herêmî" -03031201="Derfetkar" - -; Benchmark Dialog - -03080000="Çalakiya komputerê" -03080001="Bikaranîna birê:" -03080002="Şidandin" -03080003="Vekirin" -03080004="Lez" -03080005="Puan" -03080006="bi guloverî puanan" -03080007="Carî" -03080008="Encam" -03080009="Serkeftî:" -0308000A="Çewt:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/lt.txt b/tools/7-Zip/Lang/lt.txt deleted file mode 100644 index 764d063294..0000000000 --- a/tools/7-Zip/Lang/lt.txt +++ /dev/null @@ -1,512 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.57 -; Translated by Marius Navickas edited by Domas Jokubauskis -; -; -; -; - -00000000="Lithuanian" -00000001="Lietuvių" -00000002="39" - -; 7-Zip Configuration - -; Title -01000000="7-Zip nustatymai" - -; Info Page -01000100="Apie 7-Zip" -01000103="7-Zip yra nemokama programa. Vis dėlto, jeigu jums patinka 7-Zip ir jūs norėtumėte paremti jos tolesnį vystymą, prašome pinigais paremti 7-Zip projektą." -01000104="Techninis palaikymas" -01000105="Paremti" - -; Folders Page -01000200="Aplankai" -01000210="&Darbinis aplankas" -01000211="&Sisteminis laikinas aplankas" -01000212="D&abartinis" -01000213="Nurodyta&s:" -01000214="Naudoti tik išimamiems diskams" - -01000281="Nurodyti vietą laikinoms archyvinėms byloms." - -; System Page -01000300="Sistema" -01000301="Integruoti 7-Zip į kontekstinį meniu " -01000302="Pakopinis kontekstinis meniu" -01000310="Kontekstinio meniu įrašai:" - -; Language Page -01000400="Kalba" -01000401="Kalba:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip komandos" -02000103="Atverti archyvą" -02000104="Atveria pasirinktą archyvą." -02000105="Išskleisti failus..." -02000106="Išskleidžia failus iš pasirinkto archyvo." -02000107="Įtraukti į archyvą..." -02000108="Įtraukia pasirinktus elementus į archyvą." -02000109="Patikrinti archyvą" -0200010A="Patikrina pasirinkto archyvo vientisumą." -0200010B="Išskleisti čia" -0200010C="Išskleidžia pasirinkto archyvo failus šiame aplanke." -0200010D="Išskleisti į {0}" -0200010E="Išskleidžia failus į paaplankį." -0200010F="Įtraukti į {0}" -02000110="Įtraukia pasirinktus elementus į archyvą." -02000111="Suglaudinti ir išsiųsti el. paštu..." -02000112="Suglaudina pasirinktus failus į archyvą ir išsiunčia jį el. paštu." -02000113="Suglaudinti į {0} ir išsiųsti el. paštu" -02000114="Suglaudina pasirinktus failus į archyvą ir išsiunčia jį el. paštu." - -02000140="" -02000141="" - -; Properties -02000203="Kelias" -02000204="Pavadinimas" -02000205="Plėtinys" -02000206="Aplankas" -02000207="Dydis" -02000208="Dydis archyve" -02000209="Atributai" -0200020A="Sukurta" -0200020B="Naudota" -0200020C="Pakeista" -0200020D="Vientisas" -0200020E="Komentaras" -0200020F="Šifruotas" -02000210="Perskyra prieš" -02000211="Perskyra paskui" -02000212="Žodynas" -02000213="CRC" -02000214="Tipas" -02000215="Anti" -02000216="Būdas" -02000217="Kompiuterio OS" -02000218="Bylų sistema" -02000219="Vartotojas" -0200021A="Grupė" -0200021B="Blokas" -0200021C="Komentaras" -0200021D="Pozicija" -0200021E="Aplankas" -0200021F="Aplankai" -02000220="Vylos" -02000221="Versija" -02000222="Dalis" -02000223="!!Multivolume" -02000224="!!Offset" -02000225="Nuorodos" -02000226="Blokai" -02000227="Dalys" - -; Status bar -02000301="Pasirinkta {0} objektų: " -02000302="{0} objektų" - -02000320="Failai:" -02000321="Aplankai:" -02000322="Dydis:" -02000323="Dydis suglaudinus:" -02000324="Archyvai:" - -; List Context Menu -02000401="&Stulpelių..." - -02000411="&Atverti" -02000412="&Išskleisti..." - -; ToolBar -02000501="Išskleisti" - -; Messages -02000601="Šio archyvo negalima atnaujinti." -02000602="Negalima atnaujinti archyvo „{0}“" -02000603="Negalima sukurti aplanko „{0}“" -02000604="Failas nėra palaikomas archyvas." -02000605="Klaida" -02000606="Per daug elementų" -02000607="Nėra programų, kurios būtų susietos su pateikto failo plėtiniu" -02000608="Klaidų nerasta" -02000609="Negalima atverti „{0}“ failo kaip archyvo" -0200060A="Negalima atverti šifruoto archyvo „{0}“. Neteisingas slaptažodis?" - -; Dialogs -02000702="Gerai" -02000705="&Taip" -02000707="T&aip Visiems" -02000709="&Ne" -0200070B="Ne v&isiems" - -02000710="Atšaukti" -02000711="&Atšaukti" -02000713="&Uždaryti" -02000714="Sustabdyti" -02000715="Iš naujo" - -02000720="Elektroninis žinynas" - -; Extract dialog -02000800="Išskleisti" -02000801="Iš&skleisti į:" -02000802="Slaptažodis" - -02000810="Kelio režimas" -02000811="Pilni keliai" -02000812="Dabartiniai keliai" -02000813="Jokių kelių" - -02000820="Perrašymo režimas" -02000821="Paklausti prieš perrašant" -02000822="Perrašyti neįspėjant" -02000823="Praleisti esančius failus" -02000824="Automatiškai pervadinti" -02000825="Automatiškai pervadinti esančius failus" - -02000830="Failai" -02000831="Pa&sirinktus failus" -02000832="Visus f&ailus" - -02000881="Nurodyti vietą išskleidžiamiesiems failams." - -02000890="Išskleidžiama" - -; Overwrite dialog -02000900="Failų pakeitimo patvirtinimas" -02000901="Paskirtame aplanke jau yra apdorojamas failas." -02000902="Ar norėtumėte pakeisti esančią failą" -02000903="šia failu?" - -02000911="A&utomatinis pervadinimas" - -02000982="{0} baitų" -02000983="pakeista" - -; Messages dialog -02000A00="Diagnostiniai pranešimai" - -02000A80="Pranešimas" - -02000A91="Nepalaikomas suglaudinimo metodas failui „{0}“." -02000A92="Duomenų klaida „{0}“. Failas pažeistas." -02000A93="CRC klaida „{0}“. Failas pažeistas." -02000A94="Duomenų klaida šifruotame faile „{0}“. Neteisingas slaptažodis?" -02000A95="CRC neatitikimas šifruotame faile „{0}“. Neteisingas slaptažodis?" - -; Password dialog -02000B00="Slaptažodžio įvedimas" -02000B01="Įveskite slaptažodį:" -02000B02="&Rodyti slaptažodį" -02000B03="Pakartokite slaptažodį:" -02000B10="Slaptažodžiai nesutampa" -02000B11="Slaptažodžiui naudokite tik lotyniškas raides, numerius bei specialiuosius simbolius (!, #, $, ...)" -02000B12="Slaptažodis yra per ilgas" - -; Progress dialog -02000C00="Vykdymas" -02000C01="Praėjęs laikas:" -02000C02="Likęs laikas:" -02000C03="Dydis:" -02000C04="Sparta:" -02000C05="Apdorota:" -02000C06="Suglaudinimo laipsnis:" - -02000C10="&Fone" -02000C11="&Pirminis procesas" -02000C12="&Laikinai sustabdyti" -02000C13="&Tęsti" - -02000C20="Laikinai sustabdyta" - -02000C30="Ar jūs esate tikri, kad norite atšaukti?" - -; Compress dialog -02000D00="Įtraukti į archyvą" -02000D01="&Archyvas:" -02000D02="Atna&ujinimo režimas:" -02000D03="Archyvo &formatas:" -02000D04="Glaudini&mo būdas:" -02000D05="Sukurti &vientisą archyvą" -02000D06="&Parametrai:" -02000D07="Nustatymai" -02000D08="Iš&sipakuojantis archyvas" -02000D09="Daugiagijiškumas" -02000D0A="Už&šifruoti failų pavadinimus" -02000D0B="Suglaudinimo &lygis:" -02000D0C="Žo&dyno dydis:" -02000D0D="Ž&odžio dydis:" -02000D0E="Atmintinės naudojimas suglaudinimui:" -02000D0F="Atmintinės naudojimas išskleidimui:" -02000D10="Šifravimas" -02000D11="Šifravimo metodas:" -02000D12="CPU gijų skaičius:" -02000D13="Vientiso bloko dydis:" -02000D14="Ne vientisas" -02000D15="Vientisas archyvas" -02000D16="Glaudinti dalijamus failus" - -02000D40="Skaidyti į dalis bai&tais:" -02000D41="Neteisingas dalies dydis" -02000D42="Nurodytas dalies dydis: {0} baitai.\nAr jūs esate įsitikinę, jog norite archyvą skaidyti į tokias dalis?" - -02000D81="Mažiausias" -02000D82="Normalus" -02000D83="Didžiausias" -02000D84="Greitas" -02000D85="Greitesnis" -02000D86="Smarkiausias" - -02000D90="Naršyti" - -02000DA1="Įtraukti ir pakeisti failus" -02000DA2="Atnaujinti ir įtraukti failus" -02000DA3="Atnaujinti esančius failus" -02000DA4="Sinchronizuoti failus" - -02000DB1="Visus failus" - -02000DC0="Glaudinama" - -; Columns dialog -02000E00="Stulpeliai" -02000E01="Pasirinkite stulpelius, kuriuos norėtumėte matyti aplanke. Naudokite mygtukus Aukštyn ir Žemyn keisdami stulpelių tvarką." -02000E02="Pasirinktas stulpelis turėtų būti" -02000E03="taškų &pločio." - -02000E10="&Aukštyn" -02000E11="Žemyn(&Z)" -02000E12="&Rodyti" -02000E13="&Slėpti" -02000E14="Nustatyti" - -02000E81="Antraštė" -02000E82="Plotis" - -; Testing -02000F90="tikrinama" - - -; File Manager - -03000000="7-Zip failų tvarkyklė" - -; Menu -03000102="&Failas" -03000103="K&eisti" -03000104="&Rodyti" -03000105="Įran&kiai" -03000106="&Elektroninis žinynas" -03000107="Mėgi&amiausi" - -; Failas -03000210="&Atverti" -03000211="Atverti v&iduje" -03000212="Atverti iš&orėje" -03000220="&Rodyti" -03000221="K&eisti" -03000230="Pervadi&nti" -03000231="&Kopijuoti į..." -03000232="&Perkelti į..." -03000233="Šalin&ti" -03000240="Savy&bės" -03000241="Kome&ntuoti" -03000242="Skaičiuoti kontrolinę sumą" -03000250="Sukurti aplanką" -03000251="Sukurti failą" -03000260="Išei&ti" -03000270="&Skaidyti failą..." -03000271="Jungti &failus..." - -; Edit -03000310="Atša&ukti" -03000311="Paka&rtoti" -03000320="Iškirp&ti" -03000321="&Kopijuoti" -03000322="Į&dėti" -03000323="Išt&rinti" -03000330="Pažymėti &viską" -03000331="Nužymėti viską" -03000332="Atv&irkštinis žymėjimas" -03000333="Pasirikti..." -03000334="Atžymėti..." -03000335="Pasirinkti pagal tipą" -03000336="Atžymėti pagal tipą" - -; View -03000410="Did&elės piktogramos" -03000411="&Mažos piktogramos" -03000412="&Sąrašas" -03000413="&Išsamiai" -03000420="Nerūšiuotos" -03000430="Atverti pagrindinį aplanką" -03000431="Lygiu aukščiau" -03000432="Aplankų istorija..." -03000440="&Atnaujinti" -03000449="Nepaisyti aplankų" -03000450="&2 skydeliai" -03000451="&Parankinės" -03000460="Archyvo parankinė" -03000461="Standartinė parankinė" -03000462="Dideli mygtukai" -03000463="Rodyti mygtukų tekstą" - -; Tools -03000510="&Nuostatos..." -03000511="&Spartos bandymas" - -; Help -03000610="&Turinys..." -03000620="&Apie 7-Zip..." - -; Favorites -03000710="&Pridėti katalogą prie mėgiamiausiųjų kaip" -03000720="Mėgiamiausias" - -; Options Dialog - -03010000="Nustatymai" - -; Plugins -03010100="Įskiepiai" -03010101="Įskie&piai:" -03010110="Nuostatos..." - -; Edit -03010200="Redaktorius" -03010201="R&edaktorius:" - -; System -03010300="Sistema" -03010302="Susieti 7-Zip su:" -03010310="Įskiepis" - -; Settings -03010400="Nustatos" -03010401="Rodyti „..“ failų sąraše" -03010402="Rodyti tikras failų piktogramas" -03010410="Rodyti sisteminį meniu" -03010420="&Žymėti visą eilutę" -03010421="Rodyti tinklelio linija&s" -03010430="&Kitoks žymėjimo būdas" -03010440="Naudoti didžiu&lius atmintinės puslapius" - -; Strings - -03020201="Kopijuoti" -03020202="Perkelti" -03020203="Kopijuoti į:" -03020204="Perkelti į:" -03020205="kopijuojama..." -03020206="perkeliama..." -03020207="Jūs negalite perkelti arba kopijuoti elementų šiuose aplankuose." -03020208="Veiksmas nepalaikomas." -03020209="Pasirinkite paskirties aplanką." - -03020210="Patvirtinkite failo šalinimą" -03020211="Patvirtinkite aplanko šalinimą" -03020212="Patvirtinkite kelių failų šalinimą" -03020213="Ar esate įsitikinę, jog norite pašalinti „{0}“?" -03020214="Ar esate įsitikinę, jog norite pašalinti „{0}“ aplanką ir visą jo turinį?" -03020215="Ar esate įsitikinę, jog norite pašalinti šiuos {0} elementus?" -03020216="šalinama..." -03020217="Klaida trinant failą ar aplanką" - -03020220="pervadinama..." -03020221="Klaida pervadinant failą ar aplanką" -03020222="Failų kopijavimo patvirtinimas" -03020223="Ar jūs esate įsitikinę, jog norite kopijuoti failus į archyvą?" - -03020230="Sukurti aplanką" -03020231="Aplanko pavadinimas:" -03020232="Naujas aplankas" -03020233="Klaida kuriant aplanką" - -03020240="Sukurti failą" -03020241="Failo pavadinimas:" -03020242="Naujas failas" -03020243="Klaida kuriant failą" - -03020250="Pasirinkti" -03020251="Nesirinkti" -03020252="Šablonas:" - -03020260="Aplankų istorija" - -03020280="Failas „{0}“ buvo pakeistas.\nAr norite ją atnaujinti archyve?" -03020281="Negalima atnaujinti failo\n„{0}“" -03020282="Negalima paleisti redaktoriaus." -03020283="Atidaroma..." - -03020290="Komentaras" -03020291="&Komentaras:" - -030202A0="Sistema" - -03020300="Kompiuteris" -03020301="Tinklas" - -03020400="Glaudinti" -03020401="Išskleisti" -03020402="Bandyti" - -03020420="Kopijuoti" -03020421="Perkelti" -03020422="Šalinti" -03020423="Informacija" - -03020500="Skaidyti failą" -03020501="&Skaidyti į:" -03020510="skaidoma..." -03020520="Skaidymo patvirtinimas" -03020521="Ar jūs esate įsitikinę, jog norite failą skaidyti į {0} dalis?" -03020522="Dalies dydis privalo būti mažesnis už dalijamo failo dydį" - -03020600="Sujungti failus" -03020601="&Sujungti į:" -03020610="sujungiami failai..." -03020620="Pažymėkite tik pirmą failą" - -03020710="kontrolinės sumos skaičiavimas..." -03020720="Kontrolinės sumos informacija" -03020721="Duomenų CRC kontrolinė suma:" -03020722="Duomenų ir failų pavadinimų CRC kontrolinė suma:" - -03020800="skenuojama..." - -03020900="Nuostatos" - -; Computer -03031100="Visas dydis" -03031101="Laisva vieta" -03031102="Blokinio dydis" -03031103="Pavadinimas" - -; Network -03031200="Vietinis pavadinimas" -03031201="Tiekėjas" - -; Benchmark Dialog - -03080000="Spartos bandymas" -03080001="Atmintinės naudojimas:" -03080002="Suglaudinama" -03080003="Išskleidžiama" -03080004="Sparta" -03080005="Vertinimas" -03080006="Galutinis vertinimas" -03080007="Dabartinis" -03080008="Vidutinis" -03080009="Kartai:" -0308000A="Klaidos:" -0308000B="CPU naudojimas" -0308000C="Reitingas / naudojimas" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/lv.txt b/tools/7-Zip/Lang/lv.txt deleted file mode 100644 index 7fda96ceae..0000000000 --- a/tools/7-Zip/Lang/lv.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.10 beta -; Translated by Armands Radzuška -; -; -; -; - -00000000="Latvian" -00000001="Latviešu" -00000002="38" - -; 7-Zip Configuration - -; Title -01000000="7-Zip konfigurācija" - -; Info Page -01000100="Par 7-Zip" -01000103="7-Zip ir bezmaksas programma, tomēr, reģistrējoties jūs varat 7-Zip izstrādāšanu atbalstīt." -01000105="&Reģistrēties" - -; Folders Page -01000200="Mapes" -01000210="&Darba mape" -01000211="&Sistēmas pagaidfailu mape" -01000212="&Tekošā" -01000213="&Noteikt:" -01000214="&Izmantot tikai maināmajiem nesējiem" - -01000281="Norādiet vietu arhīvu pagaidfailiem." - -; System Page -01000300="Sistēma" -01000301="&Integrēt 7-Zip Windows vides kontekstizvēlē" -01000302="&Kaskādveida kontekstizvēle" -01000310="Kontekstizvēles elementi:" - -; Language Page -01000400="Valoda" -01000401="Valoda:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip komandas" -02000103="Atvērt arhīvu" -02000104="Atver izvēlēto arhīvu." -02000105="Izvilkt failus..." -02000106="Izvelk failus no izvēlētā arhīva." -02000107="Ielikt arhīvā..." -02000108="Pievieno izvēlētās vienības arhīvam." -02000109="Pārbaudīt arhīvu" -0200010A="Pārbauda izvēlētā arhīva veselumu." -0200010B="Izvilkt šeit" -0200010C="Failus no izvēlētā arhīva izvelk patreizējā mapē." -0200010D="Izvilkt {0} mapē" -0200010E="Izvelk failus apakšmapē." -0200010F="Ielikt {0}" -02000110="Ieliek izvēlētos elementus arhīvā." -02000111="Saspiest, sūtīt pa e-pastu..." -02000112="Ieliek izvēlētās vienības arhīvā un sūta arhīvu pa e-pastu." -02000113="Saspiest {0}, sūtīt pa e-pastu" -02000114=" Ieliek izvēlētās vienības arhīvā un sūta arhīvu pa e-pastu." - -02000140="" -02000141="" - -; Properties -02000203="Ceļš" -02000204="Nosaukums" -02000205="Paplašinājums" -02000206="Mape" -02000207="Lielums" -02000208="Saspiests" -02000209="Atribūti" -0200020A="Izveidots" -0200020B="Atvērts" -0200020C="Pārveidots" -0200020D="Blīvs" -0200020E="Piezīmes" -0200020F="Šifrēts" -02000210="Dalīts pirms" -02000211="Dalīts pēc" -02000212="Vārdnīca" -02000213="CRC" -02000214="Veids" -02000215="Anti" -02000216="Paņēmiens" -02000217="Sistēma" -02000218="Failu sistēma" -02000219="Lietotājs" -0200021A="Grupa" -0200021B="Bloks" -0200021C="Piezīmes" -0200021D="Pozīcija" - -; Status bar -02000301="Iezīmēts(i) {0} objekts(i)" -02000302="{0} objekts(i)" - -; List Context Menu -02000401="&Stabiņi..." - -02000411="&Atvērt" -02000412="&Izvilkt..." - -; ToolBar -02000501="Izvilkšana" - -; Messages -02000601="Šis arhīvs neatbalsta pārveidošanu." -02000602="Arhīvu {0} neizdevās pārveidot." -02000603="Mapi '{0}' neizdevās izveidot." -02000604="Fails nav atbalstīts arhīvs." -02000605="Kļūda" -02000606="Par daudz vienību." -02000607="Ar doto faila paplašinājumu neviena programma nav saistīta." -02000608="Kļūdu nav." - -; Dialogs -02000702="&Labi" -02000705="&Jā" -02000707="Jā &visiem" -02000709="&Nē" -0200070B="Nē v&isiem" - -02000710="&Atcelt" -02000711="&Atcelt" -02000713="Aiz&vērt" -02000714="Stop" -02000715="Pārstartēt" - -02000720="&Rokasgrāmata" - -; Extract dialog -02000800="Izvilkšana" -02000801="&Izvilkt uz:" -02000802="&Parole" - -02000810="Ceļi" -02000811="Pilni &ceļu nosaukumi" -02000812="Patreizējie ceļu &nosaukumi" -02000813="&Bez ceļu nosaukumiem" - -02000820="Pārrakstīšana" -02000821="&Jautāt pirms pārrakstīšanas" -02000822="Pārra&kstīt bez jautāšanas" -02000823="I&zlaist esošos failus" -02000824="A&utopārdēvēšana" -02000825="Automātiski pārdēvēt esošos failu" - -02000830="Faili" -02000831="&Iezīmētie faili" -02000832="&Visi faili" - -02000881="Norādiet vietu izvelkamiem failiem." - -02000890="Izvilkšana" - -; Overwrite dialog -02000900="Apstipriniet faila aizvietošanu" -02000901="Mērķa mape jau satur apstrādājamo failu." -02000902="Vai vēlaties aizvietot esošo failu" -02000903="ar šo?" - -02000911="Autopārdēvēšana" - -02000982="{0} baiti" -02000983="pārveidots" - -; Messages dialog -02000A00="Diagnostikas paziņojumi" - -02000A80="Paziņojums" - -02000A91="Neatbalstīts saspiešanas paņēmiens '{0}' failam." -02000A92="Datu kļūda '{0}'. Fails ir bojāts." -02000A93="CRC kļūda '{0}'. Fails ir bojāts." - -; Password dialog -02000B00="Paroles ievadīšana" -02000B01="Ievadiet paroli:" -02000B02="Par&ole redzama" - -; Progress dialog -02000C00="Process" -02000C01="Pagājušais laiks:" -02000C02="Atlikušais laiks:" -02000C03="Lielums:" -02000C04="Ātrums:" - -02000C10="&Fonā" -02000C11="&Priekšplānā" -02000C12="Pa&uze" -02000C13="&Turpināt" - -02000C20="Pauzēts" - -02000C30="Vai piekrītat pārtraukt šo darbību?" - -; Compress dialog -02000D00="Pievienošana arhīvam" -02000D01="Ar&hīvs:" -02000D02="Pār&veidošanas režīms:" -02000D03="Arhīva &formāts:" -02000D04="&Saspiešanas paņēmiens:" -02000D05="Izveidot &blīvo arhīvu" -02000D06="Parame&tri:" -02000D07="&Uzstādījumi" -02000D08="Izveidot SF&X arhīvu" -02000D09="&Multiplūsmas" -02000D0A="Šifrēt failu &nosaukumus" -02000D0B="&Saspiešanas līmenis:" -02000D0C="&Vārdnīcas lielums:" -02000D0D="Vār&da lielums:" -02000D0E="Atmiņa arhivēšanai:" -02000D0F="Atmiņa atarhivēšanai:" - -02000D40="&Dalīt sējumos, baitos:" - -02000D81="Uzkrāšana nesaspiežot" -02000D82="Parastais" -02000D83="Maksimālā saspiešana" -02000D84="Ātrais" -02000D85="Ātrākais" -02000D86="Ultra" - -02000D90="Pārlūkošana" - -02000DA1="Pievienot un aizvietot failus" -02000DA2="Atjaunināt un pievienot failus" -02000DA3="Atjaunināt esošos failus" -02000DA4="Sinhronizēt failus" - -02000DB1="Visi faili" - -02000DC0="saspiešana" - -; Columns dialog -02000E00="Stabiņi" -02000E01="Atzīmējiet stabiņus, ko Jūs vēlaties redzēt šai skatā. Izmantojiet pogas „Uz augšu” un „Uz leju” stabiņu pārkārtošanai pēc savas gaumes." -02000E02="Iezīmētajiem stabiņiem jābūt" -02000E03="pikseļus &platiem." - -02000E10="Uz a&ugšu" -02000E11="Uz &leju" -02000E12="Pa&rādīt" -02000E13="Pa&slēpt" -02000E14="Uzstādīt" - -000E81="Nosaukums" -02000E82="Platums" - -; Testing -02000F90="Pārbaude" - - -; File Manager - -03000000="7-Zip failu pārzinis" - -; Menu -03000102="&Fails" -03000103="&Labošana" -03000104="&Izskats" -03000105="&Rīki" -03000106="&Palīdzība" -03000107="Ie&cienītās" - -; File -03000210="&Atvērt" -03000211="Atvērt &iekšpusē" -03000212="Atvērt ārp&usē" -03000220="Ap&skate" -03000221="&Labot" -03000230="Pā&rdēvēt" -03000231="&Kopēt uz..." -03000232="Pār&vietot uz..." -03000233="&Dzēst" -03000240="Īpašī&bas" -03000241="&Piezīmes" -03000250="Izveidot &mapi" -03000251="Izveidot &failu" -03000260="&Beigt" -03000270="&Sadalīt failu..." -03000271="Ap&vienot failus..." - -; Edit -03000310="&Atcelt" -03000311="At&jaunot" -03000320="&Izgriezt" -03000321="&Kopēt" -03000322="Ieviet&ot" -03000323="&Dzēst" -03000330="Iezīmēt &visu" -03000331="Atcelt vis&u" -03000332="I&nvertēt iezīmējumu" -03000333="Ie&zīmēt..." -03000334="&Atcelt..." -03000335="I&ezīmēt pēc tipa" -03000336="A&tcelt pēc tipa" - -; View -03000410="&Lielas ikonas" -03000411="&Mazas ikonas" -03000412="&Saraksts" -03000413="Sī&kāk" -03000420="&Nešķirot" -03000430="&Atvērt saknes mapi" -03000431="Līmeni &uz augšu" -03000432="Mapju &vēsture..." -03000440="&Pārlasīt" -03000450="&2 paneļi" -03000451="&Rīku joslas" -03000460="Arhīva rīku josla" -03000461="Standarta rīku josla" -03000462="Lielas pogas" -03000463="Parādīt pogu tekstu" - -; Tools -03000510="&Uzstādījumi..." -03000511="&Darbspējas pārbaude" - -; Help -03000610="&Rokasgrāmatas saturs..." -03000620="&Par 7-Zip..." - -; Favorites -03000710="&Pievienot mapi iecienītajām kā" -03000720="Iecienītās" - -; Options Dialog - -03010000="Uzstādījumi" - -; Plugins -03010100="Iespraudņi" -03010101="Iespraudņi:" -03010110="&Uzstādījumi..." - -; Edit -03010200="Labošana" -03010201="&Labošanas programma:" - -; System -03010300="Sistēma" -03010302="Piesaistīt 7-Zip pie:" -03010310="Iespraudnis" - -; Settings -03010400="Uzstādījumi" -03010401="Parādīt \"..\" &vienību" -03010402="Parādīt īstās &failu ikonas" -03010410="Parādīt &sistēmas izvēli" -03010420="&Pilnas rindas iezīmēšana" -03010421="Parādīt at&dalošās līnijas" - -; Strings - -03020201="Kopēt" -03020202="Pārvietot" -03020203="Kopēt uz:" -03020204="Pārvietot uz:" -03020205="Kopēšana..." -03020206="Pārvietošana..." -03020207="Vienības uz šīm mapēm nevar kopēt vai pārvietot." -03020208="Darbība nav atbalstīta." - -03020210="Faila dzēšanas apstiprinājums" -03020211="Mapes dzēšanas apstiprinājums" -03020212="Vairāku failu dzēšanas apstiprinājums" -03020213="Vai piekrītat '{0}' dzēšanai?" -03020214="Vai piekrītat mapes '{0}' un visa tās satura dzēšanai?" -03020215="Vai piekrītat šo {0} vienību dzēšanai?" -03020216="Dzēšana..." -03020217="Faila vai mapes dzēšanas kļūda" - -03020220="Pārdēvēšana..." -03020221="Faila vai mapes pārdēvēšanas kļūda" - -03020230="Mapes izveidošana" -03020231="Mapes nosaukums:" -03020232="Jauna mape" -03020233="Mapes izveidošanas kļūda" - -03020240="Faila izveidošana" -03020241="Faila nosaukums:" -03020242="Jauns fails" -03020243="Faila izveidošanas kļūda" - -03020250="Iezīmēšana" -03020251="Iezīmējuma atcelšana" -03020252="Šablons:" - -03020260="Mapju vēsture" - -03020280="Fails '{0}' ir pārveidots.\nVai vēlaties to atjaunināt arī arhīvā?" -03020281="Failu nav iespējams uzlabot\n'{0}'" -03020282="Nav iespējams palaist labošanas programmu." -03020283="Atvēršana..." - -03020290="Piezīmes" -03020291="&Piezīmes:" - -030202A0="Sistēma" - -03020300="Dators" -03020301="Tīkls" - -03020400="Ievietot" -03020401="Izvilkt" -03020402="Pārbaude" - -03020420="Kopēt" -03020421="Ppārvietot" -03020422="Dzēst" -03020423="Info" - -03020500="Sadalīt failu" -03020501="&Dalīt uz:" -03020510="Dalīšana..." - -03020600="Apvienot failus" -03020601="&Apvienot uz:" -03020610="Apvienošana..." - -; Computer -03031100="Tilpums" -03031101="Brīvā vieta" -03031102="Klāstera lielums" -03031103="Nosaukums" - -; Network -03031200="Lokālais nosaukums" -03031201="Provaiders" - -; Benchmark Dialog - -03080000="Darpspējības pārbaude" -03080001="Atmiņas pielietojums:" -03080002="Arhivēšana" -03080003="Atarhivēšana" -03080004="Ātrums" -03080005="Vērtējums" -03080006="Kopējais vērtējums" -03080007="Patreizējais" -03080008="Rezultējošais" -03080009="Izdošanās:" -0308000A="Kļūdas:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/mk.txt b/tools/7-Zip/Lang/mk.txt deleted file mode 100644 index c4d0710d9a..0000000000 --- a/tools/7-Zip/Lang/mk.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.09 beta -; Translated by Gabriel Stojanoski -; Преведено од Габриел Стојаноски -; -; -; - -00000000="Macedonian" -00000001="Македонски" -00000002="47" - -; 7-Zip Подесување - -; Title -01000000="7-Zip Подесување" - -; Info Page -01000100="За 7-Zip" -01000103="7-Zip е бесплатен архивер. Меѓутоа, вие можете да дадете поддршка на понатамошното развивање на 7-Zip со вашето регистрирање." -01000105="Регистрирај" - -; Folders Page -01000200="Директориуми" -01000210="&Работен директориум" -01000211="&Системски привремен директориум" -01000212="&Моментален" -01000213="&Одреди:" -01000214="Само за преносни уреди" - -01000281="Одреди локација за привремените архивски датотеки." - -; System Page -01000300="Систем" -01000301="Интегрирај го 7-Zip во додатно мени" -01000302="Каскадно додатно мени" -01000310="Во додатното мени:" - -; Language Page -01000400="Јазик" -01000401="Јазик:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip команди" -02000103="Отвори архива" -02000104="Ја отвора селектираната архива." -02000105="Отпакувај датотеки..." -02000106="Отпакува датотеки од селектираната архива." -02000107="Додади во Архива..." -02000108="Ги додава селектираните датотеки во архива." -02000109="Тестирај архива" -0200010A="Ја тестира селектираната архива." -0200010B="Отпакувај овде" -0200010C="Отпакува датотеки од избраната архива во моменталниот директориум." -0200010D="Отпакувај во {0}" -0200010E="Отпакува датотеки во поддиректориум." -0200010F="Додади во {0}" -02000110="Ги додава одредените датотеки во архива." -02000111="Компресирај и прати на e-mail..." -02000112="Ги компресира датотеките во архива и архивата ја испраќа преку e-mail." -02000113="Компресирај во {0} и испрати" -02000114="Ги компресира датотеките во архива и архивата ја испраќа преку e-mail." - -02000140="<Директориум>" -02000141="<Архива>" - -; Properties -02000203="Патека" -02000204="Име" -02000205="Екстензија" -02000206="Директориум" -02000207="Големина" -02000208="Пакувана Големина" -02000209="Атрибути" -0200020A="Креирано" -0200020B="Пристапено" -0200020C="Променето" -0200020D="Целосна" -0200020E="Објаснета" -0200020F="Енкриптирана" -02000210="Подели Пред" -02000211="Подели После" -02000212="Речник" -02000213="CRC" -02000214="Тип" -02000215="Анти" -02000216="Метод" -02000217="Оперативен Систем" -02000218="Датотечен Систем" -02000219="Корисник" -0200021A="Група" -0200021B="Блок" -0200021C="Коментар" -0200021D="Позиција" - -; Status bar -02000301="{0} објект(и) избрано" -02000302="{0} објект(и)" - -; List Context Menu -02000401="&Колони..." - -02000411="&Отвори" -02000412="От&пакувај..." - -; ToolBar -02000501="Отпакувај" - -; Messages -02000601="Оваа операција не е поддржана за овој тип на архива." -02000602="Не е можно обновување на архивата {0}" -02000603="Не е можно креирање на директориумот '{0}'" -02000604="Датотеката не е поддржана архива." -02000605="Грешка" -02000606="Премногу објекти" -02000607="Нема програма придружена со оваа екстензија" -02000608="Нема грешки" - -; Dialogs -02000702="Ок" -02000705="&Да" -02000707="Да &Сите" -02000709="&Не" -0200070B="Не Н&иедна" - -02000710="Откажи" -02000711="&Откажи" -02000713="&Затвори" -02000714="Стоп" -02000715="Рестартирај" - -02000720="Помош" - -; Extract dialog -02000800="Отпакувај" -02000801="Отпакувај &во:" -02000802="Лозинка" - -02000810="Патеки" -02000811="Целосна патека" -02000812="Моментална патека" -02000813="Без патека" - -02000820="Презапишување" -02000821="Прашај пред да презапишеш" -02000822="Презапиши без прашување" -02000823="Изостави постоечки датотеки" -02000824="Автоматски преименувај" -02000825="Автоматски преименувај постоечки датотеки" - -02000830="Датотеки" -02000831="&Избрани датотеки" -02000832="&Сите датотеки" - -02000881="Одреди локација за отпакуваните датотеки." - -02000890="Отпакување" - -; Overwrite dialog -02000900="Потврди Замена на Датотеки" -02000901="Конечниот директориум веќе ја содржи датотеката." -02000902="Дали сакате да ја замените постоечката датотека" -02000903="со оваа?" - -02000911="&Автоматски преименувај" - -02000982="{0} бајти" -02000983="променета на" - -; Messages dialog -02000A00="Дијагноза" - -02000A80="Порака" - -02000A91="Неподдржан метод за компресија за '{0}'." -02000A92="Грешка во податоците во '{0}'. Датотеката е оштетена." -02000A93="CRC грешка во '{0}'. Датотеката е оштетена." - -; Password dialog -02000B00="Внеси лозинка" -02000B01="Внеси лозинка:" -02000B02="&Прикажи ја лозинката" - -; Progress dialog -02000C00="Процесирај" -02000C01="Поминато време:" -02000C02="Преостанато време:" -02000C03="Големина:" -02000C04="Брзина:" - -02000C10="По&задина" -02000C11="&Напред" -02000C12="&Пауза" -02000C13="П&родолжи" - -02000C20="Паузирано" - -02000C30="Дали сигурно сакате да откажете?" - -; Compress dialog -02000D00="Додади во архива" -02000D01="&Архива:" -02000D02="&Додавање:" -02000D03="&Формат на Архива:" -02000D04="&Метод на компресија:" -02000D05="Креирај &Целосна архива" -02000D06="&Параметри:" -02000D07="Опции" -02000D08="Креирај SFX ар&хива" -02000D09="Multi-threading" -02000D0A="&Енкриптирај ги имињата" -02000D0B="&Ниво на компресија:" -02000D0C="Големина на &речникот:" -02000D0D="Големина на &зборот:" -02000D0E="Искорист мемор за компрес:" -02000D0F="Искорист мемор за декомпрес:" - -02000D40="&Подели на делови, бајти:" - -02000D81="Спакувај" -02000D82="Нормално" -02000D83="Максимално" -02000D84="Брзо" -02000D85="Најбрзо" -02000D86="Ултра" - -02000D90="Барај" - -02000DA1="Додади и замени датотеки" -02000DA2="Обнови и додади датотеки" -02000DA3="Обнови ги постоечките датотеки" -02000DA4="Синхронизирај ги датотеките" - -02000DB1="Сите Датотеки" - -02000DC0="Компресирање" - -; Columns dialog -02000E00="Колони" -02000E01="Селектирај ги колоните што сакаш да бидат видливи во овој директориум. Употреби ги Нагоре и Надолу копчињата за да ги преуредиш колоните." -02000E02="Избраната колона треба да биде" -02000E03="пиксели &широка." - -02000E10="На&горе" -02000E11="На&долу" -02000E12="&Прикажи" -02000E13="&Сокриј" -02000E14="Стави" - -02000E81="Име" -02000E82="Ширина" - -; Testing -02000F90="Тестирање" - - -; File Manager - -03000000="7-Zip Менаџер" - -; Menu -03000102="&Датотека" -03000103="&Уреди" -03000104="&Изглед" -03000105="&Алатки" -03000106="&Помош" -03000107="&Омилени" - -; File -03000210="&Отвори" -03000211="Отвори &Внатре" -03000212="Отвори &Надвор" -03000220="&Поглед" -03000221="&Уреди" -03000230="&Преименувај" -03000231="&Копирај Во..." -03000232="&Премести Во..." -03000233="&Избриши" -03000240="&Карактеристики" -03000241="К&оментар" -03000250="Креирај Директориум" -03000251="Креирај Датотека" -03000260="&Излези" -03000270="&Подели датотека..." -03000271="Ком&бинирај датотеки..." - -; Edit -03000310="&Undo" -03000311="&Redo" -03000320="Пре&сечи" -03000321="&Копирај" -03000322="&Залепи" -03000323="&Избриши" -03000330="Селектирај &Се" -03000331="Деселектирај Се" -03000332="&Обратна Селекција" -03000333="Селектирај..." -03000334="Деселектирај..." -03000335="Селектирај по Тип" -03000336="Деселектирај по Тип" - -; View -03000410="&Големи Икони" -03000411="&Мали Икони" -03000412="&Листа" -03000413="&Детали" -03000420="Неподредени" -03000430="Отвори го основниот директориум" -03000431="Едно Ниво Нагоре" -03000432="Историја на Директориумите..." -03000440="&Обнови" -03000450="&2 Панели" -03000451="&Алатници" -03000460="Алатница на Архивата" -03000461="Стандардна Алатница" -03000462="Големи Копчиња" -03000463="Текст На Копчињата" - -; Tools -03000510="&Опции..." -03000511="&Тест" - -; Help -03000610="&Содржина..." -03000620="&За 7-Zip..." - -; Favorites -03000710="&Додади го директориумот во Омилени" -03000720="Забелешки" - -; Options Dialog - -03010000="Опции" - -; Plugins -03010100="Плагини" -03010101="&Плагини:" -03010110="Опции..." - -; Edit -03010200="Едитор" -03010201="&Едитор:" - -; System -03010300="Систем" -03010302="Придружи го 7-Zip со:" -03010310="Плагин" - -; Settings -03010400="Подесувања" -03010401="Прикажи \"..\" предмет" -03010402="Прикажи вистински икони" -03010410="Прикажи системско мени" -03010420="&Селектирај &цел ред" -03010421="Прикажи &мрежа" - -; Strings - -03020201="Копирај" -03020202="Премести" -03020203="Копирај Во:" -03020204="Премести Во:" -03020205="Копирање..." -03020206="Преместување..." -03020207="Не е можно преместување или копирање на предмети од вакви директориуми." -03020208="Постапката не е поддржана." - -03020210="Потврдете го Бришењето на Датотеката" -03020211="Потврдете го Бришењето на Директориумот" -03020212="Потврдете го бришењето на повеќе датотеки" -03020213="Дали сте сигурни за бришењето на '{0}'?" -03020214="Дали сте сигурни за бришењето на директориумот '{0}' и неговата содржина?" -03020215="Дали сте сигурни за бришењето на овие {0} датотеки?" -03020216="Бришење..." -03020217="Грешка при бришењето на Датотеката или Директориумот" - -03020220="Преименување..." -03020221="Грешка при преименувањето на Датотеката или Директориумот" - -03020230="Креирај Директориум" -03020231="Име на Директориумот:" -03020232="Нов Директориум" -03020233="Грешка при креирањето на Директориумот" - -03020240="Креирај датотека" -03020241="Име на Датотеката:" -03020242="Нова датотека" -03020243="Грешка при креирањето на датотеката" - -03020250="Селектирај" -03020251="Деселектитај" -03020252="Маскирај:" - -03020260="Историја на Директориумите" - -03020280="Датотеката '{0}' е модифицирана.\nДали сакате да ја обновите во архивата?" -03020281="Не е можно обновување на датотеката\n'{0}'" -03020282="Грешка при стартување на Едиторот." -03020283="Отворање..." - -03020290="Коментар" -03020291="&Коментар:" - -030202A0="Систем" - -03020300="Компјутер" -03020301="Мрежа" - -03020400="Додади" -03020401="Отпакувај" -03020402="Тестирај" - -03020420="Копирај" -03020421="Премести" -03020422="Избриши" -03020423="Инфо" - -03020500="Подели датотека" -03020501="&Подели на:" -03020510="Делење..." - -03020600="Состави Датотеки" -03020601="&Состави на:" -03020610="Составување..." - -; Computer -03031100="Вкупна Големина" -03031101="Слободен Простор" -03031102="Голем на Кластерите" -03031103="Етикета" - -; Network -03031200="Име" -03031201="Провајдер" - -; Benchmark Dialog - -03080000="Тест" -03080001="Искорист Меморија:" -03080002="Компресирање" -03080003="Декомпресирање" -03080004="Брзина" -03080005="Проценка" -03080006="Вкупна Проценка" -03080007="Моментално" -03080008="Резултат" -03080009="Поминато:" -0308000A="Грешки:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/mn.txt b/tools/7-Zip/Lang/mn.txt deleted file mode 100644 index b59ae41ba2..0000000000 --- a/tools/7-Zip/Lang/mn.txt +++ /dev/null @@ -1,459 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.12 -; Translated by Bayar -; Update and Spelling corrected Bayarsaikhan -; -; -; - -00000000="Mongolian" -00000001="Монгол хэл" -00000002="80" - -; 7-Zip Configuration - -; Title -01000000="7-Zip тохируулга" - -; Info Page -01000100="7-Zip-ийн тухай" -01000103="7-Zip бол үнэгүй програм. Гэлээ ч та 7-Зип-д бүртгүүлэн хөгжүүлэгчдийг дэмжиж болно. Бүртгүүлсэн хэрэглэгчид техникийн дэмжлэг авах болно." -01000104="Дэмжлэг" -01000105="Бүртгүүлэх" - -; Folders Page -01000200="Хавтсууд" -01000210="&Ажлын хавтас" -01000211="&Систем\завсрын хавтас" -01000212="&Одоогийн" -01000213="&Тодорхойлсон:" -01000214="Зөвхөн зөөврийн төхөөрөмж хэрэглэх" - -01000281="Завсрын архив файл үүсгэх байрлалыг тодорхойл." - -; System Page -01000300="Систем" -01000301="7-Зип-ийг шелл контекст цэстэй нийлүүлэх" -01000302="Контекст цэсийг цувуулан харуул" -01000310="Контекст цэсийн төрлүүд:" - -; Language Page -01000400="Хэл" -01000401="Хэл:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Зип" -02000102="7-Зип тушаалууд" -02000103="Архив нээх" -02000104="Сонгосон архив нээх." -02000105="Файлуудыг задал..." -02000106="Сонгосон архиваас файлыг задал." -02000107="Архивт нэм..." -02000108="Сонгосон зүйлүүдээ архивт нэм." -02000109="Архивийн шалгалт" -0200010A="Сонгогдсон архивийн бүтэн байдлыг шалгах." -0200010B="Энд задал" -0200010C="Сонгогдсон архиваас одооны хавтаст файлыг задал." -0200010D="{0} руу задал" -0200010E="Ерөнхий хавтаст файлыг задлах." -0200010F="{0} рүү нэм" -02000110="Сонгосон зүйлүүдээ архивт нэм." -02000111="Шахах ба Шуудандах..." -02000112="Сонгогдсон зүйлүүдийг шахаад Шуудангаар илгээх" -02000113="{0} рүү шахах ба Шууданд" -02000114="Сонгогдсон зүйлүүдийг шахаад архивийг Шуудангаар илгээх" - -02000140="<Хавтас>" -02000141="" - -; Properties -02000203="Зам" -02000204="Нэр" -02000205="Өргөтгөл" -02000206="Хавтас" -02000207="Хэмжээ" -02000208="Багцалсан хэмжээ" -02000209="Чанар" -0200020A="Үүсгэсэн" -0200020B="Хандсан" -0200020C="Өөрчилсөн" -0200020D="Баталгаатай" -0200020E="Тайлбар хийгдсэн" -0200020F="Нууцлагдсан" -02000210="Өмнө хуваасан" -02000211="Дараа хуваасан" -02000212="Толь бичиг" -02000213="CRC" -02000214="Төрөл" -02000215="Эсрэг" -02000216="Арга" -02000217="Хост ҮС" -02000218="Файл систем" -02000219="Хэрэглэгч" -0200021A="Бүлэг" -0200021B="Түгжих" -0200021C="Тайлбар" -0200021D="Байрлал" - -; Status bar -02000301="{0} зүйл(үүд) сонгогдсон байна" -02000302="{0} зүйл(үүд)" - -; List Context Menu -02000401="&Баганууд..." - -02000411="&Нээх" -02000412="&Задлах..." - -; ToolBar -02000501="Задлах" - -; Messages -02000601="Дэмжигдээгүй архивийг задлах шинэчлэлт хийх." -02000602="Архив шинэчилж чадсангүй {0}" -02000603="Хавтас үүсгэж чадахгүй '{0}'" -02000604="Дэмжигдээгүй файлын архив байна." -02000605="Алдаа" -02000606="Дэндүү их юм байна" -02000607="Файлын нэрийн өргөтгөлтөй холдбогдсон програм байхгүй байна даа" -02000608="Алдаа алга байна" - -; Dialogs -02000702="За" -02000705="&Тийм" -02000707="Бүг&д тийм" -02000709="&Үгүй" -0200070B="Бүгд ү&гүй" - -02000710="Болих" -02000711="&Болих" -02000713="&Хаах" -02000714="Зогс" -02000715="Дахин ачаалла" - -02000720="Тусламж" - -; Extract dialog -02000800="Задал" -02000801="З&адлах газар:" -02000802="Нууц үг" - -02000810="Замын горим" -02000811="Бүтэн замын нэр" -02000812="Одоогийн замын нэр" -02000813="Параметр алга" - -02000820="Давхарлаж бичих горим" -02000821="Давхарлаж бичхээсээ өмнө асуух" -02000822="Асуултгүй давхарлаж бичих" -02000823="Байгаа файлыг алгасах" -02000824="Автоматаар нэр солих" -02000825="Байвал нэрийг нь солих" - -02000830="Файлууд" -02000831="&Сонгогдсон файлууд" -02000832="&Бүх файлууд" - -02000881="Задалсан файлуудын байрлалыг тодорхойл." - -02000890="Задалж байна..." - -; Overwrite dialog -02000900="Файл дахин байрлуулахыг батлах" -02000901="Хавтас файлыг агуулсан байна." -02000902="Байгаа файлуудыг дахин байрлуулах уу" -02000903="Энүүнтэй юу?" - -02000911="A&втомат нэр солих" - -02000982="{0} битүүд" -02000983="Өөрчлөлт идэвхжилттэй" - -; Messages dialog -02000A00="Шинжилгээний зурвас" - -02000A80="Зурвас" - -02000A91="Дараах файлд шахалтын арга дэмжигдээгүй байна '{0}'." -02000A92="'{0}'өгөгдлийн алдаа. Файл эвдэрсэн байна." -02000A93="'{0}'CRC бүтсэнгүй. Файл эвдэрсэн байна." - -; Password dialog -02000B00="Нууц үгээ оруулах" -02000B01="Нууц үгээ оруулах:" -02000B02="&Нууц үг харуулах" - -; Progress dialog -02000C00="Үйл явц" -02000C01="Өнгөрсөн хугацаа:" -02000C02="Үлдсэн хугацаа:" -02000C03="Хэмжээ:" -02000C04="Хурд:" - -02000C10="&Ар талд" -02000C11="&Өмнө тал" -02000C12="&Түр зогс" -02000C13="&Үргэлжлүүл" - -02000C20="Түр зогслоо" - -02000C30="Та үнэхээр болих гэж байна уу?" - -; Compress dialog -02000D00="Архивт нэм" -02000D01="&Aрхив:" -02000D02="&Шинэчлэх горим:" -02000D03="Архив &өргөтгөл:" -02000D04="Шахах &арга:" -02000D05="Баталгаатай архив үүсгэх" -02000D06="&Параметерүүд:" -02000D07="Сонголтууд" -02000D08="SF&X архив үүсгэх" -02000D09="Олон-Бодлогын" -02000D0A="&Файлын нэрүүдийг нууцал" -02000D0B="Шахалтын &төвшин:" -02000D0C="&Толь бичгийн хэмжээ:" -02000D0D="&Үгийн хэмжээ:" -02000D0E="Шахаж байгаа санах ойн хэрэглээ:" -02000D0F="Задалж байгаа санах ойн хэрэглээ:" - -02000D40="Эзлэхүүн рүү хуваах, битүүд:" - -02000D81="Хадгалах" -02000D82="Энгийн" -02000D83="Дээд хэмжээгээр" -02000D84="Хурдан" -02000D85="Дээд хурданаар" -02000D86="Ултра" - -02000D90="Нэгжих" - -02000DA1="Нэмэх ба дахин байрлуулах" -02000DA2="Шинэчлэх ба дахин байрлуулах" -02000DA3="Байгаа файлуудыг дахин унших" -02000DA4="Файлуудыг тааруулах" - -02000DB1="Бүх файлууд" - -02000DC0="Шахаж байна" - -; Columns dialog -02000E00="Баганууд" -02000E01="Энэ хавтаст хийх багануудаа шалгана уу. Дээш оч доош оч товчлуураар та багануудаа янзалж болно." -02000E02="Сонгосон багана чинь ийм байх ёстой" -02000E03="Цэгийн &өргөн." - -02000E10="Дээш &оч" -02000E11="Доош &оч" -02000E12="&Үзүүлэх" -02000E13="&Нуух" -02000E14="Оруулах" - -02000E81="Гарчиг" -02000E82="Өргөн" - -; Testing -02000F90="Шалгаж байна" - - -; File Manager - -03000000="7-Зип файл Менежер" - -; Menu -03000102="&Файл" -03000103="&Засах" -03000104="&Үзүүлэх" -03000105="&Хэрэгслүүд" -03000106="&Тусламж" -03000107="Д&уртай зүйл" - -; File -03000210="&Нээх" -03000211="Дотор &нээх" -03000212="Гадна &нээх" -03000220="&Харах" -03000221="&Засварлах" -03000230="Нэр с&олих" -03000231="...рүү &Хуулах..." -03000232="...руу &Зөөх..." -03000233="&Устгах" -03000240="&Мэдээлэл үзэх" -03000241="Тай&лбар" -03000250="Хавтас үүсгэх" -03000251="Файл үүсгэх" -03000260="Га&рах" -03000270="&Файл хуваах..." -03000271="Файлуудыг нэгтгэх..." - -; Edit -03000310="&Цуцлах" -03000311="&Сэргээх" -03000320="Хайч&лах" -03000321="&Хуулах" -03000322="&Тавих" -03000323="&Устгах" -03000330="Бүгдийг со&нгох" -03000331="Сонгохоо болих" -03000332="&Сонголтоо эргүүл" -03000333="Сонгох..." -03000334="Сонгохгүй..." -03000335="Төрлөөр нь сонгох" -03000336="Төрлөөр нь сонгохгүй" - -; View -03000410="Том& дүрсүүд" -03000411="Жи&жиг дүрсүүд" -03000412="&Жагсаалт" -03000413="&Дэлгэрэнгүй" -03000420="Ангилаагүй" -03000430="Гол хавтсыг нээх" -03000431="Нэг төвшин дээш" -03000432="Хавтасны түүх..." -03000440="&Сэргээ" -03000450="&2 самбарууд" -03000451="&Багажны самбар" -03000460="Aрхив багажны самбар" -03000461="Стандарт багажны самбар" -03000462="Том товчлуурууд" -03000463="Товчлуурын текстийг үзүүл" - -; Tools -03000510="&Сонголтууд..." -03000511="&Бэнчмарк" - -; Help -03000610="&Агуулгууд..." -03000620="&7-Зип-ийн тухай..." - -; Favorites -03000710="&Хавтсыг дуртайдаа нэмэх үү" -03000720="Хавчуурга" - -; Options Dialog - -03010000="Сонголтууд" - -; Plugins -03010100="Плаг-инууд" -03010101="&Плаг-инууд:" -03010110="Сонголтууд..." - -; Edit -03010200="Засварлагч" -03010201="&Засварлагч:" - -; System -03010300="Систем" -03010302="7-Зипийг дараахтай нэгтгэх:" -03010310="Плаг-ин" - -; Settings -03010400="Тохируулгууд" -03010401="Зүйл \"..\" үзүүлэх" -03010402="Жинхэнэ файл дүрсийг харуулах" -03010410="Системийн цэс харуул" -03010420="&Бүтэн мөр сонгох" -03010421="&Мөрийн дундах зураас харуулах" -03010430="&Сайжруулсан Сонгох горим" -03010440="&Том санах ойн хуудас хэрэглэх" - -; Strings - -03020201="Хуулах" -03020202="Зөөх" -03020203="хуулахдаа:" -03020204="Зөөхдөө:" -03020205="Хуулж байна..." -03020206="Зөөж байна..." -03020207="Та файл ба хавтсыг зөөх буюу хуулж чадахгүй." -03020208="Үйлдэл дэмжигдээгүй байна." - -03020210="Файл устгахыг батал" -03020211="Хавтас устгахыг батал" -03020212="Олон файл устгахыг батал" -03020213="Та'{0}'-ийг устгах гэж байна уу?" -03020214="'{0}' хавтас болон бүх агуулгыг устгах гэж байна уу?" -03020215="{0} зүйлүүдийг устгах гэж байна уу?" -03020216="Устгаж байна..." -03020217="Файл болон хавтсыг устгахад алдаатай" - -03020220="Нэр солиж байна..." -03020221="Файл болон хавтсын нэрийг солиход алдаатай" -03020222="Файл хуулахыг магадлах" -03020223="Та үнэхээр файлуудыг архив руу хуулахыг хүсэж байна уу" - -03020230="Хавтас үүсгэх" -03020231="Хавтас нэр:" -03020232="Шинэ хавтас" -03020233="Хавтас үүсгэхэд алдаа гарав" - -03020240="Файл үүсгэх" -03020241="Файл нэр:" -03020242="Шинэ файл" -03020243="Файл үүсгэхэд алдаа гарав" - -03020250="Сонгох" -03020251="Сонгохгүй" -03020252="Maск:" - -03020260="Хавтсын түүх" - -03020280="Файл '{0}' өөрчлөгдлөө.\nТа архивт шинэчлэлт хиймээр байна уу?" -03020281="Файлыг шинэчилж чадсангүй\n'{0}" -03020282="Засварлагчийг нээж чадсангүй." -03020283="Нээж байна..." - -03020290="Тайлбар" -03020291="&Тайлбар:" - -030202A0="Систем" - -03020300="Компьютер" -03020301="Сүлжээ" - -03020400="Нэм" -03020401="Задал" -03020402="Шалгах" - -03020420="Хуулах" -03020421="Зөөх" -03020422="Устгах" -03020423="Шинж..." - -03020500="Хуваах файл:" -03020501="&Файл хуваах газар:" -03020510="Хувааж байна..." - -03020600="Нэгтгэх файлууд:" -03020601="&Нэгтгэх газар:" -03020610="Нэгтгэж байна..." - -; Computer -03031100="Нийт хэмжээ" -03031101="Хоосон зай" -03031102="Кластерын зай" -03031103="Нэр" - -; Network -03031200="Локаль Нэр" -03031201="Хангагч" - -; Benchmark Dialog - -03080000="Бэнчмарк" -03080001="Санах ойн хэрэглээ:" -03080002="Шахаж байна" -03080003="Задалж байна" -03080004="Хурд" -03080005="Үнэлж байна" -03080006="Нийт үнэлгээ" -03080007="Одоогийн" -03080008="Хариуг гаргаж байна" -03080009="Өнгөрсөн:" -0308000A="Алдаанууд:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/mr.txt b/tools/7-Zip/Lang/mr.txt deleted file mode 100644 index 883df5992c..0000000000 --- a/tools/7-Zip/Lang/mr.txt +++ /dev/null @@ -1,474 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.42 -; अनुवाद सुबोध गायकवाड -; -; -; -; - -00000000="Marathi" -00000001="मराठी" -00000002="78" - -; 7-Zip Configuration - -; Title -01000000="7-Zip संरचना" - -; Info Page -01000100="7-Zip बद्दल माहिती" -01000103="7-Zip हे मोफ़त सॉफ़्टवेअर आहे. तरिही, तुम्ही नोंद करुन याच्या प्रगतीला सहाय्य करू शकता." -01000104="सहाय्यता" -01000105="नोंद" - -; Folders Page -01000200="फ़ोल्डर" -01000210="&चलित फ़ोल्डर" -01000211="&प्रणालीचे तात्पुरते फ़ोल्डर" -01000212="&सध्या" -01000213="&नमुद:" -01000214="फक्त काढता येणाय्रा ड्रॉईव्हकरता वापरा" - -01000281="तात्पुरत्या दफ़तर करिता मार्ग दर्शवा." - -; System Page -01000300="प्रणाली" -01000301="7-Zip ला shell context मेनुशी जोडा" -01000302="Cascaded context menu" -01000310="Context मेनु वस्तू:" - -; Language Page -01000400="भाषा" -01000401="भाषा:" - - -; 7-Zip Explorer extension - - -; Context menu -02000101="7-Zip" -02000102="7-Zip कमांड्स" -02000103="दफ़तर उघडा" -02000104="निवडलेले दफ़तर उघडा." -02000105="फ़ाइल्स बाहेर काढा..." -02000106="निवडलेल्या दफ़तर मधुन फाइल बाहेर काढा ." -02000107="दफ़तरात टाका..." -02000108="निवडलेल्या वस्तू दफ़तरात टाका." -02000109="दफ़तर तपासा" -0200010A="दफ़तराची पुर्णता तपासा." -0200010B="येथे बाहेर काढा" -0200010C="सध्याच्या फ़ोल्डरमध्ये निवडलेल्या दफ़तर मधुन फाइल बाहेर काढा." -0200010D="बाहेर {0}" -0200010E="फ़ाइल्स उप-फ़ोल्डरमध्ये काढा." -0200010F="{0} येथे टाका" -02000110="निवडलेल्या वस्तू दफ़तरात टाका." -02000111="दाबा आणि इमेल करा..." -02000112="निवडलेल्या वस्तू दफ़तरात दाबुन टाका आणि दफ़तर इमेलद्वारे पाठवा." -02000113=" {0} येथे दाबा आणि इमेल करा" -02000114="निवडलेल्या वस्तू दफ़तरात दाबुन टाका आणि दफ़तर इमेलद्वारे पाठवा." - - -02000140="" -02000141="" - -; Properties -02000203="मार्ग" -02000204="नाव" -02000205="शेपुट" -02000206="फ़ोल्डर" -02000207="आकार" -02000208="दबलेला आकार" -02000209="गुणधर्म" -0200020A="तयार" -0200020B="वापर" -0200020C="बदल" -0200020D="ठोस" -0200020E="भाष्य" -0200020F="बंधिस्त" -02000210="या पुर्व तुकडे करा " -02000211="या नंतर तुकडे करा" -02000212="शब्दावली" -02000213="CRC" -02000214="प्रकार" -02000215="विरुद्ध" -02000216="पद्धत" -02000217="यजमान आज्ञावली" -02000218="फ़ाइल प्रणाली" -02000219="उपयोगकर्ता" -0200021A="गट" -0200021B="गठ्ठा" -0200021C="प्रतिक्रिया" -0200021D="स्थिती" -0200021E="मार्गाची सुरुवात" - -; Status bar -02000301="निवडलेल्या वस्तू{0}" -02000302="{0} वस्तू(s)" - -02000320="फ़ाइल:" -02000321="फ़ोल्डर:" -02000322="आकार:" - -; List Context Menu -02000401="&स्तंभ..." - -02000411="&उघडा" -02000412="&बाहेर..." - -; ToolBar -02000501="बाहेर" - -; Messages -02000601="या दफ़तरासाठी नुतनीकरण शक्य नाही." -02000602="{0} दफ़तराचे नुतनीकरण होऊ शकले नाही" -02000603=" '{0}' फ़ोल्डर तयार होऊ शकले नाही" -02000604="हा दफ़तर वेगळा आहे." -02000605="चुक" -02000606="खूपच जास्त वस्तू" -02000607="या फ़ाइलला उघडण्याकरता एकही संबधित प्रोग्राम नाही" -02000608="येथे एकही चूक नाही" - -; Dialogs -02000702="ठीक" -02000705="&हो" -02000707="&सर्व ला हो" -02000709="&नाही" -0200070B="&सर्व ला नाही" - -02000710="रद्द" -02000711="&रद्द" -02000713="&बंद" -02000714="थांबा" -02000715="पुन्हा सुरु करा" - -02000720="मदत" - -; Extract dialog -02000800="बाहेर" -02000801="&बाहेर:" -02000802="परवलिचा शब्द" - -02000810="मार्ग रित" -02000811="पूर्ण पत्ता" -02000812="सध्याचा पत्ता" -02000813="पत्ता नाही" - -02000820="Overwrite रीत" -02000821="overwrite करण्यापुर्वी विचारा" -02000822="Overwrite न विचारता करा" -02000823="अस्तित्वात असलेल्या फ़ाइल सोडा" -02000824="स्वयंचलित नाव बदलवा" -02000825="अस्तित्वात असलेल्या फ़ाइलचे आपोआप नाव बदलवा" - -02000830="फ़ाइल" -02000831="&निवडलेल्या फ़ाइल" -02000832="&सर्व फ़ाइल" - -02000881="फ़ाइल बाहेर काढण्यासाठी मार्ग नमूद करा." - -02000890="बाहेर" - -; Overwrite dialog -02000900="फ़ाइल बदलवीणे खात्री" -02000901="त्या फ़ोल्डरमध्ये अगोदरच कार्यान्वीत फ़ाइल आहे." -02000902="अस्तित्वात असलेली फ़ाइल बदलवायची आहे का?" -02000903="यानी?" - -02000911="स्वयंचलित नाव बदलवा" - -02000982="{0} बाइट्स" -02000983="बदल" - -; Messages dialog -02000A00="उपचार संदेश" - -02000A80="संदेश" - -02000A91="असहाय्यक दाब पद्धत'{0}'." -02000A92="डेटा चूक'{0}'. फ़ाइल तुटलेली आहे." -02000A93="CRC अयशस्वी '{0}'. फ़ाइल तुटलेली आहे." - -; Password dialog -02000B00="परवलिचा शब्द टाका" -02000B01="परवलिचा शब्द टाका:" -02000B02="परवलिचा शब्द दाखवा" - -; Progress dialog -02000C00="कार्य" -02000C01="झालेला वेळ:" -02000C02="निघुन गेलेला वॆळ:" -02000C03="आकार:" -02000C04="वेग:" - -02000C10="&मागे लपवा" -02000C11="&समोर आणा" -02000C12="&विश्राम" -02000C13="&सुरु" - -02000C20="विश्राम" - -02000C30="तुम्हाला रद्द करण्याबाबत खात्री आहे का?" - -; Compress dialog -02000D00="दफ़तरात टाका" -02000D01="&दफ़तर:" -02000D02="&नुतनीकरन रित:" -02000D03="दफ़तर &प्रकार:" -02000D04="दाब &पद्धत:" -02000D05="&ठोस दफ़तर तयार करा" -02000D06="&Parameters:" -02000D07="पर्याय" -02000D08="SF&X दफ़तर तयार करा" -02000D09="Multi-threading" -02000D0A="फ़ाइल &नाव बंधिस्त करा" -02000D0B="दाब &level:" -02000D0C="&शब्द्कोश आकार:" -02000D0D="&शब्द आकार:" -02000D0E="दाबण्यासाठी स्मरणशक्तीचा वापर:" -02000D0F="प्रसरण पावण्यासाठी स्मरणशक्तीचा वापर:" - -02000D40="तुकडे, बाइट्स:" - -02000D81="साठा" -02000D82="साधारण" -02000D83="जास्तीत जास्त" -02000D84="वेगवान" -02000D85="अतिशय वेगवान" -02000D86="एकदमच" - -02000D90="ब्राउझ" - -02000DA1="फ़ाइल टाका आणि ठेवा" -02000DA2="फ़ाइल टाका आणि नुतन करा" -02000DA3="अस्तित्वातील फ़ाइल ताजे करा" -02000DA4="Synchronize फ़ाइल" - -02000DB1="सर्व फ़ाइल" - -02000DC0="दाब" - -; Columns dialog -02000E00="स्तंभ" -02000E01="जे स्तंभ तुम्हाला या फ़ोल्डरमध्ये दृश्य करायचे आहे ते निवडा. वर आणि खाली कळचा उपयोग करा.." -02000E02="निवडलेला स्तंभ " -02000E03="पिक्सेल पसरलेला." - -02000E10="&वर" -02000E11="&खाली" -02000E12="&दृश्य" -02000E13="&लपवा" -02000E14="बसवा" - -02000E81="शिर्षक" -02000E82="रुंद" - -; Testing -02000F90="तपासणी" - - -; File Manager - -03000000="7-Zip फ़ाइल व्यवस्थापक" - -; Menu -03000102="&फ़ाइल" -03000103="&संपादन" -03000104="&दर्शन" -03000105="&अवजार" -03000106="&मदत" -03000107="आ&वडते" - -; File -03000210="&उघडा" -03000211="&अंदर उघडा" -03000212="&बाहेर उघडा" -03000220="&दृश्य" -03000221="&संपादक" -03000230="नाव बदल" -03000231="&प्रतिलिपी..." -03000232="&हलवा..." -03000233="&मिटवा" -03000240="लक्षणं" -03000241="प्रतिक्रिया" -03000250="फ़ोल्डर तयार करा" -03000251="फ़ाइल तयार करा" -03000260="गमन" -03000270="&फ़ाइल तुकडे करा..." -03000271="फ़ाइल जोडा..." - -; Edit -03000310="&पुर्वस्थिती" -03000311="&पुन्हा करा" -03000320="कापा" -03000321="&प्रतिलिपी" -03000322="&चिकटवा" -03000323="&मिटवा" -03000330="सर्व निवडा" -03000331="सर्वांना अनिवडित करा" -03000332="&निवड उलटी करा" -03000333="निवडा..." -03000334="अनिवडा..." -03000335="प्रकारेद्वारा निवडा" -03000336="प्रकारेद्वारे अनिवडा" - -; View -03000410="मोठे Icons" -03000411="लहान Icons" -03000412="&सुची" -03000413="&माहिती" -03000420="अव्यवस्थित" -03000430="Root फ़ोल्डर उघडा" -03000431="एक वरती चढा" -03000432="फ़ोल्डर इतिहास..." -03000440="&टवटवीत करा" -03000449="Flat दृश्य" -03000450="&२ फ़लक" -03000451="&अवजार कप्पाs" -03000460="दफ़तर अवजार कप्पा" -03000461="प्रमाण अवजार कप्पा" -03000462="मोठे कळ" -03000463="कळ शब्द दाखवा" - -; Tools -03000510="&पर्याय..." -03000511="&Benchmark" - -; Help -03000610="&माहिती..." -03000620="7-Zip बद्दल..." - -; Favorites -03000710="&फ़ोल्डर आवडते मध्ये टाका..." -03000720="पृष्ठ" - -; Options Dialog - -03010000="पर्याय" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="पर्याय..." - -; Edit -03010200="संपादक" -03010201="&संपादक:" - -; System -03010300="प्रणाली" -03010302="7-Zip संबधित करा:" -03010310="Plugin" - -; Settings -03010400="स्थिती" -03010401="वस्तू \"..\" दाखवा" -03010402="फ़ाइलचे खरे icon दाखवा" -03010410="प्रणालीचे मेनु दाखवा" -03010420="&सर्व ओळ निवडा" -03010421=" &grid रेघा दाखवा" -03010430="&अतिरिक्त निवड पद्धती" -03010440="मोठे स्मरणशक्ती पृष्ठ वापरा" - -; Strings - -03020201="प्रतिलिपी" -03020202="हलवा" -03020203="प्रतिलिपी:" -03020204="हलवा:" -03020205="प्रतिलिपी..." -03020206="हलवल्या जात आहे..." -03020207="तुम्ही अश्या फ़ोल्डरसाठी वस्तू हलवू किंवा प्रतिलिपी तयार करू शकत नाही." -03020208="क्रिया करता येणार नाही." - -03020210="फ़ाइल मिटवायची खात्री" -03020211="फ़ोल्डर मिटवायची खात्री" -03020212="अनेक फ़ाइल मिटवायची खात्री" -03020213="तुम्हाला '{0}' मिटवायची खात्री आहे का?" -03020214="तुम्हाला '{0}' फ़ोल्डर आणि त्यातील सर्व वस्तु मिटवायची खात्री आहे का?" -03020215="तुम्हाला {0} वस्तु मिटवायची खात्री आहे का?" -03020216="मिटत आहे..." -03020217="फ़ाइल किंवा फ़ोल्डर मिटवता येत नाही आहे" - -03020220="नविन नाव दिल्या जात आहे..." -03020221="फ़ाइल किंवा फ़ोल्डरला नविन नाव देता येत नाही आहे" -03020222="फ़ाइलची प्रतिलिपी करण्यास तुमची खात्री आहे का" -03020223="दफ़्तरात फ़ाइलची प्रतिलिपी करण्यास तुमची खात्री आहे का" - -03020230="फ़ॊल्डर तयार करा" -03020231="फ़ोल्डर नाव:" -03020232="नविन फ़ॊल्डर" -03020233="फ़ोल्डर तयार करता येत नाही आहे" - -03020240="फ़ाइल तयार करा" -03020241="फ़ाइलचे नाव:" -03020242="नविन फ़ाइल" -03020243="फ़ाइल तयार करता येत नाही आहे" - -03020250="निवडा" -03020251="निवड रद्द" -03020252="मुखवटा:" - -03020260="फ़ोल्डरचा इतिहास" - -03020280=" '{0}' ही फ़ाइल बदलली आहे.\nतुम्हाला हे दफ़तरात नुतन करायचे आहे का?" -03020281="फ़ाइल नुतन करता येत नाही\n'{0}'" -03020282="संपादक सुरु होत नाही." -03020283="उघडत आहे..." - -03020290="प्रतिक्रिया" -03020291="&प्रतिक्रिया:" - -030202A0="प्रणाली" - -03020300="संगणक" -03020301="नेटवर्क" - -03020400="टाका" -03020401="बाहेर" -03020402="तपासा" - -03020420="प्रतिलिपी" -03020421="हलवा" -03020422="मिटवा" -03020423="माहिती" - -03020500="फ़ाइलचे तुकडे करा" -03020501="&येथे तुकडे:" -03020510="तुकडे होत आहे..." - -03020600="फ़ाइल जोडा" -03020601="&येथे फ़ाइल जोडा:" -03020610="फ़ाइल जुडत आहे..." - -03020710="Checksum मोजत आहे..." -03020720="Checksum माहिती" -03020721="डेटाकरिता CRC checksum :" -03020722="नाव आणि डेटाकरिता CRC checksum :" - -03020800="बारकाईने पाहत आहे..." - -; Computer -03031100="एकूण आकार" -03031101="खाली जागा" -03031102="क्लस्टर आकार" -03031103="शिर्षक" - -; Network -03031200="लोकल नाव" -03031201="देणारा" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="स्मरणशक्ती वापर:" -03080002="दाबत आहे" -03080003="प्रसरण होत आहे" -03080004="वेग" -03080005="क्रमांकन" -03080006="एकुण क्रमांकन" -03080007="सध्या" -03080008="परिणाम" -03080009="Passes:" -0308000A="चूक:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ms.txt b/tools/7-Zip/Lang/ms.txt deleted file mode 100644 index f333b2b117..0000000000 --- a/tools/7-Zip/Lang/ms.txt +++ /dev/null @@ -1,459 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.30 -; Diterjemahkan oleh Khairul Ridhwan Bin Omar -; -; -; -; - -00000000="Malay" -00000001="Bahasa Melayu" -00000002="62" - -; 7-Zip Configuration - -; Title -01000000="Konfigurasi 7-Zip" - -; Info Page -01000100="Perihal 7-Zip" -01000103="7-Zip adalah perisian percuma. Sokong pembangunan 7-Zip dengan melakukan pendaftaran." -01000105="Pendaftaran" - -; Folders Page -01000200="Folder" -01000210="&Folder kerja" -01000211="&Folder sementara sistem" -01000212="&Sekarang" -01000213="&Ditentukan:" -01000214="Hanya untuk pemacu mudah alih" - -01000281="Tentukan lokasi untuk arkib fail sementara." - -; System Page -01000300="Sistem" -01000301="Integrasikan 7-Zip ke shell konteks menu" -01000302="Cascaded konteks menu" -01000310="Item pada konteks menu:" - -; Language Page -01000400="Bahasa" -01000401="Bahasa:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Arahan dalam 7-Zip" -02000103="Buka arkib" -02000104="Buka arkib terpilih." -02000105="Ekstrak fail..." -02000106="Ekstrak fail dari arkib terpilih." -02000107="Tambahkan ke arkib..." -02000108="Tambahkan item yang terpilih ke arkib." -02000109="Uji arkib" -0200010A="Uji integriti dari arkib terpilih." -0200010B="Ekstrak di sini" -0200010C="Ekstrak fail arkib yang terpilih ke folder ini." -0200010D="Ekstrak ke {0}" -0200010E="Ekstrak fail ke subfolder." -0200010F="Tambahkan ke {0}" -02000110="Tambahkan item terpilih ke arkib." -02000111="Padatkan dan kirimkan melalui email..." -02000112="Padatkan item yang terpilih ke arkib dan kirimkan melalui email." -02000113="Padatkan ke {0} dan kirimkan melalui email" -02000114="Padatkan item yang terpilih ke arkib dan kirimkan melalui email." - -02000140="" -02000141="" - -; Properties -02000203="Bahagian" -02000204="Nama" -02000205="Sambungan" -02000206="Folder" -02000207="Saiz" -02000208="Saiz Paket" -02000209="Atribut" -0200020A="Dibuat" -0200020B="Diakses" -0200020C="Diubah Suai" -0200020D="Solid" -0200020E="Komen" -0200020F="Terenkripsi" -02000210="Terpisah Sebelum" -02000211="Terpisah Selepas" -02000212="Kamus" -02000213="CRC" -02000214="Jenis" -02000215="Anti" -02000216="Kaedah" -02000217="Sistem Operasi" -02000218="Sistem Fail" -02000219="Pengguna" -0200021A="Kumpulan" -0200021B="Blok" -0200021C="Komen" -0200021D="Posisi" - -; Status bar -02000301="{0} buah objek telah terpilih" -02000302="{0} buah objek" - -; List Context Menu -02000401="&Kolum..." - -02000411="&Buka" -02000412="&Ekstrak..." - -; ToolBar -02000501="Ekstrak" - -; Messages -02000601="Tidak menyokong pengemaskinian untuk arkib ini." -02000602="Tidak dapat mengemaskini arkib {0}" -02000603="Tidak dapat membuat folder '{0}'" -02000604="Tidak dapat menyokong fail arkib jenis ini." -02000605="Ralat" -02000606="Terlalu banyak item" -02000607="Tidak ada aplikasi yang dikongsikan dengan sambungan dari nama fail yang diberikan" -02000608="Tidak ada ralat" - -; Dialogs -02000702="OK" -02000705="&Ya" -02000707="Ya untuk Semua" -02000709="&Tidak" -0200070B="Tidak untuk Semua" - -02000710="Batal" -02000711="&Batal" -02000713="&Tutup" -02000714="Henti" -02000715="Mula Semula" - -02000720="Bantuan" - -; Extract dialog -02000800="Ekstrak" -02000801="Ekstrak ke:" -02000802="Kata laluan" - -02000810="Mod laluan" -02000811="Laluan nama penuh" -02000812="Nama laluan sekarang" -02000813="Tidak pakai nama laluan" - -02000820="Mod tulis semula" -02000821="Tanya sebelum menulis semula" -02000822="Tulis semula tanpa perlu diberitahu" -02000823="Abaikan fail yang ada" -02000824="Namakan semula automatik" -02000825="Namakan automatik fail yang ada" - -02000830="Fail" -02000831="&Fail yang terpilih" -02000832="&Semua fail" - -02000881="Tentukan lokasi untuk pengekstrakan fail." - -02000890="Sedang mengekstrak" - -; Overwrite dialog -02000900="Pastikan penggantian fail" -02000901="Folder tujuan telah berisi fail yang telah terproses." -02000902="Mahukah anda menggantikan fail yang ada" -02000903="dengan yang ini?" - -02000911="N&amakan semula Automatik" - -02000982="{0} baits" -02000983="diubah suai pada" - -; Messages dialog -02000A00="Mesej diagnostik" - -02000A80="Mesej" - -02000A91="Kaedah pemampatan untuk '{0}' tidak disokong." -02000A92="Data ralat di '{0}'. Fail ini rosak." -02000A93="CRC gagal di '{0}'. Fail ini rosak." - -; Password dialog -02000B00="Masukkan kata laluan" -02000B01="Masukkan kata laluan:" -02000B02="&Perlihatkan kata laluan" - -; Progress dialog -02000C00="Proses" -02000C01="Telah berlalu:" -02000C02="Selesai dalam:" -02000C03="Saiz:" -02000C04="Kecepatan:" - -02000C10="&Latar belakang" -02000C11="&Latar depan" -02000C12="&Berehat" -02000C13="&Teruskan" - -02000C20="Berehat" - -02000C30="Anda yakin untuk membatalkannya?" - -; Compress dialog -02000D00="Tambahkan ke arkib" -02000D01="&Arkib:" -02000D02="&Mod kemaskini:" -02000D03="Format arkib:" -02000D04="Kaedah mampatan:" -02000D05="Buat arkib solid" -02000D06="&Parameter:" -02000D07="Opsyen" -02000D08="Buat arkib SF&X" -02000D09="Multi-threading" -02000D0A="Enkripsi nama &fail" -02000D0B="Aras &mampatan:" -02000D0C="&Saiz kamus:" -02000D0D="&Saiz perkataan:" -02000D0E="Penggunaan memori untuk Memampatkan:" -02000D0F="Penggunaan memori untuk Menyah-mampatkan:" - -02000D40="Bahagi/belah ke &nilai, baits:" - -02000D81="Untuk Penyimpanan" -02000D82="Normal" -02000D83="Maksimum" -02000D84="Cepat" -02000D85="Lebih cepat" -02000D86="Ultra" - -02000D90="Selusur..." - -02000DA1="Tambah dan gantikan fail" -02000DA2="Kemaskini dan tambahkan fail" -02000DA3="Perbaharui fail yang ada" -02000DA4="Menyesuaikan fail" - -02000DB1="Semua Fail" - -02000DC0="Memampatkan" - -; Columns dialog -02000E00="Kolum" -02000E01="Semak kolum yang anda ingin lihat untuk folder ini. Gunakan bebutang Ke Atas dan Ke Bawah untuk menyusun kolum." -02000E02="Kolum yang sepatutnya dipilih" -02000E03="piksel &lebar." - -02000E10="Pindah ke &Atas" -02000E11="Pindah ke &Bawah" -02000E12="&Perlihatkan" -02000E13="&Sembunyikan" -02000E14="Set" - -02000E81="Judul" -02000E82="Lebar" - -; Testing -02000F90="Pengujian" - - -; File Manager - -03000000="Pengurusan Fail 7-Zip" - -; Menu -03000102="&Fail" -03000103="&Edit" -03000104="&Paparan" -03000105="&Alat" -03000106="&Bantuan" -03000107="K&egemaran" - -; File -03000210="&Buka" -03000211="Buka di D&alam" -03000212="Buka di L&uar" -03000220="&Paparan" -03000221="&Edit" -03000230="Nam&akan semula" -03000231="&Salin ke..." -03000232="&Pindahkan ke..." -03000233="Hapus" -03000240="P&roperti" -03000241="Kom&en" -03000250="Buat Folder" -03000251="Buat Fail" -03000260="K&eluar" -03000270="&Bahagi/belah Fail..." -03000271="Gab&ung Fail..." - -; Edit -03000310="&Buat Asal" -03000311="&Buat Semula" -03000320="Poton&g" -03000321="&Salin" -03000322="&Tampal" -03000323="&Hapus" -03000330="Pilih &Semua" -03000331="Jangan Pilih Semua" -03000332="&Sonsangkan Pilihan " -03000333="Pilih..." -03000334="Tidak Memilih..." -03000335="Pilih Berdasarkan Jenis" -03000336="Tidak Memilih Berdasarkan Jenis" - -; View -03000410="Ikon B&esar" -03000411="Ikon K&ecil" -03000412="&Senarai" -03000413="&Butiran" -03000420="Tidak Tersusun" -03000430="Buka Root Folder" -03000431="Ke atas Satu Aras" -03000432="Folder Sejarah..." -03000440="&Segarkan Semula" -03000450="&2 Panel" -03000451="&Toolbar" -03000460="Toolbar Arkib" -03000461="Toolbar Standard" -03000462="Bebutang Besar" -03000463="Perlihatkan Teks Bebutang" - -; Tools -03000510="&Opsyen..." -03000511="&Tanda Aras" - -; Help -03000610="&Kandungan..." -03000620="&Perihal 7-Zip..." - -; Favorites -03000710="&Tambah folder pada Kegemaran sebagai" -03000720="Penanda Buku" - -; Options Dialog - -03010000="Opsyen" - -; Plugins -03010100="Plugin" -03010101="&Plugin:" -03010110="Opsyen..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistem" -03010302="Kongsikan 7-Zip dengan:" -03010310="Plugin" - -; Settings -03010400="Seting" -03010401="Perlihatkan \"..\" item" -03010402="Perlihatkan ikon asli dari fail" -03010410="Perlihatkan menu sistem" -03010420="&Pilih barisan penuh " -03010421="Perlihatkan garisan grid" -03010430="&Mod Pilihan Alternatif" -03010440="Gunakan muka surat memori yang &besar" - -; Strings - -03020201="Salin" -03020202="Pindah" -03020203="Salin ke:" -03020204="Pindah ke:" -03020205="Sedang menyalin..." -03020206="Sedang memindah..." -03020207="Anda tidak boleh memindah atau menyalin item untuk folder yang demikian." -03020208="Operasi tidak disokong." - -03020210="Pasti penghapusan fail" -03020211="Pasti penghapusan folder" -03020212="Pasti penghapusan fail-fail" -03020213="Anda yakin untuk menghapus '{0}'?" -03020214="Anda yakin untuk menghapus folder '{0}' dan semua isi kandungannya?" -03020215="Anda yakin untuk menghapus item {0}?" -03020216="Penghapusan..." -03020217="Ralat ketika menghapuskan Fail atau Folder" - -03020220="Namakan semula..." -03020221="Ralat, ketika namakan semula Fail atau Folder" -03020222="Pasti salinkan fail" -03020223="Anda yakin untuk menyalinkan fail kepada arkib" - - -03020230="Buat Folder" -03020231="Nama Folder:" -03020232="Folder Baru" -03020233="Ralat, tidak dapat Membuat Folder" - -03020240="Buat Fail" -03020241="Nama Fail:" -03020242="Fail Baru" -03020243="Ralat, tidak dapat Membuat Fail" - -03020250="Pilih" -03020251="Tidak Memilih" -03020252="Topeng:" - -03020260="Folder Sejarah" - -03020280="Fail '{0}' telah terubah suai.\nApakah anda ingin mengemaskininya pada arkib?" -03020281="Tidak dapat mengemaskini fail\n'{0}'" -03020282="Tidak dapat membuka editor." -03020283="Membuka..." - -03020290="Komen" -03020291="&Komen:" - -030202A0="Sistem" - -03020300="Komputer" -03020301="Rangkaian" - -03020400="Tambah" -03020401="Ekstrak" -03020402="Uji" - -03020420="Salin" -03020421="Pindah" -03020422="Hapus" -03020423="Maklumat" - -03020500="Pisahkan Fail" -03020501="&Pisahkan ke:" -03020510="Pembelahan ..." - -03020600="Gabungan Fail" -03020601="&Gabung ke:" -03020610="Penggabungan ..." - -; Computer -03031100="Saiz Keseluruhan" -03031101="Ruang Kosong" -03031102="Saiz Kluster" -03031103="Label" - -; Network -03031200="Nama Tempatan" -03031201="Penyedia" - -; Benchmark Dialog - -03080000="Tanda Aras" -03080001="Penggunaan memori:" -03080002="Pemampatan" -03080003="Penyah-mampatan" -03080004="Kecepatan" -03080005="Rating" -03080006="Total Rating" -03080007="Sekarang" -03080008="Keputusan" -03080009="Lulus:" -0308000A="Ralat:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/nb.txt b/tools/7-Zip/Lang/nb.txt deleted file mode 100644 index a0c0a530fb..0000000000 --- a/tools/7-Zip/Lang/nb.txt +++ /dev/null @@ -1,496 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.45 -; Translated by Jostein Christoffer Andersen -; Maintained by Kjetil Hjartnes -; Maintained by Robert Grønning -; -; - -00000000="Norwegian Bokmal" -00000001="Norsk Bokmål" -00000002="20-1" - -; 7-Zip Configuration - -; Title -01000000="7-Zip innstillinger" - -; Info Page -01000100="Om 7-Zip" -01000103="7-Zip er gratis programvare, men du kan støtte utviklingen av 7-Zip ved å registrere deg." -01000104="Brukerstøtte" -01000105="Registrering" - -; Folders Page -01000200="Mapper" -01000210="&Arbeidsmappe" -01000211="Systemets &midlertidige mappe" -01000212="&Nåværende" -01000213="&Egendefinert:" -01000214="Kun for flyttbare stasjoner" - -01000281="Angi plassering for midlertidige filer." - -; System Page -01000300="System" -01000301="Integrer 7-Zip i programmenyen" -01000302="Forgrenet programmeny" -01000310="Valg i programmenyen:" - -; Language Page -01000400="Språk" -01000401="Språk:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip-kommandoer" -02000103="Åpne arkiv" -02000104="Åpner det merkede arkivet." -02000105="Pakk ut …" -02000106="Pakk ut filer fra det merkede arkivet." -02000107="Legg til arkiv …" -02000108="Legger merkede filer til arkivet." -02000109="Test arkiv" -0200010A="Test integriteten til det merkede arkivet." -0200010B="Pakk ut internt" -0200010C="Pakk ut filer fra det merkede arkivet til gjeldende mappe." -0200010D="Pakk ut til {0}" -0200010E="Pakker ut filer til undermappe." -0200010F="Legg til {0}" -02000110="Legger merkede elementer til arkivet." -02000111="Komprimer og send med e-post …" -02000112="Komprimerer merkede elementer til et arkiv og sender det med e-post." -02000113="Komprimer til {0} og send med e-post" -02000114="Komprimerer merkede elementer til et arkiv og sender det med e-post." - -02000140="" -02000141="" - -; Properties -02000203="Plassering" -02000204="Navn" -02000205="Filetternavn" -02000206="Mappe" -02000207="Størrelse" -02000208="Komprimert størrelse" -02000209="Attributter" -0200020A="Opprettet" -0200020B="Åpnet" -0200020C="Endret" -0200020D="Kompakt" -0200020E="Kommentert" -0200020F="Kryptert" -02000210="Oppdeling før" -02000211="Oppdeling etter" -02000212="Ordbok" -02000213="CRC" -02000214="Type" -02000215="Anti" -02000216="Metode" -02000217="Vert-OS" -02000218="Filsystem" -02000219="Bruker" -0200021A="Gruppe" -0200021B="Blokk" -0200021C="Kommentar" -0200021D="Posisjon" -0200021E="Stiprefiks" - -; Status bar -02000301="{0} element(er) merket" -02000302="{0} element(er)" - -02000320="Filer:" -02000321="Mapper:" -02000322="Størrelse:" - -; List Context Menu -02000401="&Kolonner …" - -02000411="&Åpne" -02000412="&Pakk ut …" - -; ToolBar -02000501="Pakk ut" - -; Messages -02000601="Oppdateringsfunksjoner støttes ikke for dette arkivet." -02000602="Klarte ikke oppdatere arkivet «{0}»" -02000603="Klarte ikke opprette mappen «{0}»" -02000604="Filen er ikke et støttet arkivformat." -02000605="Feil" -02000606="For mange elementer" -02000607="Ingen programmer er knyttet til dette filetternavnet" -02000608="Fant ingen feil." -02000609="Kan ikke åpne filen «{0}» som arkiv" -0200060A="Kan ikke åpne det krypterte arkivet «{0}». Sjekk at du har riktig passord." - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja til &alt" -02000709="&Nei" -0200070B="Nei til a<" - -02000710="Avbryt" -02000711="&Avbryt" -02000713="&Lukk" -02000714="Stopp" -02000715="Start på nytt" - -02000720="Hjelp" - -; Extract dialog -02000800="Pakk ut" -02000801="&Pakk ut til:" -02000802="Passord" - -02000810="Filstier" -02000811="Fullstendige filstier" -02000812="Gjeldende filstier" -02000813="Ingen filstier" - -02000820="Overskrivelse" -02000821="Bekreft før overskrivelse" -02000822="Overskriv uten bekreftelse" -02000823="Hopp over filer som finnes allerede" -02000824="Navngi nye filer automatisk" -02000825="Navngi filer som finnes automatisk" - -02000830="Filer" -02000831="&Merkede filer" -02000832="&Alle filer" - -02000881="Angi plassering for filer som skal pakkes ut." - -02000890="Pakker ut" - -; Overwrite dialog -02000900="Bekreft filoverskrivelse" -02000901="Den behandlede filen finnes i målmappen allerede." -02000902="Vil du overskrive filen" -02000903="med denne?" - -02000911="Navngi a&utomatisk" - -02000982="{0} byte" -02000983="Endret" - -; Messages dialog -02000A00="Diagnosemeldinger" - -02000A80="Melding" - -02000A91="Komprimeringsmetoden støttes ikke for «{0}»." -02000A92="Datafeil i «{0}». Filen er ødelagt." -02000A93="CRC-feil i «{0}». Filen er ødelagt." -02000A94="Datafeil i den krypterte filen «{0}». Sjekk at du har riktig passord." -02000A95="CRC feilet i den krypterte filen «{0}». Sjekk at du har riktig passord." - -; Password dialog -02000B00="Angi passord" -02000B01="Angi passord:" -02000B02="&Vis passord" -02000B03="Bekreft passord:" -02000B10="Passordene er ikke like" -02000B11="Du kan bare bruke engelske bokstaver, tall eller spesialtegn (!, #, $, …) i passordet" -02000B12="Passordet er for langt" - -; Progress dialog -02000C00="Prosess" -02000C01="Tidsforbruk:" -02000C02="Gjenværende tid:" -02000C03="Størrelse:" -02000C04="Hastighet:" - -02000C10="&Bakgrunn" -02000C11="&Forgrunn" -02000C12="&Stopp" -02000C13="&Fortsett" - -02000C20="Stoppet" - -02000C30="Vil du avbryte?" - -; Compress dialog -02000D00="Legg til arkiv" -02000D01="Filn&avn:" -02000D02="&Oppdateringsmetode:" -02000D03="&Format:" -02000D04="Komprimerings&metode:" -02000D05="&Kompakt arkiv" -02000D06="&Parametre:" -02000D07="&Innstillinger" -02000D08="Selvutpakkende arkiv («SF&X»)" -02000D09="Fler&trådet" -02000D0A="Kr&ypter filnavn" -02000D0B="Komprimerings&nivå:" -02000D0C="Ord&bokstørrelse:" -02000D0D="&Ordstørrelse:" -02000D0E="Minnebruk ved komprimering:" -02000D0F="Minnebruk ved dekomprimering:" -02000D10="Kryptering" -02000D11="Krypteringsmetode:" -02000D12="Antall CPU tråder:" -02000D13="Solid blokk størrelse:" -02000D14="Ikkje-solid" -02000D15="Solid" - -02000D40="&Del opp til flere delarkiv i størrelsen:" -02000D41="Ugyldig delarkivstørrelse" -02000D42="Valgt delarkivstørrelse: {0} byte.\nEr du sikker på at du vil dele arkivet med denne størrelsen?" - -02000D81="Ukomprimert" -02000D82="Normal" -02000D83="Maksimum" -02000D84="Rask" -02000D85="Raskest" -02000D86="Ultra" - -02000D90="Bla gjennom" - -02000DA1="Legg til og overskriv filer" -02000DA2="Oppdater og legg til filer" -02000DA3="Oppdater filer" -02000DA4="Synkroniser filer" - -02000DB1="Alle filer" - -02000DC0="Komprimerer" - -; Columns dialog -02000E00="Kolonner" -02000E01="Merk av kolonnene som skal være synlige i denne mappen. Trykk «Flytt opp» og «Flytt ned» for å endre rekkefølgen." -02000E02="Den merkede kolonnen bør være" -02000E03="piksler &bred." - -02000E10="Flytt &opp" -02000E11="Flytt &ned" -02000E12="&Vis" -02000E13="&Skjul" -02000E14="Angi" - -02000E81="Tittel" -02000E82="Bredde" - -; Testing -02000F90="Testing" - - -; File Manager - -03000000="7-Zip filbehandler" - -; Menu -03000102="&Fil" -03000103="&Rediger" -03000104="&Vis" -03000105="Verk&tøy" -03000106="&Hjelp" -03000107="&Bokmerker" - -; File -03000210="&Åpne" -03000211="Åpne &internt" -03000212="Åpne &eksternt" -03000220="&Vis" -03000221="&Rediger" -03000230="Gi nytt &navn" -03000231="&Kopier til …" -03000232="&Flytt til …" -03000233="S&lett" -03000240="E&genskaper" -03000241="&Kommentar …" -03000242="Beregn sjekksum" -03000250="Ny &mappe …" -03000251="Ny f&il …" -03000260="&Avslutt" -03000270="&Del opp arkiv …" -03000271="&Sett sammen arkiv …" - -; Edit -03000310="&Angre" -03000311="&Gjør om" -03000320="Klipp &ut" -03000321="&Kopier" -03000322="&Lim inn" -03000323="&Slett" -03000330="Merk &alle" -03000331="Merk i&ngen" -03000332="Merk &omvendt" -03000333="Merk …" -03000334="Merk &ikke …" -03000335="Merk &valgt type" -03000336="Merk i&kke valgt type" - -; View -03000410="&Store ikoner" -03000411="S&må ikoner" -03000412="&Liste" -03000413="&Detaljer" -03000420="Usortert" -03000430="Rotmappe" -03000431="Gå opp et nivå" -03000432="Mappelogg …" -03000440="&Oppdater" -03000449="&Flat visning" -03000450="&To felt" -03000451="&Verktøylinjer" -03000460="Arkivverktøylinje" -03000461="Standardverktøylinje" -03000462="Store knapper" -03000463="Knappetekst" - -; Tools -03000510="&Innstillinger …" -03000511="&Yteprøve …" - -; Help -03000610="&Innhold" -03000620="&Om 7-Zip" - -; Favorites -03000710="&Bokmerk denne mappen som" -03000720="Bokmerke" - -; Options Dialog - -03010000="Innstillinger" - -; Plugins -03010100="Tillegg" -03010101="&Tillegg:" -03010110="Innstillinger …" - -; Edit -03010200="Redigering" -03010201="&Redigeringsprogram:" - -; System -03010300="System" -03010302="Assosier 7-Zip med:" -03010310="Utvidelse" - -; Settings -03010400="Innstillinger" -03010401="Vis element for å gå opp et &nivå" -03010402="Vis egentlige fil&ikoner" -03010410="Vis system&meny" -03010420="Merk &hele rader" -03010421="Vis &rutenett" -03010430="&Alternativ merking" -03010440="Bruk &store minnesider" - -; Strings - -03020201="Kopier" -03020202="Flytt" -03020203="Kopier til:" -03020204="Flytt til:" -03020205="Kopierer …" -03020206="Flytter …" -03020207="Du kan ikke flytte eller kopiere elementer i slike mapper." -03020208="Operasjonen støttes ikke." -03020209="Velg målmappe." - -03020210="Bekreft at fil skal slettes" -03020211="Bekreft at mappe skal slettes" -03020212="Bekreft at flere filer skal slettes" -03020213="Vil du slette «{0}»?" -03020214="Vil du slette mappen «{0}» med alt innhold?" -03020215="Vil du slette disse {0} elementene?" -03020216="Sletter …" -03020217="Det oppstod en feil da filen eller mappen skulle slettes" - -03020220="Navngir …" -03020221="Det oppstod en feil da filen eller mappen skulle navngis" -03020222="Bekreft at fil skal kopieres" -03020223="Vil du kopiere filene til arkivet" - -03020230="Ny mappe" -03020231="Mappenavn:" -03020232="Ny mappe" -03020233="Det oppstod en feil da mappen skulle opprettes" - -03020240="Ny fil" -03020241="Filnavn:" -03020242="Ny fil" -03020243="Det oppstod en feil da filen skulle opprettes" - -03020250="Merk" -03020251="Merk ikke" -03020252="Filter:" - -03020260="Mappelogg" - -03020280="Filen «{0}» har blitt endret.\nVil du oppdatere den i arkivet?" -03020281="Klarte ikke oppdatere filen\n«{0}»" -03020282="Klarte ikke starte redigeringsprogram." -03020283="Åpner …" - -03020290="kommentar" -03020291="&Kommentar:" - -030202A0="System" - -03020300="Datamaskin" -03020301="Nettverk" - -03020400="Legg til" -03020401="Pakk ut" -03020402="Prøv" - -03020420="Kopier" -03020421="Flytt" -03020422="Slett" -03020423="Egenskaper" - -03020500="Del opp arkiv" -03020501="&Del opp som:" -03020510="Deler opp …" -03020520="Bekreft deling" -03020521="Er du sikker på at du vil dele arkivet i {0} delarkiv?" -03020522="Delarkivene må være mindre enn originalarkivet" - -03020600="Sett sammen arkiv" -03020601="&Sett sammen som:" -03020610="Setter sammen …" -03020620="Velg bare det første delarkivet" - -03020710="Beregner sjekksum …" -03020720="Sjekksuminformasjon" -03020721="CRC-sjekksum for data:" -03020722="CRC-sjekksum for data og filnavn:" - -03020800="Skanner …" - -; Computer -03031100="Total plass" -03031101="Ledig plass" -03031102="Sektorgruppestørrelse" -03031103="Etikett" - -; Network -03031200="Lokalt navn" -03031201="Forsyner" - -; Benchmark Dialog - -03080000="Yteprøve" -03080001="Minnebruk:" -03080002="Komprimering" -03080003="Dekomprimering" -03080004="Hastighet" -03080005="Ytelse" -03080006="Samlet ytelse" -03080007="Nåværende" -03080008="Resultat" -03080009="Bestått:" -0308000A="Feilet:" -0308000B="CPU bruk" -0308000C="Ytelse / Bruk" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ne.txt b/tools/7-Zip/Lang/ne.txt deleted file mode 100644 index 111d18c2db..0000000000 --- a/tools/7-Zip/Lang/ne.txt +++ /dev/null @@ -1,473 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.37 -; Translated by Shiva Pokharel, Mahesh Subedi -; -; -; -; - -00000000="Nepali" -00000001="नेपाली" -00000002="97" - -; 7-Zip Configuration - -; Title -01000000="7-जिप कन्फिगरेसन" - -; Info Page -01000100="7-जिपका बारेमा" -01000103="7-जिप निशुल्क सफ्टवेयर हो। यद्यपी,तपाईँले दर्ता गरेर 7-जिपलाई सहयोग गर्न सक्नुहुन्छ ।" -01000104="सहयोग" -01000105="दर्ता" - -; Folders Page -01000200="फोल्डर" -01000210="&कार्य फोल्डर" -01000211="&प्रणाली टेम्प(अस्थायी) फोल्डर" -01000212="&चालू" -01000213="&निर्दिष्ट:" -01000214="हटाउन योग्य ड्राइभहरूका लागि मात्र प्रयोग गर्नुहोस्" - -01000281="अस्थायी सङ्ग्रह फाइलका लागि स्थान तोक्नुहोस् ।" - -; System Page -01000300="प्रणाली" -01000301="शेल प्रसङ्ग मेनुमा 7-जिप लाई सम्मिलन गर्नुहोस् " -01000302="सोपानी प्रसङ्ग मेनु" -01000310="प्रसङ्ग मेनु वस्तु:" - -; Language Page -01000400="भाषा" -01000401="भाषा:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-जिप" -02000102="7-जिप आदेश" -02000103="सङ्ग्रह खोल्नुहोस्" -02000104="चयन गरिएको सङ्ग्रह खोल्नुहोस्" -02000105="फाइलहरू निकाल्नुहोस्..." -02000106="चयन गरिएको सङ्ग्रहबाट फाइलहरू निकाल्नुहोस्" -02000107="सङ्ग्रहमा थप्नुहोस्..." -02000108="चयन गरिएका वस्तुहरूलाई सङ्ग्रहमा थप्दछ" -02000109="सङ्ग्रह जाँच्नुहोस्" -0200010A="चयन गरिएको सङ्ग्रहको समेङ्कन जाँच्दछ" -0200010B="यहाँ निकाल्नुहोस्" -0200010C="हालको फोल्डरमा चयन गरिएको सङ्ग्रहबाट फाइलहरू निकाल्नुहोस्" -0200010D="{0} मा निकाल्नुहोस्" -0200010E="सहायक फोल्डरमा फाइलहरू निकाल्दछ" -0200010F="{0} मा थप्नुहोस्" -02000110="चयन गरिएका वस्तुहरू सङ्ग्रह थप्दछ" -02000111="सङ्कुचन गरेर इमेल गर्नुहोस्..." -02000112="चयन गरिएका वस्तुलाई सङ्ग्रहमा सङ्कुचन गर्दछ र इमेल मार्फत सङ्ग्रहमा पठाउदछ" -02000113="{0} मा सङ्कुचन गर्नुहोस् र इमेल गर्नुहोस्" -02000114="चयन गरिएका वस्तुलाई सङ्ग्रहमा सङ्कुचन गर्दछ र इमेल मार्फत सङ्ग्रहमा पठाउदछ" - -02000140="" -02000141="" - -; Properties -02000203="मार्ग" -02000204="नाम" -02000205="विस्तार" -02000206="फोल्डर" -02000207="साइज" -02000208="प्याक गरिएको साइज" -02000209="विशेषता" -0200020A="सिर्जित" -0200020B="पहुँच" -0200020C="परिमार्जित" -0200020D="ठोस" -0200020E="टिप्पणी" -0200020F="गुप्तिकृत" -02000210="यस पहिले विभाजन गर्नुहोस्" -02000211="यस पछि विभाजन गर्नुहोस्" -02000212="शब्दकोश" -02000213="CRC" -02000214="प्रकार" -02000215="बिरोधि" -02000216="विधि" -02000217="होस्ट OS" -02000218="फाइल प्रणाली" -02000219="प्रयोगकर्ता" -0200021A="समूह" -0200021B="रोक" -0200021C="टिप्पणी" -0200021D="स्थान" -0200021E="मार्ग प्रत्यय" - -; वस्तुस्थिति पट्टी -02000301="{0} वस्तु(हरू) चयन गरियो" -02000302="{0} वस्तु(हरू)" - -02000320="फाइल:" -02000321="फोल्डर:" -02000322="साइज:" - -; प्रसङ्ग मेनु सूची -02000401="&स्तम्भ..." - -02000411="&खोल्नुहोस्" -02000412="&निकाल्नुहोस्..." - -; उपकरणपट्टी -02000501="निकाल्नुहोस्" - -; सन्देश -02000601="यो सङ्ग्रहका लागि अद्यावधिक सञ्चालन समर्थन गर्दैन" -02000602="सङ्ग्रह {0} अद्यावधिक गर्न सकिदैन" -02000603="'{0}'फोल्डर सिर्जना गर्न सकिदैन" -02000604="फाइलले सङ्ग्रह समर्थन गर्दैन" -02000605="त्रुटि" -02000606="धेरै वस्तु" -02000607="त्यहाँ दिइएको फाइल नाम विस्तारसँग सम्बन्धित अनुप्रयोग छैन" -02000608="त्यहाँ त्रुटि छैन" - -; संवाद -02000702="ठीक छ" -02000705="&हो" -02000707="&सबैलाई हो" -02000709="&होइन" -0200070B="&कसैलाई होइन" - -02000710="रद्द गर्नुहोस्" -02000711="&रद्द गर्नुहोस्" -02000713="&बन्द गर्नुहोस्" -02000714="रोक्नुहोस्" -02000715="पुन: सुरु गर्नुहोस्" - -02000720="मद्दत" - -; संवाद निकाल्नुहोस् -02000800="निकाल्नुहोस्" -02000801="यसलाई निकाल्नुहोस्:" -02000802="पासवर्ड" - -02000810="मार्ग मोड" -02000811="पूरा मार्गनाम" -02000812="हालको मार्गनामहरू" -02000813="मार्गनामहरू छैन" - -02000820="अधिलेखन मोड" -02000821="अधिलेखन गर्नु अगाडि सोध्नुहोस्" -02000822="प्रोम्टबिना अधिलेखन गर्नुहोस्" -02000823="अवस्थित फाइलहरू फड्काउनुहोस्" -02000824="स्वचालित पुन: नामकरण" -02000825="स्वचालित पुन: नामकरण अवस्थित फाइलहरू" - -02000830="फाइल" -02000831="&चयन गरिएको फाइल" -02000832="&सबै फाइल" - -02000881="निकालिएको फाइलका लागि स्थान निर्दिष्ट गर्नुहोस्" - -02000890="निकाल्दैछ" - -; अधिलेखन संवाद -02000900="फाइल प्रतिस्थापन यकिन गर्नुहोस्" -02000901="गन्तव्य फोल्डरले पहिले नै प्रक्रिया गरिएको फाइल समावेश गर्दछ" -02000902="अवस्थित फाइलमा प्रतिस्थापन गर्न चाहनुहुन्छ" -02000903="योसँग?" - -02000911="स्वचालित पुन: नामकरण" - -02000982="{0} बाइट" -02000983="यसमा परिमार्जित" - -; सन्देश संवाद -02000A00="निदानात्मक सन्देश" - -02000A80="सन्देश" - -02000A91="'{0}'का लागि असमर्थित सङ्कुचन विधि " -02000A92="'{0}'लगत त्रुटि । फाइल बिग्रेको छ" -02000A93="'{0}' मा CRC असफल । फाइल बिग्रेको छ" - -; पासवर्ड संवाद -02000B00="पासवर्ड प्रविष्ट गर्नुहोस्" -02000B01="पासवर्ड प्रविष्ट गर्नुहोस्:" -02000B02="&पासवर्ड देखाउनुहोस्" - -; प्रगित संवाद -02000C00="प्रक्रिया" -02000C01="व्यतीत समय:" -02000C02="पुन: नामकरण समय:" -02000C03="साइज:" -02000C04="गति:" - -02000C10="&पृष्ठभुमि" -02000C11="&अग्रभुमि" -02000C12="&पज गर्नुहोस्" -02000C13="&जारी राख्नुहोस्" - -02000C20="पज गरिएको" - -02000C30="तपाईँ रद्द गर्न यकिन हुनुहुन्छ ?" - -; सङ्कुचन संवाद -02000D00="सङ्ग्रहमा थप्नुहोस्" -02000D01="&सङ्ग्रह:" -02000D02="&अद्यावधिक मोड:" -02000D03="सङ्ग्रह ढाँचा:" -02000D04="सङ्कुचन विधि:" -02000D05="ठोस सङ्ग्रह सिर्जना गर्नुहोस्" -02000D06="&परिमिति:" -02000D07="विकल्प" -02000D08="SF&X सङ्ग्रह सिर्जना गर्नुहोस्" -02000D09="मल्टि-थ्रेडिङ" -02000D0A="फाइलनाम गुप्तिकरण गर्नुहोस्" -02000D0B="सङ्कुचन स्तर:" -02000D0C="&शब्दकोश साइज:" -02000D0D="&शब्द साइज:" -02000D0E="सङ्कुचनका लागि स्मृति प्रयोग:" -02000D0F="असङ्कुचनका लागि स्मृति प्रयोग:" - -02000D40="भोल्युम, बाइटमा विभाजन गर्नुहोस्:" - -02000D81="भण्डार गर्नुहोस्" -02000D82="साधारण" -02000D83="अधिकतम" -02000D84="छिटो" -02000D85="सब भन्दा छिटो" -02000D86="अत्यन्त" - -02000D90="ब्राउज गर्नुहोस्" - -02000DA1="फाइल थपेर प्रतिस्थापन गर्नुहोस्" -02000DA2="फाइलहरू अद्यावधिक गरेर थप्नुहोस्" -02000DA3="अवस्थित फाइल ताजा गर्नुहोस्" -02000DA4="फाइल समक्रमण गर्नुहोस्" - -02000DB1="सबै फाइल" - -02000DC0="सङ्कुचन" - -; स्तम्भ संवाद -02000E00="स्तम्भ" -02000E01="यो फोल्डरमा देखिने बनाउन चाहनु भएको स्तम्भ जाँच गर्नुहोस् । स्तम्भलाई पुन: क्रमबद्ध गर्न 'माथि सार्नुहोस्' र 'तल सार्नुहोस्' बटनको प्रयोग गर्नुहोस् " -02000E02="चयन गरिएको स्तम्भ हुनुपर्दछ" -02000E03="फराकिलो पिक्सेल" - -02000E10="माथि सार्नुहोस्" -02000E11="तल सार्नुहोस्" -02000E12="&देखाउनुहोस्" -02000E13="&लुकाउनुहोस्" -02000E14="सेट गर्नुहोस्" - -02000E81="शीर्षक" -02000E82="चौडाइ" - -; परीक्षण -02000F90="परीक्षण" - - -; फाइल प्रबन्धक - -03000000="7-जिप फाइल प्रबन्धक" - -; मेनु -03000102="&फाइल" -03000103="&सम्पादन गर्नुहोस्" -03000104="&हेर्नुहोस्" -03000105="&उपकरण" -03000106="&मद्दत" -03000107="&रुचाइएको" - -; फाइल -03000210="&खोल्नुहोस्" -03000211="भित्रपट्टि खोल्नुहोस्" -03000212="बाहरिपट्टि खोल्नुहोस्" -03000220="&हेर्नुहोस्" -03000221="&सम्पादन गर्नुहोस्" -03000230="पुन: नामकरण गर्नुहोस्" -03000231="&यसमा प्रतिलिपि बनाउनुहोस्..." -03000232="&यसमा सार्नुहोस्..." -03000233="&मेट्नुहोस्" -03000240="&गुण" -03000241="टिप्पणी" -03000242="checksum गणना गर्नुहोस्" -03000250="फोल्डर सिर्जना गर्नुहोस्" -03000251="फाइल सिर्जना गर्नुहोस्" -03000260="निस्कनुहोस्" -03000270="&फाइल विभाजन गर्नुहोस्..." -03000271="फाइलहरू संयोजन गर्नुहोस्..." - -; सम्पादन -03000310="&पूर्वस्थितिमा फर्काउनुहोस्" -03000311="&रिडु गर्नुहोस्" -03000320="काँट्नुहोस्" -03000321="&प्रतिलिपि बनाउनुहोस्" -03000322="&टाँस्नुहोस्" -03000323="&मेट्नुहोस्" -03000330="सबै चयन गर्नुहोस्" -03000331="सबै मेट्नुहोस्" -03000332="&चयन उल्टाउनुहोस्" -03000333="चयन गर्नुहोस्..." -03000334="चयन हटाउनुहोस्..." -03000335="प्रकार अनुसार चयन गर्नुहोस्" -03000336="प्रकार अनुसार चयन हटाउनुहोस्" - -; दृश्य -03000410="ठूलो प्रतिमा" -03000411="सानो प्रतिमा" -03000412="&सूची" -03000413="&वर्णन" -03000420="क्रमबद्ध नगरिएको" -03000430="प्रमूल फोल्डर खोल्नुहोस्" -03000431="एक स्तर माथि" -03000432="फोल्डरको इतिहार..." -03000440="&ताजा गर्नुहोस्" -03000449="फ्ल्याट दृश्य" -03000450="&२ प्यानल" -03000451="&उपकरणपट्टी" -03000460="सङ्ग्रह उपकरणपट्टी" -03000461="मानक उपकरणपट्टी" -03000462="ठूलो बटन" -03000463="बटनको पाठ देखाउनुहोस्" - -; उपकरण -03000510="&विकल्प..." -03000511="&बेञ्चमार्क" - -; मद्दत -03000610="&सामग्री..." -03000620="&7-जिपका बारेमा..." - -; रूचाइएको -03000710="&यस रूपमा रूचाइएकोमा फोल्डर थप्नुहोस्" -03000720="पुस्तकचिनो" - -; विकल्प संवाद - -03010000="विकल्प" - -; प्लगइन -03010100="प्लगइन" -03010101="&प्लगइन:" -03010110="विकल्प..." - -; सम्पादन -03010200="सम्पादक" -03010201="&सम्पादक:" - -; प्रणाली -03010300="प्रणाली" -03010302="यससँग 7-जिप सम्बन्धित:" -03010310="प्लगइन" - -; सेटिङ -03010400="सेटिङ" -03010401="\"..\" वस्तु देखाउनुहोस्" -03010402="वास्तविक फाइल प्रतिमा देखाउनुहोस्" -03010410="प्रणाली मेनु देखाउनुहोस्" -03010420="&पूरा पङ्क्ति चयन" -03010421="ग्रिड रेखा देखाउनुहोस्" -03010430="&वैकल्पिक चयन मोड" -03010440="ठूलो स्मृति पृष्ठ प्रयोग गर्नुहोस्" - -; सेटिङ - -03020201="प्रतिलिपि गर्नुहोस्" -03020202="सार्नुहोस्" -03020203="यसमा प्रतिलिपि गर्नुहोस्:" -03020204="यसमा सार्नुहोस्:" -03020205="प्रतिलिपि गर्दैछ..." -03020206="सार्दैछ..." -03020207="यस्तो फोल्डरकाल लागि तपाईँले वस्तुहरू सार्न र प्रतिलिपि गर्न सक्नुहुदैन" -03020208="सञ्चालन समर्थन गर्दैन" - -03020210="फाइल मेट्न यकिन गर्नुहोस्" -03020211="फोल्ड मेट्न यकिन गर्नुहोस्" -03020212="बहुविध फाइल मेट्न यकिन गर्नुहोस्" -03020213="तपाईँ '{0}'मेट्न निश्चित हुनुहुन्छ ?" -03020214="तपाईँ '{0}' फोल्डर यसको सबै सामग्री मेट्न निश्चित हुनुहुन्छ ?" -03020215="तपाईँ {0} वस्तुहरू मेट्न निश्चित हुनुहुन्छ ?" -03020216="मेट्दैछ..." -03020217="फाइल वा फोल्डर मेट्दा त्रुटि" - -03020220="पुन: नामकरण..." -03020221="फाइल वा फोल्डर पुन: नामकरण गर्दा त्रुटि" -03020222="फाइल प्रतिलिपि गर्न यकिन गर्नुहोस्" -03020223="तपाईँ फाइलहरू सङ्ग्रहमा प्रतिलिपि गर्न निश्चित हुनुहुन्छ" - -03020230="फोल्डर सिर्जना गर्नुहोस्" -03020231="फोल्डर नाम:" -03020232="नयाँ फोल्डर" -03020233="फोल्डर सिर्जना गर्दा त्रुटि" - -03020240="फाइल सिर्जना गर्नुहोस्" -03020241="फाइल नाम:" -03020242="नयाँ फाइल" -03020243="फाइल सिर्जना गर्दा त्रुटि" - -03020250="चयन गर्नुहोस्" -03020251="चयन हटाउनुहोस्" -03020252="मास्क:" - -03020260="फोल्डर इतिहार" - -03020280="'{0}'फाइल परिमार्जन गरिएको छ ।\nतपाईँले यसलाई सङ्ग्रहमा अद्यावधिक गर्न चाहनुहुन्छ ?" -03020281="फाइल अद्यावधिक गर्न सकिदैन\n'{0}'" -03020282="सम्पादक सुरु गर्न सकिदैन" -03020283="खोल्दैछ..." - -03020290="टिप्पणी" -03020291="&टिप्पणी:" - -030202A0="प्रणाली" - -03020300="कम्प्युटर" -03020301="सञ्जाल" - -03020400="थप्नुहोस्" -03020401="निकाल्नुहोस्" -03020402="परीक्षण गर्नुहोस्" - -03020420="प्रतिलिपि गर्नुहोस्" -03020421="सार्नुहोस्" -03020422="मेट्नुहोस्" -03020423="सूचना" - -03020500="फाइल विभाजन गर्नुहोस्" -03020501="&यसमा विभाजन गर्नुहोस्:" -03020510="विभाजन गर्दैछ..." - -03020600="फाइल संयोजन गर्नुहोस्" -03020601="&यसमा संयोजन गर्नुहोस्:" -03020610="संयोजन गर्दैछ..." - -03020710="Checksum गणना गर्दैछ..." -03020720="Checksum सूचना" -03020721="लगतका लागि CRC checksum:" -03020722="लगत र नामहरूका लागि CRC checksum:" - -03020800="स्क्यानिङ..." - -; कम्प्युटर -03031100="जम्मा साइज" -03031101="स्वतन्त्र रिक्तस्थान" -03031102="समूह साइज" -03031103="लेबुल" - -; सञ्जाल -03031200="स्थानिय नाम" -03031201="प्रदायक" - -; बेञ्चमार्क संवाद - -03080000="बेञ्चमार्क" -03080001="स्मृति उपयोग:" -03080002="सङ्कुचन" -03080003="असङ्कुचन" -03080004="गति" -03080005="दर" -03080006="जम्मा दर" -03080007="हालको" -03080008="नतिजा" -03080009="पास:" -0308000A="त्रुटि:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/nl.txt b/tools/7-Zip/Lang/nl.txt deleted file mode 100644 index 65caca8b03..0000000000 --- a/tools/7-Zip/Lang/nl.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by Jeroen Tulp - Vertaald door Jeroen Tulp -; -; Changed and updated translations as done for 7-Zip 4.26 Beta by Jeroen van der Weijde. -; -; Special thanks to Fuss! and r00n for their support in perfecting these translations. - -00000000="Dutch" -00000001="Nederlands" -00000002="19" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Configuratie" - -; Info Page -01000100="Over 7-Zip" -01000103="7-Zip is gratis software. Echter, u kunt de ontwikkeling van 7-Zip ondersteunen door u te registreren." -01000104="&Ondersteuning" -01000105="&Registreren" - -; Folders Page -01000200="Mappen" -01000210="&Werkmap" -01000211="&Tijdelijke systeemmap" -01000212="&Huidige" -01000213="&Gespecificeerd:" -01000214="Alleen voor verwisselbare schijven gebruiken." - -01000281="Specificeer een locatie voor tijdelijke archiefbestanden." - -; System Page -01000300="Systeem" -01000301="7-Zip in het contextmenu integreren." -01000302="Trapsgewijs contextmenu" -01000310="Contextmenu items:" - -; Language Page -01000400="Taal" -01000401="Taal:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip opdrachten" -02000103="Open archief" -02000104="Opent het geselecteerde archief." -02000105="Bestanden uitpakken..." -02000106="Bestanden uitpakken voor het geselecteerde archief." -02000107="Toevoegen aan archief..." -02000108="Toevoegen van de geselecteerde items aan een archief." -02000109="Archief testen" -0200010A="Integriteit van het geselecteerde archief testen." -0200010B="Pak hier uit" -0200010C="Pakt bestanden in het archief uit naar de huidige map." -0200010D="Pak uit naar {0}" -0200010E="Pakt bestanden in het archief uit naar een submap." -0200010F="Toevoegen aan {0}" -02000110="Toevoegen van geselecteerde items aan het archief." -02000111="Comprimeer en verstuur..." -02000112="Comprimeert de geselecteerde items in een archief en verstuur het via e-mail." -02000113="Comprimeer naar {0} en verstuur" -02000114="Comprimeert de geselecteerde items in het archief en verstuur het via e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Pad" -02000204="Naam" -02000205="Extensie" -02000206="Map" -02000207="Grootte" -02000208="Ingepakte grootte" -02000209="Kenmerken" -0200020A="Aangemaakt" -0200020B="Laatst geopend" -0200020C="Gewijzigd" -0200020D="Compact" -0200020E="Commentaar" -0200020F="Gecodeerd" -02000210="Gesplitst voor" -02000211="Gesplitst na" -02000212="Woordenboek" -02000213="CRC" -02000214="Type" -02000215="Anti" -02000216="Methode" -02000217="Gastheer OS" -02000218="Bestandssysteem" -02000219="Gebruiker" -0200021A="Groep" -0200021B="Blok" -0200021C="Opmerking" -0200021D="Positie" -0200021E="Pad Prefix" -0200021F="Mappen" -02000220="Bestanden" -02000221="Versie" -02000222="Volume" -02000223="Multivolume" -02000224="Offset" -02000225="Koppelingen" -02000226="Blokken" -02000227="Volumes" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Fysieke grootte" -0200022D="Kop grootte" -0200022E="Checksum" -0200022F="Karakteristieken" -02000230="Virtueel Adres" -02000231="ID" -02000232="Korte Naam" -02000233="Aanmaak Applicatie" -02000234="Sector Grootte" -02000235="Modus" -02000236="Link" - -; Status bar -02000301="{0} item(s) geselecteerd" -02000302="{0} item(s)" - -02000320="Bestanden:" -02000321="Mappen:" -02000322="Grootte:" -02000323="Gecomprimeerde grootte:" -02000324="Archieven:" - -; List Context Menu -02000401="&Kolommen..." - -02000411="&Openen" -02000412="&Uitpakken..." - -; ToolBar -02000501="Uitpakken" - -; Messages -02000601="Bijwerkfuncties niet ondersteund voor dit archief." -02000602="Kan archief {0} niet bijwerken." -02000603="Kan map '{0}' niet aanmaken." -02000604="Dit bestand is geen ondersteund archief." -02000605="Fout" -02000606="Te veel items" -02000607="Er is geen programma geassocieerd met deze bestandsextensie." -02000608="Er zijn geen fouten." -02000609="Kan bestand '{0}' niet openen als archief." -0200060A="Kan het gecodeerde archief '{0}' niet openen. Verkeerd wachtwoord?" -0200060B="Het systeem kan de benodigde hoeveelheid geheugen niet alloceren" -0200060C="Onbekende fout" -0200060D="Niet ondersteund archief type" - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja op &alles" -02000709="&Nee" -0200070B="Nee op a&lles" - -02000710="Annuleren" -02000711="&Annuleren" -02000713="A&fsluiten" -02000714="Stop" -02000715="Herstarten" - -02000720="Help" - -; Extract dialog -02000800="&Uitpakken" -02000801="U&itpakken naar:" -02000802="&Wachtwoord" - -02000810="Padmethode" -02000811="Volledige padnamen" -02000812="Huidige padnamen" -02000813="Geen padnamen" - -02000820="Overschrijfmethode" -02000821="Vraag voor overschrijven" -02000822="Overschrijven zonder bevestiging" -02000823="Bestaande bestanden overslaan" -02000824="Automatisch hernoemen" -02000825="Automatisch hernoemen van bestaande bestanden" - -02000830="Bestanden" -02000831="&Geselecteerde bestanden" -02000832="&Alle bestanden" - -02000881="Geef een locatie op voor de uitgepakte bestanden." - -02000890="Bezig met uitpakken..." - -; Overwrite dialog -02000900="Bevestig vervangen bestand" -02000901="Doelmap bevat reeds het verwerkte bestand." -02000902="Wilt u het bestaande bestand vervangen" -02000903="door dit bestand?" - -02000911="A&utomatisch hernoemen" - -02000982="{0} bytes" -02000983="gewijzigd op" - -; Messages dialog -02000A00="Diagnostische berichten" - -02000A80="Bericht" - -02000A91="Niet ondersteunde compressiemethode voor '{0}'." -02000A92="Gegevensfout in '{0}'. Bestand is beschadigd." -02000A93="CRC mislukt in '{0}'. Bestand is beschadigd." -02000A94="Gegevensfout in het gecodeerde bestand '{0}'. Verkeerd wachtwoord?" -02000A95="CRC mislukt in het gecodeerde bestand '{0}'. Verkeerd wachtwoord?" - -; Password dialog -02000B00="Wachtwoord ingeven" -02000B01="Wachtwoord &ingeven:" -02000B02="Wachtwoord &tonen" -02000B03="Wachtwoord bevestigen:" -02000B10="Wachtwoorden komen niet overeen." -02000B11="Gebruik alleen alfanumerieke en speciale karakters (!, #, $, ...) voor het wachtwoord." -02000B12="Wachtwoord is te lang." - -; Progress dialog -02000C00="Verwerking" -02000C01="Verstreken tijd:" -02000C02="Overgebleven tijd:" -02000C03="Grootte:" -02000C04="Snelheid:" -02000C05="Verwerkt:" -02000C06="Compressie verhouding:" - -02000C10="&Achtergrond" -02000C11="&Voorgrond" -02000C12="&Pauzeren" -02000C13="&Hervatten" - -02000C20="Gepauzeerd" - -02000C30="Weet u zeker dat u wilt annuleren?" - -; Compress dialog -02000D00="Toevoegen aan archief" -02000D01="&Archief:" -02000D02="&Bijwerkmethode:" -02000D03="Archief &formaat:" -02000D04="Compressie&methode:" -02000D05="&Compact archief maken" -02000D06="&Parameters:" -02000D07="Opties" -02000D08="SF&X archief maken" -02000D09="Multi-threading" -02000D0A="Codee&r bestandsnamen" -02000D0B="Compressie&niveau:" -02000D0C="&Woordenboekgrootte:" -02000D0D="W&oordgrootte:" -02000D0E="Geheugengebruik bij het inpakken:" -02000D0F="Geheugengebruik bij het uitpakken:" -02000D10="Codering" -02000D11="Cod&eermethode:" -02000D12="Aantal CP&U-threads:" -02000D13="Compacte b&lokgrootte:" -02000D14="Niet compact" -02000D15="Compact" -02000D16="Comprimeer &gedeelde bestanden" - -02000D40="Opsplitsen in &volumes (grootte in bytes):" -02000D41="Verkeerde volumegrootte" -02000D42="Gespecificeerde volumegrootte: {0} bytes.\nWeet u zeker dat u het archief zo wilt splitsen?" - -02000D81="Opslaan" -02000D82="Normaal" -02000D83="Maximum" -02000D84="Snel" -02000D85="Snelst" -02000D86="Ultra" - -02000D90="Bladeren" - -02000DA1="Bestanden toevoegen en vervangen" -02000DA2="Bestanden bijwerken en toevoegen" -02000DA3="Bestaande bestanden opfrissen" -02000DA4="Bestanden synchroniseren" - -02000DB1="Alle bestanden" - -02000DC0="Bezig met comprimeren..." - -; Columns dialog -02000E00="Kolommen" -02000E01="Markeer de kolommen die u zichtbar wilt maken in deze map. Gebruik de omhoog en omlaag knoppen om de kolommen te rangschikken." -02000E02="De gemarkeerde kolom moet" -02000E03="pixels &breed zijn." - -02000E10="Om&hoog verplaatsen" -02000E11="Om&laag verplaatsen" -02000E12="&Tonen" -02000E13="&Verbergen" -02000E14="Instellen" - -02000E81="Titel" -02000E82="Breedte" - -; Testing -02000F90="Bezig met testen..." - - -; File Manager - -03000000="7-Zip Bestandsbeheer" - -; Menu -03000102="&Bestand" -03000103="Be&werken" -03000104="Bee&ld" -03000105="E&xtra" -03000106="&Help" -03000107="&Favorieten" - -; File -03000210="&Openen" -03000211="Open B&innen" -03000212="Open B&uiten" -03000220="Bee&ld" -03000221="&Bewerken" -03000230="Naam wi&jzigen" -03000231="Kopiëren &naar..." -03000232="&Verplaatsen naar..." -03000233="Verwij&deren" -03000240="Ei&genschappen" -03000241="O&pmerking" -03000242="&Checksum berekenen" -03000243="Vergelijken" -03000250="Nieuwe &map" -03000251="Nieuw b&estand" -03000260="&Sluiten" -03000270="Bestand opspli&tsen..." -03000271="Bestanden s&amenvoegen..." - -; Edit -03000310="&Ongedaan maken" -03000311="&Opnieuw" -03000320="Kn&ippen" -03000321="&Kopiëren" -03000322="P&lakken" -03000323="Verwij&deren" -03000330="&Alles selecteren" -03000331="All&es de-selecteren" -03000332="Sele&ctie omkeren" -03000333="&Selecteer..." -03000334="&De-selecteer..." -03000335="&Selecteer op type" -03000336="&De-selecteer op type" - -; View -03000410="&Grote pictogrammen" -03000411="&Kleine pictogrammen" -03000412="&Lijst" -03000413="&Details" -03000420="&Ongesorteerd" -03000430="&Root map openen" -03000431="Één &niveau omhoog" -03000432="&Mappen Geschiedenis..." -03000440="&Vernieuwen" -03000449="&Platte weergave" -03000450="&2 Panelen" -03000451="&Werkbalken" -03000460="&Archief werkbalk" -03000461="&Standaard werkbalk" -03000462="Grote kn&oppen" -03000463="Knop&tekst weergeven" - -; Tools -03000510="&Opties..." -03000511="&Benchmark" - -; Help -03000610="&Inhoud..." -03000620="&Over 7-Zip..." - -; Favorites -03000710="&Map toevoegen aan favorieten" -03000720="Toevoegen als" - -; Options Dialog - -03010000="Opties" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="&Opties..." - -; Edit -03010200="Editor" -03010201="&Editor:" -03010202="&Vergelijken:" - -; System -03010300="Systeem" -03010302="Associeer 7-Zip met:" -03010310="Plugin" - -; Settings -03010400="Instellingen" -03010401="Toon \"..\" &item" -03010402="Toon &echte bestandspictogrammen" -03010410="Toon &systeem contextmenu" -03010420="&Selecteer gehele rij" -03010421="Toon &rasterlijnen" -03010422="Enkele klik om een item te openen" -03010430="&Alternatieve selectiemodus" -03010440="&Gebruik grote geheugenpagina's" - -; Strings - -03020201="Kopiëren" -03020202="Verplaatsen" -03020203="Kopiëren naar:" -03020204="Verplaatsen naar:" -03020205="Bezig met kopiëren..." -03020206="Bezig met verplaatsen..." -03020207="U kunt items niet verplaatsen of kopiëren voor dergelijke mappen." -03020208="Functie wordt niet ondersteund." -03020209="Selecteer een doelmap." - -03020210="Verwijdering bestand bevestigen" -03020211="Verwijdering map bevestigen" -03020212="Verwijdering van meerdere bestanden bevestigen" -03020213="Weet u zeker dat u '{0}' wilt verwijderen?" -03020214="Weet u zeker dat u de map '{0}' en alle onderliggende items wilt verwijderen?" -03020215="Weet u zeker dat u deze {0} items wilt verwijderen?" -03020216="Bezig met verwijderen..." -03020217="Fout bij het verwijderen van een bestand of map" -03020218="Het systeem kan een bestand met een lang pad niet verplaatsen naar de Prullenbak" - -03020220="Bezig met hernoemen..." -03020221="Fout bij het hernoemen van een bestand of map" -03020222="Bevestig kopiëren van bestand" -03020223="Weet u zeker dat u deze bestanden naar het archief wilt kopiëren" - -03020230="Map maken" -03020231="Naam van de map:" -03020232="Nieuwe map" -03020233="Fout bij het maken van de map" - -03020240="Bestand maken" -03020241="Bestandsnaam:" -03020242="Nieuw bestand" -03020243="Fout bij het maken van het bestand." - -03020250="Selecteren" -03020251="De-selecteren" -03020252="Masker:" - -03020260="Mappen Geschiedenis" - -03020280="Bestand '{0}' is gewijzigd.\nWilt u het bijwerken in het archief?" -03020281="Kan bestand\n'{0}' niet bijwerken." -03020282="Kan de editor niet starten." -03020283="Bezig met openen..." -03020284="Het bestand lijkt op een virus (het bevat veel opeenvolgende spaties in de naam)." - -03020290="Opmerking" -03020291="&Opmerking:" - -030202A0="Systeem" - -03020300="Computer" -03020301="Netwerk" -03020302="Documenten" - -03020400="Toevoegen" -03020401="Uitpakken" -03020402="Testen" - -03020420="Kopiëren" -03020421="Verplaatsen" -03020422="Verwijderen" -03020423="Info" - -03020500="Opsplitsen bestand" -03020501="&Opsplitsen naar:" -03020510="Bezig met opsplitsen..." -03020520="Bevestigen opsplitsen" -03020521="Weet u zeker dat u het bestand wilt opsplitsen in {0} volumes?" -03020522="De volumegrootte moet kleiner zijn dan de grootte van het oorspronkelijke bestand." - -03020600="Bestanden samenvoegen" -03020601="&Samenvoegen naar:" -03020610="Bezig met samenvoegen..." -03020620="Selecteer alleen het eerste bestand." -03020621="Kan het bestand niet herkennen als onderdeel van een gesplitst bestand" -03020622="Kan niet meer dan 1 deel van een gesplitst bestand" - -03020710="Bezig met checksum berekenen..." -03020720="Checksum informatie" -03020721="CRC checksum voor gegevens:" -03020722="CRC checksum voor gegevens en namen:" - -03020800="Bezig met scannen..." - -03020900="Eigenschappen" - -03020A01="De actie kan niet worden uitgevoerd vanuit een folder met een dermate lang pad." -03020A02="U moet 1 bestand selecteren" -03020A03="U moet 1 of meerdere bestanden selecteren" -03020A04="Bestand {0} bestaat reeds" - -; Computer -03031100="Capaciteit" -03031101="Beschikbaar" -03031102="Clustergrootte" -03031103="Label" - -; Network -03031200="Lokale naam" -03031201="Provider" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Geheugengebruik:" -03080002="Inpakken" -03080003="Uitpakken" -03080004="Snelheid" -03080005="Waarde" -03080006="Totale waarde" -03080007="Huidig" -03080008="Resultaat" -03080009="Doorgangen:" -0308000A="Fouten:" -0308000B="CPU-gebruik" -0308000C="Waarde / gebruik" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/nn.txt b/tools/7-Zip/Lang/nn.txt deleted file mode 100644 index 0f72c4aed6..0000000000 --- a/tools/7-Zip/Lang/nn.txt +++ /dev/null @@ -1,496 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.45 -; Translated by Robert Grønning -; -; -; -; - -00000000="Norwegian Nynorsk" -00000001="Norsk Nynorsk" -00000002="20-2" - -; 7-Zip Configuration - -; Title -01000000="7-Zip innstillingar" - -; Info Page -01000100="Om 7-Zip" -01000103="7-Zip er fri programvare. Du kan støtta utviklinga av 7-Zip ved å registrere deg." -01000104="Brukarstøtte" -01000105="Registrering" - -; Folders Page -01000200="Mapper" -01000210="&Arbeidsmappe" -01000211="&Midlertidig mappe" -01000212="&Noverande" -01000213="&Eigendefinert:" -01000214="Berre for flyttbare stasjonar" - -01000281="Oppgje plassering for midlertidige arkiv filer." - -; System Page -01000300="System" -01000301="Legg inn 7-Zip i programmenyen" -01000302="Forgreina programmeny" -01000310="Programmeny val:" - -; Language Page -01000400="Språk" -01000401="Språk:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip kommandoar" -02000103="Opna arkiv" -02000104="Opna valt arkiv." -02000105="Pakk ut filer..." -02000106="Pakk ut filer frå valt arkiv." -02000107="Legg til i arkiv..." -02000108="Legg til utval i arkiv." -02000109="Test arkiv" -0200010A="Testar integriteten til valt arkiv." -0200010B="Pakk ut her" -0200010C="Pakkar ut filer frå valt arkiv til denne mappa." -0200010D="Pakk ut til {0}" -0200010E="Pakkar ut filer til undermappe." -0200010F="Legg til i {0}" -02000110="Legg utval til i arkiv." -02000111="Komprimere og send som epost..." -02000112="Komprimere utval til et arkiv og send det som epost." -02000113="Komprimere til {0} og send som epost" -02000114="Komprimere utval til et arkiv og send det som epost." - -02000140="" -02000141="" - -; Properties -02000203="Bane" -02000204="Namn" -02000205="Fil etternamn" -02000206="Mappe" -02000207="Størrelse" -02000208="Komprimert Størrelse" -02000209="Eigenskapar" -0200020A="Oppretta" -0200020B="Opna" -0200020C="Endra" -0200020D="Solid" -0200020E="Kommentert" -0200020F="Kryptert" -02000210="Delt før" -02000211="Delt etter" -02000212="Ordbok" -02000213="CRC" -02000214="Type" -02000215="Anti" -02000216="Metode" -02000217="Vert OS" -02000218="Filsystem" -02000219="Brukar" -0200021A="Gruppe" -0200021B="Blokkering" -0200021C="Kommentar" -0200021D="Posisjon" -0200021E="Bane prefiks" - -; Status bar -02000301="{0} objekt(ar) valt" -02000302="{0} objekt(ar)" - -02000320="Filer:" -02000321="Mapper:" -02000322="Størrelse:" - -; List Context Menu -02000401="&Kolonner..." - -02000411="&Opna" -02000412="&Pakk ut..." - -; ToolBar -02000501="Pakk ut" - -; Messages -02000601="Dette arkivet manglar støtte for å kunne oppdaterast." -02000602="Kan ikkje oppdatere arkiv {0}" -02000603="Kan ikkje oppretta mappe '{0}'" -02000604="Fila er ikkje eit støtta arkiv." -02000605="Feil" -02000606="For mange gonger" -02000607="Ingen program er tilknytt dette fil etternamnet" -02000608="Ingen feil" -02000609="Kan ikkje opna fila '{0}' som eit arkiv" -0200060A="Kan ikkje opna det krypterte arkivet '{0}'. Feil passord?" - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja til &alt" -02000709="&Nei" -0200070B="N&ei til alt" - -02000710="Avbryt" -02000711="&Avbryt" -02000713="&Lukke" -02000714="Stopp" -02000715="Start på nytt" - -02000720="Hjelp" - -; Extract dialog -02000800="Pakk ut" -02000801="Pakk ut &til:" -02000802="Passord" - -02000810="Bane modus" -02000811="Fulstendig banenamn" -02000812="Noverande banenamn" -02000813="Ingen banenamn" - -02000820="Overskriving modus" -02000821="Bekrefta før overskriving" -02000822="Skriv over utan bekrefting" -02000823="Hopp over eksisterande filer" -02000824="Endra filnamn automatisk" -02000825="Endra filnamn automatisk for eksisterande filer" - -02000830="Filer" -02000831="&Valte filer" -02000832="&Alle filer" - -02000881="Vel ei mappe for ut-pakka filer." - -02000890="Pakkar ut" - -; Overwrite dialog -02000900="Bekrefta overskriving av fil" -02000901="Målmappa inneheld allereie ei behandla fil." -02000902="Vil du overskriva den eksisterande fila" -02000903="med denne?" - -02000911="&Skift filnamn automatisk" - -02000982="{0} byte" -02000983="endra på" - -; Messages dialog -02000A00="Diagnose meldingar" - -02000A80="Melding" - -02000A91="Kompresjonsmetoden er ikkje støtta for '{0}'." -02000A92="Data feil i '{0}'. Fila er øydelagt." -02000A93="CRC feila på '{0}'. Fila er øydelagt." -02000A94="Data feil i den krypterte fila '{0}'. Feil passord?" -02000A95="CRC feila i den krypterte fila '{0}'. Feil passord?" - -; Password dialog -02000B00="Skriv inn passord" -02000B01="Skriv inn passord:" -02000B02="&Vis passord" -02000B03="Skriv inn passordet på nytt:" -02000B10="Passorda er ikkje like" -02000B11="Bruk berre Engelske bokstavar, tal og spesielle teikn (!, #, $, ...) i passordet" -02000B12="Passordet er for langt" - -; Progress dialog -02000C00="Prosess" -02000C01="Tid brukt:" -02000C02="Tid gjenstår:" -02000C03="Størrelse:" -02000C04="Fart:" - -02000C10="&Bakgrunn" -02000C11="&Forgrunn" -02000C12="&Pause" -02000C13="&Hald fram" - -02000C20="Sett på pause" - -02000C30="Er du sikker på du vil avbryte?" - -; Compress dialog -02000D00="Legg til i arkiv" -02000D01="&Arkiv:" -02000D02="&Oppdaterings modus:" -02000D03="Arkiv &format:" -02000D04="Kompresjons &metode:" -02000D05="Opprett eit &Solid arkiv" -02000D06="&Parameter:" -02000D07="Val" -02000D08="Opprett SF&X arkiv" -02000D09="Fleirtråda" -02000D0A="&Krypter filnamn" -02000D0B="Kompresjons &nivå:" -02000D0C="O&rdbok størrelse:" -02000D0D="Or&d størrelse:" -02000D0E="Minnebruk ved kompresjon:" -02000D0F="Minnebruk ved ut-pakking:" -02000D10="Krypter" -02000D11="Krypter metode:" -02000D12="Anntal CPU tråder:" -02000D13="Solid blokk størrelse:" -02000D14="Ikkje-solid" -02000D15="Solid" - -02000D40="Splitt opp i deler, byte:" -02000D41="Feil del-størrelse" -02000D42="Oppgitt del-størrelse: {0} byte.\nEr du sikker på du vil dele arkivet opp i slike deler?" - -02000D81="Lagre" -02000D82="Normal" -02000D83="Maksimum" -02000D84="Rask" -02000D85="Raskast" -02000D86="Ekstrem" - -02000D90="Bla igjennom" - -02000DA1="Legg til og skriv over filer" -02000DA2="Oppdatere og legg til filer" -02000DA3="Frisk opp eksisterande filer" -02000DA4="Synkroniser filer" - -02000DB1="Alle filer" - -02000DC0="Komprimerer" - -; Columns dialog -02000E00="Kolonner" -02000E01="Merk kolonnene du vil visa i denne mappa. Bruk Flytt opp og Flytt ned knappane for å endra plassringen på kolonnene." -02000E02="Den valte kolonna skal vera" -02000E03="punkter &brei." - -02000E10="Flytt &Opp" -02000E11="Flytt &Ned" -02000E12="&Vis" -02000E13="&Gøym" -02000E14="Bruk" - -02000E81="Tittel" -02000E82="Breidde" - -; Testing -02000F90="Testing" - - -; File Manager - -03000000="7-Zip Fil behandlar" - -; Menu -03000102="&Fil" -03000103="&Redigere" -03000104="&Vis" -03000105="Verk&tøy" -03000106="&Hjelp" -03000107="F&avorittar" - -; File -03000210="&Opna" -03000211="Opna &Inni" -03000212="Opna &Utanfor" -03000220="&Vis" -03000221="&Redigere" -03000230="Endra &namn" -03000231="&Kopiere til..." -03000232="&Flytt til..." -03000233="&Slett" -03000240="&Eigenskapar" -03000241="Ko&mmentar" -03000242="Rekna ut kontrollnummer" -03000250="Opprett mappe" -03000251="Opprett fil" -03000260="&Avslutta" -03000270="&Del opp fil..." -03000271="Set saman filer..." - -; Edit -03000310="&Angre" -03000311="&Gjer om" -03000320="Klipp &ut" -03000321="&Kopiere" -03000322="Lim &inn" -03000323="&Slett" -03000330="&Merk alle" -03000331="Fjern alle markeringar" -03000332="&Omvendt markering" -03000333="Marker..." -03000334="Fjern markering..." -03000335="Merk etter type" -03000336="Fjern markering etter type" - -; View -03000410="S&tore ikon" -03000411="S&må ikon" -03000412="&Lista" -03000413="&Detaljar" -03000420="Assortert" -03000430="Opna kjeldemappa" -03000431="Opp eit nivå" -03000432="Mappelogg..." -03000440="&Oppdatere" -03000449="Flat vising" -03000450="&2 felt" -03000451="&Verktøylinjer" -03000460="Arkiv verktøylinje" -03000461="Standard verktøylinjer" -03000462="Store knappar" -03000463="Vis knappetekst" - -; Tools -03000510="&Val..." -03000511="&Yting test" - -; Help -03000610="&Innhold..." -03000620="&Om 7-Zip..." - -; Favorites -03000710="&Legg mappe til i favorittar som" -03000720="Bokmerke" - -; Options Dialog - -03010000="Val" - -; Plugins -03010100="Tillegg" -03010101="&Tillegg:" -03010110="Val..." - -; Edit -03010200="Redigeringsprogram" -03010201="&Redigeringsprogram:" - -; System -03010300="System" -03010302="Forbind 7-Zip med:" -03010310="Tillegg" - -; Settings -03010400="Innstillingar" -03010401="Vis \"..\" element" -03010402="Vis dei ordentlege fil ikona" -03010410="Vis system meny" -03010420="&Merk heile rader" -03010421="Vis &rutenett" -03010430="&Alternativ markerings modus" -03010440="Bruk &store minnesider" - -; Strings - -03020201="Kopiere" -03020202="Flytt" -03020203="Kopiere til:" -03020204="Flytt til:" -03020205="Kopierer..." -03020206="Flyttar..." -03020207="Du kan ikkje flytta eller kopiere element i slike mapper." -03020208="Støttar ikkje handlinga." -03020209="Vel målmappe." - -03020210="Godkjenne sletting av fil" -03020211="Godkjenne sletting av mappe" -03020212="Godkjenne sletting av fleire filer" -03020213="Er du sikker på at du vil sletta '{0}'?" -03020214="Er du sikker på at du vil sletta mappa '{0}' og alt innhold i den?" -03020215="Er du sikker på at du vil sletta desse {0} elementa?" -03020216="Slettar..." -03020217="Feil ved sletting av fil eller mappe" - -03020220="Endrar namn..." -03020221="Feil ved endring av namn på fil eller mappe" -03020222="Godkjenne filkopiering" -03020223="Er du sikker på at du vil kopiere filer til arkiv" - -03020230="Opprett mappe" -03020231="Mappe namn:" -03020232="Ny mappe" -03020233="Feil ved oppretting av mappe" - -03020240="Opprett fil" -03020241="Filnamn:" -03020242="Ny fil" -03020243="Feil ved oppretting av fil" - -03020250="Marker" -03020251="Fjern markering" -03020252="Maske:" - -03020260="Mappe logg" - -03020280="Fila '{0}' blei endra.\nVil du oppdatere den i arkivet?" -03020281="Kan ikkje oppdatere fil\n'{0}'" -03020282="Kan ikkje starta redigeringsprogram." -03020283="Opnar..." - -03020290="Kommentar" -03020291="&Kommentar:" - -030202A0="System" - -03020300="Datamaskin" -03020301="Nettverk" - -03020400="Legg til" -03020401="Pakk ut" -03020402="Test" - -03020420="Kopiere" -03020421="Flytt" -03020422="Slett" -03020423="Informasjon" - -03020500="Del opp fil" -03020501="&Del opp til:" -03020510="Delar opp..." -03020520="Godkjenne oppdeling" -03020521="Er du sikker på at du vil dele opp fila i {0} delar?" -03020522="Størrelsen på delane må vera mindre enn størrelsen på originalfila" - -03020600="Slå saman filer" -03020601="&Slå saman til:" -03020610="Slår saman..." -03020620="Berre vel den første fila" - -03020710="Reknar ut kontrollnummer..." -03020720="Informasjon om kontrollnummer" -03020721="CRC kontrollnummer for data:" -03020722="CRC kontrollnummer for data og namn:" - -03020800="Undersøkjer..." - -; Computer -03031100="Total størrelse" -03031101="Ledig plass" -03031102="Klyngje størrelse" -03031103="Etikett" - -; Network -03031200="Lokalt namn" -03031201="Leverandør" - -; Benchmark Dialog - -03080000="Yting test" -03080001="Minnebruk:" -03080002="Kompresjon" -03080003="Ut-pakking" -03080004="Fart" -03080005="Yting" -03080006="Total yting" -03080007="Noverande" -03080008="Resultat" -03080009="Gonger:" -0308000A="Feil:" -0308000B="CPU bruk" -0308000C="Yting / Bruk" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/pa-in.txt b/tools/7-Zip/Lang/pa-in.txt deleted file mode 100644 index 0884048bb7..0000000000 --- a/tools/7-Zip/Lang/pa-in.txt +++ /dev/null @@ -1,512 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by Gurmeet Singh Kochar -; -; -; -; - -00000000="Punjabi, Indian" -00000001="ਪੰਜਾਬੀ" -00000002="70-1" - -; 7-Zip Configuration - -; Title -01000000="7-ਜ਼ਿੱਪ ਸਰੰਚਨਾ" - -; Info Page -01000100="7-ਜ਼ਿੱਪ ਬਾਰੇ" -01000103="7-ਜ਼ਿੱਪ ਇੱਕ ਮੁਫ਼ਤ ਸਾਫ਼ਟਵੇਅਰ ਹੈ। ਪਰ ਫੇਰ ਵੀ, ਤੁਸੀਂ ਰਜਿਸਟਰ ਕਰਕੇ 7-ਜ਼ਿੱਪ ਦੇ ਵਿਕਾਸ ਵਿੱਚ ਸਮਰਥਨ ਪਾ ਸੱਕਦੇ ਹੋ।\n\nਪੰਜਾਬੀ ਵਿੱਚ ਅਨੁਵਾਦ ਕੀਤਾ (Translation Done By):\nGurmeet Singh Kochar (ਗੁਰਮੀਤ ਸਿੰਘ ਕੋਚਰ)\n" -01000104="ਸਮਰਥਨ" -01000105="ਰਜਿਸਟਰ" - -; Folders Page -01000200="ਫੋਲਡਰ" -01000210="ਵਰਕਿੰਗ ਫੋਲਡਰ (&W)" -01000211="ਸਿਸਟਮ ਆਰਜ਼ੀ (temp) ਫੋਲਡਰ (&S)" -01000212="ਇਸ ਸਮੇਂ ਚੁਣਿਆ (&C)" -01000213="ਹੇਠਾਂ ਦਿੱਤਾ ਗਿਆ (&S):" -01000214="ਸਿਰਫ਼ ਹਟਾਈ ਜਾ ਸੱਕਨ ਵਾਲੀਆਂ ਡਰਾਈਵ ਲਈ ਵਰਤੋਂ ਕਰੋ" - -01000281="ਆਰਜ਼ੀ ਆਕਾਈਵ ਫਾਇਲਾਂ ਲਈ ਟਿਕਾਣਾ ਦੱਸੋ।" - -; System Page -01000300="ਸਿਸਟਮ" -01000301="ਸ਼ੈੱਲ ਕੰਨਟੈਕਸਟ ਮੇਨੂੰ ਨਾਲ 7-ਜ਼ਿੱਪ ਨੂੰ ਏਕੀਕਿਰਤ ਕਰੋ" -01000302="ਕੈਸਕੇਡਡ ਕੰਨਟੈਕਸਟ ਮੇਨੂੰ" -01000310="ਕੰਨਟੈਕਸਟ ਮੇਨੂੰ ਆਈਟਮਾਂ:" - -; Language Page -01000400="ਭਾਸ਼ਾ" -01000401="ਭਾਸ਼ਾ:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-ਜ਼ਿੱਪ" -02000102="7-ਜ਼ਿੱਪ ਕਮਾਂਡਾਂ" -02000103="ਆਕਾਈਵ ਖੋਲੋ" -02000104="ਚੁਣੇ ਆਕਾਈਵ ਨੂੰ ਖੋਲੇਣ ਲਈ।" -02000105="ਫਾਇਲਾਂ ਕੱਡੋ..." -02000106="ਚੁਣੇ ਆਕਾਈਵ ਵਿੱਚੋਂ ਫਾਇਲਾਂ ਕੱਡਣ ਲਈ।" -02000107="ਆਕਾਈਵ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰੋ..." -02000108="ਚੁਣੀਆਂ ਆਈਟਮਾਂ ਆਕਾਈਵ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰਨ ਲਈ।" -02000109="ਆਕਾਈਵ ਪਰਖੋ" -0200010A="ਚੁਣੇ ਆਕਾਈਵ ਦੀ ਅਖੰਡਤਾ ਪਰਖਨ ਲਈ।" -0200010B="ਫਾਇਲਾਂ ਇੱਥੇ ਕੱਡੋ" -0200010C="ਇਸ ਵੇਲੇ ਦੇ ਫੋਲਡਰ ਵਿੱਚ ਚੁਣੇ ਆਕਾਈਵ ਵਿੱਚੋਂ ਫਾਇਲਾਂ ਕੱਡਣ ਲਈ।" -0200010D="{0} ਵਿੱਚ ਕੱਡੋ" -0200010E="ਉਪ-ਫੋਲਡਰ ਵਿੱਚ ਫਾਇਲਾਂ ਕੱਡਣ ਲਈ।" -0200010F="{0} ਵਿੱਚ ਸ਼ਾਮਲ ਕਰੋ" -02000110="ਚੁਣੀਆਂ ਆਈਟਮਾਂ ਨੂੰ ਆਕਾਈਵ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰਨ ਲਈ।" -02000111="ਨਪੀੜੋ ਅਤੇ ਈਮੇਲ ਕਰੋ..." -02000112="ਚੁਣੀਆਂ ਆਈਟਮਾਂ ਨੂੰ ਆਕਾਈਵ ਵਿੱਚ ਨਪੀੜਨ ਅਤੇ ਆਕਾਈਵ ਨੂੰ ਈਮੇਲ ਰਾਂਹੀ ਭੇਜਨ ਲਈ।" -02000113="{0} ਵਿੱਚ ਨਪੀੜੋ ਅਤੇ ਈਮੇਲ ਕਰੋ" -02000114="ਚੁਣੀਆਂ ਆਈਟਮਾਂ ਨੂੰ ਆਕਾਈਵ ਵਿੱਚ ਨਪੀੜਨ ਅਤੇ ਆਕਾਈਵ ਨੂੰ ਈਮੇਲ ਰਾਂਹੀ ਭੇਜਨ ਲਈ।" - -02000140="<ਫੋਲਡਰ>" -02000141="<ਆਕਾਈਵ>" - -; Properties -02000203="ਮਾਰਗ" -02000204="ਨਾਂ" -02000205="ਐਕਸਟੈਂਸ਼ਨ" -02000206="ਫੋਲਡਰ" -02000207="ਸਾਈਜ਼" -02000208="ਪੈਕਡ ਸਾਈਜ਼" -02000209="ਲੱਛਨ" -0200020A="ਬਣਤਰ ਸਮਾਂ" -0200020B="ਪਹੁੰਚ ਸਮਾਂ" -0200020C="ਸੋਧ ਸਮਾਂ" -0200020D="ਠੋਸ" -0200020E="ਟਿੱਪਣੀ" -0200020F="ਐਨਕ੍ਰਿਪਟਡ" -02000210="Split Before" -02000211="Split After" -02000212="ਡਿਕਸ਼ਨਰੀ" -02000213="ਸੀ-ਆਰ-ਸੀ (CRC)" -02000214="ਕਿਸਮ" -02000215="ਐਂਟੀ (Anti)" -02000216="ਢੰਗ" -02000217="ਮੇਜ਼ਬਾਨ ਔ-ਐੱਸ" -02000218="ਫਾਇਲ ਸਿਸਟਮ" -02000219="ਯੂਜ਼ਰ" -0200021A="ਸਮੂਹ" -0200021B="ਬਲੋਕ" -0200021C="ਟਿੱਪਣੀ" -0200021D="ਸਥਿੱਤੀ" -0200021E="ਮਾਰਗ ਅਗੇਤਰ" -0200021F="ਫੋਲਡਰ" -02000220="ਫਾਇਲਾਂ" -02000221="ਵਰਜਨ" -02000222="ਵੋਲੁੱਮ" -02000223="ਮਲਟੀਵੋਲੁੱਮ" -02000224="ਔਫ਼ਸੈਟ" -02000225="ਲਿੰਕ" -02000226="ਬਲੋਕ" -02000227="ਵੋਲੁੱਮ" - -; Status bar -02000301="ਚੁਣੇ ਪਦਾਰਥ: {0}" -02000302="{0} ਪਦਾਰਥ" - -02000320="ਫਾਇਲਾਂ:" -02000321="ਫੋਲਡਰ:" -02000322="ਸਾਈਜ਼:" -02000323="ਨਪੀੜਤ ਸਾਈਜ਼:" -02000324="ਆਕਾਈਵਾਂ:" - -; List Context Menu -02000401="ਕਾਲਮ (&C)..." - -02000411="ਖੋਲੋ (&O)" -02000412="ਕੱਡੋ (&E)..." - -; ToolBar -02000501="ਕੱਡੋ" - -; Messages -02000601="ਅੱਪਡੇਟ ਔਪਰੇਸ਼ਨ ਇਸ ਆਕਾਈਵ ਲਈ ਸਹਿਯੋਗੀ ਨਹੀਂ ਹਨ।" -02000602="{0} ਆਕਾਈਵ ਅੱਪਡੇਟ ਨਹੀਂ ਕੀਤੀ ਜਾ ਸੱਕੀ" -02000603="'{0}' ਫੋਲਡਰ ਨਹੀਂ ਬਣਾਇਆ ਜਾ ਸੱਕਿਆ" -02000604="ਫਾਇਲ ਇੱਕ ਸਹਿਯੋਗੀ ਆਕਾਈਵ ਨਹੀਂ ਹੈ।" -02000605="ਸਮੱਸਿਆ" -02000606="ਬਹੁੱਤ ਸਾਰੀਆਂ ਆਈਟਮਾਂ" -02000607="ਦਿੱਤੀ ਗਈ ਫਾਇਲ ਐਕਸਟੈਂਸ਼ਨ ਨਾਲ ਕੋਈ ਵੀ ਕਾਰਜ ਨਹੀਂ ਜੁੜਿਆ ਹੋਇਆ ਹੈ।" -02000608="ਕੋਈ ਸਮੱਸਿਆਵਾਂ ਨਹੀਂ ਹਨ" -02000609="'{0}' ਫਾਇਲ ਨੂੰ ਆਕਾਈਵ ਤਰ੍ਹਾਂ ਨਹੀਂ ਖੋਲਿਆ ਜਾ ਸੱਕਿਆ" -0200060A="'{0}' ਐਨਕ੍ਰਿਪਟਡ ਆਕਾਈਵ ਨਹੀਂ ਖੋਲਿਆ ਜਾ ਸੱਕਿਆ। ਗਲ਼ਤ ਪਾਸਵਰਡ?" - -; Dialogs -02000702="ਠੀਕ ਹੈ" -02000705="ਹਾਂ (&Y)" -02000707="ਸਾਰਿਆਂ ਲਈ ਹਾਂ (&A)" -02000709="ਨਹੀਂ (&N)" -0200070B="ਸਾਰਿਆਂ ਲਈ ਨਹੀਂ (&l)" - -02000710="ਰੱਦ ਕਰੋ" -02000711="ਰੱਦ ਕਰੋ (&C)" -02000713="ਬੰਦ ਕਰੋ (&C)" -02000714="ਰੁਕੋ" -02000715="ਮੁੜ ਚਾਲੂ ਕਰੋ" - -02000720="ਮੱਦਦ" - -; Extract dialog -02000800="ਕੱਡੋ" -02000801="ਇੱਥੇ ਕੱਡੋ (&x):" -02000802="ਪਾਸਵਰਡ" - -02000810="ਮਾਰਗ ਢੰਗ" -02000811="ਪੂਰੇ ਮਾਰਗ ਨਾਂ" -02000812="ਇਸ ਵੇਲੇ ਦੇ ਮਾਰਗ ਨਾਂ" -02000813="ਕੋਈ ਮਾਰਗ ਨਾਂ ਨਹੀਂ" - -02000820="ਉਪਰੀਲੇਖਨ ਢੰਗ" -02000821="ਉਪਰੀਲੇਖਨ ਤੋਂ ਪਹਿਲਾਂ ਤਸਦੀਕ" -02000822="ਬਿਨ੍ਹਾਂ ਤਸਦੀਕ ਉਪਰੀਲੇਖਨ" -02000823="ਮੌਜੂਦਾ ਫਾਇਲਾਂ ਨਾਂ ਕੱਡੋ" -02000824="ਆਪੇ ਨਾਂ ਬਦਲ ਦਿਓ" -02000825="ਮੌਜੂਦਾ ਫਾਇਲਾਂ ਦਾ ਆਪੇ ਨਾਂ ਬਦਲ ਦਿਓ" - -02000830="ਫਾਇਲਾਂ" -02000831="ਚੁਣੀਆਂ ਫਾਇਲਾਂ (&S)" -02000832="ਸਾਰੀਆਂ ਫਾਇਲਾਂ (&A)" - -02000881="ਕੱਡੀਆਂ ਜਾਉਣ ਵਾਲੀਆਂ ਫਾਇਲਾਂ ਲਈ ਟਿਕਾਣਾ ਦੱਸੋ।" - -02000890="ਕੱਡੀਆਂ ਜਾ ਰਹੀਆਂ ਹਨ" - -; Overwrite dialog -02000900="ਫਾਇਲ ਬਦਲਨ ਦੀ ਤਸਦੀਕ" -02000901="ਕਾਰਵਾਈ ਕੀਤੀ ਜਾਉਂਦੀ ਫਾਇਲ ਨਿਯਤ ਫੋਲਡਰ ਵਿੱਚ ਪਹਿਲਾਂ ਹੀ ਮੌਜੂਦ ਹੈ।" -02000902="ਕੀ ਤੁਸੀਂ ਮੌਜੂਦਾ ਫਾਇਲ ਨੂੰ" -02000903="ਇਸ ਫਾਇਲ ਨਾਲ ਬਦਲਨਾ ਚਾਹੋਗੇ?" - -02000911="ਆਪੇ ਨਾਂ ਬਦਲੀ ਕਰੋ (&u)" - -02000982="{0} ਬਾਈਟ" -02000983="ਸੋਧ ਸਮਾਂ" - -; Messages dialog -02000A00="ਡਾਈਗਨੋਸਟਿੱਕ ਸੰਦੇਸ਼" - -02000A80="ਸੰਦੇਸ਼" - -02000A91="'{0}' ਲਈ ਨਪੀੜਨ ਢੰਗ ਸਹਿਯੋਗੀ ਨਹੀਂ।" -02000A92="'{0}' ਵਿੱਚ ਡਾਟਾ ਸਮੱਸਿਆ। ਫਾਇਲ ਟੁੱਟੀ ਹੋਈ ਹੈ।" -02000A93="'{0}' ਵਿੱਚ ਸੀ-ਆਰ-ਸੀ ਅਸਫ਼ਲ ਰਿਹਾ। ਫਾਇਲ ਟੁੱਟੀ ਹੋਈ ਹੈ।" -02000A94="'{0}' ਐਨਕ੍ਰਿਪਟਡ ਫਾਇਲ ਵਿੱਚ ਡਾਟਾ ਸਮੱਸਿਆ। ਗਲ਼ਤ ਪਾਸਵਰਡ?" -02000A95="'{0}' ਐਨਕ੍ਰਿਪਟਡ ਫਾਇਲ ਵਿੱਚ ਸੀ-ਆਰ-ਸੀ ਅਸਫ਼ਲ ਰਿਹਾ। ਗਲ਼ਤ ਪਾਸਵਰਡ?" - -; Password dialog -02000B00="ਪਾਸਵਰਡ ਭਰੋ" -02000B01="ਪਾਸਵਰਡ ਭਰੋ:" -02000B02="ਪਾਸਵਰਡ ਵਿਖਾਓ (&S)" -02000B03="ਪਾਸਵਰਡ ਮੁੜ ਭਰੋ:" -02000B10="ਪਾਸਵਰਡ ਮੇਲ ਨਹੀਂ ਖਾਂਦੇ" -02000B11="ਪਾਸਵਰਡ ਲਈ ਸਿਰਫ਼ ਅੰਗ੍ਰੇਜ਼ੀ ਅੱਖਰ, ਅੰਕ, ਅਤੇ ਖ਼ਾਸ ਅੱਖਰਾਂ (!, #, $, ...) ਦੀ ਹੀ ਵਰਤੋਂ ਕਰੋ" -02000B12="ਪਾਸਵਰਡ ਬਹੁੱਤ ਲੰਬਾ ਹੈ" - -; Progress dialog -02000C00="ਕਾਰਜ" -02000C01="ਬੀਤਿਆ ਸਮਾਂ:" -02000C02="ਰਹਿੰਦਾ ਸਮਾਂ:" -02000C03="ਕੁੱਲ ਸਾਈਜ਼:" -02000C04="ਗਤੀ:" -02000C05="ਨਿਬੇੜੀਆਂ ਬਾਈਟ:" -02000C06="ਨਪੀੜਨ ਅਨੁਪਾਤ:" - -02000C10="ਬੈਕਗਰਾਉਂਡ (&B)" -02000C11="ਫੋਰਗਰਾਉਂਡ (&F)" -02000C12="ਪੋਜ਼ (&P)" -02000C13="ਜਾਰੀ ਕਰੋ (&C)" - -02000C20="ਪੋਜ਼ ਹੋਇਆ" - -02000C30="ਕੀ ਤੁਸੀਂ ਨਿਸ਼ਚਿੱਤ ਹੀ ਰੱਦ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ?" - -; Compress dialog -02000D00="ਆਕਾਈਵ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰੋ" -02000D01="ਆਕਾਈਵ (&A):" -02000D02="ਅੱਪਡੇਟ ਢੰਗ (&U):" -02000D03="ਆਕਾਈਵ ਫੌਰਮੈਟ (&f):" -02000D04="ਨਪੀੜਨ ਢੰਗ (&m):" -02000D05="ਠੋਸ ਆਕਾਈਵ ਬਣਾਓ (&S)" -02000D06="ਪੈਰਾਮੀਟਰ (&P):" -02000D07="ਚੋਣਾਂ" -02000D08="SF&X ਆਕਾਈਵ ਬਣਾਓ" -02000D09="ਮਲਟੀ-ਥਰੈਡਿੰਗ" -02000D0A="ਫਾਇਲਾਂ ਦੇ ਨਾਂ ਐਨਕ੍ਰਿਪਟ ਕਰੋ (&n)" -02000D0B="ਨਪੀੜਨ ਪੱਧਰ (&l):" -02000D0C="ਡਿਕਸ਼ਨਰੀ ਸਾਈਜ਼ (&D):" -02000D0D="ਵਰਡ ਸਾਈਜ਼(&W):" -02000D0E="ਨਪੀੜਨ ਲਈ ਮੈਮੋਰੀ ਦੀ ਵਰਤੋਂ:" -02000D0F="ਆਕਾਈਵ ਖੋਲਨ ਲਈ ਮੈਮੋਰੀ ਦੀ ਵਰਤੋਂ:" -02000D10="ਐਨਕ੍ਰਿਪਸ਼ਨ" -02000D11="ਐਨਕ੍ਰਿਪਸ਼ਨ ਢੰਗ:" -02000D12="ਸੀ-ਪੀ-ਯੂ ਥਰੈੱਡ ਗਿਣਤੀ:" -02000D13="ਠੋਸ ਬਲੋਕ ਸਾਈਜ਼:" -02000D14="ਨਾ-ਠੋਸ" -02000D15="ਠੋਸ" -02000D16="ਵਰਤੀਆਂ ਜਾਉਂਦੀਆਂ ਫਾਇਲਾਂ ਨੂੰ ਵੀ ਨਪੀੜੋ" - -02000D40="ਵੋਲੁੱਮਾਂ ਵਿੱਚ ਵੰਡੋ, ਬਾਈਟ (&v):" -02000D41="ਵੋਲੁੱਮ ਸਾਈਜ਼ ਗਲ਼ਤ ਹੈ" -02000D42="ਦਿੱਤਾ ਗਿਆ ਵੋਲੁੱਮ ਸਾਈਜ਼: {0} ਬਾਈਟ।\nਕੀ ਤੁਸੀਂ ਨਿਸ਼ਚਿੱਤ ਆਕਾਈਵ ਨੂੰ ਦਿੱਤੇ ਗਏ ਵੋਲੁੱਮਾਂ ਵਿੱਚ ਵੰਡਣਾ ਚਾਹੁੰਦੇ ਹੋ?" - -02000D81="ਸਿਰਫ਼ ਇਕੱਤਰਤਾ" -02000D82="ਆਮ" -02000D83="ਵੱਧੋਂ ਵੱਧ" -02000D84="ਤੇਜ਼" -02000D85="ਬਹੁੱਤ ਤੇਜ਼" -02000D86="ਸਭ ਤੋਂ ਵੱਧ" - -02000D90="ਬਰਾਊਜ਼" - -02000DA1="ਫਾਇਲਾਂ ਸ਼ਾਮਲ ਕਰੋ ਅਤੇ ਬਦਲੋ" -02000DA2="ਫਾਇਲਾਂ ਸ਼ਾਮਲ ਅਤੇ ਅੱਪਡੇਟ ਕਰੋ" -02000DA3="ਮੌਜੂਦਾ ਫਾਇਲਾਂ ਤਾਜ਼ਾ ਕਰੋ" -02000DA4="ਫਾਇਲਾਂ ਸਮਕਾਲਵਰਤੀ ਕਰੋ" - -02000DB1="ਸਾਰੀਆਂ ਫਾਇਲਾਂ" - -02000DC0="ਨਪੀੜਨ ਕਾਰਜ ਚੱਲ ਰਿਹਾ ਹੈ" - -; Columns dialog -02000E00="ਕਾਲਮ" -02000E01="ਉਹ ਕਾਲਮ ਚੁਣੋ ਜਿਹੜੇ ਤੁਸੀਂ ਇਸ ਫੋਲਡਰ ਵਿੱਚ ਵੇਖਣਾ ਚਾਹੁੰਦੇ ਹੋ। 'ਇੱਕ ਉੱਪਰ ਕਰੋ' ਅਤੇ 'ਇੱਕ ਨੀਚੇ ਕਰੋ' ਬਟਨਾਂ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਕਾਲਮ ਮੁੜ ਵਿਵੱਸਥਾ ਕਰ ਸੱਕਦੇ ਹੋ।" -02000E02="ਚੁਣਿਆ ਗਿਆ ਕਾਲਮ" -02000E03="ਪਿਕਸਲ ਚੌੜਾ ਹੋਏਗਾ (&w)।" - -02000E10="ਇੱਕ ਉੱਪਰ ਕਰੋ (&U)" -02000E11="ਇੱਕ ਨੀਚੇ ਕਰੋ (&D)" -02000E12="ਵਿਖਾਓ (&S)" -02000E13="ਛੁਪਾਓ (&H)" -02000E14="ਸੈਟ" - -02000E81="ਸ਼ੀਰਸ਼ਕ" -02000E82="ਚੁੜਾਈ" - -; Testing -02000F90="ਪਰਖ ਚੱਲ ਰਹੀ ਹੈ" - - -; File Manager - -03000000="7-ਜ਼ਿੱਪ ਫਾਇਲ ਮਨੇਜਰ" - -; Menu -03000102="ਫਾਇਲ (&F)" -03000103="ਸੋਧ (&E)" -03000104="ਵੇਖੋ (&V)" -03000105="ਸੰਧ (&T)" -03000106="ਮੱਦਦ (&H)" -03000107="ਪਸੰਦੀਦਾ (&a)" - -; File -03000210="ਖੋਲੋ (&O)" -03000211="ਅੰਦਰ ਖੋਲੋ (&I)" -03000212="ਬਾਹਰ ਖੋਲੋ (&u)" -03000220="ਵਿਖਾਓ (&V)" -03000221="ਸੋਧ ਕਰੋ (&E)" -03000230="ਨਾਂ ਬਦਲੋ (&m)" -03000231="ਨਵੇਂ ਟਿਕਾਣੇ ਤੇ ਨਕਲ ਉਤਾਰੋ (&C)..." -03000232="ਨਵੇਂ ਟਿਕਾਣੇ ਤੇ ਭੇਜੋ (&M)..." -03000233="ਹਟਾਓ (&D)" -03000240="ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ (&r)" -03000241="ਟਿੱਪਣੀ (&n)" -03000242="ਚੈਕਸੱਮ ਗਣਨਾ ਕਰੋ" -03000250="ਫੋਲਡਰ ਬਣਾਓ" -03000251="ਫਾਇਲ ਬਣਾਓ" -03000260="ਬਾਹਰ ਨਿਕਲੋ (&x)" -03000270="ਫਾਇਲ ਹਿੱਸਿਆਂ ਵਿੱਚ ਵੰਡੋ (&S)..." -03000271="ਫਾਇਲ ਦੇ ਹਿੱਸੇ ਜੋੜੋ (&b)..." - -; Edit -03000310="ਆਖਿਰੀ ਕਾਰਵਾਈ ਨਕਾਰੋ (&U)" -03000311="ਨਕਾਰੀ ਕਾਰਵਾਈ ਮੁੜ ਕਰੋ (&R)" -03000320="ਕੱਟੋ (&t)" -03000321="ਨਕਲ ਉਤਾਰੋ (&C)" -03000322="ਚੇਪੋ (&P)" -03000323="ਹਟਾਓ (&D)" -03000330="ਸਭ ਚੁਣੋ (&A)" -03000331="ਸਭ ਚੋਣ ਰੱਦ ਕਰੋ" -03000332="ਉਲਟ ਚੋਣ ਕਰੋ (&I)" -03000333="ਚੁਣੋ..." -03000334="ਚੋਣ ਰੱਦ ਕਰੋ..." -03000335="ਕਿਸਮ ਨਾਲ ਚੁਣੋ ਕਰੋ" -03000336="ਕਿਸਮ ਨਾਲ ਚੋਣ ਰੱਦ ਕਰੋ" - -; View -03000410="ਵੱਡੇ ਆਈਕਾਨ (&g)" -03000411="ਛੋਟੇ ਆਈਕਾਨ (&m)" -03000412="ਸੂਚੀ (&L)" -03000413="ਵੇਰਵੇ ਸਹਿਤ (&D)" -03000420="ਨਾ ਕ੍ਰਮ-ਬੱਧ" -03000430="ਰੂਟ ਫੋਲਡਰ ਖੋਲੋ" -03000431="ਇੱਕ ਪੱਧਰ ਉੱਤੇ" -03000432="ਫੋਲਡਰ ਅਤੀਤ..." -03000440="ਤਾਜ਼ਾ ਕਰੋ(&R)" -03000449="ਫਲੈਟ ਦ੍ਰਿਸ਼" -03000450="&2 ਪੈਨਲ" -03000451="ਟੂਲਬਾਰ (&T)" -03000460="ਆਕਾਈਵ ਟੂਲਬਾਰ" -03000461="ਸਧਾਰਨ ਟੂਲਬਾਰ" -03000462="ਵੱਡੇ ਬਟਨ" -03000463="ਬਟਨ ਟੈਕਸਟ ਵਿਖਾਓ" - -; Tools -03000510="ਚੋਣਾਂ (&O)..." -03000511="ਬੈਂਚਮਾਰਕ (&B)" - -; Help -03000610="ਵਿਸ਼ਾ ਸੂਚੀ (&C)..." -03000620="7-ਜ਼ਿੱਪ ਬਾਰੇ (&A)..." - -; Favorites -03000710="ਫੋਲਡਰ ਪਸੰਦੀਦਾ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰੋ (&A)" -03000720="ਬੁੱਕਮਾਰਕ" - -; Options Dialog - -03010000="ਚੋਣਾਂ" - -; Plugins -03010100="ਪਲੱਗ-ਇੰਨ" -03010101="ਪਲੱਗ-ਇੰਨ (&P):" -03010110="ਚੋਣਾਂ..." - -; Edit -03010200="ਐਡੀਟਰ" -03010201="ਟੈਕਸਟ ਐਡੀਟਰ (&E):" - -; System -03010300="ਸਿਸਟਮ" -03010302="7-ਜ਼ਿੱਪ ਨਾਲ ਹੇਠਾਂ ਦਿੱਤੇ ਫਾਇਲ ਐਕਸਟੈਂਸ਼ਨ ਜੋੜੋ:" -03010310="ਪਲੱਗ-ਇੰਨ" - -; Settings -03010400="ਸੈਟਿੰਗ" -03010401="\"..\" ਆਈਟਮ ਵਿਖਾਓ" -03010402="ਅਸਲੀ ਫਾਇਲ ਆਈਕਾਨ ਵਿਖਾਓ" -03010410="ਸਿਸਟਮ ਮੇਨੂੰ ਵਿਖਾਓ" -03010420="ਪੂਰੀ ਕਤਾਰ ਚੁਣੋ (&F)" -03010421="ਗ੍ਰਿਡ ਲਾਈਨਾਂ ਵਿਖਾਓ (&g)" -03010430="ਵਿਕਲਪਕ ਚੁਣਾਓ ਢੰਗ (&A)" -03010440="ਵੱਡੇ ਮੈਮੋਰੀ ਪੇਜ ਵਰਤੋ (&l)" - -; Strings - -03020201="ਨਵੇਂ ਟਿਕਾਣੇ ਤੇ ਨਕਲ ਉਤਾਰੋ" -03020202="ਨਵੇਂ ਟਿਕਾਣੇ ਤੇ ਭੇਜੋ" -03020203="ਹੇਠਾਂ ਦਿੱਤੇ ਟਿਕਾਣੇ ਤੇ ਨਕਲ ਉਤਾਰੋ:" -03020204="ਹੇਠਾਂ ਦਿੱਤੇ ਟਿਕਾਣੇ ਤੇ ਭੇਜੋ:" -03020205="ਨਕਲ ਉਤਾਰੀ ਜਾ ਰਹੀ ਹੈ..." -03020206="ਭੇਜਿਆ ਜਾ ਰਿਹਾ ਹੈ..." -03020207="ਇਹੋ ਜਿਹੇ ਫੋਲਡਰਾਂ ਲਈ ਤੁਸੀਂ ਆਈਟਮਾਂ ਨੂੰ ਨਵੇਂ ਟਿਕਾਣੇ ਤੇ ਨਾਂ ਹੀ ਭੇਜ ਸੱਕਦੇ ਹੋ ਨਾਂ ਨਕਲ ਉਤਾਰ ਸੱਕਦੇ ਹੋ।" -03020208="ਕਾਰਵਾਈ ਸਹਿਯੋਗੀ ਨਹੀਂ ਹੈ।" -03020209="ਨਿਯਤ ਫੋਲਡਰ ਚੁਣੋ" - -03020210="ਫਾਇਲ ਹਟਾਉਣ ਦੀ ਤਸਦੀਕ" -03020211="ਫੋਲਡਰ ਹਟਾਉਣ ਦੀ ਤਸਦੀਕ" -03020212="ਬਹੁ-ਫਾਈਲਾਂ ਹਟਾਉਣ ਦੀ ਤਸਦੀਕ" -03020213="'{0}' ਨੂੰ ਹਟਾਉਣਾ ਚਾਹੁੰਦੇ ਹੋ?" -03020214="ਕੀ ਤੁਸੀਂ ਨਿਸ਼ਚਿੱਤ ਫੋਲਡਰ '{0}' ਅਤੇ ਉਸਦੇ ਵਿੱਚਲੀਆਂ ਆਈਟਮਾਂ ਨੂੰ ਹਟਾਉਣਾ ਚਾਹੁੰਦੇ ਹੋ?" -03020215="ਕੀ ਤੁਸੀਂ ਨਿਸ਼ਚਿੱਤ ਇਨ੍ਹਾਂ {0} ਆਈਟਮਾਂ ਨੂੰ ਹਟਾਉਣਾ ਚਾਹੁੰਦੇ ਹੋ?" -03020216="ਹਟਾਉਣ ਦੀ ਕਾਰਵਾਈ ਚੱਲ ਰਹੀ ਹੈ..." -03020217="ਫਾਇਲ ਜਾਂ ਫੋਲਡਰ ਹਟਾਉਣ ਵਿੱਚ ਸਮੱਸਿਆ" - -03020220="ਨਾਂ ਬਦਲਿਆ ਜਾ ਰਿਹਾ ਹੈ..." -03020221="ਫਾਇਲ ਜਾਂ ਫੋਲਡਰ ਦਾ ਨਾਂ ਬਦਲਣ ਵਿੱਚ ਸਮੱਸਿਆ" -03020222="ਫਾਇਲ ਦੀ ਨਕਲ ਉਤਾਰਣ ਦੀ ਤਸਦੀਕ" -03020223="ਕੀ ਤੁਸੀਂ ਨਿਸ਼ਚਿੱਤ ਫਾਇਲਾਂ ਦੀ ਆਕਾਈਵ ਵਿੱਚ ਨਕਲ ਉਤਾਰਨਾ ਚਾਹੁੰਦੇ ਹੋ" - -03020230="ਫੋਲਡਰ ਬਣਾਓ" -03020231="ਫੋਲਡਰ ਨਾਂ:" -03020232="ਨਵਾਂ ਫੋਲਡਰ" -03020233="ਫੋਲਡਰ ਬਨਾਉਣ ਵਿੱਚ ਸਮੱਸਿਆ" - -03020240="ਫਾਇਲ ਬਣਾਓ" -03020241="ਫਾਇਲ ਨਾਂ:" -03020242="ਨਵੀਂ ਫਾਇਲ" -03020243="ਫਾਇਲ ਬਨਾਉਣ ਵਿੱਚ ਸਮੱਸਿਆ" - -03020250="ਚੁਣੋ" -03020251="ਚੋਣ ਰੱਦ ਕਰੋ" -03020252="ਮਾਸਕ:" - -03020260="ਫੋਲਡਰ ਅਤੀਤ" - -03020280="'{0}' ਫਾਇਲ ਸੋਧ ਦਿੱਤੀ ਗਈ ਹੈ।\nਕੀ ਤੁਸੀਂ ਉਸਨੂੰ ਆਕਾਈਵ ਵਿੱਚ ਅੱਪਡੇਟ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ?" -03020281="ਫਾਇਲ ਅੱਪਡੇਟ ਨਹੀਂ ਕੀਤੀ ਜਾ ਸੱਕੀ\n'{0}'" -03020282="ਐਡੀਟਰ ਚਾਲੂ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸੱਕਿਆ।" -03020283="ਖੋਲੀ ਜਾ ਰਹੀ ਹੈ..." - -03020290="ਟਿੱਪਣੀ" -03020291="ਟਿੱਪਣੀ (&C):" - -030202A0="ਸਿਸਟਮ" - -03020300="ਕੰਪਿਊਟਰ" -03020301="ਨੈੱਟਵਰਕ" - -03020400="ਸ਼ਾਮਲ ਕਰੋ" -03020401="ਕੱਡੋ" -03020402="ਪਰਖ ਕਰੋ" - -03020420="ਨਕਲ ਉਤਾਰੋ" -03020421="ਨਵੇਂ ਟਿਕਾਣੇ ਤੇ ਭੇਜੋ" -03020422="ਹਟਾਓ" -03020423="ਜਾਣਕਾਰੀ" - -03020500="ਫਾਇਲ ਹਿੱਸਿਆਂ ਵਿੱਚ ਵੰਡੋ" -03020501="ਹੇਠਾਂ ਦਿੱਤੇ ਟਿਕਾਣੇ ਉੱਤੇ ਹਿੱਸੇ ਕਰੋ (&S):" -03020510="ਫਾਇਲ ਹਿੱਸਿਆਂ ਵਿੱਚ ਵੰਡੀ ਜਾ ਰਹੀ ਹੈ..." -03020520="ਹਿੱਸੇ ਕਰਨ ਦੀ ਤਸਦੀਕ" -03020521="ਕੀ ਤੁਸੀਂ ਨਿਸ਼ਚਿੱਤ ਫਾਇਲ ਦੇ {0} ਵੋਲੁੱਮਾਂ ਵਿੱਚ ਹਿੱਸੇ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ?" -03020522="ਵੋਲੁੱਮ ਸਾਈਜ਼ ਅਸਲੀ ਫਾਇਲ ਦੇ ਸਾਈਜ਼ ਤੋਂ ਛੋਟਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ" - -03020600="ਫਾਇਲ ਦੇ ਹਿੱਸੇ ਜੋੜੋ" -03020601="ਹੇਠਾਂ ਦਿੱਤੇ ਟਿਕਾਣੇ ਉੱਤੇ ਹਿੱਸੇ ਜੋੜੋ(&C):" -03020610="ਹਿੱਸੇ ਜੋੜੇ ਜਾ ਰਹੇ ਹਨ..." -03020620="ਸਿਰਫ਼ ਪਹਿਲੀ ਫਾਇਲ ਚੁਣੋ" - -03020710="ਚੈਕਸੱਮ ਗਣਨਾ ਕੀਤੀ ਜਾ ਰਹੀ ਹੈ..." -03020720="ਚੈਕਸੱਮ ਜਾਣਕਾਰੀ" -03020721="ਡਾਟਾ ਲਈ ਸੀ-ਆਰ-ਸੀ ਚੈਕਸੱਮ:" -03020722="ਡਾਟਾ ਅਤੇ ਨਾਮਾਂ ਲਈ ਸੀ-ਆਰ-ਸੀ ਚੈਕਸੱਮ:" - -03020800="ਸਕੈਨ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ..." - -03020900="ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ" - -; Computer -03031100="ਕੁੱਲ ਸਾਈਜ਼" -03031101="ਖ਼ਾਲੀ ਥਾਂ" -03031102="ਕਲੱਸਟਰ ਸਾਈਜ਼" -03031103="ਲੇਬਲ" - -; Network -03031200="ਸਥਾਨਕ ਨਾਂ" -03031201="ਉਪਲੱਬਧ ਕਰਤਾ" - -; Benchmark Dialog - -03080000="ਬੈਂਚਮਾਰਕ" -03080001="ਮੈਮੋਰੀ ਵਰਤੋਂ:" -03080002="ਨਪੀੜਨ ਕਾਰਜ" -03080003="ਖੋਲਣ ਕਾਰਜ" -03080004="ਗਤੀ" -03080005="ਦਰਜ਼ਾ" -03080006="ਕੁੱਲ ਦਰਜ਼ਾ" -03080007="ਇਸ ਸਮੇਂ" -03080008="ਰੀਸੱਲਟਿੰਗ" -03080009="ਪਾਸ:" -0308000A="ਸਮੱਸਿਆਵਾਂ:" -0308000B="ਸੀ-ਪੀ-ਯੂ ਵਰਤੋਂ" -0308000C="ਦਰਜ਼ਾ / ਵਰਤੋਂ" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/pl.txt b/tools/7-Zip/Lang/pl.txt deleted file mode 100644 index bb9e18d50b..0000000000 --- a/tools/7-Zip/Lang/pl.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by cienislaw, corrected by pixel -; Last versions translated by F1xat -; Corrected and updated by Łukasz Maria P. Pastuszczak -; -; - -00000000="Polish" -00000001="Polski" -00000002="21" - -; 7-Zip Configuration - -; Title -01000000="Konfiguracja programu 7-Zip" - -; Info Page -01000100="7-Zip - informacje" -01000103="7-Zip jest programem darmowym. Możesz jednak wspomóc jego rozwój poprzez rejestrację." -01000104="Wsparcie" -01000105="Rejestracja" - -; Folders Page -01000200="Foldery" -01000210="Folder roboczy" -01000211="&Systemowy folder tymczasowy" -01000212="&Bieżący" -01000213="&Wskazany:" -01000214="Użyj tylko dla dysków wymiennych" - -01000281="Wskaż lokalizację dla tymczasowych plików archiwów." - -; System Page -01000300="System" -01000301="Zintegruj program 7-Zip z menu kontekstowym powłoki" -01000302="Kaskadowe menu kontekstowe" -01000310="Elementy menu kontekstowego:" - -; Language Page -01000400="Język" -01000401="Język:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Polecenia programu 7-Zip" -02000103="Otwórz archiwum" -02000104="Otwiera zaznaczone archiwum." -02000105="Wypakuj pliki..." -02000106="Wypakowuje pliki z zaznaczonego archiwum." -02000107="Dodaj do archiwum..." -02000108="Dodaje zaznaczone elementy do archiwum." -02000109="Testuj archiwum" -0200010A="Testuje integralność zaznaczonego archiwum." -0200010B="Wypakuj tutaj" -0200010C="Wypakowuje pliki z zaznaczonego archiwum do bieżącego folderu." -0200010D="Wypakuj do {0}" -0200010E="Wypakowuje pliki do podfolderu." -0200010F="Dodaj do {0}" -02000110="Dodaje zaznaczone elementy do archiwum." -02000111="Skompresuj i wyślij e-mailem..." -02000112="Kompresuje zaznaczone elementy do archiwum i wysyła je pocztą e-mail." -02000113="Skompresuj do {0} i wyślij e-mailem" -02000114="Kompresuje zaznaczone elementy do archiwum i wysyła je pocztą e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Ścieżka" -02000204="Nazwa" -02000205="Rozszerzenie" -02000206="Folder" -02000207="Rozmiar" -02000208="Rozmiar po spakowaniu" -02000209="Atrybuty" -0200020A="Utworzony" -0200020B="Ostatnio otwarty" -0200020C="Zmodyfikowany" -0200020D="Ciągły" -0200020E="Z komentarzem" -0200020F="Zaszyfrowany" -02000210="Podzielony przed" -02000211="Podzielony po" -02000212="Słownik" -02000213="CRC" -02000214="Typ" -02000215="Anty" -02000216="Metoda" -02000217="Pochodzenie" -02000218="System plików" -02000219="Użytkownik" -0200021A="Grupa" -0200021B="Blok" -0200021C="Komentarz" -0200021D="Pozycja" -0200021E="Prefiks ścieżki" -0200021F="Foldery" -02000220="Pliki" -02000221="Wersja" -02000222="Wolumin" -02000223="Wielowoluminowy" -02000224="Przesunięcie" -02000225="Dowiązania" -02000226="Bloki" -02000227="Woluminy" - -02000229="64-bitowy" -0200022A="Big-endian" -0200022B="Procesor" -0200022C="Rozmiar fizyczny" -0200022D="Rozmiar nagłówków" -0200022E="Suma kontrolna" -0200022F="Charakterystyki" -02000230="Adres wirtualny" -02000231="Numer seryjny woluminu" -02000232="Krótka nazwa" -02000233="Generator" -02000234="Rozmiar sektora" -02000235="Tryb" -02000236="Dowiązanie" - -; Status bar -02000301="Zaznaczono {0} obiekt(ów)" -02000302="{0} obiekt(ów)" - -02000320="Plików:" -02000321="Folderów:" -02000322="Rozmiar:" -02000323="Rozmiar po kompresji:" -02000324="Archiwów:" - -; List Context Menu -02000401="&Kolumny..." - -02000411="&Otwórz" -02000412="&Wypakuj..." - -; ToolBar -02000501="Wypakuj" - -; Messages -02000601="Operacje aktualizacji nie są obsługiwane dla tego archiwum." -02000602="Nie można zaktualizować archiwum {0}" -02000603="Nie można utworzyć folderu „{0}”" -02000604="Plik nie jest obsługiwanym archiwum." -02000605="Błąd" -02000606="Zbyt dużo elementów" -02000607="Z określonym plikiem nie skojarzono żadnej aplikacji" -02000608="Nie wykryto błędów" -02000609="Nie można otworzyć pliku „{0}” jako archiwum" -0200060A="Nie można otworzyć zaszyfrowanego archiwum „{0}”. Nieprawidłowe hasło?" -0200060B="System nie może przydzielić wymaganej ilości pamięci" -0200060C="Nieznany błąd" -0200060D="Nieobsługiwany typ archiwum" - -; Dialogs -02000702="OK" -02000705="&Tak" -02000707="Ta&k na wszystkie" -02000709="&Nie" -0200070B="Ni&e na wszystkie" - -02000710="Anuluj" -02000711="&Anuluj" -02000713="&Zamknij" -02000714="Zatrzymaj" -02000715="Ponów" - -02000720="Pomoc" - -; Extract dialog -02000800="Wypakuj" -02000801="&Wypakuj do:" -02000802="Hasło" - -02000810="Tryb ścieżek" -02000811="Pełne ścieżki" -02000812="Względne ścieżki" -02000813="Bez ścieżek" - -02000820="Tryb nadpisywania" -02000821="Monituj przed nadpisaniem" -02000822="Nadpisuj bez monitowania" -02000823="Pomiń istniejące pliki" -02000824="Automatycznie zmień nazwy" -02000825="Aut. zmień nazwy istniejących plików" - -02000830="Pliki" -02000831="&Zaznaczone pliki" -02000832="Wszystkie &pliki" - -02000881="Wskaż lokalizację dla wypakowanych plików." - -02000890="Wypakowywanie" - -; Overwrite dialog -02000900="Potwierdź zamianę pliku" -02000901="Folder docelowy zawiera już przetwarzany plik." -02000902="Czy chcesz zamienić istniejący plik" -02000903="na następujący?" - -02000911="Automatycznie &zmień nazwy" - -02000982="{0} bajtów" -02000983="zmodyfikowany" - -; Messages dialog -02000A00="Komunikaty diagnostyczne" - -02000A80="Komunikat" - -02000A91="Nieobsługiwana metoda kompresji pliku „{0}”." -02000A92="Błąd danych w „{0}”. Plik jest uszkodzony." -02000A93="CRC nie powiodła się dla „{0}”. Plik jest uszkodzony." -02000A94="Błąd danych w zaszyfrowanym pliku „{0}”. Nieprawidłowe hasło?" -02000A95="CRC nie powiodła się dla zaszyfrowanego pliku „{0}”. Nieprawidłowe hasło?" - -; Password dialog -02000B00="Wprowadź hasło" -02000B01="Wprowadź hasło:" -02000B02="Pokaż &hasło" -02000B03="Wprowadź ponownie hasło:" -02000B10="Hasła nie zgadzają się" -02000B11="W haśle używaj tylko liter alfabetu angielskiego, cyfr i znaków specjalnych (!, #, $, ...)" -02000B12="Hasło jest zbyt długie" - -; Progress dialog -02000C00="Przetwarzanie" -02000C01="Upłynęło czasu:" -02000C02="Pozostało czasu:" -02000C03="Całkowity rozmiar:" -02000C04="Szybkość:" -02000C05="Przetworzono:" -02000C06="Współczynnik kompresji:" - -02000C10="&Tło" -02000C11="&Pierwszy plan" -02000C12="&Wstrzymaj" -02000C13="&Kontynuuj" - -02000C20="Wstrzymano" - -02000C30="Czy na pewno chcesz anulować?" - -; Compress dialog -02000D00="Dodaj do archiwum" -02000D01="&Archiwum:" -02000D02="&Tryb aktualizacji:" -02000D03="&Format archiwum:" -02000D04="&Metoda kompresji:" -02000D05="Utwórz &ciągłe archiwum" -02000D06="&Parametry:" -02000D07="Opcje" -02000D08="&Utwórz archiwum SFX" -02000D09="Wielowątkowość" -02000D0A="&Zaszyfruj nazwy plików" -02000D0B="Stopień &kompresji:" -02000D0C="&Rozmiar słownika:" -02000D0D="Rozmiar &słowa:" -02000D0E="Użycie pamięci dla kompresji:" -02000D0F="Użycie pamięci dla dekompresji:" -02000D10="Szyfrowanie" -02000D11="Metoda szyfrowania:" -02000D12="Liczba wątków:" -02000D13="Rozmiar bloku ciągłego:" -02000D14="Nieciągły" -02000D15="Ciągły" -02000D16="Kompresuj pliki współdzielone" - -02000D40="Rozmiar &woluminów (bajty):" -02000D41="Nieprawidłowy rozmiar woluminu" -02000D42="Określony rozmiar woluminu: {0} bajtów.\nCzy na pewno chcesz podzielić archiwum na takie woluminy?" - -02000D81="Bez kompresji" -02000D82="Normalna" -02000D83="Maksymalna" -02000D84="Szybka" -02000D85="Najszybsza" -02000D86="Ultra" - -02000D90="Przeglądaj" - -02000DA1="Dodaj i zamień pliki" -02000DA2="Aktualizuj i dodaj pliki" -02000DA3="Odśwież istniejące pliki" -02000DA4="Synchronizuj pliki" - -02000DB1="Wszystkie pliki" - -02000DC0="Kompresowanie" - -; Columns dialog -02000E00="Kolumny" -02000E01="Wybierz kolumny, które mają być wyświetlane w tym folderze. Do zmiany kolejności kolumn możesz użyć przycisków Przenieś w górę i Przenieś w dół." -02000E02="Wybrana kolumna powinna mieć" -02000E03="&pikseli szerokości." - -02000E10="Przenieś w &górę" -02000E11="Przenieś w &dół" -02000E12="P&okaż" -02000E13="&Ukryj" -02000E14="Ustaw" - -02000E81="Nagłówek" -02000E82="Szerokość" - -; Testing -02000F90="Testowanie" - - -; File Manager - -03000000="Menedżer plików 7-Zip" - -; Menu -03000102="&Plik" -03000103="&Edycja" -03000104="&Widok" -03000105="&Narzędzia" -03000106="Pomo&c" -03000107="&Ulubione" - -; File -03000210="&Otwórz" -03000211="Otwórz &wewnątrz" -03000212="Otwórz na &zewnątrz" -03000220="Pod&gląd" -03000221="&Edytuj" -03000230="Zmień &nazwę" -03000231="Kopiuj &do..." -03000232="&Przenieś do..." -03000233="&Usuń" -03000240="Wł&aściwości" -03000241="Ko&mentarz" -03000242="Oblicz sumę kontrolną" -03000243="Diff" -03000250="Utwórz &folder" -03000251="U&twórz plik" -03000260="Za&kończ" -03000270="Podzie&l plik..." -03000271="Złą&cz pliki..." - -; Edit -03000310="&Cofnij" -03000311="&Powtórz" -03000320="&Wytnij" -03000321="&Kopiuj" -03000322="Wkl&ej" -03000323="&Usuń" -03000330="Z&aznacz wszystko" -03000331="&Odznacz wszystko" -03000332="Odwróć &zaznaczenie" -03000333="Zaznacz..." -03000334="Odznacz..." -03000335="Zaznacz według typu" -03000336="Odznacz według typu" - -; View -03000410="&Duże ikony" -03000411="&Małe ikony" -03000412="&Lista" -03000413="&Szczegóły" -03000420="Nieposortowane" -03000430="Otwórz folder główny" -03000431="Do góry o jeden poziom" -03000432="Historia folderów..." -03000440="&Odśwież" -03000449="Widok płaski" -03000450="&2 panele" -03000451="&Paski narzędzi" -03000460="Pasek archiwum" -03000461="Pasek standardowy" -03000462="Duże przyciski" -03000463="Pokaż etykiety tekstowe" - -; Tools -03000510="&Opcje..." -03000511="&Test wydajności" - -; Help -03000610="&Zawartość" -03000620="7-Zip - i&nformacje" - -; Favorites -03000710="&Dodaj folder do ulubionych jako" -03000720="Zakładka" - -; Options Dialog - -03010000="Opcje" - -; Plugins -03010100="Wtyczki" -03010101="&Wtyczki:" -03010110="Opcje..." - -; Edit -03010200="Edytor" -03010201="&Edytor:" -03010202="&Diff:" - -; System -03010300="System" -03010302="Skojarz program 7-Zip z:" -03010310="Wtyczka" - -; Settings -03010400="Ustawienia" -03010401="Pokaż element „..”" -03010402="Pokaż prawdziwe ikony plików" -03010410="Pokaż menu systemowe" -03010420="Zaznaczaj &cały rząd" -03010421="&Pokaż linie siatki" -03010422="Pojedyncze kliknięcie otwiera element" -03010430="&Alternatywny tryb zaznaczania" -03010440="&Użyj dużych stron pamięci" - -; Strings - -03020201="Kopiuj" -03020202="Przenieś" -03020203="Kopiuj do:" -03020204="Przenieś do:" -03020205="Kopiowanie..." -03020206="Przenoszenie..." -03020207="Nie możesz kopiować ani przenosić elementów do tego folderu." -03020208="Operacja nie jest obsługiwana dla tego folderu." -03020209="Wybierz folder docelowy." - -03020210="Potwierdź usunięcie pliku" -03020211="Potwierdź usunięcie folderu" -03020212="Potwierdź usunięcie wielu plików" -03020213="Czy na pewno chcesz usunąć plik „{0}”?" -03020214="Czy na pewno chcesz usunąć folder „{0}” i całą zawartość?" -03020215="Elementów: {0} - czy na pewno chcesz je usunąć?" -03020216="Usuwanie..." -03020217="Błąd podczas usuwania pliku lub folderu" -03020218="System nie może przenieść pliku o długiej ścieżce do Kosza" - -03020220="Zmienianie nazwy..." -03020221="Błąd podczas zmiany nazwy pliku lub folderu" -03020222="Potwierdź kopiowanie plików" -03020223="Czy na pewno chcesz skopiować pliki do archiwum?" - -03020230="Utwórz folder" -03020231="Nazwa folderu:" -03020232="Nowy folder" -03020233="Błąd podczas tworzenia folderu" - -03020240="Utwórz plik" -03020241="Nazwa pliku:" -03020242="Nowy plik" -03020243="Błąd podczas tworzenia pliku" - -03020250="Zaznacz" -03020251="Odznacz" -03020252="Maska:" - -03020260="Historia folderów" - -03020280="Plik „{0}” został zmodyfikowany.\nCzy chcesz zaktualizować go w archiwum?" -03020281="Nie można zaktualizować pliku\n„{0}”" -03020282="Nie można uruchomić edytora." -03020283="Otwieranie..." -03020284="Plik wygląda na wirusa (nazwa pliku zawiera długi ciąg spacji)." - -03020290="- komentarz" -03020291="&Komentarz:" - -030202A0="System" - -03020300="Komputer" -03020301="Sieć" -03020302="Dokumenty" - -03020400="Dodaj" -03020401="Wypakuj" -03020402="Testuj" - -03020420="Kopiuj" -03020421="Przenieś" -03020422="Usuń" -03020423="Informacje" - -03020500="Podziel plik" -03020501="&Podziel do:" -03020510="Dzielenie..." -03020520="Potwierdź podział" -03020521="Czy na pewno chcesz podzielić plik na {0} woluminów?" -03020522="Rozmiar woluminu musi być mniejszy od rozmiaru oryginalnego pliku" - -03020600="Złącz pliki" -03020601="&Złącz do:" -03020610="Łączenie..." -03020620="Zaznacz tylko pierwszą część podzielonego pliku" -03020621="To nie jest poprawna część podzielonego pliku" -03020622="Nie można odnaleźć co najmniej jednej części podzielonego pliku" - -03020710="Obliczanie sumy kontrolnej..." -03020720="Informacja o sumie kontrolnej" -03020721="Suma kontrolna CRC dla danych:" -03020722="Suma kontrolna CRC dla danych i nazw:" - -03020800="Skanowanie..." - -03020900="Właściwości" - -03020A01="Operacja nie może być wywołana z folderu, który ma długą ścieżkę." -03020A02="Musisz zaznaczyć jeden plik" -03020A03="Musisz zaznaczyć jeden lub więcej plików" -03020A04="Plik {0} już istnieje" - -; Computer -03031100="Całkowity rozmiar" -03031101="Wolne miejsce" -03031102="Rozmiar klastra" -03031103="Etykieta" - -; Network -03031200="Nazwa lokalna" -03031201="Dostawca" - -; Benchmark Dialog - -03080000="Test wydajności" -03080001="Użycie pamięci:" -03080002="Kompresja" -03080003="Dekompresja" -03080004="Szybkość" -03080005="Ocena" -03080006="Całkowita ocena" -03080007="Aktualnie" -03080008="Wynik" -03080009="Przebiegi:" -0308000A="Błędy:" -0308000B="Użycie CPU" -0308000C="Ocena / Użycie" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ps.txt b/tools/7-Zip/Lang/ps.txt deleted file mode 100644 index 94052e7514..0000000000 --- a/tools/7-Zip/Lang/ps.txt +++ /dev/null @@ -1,511 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.53 -; Translated by the Pathanisation Project -; pathanisation.pakhtosoft.com -; 20071226 -; - -00000000="Pashto" -00000001="پښتو" -00000002="99" - -; 7-Zip Configuration - -; Title -01000000="۷‏-زېپ سازونه" - -; Info Page -01000100="۷‏-زېپ په اړه" -01000103=".دا يو وړيا ساوتری دی. خو، په نومکښلو سره د ساوتري د پرمختګ ملاتړ کولی شئ" -01000104="ملاتړ" -01000105="نومکښل" - -; Folders Page -01000200="پوښۍ" -01000210="&کارنه پوښۍ" -01000211="&لنډمهاله غونډال پوښۍ" -01000212="&اوسنۍ" -01000213="&څانګړې" -01000214="يوازې له لېرېدونکو چليځونو لپاره کارول" - -01000281=".د لنډمهاله ارشيو دوتنو لپاره ځای وټاکئ" - -; System Page -01000300="غونډال" -01000301="۷‏-زېپ سيپۍ تړاو غورنۍ کښې زياتول" -01000302="ځړبهيزه تړاو غورنۍ" -01000310=":تړاو غورنۍ توکي" - -; Language Page -01000400="ژبه" -01000401=":ژبه" - - -; 7-Zip Explorer extension - -; Context menu -02000101="۷‏-زېپ" -02000102="۷‏-زېپ بولۍ" -02000103="ارشيو پرانيستل" -02000104=".ټاکل شوی ارشيو پرانيزي" -02000105="...دوتنې ويستل" -02000106=".د ټاکل شوي ارشيو نه دوتنې وباسي" -02000107="...ارشيو ته زياتول" -02000108=".ټاکل شوي توکي ارشيو ته زياتوي" -02000109="ارشيو ازمويل" -0200010A=".د ټاکل شوي ارشيو بشپړتيا ازمويي" -0200010B="دلته ويستل" -0200010C=".د ټاکل شوي ارشيو نه اوسنۍ پوښۍ ته دوتنې وباسي" -0200010D="ته ويستل {0}‏" -0200010E=".څېرمه پوښۍ ته دوتنې وباسي" -0200010F="ته زياتول {0}" -02000110=".ټاکل شوي توکي ارشيو ته زياتوي" -02000111="...زېرل او برېښل" -02000112=".ټاکل شوي توکي ارشيو ته زېري او د برېښلېک له لارې يې ليږي" -02000113="ته زياتول او برېښل {0}" -02000114=".ټاکل شوي توکي ارشيو ته زېري او د برېښلېک له لارې يې ليږي" - -02000140="<پوښۍ>" -02000141="<ارشيو>" - -; Properties -02000203="يونلور" -02000204="نوم" -02000205="شاتاړی" -02000206="پوښۍ" -02000207="کچ" -02000208="بنډل شوی کچ" -02000209="څانتياوې" -0200020A="جوړشوی" -0200020B="رسی" -0200020C="بدلون" -0200020D="کلک" -0200020E="څرګندون" -0200020F="کوډييز" -02000210="چول مخکښې" -02000211="چول وروسته" -02000212="ويېپانګه" -02000213="CRC" -02000214="ډول" -02000215="مخالف" -02000216="لېله" -02000217="کوربه چغ" -02000218="دوتنه غونډال" -02000219="کارن" -0200021A="ډله" -0200021B="غونډ" -0200021C="څرګندون" -0200021D="ځای" -0200021E="يونلور مختاړی" -0200021F="پوښۍ" -02000220="دوتنې" -02000221="نسخه" -02000222="ډکون" -02000223="ګڼډکون" -02000224="افسېټ" -02000225="پېوندونه" -02000226="غوڼدونه" -02000227="ډکونونه" - -; Status bar -02000301="ټاکل شوي څيزونه {0}" -02000302="څيز(ونه) '{0}'" - -02000320="دوتنې:" -02000321="پوښۍ:" -02000322=":کچ" -02000323=":زېرلی کچ" -02000324=":ارشيونه" - -; List Context Menu -02000401="...ستنې&" - -02000411="پرانيستل&" -02000412="...ويستل&" - -; ToolBar -02000501="ويستل" - -; Messages -02000601=".اوسمهاله چلښتونه دې ارشيو لپاره منلي نه دي" -02000602="ارشيو اوسمهالولی نه شي '{0}'" -02000603="پوښۍ جوړولی نه شي '{0}'" -02000604=".دوتنه منلی ارشيو نه دی" -02000605="تېروتنه" -02000606="ډېر زيات توکي" -02000607="د ورکړل شوي دوتنې نوم شاتاړي سره هېڅ کاريال مل نه دی" -02000608="هېڅ تېروتنه نشته" -02000609="'{0}' دوتنه لکه د ارشيو نه شي پرانيستلی" -0200060A="کوډييز ارشيو پرانيستلی نه شي '{0}'. ناسمه تېرنويې؟" - -; Dialogs -02000702="هوکې" -02000705="هو&" -02000707="ټولو ته هو&" -02000709="نه&" -0200070B="ټ&ولو ته نه" - -02000710="بندول" -02000711="بندول&" -02000713="بندول&" -02000714="تمول" -02000715="بياپېلول" - -02000720="مرسته" - -; Extract dialog -02000800="ويستل" -02000801=":ته و&يستل" -02000802="تېرنويې" - -02000810="يونلور اکر" -02000811="بشپړ يونلورنومونه" -02000812="اوسني يونلورنومونه" -02000813="هېڅ يونلورنومونه" - -02000820="سرليکلو اکر" -02000821="سرليکلو نه مخکښې پوښتل" -02000822="بې له پارليکې سرليکل" -02000823="شته دوتنې پرېښودل" -02000824="خپله بيانومول" -02000825="شته دوتنې خپله بيانومول" - -02000830="دوتنې" -02000831="ټاکلې دوتنې&" -02000832="ټولې دوتنې&" - -02000881=".د ويستلو دوتنو لپاره يو ځای وټاکئ" - -02000890="وباسي" - -; Overwrite dialog -02000900="دوتنه ځاېناستی باورييل" -02000901=".موخه پوښۍ دمخه بهيرلې دوتنې لري" -02000902="غواړئ چې شته دوتنه ځاېناستې کړئ" -02000903="له دې سره؟" - -02000911="خپله ب&يانومول" - -02000982="باېټه {0}" -02000983="بدل شوی په" - -; Messages dialog -02000A00="رنځ نومېرنې استوزه" - -02000A80="استوزه" - -02000A91=".لپاره نامنلې زېرنې لېله '{0}'" -02000A92=".کښې اومتوک ستونزه '{0}' دوتنه ماته ده" -02000A93=".کښې سرس پاتې راغی '{0}' دوتنه ماته ده" -02000A94="کوډييزې دوتنې '{0}' کښې اومتوک ستونزه. ناسمه تېرنويې؟" -02000A95="په کوډييزې دوتنې '{0}' کښې سرس پاتې راغی. ناسمه تېرنويې؟" - -; Password dialog -02000B00="تېرنويې وليکئ" -02000B01=":تېرنويې وليکئ" -02000B02="تېرنويې ښودل&" -02000B03=":تېرنويې بيا وليکئ" -02000B10="تېرنويې سمون نه خوري" -02000B11="تېرنويې لپاره يوازې انګريزي توري، شمېرې او ځانګړي لوښې (!, #, $, ...) وکاروئ" -02000B12="تېرنويې ډېره اوږده ده" - -; Progress dialog -02000C00="بهير" -02000C01=":تېر مهال" -02000C02=":پاتې مهال" -02000C03=":بشپړ کچ" -02000C04=":چټکتیا" -02000C05=":بهيرلی" -02000C06=":زېرلو نسبت" - -02000C10="شاليد&" -02000C11="پاسليد&" -02000C12="ځنډول&" -02000C13="پرمختلل&" - -02000C20="څنډېدلی" - -02000C30="په ډاډمنه توګه غواړئ چې بند يې کړئ؟" - -; Compress dialog -02000D00="ارشيو ته زياتول" -02000D01=":ارشيو&" -02000D02=":اوسمهاليز اکر&" -02000D03=":ارشيو بڼه&" -02000D04=":زېرنې &لېله" -02000D05="کلک ارشيو جوړول&" -02000D06=":ارزښتمني&" -02000D07="غوراوي" -02000D08="ارشيو جوړول SF&X" -02000D09="ګڼ-مزيول" -02000D0A="دوتنه &نومونه کوډييزول" -02000D0B=":زېرنې &کچه" -02000D0C=":ويېپانګې کچه&" -02000D0D=":ويې کچ&" -02000D0E=":زېرلو لپاره ياد کارونه" -02000D0F=":نازېرلو لپاره ياد کارونه" -02000D10="کوډییزونه" -02000D11=":کوډییزونې لېله" -02000D12=":د مبي مزيو شمېر" -02000D13=":کلک غونډ کچ" -02000D14="نا-کلک" -02000D15="کلک" -02000D16="ونډولې دوتنې زېرل" - -02000D40=":ډکونونو، باېټونو ته چول&" -02000D41="ناسم ډکون کچ" -02000D42=".باېټه {0} :ټاکلی ډکون کچ\nپه ډاډمنه توګه غواړئ چې ارشيو په داسې ډکونونو وويشئ؟" - -02000D81="زېرمل" -02000D82="ليوی" -02000D83="زيات" -02000D84="چټک" -02000D85="ډېر چټک" -02000D86="ډېر زيات چټک" - -02000D90="لټول" - -02000DA1="دوتنې زياتول او ځاېناستول" -02000DA2="دوتنې اوسمهالول او زياتول" -02000DA3="شته دوتنې تاندول" -02000DA4="دوتنې هممهالول" - -02000DB1="ټولې دوتنې" - -02000DC0="زېرل کيږي" - -; Columns dialog -02000E00="ستنې" -02000E01=".هغه ستنې چې په دې پوښۍ کښې يې ښکاره کول غواړئ، ټک وهئ. د ستنو بيا اوډونولو لپاره د لاندې خوځول او پورته خوځول تڼيو څخه کار واخلئ" -02000E02="ټاکل شوې ستن بايد" -02000E03=".پکسله &پلنه وي" - -02000E10="پورته& خوځول" -02000E11="لاندې خوځول&" -02000E12="ښودل&" -02000E13="پټول&" -02000E14="ټاکل" - -02000E81="سرليک" -02000E82="پلنوالی" - -; Testing -02000F90="ازموينه" - - -; File Manager - -03000000="۷‏-زېپ دوتنه سمبالګر" - -; Menu -03000102="دوتنه&" -03000103="سمون&" -03000104="ليد&" -03000105="توکي&" -03000106="مرسته&" -03000107="خ&واپوري" - -; File -03000210="پرانيستل&" -03000211="دننه& پرانيستل" -03000212="بهر پ&رانيستل" -03000220="ليد&" -03000221="سمون&" -03000230="بي&انومول" -03000231="...ته لمېسل&" -03000232="...ته خوځول&" -03000233="ړنګول&" -03000240="ځانتياوې" -03000241="څرګند&ون" -03000242="چېکسم شمېرل" -03000250="پوښۍ جوړول" -03000251="دوتنه جوړول" -03000260="و&تون" -03000270="...دوتنه چول&" -03000271="...دوتنې يوځ&ايول" - -; Edit -03000310="ناکړ&" -03000311="بياکړ&" -03000320="سکڼ&ل" -03000321="لمېسل&" -03000322="سرېښل&" -03000323="ړنګول&" -03000330="ټول ټاکل&" -03000331="ټول ناټاکل" -03000332="ټاکنه نسکورول&" -03000333="...ټاکل" -03000334="...ناټاکل" -03000335="پر ډول ټاکل" -03000336="پر ډول ناټاکل" - -; View -03000410="لو&ی انځورنونه" -03000411="و&اړه انځورنونه" -03000412="لړ&" -03000413="خبرتياوې&" -03000420="ناڼلي" -03000430="ولۍ پوښۍ پرانيستل" -03000431="يو کچه برول" -03000432="...پوښيو مخينه" -03000440="تاندول&" -03000449="پوړ ليد" -03000450="۲‏ چوکاټه&" -03000451="توکپټې&" -03000460="ارشيو توکپټه" -03000461="کره توکپټه" -03000462="لویې تڼۍ" -03000463="د تڼيو ليکنې ښودل" - -; Tools -03000510="...غوراوي&" -03000511="بنچمارک&" - -; Help -03000610="...منځپانګه&" -03000620="...۷‏-زېپ په اړه&" - -; Favorites -03000710="پوښۍ خواپورو ته زياتول لکه&" -03000720="نښه" - -; Options Dialog - -03010000="غوراوي" - -; Plugins -03010100="لګونونه" -03010101=":لګونونه&" -03010110="...غوراوي" - -; Edit -03010200="سمونګر" -03010201=":سمونګر&" - -; System -03010300="غونډال" -03010302=":له ۷‏-زېپ سره ملول" -03010310="لګون" - -; Settings -03010400="امستنې" -03010401="توکي ښودل \"..\"" -03010402="د دوتنو ريښتيني انځورنونه ښودل" -03010410="غونډال غورنۍ ښودل" -03010420="ټول کيل ټاکل&" -03010421="کرښې ښودل" -03010430="انډوليز ټاکنې اکر&" -03010440="لوی ياد مخونه کارول&" - -; Strings - -03020201="لمېسل" -03020202="خوځول" -03020203=":ته لمېسل" -03020204=":ته خوځول" -03020205="...لميسل کيږي" -03020206="...خوځيږي" -03020207=".له داسې پوښۍ لپاره توکي نه شئ خوځولی يا لمېسلی" -03020208=".چلښت منلی نه دی" -03020209=".موخه پوښۍ وټاکئ" - -03020210="دوتنې ړنګونه باورييل" -03020211="پوښۍ ړنګونه باورييل" -03020212="ګڼو دوتنو ړنګونه باورييل" -03020213="په ډاډمنه توګه '{0}' ړنګول غواړئ؟" -03020214="په ډاډمنه توګه '{0}' پوښۍ او د دې ټوله منځپانګه ړنګول غواړئ؟" -03020215="په ډاډمنه توګه دا {0} توکي ړنګول غواړئ؟" -03020216="...ړنګيږي" -03020217="دوتنې يا پوښۍ ړنګولو ستونزه" - -03020220="بيانوميږي" -03020221="دوتنې يا پوښۍ بيانومولو ستونزه" -03020222="دوتنې لمېسل باورييل" -03020223="په ډاډمنه توګه دوتنې ارشيو ته لمېسل غواړئ؟" - -03020230="پوښۍ جوړول" -03020231=":پوښۍ نوم" -03020232="نوې پوښۍ" -03020233="پوښۍ جوړولو ستونزه" - -03020240="دوتنه جوړول" -03020241=":دوتنه نوم" -03020242="نوې دوتنه" -03020243="دوتنې جوړولو ستونزه" - -03020250="ټاکل" -03020251="ناټاکل" -03020252=":وربوزۍ" - -03020260="پوښيو مخينه" - -03020280=".'{0}' دوتنه کښې بدلون راغلی\nپه ارشيو کښې يې اوسمهالول غواړئ؟" -03020281="'{0}'\nدوتنه اوسمهالولی نه شي" -03020282="سمونګر پېلولی نه شي" -03020283="...پرانيستل کيږي" - -03020290="څرګندون" -03020291=":څرګندون&" - -030202A0="غونډال" - -03020300="سولګر" -03020301="جال" - -03020400="زياتول" -03020401="ويستل" -03020402="ازمويل" - -03020420="لمېسل" -03020421="خوځول" -03020422="ړنګول" -03020423="خبرتياوې" - -03020500="دوتنه چول" -03020501=":ته چول&" -03020510="...چول کيږي" -03020520="چونه باورييل" -03020521="په ډاډمنه توګه دوتنه په {0} ډکونونو وېشل غواړئ؟" -03020522="ډکون کچ بايد د دوتنې ار کچ نه وړوکی وي" - -03020600="دوتنې يوځايول" -03020601=":ته يوځايول&" -03020610="...يوځايږي" -03020620="يوازې لمړۍ دوتنه ټاکل" - -03020710="...چېکسم شمېريږي" -03020720="چېکسم خبرتياوې" -03020721=":چېکسم CRC اومتوک لپاره" -03020722=":چېکسم CRC اومتوک او نومونو لپاره" - -03020800="...ځیريږي" - -03020900="ځانتياوې" - -; Computer -03031100="بشپړ کچ" -03031101="پاتې تشه" -03031102="ځومبک کچ" -03031103="نښکه" - -; Network -03031200="ځایي نوم" -03031201="برابروونى" - -; Benchmark Dialog - -03080000="بنچمارک" -03080001=":ياد کارونه" -03080002="زېريږي" -03080003="نازېريږي" -03080004="چټکتيا" -03080005="کچونه" -03080006="بشپړه کچونه" -03080007="اوسنی" -03080008="پايليز" -03080009=":تيريږي" -0308000A=":تېروتنه" -0308000B="مبي کارونه" -0308000C="کچونه / کارونه" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/pt-br.txt b/tools/7-Zip/Lang/pt-br.txt deleted file mode 100644 index 032fca5133..0000000000 --- a/tools/7-Zip/Lang/pt-br.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Translated by Fabricio Biazzotto - Atualizado por Felipe -; -; -; -; - -00000000="Portuguese Brazil" -00000001="Português (Brasil)" -00000002="22-1" - -; 7-Zip Configuration - -; Title -01000000="Configuração do 7-Zip" - -; Info Page -01000100="Sobre o 7-Zip" -01000103="7-Zip é um software livre. Contudo, você pode ajudar com o seu desenvolvimento registrando-o." -01000104="Suporte" -01000105="Registrar" - -; Folders Page -01000200="Pastas" -01000210="&Pasta de trabalho" -01000211="&Pasta temporária do sistema" -01000212="&Atual" -01000213="&Especificada:" -01000214="Usar apenas para drives removíveis" - -01000281="Especifique um local para os arquivos temporários." - -; System Page -01000300="Sistema" -01000301="Integrar o 7-Zip ao menu de contexto" -01000302="Menu de contexto em cascata" -01000310="Itens do menu de contexto:" - -; Language Page -01000400="Idioma" -01000401="Idioma:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandos do 7-Zip" -02000103="Abrir arquivo" -02000104="Abre o arquivo selecionado." -02000105="Extrair arquivos..." -02000106="Extrai o conteúdo do arquivo selecionado." -02000107="Adicionar ao arquivo..." -02000108="Adiciona os itens selecionados ao arquivo." -02000109="Testar o arquivo" -0200010A="Testa a integridade do arquivo selecionado." -0200010B="Extrair aqui" -0200010C="Extrai o conteúdo do arquivo selecionado na pasta atual." -0200010D="Extrair para {0}" -0200010E="Extrai os arquivos para uma sub-pasta." -0200010F="Adicionar para {0}" -02000110="Adiciona os itens selecionados ao arquivo." -02000111="Comprimir e enviar por email..." -02000112="Comprime os itens selecionados e envia o arquivo por e-mail." -02000113="Comprimir para {0} e enviar por email" -02000114="Comprime os itens selecionados e envia o arquivo por e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Caminho" -02000204="Nome" -02000205="Extensão" -02000206="Pasta" -02000207="Tamanho" -02000208="Tamanho Compactado" -02000209="Atributos" -0200020A="Criado" -0200020B="Acessado" -0200020C="Modificado" -0200020D="Sólido" -0200020E="Comentado" -0200020F="Criptografado" -02000210="Dividir Antes" -02000211="Dividir Depois" -02000212="Dicionário" -02000213="CRC" -02000214="Tipo" -02000215="Anti" -02000216="Método" -02000217="Sistema Operacional" -02000218="Sistema de Arquivos" -02000219="Usuário" -0200021A="Grupo" -0200021B="Bloco" -0200021C="Comentário" -0200021D="Posição" -0200021E="Prefixo do Caminho" -0200021F="Pastas" -02000220="Arquivos" -02000221="Versão" -02000222="Volume" -02000223="Multivolume" -02000224="Offset" -02000225="Links" -02000226="Blocos" -02000227="Volumes" - -02000229="64 bits" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Tamanho Físico" -0200022D="Tamanho dos Cabeçalhos" -0200022E="Checksum" -0200022F="Características" -02000230="Endereço Virtual" - -; Status bar -02000301="{0} objeto(s) selecionado(s)" -02000302="{0} objeto(s)" - -02000320="Arquivos:" -02000321="Pastas:" -02000322="Tamanho:" -02000323="Tamanho comprimido:" -02000324="Arquivos:" - -; List Context Menu -02000401="&Colunas..." - -02000411="&Abrir" -02000412="&Extrair..." - -; ToolBar -02000501="Extrair" - -; Messages -02000601="Operações de atualização não são suportadas por este arquivo." -02000602="Não pôde atualizar o arquivo {0}" -02000603="Não pôde criar a pasta '{0}'" -02000604="O arquivo não é suportado." -02000605="Erro" -02000606="Itens demais" -02000607="Não há nenhuma aplicação associada com o nome da extensão dado a este arquivo" -02000608="Não há erros" -02000609="Não pôde abrir o arquivo '{0}' como arquivo" -0200060A="Não pôde abrir o arquivo encriptado '{0}'. Senha errada?" -0200060B="O sistema não pôde alocar a quantidade requerida de memória" -0200060C="Erro desconhecido" -0200060D="Tipo de arquivo não suportado" - -; Dialogs -02000702="OK" -02000705="&Sim" -02000707="Sim para &Todos" -02000709="&Não" -0200070B="Não para To&dos" - -02000710="Cancelar" -02000711="&Cancelar" -02000713="&Fechar" -02000714="Parar" -02000715="Reiniciar" - -02000720="Ajuda" - -; Extract dialog -02000800="Extrair" -02000801="E&xtrair para:" -02000802="Senha" - -02000810="Modo de caminho" -02000811="Nomes dos caminhos completos" -02000812="Nomes dos caminhos atuais" -02000813="Sem nomes de caminhos" - -02000820="Modo de substituição" -02000821="Perguntar antes de sobrescrever" -02000822="Sobrescrever sem perguntar" -02000823="Pular os arquivos existentes" -02000824="Auto-renomear" -02000825="Auto-renomear os arquivos existentes" - -02000830="Arquivos" -02000831="&Arquivos selecionados" -02000832="&Todos os arquivos" - -02000881="Especifique um local para os arquivos extraídos." - -02000890="Extraindo" - -; Overwrite dialog -02000900="Confirmar a substituição dos arquivos" -02000901="A pasta destino já contém o arquivo processado." -02000902="Você gostaria de substituir o arquivo existente" -02000903="por este?" - -02000911="A&uto-Renomear" - -02000982="{0} bytes" -02000983="modificado em" - -; Messages dialog -02000A00="Mensagens de diagnóstico" - -02000A80="Mensagem" - -02000A91="Método de compressão não suportado por '{0}'." -02000A92="Erro nos dados de '{0}'. O arquivo está danificado." -02000A93="Falha no CRC de '{0}'. O arquivo está danificado." -02000A94="Erros nos dados do arquivo encriptado '{0}'. Senha errada?" -02000A95="Falha de CRC no arquivo encriptado '{0}'. Senha errada?" - -; Password dialog -02000B00="Inserir senha" -02000B01="Inserir senha:" -02000B02="&Mostrar senha" -02000B03="Re-inserir a senha:" -02000B10="As senhas não combinam" -02000B11="Usar apenas letras em Inglês, números e caracteres especiais (!, #, $, ...) para a senha" -02000B12="A senha é muito longa" - -; Progress dialog -02000C00="Processo" -02000C01="Tempo decorrido:" -02000C02="Tempo restante:" -02000C03="Tamanho total:" -02000C04="Velocidade:" -02000C05="Processado:" -02000C06="Taxa de compressão:" - -02000C10="&Em segundo plano" -02000C11="&Em primeiro plano" -02000C12="&Pausar" -02000C13="&Continuar" - -02000C20="Pausado" - -02000C30="Você tem certeza que você quer cancelar?" - -; Compress dialog -02000D00="Adicionar ao arquivo" -02000D01="&Arquivo:" -02000D02="&Modo de atualização:" -02000D03="Formato do &arquivo:" -02000D04="Método de &compressão:" -02000D05="Criar &arquivo sólido" -02000D06="&Parâmetros:" -02000D07="Opções" -02000D08="Criar ar&quivo SFX" -02000D09="Multi-processamento" -02000D0A="Criptografar os &nomes dos arquivos" -02000D0B="Nível da &compressão:" -02000D0C="&Tamanho do dicionário:" -02000D0D="&Tamanho da palavra:" -02000D0E="Uso de memória para compressão:" -02000D0F="Uso de memória para descompressão:" -02000D10="Encriptação" -02000D11="Método de encriptação:" -02000D12="Número de threads da CPU:" -02000D13="Tamanho do bloco sólido:" -02000D14="Não-sólido" -02000D15="Sólido" -02000D16="Comprimir arquivos compartilhados" - -02000D40="Dividir em &volumes, bytes:" -02000D41="Tamanho do volume incorreto" -02000D42="Tamanho do volume especificado: {0} bytes.\nVocê tem certeza que você quer dividir o arquivo em tais volumes?" - -02000D81="Armazenar" -02000D82="Normal" -02000D83="Máximo" -02000D84="Rápida" -02000D85="Mais rápida" -02000D86="Ultra" - -02000D90="Navegar" - -02000DA1="Adicionar e substituir arquivos" -02000DA2="Atualizar e adicionar arquivos" -02000DA3="Atualizar arquivos existentes" -02000DA4="Sincronizar arquivos" - -02000DB1="Todos os Arquivos" - -02000DC0="Comprimindo" - -; Columns dialog -02000E00="Colunas" -02000E01="Marque as colunas que você gostaria de tornar visíveis nesta pasta. Use os botões Mover para cima e Mover para baixo para re-ordernar as colunas." -02000E02="A coluna selecionada deve ter" -02000E03="pixels de &largura." - -02000E10="Mover para &cima" -02000E11="Mover para &baixo" -02000E12="&Mostrar" -02000E13="&Esconder" -02000E14="Definir" - -02000E81="Título" -02000E82="Largura" - -; Testing -02000F90="Testando" - - -; File Manager - -03000000="Gerenciador de Arquivos do 7-Zip" - -; Menu -03000102="&Arquivo" -03000103="&Editar" -03000104="&Ver" -03000105="&Ferramentas" -03000106="&Ajuda" -03000107="F&avoritos" - -; File -03000210="&Abrir" -03000211="Abrir &por dentro" -03000212="Abrir ex&ternamente" -03000220="&Ver" -03000221="&Editar" -03000230="Re&nomear" -03000231="&Copiar para..." -03000232="&Mover para..." -03000233="&Apagar" -03000240="P&ropriedades" -03000241="Comen&tário" -03000242="Calcular checksum" -03000250="Criar Pasta" -03000251="Criar Arquivo" -03000260="Sai&r" -03000270="&Dividir arquivo..." -03000271="Com&binar arquivos..." - -; Edit -03000310="&Desfazer" -03000311="&Refazer" -03000320="Co&rtar" -03000321="&Copiar" -03000322="&Colar" -03000323="&Apagar" -03000330="Selecionar &tudo" -03000331="Desfazer seleção" -03000332="&Inverter seleção" -03000333="Selecionar..." -03000334="Desfazer seleção..." -03000335="Selecionar por tipo" -03000336="Desfazer seleção por tipo" - -; View -03000410="Íco&nes grandes" -03000411="Íco&nes pequenos" -03000412="&Lista" -03000413="&Detalhes" -03000420="Desordenado" -03000430="Abrir a Pasta Raiz" -03000431="Subir um nível" -03000432="Histórico das Pastas..." -03000440="&Atualizar" -03000449="Visão Plana" -03000450="&2 Painéis" -03000451="&Barra de Ferramentas" -03000460="Barra de Ferramentas do Arquivo" -03000461="Barra de Ferramentas Padrão" -03000462="Botões Grandes" -03000463="Mostrar o Texto dos Botões" - -; Tools -03000510="&Opções..." -03000511="&Benchmark" - -; Help -03000610="&Conteúdo..." -03000620="&Sobre o 7-Zip..." - -; Favorites -03000710="&Adicionar a pasta aos favoritos como" -03000720="Bookmark" - -; Options Dialog - -03010000="Opções" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opções..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistema" -03010302="Associar o 7-Zip com:" -03010310="Plugin" - -; Settings -03010400="Configurações" -03010401="Mostrar o item \"..\" " -03010402="Mostrar os ícones reais dos arquivos" -03010410="Mostrar o menu do sistema" -03010420="&Selecionar a linha inteira" -03010421="Mostrar as &linhas de grade" -03010430="&Modo de seleção alternativo" -03010440="Usar &grandes páginas de memória" - -; Strings - -03020201="Copiar" -03020202="Mover" -03020203="Copiar para:" -03020204="Mover para:" -03020205="Copiando..." -03020206="Movendo..." -03020207="Você não pode mover ou copiar itens para tais pastas." -03020208="A operação não é suportada." -03020209="Selecionar a pasta destino." - -03020210="Confirmar a exclusão do arquivo" -03020211="Confirmar a exclusão da pasta" -03020212="Confirmar a exclusão de múltiplos arquivos" -03020213="Você tem certeza que você quer apagar '{0}'?" -03020214="Você tem certeza que você quer apagar a pasta '{0}' e todo o seu conteúdo?" -03020215="Você tem certeza que você quer apagar estes {0} itens?" -03020216="Apagando..." -03020217="Erro ao apagar o arquivo ou pasta" -03020218="O sistema não pode mover um arquivo com caminho longo para o Recycle Bin" - -03020220="Renomeando..." -03020221="Erro ao renomear o arquivo ou pasta" -03020222="Confirmar a cópia do arquivo" -03020223="Você tem certeza que você quer copiar os arquivos para dentro do arquivo compactado?" - -03020230="Criar Pasta" -03020231="Nome da pasta:" -03020232="Nova Pasta" -03020233="Erro na Criação da Pasta" - -03020240="Criar Arquivo" -03020241="Nome do Arquivo:" -03020242="Novo Arquivo" -03020243="Erro na Criação do Arquivo" - -03020250="Selecionar" -03020251="Desfazer seleção" -03020252="Máscara:" - -03020260="Histórico das Pastas" - -03020280="O arquivo '{0}' foi modificado.\nVocê quer atualizá-lo no arquivo compactado?" -03020281="Não pôde atualizar o arquivo\n'{0}'" -03020282="Não pôde iniciar o editor." -03020283="Abrindo..." -03020284="O arquivo parece um vírus (o nome do arquivo contém espaços longos no nome)." - -03020290="Comentário" -03020291="&Comentário:" - -030202A0="Sistema" - -03020300="Computador" -03020301="Rede" -03020302="Documentos" - -03020400="Adicionar" -03020401="Extrair" -03020402="Testar" - -03020420="Copiar" -03020421="Mover" -03020422="Apagar" -03020423="Info" - -03020500="Dividir Arquivo" -03020501="&Dividir para:" -03020510="Dividindo..." -03020520="Confirmar a Divisão" -03020521="Você tem certeza de quer você dividir o arquivo em {0} volumes?" -03020522="O tamanho do volume deve ser menor do que o tamanho do arquivo original" - -03020600="Combinar Arquivos" -03020601="&Combinar para:" -03020610="Combinando..." -03020620="Selecionar apenas o primeiro arquivo" -03020621="Não pôde detectar o arquivo como parte do arquivo dividido" -03020622="Não pôde achar mais do que uma parte do arquivo dividido" - -03020710="Calculando checksum..." -03020720="Informação de checksum" -03020721="CRC checksum para dados:" -03020722="CRC checksum para dados e nomes:" - -03020800="Escaneando..." - -03020900="Propriedades" - -03020A01="A operação não pode ser chamada de uma pasta que tem um caminho longo." -03020A02="Você deve selecionar um arquivo" -03020A03="Você deve selecionar um ou mais arquivos" -03020A04="O arquivo {0} já existe" - -; Computer -03031100="Tamanho Total" -03031101="Espaço Livre" -03031102="Tamanho do Cluster" -03031103="Rótulo" - -; Network -03031200="Nome Local" -03031201="Provedor" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Uso de memória:" -03080002="Comprimindo" -03080003="Descomprimindo" -03080004="Velocidade" -03080005="Avaliação" -03080006="Total da Avaliação" -03080007="Atual" -03080008="Resultado" -03080009="Passos:" -0308000A="Erros:" -0308000B="Uso da CPU" -0308000C="Avaliação / Uso" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/pt.txt b/tools/7-Zip/Lang/pt.txt deleted file mode 100644 index c29f05fa81..0000000000 --- a/tools/7-Zip/Lang/pt.txt +++ /dev/null @@ -1,497 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.46 -; Translated by Rui Costa -; -; -; -; - -00000000="Portuguese Standard" -00000001="Português" -00000002="22" - -; 7-Zip Configuration - -; Title -01000000="Configuração do 7-Zip" - -; Info Page -01000100="Acerca do 7-Zip" -01000103="O 7-Zip é um software gratuito. Contudo, pode apoiar o desenvolvimento do 7-Zip registando-se." -01000104="Apoio" -01000105="Registar" - -; Folders Page -01000200="Pastas" -01000210="&Pasta de trabalho" -01000211="Pasta temporária do &Sistema" -01000212="Pasta &actual" -01000213="&Especificar pasta:" -01000214="Usar só para discos removíveis" - -01000281="Especifique a pasta para os ficheiros de arquivo temporários." - -; System Page -01000300="Sistema" -01000301="Integrar 7-Zip no menu de contexto do Windows" -01000302="Menu de contexto em cascata" -01000310="Itens do menu de contexto:" - -; Language Page -01000400="Idioma" -01000401="Idioma:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandos do 7-Zip" -02000103="Abrir arquivo" -02000104="Abre o arquivo seleccionado." -02000105="Extrair ficheiros..." -02000106="Extrair ficheiros do arquivo seleccionado." -02000107="Adicionar ao arquivo..." -02000108="Adicionar os itens seleccionados ao arquivo." -02000109="Testar arquivo" -0200010A="Testa a integridade do arquivo seleccionado." -0200010B="Extrair para aqui" -0200010C="Extrair ficheiros do arquivo seleccionado para a pasta actual." -0200010D="Extrair para {0}" -0200010E="Extrair ficheiros para sub-pasta." -0200010F="Adicionar a {0}" -02000110="Adiciona os itens seleccionados ao arquivo." -02000111="Comprimir e enviar por e-mail..." -02000112="Comprimir os itens seleccionados para o arquivo e enviar o arquivo por e-mail." -02000113="Comprimir para {0} e enviar por e-mail" -02000114="Comprimir os itens seleccionados para o arquivo e enviar o arquivo por e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Caminho" -02000204="Nome" -02000205="Extensão" -02000206="Pasta" -02000207="Tamanho" -02000208="T. comprimido" -02000209="Atributos" -0200020A="Criado" -0200020B="Acedido" -0200020C="Modificado" -0200020D="Sólido" -0200020E="Compacto" -0200020F="Encriptado" -02000210="Expandido antes" -02000211="Expandido depois" -02000212="Dicionário" -02000213="CRC" -02000214="Tipo" -02000215="Anti" -02000216="Método" -02000217="Host OS" -02000218="Sistema de ficheiros" -02000219="Utilizador" -0200021A="Grupo" -0200021B="Bloco" -0200021C="Comentário" -0200021D="Posição" -0200021E="Prefixo de caminho" - -; Status bar -02000301="{0} objecto(s) seleccionado(s)" -02000302="{0} objecto(s)" - -02000320="Ficheiros:" -02000321="Pastas:" -02000322="Tamanho:" - -; List Context Menu -02000401="&Colunas..." - -02000411="&Abrir" -02000412="&Extrair..." - -; ToolBar -02000501="Extrair" - -; Messages -02000601="Este tipo de arquivo não permite actualizações." -02000602="Não é possível actualizar {0}" -02000603="Não é possível criar a pasta '{0}'" -02000604="O ficheiro não é um arquivo suportado." -02000605="Erro" -02000606="Demasiados itens" -02000607="Não existe nenhuma aplicação associada com esta extensão de ficheiro" -02000608="Não existem erros" -02000609="Não é possível abrir o ficheiro '{0}' como arquivo" -0200060A="Não é possível abrir o arquivo encriptado '{0}'. Palavra-passe errada?" - -; Dialogs -02000702="OK" -02000705="&Sim" -02000707="Sim a &tudo" -02000709="&Não" -0200070B="Não a t&udo" - -02000710="Cancelar" -02000711="&Cancelar" -02000713="&Fechar" -02000714="Parar" -02000715="Reiniciar" - -02000720="Ajuda" - -; Extract dialog -02000800="Extrair" -02000801="E&xtrair para:" -02000802="Palavra-passe" - -02000810="Modo nome de pasta" -02000811="Nome de pastas completo" -02000812="Nome de pastas actual" -02000813="Sem nome de pastas" - -02000820="Modo de sobrescrever" -02000821="Com confirmação" -02000822="Sem confirmação" -02000823="Manter os ficheiros existentes" -02000824="Renomear autom." -02000825="Renomear autom. os ficheiros existentes" - -02000830="Ficheiros" -02000831="Ficheiros &seleccionados" -02000832="&Todos os ficheiros" - -02000881="Especificar o local de destino para os ficheiros extraídos." - -02000890="A extrair" - -; Overwrite dialog -02000900="Confirmar a substituição do ficheiro" -02000901="A pasta já possui um ficheiro com o mesmo nome." -02000902="Deseja substituir o ficheiro com o mesmo nome" -02000903="por este?" - -02000911="Renomear &automaticamente" - -02000982="{0} bytes" -02000983="modificado em" - -; Messages dialog -02000A00="Mensagens de diagnóstico" - -02000A80="Mensagem" - -02000A91="Método de compressão não válido para '{0}'." -02000A92="Erro de dados em '{0}'. O arquivo está danificado." -02000A93="CRC falhou em '{0}'. O arquivo está danificado." -02000A94="Erro de dados no ficheiro encriptado '{0}'. Palavra-passe errada?" -02000A95="CRC falhou no ficheiro encriptado '{0}'. Palavra-passe errada?" - -; Password dialog -02000B00="Introduza a palavra-passe" -02000B01="Introduza a palavra-passe:" -02000B02="&Mostrar palavra-passe" -02000B03="Reintroduza a palavra-passe:" -02000B10="As palavras-passe não coincidem" -02000B11="Utilize apenas letras inglesas, números e caracteres especiais (!, #, $, ...) na palavra-passe" -02000B12="A palavra-passe é demasiado longa" - -; Progress dialog -02000C00="Progresso" -02000C01="Tempo decorrido:" -02000C02="Tempo restante:" -02000C03="Tamanho:" -02000C04="Velocidade:" - -02000C10="&Segundo plano" -02000C11="&Primeiro plano" -02000C12="&Pausar" -02000C13="&Continuar" - -02000C20="Pausado" - -02000C30="Tem a certeza que quer cancelar?" - -; Compress dialog -02000D00="Adicionar ao arquivo" -02000D01="&Arquivo:" -02000D02="&Modo de actualização:" -02000D03="&Formato do arquivo:" -02000D04="Tipo de &compressão:" -02000D05="Criar arquivo sólido" -02000D06="&Parâmetros:" -02000D07="Opções" -02000D08="Criar arquivo SF&X" -02000D09="Multi-threading" -02000D0A="Encriptar &nomes de ficheiro" -02000D0B="Níve&l de compressão:" -02000D0C="Tamanho do &dicionário:" -02000D0D="Tamanho da &palavra:" -02000D0E="Utilização de memória para compressão:" -02000D0F="Utilização de memória para descompressão:" -02000D10="Encriptação" -02000D11="Método de encriptação:" -02000D12="Número de threads da CPU:" -02000D13="Tamanho dos blocos sólidos:" -02000D14="Não sólido" -02000D15="Sólido" -02000D16="Comprimir ficheiros partilhados" - -02000D40="Separar por &volumes, bytes:" -02000D41="Tamanho do volume incorrecto" -02000D42="Tamanho do volume especificado: {0} bytes.\nTem a certeza que quer separar o arquivo em tais volumes?" - -02000D81="Sem compressão" -02000D82="Normal" -02000D83="Máxima" -02000D84="Rápida" -02000D85="A mais rápida" -02000D86="Ultra" - -02000D90="Ver" - -02000DA1="Adicionar e substituir os ficheiros" -02000DA2="Actualizar e adicionar os ficheiros" -02000DA3="Só actualizar os ficheiros" -02000DA4="Sincronizar os ficheiros" - -02000DB1="Todos os ficheiros" - -02000DC0="A comprimir" - -; Columns dialog -02000E00="Colunas" -02000E01="Seleccione as colunas que pretende visíveis nesta pasta. Use os botões Subir e Baixar para reordenar as colunas." -02000E02="A coluna seleccionada deve ter" -02000E03="&pixeis de largura." - -02000E10="&Subir" -02000E11="&Baixar" -02000E12="&Mostrar" -02000E13="&Esconder" -02000E14="Fixar" - -02000E81="Título" -02000E82="Largura" - -; Testing -02000F90="A testar" - - -; File Manager - -03000000="Gestor de ficheiros do 7-Zip" - -; Menu -03000102="&Ficheiro" -03000103="&Editar" -03000104="&Ver" -03000105="&Ferramentas" -03000106="&Ajuda" -03000107="F&avoritos" - -; File -03000210="&Abrir" -03000211="Abrir &Dentro" -03000212="Abrir &Fora" -03000220="&Ver" -03000221="&Editar" -03000230="Re&nomear" -03000231="&Copiar para..." -03000232="&Mover para..." -03000233="Apaga&r" -03000240="P&ropriedades" -03000241="Come&ntário" -03000242="Calcular checksum" -03000250="Criar Pasta" -03000251="Criar Ficheiro" -03000260="Sa&ir" -03000270="&Separar ficheiro..." -03000271="Com&binar ficheiros..." - -; Edit -03000310="&Desfazer" -03000311="&Refazer" -03000320="Co&rtar" -03000321="&Copiar" -03000322="C&olar" -03000323="&Apagar" -03000330="Seleccionar &Tudo" -03000331="De-seleccionar Tudo" -03000332="&Inverter Selecção" -03000333="Seleccionar..." -03000334="De-seleccionar..." -03000335="Seleccionar por Tipo" -03000336="De-seleccionar por Tipo" - -; View -03000410="Ícones &Grandes" -03000411="Ícones &Pequenos" -03000412="&Lista" -03000413="&Detalhes" -03000420="Sem ordem" -03000430="Abrir pasta raíz" -03000431="Subir um nível" -03000432="Histórico de pastas..." -03000440="&Actualizar" -03000449="Visualização plana" -03000450="&2 painéis" -03000451="&Barras de ferramentas" -03000460="Barra de ferramentas do arquivo" -03000461="Barra de ferramentas padrão" -03000462="Botões grandes" -03000463="Mostrar legenda dos botões" - -; Tools -03000510="&Opções..." -03000511="&Benchmark" - -; Help -03000610="&Conteúdo..." -03000620="&Acerca do 7-Zip..." - -; Favorites -03000710="&Adicionar pasta aos Favoritos como" -03000720="Favorito" - -; Options Dialog - -03010000="Opções" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opções..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistema" -03010302="Associar 7-Zip com:" -03010310="Plugin" - -; Settings -03010400="Definições" -03010401="Mostrar item \"..\" " -03010402="Mostrar ícones reais dos ficheiros" -03010410="Mostrar menu de sistema" -03010420="Selecciona linha &completa" -03010421="Mostra linhas da &grelha" -03010430="Modo de selecção &alternativo" -03010440="Utilizar páginas de &memória grandes" - -; Strings - -03020201="Copiar" -03020202="Mover" -03020203="Copiar para:" -03020204="Mover para:" -03020205="Copiando..." -03020206="Movendo..." -03020207="Não é possível copiar ou mover ficheiros para essas pastas." -03020208="Operação não suportada." -03020209="Seleccionar pasta de destino." - -03020210="Confirmar a eliminação de Ficheiro" -03020211="Confirmar a eliminação de Pasta" -03020212="Confirmar a eliminação de Múltiplos Ficheiros" -03020213="Tem a certeza que deseja eliminar '{0}'?" -03020214="Tem a certeza que deseja eliminar a pasta '{0}' e todo o seu conteúdo?" -03020215="Tem a certeza que deseja eliminar {0} itens?" -03020216="A eliminar..." -03020217="Erro ao Eliminar Ficheiro ou Pasta" - -03020220="A Renomear..." -03020221="Erro ao Renomear Ficheiro ou Pasta" -03020222="Confirmar a cópia de ficheiros" -03020223="Tem a certeza que deseja copiar ficheiros para o arquivo" - -03020230="Criar Pasta" -03020231="Nome da Pasta:" -03020232="Nova Pasta" -03020233="Erro ao criar Pasta" - -03020240="Criar Ficheiro" -03020241="Nome do Ficheiro:" -03020242="Novo ficheiro" -03020243="Erro ao Criar Ficheiro" - -03020250="Seleccionar" -03020251="Deseleccionar" -03020252="Máscara:" - -03020260="Histórico de pastas" - -03020280="O ficheiro '{0}' foi modificado.\nDeseja actualizá-lo no arquivo?" -03020281="Não é possível actualizar o ficheiro\n'{0}'" -03020282="Não é possível iniciar o editor." -03020283="A abrir..." - -03020290="Comentário" -03020291="&Comentário:" - -030202A0="Sistema" - -03020300="Computador" -03020301="Rede" - -03020400="Adicionar" -03020401="Extrair" -03020402="Testar" - -03020420="Copiar" -03020421="Mover" -03020422="Apagar" -03020423="Info" - -03020500="Separar Ficheiro" -03020501="&Separar para:" -03020510="A separar..." -03020520="Confirmar separação" -03020521="Tem a certeza que quer separar o ficheiro em {0} volumes?" -03020522="O tamanho do volume tem de ser inferior ao tamanho do ficheiro original" - -03020600="Combinar Ficheiros" -03020601="&Combinar para:" -03020610="A combinar..." -03020620="Seleccionar apenas o primeiro ficheiro" - -03020710="A calcular o Checksum..." -03020720="Informação do Checksum" -03020721="CRC checksum para dados:" -03020722="CRC checksum para dados e nome:" - -03020800="A pesquisar..." - -; Computer -03031100="Tamanho Total" -03031101="Espaço Livre" -03031102="Tamanho do Cluster" -03031103="Etiqueta" - -; Network -03031200="Nome Local" -03031201="Provedor" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Utilização de memória:" -03080002="Comprimindo" -03080003="Descomprimindo" -03080004="Velocidade" -03080005="Pontuação" -03080006="Pontuação total" -03080007="Actual" -03080008="Resultante" -03080009="Passagens:" -0308000A="Erros:" -0308000B="Uso da CPU" -0308000C="Pontuação / Uso" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ro.txt b/tools/7-Zip/Lang/ro.txt deleted file mode 100644 index c97f3ffa21..0000000000 --- a/tools/7-Zip/Lang/ro.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Translated by Lucian Nan ( http://www.prizeeinternational.com) -; -; -; -; - -00000000="Romanian" -00000001="Română" -00000002="24" - -; 7-Zip Configuration - -; Title -01000000="Configuraţia 7-Zip" - -; Info Page -01000100="Despre 7-Zip" -01000103="7-Zip este un program gratuit. Oricum, poţi contribui la dezvoltarea 7-Zip înregistrându-te." -01000104="Suport tehnic" -01000105="Înregistrează" - -; Folders Page -01000200="Directoare" -01000210="&Directorul de lucru" -01000211="Directorul &tempotar al sistemului" -01000212="&Actual" -01000213="&Specificat:" -01000214="Utilizează numai pentru discurile detaşabile" - -01000281="Specifică o destinaţie pentru arhivele temporare." - -; System Page -01000300="Sistem" -01000301="Integrează 7-Zip în contextul meniului shell" -01000302="Contextul meniului în cascadă" -01000310="Obiectele meniului:" - -; Language Page -01000400="Limba" -01000401="Limba:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comenzi 7-Zip" -02000103="Deschide arhiva" -02000104="Deschide arhivele selectate." -02000105="Dezarhivează fişierele..." -02000106="Dezarhivează fişierele din arhiva selectată." -02000107="Adaugă într-o arhivă..." -02000108="Adaugă obiectele selectate într-o arhivă." -02000109="Testează arhiva" -0200010A="Testează integritatea arhivei selectate." -0200010B="Dezarhivează aici" -0200010C="Dezarhivează fişierele din arhiva selectată în directorul actual." -0200010D="Dezarhivează în {0}" -0200010E="Dezarhivează fişierele în subdirector." -0200010F="Adaugă în {0}" -02000110="Adaugă obiectele selectate într-o arhivă." -02000111="Arhivează şi trimite email..." -02000112="Arhivează obiectele selectate într-o arhivă şi trimite-o prin email." -02000113="Arhivează în {0} şi trimite email" -02000114="Arhivează obiectele selectate într-o arhiva şi trimite-o prin email." - -02000140="" -02000141="" - -; Properties -02000203="Calea" -02000204="Nume" -02000205="Extensie" -02000206="Director" -02000207="Mărime" -02000208="Mărimea pachetului" -02000209="Atribute" -0200020A="Creată" -0200020B="Accesată" -0200020C="Modificată" -0200020D="Solidă" -0200020E="Comentat" -0200020F="Criptat" -02000210="Împarte înainte" -02000211="Împarte după" -02000212="Dicţionar" -02000213="CRC" -02000214="Tip" -02000215="Anti" -02000216="Metoda" -02000217="SO gazdă" -02000218="Fişier de sistem" -02000219="Utilizator" -0200021A="Grup" -0200021B="Blochează" -0200021C="Comentariu" -0200021D="Poziţia" -0200021E="Prefixul destinaţiei" -0200021F="Directoare" -02000220="Fişiere" -02000221="Versiunea" -02000222="Volum" -02000223="Multivolume" -02000224="Ofset" -02000225="Legături" -02000226="Blocuri" -02000227="Volume" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Mărime fizică" -0200022D="Mărimea antetelor" -0200022E="Checksum" -0200022F="Caracteristici" -02000230="Adresa virtuală" - -; Status bar -02000301="{0} obiect(e) selectat(e)" -02000302="{0} obiect(e)" - -02000320="Fişiere:" -02000321="Directoare:" -02000322="Mărime:" -02000323="Mărimea comprimată:" -02000324="Arhive:" - -; List Context Menu -02000401="&Coloane..." - -02000411="&Deschide" -02000412="De&zarhivează..." - -; ToolBar -02000501="Dezarhivează" - -; Messages -02000601="Operaţiile de actualizare nu sunt suportate pentru această arhivă." -02000602="Nu pot actualiza arhiva {0}" -02000603="Nu pot crea directorul '{0}'" -02000604="Fişierul nu este o arhivă suportată." -02000605="Eroare" -02000606="Prea multe obiecte" -02000607="Nu este nici o aplicaţie asociată cu extensia fişierului dat" -02000608="Nu sunt erori" -02000609="Nu pot deschide fişierul '{0}' ca arhivă" -0200060A="Nu pot deschide arhiva criptată '{0}'. Parola greşită?" -0200060B="Sistemul nu poate aloca memoria necesară" -0200060C="Eroare necunoscută" -0200060D="Tip de arhivă nesuportat" - -; Dialogs -02000702="Bine" -02000705="&Da" -02000707="Da, pe &toate" -02000709="&Nu" -0200070B="N&ici unul" - -02000710="Anulare" -02000711="&Anulare" -02000713="&Închide" -02000714="Opreşte" -02000715="Restartează" - -02000720="Ajutor" - -; Extract dialog -02000800="Dezarhivează" -02000801="Dezarhivează în:" -02000802="Parola" - -02000810="Modul destinaţie" -02000811="Numele întreg al destinaţiei" -02000812="Destinaţia actuală" -02000813="Fără locaţie" - -02000820="Modul de înlocuire" -02000821="Întreabă înainte de a înlocui" -02000822="Înlocuieşte fară a întreba" -02000823="Sări peste fişierele existente" -02000824="Auto redenumire" -02000825="Auto redenumeşte fişierele existente" - -02000830="Fişiere" -02000831="Fişierele &selectate" -02000832="&Toate fişierele" - -02000881="Specifică o destinaţie pentru fişierele dezarhivate." - -02000890="Dezarhivez" - -; Overwrite dialog -02000900="Aprobă înlocuirea fişierului" -02000901="Fişierul există deja în directorul destinaţie." -02000902="Doriţi să înlocuiţi fişierul existent" -02000903="cu acesta?" - -02000911="A&uto redenumire" - -02000982="{0} octeţi" -02000983="modifcat pe" - -; Messages dialog -02000A00="Mesaje de diagnosticare" - -02000A80="Mesaj" - -02000A91="Metodă de arhivare nesuportată pentru '{0}'." -02000A92="Eroare de date la '{0}'. Fişierul este corupt." -02000A93="Verificarea CRC a eşuat pentru '{0}'. Fişierul este corupt." -02000A94="Erori de date la fişierul criptat '{0}'. Parolă greşită?" -02000A95="Verificarea CRC a eşuat pentru fişierul criptat '{0}'. Parolă greşită?" - -; Password dialog -02000B00="Introdu parola" -02000B01="Introdu parola:" -02000B02="&Arată parola" -02000B03="Reintrodu parola:" -02000B10="Parolele nu sunt identice" -02000B11="Utilizaţi numai litere, cifre şi caracterele speciale (!, #, $, ...) pentru parolă" -02000B12="Parola este prea lungă" - -; Progress dialog -02000C00="Procesare" -02000C01="Timp trecut:" -02000C02="Timp rămas:" -02000C03="Mărimea:" -02000C04="Viteza:" -02000C05="Procesat:" -02000C06="Rata de comprimare:" - -02000C10="În &fundal" -02000C11="La &suprafaţă" -02000C12="&Pauză" -02000C13="&Continuă" - -02000C20="În pauză" - -02000C30="Eşti sigur că vrei să anulezi?" - -; Compress dialog -02000D00="Adaugă într-o arhivă" -02000D01="&Arhivează:" -02000D02="Modul de a&ctualizare:" -02000D03="&Formatul arhivei:" -02000D04="&Metoda de arhivare:" -02000D05="Crează arhivă &solidă" -02000D06="&Parametri:" -02000D07="Opţiuni" -02000D08="Crează arhivă SF&X" -02000D09="Mai multe fire de execuţie" -02000D0A="Criptează &numele fişierului" -02000D0B="&Nivel de arhivare:" -02000D0C="Mărimea &dicţionarului:" -02000D0D="Mărimea &cuvântului:" -02000D0E="Memorie utilizată pentru arhivare:" -02000D0F="Memorie utilizată pentru dezarhivare:" -02000D10="Criptare" -02000D11="Metoda de criptare:" -02000D12="Numărul de procesoare utilizate:" -02000D13="Mărimea blocului solid:" -02000D14="NEsolid" -02000D15="Solid" -02000D16="Arhivează fişierele partajate" - -02000D40="Împarte în &volume, octeţi:" -02000D41="Dimensiunea volumului este incorectă" -02000D42="Dimensiunea volumului specificat: {0} octeţi.\nEşti sigur că vrei să împarţi arhiva în mai multe volume (părţi)?" - -02000D81="Stochează" -02000D82="Normală" -02000D83="Maximă" -02000D84="Rapidă" -02000D85="Imediată" -02000D86="Ultra" - -02000D90="Caută" - -02000DA1="Adaugă şi înlocuieşte fişierele" -02000DA2="Actualizează şi adaugă fişierele" -02000DA3="Actualizează fişierele existente" -02000DA4="Sincronizează fişierele" - -02000DB1="Toate fişierele" - -02000DC0="Arhivare" - -; Columns dialog -02000E00="Coloane" -02000E01="Bifează coloanele pe care vrei să le faci vizibile în acest director. Utilizează butoanele Mută sus şi Mută jos pentru a reordona coloanele." -02000E02="Coloana selectată poate fi" -02000E03="puncte &mari." - -02000E10="Mută &sus" -02000E11="Mută &jos" -02000E12="&Arată" -02000E13="As&cunde" -02000E14="S&etează" - -02000E81="Titlu" -02000E82="Lăţime" - -; Testing -02000F90="Testez" - - -; File Manager - -03000000="Managerul de fişiere 7-Zip" - -; Menu -03000102="&Fişier" -03000103="&Editează" -03000104="&Vizualizează" -03000105="&Unelte" -03000106="&Ajutor" -03000107="F&avorite" - -; File -03000210="&Deschide" -03000211="Deschide î&n" -03000212="Deschide în &afară" -03000220="&Vizualizeză" -03000221="&Editează" -03000230="&Redenumeşte" -03000231="&Copiază la..." -03000232="&Mută la..." -03000233="Şter&ge" -03000240="&Proprietăţi" -03000241="Comen&tariu" -03000242="Calculează suma de verificare" -03000250="Crează director" -03000251="Crează fişier" -03000260="&Ieşire" -03000270="Împarte &fişierul..." -03000271="&Uneşte fişierele..." - -; Edit -03000310="Ca anterior (&Undo)" -03000311="&Repetă (Redo)" -03000320="&Taie" -03000321="&Copiază" -03000322="&Lipeşte" -03000323="Şter&ge" -03000330="&Selectează tot" -03000331="&Deselectează tot" -03000332="&Inversează selecţia" -03000333="Selectează..." -03000334="Deselectează..." -03000335="Selectează după tip" -03000336="Deselectează după tip" - -; View -03000410="Iconiţe m&ari" -03000411="Iconiţe m&ici" -03000412="&Listă" -03000413="&Detalii" -03000420="Nesortat" -03000430="Deschide directorul rădăcină" -03000431="Un nivel mai sus" -03000432="Istoria directoarelor..." -03000440="&Împrospătează" -03000449="Vedere plană" -03000450="&2 panouri" -03000451="Bare de &unelte" -03000460="Bara de arhivare" -03000461="Bara de unelte standard" -03000462="Butoane mari" -03000463="Arată textul butoanelor" - -; Tools -03000510="&Opţiuni..." -03000511="&Banc de încercare" - -; Help -03000610="&Conţinut..." -03000620="&Despre 7-Zip..." - -; Favorites -03000710="&Adaugă directorul în Favorite ca" -03000720="Semn de carte" - -; Options Dialog - -03010000="Opţiuni" - -; Plugins -03010100="Plugin-uri" -03010101="&Plugin-uri:" -03010110="Opţiuni..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistem" -03010302="Asociază 7-Zip cu:" -03010310="Plugin" - -; Settings -03010400="Setări" -03010401="Arată \"..\" obiect" -03010402="Arată iconiţele reale ale fişierului" -03010410="Arată meniul sistemului" -03010420="Selectează &tot rândul" -03010421="Arată liniile de ghidare" -03010430="Mod de selectare &alternativă" -03010440="Utilizează pagini &mari de memorie" - -; Strings - -03020201="Copiază" -03020202="Mută" -03020203="Copiază la:" -03020204="Mută la:" -03020205="Copiez..." -03020206="Mut..." -03020207="Nu poţi muta sau copia obiectele în aceleaşi directoare." -03020208="Operaţia nu este suportată." -03020209="Alege directorul destinaţie." - -03020210="Aprobă ştergerea fişierului" -03020211="Aprobă ştergerea directorului" -03020212="Aprobă ştergerea mai multor fişiere" -03020213="Eşti sigur că vrei să ştergi '{0}'?" -03020214="Eşti sigur că vrei să ştergi directorul '{0}' şi tot conţinutul lui?" -03020215="Eşti sigur că vrei să ştergi aceste {0} obiecte?" -03020216="Şterg..." -03020217="Eroare la ştergerea fişierului sau directorului" -03020218="Sistemul nu poate muta un fişier cu cale lungă la Coşul de gunoi" - -03020220="Redenumesc..." -03020221="Eroare la redenumirea fişierului sau directorului" -03020222="Aprobă copierea fişierului" -03020223="Eşti sigur că vrei să copiezi fişierele în arhivă" - -03020230="Crează director" -03020231="Numele directorului:" -03020232="Director nou" -03020233="Eroare la crearea directorului" - -03020240="Crează fişier" -03020241="Numele fişierului:" -03020242="Fişier nou" -03020243="Eroare la crearea fişierului" - -03020250="Selectează" -03020251="Deselectează" -03020252="Masca:" - -03020260="Istoria directoarelor" - -03020280="Fişierul '{0}' a fost modificat.\nDoreşti să îl actualizez în arhivă?" -03020281="Nu pot actualiza fişierul\n'{0}'" -03020282="Nu pot porni editorul." -03020283="Deschid..." -03020284="The file looks like a virus (the file name contains long spaces in name)." - -03020290="Comentariu" -03020291="&Comentariu:" - -030202A0="Sistem" - -03020300="Computer" -03020301="Reţea" -03020302="Documente" - -03020400="Arhivează" -03020401="Dezarhivează" -03020402="Testează" - -03020420="Copiază" -03020421="Mută" -03020422="Şterge" -03020423="Info" - -03020500="Împarte fişierul" -03020501="Î&mparte în:" -03020510="Împart..." -03020520="Confirmă împărţirea" -03020521="Eşti sigur că vrei să imparţi arhiva în {0} volume (părţi)?" -03020522="Dimensiunea volumului trebuie să fie mai mică decât dimensiunea fişierului original" - -03020600="Uneşte fişierele" -03020601="&Uneşte în:" -03020610="Unesc..." -03020620="Alege doar prima parte din fişierul împărțit" -03020621="Nu pot detecta fișierul ca parte a fișierului împărțit" -03020622="Nu găsesc mai mult de o parte din fișierul împărțit" - -03020710="Calculez suma de control..." -03020720="Informaţii despre suma de control" -03020721="Suma de control CRC pentru conţinut:" -03020722="Suma de control CRC pentru conţinut şi nume:" - -03020800="Citesc..." - -03020900="Proprietăţi" - -03020A01="Operația nu poate fi apelată dintr-un director cu cale lungă." -03020A02="Trebuie să alegi un fișier" -03020A03="Trebuie să alegi unul sau mai multe fișiere" -03020A04="Fișierul {0} există deja" - -; Computer -03031100="Mărimea totală" -03031101="Spaţiu liber" -03031102="Mărimea grupului" -03031103="Etichetă" - -; Network -03031200="Nume local" -03031201="Distribuitor" - -; Benchmark Dialog - -03080000="Banc de încercare" -03080001="Memorie utilizată:" -03080002="Arhivez" -03080003="Dezarhivez" -03080004="Viteza" -03080005="Rata" -03080006="Rata totală" -03080007="Actual" -03080008="Rezultate" -03080009="Trecute:" -0308000A="Erori:" -0308000B="Utilizarea procesorului" -0308000C="Rata / Utilizare" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ru.txt b/tools/7-Zip/Lang/ru.txt deleted file mode 100644 index 53a4377248..0000000000 --- a/tools/7-Zip/Lang/ru.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by Igor Pavlov -; -; -; -; - -00000000="Russian" -00000001="Русский" -00000002="25" - -; 7-Zip Configuration - -; Title -01000000="7-Zip - Конфигурация" - -; Info Page -01000100="О программе 7-Zip" -01000103="7-Zip является свободно распространяемой программой." -01000104="Поддержка" -01000105="Зарегистрировать" - -; Folders Page -01000200="Папки" -01000210="&Рабочая папка" -01000211="&Системная временная папка" -01000212="&Текущая" -01000213="&Задать:" -01000214="Использовать только для сменных носителей" - -01000281="Укажите положение для временных архивов." - -; System Page -01000300="Система" -01000301="Встроить 7-Zip в контекстное меню оболочки" -01000302="Каскадное контекстное меню" -01000310="Элементы контекстного меню:" - -; Language Page -01000400="Язык" -01000401="Язык:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Команды 7-Zip." -02000103="Открыть архив" -02000104="Открытие выделенного архива." -02000105="Распаковать" -02000106="Извлечение файлов из выделенного архива." -02000107="Добавить к архиву..." -02000108="Добавить выделенные объекты к архиву." -02000109="Тестировать" -0200010A="Тестирование выделенного архива." -0200010B="Распаковать здесь" -0200010C="Извлечение файлов из выделенного архива в текущую папку." -0200010D="Распаковать в {0}" -0200010E="Извлечение файлов в подкаталог." -0200010F="Добавить к {0}" -02000110="Добавить выделенные объекты к архиву." -02000111="Сжать и отправить по email..." -02000112="Сжать выделенные объекты и отправить архив по email." -02000113="Сжать в {0} и отправить по email" -02000114="Сжать выделенные объекты и отправить архив по email." - -02000140="<Папка>" -02000141="<Архив>" - -; Properties -02000203="Путь" -02000204="Имя" -02000205="Расширение" -02000206="Папка" -02000207="Размер" -02000208="Сжатый" -02000209="Атрибуты" -0200020A="Создан" -0200020B="Открыт" -0200020C="Изменен" -0200020D="Непрерывный" -0200020E="Комментарий" -0200020F="Зашифрован" -02000210="Разбит До" -02000211="Разбит После" -02000212="Словарь" -02000213="CRC" -02000214="Тип" -02000215="Анти" -02000216="Метод" -02000217="Система" -02000218="Файловая Система" -02000219="Пользователь" -0200021A="Группа" -0200021B="Блок" -0200021C="Комментарий" -0200021D="Позиция" -0200021E="Путь" -0200021F="Папок" -02000220="Файлов" -02000221="Версия" -02000222="Том" -02000223="Многотомный" -02000224="Смещение" -02000225="Ссылок" -02000226="Блоков" -02000227="Томов" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="Процессор" -0200022C="Физический Размер" -0200022D="Размер Заголовков" -0200022E="Контрольная Сумма" -0200022F="Характеристики" -02000230="Виртуальный Адрес" -02000231="ID" -02000232="Короткое Имя" -02000233="Создатель" -02000234="Размер Сектора" -02000235="Режим" -02000236="Ссылка" - -; Status bar -02000301="Выделено объектов: {0}" -02000302="{0} объект(ов)" - -02000320="Файлов:" -02000321="Папок:" -02000322="Размер:" -02000323="Сжатый:" -02000324="Архивов:" - -; List Context Menu -02000401="&Столбцы..." - -02000411="&Открыть" -02000412="&Извлечь..." - -; ToolBar -02000501="Извлечь" - -; Messages -02000601="Операции изменения не поддерживаются для этого архива." -02000602="Не удалось изменить архив {0}" -02000603="Не удалось создать папку '{0}'" -02000604="Файл не является поддерживаемым архивом." -02000605="Ошибка" -02000606="Слишком много элементов" -02000607="Нет ассоциированного приложения" -02000608="Ошибок не найдено" -02000609="Не удалось открыть файл '{0}' как архив" -0200060A="Не удалось открыть зашифрованный архив '{0}'. Неверный пароль?" -0200060B="Недостаточно свободной памяти" -0200060C="Неизвестная ошибка" -0200060D="Неподдерживаемый тип архива" - -; Dialogs -02000702="OK" -02000705="&Да" -02000707="Да для &всех" -02000709="&Нет" -0200070B="Нет для в&сех" - -02000710="Отмена" -02000711="&Отмена" -02000713="&Закрыть" -02000714="Стоп" -02000715="Перезапуск" - -02000720="Помощь" - -; Extract dialog -02000800="Извлечь" -02000801="&Распаковать в:" -02000802="&Пароль" - -02000810="Пути" -02000811="По&лные пути" -02000812="О&тносительные пути" -02000813="&Без путей" - -02000820="Перезапись" -02000821="&С подтверждением" -02000822="Б&ез подтверждения" -02000823="Проп&ускать" -02000824="Переименовать автом." -02000825="Переим. автом. существ." - -02000830="Файлы" -02000831="Выбранные файлы" -02000832="Все файлы" - -02000881="Укажите положение для извлекаемых файлов." - -02000890="Распаковка" - -; Overwrite dialog -02000900="Подтверждение замены файла" -02000901="Папка уже содержит обрабатываемый файл." -02000902="Заменить существующий файл" -02000903="следующим файлом?" - -02000911="Переименовать автом." - -02000982="{0} байтов" -02000983="изменен" - -; Messages dialog -02000A00="Сообщения" - -02000A80="Сообщение" - -02000A91="Неподдерживаемый метод сжатия для файла '{0}'." -02000A92="Ошибка в данных в '{0}'. Файл испорчен." -02000A93="Ошибка CRC в '{0}'. Файл испорчен." -02000A94="Ошибка в данных зашифрованного файла '{0}'. Неверный пароль?" -02000A95="Ошибка CRC для зашифрованного файла '{0}'. Неверный пароль?" - -; Password dialog -02000B00="Ввод пароля" -02000B01="&Введите пароль:" -02000B02="&Показать пароль" -02000B03="&Повторите пароль:" -02000B10="Пароли не совпадают" -02000B11="Для пароля используйте только символы латинского алфавита, цифры и специальные символы (!, #, $, ...)" -02000B12="Пароль слишком длинный" - -; Progress dialog -02000C00="Процесс" -02000C01="Прошло:" -02000C02="Осталось:" -02000C03="Всего:" -02000C04="Скорость:" -02000C05="Размер:" -02000C06="Степень сжатия:" - -02000C10="&Фоном" -02000C11="&На передний план" -02000C12="&Пауза" -02000C13="&Продолжить" - -02000C20="На паузе" - -02000C30="Вы действительно хотите прервать операцию?" - -; Compress dialog -02000D00="Добавить к архиву" -02000D01="&Архив:" -02000D02="&Режим изменения:" -02000D03="&Формат архива:" -02000D04="&Метод сжатия:" -02000D05="Создать &Solid архив" -02000D06="&Параметры:" -02000D07="&Опции" -02000D08="Создать SF&X-архив" -02000D09="М&ногопоточность" -02000D0A="&Шифровать имена файлов" -02000D0B="&Уровень сжатия:" -02000D0C="Размер &словаря:" -02000D0D="Размер с&лова:" -02000D0E="Объем памяти для упаковки:" -02000D0F="Объем памяти для распаковки:" -02000D10="Шифрование" -02000D11="Метод шифрования:" -02000D12="Число потоков:" -02000D13="Размер блока:" -02000D14="По размеру файла" -02000D15="Непрерывный" -02000D16="Сжимать открытые для записи файлы" - -02000D40="Разбить на &тома размером (в байтах):" -02000D41="Ошибка в поле для задания размера томов" -02000D42="Установленный размер тома: {0} байтов.\nВы действительно хотите разбить архив на такие тома?" - -02000D81="Без сжатия" -02000D82="Нормальный" -02000D83="Максимальный" -02000D84="Быстрый" -02000D85="Скоростной" -02000D86="Ультра" - -02000D90="Пролистать" - -02000DA1="Добавить и заменить" -02000DA2="Обновить и добавить" -02000DA3="Обновить" -02000DA4="Синхронизировать" - -02000DB1="Все файлы" - -02000DC0="Компрессия" - -; Columns dialog -02000E00="Столбцы" -02000E01="Пометьте столбцы, которые следует отображать в этой папке. Кнопками \"Вверх\" и \"Вниз\" можно задать порядок следования столбцов." -02000E02="Выбранные столбцы должны иметь ширину" -02000E03="точек." - -02000E10="&Вверх" -02000E11="В&низ" -02000E12="П&оказать" -02000E13="&Скрыть" -02000E14="Установить" - -02000E81="Имя" -02000E82="Ширина" - -; Testing -02000F90="Тестирование" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Файл" -03000103="&Правка" -03000104="&Вид" -03000105="С&ервис" -03000106="&Справка" -03000107="&Избранное" - -; File -03000210="&Открыть" -03000211="Открыть &внутри" -03000212="Открыть снару&жи" -03000220="Просмотр" -03000221="&Редактировать" -03000230="Переи&меновать" -03000231="&Копировать в..." -03000232="&Переместить в..." -03000233="&Удалить" -03000240="Сво&йства" -03000241="Комме&нтарий..." -03000242="Контрольная сумма" -03000243="Diff" -03000250="&Создать Папку" -03000251="Созд&ать Файл" -03000260="В&ыход" -03000270="Ра&збить файл..." -03000271="О&бъединить файлы..." - -; Edit -03000310="&Отменить" -03000311="&Вернуть" -03000320="&Вырезать" -03000321="&Копировать" -03000322="Вст&авить" -03000323="&Удалить" -03000330="Выделить в&се" -03000331="Убрать выделение" -03000332="&Обратить в&ыделение" -03000333="Выделить..." -03000334="Убрать выделение..." -03000335="Выделить по типу" -03000336="Убрать выделение по типу" - -; View -03000410="&Крупные значки" -03000411="&Мелкие значки" -03000412="Спис&ок" -03000413="&Таблица" -03000420="Без сортировки" -03000430="Открыть корневую папку" -03000431="Переход на один уровень вверх" -03000432="История папок..." -03000440="О&бновить" -03000449="Плоский режим" -03000450="&2 Панели" -03000451="&Панели инструментов" -03000460="Панель кнопок архиватора" -03000461="Стандартная панель кнопок" -03000462="Большие кнопки" -03000463="Надписи на кнопках" - -; Tools -03000510="Настройки..." -03000511="Тестирование производительности" - -; Help -03000610="&Оглавление..." -03000620="О &программе..." - -; Favorites -03000710="Добавить папку в &избранное как" -03000720="Закладка" - -; Options Dialog - -03010000="Настройки" - -; Plugins -03010100="Плагины" -03010101="&Плагины:" -03010110="Сво&йства" - -; Edit -03010200="Редактор" -03010201="&Редактор:" -03010202="&Diff:" - -; System -03010300="Система" -03010302="Ассоциировать 7-Zip с файлами:" -03010310="Плагин" - -; Settings -03010400="Настройки" -03010401="Показывать элемент \"..\"" -03010402="Показывать реальные иконки файлов" -03010410="Показывать системное меню" -03010420="Курсор на всю строку" -03010421="Показывать разделители" -03010422="Открывать одним щелчком" -03010430="Альтернативный режим пометки" -03010440="Использовать большие страницы памяти" - -; Strings - -03020201="Копировать" -03020202="Переместить" -03020203="Копировать в:" -03020204="Переместить в:" -03020205="Копирование..." -03020206="Перемещение..." -03020207="Нельзя скопировать объекты для таких папок" -03020208="Операция не поддерживается для этой папки." -03020209="Укажите папку." - -03020210="Подтверждение удаления файла" -03020211="Подтверждение удаления папки" -03020212="Подтверждение удаления группы файлов" -03020213="Вы действительно хотите удалить \"{0}\"?" -03020214="Вы действительно хотите удалить папку \"{0}\" и все ее содержимое?" -03020215="Вы действительно хотите удалить эти объекты ({0} шт.)?" -03020216="Удаление..." -03020217="Ошибка при удалении файла или папки" -03020218="Система не поддерживает операцию удаления файлов с длинными путями в корзину" - -03020220="Переименование..." -03020221="Ошибка при переименовании файла или папки" -03020222="Подтверждение копирования файлов" -03020223="Вы действительно хотите скопировать эти файлы в архив" - -03020230="Создать папку" -03020231="Имя папки:" -03020232="Новая папка" -03020233="Ошибка при создании папки" - -03020240="Создать файл" -03020241="Имя файла:" -03020242="Новый файл" -03020243="Ошибка при создании файла" - -03020250="Выделить" -03020251="Убрать выделение" -03020252="Маска:" - -03020260="История папок" - -03020280="Файл '{0}' был изменен.\nВы хотите обновить его в архиве?" -03020281="Не удалось обновить файл\n'{0}'" -03020282="Не удалось запустить редактор" -03020283="Открытие..." -03020284="Файл похож на вирус (имя файла содержит длинную последовательность пробелов)." - -03020290="Комментарий" -03020291="&Комментарий:" - -030202A0="Система" - -03020300="Компьютер" -03020301="Сеть" -03020302="Документы" - -03020400="Добавить" -03020401="Извлечь" -03020402="Тестировать" - -03020420="Копировать" -03020421="Переместить" -03020422="Удалить" -03020423="Информация" - -03020500="Разбить файл" -03020501="&Разбить в:" -03020510="Разбиение..." -03020520="Подтверждение разбиения" -03020521="Вы действительно хотите разбить файл на {0} частей?" -03020522="Размер тома должен быть меньше размера исходного файла" - -03020600="Объединить файлы" -03020601="&Объединить в:" -03020610="Объединение..." -03020620="Необходимо выделить только первую часть разбитого файла" -03020621="Не удалось распознать разбитый файл" -03020622="Не удалось найти более одной части разбитого файла" - -03020710="Вычисление контрольной суммы..." -03020720="Контрольная сумма" -03020721="Контрольная сумма CRC для данных:" -03020722="Контрольная сумма CRC для данных и имен:" - -03020800="Сканирование..." - -03020900="Свойства" - -03020A01="Операция не может быть исполнена из папки, которая имеет длинный путь." -03020A02="Вы должны выделить один файл" -03020A03="Вы должны выделить один или несколько файлов" -03020A04="Файл {0} уже существует" - -; Computer -03031100="Емкость" -03031101="Свободно" -03031102="Размер кластера" -03031103="Метка" - -; Network -03031200="Локальное имя" -03031201="Провайдер" - -; Benchmark Dialog - -03080000="Тестирование производительности" -03080001="Объем памяти:" -03080002="Упаковка" -03080003="Распаковка" -03080004="Скорость" -03080005="Рейтинг" -03080006="Общий рейтинг" -03080007="Текущий" -03080008="Итоговый" -03080009="Проходов:" -0308000A="Ошибок:" -0308000B="Нагрузка" -0308000C="Рейтинг / Нагр." - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/si.txt b/tools/7-Zip/Lang/si.txt deleted file mode 100644 index 051e61538b..0000000000 --- a/tools/7-Zip/Lang/si.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Translated by සුපුන් බුධාජීව (Supun Budhajeewa) -; -; -; -; - -00000000="Sinhala" -00000001="සිංහල" -00000002="91" - -; 7-Zip Configuration - -; Title -01000000="7-Zip වින්‍යාසගත කිරීම්" - -; Info Page -01000100="7-Zip පිළිබඳව" -01000103="7-Zip නිදහස් මෘදුකාංගයක් වුවත්, ලියාපදිංචි වීම මගින් 7-Zip හි වැඩි දියුණුව සඳහා ඔබට දායක විය හැකිය.\n\nමෙම සිංහල භාෂා පරිවර්තනය G.S.N. සුපුන් බුධාජීව (budhajeewa@gmail.com) විසින් සිදු කරන ලදී." -01000104="සහය දෙන්න" -01000105="ලියාපදිංචි වෙන්න" - -; Folders Page -01000200="බහාලුම්" -01000210="සක්‍රීය බහාලුම් (&W)" -01000211="පද්ධති තාවකාලික දෑ (Temp) බහාලුම (&S)" -01000212="වත්මන් (&C)" -01000213="තෝරන්න (&S):" -01000214="ඉවත් කළ හැකි ධාවක සඳහා පමණක් භාවිතා කරන්න" - -01000281="තාවකාලික හැකිළුම් ගොනු සඳහා ස්ථානයක් දෙන්න." - -; System Page‍ -01000300="පද්ධතිය" -01000301="Shell context මෙනුව වෙත 7-Zip අන්තර්ගත කරන්න" -01000302="Context menu අංග එක් අංගයක් යටතේ සඳහන් කරන්න‍‍‍" -01000310="Context මෙනු අංග:" - -; Language Page -01000400="භාෂාව" -01000401="භාෂාව:" - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip විධාන" -02000103="හැකිළුම විවෘත කරන්න" -02000104="තෝරා ඇති හැකිළුම විවෘත කරයි." -02000105="ගොනු ලිහන්න..." -02000106="තෝරා ඇති හැකිළුමෙන් ගොනු ලිහයි." -02000107="හැකිළුමකට ඇතුල් කරන්න..." -02000108="තෝරා ඇති වස්තු හැකිළුමකට ඇතුල් කරයි." -02000109="හැකිළුම පරීක්ෂා කරන්න" -0200010A="තෝරා ඇති හැකිළුම පරීක්ෂා කරයි." -0200010B="මෙතැනට ලිහන්න" -0200010C="තෝරා ඇති හැකිළුම ලිහා, එහි ගොනු වත්මන් බහාලුමට එක් කරයි." -0200010D="{0} වෙත ලිහන්න" -0200010E="හැකිළුම ලිහා, එහි ගොනු උප බහාලුමකට එක් කරයි." -0200010F="{0} වෙත එක් කරන්න" -02000110="තෝරාගත් වස්තු දැනටමත් නිර්මිත හැකිළුමකට එක් කරයි." -02000111="හකුළා විදුලි තැපැල් කරන්න..." -02000112="තෝරා ඇති වස්තු හකුළා විදුලි තැපෑල හරහා යවයි." -02000113="{0} වෙත හකුළා විදුලි තැපැල් කරන්න" -02000114="තෝරාගත් වස්තු දැනටමත් නිර්මිත හැකිළුමකට එක් කර විදුලි තැපෑල හරහා යවයි." - -02000140="<බහාලුම>" -02000141="<හැකිළුම>" - -; Properties -02000203="මංපෙත" -02000204="නම" -02000205="දිගුව" -02000206="බහාලුම" -02000207="විශාලත්වය" -02000208="හැකිළුමෙන් පසු විශාලත්වය" -02000209="ලක්ෂණ" -0200020A="නිර්මාණය කළ දිනය" -0200020B="ප්‍රවේශ වූ දිනය" -0200020C="අළුත් කළ දිනය" -0200020D="සවි" -0200020E="ටීකා කොට ඇත" -0200020F="සුරක්ෂිතය" -02000210="Split Before" -02000211="Split After" -02000212="Dictionary" -02000213="CRC" -02000214="වර්ගය" -02000215="Anti" -02000216="ක්‍රමය" -02000217="ධාරක මෙහෙයුම් පද්ධතිය" -02000218="ගොනු පද්ධතිය" -02000219="පරිශිලක" -0200021A="සමූහය" -0200021B="Block" -0200021C="ටීකාව" -0200021D="පිහිටීම" -0200021E="Path Prefix" -0200021F="බහාලුම්" -02000220="ගොනු" -02000221="සංස්කරණය" -02000222="Volume" -02000223="Multivolume" -02000224="Offset" -02000225="සබැඳීන්" -02000226="Blocks" -02000227="Volumes" - -02000229="බිට්-64" -0200022A="Big-endian" -0200022B="මධ්‍යම සැකසුම් පද්ධතිය (CPU)" -0200022C="භෞතික විශාලත්වය" -0200022D="ශීර්ෂ විශාලත්වය" -0200022E="Checksum" -0200022F="මුහුණුවර" -02000230="Virtual Address" - -; Status bar -02000301="වස්තු {0}ක් තෝරා ඇත" -02000302="වස්තු {0}" - -02000320="ගොනු:" -02000321="බහාලුම්:" -02000322="ප්‍රමාණය:" -02000323="හැකිළු පසු ප්‍රමාණය:" -02000324="හැකිළුම්:" - -; List Context Menu -02000401="කොලමයන් (&C)..." - -02000411="විවෘත කරන්න (&O)" -02000412="ලිහන්න (&Ex)..." - -; ToolBar -02000501="ලිහන්න" - -; Messages -02000601="මෙම හැකිළුම සඳහා යාවත්කාල කිරීම් සහයෝගය නොදක්වයි." -02000602="{0} හැකිළුම යාවත්කාල කල නොහැක" -02000603="'{0}' බහාලුම තැනිය නොහැක" -02000604="ගොනුව සහයෝගී හැකිළුමක් නොවේ." -02000605="දෝෂයක්" -02000606="අංග ඉතා අධිකය" -02000607="දෙන ලද ගොනු නාම දිගුව හා ආශ්‍රිත යෙදවුමක් නැත" -02000608="දෝෂ නොමැත" -02000609="'{0}' ගොනුව හැකිළුමක් ලෙස විවෘත කළ නොහැක" -0200060A="සුරක්ෂිත '{0}' හැකිළුම විවෘත කළ නොහැක. මුරපදය වැරදි ද ?" -0200060B="අවශ්‍ය මතක ප්‍රමාණය පද්ධතියට වෙන් කර ගත නොහැක" -0200060C="හඳුනා නොගත් දෝෂයක්" -0200060D="සහයෝගී නොවන හැකිළුම් ක්‍රමයක්" - -; Dialogs -02000702="හරි" -02000705="ඔවු (&Y)" -02000707="සියල්ලටම ඔවු (&A)" -02000709="නැහැ (&N)" -0200070B="සියල්ලටම නැහැ(&L)" - -02000710="එපා" -02000711="එපා (&C)" -02000713="වසන්න (&C)" -02000714="නවතන්න" -02000715="ප්‍රත්‍යාරම්භ කරන්න" - -02000720="උදව්" - -; Extract dialog -02000800="ලිහන්න" -02000801="ලිහීමට තැනක් (&X) :" -02000802="මුරපදය" - -02000810="මංපෙත් ස්වභාවය" -02000811="සම්පූර්ණ මංපෙත් නම්" -02000812="වර්තමාන මංපෙත් නම්" -02000813="මංපෙත් නම් අවශ්‍ය නැත" - -02000820="උඩින් ලිවීමේ ස්වභාවය" -02000821="උඩින් ලියන්නට පෙර විමසන්න" -02000822="විමසීමෙන් තොරව උඩින් ලියන්න" -02000823="දැනටමත් ඇති ගොනු මගහරින්න" -02000824="ගොනු ස්වයංක්‍රියව ප්‍රතිනම් කරන්න" -02000825="දැනටමත් ඇති ගොනු‍ ප්‍රතිනම් කරන්න" - -02000830="ගොනු" -02000831="තෝරාගත් ගොනු (&S)" -02000832="සියළු ගොනු (&A)" - -02000881="ලිහන ලද ගොනු සඳහා ස්ථානයක් තෝරන්න." - -02000890="ලිහමින් පවතී‍" - -; Overwrite dialog -02000900="ගොනු ප්‍රතිස්ථාපනය තහවුරු කර ගැනීම" -02000901="ගමනාන්ත බහාලුමේ දැනටමත් නිර්මිත ගොනුවක් ඇත." -02000902="දැනටම පවතින පහත ගොනුව," -02000903="මෙය සමග ප්‍රතිස්ථාපනය කරන්න ද ?" - -02000911="ස්වයංක්‍රියව ප්‍රතිනම් කරන්න (&U)" - -02000982="{0} බයිට (Bytes)" -02000983="නව්‍ය කළේ" - -; Messages dialog -02000A00="විනිශ්චීය පණිවුඩ" - -02000A80="පණිවිඩය" - -02000A91="'{0}' සඳහා සහයෝගය නොදක්වන හැකිළුම් ක්‍රමයක්." -02000A92="'{0}' හි දත්ත දෝෂයකි. ගොනුව බිඳී ඇත." -02000A93="'{0}' හි CRC අසමත් විනි. ගොනුව බිඳී ඇත." -02000A94="සුරක්ෂිත '{0}' ගොනුවේ දත්ත දෝෂයකි. වැරදි මුරපදයක් ද ?" -02000A95="සුරක්ෂිත '{0}' ගොනුවේ CRC අසමත් විනි. වැරදි මුරපදයක් ද ?" - -; Password dialog -02000B00="මුරපදය ඇතුල් කරන්න" -02000B01="මුරපදය ඇතුල් කරන්න:" -02000B02="මුරපදය පෙන්වන්න (&S)" -02000B03="මුරපදය නැවත ඇතුල් කරන්න:" -02000B10="මුරපද නොගැලපේ" -02000B11="මුරපද සඳහා ඉංග්‍රිසි අකුරු, ඉලක්කම් සහ විශේෂිත සංකේත පමණක් භාවිතා කරන්න (!, #, $, ...)" -02000B12="මුරපදය දිග වැඩිය" - -; Progress dialog -02000C00="ක්‍රියාවලිය" -02000C01="ගතවූ කාලය:" -02000C02="ඉතිරි කාලය:" -02000C03="සම්පූර්ණ විශාලත්වය:" -02000C04="වේගය:" -02000C05="ක්‍රියාවලියට භාජනය වූ ප්‍රමාණය:" -02000C06="හැකිළුම් අනුපාතය:" - -02000C10="පසුබිමින් (&B)" -02000C11="පෙරබිමින් (&F)" -02000C12="මදකට නවතන්න (&P)" -02000C13="නැවත අරඹන්න (&C)" - -02000C20="මදකට නවතා ඇත" - -02000C30="ඉවත්වීමට අවශ්‍ය බව විශ්වාස ද ?" - -; Compress dialog -02000D00="හැකිළුමකට එක් කරන්න" -02000D01="හැකිළුම (&A):" -02000D02="යාවත්කාල කිරීමේ ස්වභාවය (&U):" -02000D03="හැකිළුම් රටාව (&F):" -02000D04="හැකිළුම් ක්‍රමය (&M):" -02000D05="සවි හැකිළුමක් තනන්න (&S)" -02000D06="පරාමිති (&P):" -02000D07="විකල්ප" -02000D08="SF&X හැකිළුමක් තනන්න" -02000D09="Multi-threading" -02000D0A="ගොනු නාම සුරකින්න (&S)" -02000D0B="හැකිළුම් මට්ටම (&L):" -02000D0C="&Dictionary size:" -02000D0D="&Word size:" -02000D0E="හැකිලීම සඳහා මතක භාවිතය:" -02000D0F="ලිහීම ක්‍රියාව සඳහා මතක භාවිතය:" -02000D10="සුරැකුම්" -02000D11="සුරැකුම් ක්‍රමය:" -02000D12="Number of CPU threads:" -02000D13="Solid block size:" -02000D14="සවි-නොමැති" -02000D15="සවි" -02000D16="හවුල්කාර ගොනු ද හකුළන්න" - -02000D40="කොටස් වලට බෙදන්න, බයිට (bytes):" -02000D41="වැරදි කොටස් විශාලත්වයකි" -02000D42="සඳහන් කරන ලද කොටස් විශාලත්වය බයිට {0} කි.\nහැකිළුම මෙවන් කොටස් වලට බෙදියයුතු බව විශ්වාස ද ?" - -02000D81="තැන්පත් කරන්න" -02000D82="සාමාන්‍ය" -02000D83="උපරිම" -02000D84="වේගවත්" -02000D85="ඉතා වේගවත්" -02000D86="අධි හැකිළුම්‍" - -02000D90="සොයන්න" - -02000DA1="ගොනු එක් කර ප්‍රතිස්ථාපනය කරන්න" -02000DA2="ගොනු යාවත්කාල කර එක් කරන්න" -02000DA3="දැනටමත් ඇති ගොනු නැවුම් කරන්න" -02000DA4="ගොනු සමකාලී කරන්න" - -02000DB1="සියළු ගොනු" - -02000DC0="හකුළමින් පවතී" - -; Columns dialog -02000E00="කොලම" -02000E01="මෙම බහාලුමේ දිස්වනවාට ඔබ කැමති කොලමයන් තෝරන්න. කොලමයන් පිලිවෙල කිරීම සඳහා ඉහළට සහ පහළට යන බොත්තම් භාවිත කරන්න." -02000E02="තෝරාගත් කොලමයන්," -02000E03="පික්සල් පළල (&W)." - -02000E10="ඉහළට (&U)" -02000E11="පහළට (&D)" -02000E12="පෙන්වන්න (&S)" -02000E13="සඟවන්න (&H)" -02000E14="පිහිටුවන්න" - -02000E81="නාමය" -02000E82="පළල" - -; Testing -02000F90="පරීක්ෂා කිරීම" - -; File Manager - -03000000="7-Zip ගොනු කළමනාකරු" - -; Menu -03000102="ගොනුව (&F)" -03000103="සැකසුම් (&E)" -03000104="දසුන (&V)" -03000105="මෙවලම් (&T)" -03000106="උදව් (&H)" -03000107="කැමතිම (&A)" - -; File -03000210="විවෘත කරන්න (&O)" -03000211="මෙහිම විවෘත කරන්න (&I)" -03000212="පිටතින් විවෘත කරන්න (&U)" -03000220="දසුන (&V)" -03000221="සංස්කරණය කරන්න (&E)" -03000230="නැවත නම් කරන්න (&M)" -03000231="වෙනත් තැනකට පිටපත් කරන්න (&C)..." -03000232="වෙනත් තැනකට ගෙනය‍න්න (&M)..." -03000233="මකන්න (&D)" -03000240="වත්කම් (&R)" -03000241="ටීකා (&N)" -03000242="checksum ගණනය කරන්න" -03000250="බහාලුමක් තනන්න" -03000251="ගොනුවක් තනන්න" -03000260="ඉවත් වන්න (&X)" -03000270="ගොනුව බෙදන්න (&S)..." -03000271="ගොනු එකතු කරන්න (&B)..." - -; Edit -03000310="අහෝසි කරන්න (&U)" -03000311="යළි කරන්න (&R)" -03000320="කපන්න (&T)" -03000321="පිටපත් කරන්න (&C)" -03000322="අලවන්න (&P)" -03000323="මකන්න (&D)" -03000330="සියල්ල තෝරන්න (&A)" -03000331="තෝරන ලද සියල්ල ඉන් ඉවත් කරන්න" -03000332="අනෙක් පැත්තට තෝරන්න (&I)" -03000333="තෝරන්න..." -03000334="තේරීම ඉවත් කරන්න..." -03000335="වර්ගයෙන් තෝරන්න" -03000336="වර්ගයෙන් තේරීම ඉවත් කරන්න" - -; View -03000410="විශාල මූර්ති (&G)" -03000411="කුඩා මූර්ති (&M)" -03000412="ලයිස්තුව (&L)" -03000413="සවිස්තර (&D)" -03000420="අසුරන නොලද" -03000430="ප්‍රධාන බහාලුම විවෘත කරන්න" -03000431="ඉහළට එක් ස්ථරයක්" -03000432="බහාලුම් අතීතය..." -03000440="ප්‍රතිපූරණය කරන්න(&R)" -03000449="පැතලි දසුන" -03000450="පැනල &2" -03000451="මෙවලම් තීරු (&T)" -03000460="හැකිළුම් මෙවලම් තීරුව" -03000461="සම්මත මෙවලම් තීරුව" -03000462="විශාල බොත්තම්" -03000463="බොත්තම් පෙළ දක්වන්න" - -; Tools -03000510="විකල්ප (&O)..." -03000511="&Benchmark" - -; Help -03000610="අන්තර්ගතය (&C)..." -03000620="7-Zip පිළිබඳව (&A)..." - -; Favorites -03000710="බහාලුම කැමතිම අංග වලට එකතු කරන අයුර (&A)" -03000720="පොත් සලකුණ - අංක" - -; Options Dialog - -03010000 = "විකල්ප" - -; Plugins -03010100 = "ප්ලගින" -03010101 = "ප්ලගින (&P):" -03010110 = "විකල්ප..." - -; Edit -03010200 = "සංස්කාරකය" -03010201 = "සංස්කාරකය (&E):" - -; System -03010300 = "පද්ධතිය" -03010302 = "7-Zip සමග හවුල් කරන්න:" -03010310 = "ප්ලගින" - -; Settings -03010400 = "සෙටිංග්ස්" -03010401 = "\"..\" අංගය පෙන්වන්න" -03010402 = "ගොනු වල සත්‍ය මූර්තිය පෙන්වන්න" -03010410 = "පද්ධති මෙනුව පෙන්වන්න" -03010420 = "සම්පූර්ණ තීරු තේරීම (&F)" -03010421 = "වගු රේභා පෙන්වන්න (&G)" -03010430 = "වෛකල්පිත තේරීම් ස්වභාවය (&A)" -03010440 = "විශාල මතක පිටු භාවිතා කරන්න (&L)" - -; Strings - -03020201 = "පිටපත් කරන්න" -03020202 = "ගෙනයන්න" -03020203 = "වෙනත් තැනකට පිටපත් කරන්න:" -03020204 = "වෙනත් තැනකට ගෙනයන්න:" -03020205 = "පිටපත් කරමින් පවතී..." -03020206 = "ගෙනයමින් පවතී..." -03020207 = "මෙවන් බහාලුම් වලට ගොනු පිටපත් හෝ ගෙනයාම කළ නොහැක." -03020208 = "ක්‍රියාව කල නොහැක." -03020209 = "ගමනාන්ත බහාලුම තෝරන්න." - -03020210 = "ගොනු මැකීම තහවුරු කිරීම" -03020211 = "බහාලුම් මැකීම තහවුරු කිරීම" -03020212 = "බහු ගොනු මැකීම තහවුරු කිරීම" -03020213 = "ඔබට '{0}' මැකීමට අවශ්‍ය බව විශ්වාස ද ?" -03020214 = "ඔබට '{0}' බහාලුම හා එහි අන්තර්ගතය මැකීමට අවශ්‍ය බව විශ්වාස ද ?" -03020215 = "ඔබට {0} යන වස්තු මැකීමට අවශ්‍ය බව විශ්වාස ද ?" -03020216 = "මකමින් පවතී..." -03020217 = "ගොනුව හෝ බහාලුම මැකීමේ දී දෝෂයක් මතු විය" -03020218="දිගු මංපෙතක් ඇති ගොනුවක් කුණු බඳුනට යැවීම පද්ධතියට කල නොහැක." - -03020220 = "ප්‍රතිනම් කරමින් පවතී..." -03020221 = "ගොනුව හෝ බහාලුම මැකීමේදී දෝෂයක් මතු විය" -03020222 = "ගොනු පිටපත් කිරීම තහවුරු කිරීම" -03020223 = "ගො‍නුව හැකිළුම වෙත පිටපත් කළ යුතු බව ඔබට විශ්වාස ද" - -03020230 = "බහාලුමක් තනන්න" -03020231 = "බහාලුම් නාමය:" -03020232 = "නව බහාලුමක්" -03020233 = "බහාලුම තැනීමේදී දෝෂයක් මතුවිය" - -03020240 = "ගොනුවක් තනන්න" -03020241 = "ගොනු නාමය:" -03020242 = "නව ගොනුවක්" -03020243 = "ගොනුව තැනීමේදී දෝෂයක් මතුවිය" - -03020250 = "තෝරන්න" -03020251 = "තේරීම ඉවත් කරන්න" -03020252 = "ගොනුවේ හෝ බහාලුමේ නම හෝ කොටසක්:" - -03020260 = "බහාලුම් අතීතය" - -03020280 = "'{0}' ගොනුව නව්‍ය කෙරිනි.\nහැකිළුමෙහි එය යාවත්කාල කිරීමට ඔබට අවශ්‍ය ද ?" -03020281 = "ගොනුව යාවත්කාල කල නොහැක\n'{0}'" -03020282 = "සංස්කාරකය විවෘත කළ නොහැක." -03020283 = "විවෘත කරමින් පවතී..." -03020284="ගොනුව වෛරසයක් වැනිය (ගොනු නාමයේ දිගු හිස් තැන් ඇත)." - -03020290 = "ටීකාව" -03020291 = "ටීකාව (&C):" - -030202A0 = "පද්ධතිය" - -03020300 = "පරිගණකය" -03020301 = "ජාලය" -03020302="ලියකියවිලි" - -03020400 = "හකුළන්න" -03020401 = "ලිහන්න" -03020402 = "පරීක්ෂා කරන්න" - -03020420 = "පිටපත් කරන්න" -03020421 = "ගෙන යන්න" -03020422 = "මකන්න" -03020423 = "තොරතුරු" - -03020500 = "ගොනුව බෙදන්න" -03020501 = "ගොනුව බෙදා කොටස් මෙහි තැන්පත් කරන්න (&S):" -03020510 = "ගොනුව බෙදමින් පවතී..." -03020520 = "ගොනුව බෙදීම තහවුරු කරන්න" -03020521 = "ගොනුව කොටස් {0} කට බෙදීමට අවශ්‍ය බව ඔබට විශ්වාස ද ?" -03020522 = "බෙදූ කොටසක විශාලත්වය, මුල් ගොනුවේ විශාලත්වයට වඩා අඩු විය යුතුය" - -03020600 = "බෙදූ ගොනු එක් කරන්න" -03020601 = "බෙදූ ගොනු එක් කර මෙහි තැනපත් කරන්න (&C):" -03020610 = "බෙදූ ගොන එක් කරමින් පවතී..." -03020620 = "පළමු ගොනුව පමණක් තෝරන්න" -03020621="ගොනුව, බෙදන ලද ගොනුවක කොටසක් ලෙස හඳුනාගත නොහැක." -03020622="බෙදන ලද ගොනුවේ කොටස් වලින් එකකට වඩා සොයාගත නොහැක." - -03020710 = "Checksum calculating..." -03020720 = "Checksum information" -03020721 = "CRC checksum for data:" -03020722 = "CRC checksum for data and names:" - -03020800 = "සුපිරික්සමින් පවතී..." - -03020900 = "වත්කම්" - -03020A01="දිගු මංපෙතක් ඇති බහාලුමකින් ක්‍රියාකාරීත්වය කැඳවිය නොහැක." -03020A02="එක් ගොනුවක් පමණක් තේරිය යුතුය." -03020A03="ගොනු එකක් හෝ වැඩි ගණනක් තේරිය යුතුය." -03020A04="{0} ගොනුව දැනටමත් ඇත" - -; Computer -03031100 = "සම්පූර්ණ විශාලත්වය" -03031101 = "නිදහස් ඉඩ" -03031102 = "Cluster විශාලත්වය" -03031103 = "නම් පත" - -; Network -03031200 = "Local Name" -03031201 = "සපයන්නා" - -; Benchmark Dialog - -03080000 = "Benchmark" -03080001 = "මතක භාවිතය:" -03080002 = "හැකිළුම්" -03080003 = "ලිහුම්" -03080004 = "වේගය" -03080005 = "ඇගයුම" -03080006 = "සම්පූර්ණ ඇගයුම" -03080007 = "වත්මන්" -03080008 = "ප්‍රතිඵලිත" -03080009 = "Passes:" -0308000A = "දෝෂ:" -0308000B = "CPU භාවිතාව" -0308000C = "ඇගයුම / භාවිතාව‍" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/sk.txt b/tools/7-Zip/Lang/sk.txt deleted file mode 100644 index 424e88b43e..0000000000 --- a/tools/7-Zip/Lang/sk.txt +++ /dev/null @@ -1,543 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 beta -; Translated by Pavel Devečka -; -; -; -; - -00000000="Slovak" -00000001="Slovenčina" -00000002="27" - -; 7-Zip Configuration - -; Title -01000000="Nastavenia 7-Zip" - -; Info Page -01000100="O programe 7-Zip" -01000103="7-Zip je voľne šíriteľný program. Jeho vývoj môžete podporiť tým, že sa zaregistrujete." -01000104="Podporiť" -01000105="Zaregistrovať" - -; Folders Page -01000200="Adresáre" -01000210="&Pracovný adresár" -01000211="&Systémový adresár pre dočasné súbory" -01000212="&Aktuálny adresár" -01000213="&Manuálne vybraný adresár:" -01000214="Po&užiť len pre vymeniteľné jednotky" - -01000281="Vyberte adresár pre dočasné súbory." - -; System Page -01000300="Systém" -01000301="Integrovať 7-Zip do kontextového menu" -01000302="Kaskádové kontextové menu" -01000310="Položky kontextového menu:" - -; Language Page -01000400="Jazyk" -01000401="Jazyk:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Príkazy 7-Zip" -02000103="Otvoriť archív" -02000104="Otvorí vybraný archív." -02000105="Rozbaliť súbory..." -02000106="Rozbalí súbory z vybraného archívu." -02000107="Pridať do archívu..." -02000108="Pridá vybrané položky do archívu." -02000109="Otestovať archív" -0200010A="Otestuje integritu vybraného archívu." -0200010B="Rozbaliť tu" -0200010C="Rozbalí súbory z vybraného archívu do aktuálneho adresára." -0200010D="Rozbaliť do {0}" -0200010E="Rozbalí súbory do podadresára." -0200010F="Pridať do {0}" -02000110="Pridá vybrané položky do archívu." -02000111="Skomprimovať a poslať emailom..." -02000112="Skomprimuje vybrané položky do archívu a pošle archív emailom." -02000113="Skomprimovať do {0} a poslať emailom" -02000114="Skomprimuje vybrané položky do archívu a pošle archív emailom." - -02000140="" -02000141="" - -; Properties -02000203="Cesta" -02000204="Meno" -02000205="Prípona" -02000206="Adresár" -02000207="Veľkosť" -02000208="Veľkosť po kompresii" -02000209="Atribúty" -0200020A="Vytvorený" -0200020B="Sprístupnený" -0200020C="Zmenený" -0200020D="Jednoliaty" -0200020E="Komentovaný" -0200020F="Zašifrovaný" -02000210="Rozdelený predtým" -02000211="Rozdelený potom" -02000212="Slovník" -02000213="CRC" -02000214="Typ" -02000215="Anti" -02000216="Metóda" -02000217="Hostiteľský OS" -02000218="Súborový systém" -02000219="Užívateľ" -0200021A="Skupina" -0200021B="Blok" -0200021C="Komentár" -0200021D="Pozícia" -0200021E="Predpona cesty" -0200021F="Adresáre" -02000220="Súbory" -02000221="Verzia" -02000222="Zväzok" -02000223="Multizväzok" -02000224="Ofset" -02000225="Väzby" -02000226="Bloky" -02000227="Zväzky" - -02000229="64-bitov" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Fyzická veľkosť" -0200022D="Veľkosť hlavičiek" -0200022E="Kontrolný súčet" -0200022F="Charakteristiky" -02000230="Virtuálna adresa" -02000231="ID" -02000232="Skrátený názov" -02000233="Aplikácia" -02000234="Veľkosť sektoru" -02000235="Režim" -02000236="Odkaz" - -; Status bar -02000301="{0} objekt(ov) vybraných" -02000302="{0} objekt(ov)" - -02000320="Súbory:" -02000321="Adresáre:" -02000322="Veľkosť:" -02000323="Veľkosť po kompresii:" -02000324="Archívy:" - -; List Context Menu -02000401="&Stĺpce..." - -02000411="&Otvoriť" -02000412="&Rozbaliť..." - -; ToolBar -02000501="Rozbaliť" - -; Messages -02000601="Aktualizačné operácie nie sú v tomto archíve podporované." -02000602="Nemožno aktualizovať archív {0}" -02000603="Nemožno vytvoriť adresár '{0}'." -02000604="Súbor nie je podporovaný archív." -02000605="Chyba" -02000606="Priveľa položiek" -02000607="Žiadna aplikácia nie je priradená k súborom s touto príponou." -02000608="V archíve sa nenašli žiadne chyby." -02000609="Súbor '{0}' nemožno otvoriť ako archív." -0200060A="Nemožno otvoriť šifrovaný archív '{0}'. Nesprávne heslo?" -0200060B="Systém nemôže alokovať požadované množstvo pamäte." -0200060C="Neznáma chyba" -0200060D="Nepodporovaný typ archívu" - -; Dialogs -02000702="OK" -02000705="&Áno" -02000707="Áno na &všetko" -02000709="&Nie" -0200070B="Nie na vš&etko" - -02000710="Storno" -02000711="&Storno" -02000713="&Zatvoriť" -02000714="Zastaviť" -02000715="Reštartovať" - -02000720="Nápoveda" - -; Extract dialog -02000800="Rozbaliť" -02000801="Rozbaliť do:" -02000802="Heslo" - -02000810="Nastavenie názvov ciest" -02000811="Plné názvy ciest" -02000812="Aktuálne názvy ciest" -02000813="Žiadne názvy ciest" - -02000820="Nastavenie prepísania" -02000821="Spýtať sa pred prepísaním" -02000822="Prepísať bez výzvy" -02000823="Preskočiť existujúce súbory" -02000824="Automaticky premenovať" -02000825="Auto. premenovať existujúce súbory" - -02000830="Súbory" -02000831="&Vybrané súbory" -02000832="Vš&etky súbory" - -02000881="Špecifikujte adresár pre rozbalené súbory." - -02000890="Rozbaľovanie" - -; Overwrite dialog -02000900="Potvrdenie nahradenia súboru" -02000901="Cieľový adresár už obsahuje rozbaľovaný súbor." -02000902="Chcete nahradiť existujúci súbor" -02000903="týmto?" - -02000911="&Automaticky premenovať" - -02000982="{0} bajtov" -02000983="upravených" - -; Messages dialog -02000A00="Diagnostické správy" - -02000A80="Správa" - -02000A91="Nepodporovaná kompresná metóda pre '{0}'." -02000A92="Dátová chyba v '{0}'. Súbor je porušený." -02000A93="CRC zlyhalo v '{0}'. Súbor je porušený." -02000A94="Dátová chyba v šifrovanom súbore '{0}'. Nesprávne heslo?" -02000A95="CRC zlyhalo v šifrovanom súbore '{0}'. Nesprávne heslo?" - -; Password dialog -02000B00="Zadajte heslo" -02000B01="Zadajte heslo:" -02000B02="Ukázať heslo" -02000B03="Zopakujte heslo:" -02000B10="Heslá nie sú zhodné!" -02000B11="Používajte len písmená bez diakritiky, čísla a špeciálne znaky (!, #, $, ...)!" -02000B12="Heslo je príliš dlhé!" - -; Progress dialog -02000C00="Priebeh" -02000C01="Uplynutý čas:" -02000C02="Zostávajúci čas:" -02000C03="Veľkosť:" -02000C04="Rýchlosť:" -02000C05="Spracované:" -02000C06="Úroveň kompresie:" - -02000C10="&Pozadie" -02000C11="P&opredie" -02000C12="Po&zastaviť" -02000C13="Po&kračovať" - -02000C20="Pozastavené" - -02000C30="Ste si istý, že chcete akciu zrušiť?" - -; Compress dialog -02000D00="Pridať do archívu" -02000D01="&Archív:" -02000D02="&Nastavenie aktualizácie súborov v existujúcich archívoch:" -02000D03="&Formát archívu:" -02000D04="&Kompresná metóda:" -02000D05="V&ytvoriť jednoliaty archív" -02000D06="&Parametre:" -02000D07="Možnosti" -02000D08="Vytvoriť samorozbaľovací archív" -02000D09="Multi-threading" -02000D0A="Zašifrovať mená súborov" -02000D0B="Ú&roveň kompresie:" -02000D0C="&Veľkosť slovníka:" -02000D0D="V&eľkosť slova:" -02000D0E="Pamäť potrebná na kompresiu:" -02000D0F="Pamäť potrebná na dekompresiu:" -02000D10="Šifrovanie" -02000D11="Metóda šifrovania:" -02000D12="Poče&t CPU vlákien:" -02000D13="Veľk&osť jednoliateho bloku:" -02000D14="Nejednoliaty" -02000D15="Jednoliaty" -02000D16="Komprimovať zdieľané súbory" - -02000D40="Roz&deliť na časti, bajtov:" -02000D41="Nesprávna veľkosť časti" -02000D42="Vybraná veľkosť časti: {0} bytov.\nSte si istý, že chcete rozdeliť archív na také časti?" - -02000D81="Bez kompresie" -02000D82="Normálna" -02000D83="Maximálna" -02000D84="Rýchla" -02000D85="Najrýchlejšia" -02000D86="Ultra" - -02000D90="Prechádzať" - -02000DA1="Pridať a nahradiť súbory" -02000DA2="Aktualizovať a pridať súbory" -02000DA3="Aktualizovať existujúce súbory" -02000DA4="Synchronizovať súbory" - -02000DB1="Všetky súbory" - -02000DC0="Komprimovanie" - -; Columns dialog -02000E00="Stĺpce" -02000E01="Zaškrtnite stĺpce, ktoré by ste radi zviditeľnili v tomto adresári. Použite tlačítka Posunúť hore a Posunúť dole na usporiadanie stĺpcov." -02000E02="Vybraný stĺpec by mal byť" -02000E03="pixelov &široký." - -02000E10="Posunúť &hore" -02000E11="Posunúť &dole" -02000E12="&Ukázať" -02000E13="&Skryť" -02000E14="Nastaviť" - -02000E81="Titulok" -02000E82="Šírka" - -; Testing -02000F90="Výsledok testovania" - - -; File Manager - -03000000="7-Zip File Manager" - -; Menu -03000102="&Súbor" -03000103="&Upraviť" -03000104="&Zobraziť" -03000105="&Nástroje" -03000106="Ná&poveda" -03000107="&Obľúbené" - -; File -03000210="&Otvoriť" -03000211="O&tvoriť vnútri" -03000212="Ot&voriť externe" -03000220="&Zobraziť" -03000221="&Upraviť" -03000230="&Premenovať" -03000231="&Kopírovať do..." -03000232="P&resunúť do..." -03000233="O&dstrániť" -03000240="V&lastnosti" -03000241="Ko&mentár" -03000242="Vypočítať kontrolný súčet" -03000243="Rozdiel (Diff)" -03000250="Vytvoriť adresár" -03000251="Vytvoriť súbor" -03000260="Uko&nčiť" -03000270="Ro&zdeliť súbor..." -03000271="Zlúč&iť súbory..." - -; Edit -03000310="&Späť" -03000311="&Znovu" -03000320="&Vystrihnúť" -03000321="&Kopírovať" -03000322="V&ložiť" -03000323="&Vymazať" -03000330="Označiť všetko" -03000331="Odznačiť všetko" -03000332="Invertovať označenie" -03000333="Označiť..." -03000334="Odznačiť..." -03000335="Označiť podľa typu" -03000336="Odznačiť podľa typu" - -; View -03000410="&Veľké ikony" -03000411="&Malé ikony" -03000412="&Zoznam" -03000413="&Podrobnosti" -03000420="Netriediť" -03000430="Otvoriť koreňový adresár" -03000431="O úroveň vyššie" -03000432="História adresárov..." -03000440="&Obnoviť" -03000449="Plochý pohľad" -03000450="&2 Panely" -03000451="P&anely nástrojov" -03000460="Archív" -03000461="Štandard" -03000462="Veľké ikony" -03000463="Textový popis pod ikonami" - -; Tools -03000510="N&astavenia" -03000511="&Skúšobný test" - -; Help -03000610="&Obsah nápovedy" -03000620="O p&rograme 7-Zip" - -; Favorites -03000710="Pridať adresár medzi Obľúbené ako" -03000720="Záložka" - -; Options Dialog - -03010000="Nastavenia" - -; Plugins -03010100="Zásuvné moduly" -03010101="Zásuvné moduly:" -03010110="Konfigurácia" - -; Edit -03010200="Editor" -03010201="Editor:" -03010202="Vyhľadávač rozdielov (Diff):" - -; System -03010300="Systém" -03010302="Asociovať 7-Zip s vybranými typmi súborov:" -03010310="Zásuvný modul" - -; Settings -03010400="Nastavenia" -03010401="Ukázať \"..\" položku" -03010402="Ukázať skutočné ikony súborov" -03010410="Ukázať systémové menu" -03010420="Označiť celý riadok" -03010421="Zobraziť čiary mriežky" -03010422="Otvoriť položku jednoduchým kliknutím" -03010430="Alternatívny mód výberu" -03010440="Použitie veľkých stránok pamäti" - -; Strings - -03020201="Kopírovať" -03020202="Presunúť" -03020203="Kopírovať do:" -03020204="Presunúť do:" -03020205="Kopírovanie..." -03020206="Presúvanie..." -03020207="Nemôžete presunúť alebo kopírovať položky smerom do takých adresárov." -03020208="Operácia nie je podporovaná." -03020209="Vyberte cieľový adresár." - -03020210="Potvrdenie odstránenia súboru" -03020211="Potvrdenie odstránenia adresára" -03020212="Potvrdenie odstránenia viacerých položiek" -03020213="Ste si istý, že chcete odstrániť súbor '{0}'?" -03020214="Ste si istý, že chcete odstrániť adresár '{0}' a celý jeho obsah?" -03020215="Ste si istý, že chcete odstrániť týchto {0} položiek?" -03020216="Odstraňovanie..." -03020217="Chyba pri odstraňovaní súboru alebo adresáru" -03020218="Systém nemôže do koša presunúť súbor s dlhou cestou" - -03020220="Premenovanie..." -03020221="Chyba pri premenovaní súboru alebo adresáru" -03020222="Potvrdiť kopírovanie súboru/súborov" -03020223="Ste si istý, že chcete kopírovať súbor/súbory do archívu?" - -03020230="Vytvoriť adresár" -03020231="Meno adresáru:" -03020232="Nový adresár" -03020233="Chyba pri vytváraní adresáru" - -03020240="Vytvoriť súbor" -03020241="Meno súboru:" -03020242="Nový súbor" -03020243="Chyba pri vytváraní súboru" - -03020250="Označiť" -03020251="Odznačiť" -03020252="Maska:" - -03020260="História adresárov" - -03020280="Súbor '{0}' bol zmenený.\nChcete ho aktualizovať v archíve?" -03020281="Nemožno aktualizovať súbor\n'{0}'" -03020282="Nemožno spustiť editor." -03020283="Otváranie..." -03020284="Súbor vyzerá ako vírus. (Meno súboru obsahuje veľa medzier.)" - -03020290="Komentár" -03020291="&Komentár:" - -030202A0="Systém" - -03020300="Počítač" -03020301="Sieť" -03020302="Dokumenty" - -03020400="Pridať" -03020401="Rozbaliť" -03020402="Otestovať" - -03020420="Kopírovať" -03020421="Presunúť" -03020422="Odstrániť" -03020423="Vlastnosti" - -03020500="Rozdeliť súbor" -03020501="&Rozdeliť do:" -03020510="Rozdeľovanie..." -03020520="Potvrďte rozdeľovanie." -03020521="Ste si istý, že chcete rozdeliť súbor na {0} častí?" -03020522="Veľkosť časti musí byť menšia, než veľkosť pôvodného súboru." - -03020600="Zlúčiť súbory" -03020601="&Zlúčiť do:" -03020610="Zlučovanie..." -03020620="Vyberte len prvý súbor." -03020621="Nie je možné detekovať súbor ako časť rozdeleného súboru." -03020622="Nie je možné nájsť viac ako jednu časť rozdeleného súboru." - -03020710="Výpočet CRC..." -03020720="Informácie o CRC" -03020721="CRC pre dáta:" -03020722="CRC pre dáta a názvy:" - -03020800="Prehľadávanie..." - -03020900="Vlastnosti" - -03020A01="Operácia nemôže byť volaná z adresára, ktorý má dlhú cestu." -03020A02="Musíte si vybrať jeden súbor." -03020A03="Musíte si vybrať jeden alebo viac súborov." -03020A04="Súbor {0} už existuje." - -; Computer -03031100="Celková veľkosť" -03031101="Voľné miesto" -03031102="Veľkosť klastra" -03031103="Menovka" - -; Network -03031200="Lokálny názov" -03031201="Prevádzkovateľ" - -; Benchmark Dialog - -03080000="Skúšobný test" -03080001="Použitá pamäť:" -03080002="Komprimovanie" -03080003="Rozbaľovanie" -03080004="Rýchlosť" -03080005="Hodnotenie" -03080006="Celkové hodnotenie" -03080007="Aktuálne:" -03080008="Výsledné:" -03080009="Testov bez chýb:" -0308000A="Chyby:" -0308000B="Využitie CPU" -0308000C="Hodn. / Využitie" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/sl.txt b/tools/7-Zip/Lang/sl.txt deleted file mode 100644 index 7fc9efe022..0000000000 --- a/tools/7-Zip/Lang/sl.txt +++ /dev/null @@ -1,512 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.55 -; First translation by tomazek -; All further translations and edits by miles -; -; -; - -00000000="Slovenian" -00000001="Slovenski" -00000002="36" - -; 7-Zip Configuration - -; Title -01000000="Konfiguracija 7-Zip" - -; Info Page -01000100="O programu 7-Zip" -01000103="7-Zip je brezplačen. Njegov razvoj podprete s tem, da se registrirate." -01000104="Podpora" -01000105="Registracija" - -; Folders Page -01000200="Mape" -01000210="&Delovna mapa" -01000211="&Sistemska začasna mapa" -01000212="&Trenutna mapa" -01000213="&Navedeno:" -01000214="Uporabi le za izmenljive pogone" - -01000281="Navedite mesto za začasne arhivske datoteke." - -; System Page -01000300="Sistem" -01000301="Integracija 7-Zip v kontekstni meni lupine" -01000302="Kaskadni kontekstni meni" -01000310="Izbire kontekstnega menija:" - -; Language Page -01000400="Jezik" -01000401="Jezik:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Ukazi 7-Zip" -02000103="Odpri arhiv" -02000104="Odpre izbrani arhiv." -02000105="Razširi datoteke ..." -02000106="Razširi datoteke iz izbranega arhiva." -02000107="Stisni v arhiv ..." -02000108="Stisne izbrane datoteke ali mape v arhiv." -02000109="Preizkusi arhiv" -0200010A="Preveri integriteto izbranega arhiva." -0200010B="Razširi semkaj" -0200010C="Razširi datoteke izbranega arhiva v trenutno mapo." -0200010D="Razširi v {0}" -0200010E="Razširi datoteke v podmapo." -0200010F="Dodaj v {0}" -02000110="Stisne izbrane datoteke ali mape v arhiv." -02000111="Stisni in pošlji ..." -02000112="Stisne izbrane datoteke v arhiv in ga pošlje po elektronski pošti." -02000113="Stisni v {0} in pošlji po e-pošti" -02000114="Stisne izbrane datoteke v arhiv in ga pošlje po elektronski pošti." - -02000140="" -02000141="" - -; Properties -02000203="Pot" -02000204="Ime" -02000205="Pripona" -02000206="Mapa" -02000207="Velikost" -02000208="Stisnjena velikost" -02000209="Atributi" -0200020A="Izdelano" -0200020B="Uporabljeno" -0200020C="Spremenjeno" -0200020D="Trdno" -0200020E="Komentirano" -0200020F="Šifrirano" -02000210="Razdeli pred" -02000211="Razdeli po" -02000212="Slovar" -02000213="CRC" -02000214="Vrsta" -02000215="Anti" -02000216="Metoda" -02000217="Gostiteljski OS" -02000218="Datotečni sistem" -02000219="Uporabnik" -0200021A="Skupina" -0200021B="Blok" -0200021C="Opomba" -0200021D="Položaj" -0200021E="Predpona poti" -0200021F="Mape" -02000220="Datoteke" -02000221="Različica" -02000222="Nosilec" -02000223="Več nosilcev" -02000224="Zamik" -02000225="Povezave" -02000226="Bloki" -02000227="Nosilcev" - -; Status bar -02000301="Izbran(ih) {0} objekt(ov)" -02000302="{0} objekt(ov)" - -02000320="Datoteke:" -02000321="Mape:" -02000322="Velikost:" -02000323="Stisnjena velikost:" -02000324="Arhivi:" - -; List Context Menu -02000401="&Stolpci ..." - -02000411="&Odpri" -02000412="&Razširi ..." - -; ToolBar -02000501="Razširi" - -; Messages -02000601="Za ta arhiv operacije osveževanja niso podprte." -02000602="Arhiva {0} ni mogoče osvežiti" -02000603="Mape '{0}' ni mogoče ustvariti" -02000604="Datoteka ni podprti arhiv." -02000605="Napaka" -02000606="Preveč izbir" -02000607="S podano vrsto datoteke ni povezana nobena aplikacija" -02000608="Brez napak" -02000609="Datoteke '{0}' ni mogoče odpreti kot arhiv" -0200060A="Šifriranega arhiva '{0}' ni mogoče odpreti. Je morda geslo napačno?" - -; Dialogs -02000702="V redu" -02000705="&Da" -02000707="Da za &vse" -02000709="&Ne" -0200070B="Ne za v&se" - -02000710="Prekliči" -02000711="P&rekliči" -02000713="&Zapri" -02000714="Zaustavi" -02000715="Ponovno zaženi" - -02000720="Pomoč" - -; Extract dialog -02000800="Razširi" -02000801="R&azširi v:" -02000802="Geslo" - -02000810="Poti" -02000811="Polne poti" -02000812="Trenutne poti" -02000813="Brez poti" - -02000820="Prepisovalni način" -02000821="Zahtevaj potrditev" -02000822="Prepiši brez potrditve" -02000823="Preskoči obstoječe datoteke" -02000824="Samodejno preimenuj" -02000825="Samodejno preimenuj obstoječe datoteke" - -02000830="Datoteke" -02000831="Samo &izbrane" -02000832="&Vse datoteke" - -02000881="Določite mesto razširjanja datotek." - -02000890="Razširjanje" - -; Overwrite dialog -02000900="Potrditev zamenjave datoteke" -02000901="Ciljna mapa že vsebuje obdelovano datoteko." -02000902="Želite zamenjati obstoječo datoteko" -02000903="s to datoteko?" - -02000911="Samodejno &preimenuj" - -02000982="{0} bajtov" -02000983="spremenjena" - -; Messages dialog -02000A00="Diagnostična sporočila" - -02000A80="Sporočilo" - -02000A91="Nepodprta metoda stiskanja za '{0}'." -02000A92="Podatkovna napaka v '{0}'. Datoteka je poškodovana." -02000A93="Napaka CRC v '{0}'. Datoteka je poškodovana." -02000A94="Podatkovna napaka v šifrirani datoteki '{0}'. Je geslo pravilno?" -02000A95="Napaka CRC v šifrirani datoteki '{0}'. Je geslo pravilno?" - -; Password dialog -02000B00="Vnos gesla" -02000B01="Vnesite geslo:" -02000B02="&Pokaži geslo" -02000B03="Ponovno vnesite geslo:" -02000B10="Gesli se ne ujemata" -02000B11="Za geslo uporabite le črke, številke in posebne znake angleške abecede (!, #, $, ...)" -02000B12="Geslo je predolgo" - -; Progress dialog -02000C00="Obdelovanje" -02000C01="Pretečeni čas:" -02000C02="Preostali čas:" -02000C03="Velikost:" -02000C04="Hitrost:" -02000C05="Obdelano:" -02000C06="Razmerje stiskanja:" - -02000C10="&Ozadje" -02000C11="O&spredje" -02000C12="&Začasno zaustavi" -02000C13="&Nadaljuj" - -02000C20="Zaustavljen" - -02000C30="Ste prepričani, da želite preklicati?" - -; Compress dialog -02000D00="Dodaj v arhiv" -02000D01="&Arhiv:" -02000D02="&Način osveževanja:" -02000D03="&Vrsta arhiva:" -02000D04="&Metoda stiskanja:" -02000D05="Izdelaj &trdni arhiv" -02000D06="&Parametri:" -02000D07="Možnosti" -02000D08="Izdelaj arhiv SF&X" -02000D09="Večnitnost" -02000D0A="Šifriraj &imena datotek" -02000D0B="Raven &stiskanja:" -02000D0C="&Velikost slovarja:" -02000D0D="Velikost &besede:" -02000D0E="Poraba pomnilnika za stiskanje:" -02000D0F="Poraba pomnilnika za razširjanje:" -02000D10="Šifriranje" -02000D11="Metoda šifriranja:" -02000D12="Število niti CPE:" -02000D13="Velikost trdnega bloka:" -02000D14="Ne-trdno" -02000D15="Trdno" -02000D16="Stisni skupne datoteke" - -02000D40="Razdeli na &nosilce velikosti (v bajtih):" -02000D41="Neveljavna velikost nosilca" -02000D42="Navedena velikost nosilca: {0} bajtov.\nSte prepričani, da želite razdeliti arhiv na takšne nosilce?" - -02000D81="Brez stiskanja" -02000D82="Običajno" -02000D83="Največje stiskanje" -02000D84="Hitro" -02000D85="Najhitrejše" -02000D86="Ultra" - -02000D90="Prebrskaj" - -02000DA1="Dodaj in zamenjaj datoteke" -02000DA2="Osveži in dodaj datoteke" -02000DA3="Osveži obstoječe datoteke" -02000DA4="Sinhroniziraj datoteke" - -02000DB1="Vse datoteke" - -02000DC0="Stiskanje" - -; Columns dialog -02000E00="Stolpci" -02000E01="Preverite stolpce, ki bi jih radi naredili vidne v tej mapi. Za preureditev njihovega vrstnega reda uporabite gumba Premakni gor in Premakni dol." -02000E02="Izbrani stolpec naj bo širok" -02000E03="&slikovnih točk." - -02000E10="Premakni &gor" -02000E11="Premakni &dol" -02000E12="&Prikaži" -02000E13="&Skrij" -02000E14="Nastavi" - -02000E81="Naslov" -02000E82="Širina" - -; Testing -02000F90="Preizkušanje" - - -; File Manager - -03000000="Upravitelj datotek 7-Zip" - -; Menu -03000102="&Datoteka" -03000103="&Urejanje" -03000104="&Pogled" -03000105="O&rodja" -03000106="Po&moč" -03000107="Pr&iljubljene" - -; File -03000210="&Odpri" -03000211="Odpri &znotraj" -03000212="Odpri zu&naj" -03000220="P&rikaz" -03000221="&Urejanje" -03000230="Prei&menuj" -03000231="&Kopiraj ..." -03000232="&Premakni ..." -03000233="Iz&briši" -03000240="L&astnosti" -03000241="Opomb&e" -03000242="Izračunaj preskusno vsoto" -03000250="Ustvari mapo" -03000251="Ustvari datoteko" -03000260="&Izhod" -03000270="&Razdeli datoteko ..." -03000271="&Združi datoteke ..." - -; Edit -03000310="Ra&zveljavi" -03000311="P&onovi" -03000320="&Izreži" -03000321="&Kopiraj" -03000322="Prile&pi" -03000323="Iz&briši" -03000330="Izberi &vse" -03000331="Razveljavi izbiro vseh" -03000332="&Preobrni izbor" -03000333="Izberi ..." -03000334="Razveljavi izbiro ..." -03000335="Izberi glede na vrsto" -03000336="Razveljavi izbiro glede na vrsto" - -; View -03000410="&Velike ikone" -03000411="&Majhne ikone" -03000412="&Seznam" -03000413="&Podrobnosti" -03000420="Nerazvrščeno" -03000430="Odpri korensko mapo" -03000431="Nadrejena raven" -03000432="Zgodovina mape ..." -03000440="&Osveži" -03000449="Splošen pogled" -03000450="&Dve podokni" -03000451="&Orodne vrstice" -03000460="Orodna vrstica arhiva" -03000461="Navadna orodna vrstica" -03000462="Veliki gumbi" -03000463="Pokaži besedilo gumbov" - -; Tools -03000510="&Možnosti ..." -03000511="Me&ritev" - -; Help -03000610="&Vsebina pomoči ..." -03000620="&O programu 7-Zip ..." - -; Favorites -03000710="&Dodaj mapo med Priljubljene kot" -03000720="Zaznamek" - -; Options Dialog - -03010000="Možnosti" - -; Plugins -03010100="Dodatki" -03010101="&Dodatki:" -03010110="Možnosti ..." - -; Edit -03010200="Urejevalnik" -03010201="&Urejevalnik:" - -; System -03010300="Sistem" -03010302="Poveži 7-Zip z:" -03010310="Dodatek" - -; Settings -03010400="Nastavitve" -03010401="Pokaži postavko \"..\"" -03010402="Pokaži prave ikone datotek" -03010410="Pokaži sistemski meni" -03010420="&Izbor celotne vrstice" -03010421="Pokaži &mrežne črte" -03010430="&Alternativni način izbiranja" -03010440="Uporabi &velike spominske strani" - -; Strings - -03020201="Kopiraj" -03020202="Premakni" -03020203="Kopiraj v:" -03020204="Premakni v:" -03020205="Kopiranje ..." -03020206="Premikanje ..." -03020207="Ne morete premakniti ali prekopirati elementov take mape." -03020208="Operacija ni podprta." -03020209="Izberite ciljno mapo." - -03020210="Potrditev brisanja datoteke" -03020211="Potrditev brisanja mape" -03020212="Potrditev brisanja več datotek" -03020213="Ste prepričani, da želite zbrisati '{0}'?" -03020214="Ste prepričani, da želite zbrisati mapo '{0}' in celotno njeno vsebino?" -03020215="Ste prepričani, da želite zbrisati teh {0} postavk?" -03020216="Brisanje ..." -03020217="Napaka pri brisanju datoteke ali mape" - -03020220="Preimenovanje ..." -03020221="Napaka pri preimenovanju datoteke ali mape" -03020222="Potrditev kopiranja datoteke" -03020223="Ste prepričani, da želite kopirati datoteke v arhiv?" - -03020230="Izdelava mape" -03020231="Ime mape:" -03020232="Nova mapa" -03020233="Napaka pri ustvarjanju mape" - -03020240="Ustvarjanje datoteke" -03020241="Ime datoteke:" -03020242="Nova datoteka" -03020243="Napaka pri ustvarjanju datoteke" - -03020250="Izberi" -03020251="Razveljavi izbiro" -03020252="Maska:" - -03020260="Zgodovina map" - -03020280="Datoteka '{0}' je bila spremenjena.\nJo želite osvežiti v arhivu?" -03020281="Datoteke ni mogoče osvežiti\n'{0}'" -03020282="Urejevalnika ni mogoče pognati." -03020283="Odpiranje ..." - -03020290="Opomba" -03020291="&Opomba:" - -030202A0="Sistem" - -03020300="Računalnik" -03020301="Omrežje" - -03020400="Dodaj" -03020401="Razširi" -03020402="Preizkusi" - -03020420="Kopiraj" -03020421="Premakni" -03020422="Izbriši" -03020423="Informacije" - -03020500="Razdeli datoteko" -03020501="&Razdeli na:" -03020510="Razdeljevanje ..." -03020520="Potrditev razdelitve" -03020521="Ste prepričani, da želite razdeliti datoteko na {0} nosilcev?" -03020522="Velikost nosilca mora biti manjša kot velikost izvorne datoteke" - -03020600="Združi datoteke" -03020601="&Združi v:" -03020610="Združevanje ..." -03020620="Izberite samo prvo datoteko" - -03020710="Izračun preskusne vsote ..." -03020720="Podatki o preskusni vsoti" -03020721="Preskusna vsota za podatke:" -03020722="Preskusna vsota za podatke in imena:" - -03020800="Pregledovanje ..." - -03020900="Properties" - -; Computer -03031100="Skupna velikost" -03031101="Prostega prostora" -03031102="Velikost gruče" -03031103="Oznaka" - -; Network -03031200="Krajevno ime" -03031201="Ponudnik" - -; Benchmark Dialog - -03080000="Meritev" -03080001="Poraba pomnilnika:" -03080002="Stiskanje" -03080003="Razširjanje" -03080004="Hitrost" -03080005="Ocena" -03080006="Skupna ocena" -03080007="Trenutno" -03080008="Končno" -03080009="Prehodi:" -0308000A="Napake:" -0308000B="Uporaba CPE" -0308000C="Ocena / uporaba" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/sq.txt b/tools/7-Zip/Lang/sq.txt deleted file mode 100644 index 5a5b03f8a2..0000000000 --- a/tools/7-Zip/Lang/sq.txt +++ /dev/null @@ -1,473 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.37 -; Translated by Mikel Hasko -; -; -; -; - -00000000="Albanian" -00000001="Shqip" -00000002="28" - -; 7-Zip Configuration - -; Title -01000000="Konfigurimi i 7-Zip" - -; Info Page -01000100="Për 7-Zip" -01000103="7-Zip është softuer falas. Megjithatë, ju mund të përkrahni në zhvillimin e 7-Zip duke e regjistruar atë." -01000104="Përkrahja" -01000105="Regjistrimi" - -; Folders Page -01000200="Dosje" -01000210="&Dosja e punës" -01000211="Dosja e përkohshme e &sistemit" -01000212="Dosja &aktuale" -01000213="I sp&ecifikuar:" -01000214="Përdor vetëm për njësi të largueshme" - -01000281="Specifikoni një vendndodhje për skedarët e përkohshëm të arkivit." - -; System Page -01000300="Sistemi" -01000301="Integro 7-Zip në kontekst meny" -01000302="Kaskado kontekst menynë" -01000310="Elementë të kontekst menysë:" - -; Language Page -01000400="Gjuha" -01000401="Gjuha:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Komanda të 7-Zip" -02000103="Hap arkivin" -02000104="Hap arkivin e selektuar." -02000105="Zbërthe skedarët..." -02000106="Zbërthen skedarët na arkivi i selektuar." -02000107="Shto në arkiv..." -02000108="Shton artikujt e zgjedhur në arkiv." -02000109="Testo arkivin" -0200010A="Teston integritetin e arkivit të selektuar." -0200010B="Zbërthe këtu" -0200010C="Zbërthen skedarët nga arkivi i zgjedhur në dosjen aktuale." -0200010D="Zbërthe në {0}" -0200010E="Zbërthen skedarët tek nëndosja." -0200010F="Shto tek {0}" -02000110="Shton artikujt e zgjedhur në arkiv." -02000111="Kompreso dhe dërgo me e-mail..." -02000112="Kompreson artikujt e zgjedhur në arkiv dhe e dërgon këtë të fundit me e-mail." -02000113="Kompreso në {0} dhe dërgo me e-mail" -02000114="Kompreson artikujt e zgjedhur në arkiv dhe e dërgon këtë të fundit me e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Shtegu" -02000204="Emri" -02000205="Prapashtesa" -02000206="Dosja" -02000207="Madhësia" -02000208="Madhësia e mbërthimit" -02000209="Atributet" -0200020A="Krijuar më" -0200020B="Hyrë së fundi më" -0200020C="Modifikuar më" -0200020D="I qëndrueshëm" -0200020E="I komentuar" -0200020F="I shifruar" -02000210="Ndaj para" -02000211="Ndaj pas" -02000212="Fjalori" -02000213="CRC" -02000214="Tipi" -02000215="Anti" -02000216="Metoda" -02000217="Pronari i sistemit" -02000218="Sistemi i skedarit" -02000219="Përdoruesi" -0200021A="Grupi" -0200021B="Blloku" -0200021C="Komenti" -0200021D="Pozicioni" -0200021E="Prefiksi i shtegut" - -; Status bar -02000301="Selektuar {0} objekt(e)" -02000302="{0} objekt(e)" - -02000320="Skedarë:" -02000321="Dosje:" -02000322="Madhësia:" - -; List Context Menu -02000401="&Kolona..." - -02000411="&Hap" -02000412="&Zbërthe..." - -; ToolBar -02000501="Zbërthe" - -; Messages -02000601="Operacionet e azhurnimit për këtë arkiv s'përkrahen." -02000602="S'mund të azhurnojë arkivin {0}" -02000603="S'mund të krijojë dosjen '{0}'" -02000604="Skedari është një arkiv i papërkrahur." -02000605="Gabim" -02000606="Tepër shumë artikuj" -02000607="S'ka aplikim të lidhur me prapashtesën e dhënë të emrit të skedarit" -02000608="S'ka gabime" - -; Dialogs -02000702="Në rregull" -02000705="&Po" -02000707="Po për të gjith&a" -02000709="&Jo" -0200070B="Jo për të gjit&ha" - -02000710="Anulim" -02000711="&Anulim" -02000713="&Mbyll" -02000714="Ndalo" -02000715="Rinis" - -02000720="Ndihmë" - -; Extract dialog -02000800="Zbërthe" -02000801="Z&bërthe në:" -02000802="Fjalëkalimi" - -02000810="Mënyra e Shtegut" -02000811="Emra të plotë Shtigjesh" -02000812="Emrat aktualë të Shtigjeve" -02000813="Pa emra shtigjesh" - -02000820="Mënyra e mbishkrimit" -02000821="Pyet para se të mbishkruaj" -02000822="Mbishkruaj pa nxitje" -02000823="Mbikalo skedarët ekzistues" -02000824="Riemërto automatikisht" -02000825="Riemërto auto. skedarët ekzistues" - -02000830="Skedarët" -02000831="Skedarët e &selektuar" -02000832="&Të gjithë skedarët" - -02000881="Specifikoni një vendndodhje për skedarët e zbërthyer." - -02000890="Duke zbërthyer" - -; Overwrite dialog -02000900="Konfirmo zëvendësimin e skedarëve" -02000901="Dosja e destinacionit e përmban një herë skedarin e përpunuar." -02000902="Dëshironi ta zëvendësoni skedarin ekzistues" -02000903="me këtë?" - -02000911="R&iemërtim automatik" - -02000982="{0} bajt" -02000983="modifikuar më" - -; Messages dialog -02000A00="Mesazhe diagnostikues" - -02000A80="Mesazhi" - -02000A91="Metodë e papërkrahshme kompresimi për '{0}'." -02000A92="Gabim të dhënash në '{0}'. Skedari është i prishur." -02000A93="CRC dështoi '{0}'. Skedari është i prishur." - -; Password dialog -02000B00="Fusni fjalëkalimin" -02000B01="Fusni fjalëkalimin:" -02000B02="&Trego fjalëkalimin" - -; Progress dialog -02000C00="Procesi" -02000C01="Koha e kaluar:" -02000C02="Koha e mbetur:" -02000C03="Madhësia:" -02000C04="Shpejtësia:" - -02000C10="Në &sfond" -02000C11="Në pla&n të parë" -02000C12="&Pushim" -02000C13="&Vazhdim" - -02000C20="Në pushim" - -02000C30="Jeni të sigurt se dëshironi ta anuloni?" - -; Compress dialog -02000D00="Shto në arkiv" -02000D01="&Arkivi:" -02000D02="&Mënyra e azhurnimit:" -02000D03="&Formati i arkivit:" -02000D04="Metoda e kompr&esimit:" -02000D05="&Krijo një arkiv të qëndrueshëm" -02000D06="&Parametrat:" -02000D07="Opsionet" -02000D08="Krijo një arkiv SF&X" -02000D09="Multifillesë" -02000D0A="Shifro em&rat e skedarëve" -02000D0B="&Niveli i kompresimit:" -02000D0C="Ma&dhësia e fjalorit:" -02000D0D="Mad&hësia e fjalës:" -02000D0E="Shfrytëzimi i memo. për kompresimin:" -02000D0F="Shfrytëzimi i memo. për dekompresimin:" - -02000D40="Ndaj në &volume (madhësia jepet në bajt):" - -02000D81="Ruaj" -02000D82="Normal" -02000D83="Maksimal" -02000D84="I shpejtë" -02000D85="Më i shpejtë" -02000D86="Ultra" - -02000D90="Shfleto" - -02000DA1="Shto dhe zëvendëso skedarët" -02000DA2="Azhurno dhe shto skedarët" -02000DA3="Azhurno skedarët ekzistues" -02000DA4="Sinkronizo skedarët" - -02000DB1="Të gjithë skedarët" - -02000DC0="Duke kompresuar" - -; Columns dialog -02000E00="Kolonat" -02000E01="Verifikoni kolonat që dëshironi të jenë të dukshme në këtë dosje. Përdorni tastet \"Lëviz lartë\" & \"Lëviz poshtë\" për të rirenditur kolonat." -02000E02="Kolonat e zgjedhura duhet të jenë" -02000E03="piksel &të gjera." - -02000E10="Lëviz &lartë" -02000E11="Lëviz p&oshtë" -02000E12="&Shfaq" -02000E13="&Fshih" -02000E14="Cakto" - -02000E81="Titulli" -02000E82="Gjerësia" - -; Testing -02000F90="Duke testuar" - - -; File Manager - -03000000="Menaxheri i skedarëve 7-Zip" - -; Menu -03000102="&Skedari" -03000103="&Redaktimi" -03000104="&Pamja" -03000105="&Veglat" -03000106="&Ndihma" -03000107="&Të parapëlqyerit" - -; File -03000210="&Hap" -03000211="Hap përbre&nda" -03000212="Hap përjas&hta" -03000220="&Pamja" -03000221="&Redakto" -03000230="Ri&emërto" -03000231="&Kopjo tek..." -03000232="&Zhvendos tek..." -03000233="&Fshi" -03000240="&Vetitë" -03000241="Ko&menti" -03000242="Llogarit shumën e verifikimit" -03000250="Krijo një dosje" -03000251="Krijo një skedar" -03000260="&Dil" -03000270="N&daj skedarin..." -03000271="Kom&bino skedarët..." - -; Edit -03000310="&Zhbëj" -03000311="&Ribëj" -03000320="&Prit" -03000321="&Kopjo" -03000322="&Ngjit" -03000323="&Fshi" -03000330="S&elekto të gjithë" -03000331="Çse&lekto të gjithë" -03000332="Anasill selekti&min" -03000333="Selekto..." -03000334="Çselekto..." -03000335="Selekto sipas tipit" -03000336="Çselekto sipas tipit" - -; View -03000410="Ikona të &mëdha" -03000411="Ikona të &vogla" -03000412="&Listë" -03000413="&Detaje" -03000420="&Të parenditur" -03000430="Hap dosjen rrënjë" -03000431="Një nivel më lartë" -03000432="Historiku i dosjes..." -03000440="&Rifresko" -03000449="Pamje e rrafshtë" -03000450="&2 panele" -03000451="&Shiritat e veglave" -03000460="Shiriti i veglave i arkivit" -03000461="Shiriti standard i veglave" -03000462="Butona të mëdhenj" -03000463="Shfaq tekstin e butonave" - -; Tools -03000510="&Opsionet..." -03000511="&Etapa" - -; Help -03000610="&Përmbajtjet..." -03000620="&Për 7-Zip..." - -; Favorites -03000710="&Shto dosjen tek të parapëlqyerit si" -03000720="Shënuesi" - -; Options Dialog - -03010000="Opsionet" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opsionet..." - -; Edit -03010200="Redaktuesi" -03010201="&Redaktuesi:" - -; System -03010300="Sistemi" -03010302="Lidh 7-Zip me:" -03010310="Plugin" - -; Settings -03010400="Rregullimet" -03010401="Shfaq &artikullin \"..\"" -03010402="Shfaq &ikonat e vërteta të skedarëve" -03010410="Shfaq &menynë e sistemit" -03010420="Selekto të tërë &rreshtin" -03010421="Shfaq &vijat e rrjetit" -03010430="Mënyrë alternative &selektimi" -03010440="Përdor &faqe të mëdha të memories" - -; Strings - -03020201="Kopjo" -03020202="Zhvendos" -03020203="Kopjo tek:" -03020204="Zhvendos tek:" -03020205="Duke kopjuar..." -03020206="Duke zhvendosur..." -03020207="Ju s'mund të zhvendosni ose kopjoni artikuj për dosje të atilla." -03020208="Operacioni s'përkrahet." - -03020210="Konfirmo fshirjen e skedarit" -03020211="Konfirmo fshirjen e dosjes" -03020212="Konfirmo fshirjen e shumëfishtë të skedarëve" -03020213="Jeni të sigurt që doni të fshini '{0}'?" -03020214="Jeni të sigurt që doni të fshini dosjen '{0}' dhe tërë përmbajtjen e saj?" -03020215="Jeni të sigurt që doni t'i fshini këto {0} artikuj?" -03020216="Duke fshirë..." -03020217="Gabim gjatë fshirjes së skedarit apo dosjes" - -03020220="Duke riemërtuar..." -03020221="Gabim gjatë riemërtimit të skedarit apo dosjes" -03020222="Konfirmim për kopjimin e skedarëve" -03020223="Jeni të sigurt që doni të kopjoni skedarë në arkiv" - -03020230="Krijo një dosje" -03020231="Emri i dosjes:" -03020232="Dosje e re" -03020233="Gabim gjatë krijimit të dosjes" - -03020240="Krijo një skedar" -03020241="Emri i skedarit:" -03020242="Skedar i ri" -03020243="Gabim gjatë krijimit të skedarit" - -03020250="Selekto" -03020251="Çselekto" -03020252="Maska:" - -03020260="Historiku i dosjes" - -03020280="Skedari '{0}' u modifikua.\nDoni ta azhurnoni atë edhe në arkiv?" -03020281="S'mund të azhurnojë skedarin\n'{0}'" -03020282="S'mund të hap redaktuesin." -03020283="Duke hapur..." - -03020290="Komenti" -03020291="&Komenti:" - -030202A0="Sistemi" - -03020300="Kompjuteri" -03020301="Rrejti" - -03020400="Shto" -03020401="Zbërthe" -03020402="Testo" - -03020420="Kopjo" -03020421="Zhvendos" -03020422="Fshi" -03020423="Info" - -03020500="Ndaj skedarin" -03020501="&Ndaj në:" -03020510="Duke ndarë..." - -03020600="Kombino skedarët" -03020601="&Kombino në:" -03020610="Duke kombinuar..." - -03020710="Duke llogaritur shumën e verifikimit..." -03020720="Informacionet e shumës së verifikimit" -03020721="Shuma e verifikimit CRC për të dhënat:" -03020722="Shuma e verifikimit CRC për të dhënat dhe emrat:" - -03020800="Duke skanuar..." - -; Computer -03031100="Madhësia totale" -03031101="Hapësira e lirë" -03031102="Madhësia e cluster-it" -03031103="Etiketa" - -; Network -03031200="Emri lokal" -03031201="Kujdestari" - -; Benchmark Dialog - -03080000="Etapa" -03080001="Shfrytëzimi i memories:" -03080002="Kompresimi" -03080003="Dekompresimi" -03080004="Shpejtësia" -03080005="Vlerësimi" -03080006="Vlerësimi total" -03080007="Aktualisht" -03080008="Rezultati" -03080009="Kalime:" -0308000A="Gabime:" - -;!@LangEnd@! \ No newline at end of file diff --git a/tools/7-Zip/Lang/sr-spc.txt b/tools/7-Zip/Lang/sr-spc.txt deleted file mode 100644 index aa7f67e2ab..0000000000 --- a/tools/7-Zip/Lang/sr-spc.txt +++ /dev/null @@ -1,456 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.30 -; Translated by Lazar - -00000000="Serbian - Cyrillic" -00000001="Српски - ћирилица" -00000002="26-3" - -; 7-Zip Configuration - -; Title -01000000="Подешавање 7-Zip-a" - -; Info Page -01000100="О програму" -01000103="7-Zip је бесплатан програм. Но, ако Вам се 7-Zip допадне и пожелите да подржите даљи развој програма, молимо Вас региструјте се тако што ћете приложити донацију од 20$. То можете урадити кредитном картицом или неким другим начином плаћања." -01000104="Подршка" -01000105="Регистрација" - -; Folders Page -01000200="Фасцикле" -01000210="Радна фасцикла" -01000211="Користи Windows-ову привремену фасциклу" -01000212="Тренутна" -01000213="Наведена:" -01000214="Користи само за измењиве медије" - -01000281="Наведите локацију за смештање привремених датотека." - -; System Page -01000300="Систем" -01000301="Убаци 7-Zip у системски мени" -01000302="Каскадни системски мени" -01000310="Ставке системског менија:" - -; Language Page -01000400="Језик" -01000401="Језик:" - - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip команде" -02000103="Отвори архиву" -02000104="Отвори изабрану архиву." -02000105="Издвој датотеке..." -02000106="Издвој датотеке из изабране архиве." -02000107="Додај у архиву..." -02000108="Додај изабране ставке у архиву." -02000109="Тестирај архиву" -0200010A="Тестирај интегритет изабране архиве." -0200010B="Издвој овде" -0200010C="Издвој датотеке из изабране архиве у тренутну фасциклу." -0200010D="Издвој у {0}" -0200010E="Издвој датотеке у подфасциклу." -0200010F="Додај у {0}" -02000110="Додај изабране датотеке у архиву." -02000111="Додај и направи e-mail..." -02000112="Додај обележене датотеке и направи e-mail." -02000113="Додај у {0} и направи e-mail" -02000114="Додај обележене датотеке и направи e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Путања" -02000204="Назив" -02000205="Тип" -02000206="Фасцикла" -02000207="Величина" -02000208="Величина у запакованом стању" -02000209="Атрибути" -0200020A="Креирана" -0200020B="Приступано" -0200020C="Промењено" -0200020D="Solid" -0200020E="Коментар" -0200020F="Шифровано" -02000210="Подели пре" -02000211="Подели после" -02000212="Dictionary" -02000213="CRC" -02000214="Тип" -02000215="Анти" -02000216="Метод" -02000217="Оперативни систем" -02000218="Систем датотека" -02000219="Корисник" -0200021A="Група" -0200021B="Блок" -0200021C="Коментар" -0200021D="Положај" - -; Status bar -02000301="{0} објекат(а) изабрано" -02000302="{0} објекат(а)" - -; List Context Menu -02000401="Колона..." - -02000411="Отвори" -02000412="Издвој..." - -; ToolBar -02000501="Издвој" - -; Messages -02000601="Операција освежавања није дозвољена за ову архиву." -02000602="Не могу да освежим архиву {0}" -02000603="Не могу да креирам Фасциклу '{0}'" -02000604="Датотека није једна од подржаних архива." -02000605="Грешка" -02000606="Исувише ставки" -02000607="Ни једна апликација није додељена наведеној екстензији" -02000608="Није било никаквих грешака" - -; Dialogs -02000702="У реду" -02000705="Да" -02000707="Да за све" -02000709="Не" -0200070B="Не за све" - -02000710="Откажи" -02000711="Откажи" -02000713="Затвори" -02000714="Стани" -02000715="Поново" - -02000720="Помоћ" - -; Extract dialog -02000800="Издвој" -02000801="Издвој у:" -02000802="Шифра" - -02000810="Путање" -02000811="Пуна путања" -02000812="Тренутне путање" -02000813="Без путање" - -02000820="Замена" -02000821="Питај пре него што замениш" -02000822="Замени без запиткивања" -02000823="Прескочи постојеће датотеке" -02000824="Аутоматска промена назива" -02000825="Аутоматска промена назива постојећих датотека" - -02000830="Датотеке" -02000831="Изабрани датотеке" -02000832="Све датотеке" - -02000881="Наведи локацију где ће се издвајати датотеке из архива." - -02000890="Издвајање" - -; Overwrite dialog -02000900="Потврди замену датотеке" -02000901="Циљна фасцикла већ садржи датотеку која се тренутно обрађује." -02000902="Да ли желите да замените постојећу датотеку" -02000903="са овом?" - -02000911="Аутоматска промена назива" - -02000982="{0} бајтова" -02000983="модификовано" - -; Messages dialog -02000A00="Дијагностичке поруке" - -02000A80="Поруке" - -02000A91="Неподржани метод компресије за '{0}'." -02000A92="Грешка у '{0}'. Датотека је неисправана." -02000A93="CRC грешка у '{0}'. Датотека је неисправана." - -; Password dialog -02000B00="Унесите лозинку" -02000B01="Унесите лозинку:" -02000B02="Прикажи лозинку" - -; Progress dialog -02000C00="Обрађујем" -02000C01="Протекло време:" -02000C02="Преостало време:" -02000C03="Величина:" -02000C04="Брзина:" - -02000C10="Позадина" -02000C11="На врху" -02000C12="Пауза" -02000C13="Настави" - -02000C20="Пауза" - -02000C30="Да ли сте сигурни да желите да прекинете?" - -; Compress dialog -02000D00="Додај у архиву" -02000D01="Архива:" -02000D02="Надоградња архива:" -02000D03="Формат архиве:" -02000D04="Тип компресије:" -02000D05="Креирај Solid архиву" -02000D06="Параметри:" -02000D07="Опције" -02000D08="Креирај SFX архиву" -02000D09="Више нити" -02000D0A="Шифруј називе датотека" -02000D0B="Ниво компресије:" -02000D0C="Dictionary size:" -02000D0D="Word size:" -02000D0E="Потребна меморија - компресија:" -02000D0F="Потребна меморија - декомпресија:" - -02000D40="Подели на делове, бајти:" - -02000D81="Без компресије" -02000D82="Нормално" -02000D83="Максимално" -02000D84="Брзо" -02000D85="Брже" -02000D86="Најбрже" - -02000D90="Прегледај" - -02000DA1="Додај и замени датотеке" -02000DA2="Освежи и додај датотеке" -02000DA3="Озвежи постојеће датотеке" -02000DA4="Синхронизуј датотеке" - -02000DB1="Све датотеке" - -02000DC0="Додајем" - -; Columns dialog -02000E00="Колоне" -02000E01="Обележите колоне које бисте желели да буду видљиве у овом прегледу. Користите PageUp и PageDown тастере како бисте преуредили колоне по сопственом избору." -02000E02="Изабране колоне би требале бити" -02000E03="тачака широке." - -02000E10="Помери горе" -02000E11="Помери доле" -02000E12="Прикажи" -02000E13="Сакриј" -02000E14="Постави" - -02000E81="Наслов" -02000E82="Ширина" - -; Testing -02000F90="Тестирање" - -; File Manager - -03000000="7-Zip" - -; Menu -03000102="Датотека" -03000103="Уређивање" -03000104="Преглед" -03000105="Алати" -03000106="Помоћ" -03000107="Омиљено" - -; File -03000210="Погледај" -03000211="Отвори са 7-Zip-ом" -03000212="Отвори са придруженом програмом" -03000220="Прегледај" -03000221="Промени" -03000230="Преименуј" -03000231="Копирај у..." -03000232="Премести у..." -03000233="Обриши" -03000240="Својства" -03000241="Коментар" -03000250="Нова фасцикла" -03000251="Нова датотека" -03000260="Излаз" -03000270="Подели фајл..." -03000271="Спој делове..." - - -; Edit -03000310="Опозови" -03000311="Понови" -03000320="Исеци" -03000321="Копирај" -03000322="Налепи" -03000323="Избриши" -03000330="Изабери све" -03000331="Поништи избор свега" -03000332="Обрнути избор" -03000333="Изабери..." -03000334="Поништи избор..." -03000335="Изабери по типу" -03000336="Поништи избор по типу" - -; View -03000410="Иконе" -03000411="Напоредно слагање" -03000412="Списак" -03000413="Детаљи" -03000420="Без сортирања" -03000430="Отвори почетну фасциклу" -03000431="Горе за један ниво" -03000432="Хронологија..." -03000440="Освежавање" -03000450="2 Прозора" -03000451="Траке са алаткама" -03000460="Рад са архивама" -03000461="Рад са датотекама" -03000462="Велика дугмад" -03000463="Прикажи текст испод дугмади" - -; Tools -03000510="Опције..." -03000511="Benchmark" - -; Help -03000610="Помоћ..." -03000620="О програму..." - -; Favorites -03000710="Додај" -03000720="Изабери" - -; Options Dialog - -03010000="Опције" - -; Plugins -03010100="Plug-ins" -03010101="Plug-ins:" -03010110="Опције..." - -; Edit -03010200="Промене у датотекама" -03010201="Програм:" - -; System -03010300="Систем" -03010302="7-Zip отвара следеће типове датотека:" -03010310="Plug-in" - -; Settings -03010400="Подешавања" -03010401="Прикажи \"..\"" -03010402="Прикажи праве сличице датотека" -03010410="Прикажи системски мени" -03010420="Обележи цео ред" -03010421="Прикажи линије мреже" -03010430="Алтернативни начин за бирање" -03010440="Користи велике меморијске блокове" - -; Strings - -03020201="Копирај" -03020202="Исеци" -03020203="Копирај у:" -03020204="Премести у:" -03020205="Копирање у току..." -03020206="Премештање у току..." -03020207="Није могуће преместити или копирати садржај ове Фасцикле." -03020208="Операција није подржана." - -03020210="Потврдите брисање датотеке" -03020211="Потврдите брисање фасцикле" -03020212="Потврдите вишеструко брисање датотека" -03020213="Јесте ли сигурни да желите да обришете '{0}'?" -03020214="Јесте ли сигурни да желите да обришете фасциклу '{0}' и сав њен садржај?" -03020215="Јесте ли сигурни да желите да обришете ове {0} податке?" -03020216="Брисање у току..." -03020217="Грешка при брисању датотеке или фасцикле" - -03020220="Преименовање у току..." -03020221="Грешка при преименовању датотеке или фасцикле" -03020222="Потврди копирање датотеке" -03020223="Да ли сте сигурни да желите да копирате датотеке у архиву" - -03020230="Креирај фасциклу" -03020231="Име фасцикле:" -03020232="Нова фасцикла" -03020233="Грешка при креирању фасцикли" - -03020240="Креирај датотеку" -03020241="Име датотеке:" -03020242="Нова датотека" -03020243="Грешка при креирању датотека" - -03020250="Одабери" -03020251="Поништи избор" -03020252="Маска:" - -03020260="Хронологија" - -03020280="Датотека '{0}' је измјењена.\nДа ли желите ажурирати архиву?" -03020281="Није могуће ажурирати датотеку\n'{0}'" -03020282="Није могуће започети уређивање." -03020283="Отварање у току..." - -03020291="Коментар" -03020291="Коментар:" - -030202A0="Систем" - -03020300="Рачунар" -03020301="Мрежа" - -03020400="Додај" -03020401="Издвој" -03020402="Тестирај" - -03020420="Копирај" -03020421="Премести" -03020422="Избриши" -03020423="Својства" - -03020500="Подели датотеку" -03020501="Подели на:" -03020510="Подела..." - -03020600="Састави датотеке" -03020601="Састави у:" -03020610="Спајање..." - -; Computer -03031100="Укупни капацитет" -03031101="Слободни простор" -03031102="Величинa cluster-а" -03031103="Назив" - -; Network -03031200="Локално име" -03031201="Provider" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Коришћење меморије:" -03080002="Компресија" -03080003="Декомпресија" -03080004="Брзина" -03080005="Оцена" -03080006="Потпуна оцена" -03080007="Тренутно" -03080008="Резултат" -03080009="Пролази:" -0308000A="Грешке:" - -;!@LangEnd@! \ No newline at end of file diff --git a/tools/7-Zip/Lang/sr-spl.txt b/tools/7-Zip/Lang/sr-spl.txt deleted file mode 100644 index b5af48a6ad..0000000000 --- a/tools/7-Zip/Lang/sr-spl.txt +++ /dev/null @@ -1,456 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.30 -; Translated by Lazar - -00000000="Serbian - Latin" -00000001="Srpski - latinica" -00000002="26-2" - -; 7-Zip Configuration - -; Title -01000000="Podešavanje 7-Zip-a" - -; Info Page -01000100="O programu" -01000103="7-Zip je besplatan program. No, ako Vam se 7-Zip dopadne i poželite da podržite dalji razvoj programa, molimo Vas registrujte se tako što ćete priložiti donaciju od 20$. To možete uraditi kreditnom karticom ili nekim drugim načinom plaćanja." -01000104="Podrška" -01000105="Registracija" - -; Folders Page -01000200="Fascikle" -01000210="Radna fascikla" -01000211="Koristi Windows-ovu privremenu fasciklu" -01000212="Trenutna" -01000213="Navedena:" -01000214="Koristi samo za izmenjive medije" - -01000281="Navedite lokaciju za smeštanje privremenih datoteka." - -; System Page -01000300="Sistem" -01000301="Ubaci 7-Zip u sistemski meni" -01000302="Kaskadni sistemski meni" -01000310="Stavke sistemskog menija:" - -; Language Page -01000400="Jezik" -01000401="Jezik:" - - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip komande" -02000103="Otvori arhivu" -02000104="Otvori izabranu arhivu." -02000105="Izdvoj datoteke..." -02000106="Izdvoj datoteke iz izabrane arhive." -02000107="Dodaj u arhivu..." -02000108="Dodaj izabrane stavke u arhivu." -02000109="Testiraj arhivu" -0200010A="Testiraj integritet izabrane arhive." -0200010B="Izdvoj ovde" -0200010C="Izdvoj datoteke iz izabrane arhive u trenutnu fasciklu." -0200010D="Izdvoj u {0}" -0200010E="Izdvoj datoteke u podfasciklu." -0200010F="Dodaj u {0}" -02000110="Dodaj izabrane datoteke u arhivu." -02000111="Dodaj i napravi e-mail..." -02000112="Dodaj obeležene datoteke i napravi e-mail." -02000113="Dodaj u {0} i napravi e-mail" -02000114="Dodaj obeležene datoteke i napravi e-mail." - -02000140="" -02000141="" - -; Properties -02000203="Putanja" -02000204="Naziv" -02000205="Tip" -02000206="Fascikla" -02000207="Veličina" -02000208="Veličina u zapakovanom stanju" -02000209="Atributi" -0200020A="Kreirana" -0200020B="Pristupano" -0200020C="Promenjeno" -0200020D="Solid" -0200020E="Komentar" -0200020F="Šifrovano" -02000210="Podeli pre" -02000211="Podeli posle" -02000212="Dictionary" -02000213="CRC" -02000214="Tip" -02000215="Anti" -02000216="Metod" -02000217="Operativni sistem" -02000218="Sistem datoteka" -02000219="Korisnik" -0200021A="Grupa" -0200021B="Blok" -0200021C="Komentar" -0200021D="Položaj" - -; Status bar -02000301="{0} objekat(a) izabrano" -02000302="{0} objekat(a)" - -; List Context Menu -02000401="Kolona..." - -02000411="Otvori" -02000412="Izdvoj..." - -; ToolBar -02000501="Izdvoj" - -; Messages -02000601="Operacija osvežavanja nije dozvoljena za ovu arhivu." -02000602="Ne mogu da osvežim arhivu {0}" -02000603="Ne mogu da kreiram Fasciklu '{0}'" -02000604="Datoteka nije jedna od podržanih arhiva." -02000605="Greška" -02000606="Isuviše stavki" -02000607="Ni jedna aplikacija nije dodeljena navedenoj ekstenziji" -02000608="Nije bilo nikakvih grešaka" - -; Dialogs -02000702="U redu" -02000705="Da" -02000707="Da za sve" -02000709="Ne" -0200070B="Ne za sve" - -02000710="Otkaži" -02000711="Otkaži" -02000713="Zatvori" -02000714="Stani" -02000715="Ponovo" - -02000720="Pomoć" - -; Extract dialog -02000800="Izdvoj" -02000801="Izdvoj u:" -02000802="Šifra" - -02000810="Putanje" -02000811="Puna putanja" -02000812="Trenutne putanje" -02000813="Bez putanje" - -02000820="Zamena" -02000821="Pitaj pre nego što zameniš" -02000822="Zameni bez zapitkivanja" -02000823="Preskoči postojeće datoteke" -02000824="Automatska promena naziva" -02000825="Automatska promena naziva postojećih datoteka" - -02000830="Datoteke" -02000831="Izabrani datoteke" -02000832="Sve datoteke" - -02000881="Navedi lokaciju gde će se izdvajati datoteke iz arhiva." - -02000890="Izdvajanje" - -; Overwrite dialog -02000900="Potvrdi zamenu datoteke" -02000901="Ciljna fascikla već sadrži datoteku koja se trenutno obrađuje." -02000902="Da li želite da zamenite postojeću datoteku" -02000903="sa ovom?" - -02000911="Automatska promena naziva" - -02000982="{0} bajtova" -02000983="modifikovano" - -; Messages dialog -02000A00="Dijagnostičke poruke" - -02000A80="Poruke" - -02000A91="Nepodržani metod kompresije za '{0}'." -02000A92="Greška u '{0}'. Datoteka je neispravana." -02000A93="CRC greška u '{0}'. Datoteka je neispravana." - -; Password dialog -02000B00="Unesite lozinku" -02000B01="Unesite lozinku:" -02000B02="Prikaži lozinku" - -; Progress dialog -02000C00="Obrađujem" -02000C01="Proteklo vreme:" -02000C02="Preostalo vreme:" -02000C03="Veličina:" -02000C04="Brzina:" - -02000C10="Pozadina" -02000C11="Na vrhu" -02000C12="Pauza" -02000C13="Nastavi" - -02000C20="Pauza" - -02000C30="Da li ste sigurni da želite da prekinete?" - -; Compress dialog -02000D00="Dodaj u arhivu" -02000D01="Arhiva:" -02000D02="Nadogradnja arhiva:" -02000D03="Format arhive:" -02000D04="Tip kompresije:" -02000D05="Kreiraj Solid arhivu" -02000D06="Parametri:" -02000D07="Opcije" -02000D08="Kreiraj SFX arhivu" -02000D09="Više niti" -02000D0A="Šifruj nazive datoteka" -02000D0B="Nivo kompresije:" -02000D0C="Dictionary size:" -02000D0D="Word size:" -02000D0E="Potrebna memorija - kompresija:" -02000D0F="Potrebna memorija - dekompresija:" - -02000D40="Podeli na delove, bajti:" - -02000D81="Bez kompresije" -02000D82="Normalno" -02000D83="Maksimalno" -02000D84="Brzo" -02000D85="Brže" -02000D86="Najbrže" - -02000D90="Pregledaj" - -02000DA1="Dodaj i zameni datoteke" -02000DA2="Osveži i dodaj datoteke" -02000DA3="Ozveži postojeće datoteke" -02000DA4="Sinhronizuj datoteke" - -02000DB1="Sve datoteke" - -02000DC0="Dodajem" - -; Columns dialog -02000E00="Kolone" -02000E01="Obeležite kolone koje biste želeli da budu vidljive u ovom pregledu. Koristite PageUp i PageDown tastere kako biste preuredili kolone po sopstvenom izboru." -02000E02="Izabrane kolone bi trebale biti" -02000E03="tačaka široke." - -02000E10="Pomeri gore" -02000E11="Pomeri dole" -02000E12="Prikaži" -02000E13="Sakrij" -02000E14="Postavi" - -02000E81="Naslov" -02000E82="Širina" - -; Testing -02000F90="Testiranje" - -; File Manager - -03000000="7-Zip" - -; Menu -03000102="Datoteka" -03000103="Uređivanje" -03000104="Pregled" -03000105="Alati" -03000106="Pomoć" -03000107="Omiljeno" - -; File -03000210="Pogledaj" -03000211="Otvori sa 7-Zip-om" -03000212="Otvori sa pridruženom programom" -03000220="Pregledaj" -03000221="Promeni" -03000230="Preimenuj" -03000231="Kopiraj u..." -03000232="Premesti u..." -03000233="Obriši" -03000240="Svojstva" -03000241="Komentar" -03000250="Nova fascikla" -03000251="Nova datoteka" -03000260="Izlaz" -03000270="Podeli fajl..." -03000271="Spoj delove..." - - -; Edit -03000310="Opozovi" -03000311="Ponovi" -03000320="Iseci" -03000321="Kopiraj" -03000322="Nalepi" -03000323="Izbriši" -03000330="Izaberi sve" -03000331="Poništi izbor svega" -03000332="Obrnuti izbor" -03000333="Izaberi..." -03000334="Poništi izbor..." -03000335="Izaberi po tipu" -03000336="Poništi izbor po tipu" - -; View -03000410="Ikone" -03000411="Naporedno slaganje" -03000412="Spisak" -03000413="Detalji" -03000420="Bez sortiranja" -03000430="Otvori početnu fasciklu" -03000431="Gore za jedan nivo" -03000432="Hronologija..." -03000440="Osvežavanje" -03000450="2 Prozora" -03000451="Trake sa alatkama" -03000460="Rad sa arhivama" -03000461="Rad sa datotekama" -03000462="Velika dugmad" -03000463="Prikaži tekst ispod dugmadi" - -; Tools -03000510="Opcije..." -03000511="Benchmark" - -; Help -03000610="Pomoć..." -03000620="O programu..." - -; Favorites -03000710="Dodaj" -03000720="Izaberi" - -; Options Dialog - -03010000="Opcije" - -; Plugins -03010100="Plug-ins" -03010101="Plug-ins:" -03010110="Opcije..." - -; Edit -03010200="Promene u datotekama" -03010201="Program:" - -; System -03010300="Sistem" -03010302="7-Zip otvara sledeće tipove datoteka:" -03010310="Plug-in" - -; Settings -03010400="Podešavanja" -03010401="Prikaži \"..\"" -03010402="Prikaži prave sličice datoteka" -03010410="Prikaži sistemski meni" -03010420="Obeleži ceo red" -03010421="Prikaži linije mreže" -03010430="Alternativni način za biranje" -03010440="Koristi velike memorijske blokove" - -; Strings - -03020201="Kopiraj" -03020202="Iseci" -03020203="Kopiraj u:" -03020204="Premesti u:" -03020205="Kopiranje u toku..." -03020206="Premeštanje u toku..." -03020207="Nije moguće premestiti ili kopirati sadržaj ove Fascikle." -03020208="Operacija nije podržana." - -03020210="Potvrdite brisanje datoteke" -03020211="Potvrdite brisanje fascikle" -03020212="Potvrdite višestruko brisanje datoteka" -03020213="Jeste li sigurni da želite da obrišete '{0}'?" -03020214="Jeste li sigurni da želite da obrišete fasciklu '{0}' i sav njen sadržaj?" -03020215="Jeste li sigurni da želite da obrišete ove {0} podatke?" -03020216="Brisanje u toku..." -03020217="Greška pri brisanju datoteke ili fascikle" - -03020220="Preimenovanje u toku..." -03020221="Greška pri preimenovanju datoteke ili fascikle" -03020222="Potvrdi kopiranje datoteke" -03020223="Da li ste sigurni da želite da kopirate datoteke u arhivu" - -03020230="Kreiraj fasciklu" -03020231="Ime fascikle:" -03020232="Nova fascikla" -03020233="Greška pri kreiranju fascikli" - -03020240="Kreiraj datoteku" -03020241="Ime datoteke:" -03020242="Nova datoteka" -03020243="Greška pri kreiranju datoteka" - -03020250="Odaberi" -03020251="Poništi izbor" -03020252="Maska:" - -03020260="Hronologija" - -03020280="Datoteka '{0}' je izmjenjena.\nDa li želite ažurirati arhivu?" -03020281="Nije moguće ažurirati datoteku\n'{0}'" -03020282="Nije moguće započeti uređivanje." -03020283="Otvaranje u toku..." - -03020291="Komentar" -03020291="Komentar:" - -030202A0="Sistem" - -03020300="Računar" -03020301="Mreža" - -03020400="Dodaj" -03020401="Izdvoj" -03020402="Testiraj" - -03020420="Kopiraj" -03020421="Premesti" -03020422="Izbriši" -03020423="Svojstva" - -03020500="Podeli datoteku" -03020501="Podeli na:" -03020510="Podela..." - -03020600="Sastavi datoteke" -03020601="Sastavi u:" -03020610="Spajanje..." - -; Computer -03031100="Ukupni kapacitet" -03031101="Slobodni prostor" -03031102="Veličina cluster-a" -03031103="Naziv" - -; Network -03031200="Lokalno ime" -03031201="Provider" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Korišćenje memorije:" -03080002="Kompresija" -03080003="Dekompresija" -03080004="Brzina" -03080005="Ocena" -03080006="Potpuna ocena" -03080007="Trenutno" -03080008="Rezultat" -03080009="Prolazi:" -0308000A="Greške:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/sv.txt b/tools/7-Zip/Lang/sv.txt deleted file mode 100644 index 000ca0881d..0000000000 --- a/tools/7-Zip/Lang/sv.txt +++ /dev/null @@ -1,536 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Original translation by Andreas M Nilsson and Christoffer Enqvist -; Maintained since '7-Zip 4.07 beta' by Andreas M Nilsson -; Updated for '7-Zip 4.42' by Bernhard Eriksson, Wermlandsdata, Sweden -; Incorpororated changes made by Andreas M Nilsson for 4.44 -; Updated for 4.53 and 4.59 by Bernhard Eriksson, Wermlandsdata, Sweden - -00000000="Swedish" -00000001="Svenska" -00000002="29" - -; 7-Zip Configuration - -; Title -01000000="7-Zip konfiguration" - -; Info Page -01000100="Om 7-Zip" -01000103="7-Zip är fri programvara. Du kan emellertid stödja den fortsatta utvecklingen av 7-Zip genom att donera. Den aktuella översättningen på svenska är gjord av Wermlandsdata, baserad på arbete utfört av Andreas M Nilsson och Christoffer Enqvist." -01000104="Support" -01000105="Donera" - -; Folders Page -01000200="Mappar" -01000210="&Arbetsmapp" -01000211="&Systemets temp-mapp" -01000212="A&ktuell" -01000213="Spe&cificerad:" -01000214="Använd enbart för &flyttbara enheter" - -01000281="Ange plats där temporära arkivfiler ska sparas." - -; System Page -01000300="System" -01000301="Lägg till 7-Zip som alternativ i Utforskarens högerklicksmenyn" -01000302="Placera 7-Zip som en undermeny" -01000310="Objekt i högerklicksmenyn:" - -; Language Page -01000400="Språk" -01000401="Språk:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip kommandon" -02000103="Öppna" -02000104="Öppna det markerade arkivet." -02000105="Packa upp filer..." -02000106="Packar upp filer från det markerade arkivet." -02000107="Lägg till arkiv..." -02000108="Lägger till de markerade filerna till ett arkiv." -02000109="Kontrollera arkivet" -0200010A="Kontrollerar om arkivet är korrupt." -0200010B="Packa upp här" -0200010C="Packar upp filer från det markerade arkivet till den aktuella mappen." -0200010D="Packa upp till {0}" -0200010E="Packar upp filer till en undermapp." -0200010F="Lägg till {0}" -02000110="Lägger till de markerade filerna till ett arkiv." -02000111="Komprimera och skicka som e-post..." -02000112="Komprimerar de markerade filerna till ett arkiv och skickar arkivet via e-post." -02000113="Komprimera till {0} och skicka som e-post" -02000114="Komprimerar de markerade filerna till ett arkiv och skickar arkivet via e-post." - -02000140="" -02000141="" - -; Properties -02000203="Sökväg" -02000204="Namn" -02000205="Filändelse" -02000206="Mapp" -02000207="Storlek" -02000208="Storlek komprimerad" -02000209="Attribut" -0200020A="Skapad" -0200020B="Använd" -0200020C="Ändrad" -0200020D="Sammanhängande (Solid)" -0200020E="Kommenterad" -0200020F="Krypterad" -02000210="Delad före" -02000211="Delad efter" -02000212="Ordlista" -02000213="CRC" -02000214="Typ" -02000215="Anti" -02000216="Metod" -02000217="Värd OS" -02000218="Filsystem" -02000219="Användare" -0200021A="Grupp" -0200021B="Block" -0200021C="Kommentar" -0200021D="Position" -0200021E="Sökvägs prefix" -0200021F="Kataloger" -02000220="Filer" -02000221="Version" -02000222="Volym" -02000223="Multivolym" -02000224="Offset" -02000225="Länkar" -02000226="Block" -02000227="Volymer" - -02000229="64-bitars" -0200022A="Big-endian" -0200022B="CPU" -0200022C="Fysisk storlek" -0200022D="Storlek på header" -0200022E="Checksumma" -0200022F="Karakteristisk" -02000230="Virtuell adress" - -; Status bar -02000301="{0} objekt markerade" -02000302="{0} objekt" - -02000320="Filer:" -02000321="Mappar:" -02000322="Storlek:" -02000323="Komprimerad storlek:" -02000324="Arkiv:" - -; List Context Menu -02000401="&Kolumner..." - -02000411="&Öppna" -02000412="&Packa upp..." - -; ToolBar -02000501="Packa upp" - -; Messages -02000601="Uppdatering stöds inte för det här arkivet." -02000602="Kan inte uppdatera arkiv {0}" -02000603="Kan inte skapa mapp '{0}'" -02000604="Arkivformatet stöds inte." -02000605="Fel" -02000606="För många objekt" -02000607="Filändelsen är inte associerad till något program" -02000608="Inga fel påträffades" -02000609="Kan inte öppna filen '{0}' som ett arkiv" -0200060A="Kan inte öppna det krypterade arkivet '{0}'. Fel lösenord?" -0200060B="Systemet kan inte allokera den begärda minnesmängden" -0200060C="Okänt fel" -0200060D="Arkiv typen stöds ej" - -; Dialogs -02000702="OK" -02000705="&Ja" -02000707="Ja till &Alla" -02000709="&Nej" -0200070B="Nej till A&lla" - -02000710="Avbryt" -02000711="A&vbryt" -02000713="&Stäng" -02000714="Stopp" -02000715="Starta om" - -02000720="Hjälp" - -; Extract dialog -02000800="Packa upp" -02000801="&Packa upp till:" -02000802="&Lösenord" - -02000810="&Sökvägstyp" -02000811="Kompletta sökvägar" -02000812="Aktuella sökvägar" -02000813="Inga sökvägar" - -02000820="&Överskrivning" -02000821="Fråga före överskrivning" -02000822="Skriv över befintliga filer" -02000823="Hoppa över befintliga filer" -02000824="Automatisk omdöpning" -02000825="Automatisk omdöpning av befintliga filer" - -02000830="Filer" -02000831="&Markerade filer" -02000832="&Alla filer" - -02000881="Ange sökväg för uppackade filer." - -02000890="Packar upp" - -; Overwrite dialog -02000900="Bekräfta överskrivning av fil" -02000901="Målmappen innehåller redan den behandlade filen." -02000902="Vill du skriva över den befintliga filen" -02000903="med den här?" - -02000911="A&utomatisk omdöpning" - -02000982="{0} bytes" -02000983="ändrad den" - -; Messages dialog -02000A00="Diagnostiska meddelanden" - -02000A80="Meddelande" - -02000A91="Komprimeringsmetoden stöds inte för '{0}'." -02000A92="Datafel i '{0}'. Filen är korrupt." -02000A93="CRC-fel i '{0}'. Filen är korrupt." -02000A94="Datafel i den krypterade filen '{0}'. Fel lösenord?" -02000A95="CRC-fel i den krypterade filen '{0}'. Fel lösenord?" - -; Password dialog -02000B00="Ange lösenord" -02000B01="Ange lösenord:" -02000B02="&Visa lösenord" -02000B03="Upprepa lösenord:" -02000B10="Lösenorden stämmer inte överens." -02000B11="Använd endast engelska tecken, siffror och special tecken (!, #, $, ...) till lösenord" -02000B12="Lösenordet är för långt." - -; Progress dialog -02000C00="Förlopp" -02000C01="Förfluten tid:" -02000C02="Återstående tid:" -02000C03="Storlek:" -02000C04="Hastighet:" -02000C05="Bearbetat:" -02000C06="Komprimeringsgrad:" - -02000C10="&Bakgrunden" -02000C11="&Förgrunden" -02000C12="&Pausa" -02000C13="F&ortsätt" - -02000C20="Pausad" - -02000C30="Är du säker på att du vill avbryta?" - -; Compress dialog -02000D00="Lägg till arkiv" -02000D01="&Arkiv:" -02000D02="&Uppdateringsmetod:" -02000D03="Arkiv&format:" -02000D04="&Komprimeringsmetod:" -02000D05="Skapa ett &sammanhängande (eng. solid) arkiv" -02000D06="&Parametrar:" -02000D07="Alternativ" -02000D08="Skapa sj&älvuppackande arkiv" -02000D09="Använd flera trådar" -02000D0A="Kryptera fil&namn" -02000D0B="Komprimeringsniv&å:" -02000D0C="Storlek på &ordlista:" -02000D0D="Storlek på o&rd:" -02000D0E="Minne behövt vid komprimering:" -02000D0F="Minne behövt vid dekomprimering:" -02000D10="Kryptering" -02000D11="Krypteringsmetod:" -02000D12="Antal trådar:" -02000D13="Solit block storlek:" -02000D14="Icke-solit" -02000D15="Solit" -02000D16="Komprimera delade filer" - -02000D40="Dela upp i &delar (volymer), bytes:" -02000D41="Felaktig volymstorlek." -02000D42="Specificerad volymstorlek: {0} byte.\nÄr du säker du vill dela arkivet i sådana delar?" - -02000D81="Okomprimerat" -02000D82="Normal" -02000D83="Maximal" -02000D84="Snabb" -02000D85="Snabbaste" -02000D86="Ultra" - -02000D90="Bläddra" - -02000DA1="Lägg till och ersätt filer" -02000DA2="Lägg till och uppdatera befintliga filer" -02000DA3="Uppdatera enbart befintliga filer" -02000DA4="Synkronisera filer" - -02000DB1="Alla filer" - -02000DC0="Komprimerar" - -; Columns dialog -02000E00="Kolumner" -02000E01="Markera de kolumner du vill ska vara synliga i den här mappen. Använd \"Flytta Upp\" och \"Flytta Ner\" knapparna för att ordna om kolumnerna." -02000E02="Den valda kolumnen ska vara" -02000E03="pixlar &bred." - -02000E10="Flytta &Upp" -02000E11="Flytta &Ner" -02000E12="&Visa" -02000E13="&Dölj" -02000E14="Bestäm" - -02000E81="Titel" -02000E82="Bredd" - -; Testing -02000F90="Kontrollerar" - - -; File Manager - -03000000="7-Zip Filhanterare" - -; Menu -03000102="&Arkiv" -03000103="&Redigera" -03000104="&Visa" -03000105="Verkt&yg" -03000106="&Hjälp" -03000107="&Favoriter" - -; File -03000210="&Öppna" -03000211="Öppna &internt" -03000212="Öppna &externt" -03000220="&Visa" -03000221="&Redigera" -03000230="&Byt namn" -03000231="&Kopiera till..." -03000232="&Flytta till..." -03000233="&Ta bort" -03000240="E&genskaper" -03000241="Komme&ntera" -03000242="Beräkna checksumma" -03000250="Skapa mapp" -03000251="Skapa fil" -03000260="&Avsluta" -03000270="&Dela upp fil..." -03000271="&Sätt ihop filer..." - -; Edit -03000310="&Ångra" -03000311="&Gör om" -03000320="&Klipp ut" -03000321="K&opiera" -03000322="K&listra in" -03000323="&Ta bort" -03000330="Markera &alla" -03000331="Avmarkera alla" -03000332="&Invertera markering" -03000333="Markera..." -03000334="Avmarkera..." -03000335="Markera efter typ" -03000336="Avmarkera efter typ" - -; View -03000410="St&ora ikoner" -03000411="Sm&å ikoner" -03000412="&Lista" -03000413="&Detaljerad lista" -03000420="Osorterade" -03000430="Öppna rotmappen" -03000431="Upp en nivå" -03000432="Mapphistorik..." -03000440="&Uppdatera" -03000449="Platt vy" -03000450="&2 Paneler" -03000451="&Verktygsfält" -03000460="Verktygsfältet Arkiv" -03000461="Verktygsfältet Standard" -03000462="Stora Knappar" -03000463="Visa Knapptext" - -; Tools -03000510="&Alternativ..." -03000511="&Benchmark" - -; Help -03000610="&Innehåll..." -03000620="&Om 7-Zip..." - -; Favorites -03000710="&Lägg mappen till Favoriter som" -03000720="Bokmärke" - -; Options Dialog - -03010000="Alternativ" - -; Plugins -03010100="Insticksmoduler" -03010101="&Insticksmoduler:" -03010110="Alternativ..." - -; Edit -03010200="Redigerare" -03010201="&Redigerare:" - -; System -03010300="System" -03010302="Associera med 7-Zip:" -03010310="Insticksmodul" - -; Settings -03010400="Inställningar" -03010401="Visa \"..\" objektet" -03010402="Visa riktiga ikoner, för filer innehållande ikoner (el. länkade)" -03010410="Visa system-menyn" -03010420="Markera &hel rad" -03010421="Visa &rutnät" -03010430="&Alternativt markeringsläge" -03010440="Använd &stora minnessidor" - -; Strings - -03020201="Kopiera" -03020202="Flytta" -03020203="Kopiera till:" -03020204="Flytta till:" -03020205="Kopierar..." -03020206="Flyttar..." -03020207="Du kan inte flytta eller kopiera objekt till sådan mapp." -03020208="Funktionen stöds inte." -03020209="Välj målmapp." - -03020210="Bekräfta borttagning av fil" -03020211="Bekräfta borttagning av mapp" -03020212="Bekräfta borttagning av flera filer" -03020213="Är du säker på att du vill ta bort '{0}'?" -03020214="Är du säker på att du vill ta bort mappen '{0}' och allt dess innehåll?" -03020215="Är du säker på att du vill ta bort de här {0} objekten?" -03020216="Tar bort..." -03020217="Ett fel uppstod under borttagning av fil eller mapp" -03020218="Systemet kan inte flytta en fil med s lng skvg till papperskorgen" - -03020220="Döper om..." -03020221="Ett fel uppstod under omdöpning av fil eller mapp" -03020222="Bekräfta kopiering av fil" -03020223="Är du säker på att du vill kopiera filerna till arkivet" - -03020230="Skapa mapp" -03020231="Mappnamn:" -03020232="Ny mapp" -03020233="Fel vid skapande av mapp" - -03020240="Skapa fil" -03020241="Filnamn:" -03020242="Ny fil" -03020243="Fel vid skapande av fil" - -03020250="Markera" -03020251="Avmarkera" -03020252="Filter:" - -03020260="Mapphistorik" - -03020280="Filen '{0}' har blivit ändrad.\nVill du uppdatera den i arkivet?" -03020281="Kan inte uppdatera filen\n'{0}'" -03020282="Kan inte starta redigeraren." -03020283="Öppnar..." -03020284="Filen verkar vara ett virus (filnamnet innehåller 'långa' mellanslag)." - -03020290="Kommentar" -03020291="&Kommentar:" - -030202A0="System" - -03020300="Dator" -03020301="Nätverk" -03020302="Dokument" - -03020400="Lägg till" -03020401="Packa upp" -03020402="Testa" - -03020420="Kopiera" -03020421="Flytta" -03020422="Radera" -03020423="Info" - -03020500="Dela Upp Fil" -03020501="&Dela upp till:" -03020510="Delar upp..." -03020520="Bekräfta uppdelning" -03020521="Är det säkert du vill dela upp filen i {0} volymer?" -03020522="Volymstorleken måste vara mindre än storleken på originalfilen." - -03020600="Sätt Ihop Filer" -03020601="&Sätt ihop till:" -03020610="Sätter ihop..." -03020620="Markera bara första filen" -03020621="Kan inte upptäcka att filen är en del av en uppdelad fil" -03020622="Kan inte hitta mer än en del av en uppdelad fil" - -03020710="Beräknar checksumma..." -03020720="Checksumma information" -03020721="CRC checksumma för data:" -03020722="CRC checksumma för data och namn:" - -03020800="Skannar..." - -03020900="Egenskaper" - -03020A01="Operation kan inte utföras från en katalog med en så lång sökväg." -03020A02="Du måste välja en fil" -03020A03="Du måste välja en eller flera filer" -03020A04="Filen {0} existerar redan" - -; Computer -03031100="Total Storlek" -03031101="Ledigt utrymme" -03031102="Kluster storlek" -03031103="Etikett" - -; Network -03031200="Datornamn" -03031201="Nätverkstyp" - -; Benchmark Dialog - -03080000="Benchmark" -03080001="Minnesanvändning:" -03080002="Komprimering" -03080003="Dekomprimering" -03080004="Hastighet" -03080005="Prestanda" -03080006="Total prestanda" -03080007="Aktuellt" -03080008="Resultat" -03080009="Omgångar:" -0308000A="Fel:" -0308000B="CPU Användning" -0308000C="Rate / Användning" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/ta.txt b/tools/7-Zip/Lang/ta.txt deleted file mode 100644 index 6ed6d05ce2..0000000000 --- a/tools/7-Zip/Lang/ta.txt +++ /dev/null @@ -1,440 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.13 -; Translated by Ve Elanjelian, lead coordinator of ThamiZha! team. See: www.thamizha.com -; -; -; -; - -00000000="Tamil" -00000001="தமிழ்" -00000002="73" - -; 7-Zip Configuration - -; Title -01000000="7-ஜிப் தகவமைப்பு" - -; Info Page -01000100="7-ஜிப்பைப் பற்றி" -01000103="தமிழாக்கம் (c) 2004 தமிழா! குழு - www.thamizha.com/\n\n7-ஜிப் ஒரு பரிநிரல் ஆகும். ஆனால், நீங்கள் 7-ஜிப்பின் மேம்பாட்டை ஆதரிக்க விரும்பினால், பதிவுபெற்றுங்கள். பதிவுபெற்ற பயனராக, நீங்கள் தொழில்நுட்ப உதவியும் பெறலாம்." -01000105="பதிவுபெறுங்கள்" - -; Folders Page -01000200="அடைவுகள்" -01000210="பணியிலுள்ள அடைவு" -01000211="மண்டல தற்காலிக அடைவு" -01000212="நடப்பு" -01000213="குறிப்பிட்ட:" -01000214="கழற்று இயக்கிகளை மட்டும் பயன்படுத்து" - -01000281="கோப்புகளைத் தற்காலிக காப்பகப்படுத்தும் இடத்தைக் குறிப்பிடுக." - -; System Page -01000300="மண்டலம்" -01000301="7-ஜிப்பை வெற்று சூழல்பட்டியலுடன் ஒருங்கிணை" -01000302="விழுதொடரும் சூழல் பட்டியல்" -01000310="சூழல் பட்டியல் உருப்படிகள்:" - -; Language Page -01000400="மொழி" -01000401="மொழி:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-ஜிப்" -02000102="7-ஜிப் ஆணைகள்" -02000103="காப்பகத்தைத் திற" -02000104="தேரிவிக்கப்பட்ட காப்பகத்தைத் திறக்கும்." -02000105="கோப்புகளை வெளிக்கொணர்..." -02000106="தெரிவுசெய்யப்பட்ட காப்பக கோப்புகளை வெளிக்கொணரும்." -02000107="காப்பகத்தில் இணை..." -02000108="தெரிவிக்கப்பட்ட உருப்படிகளைக் காப்பகத்திலிணைக்கும்." -02000109="காப்பகத்தைச் சோதனைசெய்" -0200010A="தெரிவுசெய்யப்பட்ட காப்பக சீர்மையைச் சோதிக்கும்." -0200010B="இங்கு வெளிக்கொணர்" -0200010C="தெரிவுசெய்யப்பட்ட காப்பகக் கோப்புகளை நடப்பு அடைவில் வெளிக்கொணரும்." -0200010D="{0}-ல் வெளிக்கொணர்" -0200010E="துணைஅடைவில் கோப்புகளை வெளிக்கொணர்." -0200010F="{0}-ல் இணை" -02000110="தெரிவிக்கப்பட்ட உருப்படிகளைக் காப்பகத்திலிணைக்கும்." -02000111="இறுக்கி மின்னஞ்சலனுப்பு..." -02000112="தெரிவான உருப்படிகளை காப்பகத்தில் இறுக்கிய பின் காப்பகத்தை மின்னஞ்சல் வழி அனுப்பும்." -02000113="{0}-க்கு இறுக்கி அஞ்சலனுப்பு" -02000114="தெரிவான உருப்படிகளை காப்பகத்தில் இறுக்கிய பின் காப்பகத்தை மின்னஞ்சல் வழி அனுப்பும்." - -02000140="<அடைவு>" -02000141="<காப்பகம்>" - -; Properties -02000203="பாதை" -02000204="பெயர்" -02000205="நீட்டிப்பு" -02000206="அடைவு" -02000207="அளவு" -02000208="கட்டப்பட்ட அளவு" -02000209="பண்புக்கூறு" -0200020A="உருவாக்கப்பட்டது" -0200020B="அனுகப்பட்டது" -0200020C="மாற்றப்பட்டது" -0200020D="திண்மம்" -0200020E="கருத்துரைக்கப்பட்ட" -0200020F="மறைக்குறியீட்டப்பட்டது" -02000210="முன் பிரி" -02000211="பின் பிரி" -02000212="அகராதி" -02000213="CRC" -02000214="வகை" -02000215="தடுப்பு" -02000216="வழி" -02000217="புரவலரின் OS" -02000218="கோப்பு மண்டலம்" -02000219="பயனர்" -0200021A="குழு" -0200021B="கட்டம்" -0200021C="குறிப்பு" - -; Status bar -02000301="{0} பொருள் தெரிவானது" -02000302="{0} பொருள்(கள்)" - -; List Context Menu -02000401="பத்திகள்..." - -02000411="திற" -02000412="வெளிக்கொணர்..." - -; ToolBar -02000501="வெளிக்கொணர்" - -; Messages -02000601="இக்காப்பகத்தில் புதுப்பிக்கும் செயல்களுக்கு ஆதரவில்லை." -02000602="{0} காப்பகத்தைப் புதுப்பிக்க முடியவில்லை" -02000603="'{0}' அடைவை உருவாக்க இயலவில்லை" -02000604="கோப்பு ஒரு ஆதரிக்கப்படாத காப்பகம்." -02000605="தவறு" -02000606="மிகவும் அதிகமான உருப்படிகள்" -02000607="கொடுக்கப்பட்ட கோப்புப் பெயர் நீட்டிப்புடன் தொடர்பான எப்பயன்பாடும் இல்லை." -02000608="தவறுகளேதுமில்லை" - -; Dialogs -02000702="சரி" -02000705="ஆம்" -02000707="அனைத்திற்கும் ஆம்" -02000709="வேண்டாம்" -0200070B="அனைத்திற்கும் இல்லை" - -02000710="இரத்து" -02000711="இரத்து" -02000713="மூடு" -02000714="நிறுத்து" -02000715="மீள்துவங்கு" - -02000720="உதவி" - -; Extract dialog -02000800="வெளிக்கொணர்" -02000801="இங்கு வெளிக்கொணர்:" -02000802="கடவுச்சொல்" - -02000810="பாதை முறைமை" -02000811="முழு பாதைப்பெயர்கள்" -02000812="நடப்பு பாதைப்பெயர்கள்" -02000813="பாதைப்பெயர்களில்லை" - -02000820="மேலெழுதல் முறைமை" -02000821="மேலெழுதுவதற்கு முன் கேள்" -02000822="கேட்காமல் மேலெழுது" -02000823="தற்பொழுதுள்ள கோப்புகளைத் தவிர்" -02000824="தானாக மாற்றுப்பெயரிடு" - -02000830="கோப்புகள்" -02000831="தேரிவான கோப்புகள்" -02000832="அனைத்து கோப்புகளும்" - -02000881="வெளிக்கொணர்ந்த கோப்புகளுக்கான இடத்தைக் குறிப்பிடு." - -02000890="வெளிக்கொணரப்படுகின்றது" - -; Overwrite dialog -02000900="கோப்பு மாற்றத்தை உறுதிசெய்" -02000901="சேரிட அடைவு ஏற்கனவே செயல்படுத்தப்பட்ட கோப்பைக் கொண்டுள்ளது." -02000902="தற்பொழுதுள்ள கோப்பை" -02000903="இதக்கொண்டு மாற்ற விரும்புகிறீர்களா?" - -02000911="தானாக மாற்றுப்பெயரிடு" - -02000982="{0} பைட்கள்" -02000983="மாற்றப்பட்ட காலம்" - -; Messages dialog -02000A00="அறிவழிச் செய்திகள்" - -02000A80="செய்தி" - -02000A91="'{0}'-ல் ஆதரவில்லாத இறுக்கல் முறை." -02000A92="'{0}'-ல் தரவுத் தவறு. கோப்பு முறிந்துள்ளது." -02000A93="'{0}'-ல் CRC தோல்வியுற்றது. கோப்பு முறிந்துள்ளது." - -; Password dialog -02000B00="கடவுச்சொல்லை உள்ளிடுக" -02000B01="கடவுச்சொல்லை உள்ளிடுக:" -02000B02="கடவுச்சொல்லை காட்டு" - -; Progress dialog -02000C00="செயலாக்கம்" -02000C01="மீதமுள்ள நேரம்:" -02000C02="மீதமுள்ள நேரம்:" -02000C03="அளவு:" -02000C04="வேகம்:" - -02000C10="பின்புலம்" -02000C11="முன்புலம்" -02000C12="தற்காலிகமாக நிறுத்து" -02000C13="தொடரவும்" - -02000C20="தற்காலிக நிறுத்தல்" - -02000C30="உறுதியாகவே இரத்து செய்ய விரும்புகிறீர்களா?" - -; Compress dialog -02000D00="காப்பகத்திலிணை" -02000D01="காப்பகம்:" -02000D02="புதுபிக்கும் முறைமை:" -02000D03="காப்பக வடிவம்:" -02000D04="இறுக்கும் வழி:" -02000D05="திண்ம காப்பகத்தை உருவாக்கு" -02000D06="அளபுருகள்:" -02000D07="விருப்பத்தேர்வுகள்" -02000D08="SFX காப்பகம் உறுவாக்கு" -02000D09="பல இழையாக்கம்" -02000D0A="பெயரை மறைக்குறியீடாக்கு" -02000D0B="இறுக்க வகை:" -02000D0C="அகராதி அளவு:" -02000D0D="வார்த்தை அளவு:" -02000D0E="இறுக்க நினைவக பயன்பாடு:" -02000D0F="பெருக்க நினைவக பயன்பாடு:" - -02000D40="கனவளவுகளுக்கு, பைட்களுக்குப் பிரி:" - -02000D81="தேக்கு" -02000D82="சாதாரண" -02000D83="அதிகமான" -02000D84="விரைவான" -02000D85="அதிவிரைவான" -02000D86="சிறப்பான" - -02000D90="உலாவு" - -02000DA1="சேர்த்து கோப்புகளை மாற்று" -02000DA2="புதிப்பித்து கோப்புகளை சேர்" -02000DA3="உள்ள கோப்புகளைப் புதுப்பி" -02000DA4="கோப்புகளை ஒத்தியக்கு" - -02000DB1="அனைத்து கோப்புகளும்" - -02000DC0="இறுக்கப்படுகின்றது" - -; Columns dialog -02000E00="பத்திகள்" -02000E01="இவ்வடைவில் தெரிய வேண்டியவற்றின் பத்திகளைத் தெரிவுசெய். மேல் நகர்த்து மற்றும் கீழ் நகர்த்து பொத்தான்களக் கொண்டு பத்திகளை ஒழுங்காக்கு." -02000E02="தெரிவுசெய்யப்பட்ட பத்தி" -02000E03="படத்துணுக்கு அகலம் இருக்கவேண்டும்." - -02000E10="மேல் நகர்த்து" -02000E11="கீழ் நகர்த்து" -02000E12="காட்டு" -02000E13="மறை" -02000E14="அமை" - -02000E81="தலைப்பு" -02000E82="அகலம்" - -; Testing -02000F90="சோதனை..." - - -; File Manager - -03000000="7-ஜிப் கோப்பு மேலாளர்" - -; Menu -03000102="கோப்பு" -03000103="பதிப்பு" -03000104="பார்வை" -03000105="கருவிகள்" -03000106="உதவி" -03000107="விருப்பங்கள்" - -; File -03000210="திற" -03000211="உள்ளே திற" -03000212="வெளியே திற" -03000220="பார்வை" -03000221="பதிப்பு" -03000230="மாற்றுப்பெயரிடு" -03000231="இங்கு நகலெடு..." -03000232="இங்கு நகர்த்து..." -03000233="அழி" -03000240="தன்மைகள்" -03000241="கருத்துரை" -03000250="கோப்பை உருவாக்கு" -03000251="கோப்பு உருவாக்கு" -03000260="வெளியேறு" - -; Edit -03000310="செயல்நீக்கு" -03000311="செயல்மீள்" -03000320="வெட்டு" -03000321="நகல்" -03000322="ஒட்டு" -03000323="அழி" -03000330="அனைத்தும் தேர்ந்தெடு" -03000331="அனைத்தும் நீக்கு" -03000332="தெரிவை புரட்டு" -03000333="தேர்ந்தெடு..." -03000334="நீக்கு..." -03000335="வகைப்படி தெரிவுசெய்" -03000336="வகைப்படி நீக்கு" - -; View -03000410="பெரிய உருபிகள்" -03000411="சிறிய உருபிகள்" -03000412="பட்டியல்" -03000413="தகவல்கள்" -03000420="வரிசைப்படுத்தப்படாதது" -03000430="வேர் அடைவைத் திற" -03000431="ஒரு படி மேல்" -03000432="அடைவுகளின் வரலாறு..." -03000440="புதுக்கல்" -03000450="2 பலகங்கள்" -03000451="கருவிப்பட்டைகள்" -03000460="காப்பக கருவிப்பட்டை" -03000461="பொதுவான கருவிப்பட்டை" -03000462="பெரிய பொத்தான்கள்" -03000463="பொத்தான்களின் உரையைக் காட்டு" - -; Tools -03000510="விருப்பத்தேர்வு..." -03000511="மதிப்பீட்டு அளவை" - -; Help -03000610="பொருளடக்கம்..." -03000620="7-ஜிப்பைப் பற்றி..." - -; Favorites -03000710="அடைவை விரும்பியவற்றுள் இப்படி இணை" -03000720="புத்தகக்குறி" - -; Options Dialog - -03010000="தேர்வுகள்" - -; Plugins -03010100="செருகுநிரல்கள்" -03010101="செருகுநிரல்கள்:" -03010110="தேர்வுகள்..." - -; Edit -03010200="பதிப்பாளன்" -03010201="பதிப்பாளன்:" - -; System -03010300="மண்டலம்" -03010302="7-ஜிப்பை இதனுடன் தொடர்புப்படுத்து:" -03010310="செருகுநிரல்" - -; Settings -03010400="அமைவுகள்" -03010401="\"..\" உருப்படியைக் காட்டு" -03010402="கோப்பு உருபிகளைக் காட்டு" -03010410="மண்டல பட்டியலைக் காட்டு" - -; Strings - -03020201="நகல்" -03020202="நகர்த்து" -03020203="இங்கு நகலெடு:" -03020204="இங்கு நகர்த்து:" -03020205="நகலெடுக்கப்படுகிறது..." -03020206="நகர்த்தப்படுகிறது..." -03020207="அத்தகைய அடைவுகளுக்கு நீங்கள் நகர்த்தவோ நகலெடுக்கவோ முடியாது." -03020208="அத்தகைய செயலுக்கு ஆதரவில்லை." - -03020210="கோப்பு அழிப்பை உறுதிசெய்" -03020211="அடைவு அழிப்பை உறுதிசெய்" -03020212="பல கோப்பு அழிப்பை உறுதிசெய்" -03020213="'{0}'-ஐ உறுதியாக அழிக்க விரும்புகிறீர்களா?" -03020214="'{0}' அடைவையும் அதிலுள்ளவற்றயும் உறுதியாகவே அழிக்க விரும்புகிறீர்களா?" -03020215="இந்த {0} உருப்படிகளை உறுதியாக அழிக்க விரும்புகிறீர்களா?" -03020216="அழிக்கப்படுகிறது..." -03020217="கோப்பையோ அடைவையோ அழிக்கும்போது தவறு" - -03020220="பெயர்மாற்றப்படுகிறது..." -03020221="கோப்பையோ அடைவையோ பெயர்மாற்றும்போது தவறு" - -03020230="அடைவு உருவாக்கு" -03020231="அடைவின் பெயர்:" -03020232="புதிய அடைவு" -03020233="அடைவு உருவாக்கும்போது தவறு" - -03020240="கோப்பு உருவாக்கு" -03020241="கோப்பின் பெயர்:" -03020242="புதிய கோப்பு" -03020243="கோப்பு உருவாக்கையில் தவறேற்பட்டது" - -03020250="தெரிவுசெய்" -03020251="நீக்கு" -03020252="முகமுடி:" - -03020260="அடைவுகளின் வரலாறு" - -03020280="'{0}' கோப்பு மாற்றப்பட்டது.\nஇதனை காப்பகத்தில் புதுப்பிக்க வேண்டுமா?" -03020281="பின்வரும் கோப்பை புதுப்பிக்க இயலவில்லை\n'{0}'" -03020282="பதிப்பாளனைத் துவக்க இயலவில்லை." -03020283="திறக்கப்படுகின்றது..." - -03020290="கருத்துரை" -03020291="கருத்துரை:" - -030202A0="மண்டலம்" - -03020300="கணினி" -03020301="பிணையம்" - -03020400="இணை" -03020401="வெளிக்கொணர்" -03020402="பரிசோதி" - -03020420="நகல்" -03020421="நகர்த்து" -03020422="அழி" -03020423="தகவல்" - -; Computer -03031100="மொத்த அளவு" -03031101="காளி இடம்" -03031102="கொத்தணியின் அளவு" -03031103="வில்லை" - -; Network -03031200="இடத்துரி பெயர்" -03031201="வழங்குபவர்" - -; Benchmark Dialog - -03080000="மதிப்பீட்டு அளவை" -03080001="நினைவக பயன்:" -03080002="இறுக்கப்படுகையில்" -03080003="பெருக்கப்படுகையில்" -03080004="வேகம்" -03080005="புள்ளிகள்" -03080006="மொத்த புள்ளிகள்" -03080007="நடப்பு" -03080008="முடிவில்" -03080009="சரியானவை:" -0308000A="தவறுகள்:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/th.txt b/tools/7-Zip/Lang/th.txt deleted file mode 100644 index 12eab80dd5..0000000000 --- a/tools/7-Zip/Lang/th.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 3.13 -; Translated by Zafire06 -; -; -; -; - -00000000="Thai" -00000001="ไทย" -00000002="30" - -; 7-Zip Configuration - -; Title -01000000="โครงแบบ 7-Zip" - -; Info Page -01000100="เกี่ยวกับ 7-Zip" -01000103="7-Zip เป็นฟรีแวร์ อย่างไรก็ตาม คุณสามารถสนับสนุนการพัฒนาของ 7-Zip ได้โดยการลงทะเบียน เมื่อคุณเป็นผู้ใช้ที่ลงทะเบียนแล้ว คุณจะได้รับการสนับสนุนทางเทคนิคจากเรา" -01000105="ลงทะเบียน" - -; Folders Page -01000200="โฟลเดอร์" -01000210="&โฟลเดอร์ที่ทำงานอยู่" -01000211="&โฟลเดอร์ต่างๆของระบบ" -01000212="&โฟลเดอร์ปัจจุบัน" -01000213="&ระบุ:" -01000214="ใช้สำหรับไดรฟ์แบบถอดได้เท่านั้น" - -01000281="รายละเอียดที่ตั้งสำหรับไฟล์เอกสารชั่วคราว" - -; System Page -01000300="ระบบ" -01000301="รวบรวมคำสั่ง 7-Zip ไปที่แถบเมนูลัด" -01000302="แยกเป็นแถบคำสั่ง 7-Zip" -01000310="วัตถุที่ปรากฏบนเมนูลัด:" - -; Language Page -01000400="ภาษา" -01000401="ภาษา:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="คำสั่ง 7-Zip" -02000103="เปิดเอกสาร" -02000104="เปิดเอกสารที่เลือกไว้" -02000105="แยกไฟล์..." -02000106="แยกไฟล์จากเอกสารที่เลือกไว้" -02000107="เพิ่มเข้าเอกสาร..." -02000108="เพิ่มวัตถุที่เลือกไว้เข้าเอกสาร" -02000109="ทดสอบเอกสาร" -0200010A="ทดสอบความน่าเชื่อถือของเอกสารที่เลือกไว้" -0200010B="แยกไฟล์ที่นี่" -0200010C="แยกไฟล์จากเอกสารที่เลือกไว้ไปที่โฟลเดอร์เดิม" -0200010D="แยกไฟล์ไปที่ {0}" -0200010E="แยกไฟล์ไปที่โฟลเดอร์ย่อย." -0200010F="เพิ่มเข้า {0}" -02000110="เพิ่มวัตถุที่เลือกไว้เข้าเอกสาร" -02000111="บีบอัดแล้วส่งอีเมลล์..." -02000112="บีบอัดวัตถุที่เลือกไว้แล้วส่งไปทางอีเมลล์" -02000113="บีบอัดเป็น {0} แล้วส่งอีเมลล์" -02000114="บีบอัดวัตถุที่เลือกไว้แล้วส่งไปทางอีเมลล์" - -02000140="<โฟลเดอร์>" -02000141="<เอกสาร>" - -; Properties -02000203="ที่ตั้ง" -02000204="ชื่อ" -02000205="ชนิด" -02000206="โฟลเดอร์" -02000207="ขนาด" -02000208="ขนาดเมื่อถูกจัดเก็บ" -02000209="ลักษณะประจำ" -0200020A="สร้างเมื่อ" -0200020B="เข้าถึงเมื่อ" -0200020C="ดัดแปรเมื่อ" -0200020D="ต่อเนื่อง" -0200020E="หมายเหตุ" -0200020F="การเข้ารหัสลับ" -02000210="ก่อนแบ่ง" -02000211="หลังแบ่ง" -02000212="ดิคชันนารี" -02000213="ซีอาร์ซี" -02000214="แบบชนิด" -02000215="ต่อต้าน" -02000216="วิธีการ" -02000217="OS ที่ใช้" -02000218="ไฟล์ระบบ" -02000219="ผู้ใช้" -0200021A="กลุ่ม" -0200021B="บล็อก" -0200021C="หมายเหตุ" - -; Status bar -02000301="{0} วัตถุที่เลือกไว้" -02000302="{0} วัตถุ" - -; List Context Menu -02000401="&สดมภ์..." - -02000411="&เปิด" -02000412="&แยกไฟล์..." - -; ToolBar -02000501="แยกไฟล์" - -; Messages -02000601="ปรับปรุงการทำงานไม่สนับสนุนสำหรับเอกสาร" -02000602="ไม่สามารถปรับปรุงเอกสาร {0}" -02000603="ไม่สามารถสร้างโฟลเดอร์ '{0}'" -02000604="ไฟล์ไม่สนับสนุนเอกสาร" -02000605="เกิดข้อผิดพลาด" -02000606="มีวัตถุมากเกินไป" -02000607="ไม่มีโปรแกรมที่เปิดชนิดไฟล์ที่ให้มาได้" -02000608="ไม่มีข้อผิดพลาด" - -; Dialogs -02000702="ตกลง" -02000705="&ใช่" -02000707="ใช่ทั้งหมด" -02000709="&ไม่" -0200070B="ไม่ทั้งหมด" - -02000710="ยกเลิก" -02000711="&ยกเลิก" -02000713="&ออก" -02000714="หยุด" -02000715="ฟื้นฟู" - -02000720="ช่วยเหลือ" - -; Extract dialog -02000800="แยกไฟล์" -02000801="แยกไฟล์ไปที่:" -02000802="รหัสผ่าน" - -02000810="ที่ตั้ง" -02000811="ชื่อที่ตั้งแบบเต็ม" -02000812="ชื่อตั้งเดิม" -02000813="ไม่มีชื่อที่ตั้ง" - -02000820="การบันทึกทับ" -02000821="ถามก่อนมีการบันทึกทับ" -02000822="บันทึกทับโดยไม่มีข้อความพร้อมรับ" -02000823="ข้ามไฟล์ที่มีอยู่" -02000824="เปลี่ยนชื่ออัตโนมัติ" - -02000830="ไฟล์" -02000831="&ไฟล์ที่เลือกไว้" -02000832="&ไฟล์ทั้งหมด" - -02000881="ระบุที่ตั้งสำหรับไฟล์ที่แยกออกมา" - -02000890="กำลังแยกไฟล์" - -; Overwrite dialog -02000900="ยืนยันการแทนที่ไฟล์" -02000901="โฟลเดอร์ปลายทางมีไฟล์ที่ได้ประมวลผลแล้ว" -02000902="คุณต้องการแทนที่ไฟล์ที่มีอยู่หรือไม่" -02000903="ด้วย" - -02000911="เปลี่ยนชื่ออัตโนมัติ" - -02000982="{0} ไบต์" -02000983="ดัดแปรบน" - -; Messages dialog -02000A00="ข้อความวินิจฉัย" - -02000A80="ข้อความ" - -02000A91="ไม่สนับสนุนการบีบอัดเมท็อดสำหรับ '{0}'" -02000A92="ข้อมูลใน '{0}' ผิดพลาด ไฟล์ชำรุด" -02000A93="ซีอาร์ซีใน '{0}' ไม่สามารถใช้การได้ ไฟล์ชำรุด" - -; Password dialog -02000B00="ใส่รหัสผ่าน" -02000B01="ใส่รหัสผ่าน:" -02000B02="&แสดงรหัสผ่าน" - -; Progress dialog -02000C00="กระบวนการ" -02000C01="ใช้เวลาไปแล้ว:" -02000C02="ต้องใช้เวลาอีก:" -02000C03="ขนาด:" -02000C04="ความเร็ว:" - -02000C10="&ทำงานเป็นพื้นหลัง" -02000C11="&ทำงานเป็นพื้นหน้า" -02000C12="&หยุดชั่วคราว" -02000C13="&ดำเนินการต่อ" - -02000C20="หยุดชั่วคราว" - -02000C30="คุณแน่ใจหรือว่าจะยกเลิก" - -; Compress dialog -02000D00="เพิ่มเข้าเอกสาร" -02000D01="&เอกสาร:" -02000D02="&การปรับปรุง:" -02000D03="เอกสารการจัดรูปแบบ:" -02000D04="การบีบอัดเมท็อด:" -02000D05="สร้างเอกสารแบบต่อเนื่อง" -02000D06="&พารามิเตอร์:" -02000D07="ตัวเลือก" -02000D08="สร้างเอกสาร SFX" -02000D09="สร้างสายโยงใยมากเป็นพิเศษ" -02000D0A="สร้างรหัสผ่าน" -02000D0B="อัตราการบีบอัด:" -02000D0C="&ขนาดดิคชันนารี:" -02000D0D="&ขนาดอักษร:" -02000D0E="หน่วยความจำที่ใช้ในการบีบอัด:" -02000D0F="หน่วยความจำที่ใช้ในการแตกออก:" - -02000D40="อัตราการแบ่งไฟล์, ไบต์:" - -02000D81="เก็บเฉยๆ" -02000D82="ธรรมดา" -02000D83="ดี" -02000D84="เร็ว" -02000D85="เร็วที่สุด" -02000D86="ดีที่สุด" - -02000D90="ค้นดู" - -02000DA1="เพิ่มและแทนที่ไฟล์" -02000DA2="ปรับปรุงและเพิ่ม" -02000DA3="ทำให้ไฟล์ที่มีอยู่ใช้การได้ดีขึ้น" -02000DA4="ทำให้ไฟล์ประสานกัน" - -02000DB1="ไฟล์ทั้งหมด" - -02000DC0="กำลังบีบอัด" - -; Columns dialog -02000E00="สดมภ์" -02000E01="ตรวจสอบสดมภ์ซึ่งจะทำให้คุณรู้รายละเอียดของไฟล์ได้มากขึ้น ใช้ปุ่มย้ายขึ้นและย้ายลงเพื่อเรียงลำดับสดมภ์อีกครั้ง" -02000E02="สดมภ์ที่เลือกไว้จะเป็น" -02000E03="ความกว้าง (พิกเซล)" - -02000E10="ย้ายขึ้น" -02000E11="ย้ายลง" -02000E12="&แสดง" -02000E13="&ซ่อน" -02000E14="เซ็ต" - -02000E81="หัวเรื่อง" -02000E82="ความกว้าง" - -; Testing -02000F90="กำลังทดสอบ" - - -; File Manager - -03000000="ตัวจัดการไฟล์ 7-Zip" - -; Menu -03000102="&แฟ้ม" -03000103="&แก้ไข" -03000104="&มุมมอง" -03000105="&เครื่องมือ" -03000106="&ช่วยเหลือ" -03000107="&รายการโปรด" - -; File -03000210="&เปิด" -03000211="เปิดในหน้าต่างเดิม" -03000212="เปิดในหน้าต่างใหม่" -03000220="&มุมมอง" -03000221="&แก้ไข" -03000230="&เปลี่ยนชื่อ" -03000231="&คัดลอกไปที่..." -03000232="&วางที่..." -03000233="&ลบ" -03000240="&คุณสมบัติ" -03000241="&หมายเหตุ" -03000250="สร้างโฟลเดอร์" -03000251="สร้างไฟล์" -03000260="ออก" - -; Edit -03000310="&ทำกลับ" -03000311="&ทำซ้ำ" -03000320="&ตัด" -03000321="&คัดลอก" -03000322="&วาง" -03000323="&ลบ" -03000330="เลือกทั้งหมด" -03000331="ยกเลิกการเลือกทั้งหมด" -03000332="&สลับการเลือกให้เป็นตรงกันข้าม" -03000333="เลือก..." -03000334="ยกเลิกการเลือก..." -03000335="เลือกด้วยแบบชนิด" -03000336="ยกเลิกการเลือกด้วยแบบชนิด" - -; View -03000410="&ไอคอนขนาดใหญ่" -03000411="&ไอคอนขนาดเล็ก" -03000412="&แสดงเป็นรายการ" -03000413="&แสดงแบบละเอียด" -03000420="ไม่เลือก" -03000430="เปิดรากโฟลเดอร์" -03000431="เลื่อนขึ้นหนึ่งระดับ" -03000432="ประวัติโฟลเดอร์..." -03000440="&ฟื้นฟู" -03000450="&แสดง 2 แผง" -03000451="&แถบเครื่องมือ" -03000460="แถบเครื่องมือเอกสาร" -03000461="แถบเครื่องมือธรรมดา" -03000462="ปุ่มขนาดใหญ่" -03000463="แสดงข้อความบนปุ่ม" - -; Tools -03000510="&ตัวเลือก..." -03000511="&เกณฑ์เปรียบเทียบสมรรถนะ" - -; Help -03000610="&เนื้อหาและดัชนี..." -03000620="&เกี่ยวกับ 7-Zip..." - -; Favorites -03000710="&เพิ่มโฟลเดอร์เข้ารายการโปรด" -03000720="คั่นหน้าที่" - -; Options Dialog - -03010000="ตัวเลือก" - -; Plugins -03010100="ปลั๊กอิน" -03010101="&ปลั๊กอิน:" -03010110="ตัวเลือก..." - -; Edit -03010200="บรรณาธิกรณ์" -03010201="&บรรณาธิกรณ์:" - -; System -03010300="ระบบ" -03010302="ทำให้ 7-Zip ทำงานร่วมกับ:" -03010310="ปลั๊กอิน" - -; Settings -03010400="กำหนด" -03010401="แสดงวัตถุ \"..\"" -03010402="แสดงไอคอนไฟล์ที่แท้จริง" -03010410="แสดงเมนูระบบ" - -; Strings - -03020201="คัดลอก" -03020202="ย้าย" -03020203="คัดลอกไปที่:" -03020204="ย้ายที่:" -03020205="กำลังคัดลอก..." -03020206="กำลังวาง..." -03020207="คุณไม่สามารถย้ายหรือคัดลอกวัตถุในโฟลเดอร์เช่นนี้" -03020208="การปฏิบัติการไม่สนับสนุน" - -03020210="ยืนยันการลบไฟล์" -03020211="ยืนยันการลบโฟลเดอร์" -03020212="ยืนยันการลบไฟล์แบบควบซ้อน" -03020213="คุณแน่ใจหรือว่าคุณต้องการจะลบไฟล์ '{0}'?" -03020214="คุณแน่ใจหรือว่าคุณต้องการจะลบโฟลเดอร์ '{0}' และข้อมูลของมันทั้งหมด" -03020215="คุณแน่ใจหรือว่าจะลบวัตถุ {0} เหล่านี้" -03020216="กำลังลบ..." -03020217="เกิดข้อผิดพลาดในการลบไฟล์หรือโฟลเดอร์" - -03020220="กำลังเปลี่ยนชื่อ..." -03020221="เกิดข้อผิดพลาดในการเปลี่ยนชื่อไฟล์หรือโฟลเดอร์" - -03020230="สร้างโฟลเดอร์" -03020231="ชื่อโฟลเดอร์:" -03020232="โฟลเดอร์ใหม่" -03020233="เกิดข้อผิดพลาดในการสร้างโฟลเดอร์" - -03020240="สร้างไฟล์" -03020241="ชื่อไฟล์:" -03020242="ไฟล์ใหม่" -03020243="เหิดข้อผิดพลาดในการสร้างไฟล์" - -03020250="เลือก" -03020251="ยกเลิกการเลือก" -03020252="ตัวพราง:" - -03020260="ประวัติโฟลเดอร์" - -03020280="ไฟล์ '{0}' ได้ถูกดัดแปรแล้ว\nคุณต้องการจะปรับปรุงเอกสารหรือไม่" -03020281="ไม่สามารถปรับปรุงไฟล์\n'{0}'" -03020282="ไม่สามารถเปิดบรรณาธิกรณ์" -03020283="กำลังเปิด..." - -03020290="หมายเหตุ" -03020291="&หมายเหตุ:" - -030202A0="ระบบ" - -03020300="คอมพิวเตอร์" -03020301="เครือข่าย" - -03020400="เพิ่มเข้า" -03020401="แยกไฟล์" -03020402="ทดสอบ" - -03020420="คัดลอก" -03020421="ย้าย" -03020422="ลบ" -03020423="เกี่ยวกับ" - -; Computer -03031100="ขนาดทั้งหมด" -03031101="ช่องว่างที่เหลืออยู่" -03031102="ขนาดกลุ่ม" -03031103="ป้าย" - -; Network -03031200="ชื่อเฉพาะ" -03031201="ผู้ให้บริการ" - -; Benchmark Dialog - -03080000="เกณฑ์เปรียบเทียบสมรรถนะ" -03080001="หน่วยความจำที่ใช้:" -03080002="การบีบอัด" -03080003="การยกเลิกบีบอัด" -03080004="ความเร็ว" -03080005="เกณฑ์ความสามารถ" -03080006="เกณฑ์ความสามารถทั้งหมด" -03080007="ปัจจุบัน" -03080008="ผลการประเมิน" -03080009="ข้อความ:" -0308000A="ความผิดพลาด:" - -; New lines (Added 11/10/2004 For Version 4) -0200021D="ตำแหน่ง" -02000825="เปลี่ยนชื่อไฟล์ที่มีอยู่แล้วอัตโนมัติ" -03000270="แ&บ่งไฟล์..." -03000271="ร&วมไฟล์..." -03010420="เ&ลือกเต็มแถว" -03010421="แสดงเ&ส้นกริด" -03020500="แบ่งไฟล์" -03020501="แ&บ่งไปที่:" -03020510="กำลังแบ่ง..." -03020600="รวมไฟล์" -03020601="&รวมไปที่:" -03020610="กำลังรวม..." - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/tr.txt b/tools/7-Zip/Lang/tr.txt deleted file mode 100644 index 8d644ecd36..0000000000 --- a/tools/7-Zip/Lang/tr.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by X-FoRcE 22.09.2009 -; -; X-FoRcE -; Turkiye -; - -00000000="Turkish" -00000001="Türkçe" -00000002="31" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Yapılandırma" - -; Info Page -01000100="7-Zip hakkında" -01000103="7-Zip özgür bir yazılımdır. Ancak, kayıt olarak 7-zip geliştirme faaliyetine destek olabilirsiniz." -01000104="Destek" -01000105="Kayıt ol" - -; Folders Page -01000200="Klasörler" -01000210="Ça&lışma klasörü" -01000211="&Sistem TEMP klasörü" -01000212="&Geçerli klasör" -01000213="&Belirtilen klasör:" -01000214="Sadece çıkarılabilen sürücüler için kullan" - -01000281="Geçici arşiv dosyaları için bir yer belirleyin." - -; System Page -01000300="Sistem" -01000301="İçerik menülerinde 7-Zip görünsün" -01000302="Kademeli içerik menüsü" -01000310="İçerik menü öğeleri:" - -; Language Page -01000400="Dil" -01000401="Dil:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip komutları" -02000103="Arşivi aç" -02000104="Seçili arşivi açar." -02000105="Dosyaları çıkart..." -02000106="Seçili arşivden dosyaları çıkartır." -02000107="Arşivle..." -02000108="Seçili öğeleri arşive ekler." -02000109="Arşivi sına" -0200010A="Seçili arşivin bütünlüğünü test eder." -0200010B="Burada çıkart" -0200010C="Seçili arşivdeki dosyaları geçerli klasöre çıkartır." -0200010D="{0} klasörüne çıkart" -0200010E="Alt klasöre çıkartır." -0200010F="{0} olarak arşivle" -02000110="Seçili öğeleri arşive ekler." -02000111="Sıkıştırıp postala..." -02000112="Seçili öğeleri sıkıştırıp arşivler ve arşivi e-posta ile gönderir." -02000113="{0} olarak sıkıştır ve postala" -02000114="Seçili öğeleri sıkıştırıp arşivler ve arşivi e-posta ile gönderir." - -02000140="" -02000141="" - -; Properties -02000203="Yol" -02000204="Ad" -02000205="Uzantı" -02000206="Klasör" -02000207="Boyut" -02000208="Arşivde boyutu" -02000209="Öznitelikler" -0200020A="Oluşturma" -0200020B="Erişim" -0200020C="Değiştirme" -0200020D="Katı" -0200020E="Açıklanmış" -0200020F="Şifrelenmiş" -02000210="Önceki parça" -02000211="Sonraki parça" -02000212="Sözlük" -02000213="CRC" -02000214="Tür" -02000215="Anti" -02000216="Sıkıştırma şekli" -02000217="İşletim sistemi" -02000218="Dosya Sistemi" -02000219="Kullanıcı" -0200021A="Grup" -0200021B="Blok" -0200021C="Açıklama" -0200021D="Konum" -0200021E="Yol Öneki" -0200021F="Klasörler" -02000220="Dosyalar" -02000221="Sürüm" -02000222="Cilt" -02000223="Çoklu Cilt" -02000224="Konum" -02000225="Bağlantılar" -02000226="Bloklar" -02000227="Ciltler" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="İşlemci" -0200022C="Fiziksel Boyut" -0200022D="Başlık Boyutu" -0200022E="Checksum" -0200022F="Karakteristik" -02000230="Sanal Adres" -02000231="ID" -02000232="Kısa İsim" -02000233="Oluşturan Yazılım" -02000234="Kesim Boyutu" -02000235="Biçim" -02000236="Bağlantı" - -; Status bar -02000301="{0} adet öğe seçili" -02000302="{0} adet öğe" - -02000320="Dosyalar:" -02000321="Klasörler:" -02000322="Boyut:" -02000323="Sıkıştırılmış Boyut:" -02000324="Arşivler:" - -; List Context Menu -02000401="&Sütunlar..." - -02000411="&Aç" -02000412="&Çıkart..." - -; ToolBar -02000501="Çıkart" - -; Messages -02000601="Bu arşiv üzerinde güncelleme yapamazsınız." -02000602="{0} arşivi güncellenemiyor" -02000603="'{0}' klasörü oluşturulamıyor" -02000604="Bu dosya bilinen bir arşiv değil." -02000605="Hata" -02000606="Çok fazla öğe" -02000607="Bu dosya uzantısı ile ilişkili bir uygulama yok" -02000608="Hata yok." -02000609="'{0}' arşiv dosyası olarak açılamıyor." -0200060A="'{0}' dosyası açılamıyor. Şifreniz yanlış olabilir mi?" -0200060B="Sistem gerekli belleği ayarlayamadı" -0200060C="Bilinmeyen hata" -0200060D="Desteklenmeyen arşiv tipi" - -; Dialogs -02000702="Tamam" -02000705="&Evet" -02000707="Tümüne E&vet" -02000709="&Hayır" -0200070B="Tümüne Ha&yır" - -02000710="İptal" -02000711="İ&ptal" -02000713="&Kapat" -02000714="Dur" -02000715="Tekrar başlat" - -02000720="Yardım" - -; Extract dialog -02000800="Çıkart" -02000801="&Çıkartılacak yer:" -02000802="Parola" - -02000810="Yol adları" -02000811="Tam yol adları" -02000812="Geçerli yol adları" -02000813="Yol adları olmasın" - -02000820="Olan dosyalar" -02000821="Üzerine yazmak için sor" -02000822="Sormadan üzerine yaz" -02000823="Çıkartma" -02000824="Arşivdekilere yeni ad ver" -02000825="Olanlara yeni ad ver" - -02000830="Dosyalar" -02000831="&Seçili dosyalar" -02000832="&Tüm dosyalar" - -02000881="Çıkartılacak dosyalar için bir yer belirleyin." - -02000890="çıkartılıyor" - -; Overwrite dialog -02000900="Üzerine Yazma Durumu" -02000901="Hedef klasörde bu adla bir dosya var. Üzerine yazılsın mı?" -02000902="Mevcut dosya:" -02000903="Çıkartılan dosya:" - -02000911="&Yeni ad ver" - -02000982="{0} bayt" -02000983="son değişimi " - -; Messages dialog -02000A00="Tanılayıcı iletiler" - -02000A80="İleti" - -02000A91="'{0}' için sıkıştırma şekli tanınamadı." -02000A92="'{0}' bozuk. (Veri hatası)" -02000A93="'{0}' bozuk. (CRC hatası)" -02000A94="Şifrelenmiş '{0}' dosyası hatalı. Şifreniz yanlış olabilir mi?" -02000A95="'{0}' dosyasında CRC hatası. Şifreniz yanlış olabilir mi?" - -; Password dialog -02000B00="Parola Girişi" -02000B01="Parolayı girin:" -02000B02="Par&ola görünsün" -02000B03="Şifre tekrarı:" -02000B10="Şifreler birbiriyle uyuşmuyor." -02000B11="Şifre için İngilizce harfler, sayılar ve özel karekterden (!, #, $, ...) kullanabilirsiniz." -02000B12="Şifre çok uzun" - -; Progress dialog -02000C00="işle" -02000C01="Geçen süre:" -02000C02="Kalan süre:" -02000C03="Boyut:" -02000C04="Hız:" -02000C05="İşlenen:" -02000C06="Sıkıştırma oranı:" - -02000C10="&Arka planda" -02000C11="Ö&nde" -02000C12="&Duraklat" -02000C13="De&vam et" - -02000C20="Duraklatıldı - " - -02000C30="İptal edilsin mi?" - -; Compress dialog -02000D00="Arşivle" -02000D01="&Arşiv:" -02000D02="&Güncelleme şekli:" -02000D03="Arşiv &biçimi:" -02000D04="Sı&kıştırma şekli:" -02000D05="Ka&tı olsun" -02000D06="&Parametreler:" -02000D07="Seçenekler" -02000D08="Ke&ndi çıkartsın (SFX)" -02000D09="Ç&ok ilmekli" -02000D0A="Dosya adlarını şi&frele" -02000D0B="Sıkıştırma dü&zeyi:" -02000D0C="&Sözlük boyutu:" -02000D0D="Ke&lime boyutu:" -02000D0E="Bellek kullanımı (Sıkıştırma):" -02000D0F="Bellek kullanımı (Çözme):" -02000D10="Şifreleme" -02000D11="Şifreleme metodu:" -02000D12="İşlemci iş parçası sayısı:" -02000D13="Aralıksız blok boyutu:" -02000D14="Aralıklı" -02000D15="Aralıksız" -02000D16="Paylaşılan dosyaları sıkıştır" - -02000D40="Bayt/&cilt olarak parçala:" -02000D41="Yanlış cilt boyutu" -02000D42="Belirtilen cilt boyutu: {0} bayt.\nBu boyutta ciltlere ayırmak istediğinize emin misiniz?" - -02000D81="Sıkıştırmasız" -02000D82="Normal" -02000D83="Maksimum" -02000D84="Hızlı" -02000D85="En hızlı" -02000D86="Ultra" - -02000D90="Gözat" - -02000DA1="Dosyaları ekle, olanları çıkart" -02000DA2="Dosyaları ekle, eskileri güncelle" -02000DA3="Sadece eskileri güncelle" -02000DA4="Dosyaları eşitle" - -02000DB1="Tüm dosyalar" - -02000DC0="sıkıştırılıyor" - -; Columns dialog -02000E00="Sütunlar" -02000E01="Bu klasörde görülebilir olmasını istediğiniz sütunları işaretleyin. Sütunları sıralamak için yukarı-aşağı düğmelerini kullanın." -02000E02="Seçili sütun genişliği" -02000E03="&piksel olsun." - -02000E10="&Yukarı" -02000E11="&Aşağı" -02000E12="&Göster" -02000E13="Gi&zle" -02000E14="Tayin et" - -02000E81="Başlık" -02000E82="Genişlik" - -; Testing -02000F90="Sınanıyor" - - -; File Manager - -03000000="7-Zip Dosya Yöneticisi" - -; Menu -03000102="&Dosya" -03000103="Dü&zenle" -03000104="Gö&rüntüle" -03000105="&Araçlar" -03000106="&Yardım" -03000107="Sı&k Kullanılanlar" - -; File -03000210="&Aç" -03000211="Pa&nelde Aç" -03000212="Pence&rede Aç" -03000220="&Görüntüle" -03000221="Dü&zenle" -03000230="Yeni a&d ver" -03000231="K&opyala" -03000232="&Taşı" -03000233="&Sil" -03000240="Öz&ellikler" -03000241="Açıkla&ma" -03000242="Toplam checksum hesapla" -03000243="Fark" -03000250="Yeni k&lasör" -03000251="Yeni dos&ya" -03000260="Çı&k" -03000270="&Parçala..." -03000271="&Birleştir..." - -; Edit -03000310="&Geri al" -03000311="&Yinele" -03000320="&Kes" -03000321="K&opyala" -03000322="Ya&pıştır" -03000323="&Sil" -03000330="&Tümünü seç" -03000331="Tüm seçimi ka&ldır" -03000332="&Aksini seç" -03000333="Seç..." -03000334="Seçimi kaldır..." -03000335="Bu uzantıyı seç" -03000336="Uzantılı seçimi kaldır" - -; View -03000410="&Büyük Simgeler" -03000411="&Küçük Simgeler" -03000412="&Liste" -03000413="&Detaylar" -03000420="Sırasız" -03000430="Kök Klasörü Aç" -03000431="Bir Seviye Yukarı" -03000432="Klasör Geçmişi..." -03000440="&Yenile" -03000449="Düz Görünüm" -03000450="&2 Panel aç" -03000451="&Araç çubukları" -03000460="Arşiv çubuğu" -03000461="Standart çubuk" -03000462="Büyük düğmeler" -03000463="Düğme metinleri görünsün" - -; Tools -03000510="&Seçenekler..." -03000511="&Performans ölçümü" - -; Help -03000610="İç&indekiler..." -03000620="7-Zip &Hakkında..." - -; Favorites -03000710="Geçerli &klasörü ekle" -03000720="Yer" - -; Options Dialog - -03010000="Seçenekler" - -; Plugins -03010100="Eklentiler" -03010101="&Eklentiler:" -03010110="Ayarlar..." - -; Edit -03010200="Düzenleyici" -03010201="Metin &düzenleyici:" -03010202="&Fark:" - -; System -03010300="Sistem" -03010302="7-Zip ile ilişkilendir:" -03010310="Eklenti" - -; Settings -03010400="Ayarlar" -03010401="\"..\" öğesi görünsün" -03010402="Gerçek dosya simgeleri görünsün" -03010410="Sistem menüsü görünsün" -03010420="&Tüm satır seçilsin" -03010421="Tabl&o çizgileri görünsün" -03010422="Öğeyi açmak için tek tıkla" -03010430="&Alternatif seçim kipi" -03010440="Geniş &bellek sayfaları kullan" - -; Strings - -03020201="Kopyala" -03020202="Taşı" -03020203="Kopyalanacak yer:" -03020204="Taşınacak yer:" -03020205="Kopyalanıyor..." -03020206="Taşınıyor..." -03020207="Öğelerin kopyalanması veya taşınması bu klasör için mümkün değil." -03020208="Bu klasör için istenen işlem desteklenmiyor." -03020209="Hedef klasörü seçiniz." - -03020210="Dosya Silme Onayı" -03020211="Klasör Silme Onayı" -03020212="Birden Fazla Dosya Silme Onayı" -03020213="'{0}' silinsin mi?" -03020214="'{0}' klasörü ve içindekiler silinsin mi?" -03020215="{0} silinsin mi?" -03020216="Siliniyor..." -03020217="Dosya veya Klasör Silme Hatası" -03020218="Dosya yolu uzun olduğundan Geri Dönüşüm Kutusuna taşınamıyor" - -03020220="Dosya Adı Değiştiriliyor..." -03020221="Dosya veya Klasör Adlandırma Hatası" -03020222="Kopyalama Onayı" -03020223="Dosyalar arşive kopyalansın mı" - -03020230="Yeni klasör" -03020231="Klasör adı:" -03020232="Yeni Klasör" -03020233="Klasör Oluşturma Hatası" - -03020240="Yeni dosya" -03020241="Dosya Adı:" -03020242="Yeni Dosya" -03020243="Dosya Oluşturma Hatası" - -03020250="Seç" -03020251="Seçimi kaldır" -03020252="Seçim ifadesi:" - -03020260="Klasör Geçmişi" - -03020280="'{0}' dosyası değişmiş.\nArşivde güncellensin mi?" -03020281="'{0}' dosyası güncellenemedi" -03020282="Metin düzenleyici başlatılamadı." -03020283="açılıyor..." -03020284="Bu dosya virüs gibi görünüyor.(Dosya ismi uzun boşluk içeriyor)." - -03020290="Açıklama" -03020291="&Açıklama:" - -030202A0="Sistem" - -03020300="Bilgisayar" -03020301="Ağ" -03020302="Belgeler" - -03020400="Arşivle" -03020401="Çıkart" -03020402="Sına" - -03020420="Kopyala" -03020421="Taşı" -03020422="Sil" -03020423="Bilgi" - -03020500="Parçala" -03020501="Şu &klasörde parçala:" -03020510="Parçalanıyor..." -03020520="Silmeyi onaylayın" -03020521="Dosyayı {0} parçaya ayırmak istediğinizden emin misiniz?" -03020522="Parça büyüklüğü, orjinal dosya boyutundan küçük olmalıdır" - -03020600="Birleştir" -03020601="Şu &klasörde birleştir:" -03020610="Birleştiriliyor..." -03020620="Sadece ilk parçayı seçiniz" -03020621="Parçalanan dosya tespit edilemedi" -03020622="Parçalanmış dosyanın bir parçadan fazlası bulunamadı" - -03020710="Checksum değeri hesaplanıyor..." -03020720="Checksum bilgisi" -03020721="Verinin CRC değeri:" -03020722="Verinin CRC değeri ve isimler:" - -03020800="Taranıyor..." - -03020900="Özellikler" - -03020A01="The operation cannot be called from a folder that has a long path." -03020A02="Bir dosya seçmelisiniz" -03020A03="Bir veya daha fazla dosya seçmelisiniz" -03020A04="Dosya {0} zaten mevcut" - -; Computer -03031100="Toplam Boyut" -03031101="Boş Alan" -03031102="Küme Boyutu" -03031103="Etiket" - -; Network -03031200="Yerel Ad" -03031201="Sağlayıcı" - -; Benchmark Dialog - -03080000="Bilgisayar performansı" -03080001="Bellek kullanımı:" -03080002="Sıkıştırılıyor" -03080003="Çözülüyor" -03080004="Hız" -03080005="Puan" -03080006="Toplam Puan" -03080007="Mevcut" -03080008="Sonuç" -03080009="Başarılı:" -0308000A="Hatalı:" -0308000B="İşlemci kullanımı" -0308000C="Puan / Kullanım" - -;!@LangEnd@! - - \ No newline at end of file diff --git a/tools/7-Zip/Lang/tt.txt b/tools/7-Zip/Lang/tt.txt deleted file mode 100644 index 1809a18ccf..0000000000 --- a/tools/7-Zip/Lang/tt.txt +++ /dev/null @@ -1,454 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.07 beta -; Translated by Albert Fazlí (http://soft.beznen.net/) -; -; -; -; - -00000000="Tatarish" -00000001="Tatarça" -00000002="68" - -; 7-Zip Configuration - -; Title -01000000="7-Zip Caylaw" - -; Info Page -01000100="7-Zip turında" -01000103="7-Zip yazılımı buşlay. Alay bulsa da, terkälü aşa anı citeşterü eşenä yärdäm itep bula." -01000105="Terkälü" - -; Folders Page -01000200="Törgäklär" -01000210="&Eş törgäge" -01000211="&Sistemneñ çorlı törgäge" -01000212="&Biredäge" -01000213="Bo&nısı:" -01000214="Çığarmalı cıharlar öçen genä qullanası" - -01000281="Çorlı tuplam biremnäre öçen urınlaşu bilgeläw." - -; System Page -01000300="Sistem" -01000301="7-Zip'ne atılma saylaqqa kertäse" -01000302="Atılma saylaqnı töräse" -01000310="Atılma saylaq kereme:" - -; Language Page -01000400="Telläşterü" -01000401="Tel saylaw:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip boyırığı" -02000103="Tuplamanı Açu" -02000104="Saylanğan tuplamanı aça." -02000105="Biremne Çişü..." -02000106="Saylanğan tuplama biremnären çişä." -02000107="Tuplamağa Östäw..." -02000108="Saylanğan kermenärne tuplamağa östi." -02000109="Tuplamanı Sına" -0200010A="Saylanğan tuplamanıñ tulılığın tikşerä." -0200010B="Bonda Çiş" -0200010C="Saylanğan tuplama biremnären biredäge törgäkkä çişä." -0200010D="Boña Çiş: {0}" -0200010E="Biremnärne eçtörgäkkä çişä." -0200010F="Boña Östä: {0}" -02000110="Saylanğan keremnärne tuplamağa östi." -02000111="Qısıp Cibärü..." -02000112="Saylanğan keremnärne tuplamağa östäp, şul tuplamanı email aşa cibärä." -02000113="Qısıp Cibär, {0} kebek" -02000114="Saylanğan keremnärne tuplamağa östäp, şul tuplamanı email aşa cibärä." - -02000140="" -02000141="" - -; Properties -02000203="Yul" -02000204="Adı" -02000205="Quşımta" -02000206="Törgäk" -02000207="Küläm" -02000208="Qısqan Küläm" -02000209="Üzençälek" -0200020A="Yasaldı" -0200020B="İreşelde" -0200020C="Üzgärelde" -0200020D="Özelmäs" -0200020E="Açıqlamalı" -0200020F="Serlängän" -02000210="Bülü Aldında" -02000211="Bülüdän Soñ" -02000212="Süznämä" -02000213="CRC" -02000214="Törlek" -02000215="Qarşı" -02000216="Isul" -02000217="Host OS" -02000218="Birem Sisteme" -02000219="Qullanuçı" -0200021A="Törkem" -0200021B="Blok" -0200021C="Açıqlama" -0200021D="Urını" - -; Status bar -02000301="{0} cisem saylandı" -02000302="{0} cisem" - -; List Context Menu -02000401="&Buylar..." - -02000411="&Aç" -02000412="&Çişü..." - -; ToolBar -02000501="Çişü" - -; Messages -02000601="Bu tuplama öçen yañartu eşen uzdırıp bulmí." -02000602="Tuplamanı yañartıp buldı: {0}" -02000603="Törgäkne yasap bulmadı: {0}" -02000604="Bu birem totılğan tuplamalardan tügel." -02000605="Xata" -02000606="Keremnär artıq küp" -02000607="Bu birem adındağı quşımtağa kileştergän yazılımnar yuq" -02000608="Xatalar yuq" - -; Dialogs -02000702="OK" -02000705="Ä&ye" -02000707="&Barına da Äye" -02000709="Yu&q" -0200070B="Barına da Y&uq" - -02000710="Kiräkmi" -02000711="&Kiräkmi" -02000713="&Çığış" -02000714="Tuqta" -02000715="Yänä Cibär" - -02000720="Yärdäm" - -; Extract dialog -02000800="Çiş" -02000801="Boña çişä&se:" -02000802="Sersüz" - -02000810="Yullar" -02000811="Tulı yul adı" -02000812="Bu yuldan tayanıp" -02000813="Yullarsız" - -02000820="Östän yazıp" -02000821="Östän yazu aldınnan sorísı" -02000822="Östän yazu aldınnan soramísı" -02000823="Bulğan biremne uzası" -02000824="Adın üzgärtäse" -02000825="Bulğan birem adın üzgärtäse" - -02000830="Biremnär" -02000831="&Saylanğan biremnär" -02000832="&Bar biremnär" - -02000881="Çiğelgän biremnär öçen urınlaşu törgägen bilgeläw." - -02000890="Çişü" - -; Overwrite dialog -02000900="Birem Almaştırunı Raslaw" -02000901="Çişü törgägendä eşkärtelä torğan biremnär bar inde." -02000902="Şul bar bulğan biremne" -02000903="bonısına almaştırasımı?" - -02000911="Üzennän &Atap tor" - -02000982="{0} bayt" -02000983="üzgärtelüe" - -; Messages dialog -02000A00="Tikşerü beldermäse" - -02000A80="Beldermä" - -02000A91="'{0}' eçtälegeneñ qısu ısulı totılmí." -02000A92="'{0}' eçtälege yaraqsız. Bu birem bozıq." -02000A93="'{0}' CRC'se kileşmi. Bu birem bozıq." - -; Password dialog -02000B00="Sersüz kertü" -02000B01="Sersüz kertü:" -02000B02="&Sersüz kürsätäse" - -; Progress dialog -02000C00="Alğa barış" -02000C01="Uylanğan waqıt:" -02000C02="Qalğan waqıt:" -02000C03="Küläm:" -02000C04="Tizlek:" - -02000C10="&Artqı yaqta" -02000C11="A&lğı yaqta" -02000C12="&Tuqtap tor" -02000C13="&Dawam it" - -02000C20="Tuqtap tora" - -02000C30="Bu eşne çınlap ta özäseme?" - -; Compress dialog -02000D00="Tuplamağa östä" -02000D01="&Tuplama:" -02000D02="&Yañartu isulı:" -02000D03="Tuplama &töre:" -02000D04="Qısu &ısulı:" -02000D05="Ö&zelmäs tuplama yasísı" -02000D06="&Köylämä:" -02000D07="Köylämälär" -02000D08="SF&X tuplama yasísı" -02000D09="Küp-ceple" -02000D0A="Birem adı&n serlise" -02000D0B="Qızu &köçe:" -02000D0C="&Süznämä küläme:" -02000D0D="Sü&z küläme:" -02000D0E="Qısqanda Xäter qullanu:" -02000D0F="Çişkändä Xäter qullanu:" - -02000D40="&Töplämgä büläse, bayt:" - -02000D81="Saqlap" -02000D82="Ğädäti" -02000D83="Bik qısıp" -02000D84="Tiz" -02000D85="Bik tiz" -02000D86="İs kitkeç" - -02000D90="Saylaw" - -02000DA1="Biremnärne östise dä almaştırası" -02000DA2="Biremnärne östise dä yañartası" -02000DA3="Bulğan biremnärne yañartası" -02000DA4="Biremnärne çordaşlísı" - -02000DB1="Bar Biremnär" - -02000DC0="Qısu" - -; Columns dialog -02000E00="Buylar" -02000E01="Bu törgäktä küräse kilgän buylarnı saylaw. Buylarnıñ tezeleşen üzgärtü öçen, Öskäräk/Asqaraq töymälären qullanası." -02000E02="Saylanğan buy " -02000E03="tap &kiñlegendä bulırğa tieş." - -02000E10="Ös&käräk" -02000E11="As&qaraq" -02000E12="Kü&rsät" -02000E13="&Yäşer" -02000E14="Quy" - -02000E81="Başlıq" -02000E82="Kiñlek" - -; Testing -02000F90="Sınaw" - - -; File Manager - -03000000="7-Zip Birem İdäräçe" - -; Menu -03000102="&Birem" -03000103="Ü&zgärtü" -03000104="&Küreneş" -03000105="&Qoral" -03000106="&Yärdäm" -03000107="&Saylanma" - -; File -03000210="&Aç" -03000211="&Üzendä Aç" -03000212="&Tıştan Aç" -03000220="&Eçtälege" -03000221="Ü&zgärtü" -03000230="İse&m Quşu" -03000231="Boña &Kübäytü..." -03000232="Boña Küçe&rü..." -03000233="&Beter" -03000240="&Üzençälege" -03000241="Açıqla&ma" -03000250="Törgäk Yasaw..." -03000251="Birem Yasaw..." -03000260="Çı&ğış" -03000270="Biremne &Bülü..." -03000271="Biremnärne &Berläşterü..." - -; Edit -03000310="Kire a&l" -03000311="Kire &qaq" -03000320="Ki&sep al" -03000321="&İskä al" -03000322="&Östäp quy" -03000323="&Beter" -03000330="B&arın da Sayla" -03000331="Saylanunı Beter" -03000332="K&ire Saylap" -03000333="Saylanğan itü" -03000334="Saylanmağan itü" -03000335="Törne Saylanğan itü" -03000336="Törne Saylanmağan itü" - -; View -03000410="&Olı Tamğa" -03000411="&Keçe Tamğa" -03000412="&Tezmä" -03000413="&Cäymä" -03000420="Tezmiçä" -03000430="Töp Torgäkne Aç" -03000431="Ber Adımğa Öskä" -03000432="Utkän Törgäklär..." -03000440="&Yañart" -03000450="&2 Taqta" -03000451="&Qoraltirä" -03000460="Tuplama Qoraltiräse" -03000461="Töp Qoraltirä" -03000462="Olı Töymälär" -03000463="Töymä Yazması belän" - -; Tools -03000510="&Caylaw..." -03000511="Ci&tezlek" - -; Help -03000610="&Eçtälek..." -03000620="7-Zip &Turında..." - -; Favorites -03000710="&Törgäkne bolay itep östä:" -03000720="Bitbilge" - -; Options Dialog - -03010000="Caylaw" - -; Plugins -03010100="Östämä" -03010101="&Östämä:" -03010110="Caylaw..." - -; Edit -03010200="Tözätkeç" -03010201="&Tözätkeç:" - -; System -03010300="Sistem" -03010302="7-Zip belän Kileşter:" -03010310="Östämä" - -; Settings -03010400="Caylaw" -03010401="Tezmädä \"..\" törgägen kürsätäse" -03010402="Birem tamğasın kürsätäse" -03010410="Sistem saylağın kürsätäse" -03010420="Yulnı &tulayım saylísı" -03010421="Yulara sızıq &kürsätäse" - -; Strings - -03020201="İskä" -03020202="Küçer" -03020203="Boña kübäyt:" -03020204="Boña küçer:" -03020205="Kübäytü..." -03020206="Küçerü..." -03020207="Bu törgäk öçen keremnärne kübäytep/küçerep bulmí." -03020208="Bonı eşläp bulmí." - -03020210="Birem Beterüne Raslaw" -03020211="Törgäk Beterüne Raslaw" -03020212="Biremnärne Küpläp Beterüne Raslaw" -03020213="Bonı çınlap ta beteräseme: '{0}'?" -03020214="Bu törgäkne anıñ bar eçtälege belän çınlap ta beteräseme: '{0}'?" -03020215="Bu {0} keremne çınlap ta beteräseme?" -03020216="Beterü..." -03020217="Birem/Törgäkne Beterü Xatası" - -03020220="İsem quşu..." -03020221="Birem/Törgäkkä İsem quşu Xatası" - -03020230="Törgäk Yasaw" -03020231="Törgäk adı:" -03020232="Yaña Törgäk" -03020233="Törgäk Yasaw Xatası" - -03020240="Birem Yasaw" -03020241="Birem Adı:" -03020242="Yaña Birem" -03020243="Birem Yasaw Xatası" - -03020250="Saylağan it" -03020251="Saylanmağan it" -03020252="Ürnäk:" - -03020260="Uzğan Törgäklär" - -03020280="'{0}' atlı birem üzgärtelde.\nAnı tuplamada da yañartasımı?" -03020281="Biremne yañartıp bulmadı\n'{0}'" -03020282="Tözätkeçne cibärep bulmadı." -03020283="Açu..." - -03020290="Açıqlama" -03020291="&Açıqlama:" - -030202A0="Sistem" - -03020300="Sanaq" -03020301="Çeltär" - -03020400="Östä" -03020401="Çiş" -03020402="Sına" - -03020420="Kübäyt" -03020421="Küçer" -03020422="Beter" -03020423="Turında" - -03020500="Biremne Bül" -03020501="&Boña büläse:" -03020510="Bülderü..." - -03020600="Biremne Ber it" -03020601="&Boña ber itäse:" -03020610="Berläşterü..." - -; Computer -03031100="Barlıq Küläm" -03031101="Buş Alan" -03031102="Börtek Küläme" -03031103="Yazma" - -; Network -03031200="Cirle Atama" -03031201="Tä'minçe" - -; Benchmark Dialog - -03080000="Citezlek" -03080001="Xäter totıla:" -03080002="Qısqanda" -03080003="Çişkändä" -03080004="Tizlek" -03080005="Köç" -03080006="Köç Yomğağı" -03080007="Biredä" -03080008="Näticä" -03080009="Eşläp çığu:" -0308000A="Xatalar:" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/ug.txt b/tools/7-Zip/Lang/ug.txt deleted file mode 100644 index 5b4aa0cf55..0000000000 --- a/tools/7-Zip/Lang/ug.txt +++ /dev/null @@ -1,536 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.59 -; Translated by Sahran -; -; -; -; - -00000000="Uyghur" -00000001= "ئۇيغۇرچە" -00000002= "128" - -; 7-Zip Configuration - -; Title -01000000= "‏7-Zip تەڭشەك" - -; Info Page -01000100= "‎7-Zip‏ ھەققىدە" -01000103= "‏7-Zip ‏ھەقسىز دېتال. ئەمما تىزىملىتىش ئارقىلىق ئۇنى ئېچىشنى قوللىسىڭىز بولىدۇ." -01000104= "تېخنىكىلىق قوللاش" -01000105= "خەتلەت" - -; Folders Page -01000200= "قىسقۇچ" -01000210= "خىزمەت مۇندەرىجىسى(&W)" -01000211= "(&S)سىستېما ۋاقىتلىق قىسقۇچ" -01000212= "(&C)نۆۋەتتىكى" -01000213= "(&S)بەلگىلەنگەن قىسقۇچ:" -01000214= "يان دىسكىغىلا ئىشلىتىلىدۇ" - -01000281= "پرىس ھۆججىتىنى يېشىدىغان ۋاقىتلىق ئورۇندىن بىرنى بەلگىلەڭ." - -; System Page -01000300= "سىستېما" -01000301= "7-Zip نى ئوڭ كۇنۇپكا تىزىملىكىگە قوش" -01000302= "ئوڭ تىزىملىكنى دەستىلە" -01000310= "ئوڭ تىزىملىكتە كۆرۈنىدىغان تۈرنى تاللاش" - -; Language Page -01000400= "تىل" -01000401= "تىل:" - - -; 7-Zip Explorer extension - -; Context menu -02000101= "7-Zip" -02000102= "7-Zip بۇيرۇقى" -02000103= "پرىس ئاچ" -02000104= "تاللىغان پرىسنى ئاچ" -02000105= "ھۆججەت يەش…" -02000106= "تاللىغان پرىستىن ھۆججەت يەش" -02000107= "پرىسقا قوش" -02000108= "تاللىغان تۈرنى پرىسقا قوش" -02000109= "پرىس سىنا" -0200010A= "تاللىغان پرىسنىڭ مۇكەممەللىكىنى تەكشۈر" -0200010B= "مۇشۇ يەرگە يەش" -0200010C= "تاللىغان پرىستىن ھۆججەتنى نۆۋتتىكى مۇندەرىجىگە يەش" -0200010D= "{0} غا يەش‪‬" -0200010E= "تارماق قىسقۇچقا يەش" -0200010F= "{0}‬ غا قوش ‪" -02000110= "تاللىغان تۈرنى پرىسقا قوش" -02000111= "پرىس ۋە ئېلخەت…" -02000112= "تاللىغان تۈرنى پرىسقا قوشۇپ ئېلخەتتە يوللا." -02000113= "‬ غا پرىسلاپ ئېلخەتتە يوللا" -02000114= "تاللىغان تۈرنى پرىسقا قوشۇپ ئېلخەتتە يوللا" - -02000140= "<قىسقۇچ>" -02000141= "<پرىس>" - -; Properties -02000203= "يول" -02000204= "ئاتى" -02000205= "كېڭەيتىلگەن ئاتى" -02000206= "قىسقۇچ" -02000207= "چوڭلۇقى" -02000208= "بوغچا چوڭلۇقى" -02000209= "خاسلىق" -0200020A= "قۇرغان ۋاقىت" -0200020B= "زىيارەت ۋاقتى" -0200020C= "ئۆزگەرتكەن ۋاقىت" -0200020D= "پۇختا" -0200020E= "ئىزاھات" -0200020F= "شىفىرلانغان" -02000210= "ئاۋال پارچىلا" -02000211= "كېيىن پارچىلا" -02000212= "لۇغەت" -02000213= "CRC" -02000214= "تىپى" -02000215= "قارشى" -02000216= "ئۇسۇل" -02000217= "ئاساسىي مەشغۇلات سىستېمىسى" -02000218= "ھۆججەت سىستېمىسى" -02000219= "ئىشلەتكۈچى" -0200021A= "گۇرۇپپا" -0200021B= "بۆلەك" -0200021C= "ئىزاھات" -0200021D= "ئورۇن" -0200021E= "يول ئالدى قوشۇلغۇچى" -0200021F= "قىسقۇچ" -02000220= "ھۆججەت" -02000221= "نەشرى" -02000222= "ئەن" -02000223= "كۆپ ئەن" -02000224= "ئورۇن ھالقىش" -02000225= "ئۇلانما" -02000226= "بۆلەك" -02000227= "ئەنلەش" - -02000229="64-bit" -0200022A="Big-endian" -0200022B="CPU" -0200022C="فىزىكىلىق چوڭلۇقى" -0200022D="ھۆججەت باشى چوڭلۇقى" -0200022E="يىغىندا تەكشۈر" -0200022F="ئالاھىدىلىك" -02000230="مەۋھۇم ئادرېس" - -; Status bar -02000301= "{0} تۈر تاللاندى" -02000302= "{0} تۈر" - -02000320= "ھۆججەت:" -02000321= "قىسقۇچ:" -02000322= "چوڭلۇقى:" -02000323= "پرىس چوڭلۇقى:" -02000324= "پرىس:" - -; List Context Menu -02000401= "ستۇن(&C)…" - -02000411= "ئاچ(&O)" -02000412= "يەش(&E)…" - -; ToolBar -02000501= "يەش" - -; Messages -02000601= "بۇ پرىس يېڭىلاش مەشغۇلاتىنى قوللىمايدۇ" -02000602= "{0} پرىسنى يېڭىلىيالمايدۇ" -02000603= "“{0}” قىسقۇچ قۇرالمايدۇ" -02000604= "ھۆججەت پرىسنى قوللىمايدۇ" -02000605= "خاتالىق" -02000606= "تۈر بەك كۆپ" -02000607= "بېرىلگەن ھۆججەتنىڭ كېڭەيتىلگەن ئاتى ھېچقانداق قوللىنىشچان پروگراممىغا باغلانمىغان" -02000608= "خاتالىق يوق" -02000609= "'{0}' ھۆججەتنى پرىس سۈپىتىدە ئاچالمايدۇ" -0200060A= "'{0}' شىفىرلانغان پرىسنى ئاچالمايدۇ. ئىم خاتا " -0200060B="سىستېما لازىملىق ئەسلەكنى تەقسىملىيەلمەيدۇ" -0200060C="نامەلۇم خاتالىق" -0200060D="قوللىمايدىغان پرىس تېپى" - -; Dialogs -02000702= "جەزملە" -02000705= "(&Y)ھەئە" -02000707= "ھەممىسى ھەئە(&A)" -02000709= "ياق(&N)" -0200070B= "ھەممىسى ياق(&L)" - -02000710= "ۋاز كەچ" -02000711= "ۋاز كەچ(&C)" -02000713= "ياپ(&C)" -02000714= "توختا" -02000715= "قايتا باشلا" - -02000720= "ياردەم" - -; Extract dialog -02000800= "يەش" -02000801= "يېشىش ئورنى(&X):" -02000802= "ئىم" - -02000810= "يول مودېلى" -02000811= "تولۇق يول ئاتى" -02000812= "نۆۋەتتىكى يول ئاتى" -02000813= "يول ئاتى يوق" - -02000820= "قاپلاش مودېلى" -02000821= "قاپلاشتىن بۇرۇن سورا" -02000822= "ئەسكەرتمەي قاپلا" -02000823= "مەۋجۇد ھۆججەتتىن ئاتلا" -02000824= "ئۆزلۈكىدىن ئاتىنى ئۆزگەرت" -02000825= "مەۋجۇد ھۆججەت ئاتىنى ئۆزگەرت" - -02000830= "ھۆججەتلەر" -02000831= "تاللانغان ھۆججەتلەر(&S)" -02000832= "ھەممە ھۆججەت(&A)" - -02000881= "ھۆججەت يېشىدىغان جايدىن بىرنى كۆرسىتىڭ" - -02000890= "يېشىۋاتىدۇ" - -; Overwrite dialog -02000900= "ھۆججەت ئالماشتۇرۇشنى جەزملە" -02000901= "بۇ قىسقۇچ ئوخشاش ئاتلىق ھۆججەتتىن بىرنى ئۆز ئىچىگە ئالغان" -02000902= "بۇنىڭغا مەۋجۇد ھۆججەتنى " -02000903= " ئالماشتۇرامسىز؟" - -02000911= "ئۆزلۈكىدىن ئات ئۆزگەرت(&U)" - -02000982= "{0} بايت" -02000983= "ئۆزگەرتكەن" - -; Messages dialog -02000A00= "دىئاگنوز ئۇچۇرى" - -02000A80= "ئۇچۇر" - -02000A91= "{0} قوللىمايدىغان پرىسلاش مودېلى" -02000A92= "“{0}” سانلىق مەلۇمات خاتا. ھۆججەت بۇزۇلغان" -02000A93= "“{0}” ئورۇندىكى CRC تەكشۈرۈش مەغلۇپ بولدى، ھۆججەت بۇزۇلغان" -02000A94= "»{0}« شىفىرلانغان ھۆججەت سانلىق مەلۇماتىدا خاتالىق بار، ئىم خاتا." -02000A95= "“{0}” شىفىرلانغان ھۆججەت CRC سانلىق مەلۇمات دەلىللەشتە خاتالىق بار، ئىم خاتا." - -; Password dialog -02000B00= "ئىم كىرگۈزۈڭ" -02000B01= "ئىم كىرگۈزۈڭ:" -02000B02= "ئىم كۆرسەت(&S)" -02000B03= "ئىمنى قايتا كىرگۈزۈڭ " -02000B10= "ئىم ماس كەلمىدى" -02000B11= "(!、#、$...)ئىمغا ئىنگلىزچە ھەرپ، سان ۋە ئالاھىدە ھەرپ-بەلگىلەرلا ئىشلىتىلىدۇ" -02000B12= "ئىم بەك ئۇزۇن" - -; Progress dialog -02000C00= "جەريان" -02000C01= "كەتكەن ۋاقىت:" -02000C02= "قالغان ۋاقىت:" -02000C03= "ئومۇمىي چوڭلۇقى:" -02000C04= "سۈرئىتى:" -02000C05= "بىر تەرەپ قىلىندى:" -02000C06= "پرىس نىسبىتى:" - -02000C10= "ئارقا سۇپا(&B)" -02000C11= "ئالدى سۇپا(&F)" -02000C12= "ۋاقىتلىق توختا(&P)" -02000C13= "داۋاملاشتۇر(&C)" - -02000C20= "ۋاقىتلىق توختىتىلدى" - -02000C30= "راستىنلا ۋاز كېچەمسىز؟" - -; Compress dialog -02000D00= "پرىسقا قوش" -02000D01= "پرىس(&A):" -02000D02= "يېڭىلاش مودېلى(&U):" -02000D03= "پرىسلاش شەكلى(&F):" -02000D04= "پرىسلاش مودېلى(&M):" -02000D05= "مۇقىم پرىس ياسا(&S)" -02000D06= "پارامېتىر(&P):" -02000D07= "تاللانما" -02000D08= "ئۆزى يېشىلىدىغان پرىس ياسا(&X)" -02000D09= "كۆپ ئېقىملىق" -02000D0A= "شىفىرلىق ھۆججەت ئاتى(&N)" -02000D0B= "پرىسلاش دەرىجىسى(&L):" -02000D0C= "لۇغەت چوڭلۇقى(&D):" -02000D0D= "سۆز چوڭلۇقى(&W):" -02000D0E= "پرىسلاشقا كېرەكلىك ئەسلەك:" -02000D0F= "يېشىشكە كېرەكلىك ئەسلەك:" -02000D10= "شىفىرلاش" -02000D11= "شىفىرلاش ئۇسۇلى:" -02000D12= "CPU ئېقىم سانى :" -02000D13= "مۇقىم سانلىق مەلۇمات چوڭلۇقى:" -02000D14= "مۇقىمسىز" -02000D15= "مۇقىم" -02000D16= "ھەمبەھىر ھۆججەت پرىسلا" - -02000D40= "پارچە چوڭلۇقى، بايت(&V):" -02000D41= "پارچە چوڭلۇقى خاتا" -02000D42= "بايت{0} بەلگىلەنگەن پارچە چوڭلۇقى\nنۆۋەتتىكى ھۆججەتنى پارچىلامسىز؟" - -02000D81= "ساقلا" -02000D82= "نورمال" -02000D83= "ئەڭ چوڭ" -02000D84= "تېز" -02000D85= "ئەڭ تېز" -02000D86= "ئەڭ زور چەكتە" - -02000D90= "كۆز يۈگۈرت" - -02000DA1= "ھۆججەت قوش ۋە ئالماشتۇر" -02000DA2= "ھۆججەت يېڭىلا ۋە قوش" -02000DA3= "مەۋجۇد ھۆججەتنى يېڭىلا" -02000DA4= "ھۆججەت قەدەمداشلا" - -02000DB1= "ھەممە ھۆججەت" - -02000DC0= "پرىسلاۋاتىدۇ" - -; Columns dialog -02000E00= "ستون" -02000E01= "بۇ قىسقۇچتا كۆرمەكچى بولغان ستوننى تاللاڭ. يۇقىرىغا ياكى تۆۋەنگە كۇنۇپكىسى بىلەن بۇ ستونلارنىڭ تەرتىپىنى قايتا ئورۇنلاشتۇرالايسىز." -02000E02= "تاللىغان ستون" -02000E03= "تاللىغان ستون كەڭلىكى(&W)(پىكسېل)" - -02000E10= "يۇقىرىغا يۆتكە(&U)" -02000E11= "تۆۋەنگە يۆتكە(&D)" -02000E12= "كۆرسەت(&S)" -02000E13= "يوشۇر(&H)" -02000E14= "تەڭشەك" - -02000E81= "ماۋزۇ" -02000E82= "كەڭلىك" - -; Testing -02000F90= "سىناۋاتىدۇ" - - -; File Manager - -03000000= "7-Zip ھۆججەت باشقۇرغۇچ" - -; Menu -03000102= "ھۆججەت(&F)" -03000103= "تەھرىر(&E)" -03000104= "كۆرۈنۈش(&V)" -03000105= "قورال(&T)" -03000106= "ياردەم(&H)" -03000107= "يىغقۇچ(&A)" - -; File -03000210= "ئاچ(&O)" -03000211= "نۆۋەتتىكى كۆزنەكتە ئاچ(&I)" -03000212= "يېڭى كۆزنەكتە ئاچ(&U)" -03000220= "كۆرۈنۈش(&V)" -03000221= "تەھرىر(&E)" -03000230= "ئات ئۆزگەرت(&M)" -03000231= "كۆچۈرۈش ئورنى(&C)…" -03000232= "يۆتكەش ئورنى(&M)…" -03000233= "ئۆچۈر(&D)" -03000240= "خاسلىق(&R)" -03000241= "ئىزاھات(&N)" -03000242= "ھۆججەت دەلىللە" -03000250= "يېڭى قىسقۇچ" -03000251= "يېڭى ھۆججەت" -03000260= "چېكىن(&X)" -03000270= "ھۆججەت پارچىلا(&S)…" -03000271= "ھۆججەت بىرلەشتۈر(&B)…" - -; Edit -03000310= "يېنىۋال(&U)" -03000311= "قايتىلا(&R)" -03000320= "كەس(&T)" -03000321= "كۆچۈر(&C)" -03000322= "چاپلا(&P)" -03000323= "ئۆچۈر(&D)" -03000330= "ھەممىنى تاللا(&A)" -03000331= "ھەممىنى تاللىما" -03000332= "ئەكسىچە تاللا(&I)" -03000333= "تاللا…" -03000334= "ئەكسىچە تاللا…" -03000335= "ئوخشاش تۈردىكى ھۆججەتنى تاللا" -03000336= "ئوخشاش تۈردىكى ھۆججەتنى ئەكسىچە تاللا" - -; View -03000410= "چوڭ سىنبەلگە(&G)" -03000411= "كىچىك سىنبەلگە(&M)" -03000412= "تىزىملىك(&L)" -03000413= "تەپسىلىي(&D)" -03000420= "تەرتىپلەنمىگەن" -03000430= "غول قىسقۇچنى ئاچ" -03000431= "يۇقىرىغا" -03000432= "قىسقۇچ تارىخى…" -03000440= "يېڭىلا(&R)" -03000449= "تەكشىلىك كۆرۈنۈش" -03000450= "&2 يۈز" -03000451= "قورال ستونى(&T)" -03000460= "پرىس قورال ستونى" -03000461= "ئۆلچەملىك قورال ستونى" -03000462= "چوڭ كۇنۇپكا" -03000463= "كۇنۇپكا خېتىنى كۆرسەت" - -; Tools -03000510= "تاللانما(&O)…" -03000511= "ئۆلچەملىك سىناش(&B)" - -; Help -03000610= "مۇندەرىجە(&C)…" -03000620= " 7-Zip (&A)ھەققىدە " - -; Favorites -03000710= "يىغقۇچقا قوش(&A)" -03000720= "خەتكۈچ" - -; Options Dialog - -03010000= "تاللانما" - -; Plugins -03010100= "قىستۇرما دېتال" -03010101= "قىستۇرما دېتال(&P):" -03010110= "تاللانما…" - -; Edit -03010200= "تەھرىرلىگۈچ" -03010201= "تەھرىرلىگۈچ(&E):" - -; System -03010300= "سىستېما" -03010302= "7-Zip بىلەن باغلانغان ھۆججەت تىپى:" -03010310= "قىستۇرما دېتال" - -; Settings -03010400= "تەڭشەك" -03010401= "كۆرسەت“..”تۈر" -03010402= "ھەقىقىي ھۆججەت سىنبەلگىسى كۆرسەت" -03010410= "سىستېما تىزىملىكىنى كۆرسەت" -03010420= "پۈتۈن قۇر تاللا(&F)" -03010421= "سېتكا كۆرسەت(&G)" -03010430= "شەيئى تاللاش مودىلى(&A)" -03010440= "چوڭ ئەسلەك بېتى ئىشلەت(&L)" - -; Strings - -03020201= "كۆچۈر" -03020202= "يۆتكە" -03020203= "كۆچۈرۈش ئورنى:" -03020204= "يۆتكەش ئورنى:" -03020205= "كۆچۈرۈۋاتىدۇ…" -03020206= "يۆتكەۋاتىدۇ…" -03020207= "سىز ھۆججەت(قىسقۇچ)نى بۇنداق يۆتكەپ ياكى كۆچۈرەلمەيسىز" -03020208= "نۆۋەتتىكى مەشغۇلاتنى قوللىمايدۇ" -03020209= "نىشان قىسقۇچ تاللاڭ" - -03020210= "ھۆججەت ئۆچۈرۈشنى جەزملە" -03020211= "قىسقۇچ ئۆچۈرۈشنى جەزملە" -03020212= "كۆپ ھۆججەت ئۆچۈرۈشنى جەزملە" -03020213= "“{0}” راستىنلا ئۆچۈرەمسىز؟" -03020214= "“{0}” قىسقۇچ ۋە مەزمۇننى راستىنلا ئۆچۈرەمسىز؟" -03020215= "{0} تۈرنى راستىنلا ئۆچۈرەمسىز؟ " -03020216= "ئۆچۈرۈۋاتىدۇ…" -03020217= "قىسقۇچ ياكى ھۆججەت ئۆچۈرۈش خاتالىقى" -03020218="سىستېما يولى ئۇزۇن بولغان ھۆججەتنى ئەخلەتخاناغا يۆتكىيەلمەيدۇ" - -03020220= "ئاتىنى ئۆزگەرتىۋاتىدۇ…" -03020221= "ھۆججەت ياكى قىسقۇچ ئاتىنى ئۆزگەرتىش خاتالىقى" -03020222= "ھۆججەت كۆچۈرۈشنى جەزملە" -03020223= "ھۆججەتنى پرىسقا راستىنلا كۆچۈرەمسىز؟" - -03020230= " قىسقۇچ قۇر" -03020231= "قىسقۇچ ئاتى" -03020232= "يېڭى قىسقۇچ" -03020233= "قىسقۇچ قۇرۇش خاتالىقى" - -03020240= "ھۆججەت قۇر" -03020241= "ھۆججەت ئاتى" -03020242= "يېڭى ھۆججەت" -03020243= "ھۆججەت قۇرۇش خاتالىقى" - -03020250= "تاللاش" -03020251= "ئەكسىچە تاللا" -03020252= "ماسكا:" - -03020260= "قىسقۇچ تارىخى" - -03020280= "“{0}”ئۆزگەرتىلدى\nپرىس ھۆججىتىدە يېڭىلامسىز؟" -03020281= "“{0}”ھۆججەتنى يېڭىلىيالمىدى\n" -03020282= "تەھرىرلىگۈچنى قوزغىتالمىدى" -03020283= "ئېچىۋاتىدۇ…" -03020284="بۇ ھۆججەت ۋىرۇستەك تۇرىدۇ (ھۆججەت ئاتىدا كۆپ بوشلۇق بار)" - -03020290= "ئىزاھات" -03020291= "ئىزاھات(&C)" - -030202A0= "سىستېما" - -03020300= "كومپيۇتېر" -03020301= "تور قوشنا" -03020302="پۈتۈكلەر" - -03020400= "قوش" -03020401= "يەش" -03020402= "سىنا" - -03020420= "كۆچۈر" -03020421= "يۆتكە" -03020422= "ئۆچۈر" -03020423= "ئۇچۇر" - -03020500= "ھۆججەت پارچىلا" -03020501= "پارچىلاش سانى(&S):" -03020510= "پارچىلاۋاتىدۇ…" -03020520= "پارچىلاشنى جەزملە" -03020521= "ھۆججەتنى {0} پارچىغا بۆلەمسىز؟ " -03020522= "پارچە چوڭلۇقى چوقۇم ئەسلى ھۆججەتتىن كىچىك بولۇشى لازىم" - -03020600= "ھۆججەت بىرلەشتۈر" -03020601= "بىرلەشتۈرۈش(&C):" -03020610= "بىرلەشتۈرۈۋاتىدۇ…" -03020620= "بىرىنچى ھۆججەتنىلا تاللا" -03020621="بۆلەكلەنگەن ھۆججەت پارچىسى ئىكەنلىكىنى بايقىيالمىدى" -03020622="باشقا ھۆججەت پارچىسىنى بايقىيالمىدى" - -03020710= "تەكشۈرۈۋاتىدۇ…" -03020720= "تەكشۈرۈش ئۇچۇرى" -03020721= "CRC سانلىق مەلۇمات تەكشۈرۈش:" -03020722= "CRC سانلىق مەلۇمات ۋە ھۆججەت ئاتى تەكشۈرۈش:" - -03020800= "ئىزدەۋاتىدۇ…" - -03020900= "خاسلىق" - -03020A01="يولى ئۇزۇن قىسقۇچقا بۇ مەشغۇلاتنى ئېلىپ بارالمايدۇ." -03020A02="چوقۇم ھۆججەتتىن بىرنى تاللاڭ" -03020A03="چوقۇم بىر ياكى بىر قانچە ھۆججەت تاللاڭ" -03020A04=" {0} ھۆججەت مەۋجۇد" - -; Computer -03031100= "ئومۇمى سىغىمى" -03031101= "ئىشلىتىلىشچان بوشلۇق" -03031102= "توپلاشتۇرغۇچ چوڭلۇقى" -03031103= "ئەن" - -; Network -03031200= "يەرلىك ئاتى" -03031201= "تەمىنلىگۈچى" - -; Benchmark Dialog - -03080000= "ئاساسىي تەكشۈرۈش" -03080001= "ئىشلىتىلگەن ئەسلەك:" -03080002= "پرىسلاۋاتىدۇ" -03080003= "يېشىۋاتىدۇ" -03080004= "سۈرئەت" -03080005= "سۈرئىتى" -03080006= "ئوتتۇرىچە سۈرئىتى" -03080007= "نۆۋەتتە" -03080008= "نەتىجە" -03080009= "يوللاش:" -0308000A= "خاتالىق:" -0308000B= "CPU ئىشلىتىلىشى" -0308000C= "ئىشلىتىش سۈرئىتى" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/uk.txt b/tools/7-Zip/Lang/uk.txt deleted file mode 100644 index bc53fbd465..0000000000 --- a/tools/7-Zip/Lang/uk.txt +++ /dev/null @@ -1,534 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.60 beta -; Translated by Misha Padalka -; -; -; -; - -00000000="Ukrainian" -00000001="Українська" -00000002="34" - -; 7-Zip Configuration - -; Title -01000000="Налаштування 7-Zip" - -; Info Page -01000100="Про 7-Zip" -01000103="7-Zip - це вільне програмне забезпечення. Але Ви можете допомогти розробці 7-zip за допомогою реєстрації." -01000104="Підтримка" -01000105="Зареєструватися" - -; Folders Page -01000200="Теки" -01000210="&Робоча тека" -01000211="&Системна тека тимчасових файлів" -01000212="&Поточна" -01000213="&Задана:" -01000214="Використовувати тільки для змінних носіїв" - -01000281="Вкажіть розташування тимчасових архівних файлів." - -; System Page -01000300="Система" -01000301="Інтегрувати 7-Zip до контекстного меню оболонки" -01000302="Каскадне контекстне меню" -01000310="Пункти контекстного меню:" - -; Language Page -01000400="Мова" -01000401="Мова:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Команди 7-Zip" -02000103="Відкрити архів" -02000104="Відкриває вибраний архів." -02000105="Видобути файли..." -02000106="Видобуває файли з вибраного архіву." -02000107="Додати до архіву..." -02000108="Додає вибрані елементи до архіву." -02000109="Перевірити архів" -0200010A="Перевіряє цілісність вибраного архіву." -0200010B="Видобути тут" -0200010C="Видобуває файли з вибраного архіву до поточної теки." -0200010D="Видобути до {0}" -0200010E="Видобуває файли до теки." -0200010F="Додати до {0}" -02000110="Додає вибрані елементи до архіву." -02000111="Стиснути та надіслати..." -02000112="Стискає вибрані елементи та надсилає архів електронною поштою." -02000113="Стиснути до {0} та надіслати" -02000114="Стискає вибрані елементи та надсилає архів електронною поштою." - -02000140="<Тека>" -02000141="<Архів>" - -; Properties -02000203="Шлях" -02000204="Назва" -02000205="Розширення" -02000206="Тека" -02000207="Розмір" -02000208="Розмір в архіві" -02000209="Атрибути" -0200020A="Створено" -0200020B="Останній доступ" -0200020C="Змінено" -0200020D="Неперервний" -0200020E="З коментарем" -0200020F="Зашифровано" -02000210="Розбитий до" -02000211="Розбитий після" -02000212="Словник" -02000213="CRC" -02000214="Тип" -02000215="Анти" -02000216="Метод" -02000217="Операційна система" -02000218="Файлова система" -02000219="Користувач" -0200021A="Група" -0200021B="Блок" -0200021C="Коментар" -0200021D="Позиція" -0200021E="Префікс шляху" -0200021F="Тек" -02000220="Файлів" -02000221="Версія" -02000222="Частина" -02000223="З декількох частин" -02000224="Зміщення" -02000225="Посилань" -02000226="Блоків" -02000227="Частин" - -02000229="64-біт" -0200022A="Big-endian" -0200022B="Процесор" -0200022C="Фізичний розмір" -0200022D="Розмір заголовків" -0200022E="Контрольна сума" -0200022F="Властивості" -02000230="Віртуальна адреса" - -; Status bar -02000301="{0} об'єкт(ів) вибрано" -02000302="{0} об'єкт(ів)" - -02000320="Файлів:" -02000321="Тек:" -02000322="Розмір:" -02000323="Розмір після стиснення:" -02000324="Архівів:" - -; List Context Menu -02000401="&Колонки..." - -02000411="&Відкрити" -02000412="&Видобути..." - -; ToolBar -02000501="Видобути" - -; Messages -02000601="Операція оновлення не підтримується для даного архіву." -02000602="Не можу оновити архів {0}" -02000603="Не можу створити теку '{0}'" -02000604="Файл не є підтримуваним архівом." -02000605="Помилка" -02000606="Забагато елементів" -02000607="Немає програми, пов'язаної з даним розширенням" -02000608="Без помилок" -02000609="Не можу відкрити файл '{0}' як архів" -0200060A="Не можу відкрити зашифрований архів '{0}'. Хибний пароль?" -0200060B="Система не може виділити необхідний обсяг пам'яті" -0200060C="Невідома помилка" -0200060D="Непідтримуватий тип архіву" - -; Dialogs -02000702="Гаразд" -02000705="&Так" -02000707="Так для &всіх" -02000709="&Ні" -0200070B="Ні для вс&іх" - -02000710="Скасувати" -02000711="&Скасувати" -02000713="&Закрити" -02000714="Зупинити" -02000715="Перезапустити" - -02000720="Довідка" - -; Extract dialog -02000800="Видобути" -02000801="В&идобути до:" -02000802="Пароль" - -02000810="Обробка шляхів" -02000811="Повні шляхи" -02000812="Відносні шляхи" -02000813="Без шляхів" - -02000820="Режим перезапису" -02000821="Запитувати перед перезаписом" -02000822="Перезаписувати без попередження" -02000823="Пропускати існуючі файли" -02000824="Автоматично перейменовувати" -02000825="Автоматично перейменовувати існуючі файли" - -02000830="Файли" -02000831="&Вибрані файли" -02000832="&Всі файли" - -02000881="Вкажіть розміщення видобуваних файлів." - -02000890="Видобування" - -; Overwrite dialog -02000900="Підтвердіть заміну файлу" -02000901="Тека призначення вже містить оброблюваний файл." -02000902="Ви бажаєте замінити існуючий файл" -02000903="Цим?" - -02000911="А&втоматично перейменовувати" - -02000982="{0} байт" -02000983="змінений" - -; Messages dialog -02000A00="Діагностичні повідомлення" - -02000A80="Повідомлення" - -02000A91="Непідтривуваний метод стиску для '{0}'." -02000A92="Помилка даний у '{0}'. Файл пошкоджено." -02000A93="Збій контрольної суми в '{0}'. Файл пошкоджено." -02000A94="Помилка даних у зашифрованому файлі '{0}'. Хибний пароль?" -02000A95="Помилка контрольної суми у зашифрованому файлі '{0}'. Хибний пароль?" - -; Password dialog -02000B00="Введіть пароль" -02000B01="Введіть пароль:" -02000B02="&Показувати пароль" -02000B03="Повторіть пароль:" -02000B10="Паролі не співпадають" -02000B11="Для паролю використовуйте лише англійські літери, цифри та спеціальні символи (!, #, $, ...)" -02000B12="Пароль занадто довгий" - -; Progress dialog -02000C00="Процес" -02000C01="Пройшло:" -02000C02="Залишилося:" -02000C03="Розмір:" -02000C04="Швидкість:" -02000C05="Оброблено:" -02000C06="Ступінь стиску:" - -02000C10="&На задньому плані" -02000C11="&На передньому плані" -02000C12="&Пауза" -02000C13="&Продовжити" - -02000C20="Призупинено" - -02000C30="Ви впевнені, що бажаєте скасувати?" - -; Compress dialog -02000D00="Додати до архіву" -02000D01="&Архів:" -02000D02="&Режим оновлення:" -02000D03="&Формат архіву:" -02000D04="&Метод стискання:" -02000D05="Створити &неперервний архів" -02000D06="&Параметри:" -02000D07="Налаштування" -02000D08="Створити архів, що сам &видобувається" -02000D09="Багатопоточність" -02000D0A="Шифрувати &назви файлів" -02000D0B="&Ступінь стиску:" -02000D0C="&Розмір словника:" -02000D0D="&Розмір слова:" -02000D0E="Необхідно пам'яті для стискання:" -02000D0F="Необхідно пам'яті для видобування:" -02000D10="Шифрування" -02000D11="Метод шифрування:" -02000D12="Кількість потоків:" -02000D13="Розмір блоку:" -02000D14="За розміром файлу" -02000D15="Неперервний" -02000D16="Стискати відкриті на запис файли" - -02000D40="Розділити на &частини, байт:" -02000D41="Хибний розмір частини" -02000D42="Заданий розмір частини: {0} байт.\nВи впевнені, що бажаєте розбити архів на такі частини?" - -02000D81="Без стиску" -02000D82="Нормальна" -02000D83="Максимальна" -02000D84="Швидка" -02000D85="Найшвидша" -02000D86="Ультра" - -02000D90="Переглянути" - -02000DA1="Додати та замінити файли" -02000DA2="Оновити та замінити файли" -02000DA3="Оновити існуючі файли" -02000DA4="Синхронізувати файли" - -02000DB1="Всі файли" - -02000DC0="Стискання" - -; Columns dialog -02000E00="Колонки" -02000E01="Позначте колонки, які ви бажаєте показувати в даній теці. Використовуйте кнопки \"Змістити вгору\" та \"Змістити вниз\" для зміни порядку колонок." -02000E02="Вибрана колонка має бути &шириною" -02000E03="пікселів." - -02000E10="Змістити &вгору" -02000E11="Змістити &вниз" -02000E12="&Показати" -02000E13="П&риховати" -02000E14="Встановити" - -02000E81="Заголовок" -02000E82="Ширина" - -; Testing -02000F90="Тестування" - - -; File Manager - -03000000="Менеджер файлів 7-Zip" - -; Menu -03000102="&Файл" -03000103="&Редагування" -03000104="&Вигляд" -03000105="&Інструменти" -03000106="&Допомога" -03000107="&Улюблене" - -; File -03000210="&Відкрити" -03000211="Відкрити в&середині" -03000212="Відкрити &зовні" -03000220="&Переглянути" -03000221="&Редагувати" -03000230="Змінити &назву" -03000231="&Копіювати до..." -03000232="&Перемістити до..." -03000233="Ви&далити" -03000240="В&ластивості" -03000241="Комет&ар" -03000242="Обчислити контрольну суму" -03000250="Створити теку" -03000251="Створити файл" -03000260="Ви&хід" -03000270="&Розбити файл..." -03000271="Ск&ласти файли..." - -; Edit -03000310="&Скасувати" -03000311="&Повернути" -03000320="Ви&різати" -03000321="&Копіювати" -03000322="&Вставити" -03000323="Ви&далити" -03000330="Вибрати &всі" -03000331="Зняти вибір" -03000332="&Інвертувати вибір" -03000333="Вибрати..." -03000334="Зняти вибір..." -03000335="Вибрати за типом" -03000336="Зняти вибір за типом" - -; View -03000410="Вели&кі значки" -03000411="&Маленькі значки" -03000412="&Список" -03000413="&Таблиця" -03000420="Без сортування" -03000430="Відкрити кореневу теку" -03000431="Вгору на один рівень" -03000432="Історія тек..." -03000440="&Оновити" -03000449="Плоский вигляд" -03000450="&2 панелі" -03000451="&Панелі інструментів" -03000460="Панель архіву" -03000461="Стандартна панель" -03000462="Великі кнопки" -03000463="Текст на кнопках" - -; Tools -03000510="&Налаштування..." -03000511="&Тестування швидкості" - -; Help -03000610="&Зміст..." -03000620="&Про 7-Zip..." - -; Favorites -03000710="&Додати теку до улюблених як" -03000720="Закладка" - -; Options Dialog - -03010000="Options" - -; Plugins -03010100="Модулі" -03010101="&Модулі:" -03010110="Параметри..." - -; Edit -03010200="Редактор" -03010201="&Редактор:" - -; System -03010300="Система" -03010302="Пов'язати 7-Zip з:" -03010310="Модуль" - -; Settings -03010400="Налаштування" -03010401="Показувати елемент \"..\"" -03010402="Показувати системні значки" -03010410="Показувати системне меню" -03010420="&Вибір цілого рядка" -03010421="Показувати &сітку" -03010430="&Альтернативний режим виділення" -03010440="Використовувати в&еликі сторінки пам'яті" - -; Strings - -03020201="Копіювати" -03020202="Перемістити" -03020203="Копіювати до:" -03020204="Перемістити до:" -03020205="Копіювання..." -03020206="Переміщення..." -03020207="Ви не можете переміщувати чи копіювати елементи для таких тек." -03020208="Операція не підтримується." -03020209="Вкажіть теку призначення." - -03020210="Підтвердіть видалення файлу" -03020211="Підтвердіть видалення теки" -03020212="Підтвердіть видалення декількох файлів" -03020213="Ви впевнені, що бажаєте видалити '{0}'?" -03020214="Ви впевнені, що бажаєте видалити теку '{0}' і весь її вміст?" -03020215="Ви впевнені, що бажаєте видалити ці {0} елементів?" -03020216="Видалення..." -03020217="Помилка при видалення файлу чи теки" -03020218="Система не може пересунути файл з довгим шляхом у Кошик" - -03020220="Зміна назви..." -03020221="Помилка при зміні назви файлу чи теки" -03020222="Підтвердіть копіювання файлу" -03020223="Ви впевнені, що хочете скопіювати файли в архів" - -03020230="Створити теку" -03020231="Назва теки:" -03020232="Нова тека" -03020233="Помилка при створенні теки" - -03020240="Створити файл" -03020241="Назва файлу:" -03020242="Новий файл" -03020243="Помилка при створенні файлу" - -03020250="Вибрати" -03020251="Зняти вибір" -03020252="Маска:" - -03020260="Історія тек" - -03020280="Файл '{0}' було змінено.\nВи бажаєте оновити його в архіві?" -03020281="Не можу оновити файл\n'{0}'" -03020282="Не можу запустити редактор." -03020283="Відкриття..." -03020284="Файл схожий на вірус (назва містить довгі пропуски)." - -03020290="Коментар" -03020291="&Коментар:" - -030202A0="Системне" - -03020300="Комп'ютер" -03020301="Мережа" -03020302="Документи" - -03020400="Додати" -03020401="Витягнути" -03020402="Тестувати" - -03020420="Копіювати" -03020421="Перемістити" -03020422="Видалити" -03020423="Інформація" - -03020500="Розбити файл" -03020501="&Розбити до:" -03020510="Розбиття..." -03020520="Підтвердіть розбиття" -03020521="Ви впевнені, що бажаєте розбити архів на {0} частин?" -03020522="Розмір частини має бути меншим за розмір вихідного файлу" - -03020600="Склеїти файли" -03020601="&Склеїти до:" -03020610="Склеювання..." -03020620="Виберіть тільки перший файл" -03020621="Файл не схожий на частину розбитого файлу" -03020622="Не можу знайти більше однієї частини розбитого файлу" - -03020710="Обчислення контрольної суми..." -03020720="Інформація про контрольну суму" -03020721="Контрольна сума для даних:" -03020722="Контрольна сума для даних та назв:" - -03020800="Сканування..." - -03020900="Властивості" - -03020A01="Дія не може бути виконана в теці з довгим шляхом." -03020A02="Виберіть один файл" -03020A03="Виберіть один або більше файлів" -03020A04="Файл {0} вже існує" - -; Computer -03031100="Загальний розмір" -03031101="Вільний простір" -03031102="Розмір кластеру" -03031103="Мітка" - -; Network -03031200="Локальна назва" -03031201="Джерело" - -; Benchmark Dialog - -03080000="Тестування швидкості" -03080001="Використання пам'яті:" -03080002="Стискання" -03080003="Витягування" -03080004="Швидкість" -03080005="Рейтинг" -03080006="Загальний рейтинг" -03080007="Поточний" -03080008="Результат" -03080009="Проходів:" -0308000A="Помилок:" -0308000B="Завантаження процесора" -0308000C="Рейтинг / Завантаження" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/uz.txt b/tools/7-Zip/Lang/uz.txt deleted file mode 100644 index d9b7523a19..0000000000 --- a/tools/7-Zip/Lang/uz.txt +++ /dev/null @@ -1,459 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.30 -; Translated by Sherzod Mamatkulov -; -; -; -; - -00000000="Uzbek" -00000001="O'zbek" -00000002="67" - -; 7-Zip Configuration - -; Title -01000000="7-Zip tanlovlari" - -; Info Page -01000100="7-Zip haqida" -01000103="7-Zip bepul dasturiy ta'minot. Binobarin, siz uni qayd qildirish orqali qo'llab-quvvatlashingiz mumkin." -01000104="Yordam" -01000105="Qayd qilish" - -; Folders Page -01000200="Papkalar" -01000210="&Ish papkasi" -01000211="Tizim &vaqtinchalik papkasi" -01000212="&Joriy papka" -01000213="&Tayinlangan:" -01000214="Faqat olinadigan drayvlar uchun ishlat" - -01000281="Vaqtinchalik arxiv fayllari uchun manzilni tayinlang." - -; System Page -01000300="Tizim" -01000301="7-Zipni qobiq kontekst menyusiga qo'sh" -01000302="Kontekst menyusi pog'onali" -01000310="Kontekst menyu bandlari:" - -; Language Page -01000400="Til" -01000401="Til:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip buyruqlari" -02000103="Arxivni och" -02000104="Tanlangan arxivni ochadi." -02000105="Fayllarni ajrat..." -02000106="Tanlangan arxivdan fayllarni ajratadi." -02000107="Arxivga qo'sh..." -02000108="Tanlangan qismlarni arxivga qo'shadi." -02000109="Arxivni sina" -0200010A="Tanlangan arxivning butunligini tekshiradi." -0200010B="Shu joyga ajrat" -0200010C="Tanlangan arxivdagi fayllarni joriy papkaga ajratadi." -0200010D="{0}ga ajrat" -0200010E="Fayllarni nimpapkaga ajratadi." -0200010F="{0}ga qo'sh" -02000110="Tanlangan qismlarni arxivga qo'shadi." -02000111="Siq va emailda jo'nat..." -02000112="Tanlangan qismlarni arxivga siqib, email orqali jo'natadi." -02000113="{0}ga siq va emailda jo'nat" -02000114="Tanlangan qismlarni arxivga siqib, email orqali jo'natadi." - -02000140="" -02000141="" - -; Properties -02000203="Yo'lak" -02000204="Nomi" -02000205="Kengaytma" -02000206="Papka" -02000207="Hajmi" -02000208="Siqilgan hajmi" -02000209="Atributlari" -0200020A="Yaratilgan" -0200020B="Ochilgan" -0200020C="O'zgartirilgan" -0200020D="Yaxlit" -0200020E="Sharhlangan" -0200020F="Tilsimlangan" -02000210="Bundan oldin bo'laklangan" -02000211="Bundan keyin bo'laklangan" -02000212="Lug'at" -02000213="CRC" -02000214="Turi" -02000215="Anti" -02000216="Uslub" -02000217="Mezbon OS" -02000218="Fayl tizimi" -02000219="Foydalanuvchi" -0200021A="Guruh" -0200021B="Block" -0200021C="Sharh" -0200021D="Joylashuv" - -; Status bar -02000301="{0} ta qism tanlangan" -02000302="{0} ta qism" - -; List Context Menu -02000401="&Ustunlar..." - -02000411="&Ochish" -02000412="&Ajrat..." - -; ToolBar -02000501="Ajrat" - -; Messages -02000601="Bu arxivga nisbatan yangilash amallari bajarilmaydi." -02000602="{0} arxivini yagilay olmadim" -02000603="'{0}' papkasini yarata olmadim" -02000604="Ushbu fayl tushunarli arxiv emas." -02000605="Xato" -02000606="Qismlar o'ta ko'p" -02000607="Berilgan fayl nomi kengaytmasi bilan hechqanday dastur biriktirilmagan" -02000608="Hechqanday xato yo'q" - -; Dialogs -02000702="OK" -02000705="&Ha" -02000707="H&ammasiga ha" -02000709="&Yo'q" -0200070B="Hammasiga y&o'q" - -02000710="Bekor" -02000711="&Bekor" -02000713="&Yopish" -02000714="To'xta" -02000715="Qayta boshla" - -02000720="Yordam" - -; Extract dialog -02000800="Ajratish" -02000801="&Buyerga ajrat:" -02000802="Parol" - -02000810="Yo'lak uslubi" -02000811="To'liq yo'lak nomlari" -02000812="Joriy yo'lak nomlari" -02000813="Yo'lak nomi yo'q" - -02000820="Ustidan yozish uslubi" -02000821="Yozib yuborishdan oldin so'ra" -02000822="So'ramasdan yozib yubor" -02000823="Oldindan mavjud fayllarni tashlab ket" -02000824="Avtomatik tarzda qayta nomla" -02000825="Mavjud fayllarni avto qayta nomla" - -02000830="Fayllar" -02000831="&Tanlangan fayllar" -02000832="&Barcha fayllar" - -02000881="Ajratilgan fayllar uchun manzil tayinlang." - -02000890="Ajratilmoqda" - -; Overwrite dialog -02000900="Fayl ustidan yozishni tasdiqlash" -02000901="Manziliy papkada ishlangan fayl oldindan mavjud." -02000902="Mavjud faylni" -02000903="bunisi bilan almashtirasizmi?" - -02000911="A&vtomatik tarzda qayta nomla" - -02000982="{0} bayt" -02000983="o'zgargan sanasi" - -; Messages dialog -02000A00="Diagnostik xabarlar" - -02000A80="Xabar" - -02000A91="'{0}'dagi siquv metodi notanish." -02000A92="'{0}'da data xatosi yuz berdi. Fayl zararlangan." -02000A93="'{0}'da CRC amalga oshmadi. Fayl zararlangan." - -; Password dialog -02000B00="Parolni kiritish" -02000B01="Parolni kiriting:" -02000B02="&Parolni ko'rsat" - -; Progress dialog -02000C00="Jarayon" -02000C01="O'tgan vaqt:" -02000C02="Qolgan vaqt:" -02000C03="Hajm:" -02000C04="Tezlik:" - -02000C10="&Orqa fon" -02000C11="Ol&di fon" -02000C12="&Pauza" -02000C13="&Davom et" - -02000C20="Pauza qilingan" - -02000C30="Rostdan ham bekor qilishni istaysizmi?" - -; Compress dialog -02000D00="Arxivga qo'shish" -02000D01="&Arxiv:" -02000D02="&Yangilash uslubi:" -02000D03="Arxiv &formati:" -02000D04="&Siquv metodi:" -02000D05="&Yaxlit arxiv yarat" -02000D06="&Parametrlar:" -02000D07="Tanlovlar" -02000D08="SF&X arxiv yarat" -02000D09="Ko'p-bo'limda" -02000D0A="Fayl &nomlarini tilsimla" -02000D0B="Siq&uv bosqichi:" -02000D0C="&Lug'at hajmi:" -02000D0D="So'z haj&mi:" -02000D0E="Siquvda ishlatiladigan xotira:" -02000D0F="Ajratuvda ishlatiladigan xotira:" - -02000D40="&Tomlarga bo'lakla, bayt:" - -02000D81="Saqlash" -02000D82="O'rtacha" -02000D83="Eng zo'r" -02000D84="Tez" -02000D85="Eng tez" -02000D86="Ultra" - -02000D90="Belgila" - -02000DA1="Fayllarni qo'sh va almashtir" -02000DA2="Fayllarni yangila va qo'sh" -02000DA3="Mavjud fayllarni yangila" -02000DA4="Fayllarni sinxronla" - -02000DB1="Barcha fayllar" - -02000DC0="Siquv ketmoqda" - -; Columns dialog -02000E00="Ustunlar" -02000E01="Ushbu papkada ko'rinadigan ustunlarni belgilang. Ustunlarni tartibini o'zgartirish uchun Yuqoriga va Pastga tugmalaridan foydalaning." -02000E02="Tanlangan ustun kengligi" -02000E03="pi&xel bo'lsin." - -02000E10="&Yuqoriga" -02000E11="&Pastga" -02000E12="&Ko'rsat" -02000E13="Y&ashir" -02000E14="Tayinla" - -02000E81="Sarlavha" -02000E82="Kengligi" - -; Testing -02000F90="sinaldi" - - -; File Manager - -03000000="7-Zip fayl boshqaruvchisi" - -; Menu -03000102="&Fayl" -03000103="&Tahrir" -03000104="&Ko'rish" -03000105="&Asboblar" -03000106="&Yordam" -03000107="Fa&voritlar" - -; File -03000210="&Ochish" -03000211="&Ichkarida ochish" -03000212="&Tashqarida ochish" -03000220="&Ko'rish" -03000221="Ta&hrirla" -03000230="&Qayta nomla" -03000231="Buyerga &nusxala..." -03000232="B&uyerga ko'chir..." -03000233="O'chir" -03000240="&Xossalari" -03000241="&Sharh" -03000250="Papka yarat" -03000251="Fayl yarat" -03000260="&Chiqish" -03000270="&Faylni bo'lakla..." -03000271="Fayllarni &birlashtir..." - -; Edit -03000310="&Qaytar" -03000311="Qayta &bajar" -03000320="Q&irqish" -03000321="&Nusxala" -03000322="Qo'yis&h" -03000323="&O'chir" -03000330="H&ammasini tanla" -03000331="Hammasini tashla" -03000332="&Tanlanishni teskarila" -03000333="Tanlash..." -03000334="Tashlash..." -03000335="Turi bo'yicha tanla" -03000336="Turi bo'yicha tashla" - -; View -03000410="&Yirik ikonlar" -03000411="&Mitti ikonlar" -03000412="&Ro'yxat" -03000413="&Tafsilotlar" -03000420="Saralanmagan" -03000430="Ildiz papkasini och" -03000431="Bir bosqich yuqoriga" -03000432="Papkalar tarixi..." -03000440="&Qayta och" -03000450="&2 ta panel" -03000451="&Uskunalar majmuasi" -03000460="Arxiv toolbari" -03000461="Standart toolbar" -03000462="Yirik tugmalar" -03000463="Tugmalar matnini ko'rsat" - -; Tools -03000510="Tanl&ovlar..." -03000511="&Baholash" - -; Help -03000610="&Tarkibi..." -03000620="&7-Zip haqida..." - -; Favorites -03000710="&Papkani ushbu xatcho'p qo'sh" -03000720="Xatcho'p" - -; Options Dialog - -03010000="Tanlovlar" - -; Plugins -03010100="Plaginlar" -03010101="&Plaginlar:" -03010110="Tanlovlar..." - -; Edit -03010200="Muharrir" -03010201="&Muharrir:" - -; System -03010300="Tizim" -03010302="Ushbu arxivlarni 7-Zip bilan biriktir:" -03010310="Plagin" - -; Settings -03010400="Sharoit" -03010401="\"..\" qismini ko'rsat" -03010402="Fayllarning haqiqiy ikonlarini ko'rsat" -03010410="Tizim menyusini ko'rsat" -03010420="&To'liq yo'lakni tanlash" -03010421="&Panjara chiziqlarini ko'rsat" -03010430="&Muqobil tanlash uslubini qo'lla" -03010440="&Yirik xotira pageini ishlat" - -; Strings - -03020201="Nusxalash" -03020202="Ko'chirish" -03020203="Ushbu katalogga nusxala:" -03020204="Ushbu katalogga ko'chir:" -03020205="Nusxalanmoqda..." -03020206="Ko'chirilmoqda..." -03020207="Bunaqangi papkalar uchun qismlarni ko'chirish yoki nusxalashning iloji yo'q." -03020208="Ushbu operatsiya qo'llanmaydi." - -03020210="Faylni o'chirishni tasdiqlang" -03020211="Papkani o'chirishni tasdiqlang" -03020212="Ko'plab fayllarni o'chirishni tasdiqlang" -03020213="Rostdan ham '{0}'ni o'chirib tashlamoqchimisiz?" -03020214="Rostdan ham '{0}' papkasini butun tarkibi bilan o'chirib tashlamoqchimisiz?" -03020215="Rostdan ham ushbu {0} ta qismni o'chirib tashlamoqchimisiz?" -03020216="O'chirilmoqda..." -03020217="Fayl yoki papkani o'chirishda xato yuz berdi" - -03020220="Qayta nomlanmoqda..." -03020221="Fayl yoki papkani qayta nomlashda xato yuz berdi" -03020222="Faylni nusxalashni tasdiqlang" -03020223="Rostdan ham fayllarni arxivga nusxalashni xohlaysizmi" - -03020230="Papka yaratish" -03020231="Papka nomi:" -03020232="Yangi papka" -03020233="Papka yaratishda xato yuz berdi" - -03020240="Fayl yaratish" -03020241="Fayl nomi:" -03020242="Yangi fayl" -03020243="Fayl yaratishda xatolik yuz berdi" - -03020250="Tanlash" -03020251="Tashlash" -03020252="Maska:" - -03020260="Papkalar tarixi" - -03020280="'{0}' fayli o'zgartirildi.\nUni arxiv ichida yangilashni xohlaysizmi?" -03020281="Ushbu faylni yangilay olmadim\n'{0}'" -03020282="Muharrirni ocha olmadim." -03020283="Ochilmoqda..." - -03020290="sharhi" -03020291="&Sharh:" - -030202A0="Tizim" - -03020300="Kompyuter" -03020301="Tarmoq" - -03020400="Qo'sh" -03020401="Ajrat" -03020402="Sina" - -03020420="Nusxala" -03020421="Ko'chir" -03020422="O'chir" -03020423="Info" - -03020500="Faylni bo'laklash" -03020501="&Ushbu katalogga bo'lakla:" -03020510="Bo'laklanmoqda..." - -03020600="Fayllarni birlashtirish" -03020601="&Ushbu katalogga birlashtir:" -03020610="Birlashtirilmoqda..." - -; Computer -03031100="Umumiy hajmi" -03031101="Bo'sh joy" -03031102="Klaster hajmi" -03031103="Yorliq" - -; Network -03031200="Lokal nomi" -03031201="Provayder" - -; Benchmark Dialog - -03080000="Baholash" -03080001="Xotira ishlatilishi:" -03080002="Siqish" -03080003="Ajratish" -03080004="Tezlik" -03080005="Reyting" -03080006="Umumiy reyting" -03080007="Joriy" -03080008="Natijaviy" -03080009="O'tganlar:" -0308000A="Xatolar:" - -;!@LangEnd@! \ No newline at end of file diff --git a/tools/7-Zip/Lang/va.txt b/tools/7-Zip/Lang/va.txt deleted file mode 100644 index 5ec96db0ba..0000000000 --- a/tools/7-Zip/Lang/va.txt +++ /dev/null @@ -1,493 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.44 -; Translated by Fernando Verdú -; -; -; -; - -00000000="Valencian" -00000001="Valencià" -00000002="" - -; 7-Zip Configuration - -; Title -01000000="Configuració del 7-Zip" - -; Info Page -01000100="Sobre 7-Zip" -01000103="7-Zip és un programa lliure (GNU LGPL). Pot col·laborar en el desenvolupament del 7-zip registrant-lo, com a usuari registrat podrà rebre suport tècnic." -01000104="Suport" -01000105="Registrar" - -; Folders Page -01000200="Directoris" -01000210="Directori de &treball" -01000211="Directori temporal del &sistema" -01000212="Directori a&ctual" -01000213="E&specificar directori:" -01000214="Utilitzar només per a discs extraibles" - -01000281="Especificar un directori per als arxius temporals." - -; System Page -01000300="Sistema" -01000301="Integrar 7-Zip dins el menu contextual de Windows" -01000302="Menu contextual en cascada" -01000310="Objectes del menu contextual:" - -; Language Page -01000400="Idioma" -01000401="Idioma:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Comandaments 7-Zip" -02000103="Obrir arxiu" -02000104="Obri l'arxiu seleccionat." -02000105="Extraure fitxers..." -02000106="Extraure els fitxers de l'arxiu seleccionat." -02000107="Afegir a l'arxiu..." -02000108="Afegir els objectes seleccionats a l'arxiu." -02000109="Comprovar arxiu" -0200010A="Comprova la integritat del fitxer seleccionat." -0200010B="Extraure ací" -0200010C="Extrau els fitxers de l'arxiu triat al directori actual." -0200010D="Extraure a {0}" -0200010E="Extrau fitxers al subdirectori." -0200010F="Afegir a {0}" -02000110="Afegix els fitxers triats a l'arxiu." -02000111="Comprimir i enviar per correu electrònic..." -02000112="Comprimir els objectes triats a l'arxiu i enviar l'arxiu per correu electrònic." -02000113="Comprimir a {0} i enviar per correu electrònic" -02000114="Comprimir els objectes triats a l'arxiu i enviar l'arxiu per correu electrònic.." - -02000140="" -02000141="" - -; Properties -02000203="Adreça" -02000204="Nom" -02000205="Tipus d'arxiu" -02000206="Directori" -02000207="Tamany" -02000208="Tamany comprimit" -02000209="Atributs" -0200020A="Creat" -0200020B="ültim accés" -0200020C="Última modificació" -0200020D="Compacte" -0200020E="Comentari" -0200020F="Xifrat" -02000210="Expandit abans" -02000211="Expandit després" -02000212="Diccionari" -02000213="CRC" -02000214="Tipus" -02000215="Anti" -02000216="Mètode" -02000217="SO d'origen" -02000218="Sistema de fitxers" -02000219="Usuari" -0200021A="Grup" -0200021B="Bloc" -0200021C="Comentari" -0200021D="Posició" -0200021E="Prefix de ruta" - -; Status bar -02000301="{0} objecte(s) seleccionat(s)" -02000302="{0} objecte(s)" - -02000320="Fitxers:" -02000321="Directoris:" -02000322="Mida:" - -; List Context Menu -02000401="&Columnes..." - -02000411="&Obrir" -02000412="&Extraure..." - -; ToolBar -02000501="Extraure" - -; Messages -02000601="Les operacions d'actualització d'este arxiu no estan suportades." -02000602="No es pot actualitzar l'arxiu {0}" -02000603="No es pot crear el directori '{0}'" -02000604="Tipus d'arxiu desconegut." -02000605="Error" -02000606="Massa objectes" -02000607="No hi ha cap programa associat amb este tipus de fitxer" -02000608="No hi ha errors" -02000609="No es pot obrir el fitxer '{0}' com arxiu" -0200060A="No es pot obrir l'arxiu xifrat '{0}'. contrasenya incorrecta?" - -; Dialogs -02000702="Acceptar" -02000705="&Si" -02000707="Si a &tot" -02000709="&No" -0200070B="No a t&ot" - -02000710="Cancel·lar" -02000711="&Cancel·lar" -02000713="Tan&car" -02000714="Parar" -02000715="Reiniciar" - -02000720="Ajuda" - -; Extract dialog -02000800="Extraure" -02000801="E&xtraure a:" -02000802="Contrasenya" - -02000810="Mode d'adreça" -02000811="Adreça sencera" -02000812="Adreça actual" -02000813="Sense adreça" - -02000820="Sobreescriu" -02000821="Pregunta abans de sobreescriure" -02000822="Sobreescriu sense confirmació" -02000823="Conserva arxius ja existents" -02000824="Reanomena automàticament" -02000825="Reanomena automàticament arxius ja existents" - -02000830="Fitxers" -02000831="Fitxers &seleccionats" -02000832="Tots els fitxers" - -02000881="Seleccione destinació per als fitxers extrets." - -02000890="Extraent" - -; Overwrite dialog -02000900="Confirmar substitució de fitxers" -02000901="El directori de destinació conté un fitxer amb el mateix nom." -02000902="Vol substituir el fitxer existent" -02000903="per este altre?" - -02000911="Renomenar a&utomàticament" - -02000982="{0} bytes" -02000983="modificat el" - -; Messages dialog -02000A00="Missatges de diagnosi" - -02000A80="Missatge" - -02000A91="Mètode de compressió no vàlid per a '{0}'." -02000A92="Error de dades en '{0}'. L'arxiu està corrupte." -02000A93="CRC ha fallat en '{0}'. L'arxiu està corrupte." -02000A94="Errors de dades en l'arxiu xifrat '{0}'. Contrasenya incorrecta?" -02000A95="CRC incorrecte en l'arxiu xifrat '{0}'. Contrasenya incorrecta?" - -; Password dialog -02000B00="Introduir contrasenya" -02000B01="Introduir contrasenya:" -02000B02="Mo&strar contrasenya" -02000B03="Reintroduir contrasenya:" -02000B10="Les contrasenyes no coincideixen" -02000B11="Useu només lletres de l'alfabet anglès, números i caràcters especials (!, #, $, ...) per a la contrasenya" -02000B12="Contrasenya massa llarga" - -; Progress dialog -02000C00="Procés" -02000C01="Temps transcorregut:" -02000C02="Temps restant:" -02000C03="Mida:" -02000C04="Velocitat:" - -02000C10="Segon pla" -02000C11="Primer pla" -02000C12="&Pausa" -02000C13="&Continuar" - -02000C20="Parat" - -02000C30="Està segur que vol cancel·lar?" - -; Compress dialog -02000D00="Afegir a l'arxiu" -02000D01="&Arxiu:" -02000D02="Mode d'act&ualització:" -02000D03="&Format de l'arxiu:" -02000D04="Tipus de co&mpressió:" -02000D05="Crear arxiu compacte" -02000D06="&Paràmetres:" -02000D07="Opcions" -02000D08="Crear arxiu SF&X" -02000D09="Multi-threading" -02000D0A="Encriptar el nom dels fitxers" -02000D0B="&Nivell de compressió:" -02000D0C="Tamany &diccionari:" -02000D0D="Tamany ¶ula:" -02000D0E="Us de memòria Comprimint:" -02000D0F="Us de memòria Descomprimint:" -02000D10="Xifrat" -02000D11="Métode de xifrat:" - -02000D40="Separar en &volums, bytes:" -02000D41="Mida incorrecta de volum" -02000D42="Mida del volum especificada: {0} bytes.\nEsteu segurs que voleu dividir l'arxiu en volums?" - -02000D81="Sense compressió" -02000D82="Normal" -02000D83="Màxima" -02000D84="Ràpida" -02000D85="La més ràpida" -02000D86="Ultra" - -02000D90="Visualitzar" - -02000DA1="Afegir i substituir fitxers" -02000DA2="Actualitzar i afegir fitxers" -02000DA3="Actualitzar fitxers existents" -02000DA4="Sincronitzar fitxers" - -02000DB1="Tots els fitxers" - -02000DC0="Comprimint" - -; Columns dialog -02000E00="Columnes" -02000E01="Seleccione les columnes que vol que siguen visibles en este mode. Faça servir les tecles AvPg i RePg per a organitzar les columnes." -02000E02="La columna triada ha de tindre" -02000E03="píxels d'amplària." - -02000E10="Moure cap am&unt" -02000E11="Moure cap avall" -02000E12="Mo&strar" -02000E13="Amagar" -02000E14="Fixar" - -02000E81="Títol" -02000E82="Ample" - -; Testing -02000F90="Provant" - - -; File Manager - -03000000="Gestor d'Arxius 7-Zip" - -; Menu -03000102="&Arxiu" -03000103="&Editar" -03000104="&Visualitzar" -03000105="Ferramentes" -03000106="Ajuda" -03000107="Favorits" - -; File -03000210="&Obrir" -03000211="Obrir d&ins" -03000212="Obrir fora" -03000220="&Visualitzar" -03000221="&Editar" -03000230="Renom&enar" -03000231="&Copiar a..." -03000232="&Moure a..." -03000233="&Suprimir" -03000240="P&ropietats" -03000241="Come&ntari" -03000242="Calcular checksum" -03000250="Crear directori" -03000251="Crear fitxer" -03000260="Eixir" -03000270="&Separar fitxer..." -03000271="Com&binar fitxers..." - -; Edit -03000310="&Desfer" -03000311="&Refer" -03000320="Re&tallar" -03000321="&Copiar" -03000322="&Pegar" -03000323="&Suprimir" -03000330="Seleccion&ar-ho tot" -03000331="Deseleccionar-ho tot" -03000332="&Invertir selecció" -03000333="Seleccionar..." -03000334="No seleccionar..." -03000335="Seleccionar per tipus" -03000336="No seleccionar per tipus" - -; View -03000410="Icones g&rans" -03000411="Icones menudes" -03000412="&Llista" -03000413="&Detalls" -03000420="No ordenat" -03000430="Obrir directori arrel" -03000431="Directori pare" -03000432="Historial de carpetes..." -03000440="Actualitza&r" -03000449="Vista plana" -03000450="&2 Taules" -03000451="&Barres de ferramentes" -03000460="Arxiu" -03000461="Estàndard" -03000462="Botons grans" -03000463="Mostrar text dels botons" - -; Tools -03000510="&Opcions..." -03000511="&Banc de proves" - -; Help -03000610="&Contingut..." -03000620="Sobre 7-Zip..." - -; Favorites -03000710="&Afegir el directori als Favorits com a" -03000720="Personal" - -; Options Dialog - -03010000="Opcions" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Opcions..." - -; Edit -03010200="Editor" -03010201="&Editor:" - -; System -03010300="Sistema" -03010302="Associar 7-Zip amb:" -03010310="Plugin" - -; Settings -03010400="Ajusts" -03010401="Mostrar l'objecte \"..\"" -03010402="Mostrar icones reals dels fitxers" -03010410="Mostrar el menú del sistema" -03010420="Seleccionar &tota la la fila" -03010421="Mostrar &línies de la taula" -03010430="Mode de selecció &alternatiu" -03010440="Utilitzar pàgines de memòria &grans" - -; Strings - -03020201="Copiar" -03020202="Moure" -03020203="Copiar a:" -03020204="Moure a:" -03020205="Copiant..." -03020206="Movent..." -03020207="No es poden moure o copiar elements d'este tipus de carpetes." -03020208="Operació no permesa." -03020209="Seleccioneu carpeta de destinació." - -03020210="Confirmar supressió del fitxer" -03020211="Confirmar supressió del directori" -03020212="Confirmar supressió m�ltiple de fitxers" -03020213="Està segur de voler suprimir '{0}'?" -03020214="Està segur de voler suprimir la carpeta '{0}' i tot el seu contingut?" -03020215="Està segur de voler esborrar estos {0} elements?" -03020216="Suprimint..." -03020217="Error esborrant fitxer o carpeta" - -03020220="Renomenant..." -03020221="Error renomenant fitxer o carpeta" -03020222="Confirmar copia de fitxer" -03020223="Està segur que vol copiar els fitxers a l'arxiu" - -03020230="Crear carpeta" -03020231="Nom de carpeta:" -03020232="Carpeta nova" -03020233="Error creant carpeta" - -03020240="Crear fitxer" -03020241="Nom de fitxer:" -03020242="Fitxer nou" -03020243="Error creant el fitxer" - -03020250="Seleccionar" -03020251="No seleccionar" -03020252="Màscara:" - -03020260="Historial de directoris" - -03020280="El fitxer '{0}' ha sigut modificat.\nVol actualitzar-lo a l'arxiu?" -03020281="No es pot actualitzar el fitxer\n'{0}'" -03020282="No es pot executar l'editor." -03020283="Obrint..." - -03020290="Comentari" -03020291="&Comentari:" - -030202A0="Sistema" - -03020300="El meu ordinador" -03020301="Entorn de xarxa" - -03020400="Afegir" -03020401="Extraure" -03020402="Provar" - -03020420="Copiar" -03020421="Moure" -03020422="Esborrar" -03020423="Info" - -03020500="Separar fitxer" -03020501="&Separar a:" -03020510="Separant..." -03020520="Confirma divissió" -03020521="Esteu segurs que voleu dividir el fitxer en {0} volums?" -03020522="La mida del volum ha de ser menor que la mida original del fitxer" - -03020600="Combinar fitxers" -03020601="&Combinar a:" -03020610="Combinant..." -03020620="Seleccioneu només el primer fitxer" - -03020710="Calculant checksum..." -03020720="Informació checksum" -03020721="CRC checksum per a les dades:" -03020722="CRC checksum per a dades i noms:" - -03020800="Escanejant..." - -; Computer -03031100="Tamany total" -03031101="Espai lliure" -03031102="Tamany sector" -03031103="Etiqueta" - -; Network -03031200="Nom local" -03031201="Proveïdor" - -; Benchmark Dialog - -03080000="Banc de proves" -03080001="Us de memoria:" -03080002="Comprimint" -03080003="Descomprimint" -03080004="Velocitat" -03080005="Taxa" -03080006="Taxa total" -03080007="Actual" -03080008="Resultant" -03080009="Passades:" -0308000A="Errors:" - -;!@LangEnd@! - - - diff --git a/tools/7-Zip/Lang/vi.txt b/tools/7-Zip/Lang/vi.txt deleted file mode 100644 index 43925838a2..0000000000 --- a/tools/7-Zip/Lang/vi.txt +++ /dev/null @@ -1,497 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 4.48 beta -; Translated by Nguyễn Hồng Quân -; -; -; -; - -00000000="Vietnamese" -00000001="Tiếng Việt" -00000002="42" - -; 7-Zip Configuration - -; Title -01000000="Cấu hình 7-Zip" - -; Info Page -01000100="Giới thiệu 7-Zip" -01000103="7-Zip là một phần mềm miễn phí. Tuy nhiên, bạn vui lòng ủng hộ nhóm phát triển 7-Zip bằng cách đăng ký." -01000104="Ủng hộ" -01000105="Đăng ký" - -; Folders Page -01000200="Thư mục" -01000210="&Thư mục làm việc" -01000211="&Thư mục tạm của hệ thống" -01000212="&Hiện hành" -01000213="&Đặc biệt:" -01000214="Chỉ sử dụng cho ổ đĩa tháo lắp" - -01000281="Chỉ định nơi chứa tập tin lưu tạm." - -; System Page -01000300="Hệ thống" -01000301="Tích hợp 7-Zip vào menu ngữ cảnh" -01000302="Xếp tầng menu ngữ cảnh" -01000310="Menu ngữ cảnh:" - -; Language Page -01000400="Ngôn ngữ" -01000401="Ngôn ngữ:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="Các lệnh của 7-Zip" -02000103="Mở tập tin đã nén" -02000104="Mở tập tin đã nén." -02000105="Giải nén tập tin..." -02000106="Giải nén từ tập tin nén đã chọn." -02000107="Thêm vào tập tin nén..." -02000108="Thêm những tập tin đã chọn vào tập tin nén." -02000109="Kiểm tra tập tin nén" -0200010A="Kiểm tra tính toàn vẹn của tập tin đã nén." -0200010B="Giải nén tại đây" -0200010C="Giải nén vào thư mục hiện hành." -0200010D="Giải nén vào {0}" -0200010E="Giải nén vào thư mục con." -0200010F="Thêm vào {0}" -02000110="Thêm những tập tin đã chọn vào tập tin nén." -02000111="Nén và gởi email..." -02000112="Nén những tập tin đã chọn thành tập tin nén rồi gởi email." -02000113="Nén thành {0} rồi gởi email" -02000114="Nén những tập tin đã chọn vào tập tin nén rồi gởi email." - -02000140="" -02000141="" - -; Properties -02000203="Đường dẫn" -02000204="Tên" -02000205="Phần mở rộng" -02000206="Thư mục" -02000207="Trước khi nén" -02000208="Sau khi nén" -02000209="Thuộc tính" -0200020A="Thời điểm tạo thành" -0200020B="Thời điểm truy xuất" -0200020C="Thời điểm sửa đổi" -0200020D="Đặc" -0200020E="Ghi chú" -0200020F="Đã được mã hoá" -02000210="Chia nhỏ trước" -02000211="Chia nhỏ sau" -02000212="Từ điển" -02000213="CRC" -02000214="Loại" -02000215="Anti" -02000216="Phương pháp" -02000217="Host OS" -02000218="Hệ thống tập tin" -02000219="Người dùng" -0200021A="Nhóm" -0200021B="Đóng khối" -0200021C="Chú thích" -0200021D="Vị trí" -0200021E="Đầu ngữ đường dẫn" - -; Status bar -02000301="{0} đối tượng đã được chọn" -02000302="{0} đối tượng" - -02000320="Tập tin:" -02000321="Thư mục:" -02000322="Kích cỡ:" - -; List Context Menu -02000401="&Cột..." - -02000411="&Mở" -02000412="&Giải nén..." - -; ToolBar -02000501="Giải nén" - -; Messages -02000601="Thao tác cập nhật không được hỗ trợ cho tập tin này." -02000602="Không thể cập nhật tập tin {0}" -02000603="Không thể tạo thư mục '{0}'" -02000604="Dạng tập tin này không được hỗ trợ." -02000605="Lỗi" -02000606="Quá nhiều mục" -02000607="Không có ứng dụng tương ứng với phần mở rộng của tập tin này" -02000608="Không xuất hiện lỗi" -02000609="Không thể mở '{0}' như là tập tin nén" -0200060A="Không thể mở tập tin nén bị mã hóa '{0}'. Mật khẩu sai?" - -; Dialogs -02000702="Đồng ý" -02000705="&Có" -02000707="Có &tất" -02000709="&Không" -0200070B="Khôn&g tất" - -02000710="Huỷ bỏ" -02000711="&Huỷ bỏ" -02000713="&Đóng" -02000714="Dừng" -02000715="Làm lại" - -02000720="Giúp đỡ" - -; Extract dialog -02000800="Giải nén" -02000801="&Giải nén vào:" -02000802="Mật mã" - -02000810="Chế độ đường dẫn" -02000811="Đường dẫn đầy đủ" -02000812="Đường dẫn hiện thời" -02000813="Không có đường dẫn" - -02000820="Chế độ ghi đè" -02000821="Hỏi trước khi ghi đè" -02000822="Ghi đè không cần hỏi" -02000823="Bỏ qua tập tin đã có" -02000824="Tự động đổi tên" -02000825="Tự động đổi tên tập tin đã có" - -02000830="Tập tin" -02000831="Tập tin đã &chọn" -02000832="&Tất cả tập tin" - -02000881="Chọn nơi để giải nén tập tin." - -02000890="Đang giải nén" - -; Overwrite dialog -02000900="Xác nhận thay thế tập tin" -02000901="Thư mục đích đã có tập tin cần xử lý." -02000902="Bạn có muốn thay thế tập tin đã có" -02000903="bằng tập tin mới?" - -02000911="&Tự đổi tên" - -02000982="{0} bytes" -02000983="chỉnh sửa ngày" - -; Messages dialog -02000A00="Thông điệp chẩn đoán" - -02000A80="Thông điệp" - -02000A91="Phương pháp nén không được hỗ trợ cho '{0}'." -02000A92="Lỗi về dữ liệu trong '{0}'. Tập tin đã bị hỏng." -02000A93="Lỗi chẵn/lẻ (CRC) trong '{0}'. Tập tin đã bị hỏng." -02000A94="Lỗi dữ liệu trong tập tin nén bị mã hóa '{0}'. Mật khẩu sai?" -02000A95="CRC không thành trong tập tin nén bị mã hóa '{0}'. Mật khẩu sai?" - -; Password dialog -02000B00="Nhập mật khẩu" -02000B01="Nhập mật khẩu:" -02000B02="&Hiển thị mật khẩu" -02000B03="Nhập lại mật khẩu:" -02000B10="Các mật khẩu không khớp nhau" -02000B11="Chỉ dùng những chữ cái tiếng Anh, số và những kí tự đặc biệt (!, #, $, ...) cho mật khẩu" -02000B12="Mật khẩu quá dài đi" - -; Progress dialog -02000C00="Xử lý" -02000C01="Thời gian đã qua:" -02000C02="Thời gian còn lại:" -02000C03="Kích thước:" -02000C04="Tốc độ:" - -02000C10="&Chạy nền" -02000C11="&Chạy ưu tiên" -02000C12="&Dừng" -02000C13="&Tiếp tục" - -02000C20="Đã dừng" - -02000C30="Bạn có muốn chấm dứt?" - -; Compress dialog -02000D00="Thêm vào tập tin nén" -02000D01="&Tập tin nén:" -02000D02="&Chế độ cập nhật:" -02000D03="&Dạng tập tin nén:" -02000D04="&Phương thức nén:" -02000D05="Chỉ tạo thành &một tập tin nén" -02000D06="Tham &số:" -02000D07="Tuỳ chọn" -02000D08="Tạo tập tin &tự giải nén" -02000D09="Đa luồng" -02000D0A="Mã hoá &tên tập tin" -02000D0B="&Cấp độ nén:" -02000D0C="&Kích thước thư mục:" -02000D0D="&Kích thước từ:" -02000D0E="Bộ nhớ sử dụng cho việc nén:" -02000D0F="Bộ nhớ sử dụng cho việc giải nén:" -02000D10="Mã hóa" -02000D11="Phương pháp mã hóa:" -02000D12="Số luồng xử lý CPU:" -02000D13="Kích cỡ khối đặc:" -02000D14="Không đặc" -02000D15="Đặc" -02000D16="Nén những tập tin chia sẻ" - -02000D40="Chia thành &nhiều phần, bytes:" -02000D41="Kích cỡ phần chia chưa đúng" -02000D42="Kích cỡ phần chia đã định là: {0} bytes.\nĐúng là bạn muốn chia nhỏ tập tin nén thành những phần như thế?" - -02000D81="Lưu trữ" -02000D82="Thường" -02000D83="Tối đa" -02000D84="Nhanh" -02000D85="Nhanh nhất" -02000D86="Siêu nhanh" - -02000D90="Tìm chọn" - -02000DA1="Thêm và thay thế tập tin" -02000DA2="Cập nhật và thêm tập tin" -02000DA3="Cập nhật tập tin đã có" -02000DA4="Đồng bộ tập tin" - -02000DB1="Tất cả tập tin" - -02000DC0="Đang nén, chờ tí" - -; Columns dialog -02000E00="Cột" -02000E01="Đánh dấu chọn các cột mà bạn muốn xuất hiện trong thư mục này. Dùng các nút LÊN/XUỐNG để thay đổi thứ tự các cột." -02000E02="Cột đã chọn nên có" -02000E03="độ &rộng theo điểm ảnh." - -02000E10="Chuyển &Lên" -02000E11="Chuyển &Xuống" -02000E12="&Hiển thị" -02000E13="&Ẩn" -02000E14="Đặt" - -02000E81="Tiêu đề" -02000E82="Độ rộng" - -; Testing -02000F90="Kiểm tra" - - -; File Manager - -03000000="Chương trình quản lý tập tin 7-Zip" - -; Menu -03000102="&Tập tin" -03000103="&Biên tập" -03000104="&Xem" -03000105="&Công cụ" -03000106="&Giúp đỡ" -03000107="Ư&a thích" - -; File -03000210="&Mở" -03000211="Mở &tại đây" -03000212="Mở trong cửa sổ &khác" -03000220="&Xem" -03000221="&Biên tập" -03000230="Đổ&i tên" -03000231="&Sao chép đến..." -03000232="&Di chuyển đến..." -03000233="&Xoá" -03000240="Th&uộc tính" -03000241="C&hú thích" -03000242="Tính checksum" -03000250="Tạo thư mục" -03000251="Tạo tập tin" -03000260="Th&oát" -03000270="&Cắt tập tin..." -03000271="&Nối tập tin..." - -; Edit -03000310="Như &cũ" -03000311="Làm &lại" -03000320="&Cắt" -03000321="&Sao chép" -03000322="&Dán" -03000323="&Xoá" -03000330="Chọn &tất cả" -03000331="Bỏ chọn tất cả" -03000332="Chọn &ngược lại" -03000333="Chọn..." -03000334="Bỏ chọn..." -03000335="Chọn theo loại" -03000336="Bỏ chọn theo loại" - -; View -03000410="Biểu tượng &lớn" -03000411="Biểu tượng &nhỏ" -03000412="&Danh sách" -03000413="&Chi tiết" -03000420="Không sắp xếp" -03000430="Mở thư mục gốc" -03000431="Lên một cấp" -03000432="Lịch sử thư mục..." -03000440="&Rà soát lại" -03000450="&2 bảng" -03000449="Xem dàn trải" -03000451="&Thanh công cụ" -03000460="Thanh công cụ nén" -03000461="Thanh công cụ chuẩn" -03000462="Sử dụng nút lớn" -03000463="Hiển thị chữ trên nút" - -; Tools -03000510="&Tuỳ chọn..." -03000511="Đo tốc độ" - -; Help -03000610="&Nội dung..." -03000620="&Giới thiệu 7-Zip..." - -; Favorites -03000710="&Thêm thư mục vào 'Ưa thích' như là" -03000720="Đánh dấu" - -; Options Dialog - -03010000="Các tùy chọn" - -; Plugins -03010100="Plugins" -03010101="&Plugins:" -03010110="Tuỳ chọn..." - -; Edit -03010200="Biên tập" -03010201="&Biên tập:" - -; System -03010300="Hệ thống" -03010302="Liên kết 7-Zip với:" -03010310="Plugin" - -; Settings -03010400="Sắp đặt" -03010401="Hiển thị \"..\"" -03010402="Hiển thị biểu tượng thực của tập tin" -03010410="Hiển thị menu hệ thống" -03010420="Chọn cả &dòng" -03010421="Hiển thị &lưới" -03010430="Chế độ chọn luân &phiên" -03010440="Sử dụng bộ &nhớ lớn" - -; Strings - -03020201="Sao chép" -03020202="Di chuyển" -03020203="Sao chép đến:" -03020204="Di chuyển đến:" -03020205="Đang sao chép..." -03020206="Đang di chuyển..." -03020207="Bạn không thể di chuyển hoặc sao chép vào thư mục đó." -03020208="Thao tác không được hỗ trợ." -03020209="Chọn thư mục đến." - -03020210="Xác nhận xoá tập tin" -03020211="Xác nhận xoá thư mục" -03020212="Xác nhận xoá nhiều tập tin" -03020213="Bạn có chắc là bạn có muốn xoá '{0}'?" -03020214="Bạn có chắc là bạn muốn xoá thư mục '{0}' và tất cả tập tin trong nó?" -03020215="Bạn có chắc là bạn muốn xoá {0} ?" -03020216="Đang xoá..." -03020217="Lỗi khi đang xoá tập tin hoặc thư mục" - -03020220="Đang đổi tên..." -03020221="Lỗi khi đổi tên tập tin hoặc thư mục" -03020222="Xác nhận sao chép tập tin" -03020223="Bạn chắc chắn muốn sao chép vào tập tin nén chứ" - -03020230="Tạo thư mục" -03020231="Tên thư mục:" -03020232="Thư mục mới" -03020233="Lỗi khi tạo thư mục" - -03020240="Tạo tập tin" -03020241="Tên tập tin:" -03020242="Tập tin mới" -03020243="Lỗi khi tạo tập tin" - -03020250="Chọn" -03020251="Bỏ chọn" -03020252="Mặt nạ:" - -03020260="Lịch sử thư mục" - -03020280="Tập tin '{0}' đã bị thay đổi.\nBạn có muốn cập nhật vào tập tin nén?" -03020281="Không thể cập nhật tập tin\n'{0}'" -03020282="Không thể khởi động trình biên tập." -03020283="Đang mở..." - -03020290="Chú thích" -03020291="&Chú thích:" - -030202A0="Hệ thống" - -03020300="Máy tính" -03020301="Mạng" - -03020400="Thêm" -03020401="Giải nén" -03020402="Kiểm tra" - -03020420="Sao chép" -03020421="Di chuyển" -03020422="Xoá" -03020423="Thông tin" - -03020500="Chia nhỏ tập tin" -03020501="&Chia nhỏ thành:" -03020510="Đang chia nhỏ..." -03020520="Xác nhận việc chia nhỏ" -03020521="Bạn có chắc là muốn chia nhỏ tập tin nén thành {0} phần?" -03020522="Kích cỡ phần chia phải nhỏ hơn tập tin gốc à nha!" - -03020600="Nối tập tin" -03020601="&Nối thành:" -03020610="Đang nối..." -03020620="Chỉ chọn tập tin đầu thôi" - -03020710="Đang tính checksum..." -03020720="Thông tin checksum" -03020721="CRC checksum cho dữ liệu:" -03020722="CRC checksum cho dữ liệu và tên:" - -03020800="Đang quét..." - -; Computer -03031100="Tổng kích thước" -03031101="Kích thước trống" -03031102="Kích thước cluster" -03031103="Nhãn" - -; Network -03031200="Tên cục bộ" -03031201="Nhà cung cấp" - -; Benchmark Dialog - -03080000="Đo tốc độ" -03080001="Bộ nhớ sử dụng:" -03080002="Nén" -03080003="Giải nén" -03080004="Tốc độ" -03080005="Đánh giá" -03080006="Tổng đánh giá" -03080007="Hiện thời" -03080008="Kết quả" -03080009="Đã qua:" -0308000A="Lỗi:" -0308000B="Mức dùng CPU" -0308000C="Tốc độ / Mức dùng" - -;!@LangEnd@! diff --git a/tools/7-Zip/Lang/zh-cn.txt b/tools/7-Zip/Lang/zh-cn.txt deleted file mode 100644 index 5abd493aa9..0000000000 --- a/tools/7-Zip/Lang/zh-cn.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.08 -; translated by Sparanoid -; http://7z.sparanoid.com/ -; last updated: 2009-12-07 -; revision: 2119 -; - -00000000="Chinese Simplified" -00000001="简体中文" -00000002="4-2" - -; 7-Zip Configuration - -; Title -01000000="7-Zip 配置" - -; Info Page -01000100="关于 7-Zip" -01000103="7-Zip 是一款免费软件。您可以通过捐赠的方式来支持 7-Zip 的开发。" -01000104="技术支持" -01000105="注册" - -; Folders Page -01000200="文件夹" -01000210="工作文件夹(&W)" -01000211="系统临时文件夹(&S)" -01000212="当前文件夹(&C)" -01000213="指定位置(&S)" -01000214="仅用于可移动设备" - -01000281="指定一个存放临时压缩包的位置。" - -; System Page -01000300="系统" -01000301="添加 7-Zip 到右键菜单" -01000302="层叠右键菜单" -01000310="选择在右键菜单中显示的项目" - -; Language Page -01000400="语言" -01000401="选择语言:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip 指令" -02000103="打开压缩包" -02000104="打开选定的压缩包" -02000105="提取文件..." -02000106="从选定的压缩文件中提取文件" -02000107="添加到压缩包..." -02000108="添加选定项目到压缩包" -02000109="测试压缩包" -0200010A="完整测试已选中的档案" -0200010B="提取到当前目录" -0200010C="从选定的压缩包中提取文件到当前目录。" -0200010D="提取到 {0}" -0200010E="提取文件到子文件夹" -0200010F="添加到 {0}" -02000110="添加选定项目到压缩包" -02000111="压缩并邮寄..." -02000112="将选定的项目添加到压缩包并使用电子邮件发送。" -02000113="压缩 {0} 并邮寄" -02000114="将选定的项目添加到压缩包并使用电子邮件发送。" - -02000140="<文件夹>" -02000141="<档案>" - -; Properties -02000203="路径" -02000204="名称" -02000205="扩展名" -02000206="文件夹" -02000207="大小" -02000208="压缩后大小" -02000209="属性" -0200020A="创建时间" -0200020B="访问时间" -0200020C="修改时间" -0200020D="固实" -0200020E="注释" -0200020F="加密" -02000210="之前分割" -02000211="之后分割" -02000212="字典大小" -02000213="CRC" -02000214="类型" -02000215="剔除项" -02000216="算法" -02000217="主操作系统" -02000218="文件系统" -02000219="用户" -0200021A="组" -0200021B="字块" -0200021C="注释" -0200021D="定位" -0200021E="路径前缀" -0200021F="文件夹" -02000220="文件" -02000221="版本" -02000222="卷" -02000223="多卷压缩" -02000224="偏移" -02000225="链接" -02000226="字块" -02000227="分卷" - -02000229="64 位" -0200022A="大字节序" -0200022B="CPU" -0200022C="物理大小" -0200022D="文件头大小" -0200022E="校验和" -0200022F="特征" -02000230="虚拟地址" -02000231="ID" -02000232="短文件名" -02000233="创建程序" -02000234="扇区大小" -02000235="模式" -02000236="链接" - -; Status bar -02000301="选定 {0} 个项目" -02000302="{0} 个项目" - -02000320="文件:" -02000321="文件夹:" -02000322="大小:" -02000323="处理后大小:" -02000324="压缩包:" - -; List Context Menu -02000401="栏目(&C)..." - -02000411="打开(&O)" -02000412="提取(&E)..." - -; ToolBar -02000501="提取" - -; Messages -02000601="不支持此压缩包的更新操作。" -02000602="无法更新压缩包 {0}" -02000603="无法创建文件夹“{0}”" -02000604="文件不支持压缩包。" -02000605="错误" -02000606="项目太多" -02000607="没有应用程序和下面给出的文件扩展名相关联。" -02000608="未发现错误" -02000609="无法作为压缩包打开文件“{0}”" -0200060A="无法打开加密压缩包“{0}”。密码错误?" -0200060B="系统无法分配所需内存" -0200060C="未知错误" -0200060D="不支持的压缩包格式" - -; Dialogs -02000702="确定" -02000705="是(&Y)" -02000707="全是(&A)" -02000709="否(&N)" -0200070B="全否(&L)" - -02000710="取消" -02000711="取消(&C)" -02000713="关闭(&C)" -02000714="停止" -02000715="重新开始" - -02000720="帮助" - -; Extract dialog -02000800="提取" -02000801="提取到(&X):" -02000802="密码" - -02000810="路径模式" -02000811="完整路径" -02000812="当前路径" -02000813="无路径" - -02000820="覆盖模式" -02000821="在覆盖前询问" -02000822="不提示自动覆盖" -02000823="跳过已经存在的文件" -02000824="自动重命名" -02000825="重命名现有文件" - -02000830="文件" -02000831="选定的文件(&S)" -02000832="全部文件(&A)" - -02000881="指定一个提取文件的位置。" - -02000890="正在提取" - -; Overwrite dialog -02000900="确认文件替换" -02000901="此文件夹已包含一个相同名称的文件。" -02000902="是否将现有文件" -02000903="替换为" - -02000911="自动重新命名(&U)" - -02000982="{0} 字节" -02000983="修改于" - -; Messages dialog -02000A00="诊断信息" - -02000A80="信息" - -02000A91="不支持的压缩算法“{0}”。" -02000A92="数据“{0}”发生错误,文件已损坏。" -02000A93="CRC 校验“{0}”失败,文件已损坏。" -02000A94="加密文件“{0}”数据有误,密码错误?" -02000A95="加密文件“{0}”CRC 数据效验有误,密码错误?" - -; Password dialog -02000B00="输入密码" -02000B01="输入密码:" -02000B02="显示密码(&S)" -02000B03="重新输入:" -02000B10="密码不匹配" -02000B11="密码只允许英文字符,数字,以及特殊字符 (!、#、$...)" -02000B12="密码过长" - -; Progress dialog -02000C00="进程" -02000C01="已用时间:" -02000C02="剩余时间:" -02000C03="总大小:" -02000C04="速度:" -02000C05="已处理:" -02000C06="压缩率:" - -02000C10="后台(&B)" -02000C11="前台(&F)" -02000C12="暂停(&P)" -02000C13="继续(&C)" - -02000C20="已暂停" - -02000C30="您真的要取消吗?" - -; Compress dialog -02000D00="添加到压缩包" -02000D01="压缩包(&A):" -02000D02="更新方式(&U):" -02000D03="压缩格式(&F):" -02000D04="压缩方法(&M):" -02000D05="创建固实压缩包(&S)" -02000D06="参数(&P):" -02000D07="选项" -02000D08="创建自释放程序(&X)" -02000D09="多线程支持(Pentium 4 HT 或多处理器)" -02000D0A="加密文件名(&N)" -02000D0B="压缩等级(&L):" -02000D0C="字典大小(&D):" -02000D0D="单词大小(&W):" -02000D0E="压缩所需内存:" -02000D0F="解压缩所需内存:" -02000D10="加密" -02000D11="加密算法:" -02000D12="CPU 线程数:" -02000D13="固实数据大小:" -02000D14="非固实" -02000D15="固实" -02000D16="压缩共享文件" - -02000D40="分卷大小,字节(&V):" -02000D41="分卷大小错误" -02000D42="指定分卷大小:{0} 字节。\n您确定要分割当前文件吗?" - -02000D81="仅存储" -02000D82="标准压缩" -02000D83="最大压缩" -02000D84="快速压缩" -02000D85="极速压缩" -02000D86="极限压缩" - -02000D90="浏览" - -02000DA1="添加并替换文件" -02000DA2="更新并添加文件" -02000DA3="只刷新已存在的文件" -02000DA4="同步压缩包内容" - -02000DB1="所有文件" - -02000DC0="压缩" - -; Columns dialog -02000E00="栏目" -02000E01="选中您愿意在这个文件夹中可见的栏目。使用上移或者下移按钮来重新安排该栏目的顺序。" -02000E02="选定栏目将会被" -02000E03="所选栏的宽度(像素)(&W)" - -02000E10="上移(&U)" -02000E11="下移(&D)" -02000E12="显示(&S)" -02000E13="隐藏(&H)" -02000E14="设置" - -02000E81="标题" -02000E82="宽度" - -; Testing -02000F90="测试" - - -; File Manager - -03000000="7-Zip 文件管理器" - -; Menu -03000102="文件(&F)" -03000103="编辑(&E)" -03000104="查看(&V)" -03000105="工具(&T)" -03000106="帮助(&H)" -03000107="收藏(&A)" - -; File -03000210="打开(&O)" -03000211="当前窗口打开(&I)" -03000212="新建窗口打开(&U)" -03000220="视图(&V)" -03000221="编辑(&E)" -03000230="重命名(&M)" -03000231="复制到(&C)..." -03000232="移动到(&M)..." -03000233="删除(&D)" -03000240="属性(&R)" -03000241="注释(&N)" -03000242="文件效验" -03000243="文件比较" -03000250="新建文件夹" -03000251="新建文件" -03000260="退出(&X)" -03000270="分割文件(&S)..." -03000271="合并文件(&B)..." - -; Edit -03000310="撤消(&U)" -03000311="重做(&R)" -03000320="剪切(&T)" -03000321="复制(&C)" -03000322="粘贴(&P)" -03000323="删除(&D)" -03000330="全选(&A)" -03000331="全部取消" -03000332="反选(&I)" -03000333="选择..." -03000334="取消选择..." -03000335="选择相同类型的文件" -03000336="取消选择相同类型的文件" - -; View -03000410="大图标(&G)" -03000411="小图标(&M)" -03000412="列表(&L)" -03000413="详细信息(&D)" -03000420="不排序" -03000430="打开根文件夹" -03000431="向上" -03000432="文件夹历史..." -03000440="刷新(&R)" -03000449="平板模式" -03000450="双版面(&2)" -03000451="工具栏(&T)" -03000460="档案工具栏" -03000461="标准工具栏" -03000462="大按钮" -03000463="显示按钮文字" - -; Tools -03000510="选项(&O)" -03000511="基准测试(&B)" - -; Help -03000610="查看帮助(&C)" -03000620="关于 7-Zip (&A)" - -; Favorites -03000710="添加到收藏夹(&A)" -03000720="书签" - -; Options Dialog - -03010000="选项" - -; Plugins -03010100="插件" -03010101="插件(&P):" -03010110="插件选项..." - -; Edit -03010200="编辑器" -03010201="指定编辑器(&E):" -03010202="指定文件比较程序(&D):" - -; System -03010300="系统" -03010302="使用 7-Zip 关联的文件类型:" -03010310="插件" - -; Settings -03010400="显示" -03010401="显示“..”项 (双击向上)" -03010402="显示真实图标" -03010410="显示系统菜单" -03010420="整行选择(&F)" -03010421="显示网格线(&G)" -03010422="单击打开项目" -03010430="7-Zip 传统选择模式(&A)" -03010440="使用大内存页(&L)" - -; Strings - -03020201="复制" -03020202="移动" -03020203="复制到:" -03020204="移动到:" -03020205="正在复制..." -03020206="正在移动..." -03020207="你不能这样移动或复制文件(夹)。" -03020208="不支持当前操作" -03020209="选择目标文件夹。" - -03020210="确认文件删除" -03020211="确认文件夹删除" -03020212="确认删除多个文件" -03020213="确实要删除 “{0}”吗?" -03020214="确实要删除文件夹“{0}”以及全部内容吗?" -03020215="确实要删除这 {0} 项?" -03020216="正在删除..." -03020217="无法删除文件或文件夹." -03020218="系统无法将过长路径的文件移动到回收站" - -03020220="正在重新命名..." -03020221="无法重命名文件或文件夹。" -03020222="确认文件复制" -03020223="您确定复制文件到压缩包" - -03020230="新建文件夹" -03020231="文件夹名称:" -03020232="新建文件夹" -03020233="无法创建文件夹" - -03020240="新建文件" -03020241="文件名:" -03020242="新建文件.txt" -03020243="无法新建文件" - -03020250="选择" -03020251="取消选定" -03020252="掩码:" - -03020260="文件夹历史" - -03020280="文件“{0}”已修改。\n你想在压缩文件中更新它?" -03020281="无法更新文件\n“{0}”,有可能该压缩包是固实的。" -03020282="无法运行外部编辑。" -03020283="正在打开..." -03020284="此文件似乎是病毒文件(文件名中包含多个空格)。" - -03020290="注释" -03020291="注释(&C):" - -030202A0="系统" - -03020300="我的电脑" -03020301="网上邻居" -03020302="我的文档" - -03020400=" 添加 " -03020401=" 提取 " -03020402=" 测试 " - -03020420=" 复制 " -03020421=" 移动 " -03020422=" 删除 " -03020423=" 信息 " - -03020500="分割文件" -03020501="分割文件到(&S):" -03020510="正在分割..." -03020520="确认分割" -03020521="您确认要将文件分割为 {0} 个分卷?" -03020522="分卷大小必须小于原文件大小" - -03020600="合并文件" -03020601="合并文件到(&S):" -03020610="正在合并..." -03020620="请选择分卷的首个文件" -03020621="无法识别文件为压缩分卷" -03020622="无法找到其他压缩分卷" - -03020710="正在效验..." -03020720="效验信息" -03020721="CRC 数据效验:" -03020722="CRC 数据及文件名效验:" - -03020800="正在搜索..." - -03020900="属性" - -03020A01="无法为过长的路径完成该操作。" -03020A02="您必须选择一个文件" -03020A03="您至少要选择一个文件" -03020A04="文件 {0} 已存在" - -; Computer -03031100="总大小" -03031101="可用空间" -03031102="簇大小" -03031103="卷标" - -; Network -03031200="本地名称" -03031201="供应者" - -; Benchmark Dialog - -03080000="基准测试" -03080001="内存使用:" -03080002="压缩" -03080003="解压缩" -03080004="速度" -03080005="评分" -03080006="总体评分" -03080007="当前" -03080008="结果" -03080009="已通过:" -0308000A="发生错误:" -0308000B="CPU 使用率" -0308000C="使用率评分" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/Lang/zh-tw.txt b/tools/7-Zip/Lang/zh-tw.txt deleted file mode 100644 index 05a9ff3cbe..0000000000 --- a/tools/7-Zip/Lang/zh-tw.txt +++ /dev/null @@ -1,545 +0,0 @@ -;!@Lang@!UTF-8! -; 7-Zip 9.07 -; Translated by Jack Pang at Developer's Home -; http://www.developershome.com/7-zip/ -; -; 7-Zip 4.59 -; Translated by Leon Tseng, sec2, 琥珀 - -00000000="Chinese Traditional" -00000001="繁體中文" -00000002="4-1" - -; 7-Zip Configuration - -; Title -01000000="7-Zip 組態設定" - -; Info Page -01000100="關於 7-Zip" -01000103="7-Zip 為自由軟體。不過,您可以藉由註冊來支援 7-Zip 的開發。" -01000104="支援" -01000105="註冊" - -; Folders Page -01000200="資料夾" -01000210="工作資料夾(&W)" -01000211="系統暫存資料夾(&S)" -01000212="目前的資料夾(&C)" -01000213="指定的資料夾(&S):" -01000214="僅用於卸除式磁碟機" - -01000281="請指定存放暫存壓縮檔的位置。" - -; System Page -01000300="系統" -01000301="將 7-Zip 整合到快顯功能表中" -01000302="串聯式快顯功能表" -01000310="快顯功能表項目:" - -; Language Page -01000400="語言" -01000401="介面語言:" - - -; 7-Zip Explorer extension - -; Context menu -02000101="7-Zip" -02000102="7-Zip 指令" -02000103="開啟壓縮檔" -02000104="開啟選取的壓縮檔。" -02000105="解壓縮檔案..." -02000106="從選取的壓縮檔中解壓縮檔案。" -02000107="加入壓縮檔..." -02000108="將選取的項目加入壓縮檔中。" -02000109="測試壓縮檔" -0200010A="測試選取壓縮檔的完整性。" -0200010B="解壓縮至此" -0200010C="從選取的壓縮檔解壓縮檔案至目前的資料夾中。" -0200010D="解壓縮至 {0}" -0200010E="將檔案解壓縮到子資料夾。" -0200010F="加入 {0}" -02000110="將選取的項目加入壓縮檔中。" -02000111="壓縮並郵寄..." -02000112="將選取的項目壓縮為壓縮檔並經由電子郵件傳送此壓縮檔。" -02000113="壓縮成 {0} 並郵寄" -02000114="將選取的項目壓縮為壓縮檔並經由電子郵件傳送此壓縮檔。" - -02000140="<資料夾>" -02000141="<壓縮檔>" - -; Properties -02000203="路徑" -02000204="名稱" -02000205="副檔名" -02000206="資料夾" -02000207="大小" -02000208="封裝後大小" -02000209="屬性" -0200020A="建立日期" -0200020B="存取日期" -0200020C="修改日期" -0200020D="緊密" -0200020E="註解" -0200020F="加密" -02000210="分割前" -02000211="分割後" -02000212="字典大小" -02000213="CRC" -02000214="類型" -02000215="防護" -02000216="方式" -02000217="主機作業系統" -02000218="檔案系統" -02000219="使用者" -0200021A="群組" -0200021B="區塊" -0200021C="註解" -0200021D="位置" -0200021E="路徑前綴" -0200021F="資料夾" -02000220="檔案" -02000221="版本" -02000222="卷" -02000223="多卷" -02000224="偏移" -02000225="連結" -02000226="區塊" -02000227="分卷" - -02000229="64 位" -0200022A="大端序" -0200022B="CPU" -0200022C="物理大小" -0200022D="文件頭大小" -0200022E="驗證值" -0200022F="特徵" -02000230="虛擬地址" -02000231="ID" -02000232="簡短名稱" -02000233="創建程式" -02000234="扇區大小" -02000235="模式" -02000236="鏈接" - -; Status bar -02000301="已選取 {0} 個物件" -02000302="{0} 個物件" - -02000320="檔案:" -02000321="資料夾:" -02000322="大小:" -02000323="壓縮大小:" -02000324="壓縮檔:" - -; List Context Menu -02000401="欄位(&C)..." - -02000411="開啟(&O)" -02000412="解壓縮(&E)..." - -; ToolBar -02000501="解壓縮" - -; Messages -02000601="此壓縮檔未支援更新操作。" -02000602="無法更新壓縮檔 {0}" -02000603="無法建立資料夾 '{0}'" -02000604="非支援的壓縮檔。" -02000605="錯誤" -02000606="項目過多" -02000607="沒有任何應用程式與特定的檔案副檔名有所關聯。" -02000608="沒有任何錯誤" -02000609="無法開啟壓縮檔 '{0}'" -0200060A="無法開啟加密的壓縮檔 '{0}'。錯誤的密碼?" -0200060B="系統未能提供所需記憶體空間" -0200060C="未知的錯誤" -0200060D="不支援的壓縮檔類型" - -; Dialogs -02000702="確定" -02000705="是(&Y)" -02000707="全部皆是(&A)" -02000709="否(&N)" -0200070B="全部皆否(&L)" - -02000710="取消" -02000711="取消(&C)" -02000713="關閉(&C)" -02000714="停止" -02000715="重新開始" - -02000720="說明" - -; Extract dialog -02000800="解壓縮" -02000801="解壓縮至(&X):" -02000802="密碼" - -02000810="路徑模式" -02000811="完整的路徑名稱" -02000812="目前的路徑名稱" -02000813="不要路徑名稱" - -02000820="覆寫模式" -02000821="覆寫前先詢問我" -02000822="覆寫時不詢問" -02000823="略過現有的檔案" -02000824="自動重新命名" -02000825="自動重新命名現有的檔案" - -02000830="檔案" -02000831="選取的檔案(&S)" -02000832="所有檔案(&A)" - -02000881="請指定存放暫存壓縮檔的位置。" - -02000890="正在解壓縮" - -; Overwrite dialog -02000900="確認取代檔案" -02000901="目的資料夾已包含要處理的檔案。" -02000902="您要取代現有的檔案" -02000903="而改用這個檔案嗎?" - -02000911="自動重新命名(&U)" - -02000982="{0} 位元組" -02000983="修改日期" - -; Messages dialog -02000A00="診斷訊息" - -02000A80="訊息" - -02000A91="'{0}' 未支援此壓縮方式。" -02000A92="'{0}' 中的資料含有錯誤。檔案已損壞。" -02000A93="'{0}' 的 CRC 驗證失敗。檔案已損壞。" -02000A94="資料錯誤於加密的檔案 '{0}'。錯誤的密碼?" -02000A95="CRC 失敗於加密的檔案 '{0}'。錯誤的密碼?" - -; Password dialog -02000B00="輸入密碼" -02000B01="輸入密碼:" -02000B02="顯示密碼(&S)" -02000B03="重新輸入密碼:" -02000B10="密碼不一致" -02000B11="僅能使用英文字母、數字和特殊字元 (!, #, $, ...) 當作密碼" -02000B12="密碼太長" - -; Progress dialog -02000C00="進度" -02000C01="經過時間:" -02000C02="剩餘時間:" -02000C03="大小:" -02000C04="速度:" -02000C05="已處理:" -02000C06="壓縮率:" - -02000C10="背景作業(&B)" -02000C11="前景作業(&F)" -02000C12="暫停(&P)" -02000C13="繼續(&C)" - -02000C20="暫停" - -02000C30="您確定要取消嗎?" - -; Compress dialog -02000D00="加入壓縮檔" -02000D01="壓縮檔(&A):" -02000D02="更新模式(&U):" -02000D03="壓縮檔格式(&F):" -02000D04="壓縮方式(&M):" -02000D05="建立結實壓縮檔(&S)" -02000D06="參數(&P):" -02000D07="選項" -02000D08="建立自解壓縮檔(&X)" -02000D09="多執行緒" -02000D0A="加密檔名(&N)" -02000D0B="壓縮層級(&L):" -02000D0C="字典大小(&D):" -02000D0D="字組大小(&W):" -02000D0E="壓縮時記憶體使用:" -02000D0F="解壓縮時記憶體使用:" -02000D10="加密" -02000D11="加密方法:" -02000D12="CPU 線程數:" -02000D13="結實區塊大小:" -02000D14="非結實" -02000D15="結實" -02000D16="壓縮共用檔案" - -02000D40="分割壓縮檔,位元組(&V):" -02000D41="不正確的分割大小" -02000D42="指定的分割大小: {0} 位元組。\n您確定要分割為這些壓縮檔嗎?" - -02000D81="封存" -02000D82="一般壓縮" -02000D83="最大壓縮" -02000D84="快速壓縮" -02000D85="最快速壓縮" -02000D86="極致壓縮" - -02000D90="瀏覽" - -02000DA1="加入並取代檔案" -02000DA2="更新並加入檔案" -02000DA3="更新現有的檔案" -02000DA4="同步處理檔案" - -02000DB1="所有檔案" - -02000DC0="正在壓縮" - -; Columns dialog -02000E00="欄位" -02000E01="核取您想在此資料夾中所要顯示的欄位。請使用 [上移] 和 [下移] 按鈕重新排列欄位的順序。" -02000E02="選取的欄位應該是" -02000E03="像素寬度(&W)" - -02000E10="上移(&U)" -02000E11="下移(&D)" -02000E12="顯示(&S)" -02000E13="隱藏(&H)" -02000E14="設定" - -02000E81="標題" -02000E82="寬度" - -; Testing -02000F90="測試" - - -; File Manager - -03000000="7-Zip 檔案管理員" - -; Menu -03000102="檔案(&F)" -03000103="編輯(&E)" -03000104="檢視(&V)" -03000105="工具(&T)" -03000106="說明(&H)" -03000107="我的最愛(&A)" - -; File -03000210="開啟(&O)" -03000211="在內部開啟(&I)" -03000212="在外部開啟(&U)" -03000220="檢視(&V)" -03000221="編輯(&E)" -03000230="重新命名(&M)" -03000231="複製到(&C)..." -03000232="移動到(&M)..." -03000233="刪除(&D)" -03000240="內容(&R)" -03000241="註解(&N)" -03000242="計算驗證值" -03000243="比較檔案" -03000250="建立資料夾" -03000251="建立檔案" -03000260="結束(&X)" -03000270="分割檔案(&S)..." -03000271="合併檔案(&B)..." - -; Edit -03000310="還原(&U)" -03000311="重做(&R)" -03000320="剪下(&T)" -03000321="複製(&C)" -03000322="貼上(&P)" -03000323="刪除(&D)" -03000330="全選(&A)" -03000331="全不選" -03000332="反向選擇(&I)" -03000333="選取..." -03000334="取消選取..." -03000335="依類型選取" -03000336="依類型不選取" - -; View -03000410="大圖示(&G)" -03000411="小圖示(&M)" -03000412="清單(&L)" -03000413="詳細資料(&D)" -03000420="不排序" -03000430="開啟根目錄" -03000431="上移一層" -03000432="資料夾歷程記錄..." -03000440="重新整理(&R)" -03000449="攤開檢視" -03000450="雙窗格(&2)" -03000451="工具列(&T)" -03000460="壓縮檔工具列" -03000461="標準工具列" -03000462="大型按鈕" -03000463="顯示按鈕文字" - -; Tools -03000510="選項(&O)..." -03000511="效能測試(&B)" - -; Help -03000610="內容(&C)..." -03000620="關於 7-Zip(&A)..." - -; Favorites -03000710="將資料夾加入我的最愛為(&A)" -03000720="書籤" - -; Options Dialog - -03010000="選項" - -; Plugins -03010100="外掛程式" -03010101="外掛程式(&P):" -03010110="選項..." - -; Edit -03010200="編輯器" -03010201="編輯器(&E):" -03010202="檔案比較程式(&D):" - -; System -03010300="系統" -03010302="使 7-Zip 與之產生關聯:" -03010310="外掛程式" - -; Settings -03010400="設定" -03010401="顯示 \"..\" 項目" -03010402="顯示實際檔案圖示" -03010410="顯示系統選單" -03010420="整列選取(&F)" -03010421="顯示格線(&G)" -03010422="單擊開啟項目" -03010430="使用替代選擇模式(&A)" -03010440="使用大量記憶體分頁(&L)" - -; Strings - -03020201="複製" -03020202="移動" -03020203="複製到:" -03020204="移動到:" -03020205="正在複製..." -03020206="正在移動..." -03020207="您不能在這類資料夾中移動或複製項目。" -03020208="未支援的操作。" -03020209="選擇目標資料夾。" - -03020210="確認刪除檔案" -03020211="確認刪除資料夾" -03020212="確認刪除多個檔案" -03020213="您確定要刪除 '{0}' 嗎?" -03020214="您確定要刪除資料夾 '{0}' 以及它所有的內容嗎?" -03020215="您確定要刪除這 {0} 個項目嗎? " -03020216="正在刪除..." -03020217="刪除檔案或資料夾時發生錯誤" -03020218="系統不能移動路徑過長的檔案到資源回收筒" - -03020220="正在重新命名..." -03020221="重新命名檔案或資料夾時發生錯誤" -03020222="確認複製檔案" -03020223="您確定要複製檔案至壓縮檔?" - -03020230="建立資料夾" -03020231="資料夾名稱:" -03020232="新增資料夾" -03020233="建立資料夾時發生錯誤" - -03020240="建立檔案" -03020241="檔案名稱:" -03020242="新增檔案" -03020243="建立檔案時發生錯誤" - -03020250="選取" -03020251="取消選取" -03020252="遮罩:" - -03020260="資料夾歷程記錄" - -03020280="檔案 '{0}' 已被修改過。\n您是否要在此壓縮檔內更新檔案?" -03020281="無法更新檔案\n'{0}'" -03020282="無法啟動編輯器。" -03020283="正在開啟..." -03020284="檔案似是病毒(檔案名稱含有很多空格)。" - -03020290="註解" -03020291="註解(&C):" - -030202A0="系統" - -03020300="電腦" -03020301="網路" -03020302="文件" - -03020400="加入" -03020401="解壓縮" -03020402="測試" - -03020420="複製" -03020421="移動" -03020422="刪除" -03020423="資訊" - -03020500="分割檔案" -03020501="分割到(&S):" -03020510="正在分割..." -03020520="確認分割" -03020521="您確定要分割檔案為 {0} 個?" -03020522="分割大小必須小於原始檔案大小" - -03020600="合併檔案" -03020601="合併到(&C):" -03020610="正在合併..." -03020620="僅選取第一個檔案" -03020621="未能確認此檔案為完整檔案分割出來的一部分" -03020622="找不到完整檔案的其他部分" - -03020710="正在計算驗證值..." -03020720="驗證值資訊" -03020721="資料的 CRC 驗證值:" -03020722="資料及名稱的 CRC 驗證值:" - -03020800="正在掃瞄..." - -03020900="內容" - -03020A01="不能完成操作,因資料夾路徑過長。" -03020A02="您必須選擇一個檔案" -03020A03="您必須選擇最少一個檔案" -03020A04="檔案 {0} 已存在" - -; Computer -03031100="全部大小" -03031101="可用空間" -03031102="叢集大小" -03031103="標籤" - -; Network -03031200="本機名稱" -03031201="提供者" - -; Benchmark Dialog - -03080000="效能測試" -03080001="記憶體使用:" -03080002="壓縮" -03080003="解壓縮" -03080004="速度" -03080005="評等" -03080006="整體評等" -03080007="目前" -03080008="結果" -03080009="通過數:" -0308000A="錯誤數:" -0308000B="CPU 使用" -0308000C="評等 / 使用" - -;!@LangEnd@! - - diff --git a/tools/7-Zip/copying.txt b/tools/7-Zip/copying.txt deleted file mode 100644 index f3926a6155..0000000000 --- a/tools/7-Zip/copying.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/tools/7-Zip/descript.ion b/tools/7-Zip/descript.ion deleted file mode 100644 index 52efc10a40..0000000000 --- a/tools/7-Zip/descript.ion +++ /dev/null @@ -1,15 +0,0 @@ -7-zip.chm 7-Zip Help -7-Zip.dll 7-Zip Plugin -7z.dll 7-Zip Engine -7z.exe 7-Zip Console -7z.sfx 7-Zip GUI SFX -7zCon.sfx 7-Zip Console SFX -7zFM.exe 7-Zip File Manager -7zg.exe 7-Zip GUI -7zip_pad.xml 7-Zip Portable Application Description (PAD) -copying.txt GNU LGPL license -descript.ion 7-Zip File Descriptions -History.txt 7-Zip History -Lang 7-Zip Translations -License.txt 7-Zip License -readme.txt 7-Zip Overview diff --git a/tools/7-Zip/license.txt b/tools/7-Zip/license.txt deleted file mode 100644 index e25910a648..0000000000 --- a/tools/7-Zip/license.txt +++ /dev/null @@ -1,56 +0,0 @@ - 7-Zip - ~~~~~ - License for use and distribution - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - 7-Zip Copyright (C) 1999-2010 Igor Pavlov. - - Licenses for files are: - - 1) 7z.dll: GNU LGPL + unRAR restriction - 2) All other files: GNU LGPL - - The GNU LGPL + unRAR restriction means that you must follow both - GNU LGPL rules and unRAR restriction rules. - - - Note: - You can use 7-Zip on any computer, including a computer in a commercial - organization. You don't need to register or pay for 7-Zip. - - - GNU LGPL information - -------------------- - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You can receive a copy of the GNU Lesser General Public License from - http://www.gnu.org/ - - - unRAR restriction - ----------------- - - The decompression engine for RAR archives was developed using source - code of unRAR program. - All copyrights to original unRAR code are owned by Alexander Roshal. - - The license for original unRAR code has the following restriction: - - The unRAR sources cannot be used to re-create the RAR compression algorithm, - which is proprietary. Distribution of modified unRAR sources in separate form - or as a part of other software is permitted, provided that it is clearly - stated in the documentation and source comments that the code may - not be used to develop a RAR (WinRAR) compatible archiver. - - - -- - Igor Pavlov diff --git a/tools/7-Zip/readme.txt b/tools/7-Zip/readme.txt deleted file mode 100644 index 82364e945d..0000000000 --- a/tools/7-Zip/readme.txt +++ /dev/null @@ -1,48 +0,0 @@ -7-Zip 9.11 ----------- - -7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/2008/XP/Vista/7. - -7-Zip Copyright (C) 1999-2010 Igor Pavlov. - -The main features of 7-Zip: - - - High compression ratio in the new 7z format - - Supported formats: - - Packing / unpacking: 7z, XZ, BZIP2, GZIP, TAR and ZIP - - Unpacking only: ARJ, CAB, CHM, CPIO, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, - MBR, MSI, NSIS, NTFS, RAR, RPM, UDF, VHD, WIM, XAR and Z. - - Fast compression and decompression - - Self-extracting capability for 7z format - - Strong AES-256 encryption in 7z and ZIP formats - - Integration with Windows Shell - - Powerful File Manager - - Powerful command line version - - Localizations for 74 languages - - -7-Zip is free software distributed under the GNU LGPL (except for unRar code). -Read License.txt for more infomation about license. - - - This distribution contains the following files: - - 7zFM.exe - 7-Zip File Manager - 7-zip.dll - Plugin for Windows Shell and for 7-Zip File Manager - 7zg.exe - GUI module - 7z.exe - Command line version - 7z.dll - 7-Zip engine module - 7z.sfx - SFX module (Windows version) - 7zCon.sfx - SFX module (Console version) - - License.txt - License information - readme.txt - This file - History.txt - History of 7-Zip - 7-zip.chm - User's Manual in HTML Help format - - Lang\en.ttt - English (base) localization file - Lang\*.txt - Localization files - - ---- -End of document diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Phone.Build.Tasks.dll b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Phone.Build.Tasks.dll deleted file mode 100644 index c153d499e2..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Phone.Build.Tasks.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Phone.PreImport.targets b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Phone.PreImport.targets deleted file mode 100644 index 113d4b9377..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Phone.PreImport.targets +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - $(PrepareForRunDependsOn); - ValidateWMAppManifest; - - - - - - CreateSilverlightAppManifest - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.CSharp.targets b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.CSharp.targets deleted file mode 100644 index c5458d36b9..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.CSharp.targets +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.Common.targets b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.Common.targets deleted file mode 100644 index e62af90ec0..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.Common.targets +++ /dev/null @@ -1,704 +0,0 @@ - - - - - - - - - - - - - - - - - - - true - true - false - false - false - $(FrameworkRegistryBase)\$(TargetFrameworkVersion) - $(FrameworkRegistryBaseWithVersion)\ReferenceAssemblies - $(FrameworkRegistryBaseWithVersion)\ReferenceAssemblies - Silverlight 4 - False - - $(FrameworkSDKRoot)bin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_FullFrameworkReferenceAssemblyPaths>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), '')) - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile))) - - - - $(TargetFrameworkDirectory) - @(_TargetFrameworkSDKDirectoryItem) - $(TargetFrameworkSDKDirectory) - - - - <_TargetFrameworkDirectoryItem Include="$(TargetFrameworkDirectory)"/> - - - <_TargetFrameworkSDKDirectoryItem Include="$(TargetFrameworkSDKDirectory)" Condition="'@(_TargetFrameworkSDKDirectoryItem)' == ''"/> - - - - - - - - - - - - - - - - - - - - - CategorizeSilverlightReferences; - ValidateXapFilenames; - $(PrepareForRunDependsOn); - ValidateXaml; - CreateSilverlightAppManifest; - PackagePlatformExtensions; - XapPackager; - CreateHtmlTestPage; - - - - - - $(BuiltProjectOutputGroupDependsOn); - CategorizeSilverlightReferences; - - - - - - - $(PrepareResourcesDependsOn) - - - - - - - GetFrameworkPaths; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compile; - ValidateReferences; - - - - - - - - - - - - - _CreateSLProperties; - MarkupCompilePass1; - ValidateXaml; - FilesToXap; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - $(MSBuildProjectFullPath) - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - - - - AppManifest.xaml - - - true - $(XapFilename) - - - - - - - - CreateSilverlightAppManifest;CategorizeSilverlightReferences - $(FilesToXapDependsOn);GetCopyToOutputDirectoryContentProjectItems - - - - - - - - - - - - - - - - - - - AssignTargetPaths;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - - - <_OriginalBuildingProject>$(BuildingProject) - true - - - - - - - - PrepareResourceNames; - $(ComputeIntermediateSatelliteAssembliesDependsOn); - - - - - - - _CreateSLProperties; - AssignTargetPaths; - _PreCategorizeSilverlightReferences; - ResolveReferences; - ComputeIntermediateSatelliteAssemblies; - - - - - - - - - - - - - - - - true - %(Filename)%(Extension) - - - - - $(_OriginalBuildingProject) - - - - - - - - _CreateSLProperties; - CategorizeSilverlightReferences; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - Resx - false - $(IntermediateOutputPath)$(_ResourceNameInMainAssembly) - - - - - - - - - _CreateSLProperties; - FilesToXap; - - - - - - - - - - {CandidateAssemblyFiles}; - $(ReferencePath); - {HintPathFromItem}; - {TargetFrameworkDirectory}; - {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)}; - {Registry:$(WindowsPhone7RegistryBase),$(WindowsPhone7RegistryBaseVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)}; - {RawFileName}; - $(TargetDir) - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.VisualBasic.targets b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.VisualBasic.targets deleted file mode 100644 index f01d640031..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.VisualBasic.targets +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - Embed - My Project\WMAppManifest.xml - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone.Build.Tasks.dll b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone.Build.Tasks.dll deleted file mode 100644 index 61bbcbd1d8..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone.Build.Tasks.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone.Overrides.targets b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone.Overrides.targets deleted file mode 100644 index 3fa0ab7913..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone.Overrides.targets +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\ReferenceAssemblies - false - Silverlight 4.0 Windows Phone Profile - true - - - - - - - - - - - - - - $(TokenBackgroundImage) - - - $(ApplicationIconImage) - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone71.Overrides.targets b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone71.Overrides.targets deleted file mode 100644 index 67c845d74f..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/Microsoft.Silverlight.WindowsPhone71.Overrides.targets +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\ReferenceAssemblies - false - Silverlight 4.0 Windows Phone 7.1 Profile - Software\Microsoft\Microsoft SDKs\Silverlight for Phone - $(TargetFrameworkVersion) - true - - - - - - - - - - - - - - $(TokenBackgroundImage) - - - $(ApplicationIconImage) - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/XamlServicesWP.dll b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/XamlServicesWP.dll deleted file mode 100644 index 6455a5b397..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/XamlServicesWP.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/zlib114.dll b/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/zlib114.dll deleted file mode 100644 index b52e6ccf9c..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight for Phone/v4.0/zlib114.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.Build.Tasks.dll b/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.Build.Tasks.dll deleted file mode 100644 index 18ac9eaaf5..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.Build.Tasks.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.CSharp.targets b/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.CSharp.targets deleted file mode 100644 index c5458d36b9..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.CSharp.targets +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.Common.targets b/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.Common.targets deleted file mode 100644 index 0ed941c50a..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.Common.targets +++ /dev/null @@ -1,631 +0,0 @@ - - - - - - - - - - - - - - - - true - true - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(TargetFrameworkDirectory) - @(_TargetFrameworkSDKDirectoryItem) - $(TargetFrameworkSDKDirectory) - - - - <_TargetFrameworkDirectoryItem Include="$(TargetFrameworkDirectory)"/> - - - <_TargetFrameworkSDKDirectoryItem Include="$(TargetFrameworkSDKDirectory)" Condition="'@(_TargetFrameworkSDKDirectoryItem)' == ''"/> - - - - - - - - - - - - - - - - - - - - - CategorizeSilverlightReferences; - ValidateXapFilenames; - $(PrepareForRunDependsOn); - ValidateXaml; - CreateSilverlightAppManifest; - PackagePlatformExtensions; - XapPackager; - CreateHtmlTestPage; - - - - - - $(BuiltProjectOutputGroupDependsOn); - CategorizeSilverlightReferences; - - - - - - - $(PrepareResourcesDependsOn) - - - - - - - GetFrameworkPaths; - - - - - - - - - - - - - - - - - - - - - - Compile; - - - - - - - - - - - - - _CreateSLProperties; - MarkupCompilePass1; - ValidateXaml; - FilesToXap; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - $(MSBuildProjectFullPath) - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - - - - AppManifest.xaml - - - true - $(XapFilename) - - - - - - - - CreateSilverlightAppManifest;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - AssignTargetPaths;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - - - <_OriginalBuildingProject>$(BuildingProject) - true - - - - - - - - PrepareResourceNames; - $(ComputeIntermediateSatelliteAssembliesDependsOn); - - - - - - - _CreateSLProperties; - AssignTargetPaths; - _PreCategorizeSilverlightReferences; - ResolveReferences; - ComputeIntermediateSatelliteAssemblies; - - - - - - - - - - - - - - - - true - %(Filename)%(Extension) - - - - - $(_OriginalBuildingProject) - - - - - - - - _CreateSLProperties; - CategorizeSilverlightReferences; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - Resx - false - $(IntermediateOutputPath)$(_ResourceNameInMainAssembly) - - - - - - - - - _CreateSLProperties; - FilesToXap; - - - - - - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.VisualBasic.targets b/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.VisualBasic.targets deleted file mode 100644 index 9940a0f874..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v3.0/Microsoft.Silverlight.VisualBasic.targets +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v3.0/XamlServices.dll b/tools/MSBuild/Microsoft/Silverlight/v3.0/XamlServices.dll deleted file mode 100644 index 7f62aca0f6..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v3.0/XamlServices.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v3.0/zlib114.dll b/tools/MSBuild/Microsoft/Silverlight/v3.0/zlib114.dll deleted file mode 100644 index 058b7ddf01..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v3.0/zlib114.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Ria.Client.targets b/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Ria.Client.targets deleted file mode 100644 index 53e4652c7c..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Ria.Client.targets +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - BeforeRiaClientCodeGen; - CoreRiaClientCodeGen; - AfterRiaClientCodeGen; - - - - - - - - - - - - - - - - - PrepareForRiaClientCodeGen; - CreateRiaClientFiles; - - - - - - - - - - - CleanRiaClientFiles; - - - - - - - <_RiaClientCodeGenOutputPath>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)')) - <_RiaClientCodeGenHistoryFile>$([System.IO.Path]::Combine('$(_RiaClientCodeGenOutputPath)', '$(MSBuildProjectName).RiaFiles.txt')) - - - - - - - $(CleanDependsOn); - RiaClientClean; - - - - RiaClientCodeGen; - $(CoreCompileDependsOn); - - - - - - - - $(CleanDependsOn); - RiaClientClean; - - - - RiaClientClean; - $(CoreCompileDependsOn); - - - - - - - System.ComponentModel.DataAnnotations.dll;System.Runtime.Serialization.dll;System.ServiceModel.dll;System.ServiceModel.DomainServices.Client.dll;System.ServiceModel.DomainServices.Client.Web.dll;System.ServiceModel.Web.Extensions - - - - - - - - - - - - - - - - ResolveRiaClientCodeGenInputs; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.Build.Tasks.dll b/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.Build.Tasks.dll deleted file mode 100644 index a2eb702992..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.Build.Tasks.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.CSharp.targets b/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.CSharp.targets deleted file mode 100644 index c5458d36b9..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.CSharp.targets +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.Common.targets b/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.Common.targets deleted file mode 100644 index a849ace39a..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.Common.targets +++ /dev/null @@ -1,640 +0,0 @@ - - - - - - - - - - - - - - - - true - true - false - false - false - Silverlight 4 - - $(FrameworkSDKRoot)bin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(TargetFrameworkDirectory) - @(_TargetFrameworkSDKDirectoryItem) - $(TargetFrameworkSDKDirectory) - - - - <_TargetFrameworkDirectoryItem Include="$(TargetFrameworkDirectory)"/> - - - <_TargetFrameworkSDKDirectoryItem Include="$(TargetFrameworkSDKDirectory)" Condition="'@(_TargetFrameworkSDKDirectoryItem)' == ''"/> - - - - - - - - - - - - - - - - - - - - CategorizeSilverlightReferences; - ValidateXapFilenames; - $(PrepareForRunDependsOn); - ValidateXaml; - CreateSilverlightAppManifest; - PackagePlatformExtensions; - XapPackager; - CreateHtmlTestPage; - - - - - - $(BuiltProjectOutputGroupDependsOn); - CategorizeSilverlightReferences; - - - - - - - $(PrepareResourcesDependsOn) - - - - - - - GetFrameworkPaths; - - - - - - - - - - - - - - - - - - - - - - Compile; - - - - - - - - - - - - - _CreateSLProperties; - MarkupCompilePass1; - ValidateXaml; - FilesToXap; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - $(MSBuildProjectFullPath) - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - - - - AppManifest.xaml - - - true - $(XapFilename) - - - - - - - - CreateSilverlightAppManifest;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - AssignTargetPaths;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - - - <_OriginalBuildingProject>$(BuildingProject) - true - - - - - - - - PrepareResourceNames; - $(ComputeIntermediateSatelliteAssembliesDependsOn); - - - - - - - _CreateSLProperties; - AssignTargetPaths; - _PreCategorizeSilverlightReferences; - ResolveReferences; - ComputeIntermediateSatelliteAssemblies; - - - - - - - - - - - - - - - - true - %(Filename)%(Extension) - - - - - $(_OriginalBuildingProject) - - - - - - - - _CreateSLProperties; - CategorizeSilverlightReferences; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - Resx - false - $(IntermediateOutputPath)$(_ResourceNameInMainAssembly) - - - - - - - - - _CreateSLProperties; - FilesToXap; - - - - - - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.VisualBasic.targets b/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.VisualBasic.targets deleted file mode 100644 index 9940a0f874..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v4.0/Microsoft.Silverlight.VisualBasic.targets +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/XamlServices.dll b/tools/MSBuild/Microsoft/Silverlight/v4.0/XamlServices.dll deleted file mode 100644 index f254d01b61..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v4.0/XamlServices.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v4.0/zlib114.dll b/tools/MSBuild/Microsoft/Silverlight/v4.0/zlib114.dll deleted file mode 100644 index 3fbf368565..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v4.0/zlib114.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Ria.Client.targets b/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Ria.Client.targets deleted file mode 100644 index b520604aa7..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Ria.Client.targets +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - BeforeRiaClientCodeGen; - CoreRiaClientCodeGen; - AfterRiaClientCodeGen; - - - - - - - - - - - - - - - - - PrepareForRiaClientCodeGen; - CreateRiaClientFiles; - - - - - - - - - - - CleanRiaClientFiles; - - - - - - - <_RiaClientCodeGenOutputPath>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)')) - <_RiaClientCodeGenHistoryFile>$([System.IO.Path]::Combine('$(_RiaClientCodeGenOutputPath)', '$(MSBuildProjectName).RiaFiles.txt')) - - - - - - - $(CleanDependsOn); - RiaClientClean; - - - - RiaClientCodeGen; - $(CoreCompileDependsOn); - - - - - - - - $(CleanDependsOn); - RiaClientClean; - - - - RiaClientClean; - $(CoreCompileDependsOn); - - - - - - - System.ComponentModel.DataAnnotations.dll;System.Runtime.Serialization.dll;System.ServiceModel.dll;System.ServiceModel.DomainServices.Client.dll;System.ServiceModel.DomainServices.Client.Web.dll;System.ServiceModel.Web.Extensions - - - - - - - - - - - - - - - - ResolveRiaClientCodeGenInputs; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.Build.Tasks.dll b/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.Build.Tasks.dll deleted file mode 100644 index bc4b8233f4..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.Build.Tasks.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.CSharp.targets b/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.CSharp.targets deleted file mode 100644 index c5458d36b9..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.CSharp.targets +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.Common.targets b/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.Common.targets deleted file mode 100644 index 223ee09054..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.Common.targets +++ /dev/null @@ -1,641 +0,0 @@ - - - - - - - - - - - - - - - - true - true - false - false - false - Silverlight 4 - - $(FrameworkSDKRoot)bin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(TargetFrameworkDirectory) - @(_TargetFrameworkSDKDirectoryItem) - $(TargetFrameworkSDKDirectory) - - - - <_TargetFrameworkDirectoryItem Include="$(TargetFrameworkDirectory)"/> - - - <_TargetFrameworkSDKDirectoryItem Include="$(TargetFrameworkSDKDirectory)" Condition="'@(_TargetFrameworkSDKDirectoryItem)' == ''"/> - - - - - - - - - - - - - - - - - - - - CategorizeSilverlightReferences; - ValidateXapFilenames; - $(PrepareForRunDependsOn); - ValidateXaml; - CreateSilverlightAppManifest; - PackagePlatformExtensions; - XapPackager; - CreateHtmlTestPage; - - - - - - $(BuiltProjectOutputGroupDependsOn); - CategorizeSilverlightReferences; - - - - - - - $(PrepareResourcesDependsOn) - - - - - - - GetFrameworkPaths; - - - - - - - - - - - - - - - - - - - - - - Compile; - - - - - - - - - - - - - _CreateSLProperties; - MarkupCompilePass1; - ValidateXaml; - FilesToXap; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - $(MSBuildProjectFullPath) - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - - - - AppManifest.xaml - - - true - $(XapFilename) - - - - - - - - CreateSilverlightAppManifest;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - AssignTargetPaths;CategorizeSilverlightReferences - - - - - - - - - - - - - - - - - - - <_OriginalBuildingProject>$(BuildingProject) - true - - - - - - - - PrepareResourceNames; - $(ComputeIntermediateSatelliteAssembliesDependsOn); - - - - - - - _CreateSLProperties; - AssignTargetPaths; - _PreCategorizeSilverlightReferences; - ResolveReferences; - ComputeIntermediateSatelliteAssemblies; - - - - - - - - - - - - - - - - true - %(Filename)%(Extension) - - - - - $(_OriginalBuildingProject) - - - - - - - - _CreateSLProperties; - CategorizeSilverlightReferences; - CreateSilverlightAppManifest; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - Resx - false - $(IntermediateOutputPath)$(_ResourceNameInMainAssembly) - - - - - - - - - _CreateSLProperties; - FilesToXap; - - - - - - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.VisualBasic.targets b/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.VisualBasic.targets deleted file mode 100644 index 9940a0f874..0000000000 --- a/tools/MSBuild/Microsoft/Silverlight/v5.0/Microsoft.Silverlight.VisualBasic.targets +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - Silverlight - Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier) - - - - - - - diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/XamlServices.dll b/tools/MSBuild/Microsoft/Silverlight/v5.0/XamlServices.dll deleted file mode 100644 index 138f209cd0..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v5.0/XamlServices.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/Silverlight/v5.0/zlib114.dll b/tools/MSBuild/Microsoft/Silverlight/v5.0/zlib114.dll deleted file mode 100644 index 90d1acb898..0000000000 Binary files a/tools/MSBuild/Microsoft/Silverlight/v5.0/zlib114.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.Build.Tasks.dll b/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.Build.Tasks.dll deleted file mode 100644 index 3df0b8cd58..0000000000 Binary files a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.Build.Tasks.dll and /dev/null differ diff --git a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.CPP.Targets b/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.CPP.Targets deleted file mode 100644 index 9f87f89954..0000000000 --- a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.CPP.Targets +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - MarkupCompilePass1; - $(BeforeClCompileTargets) - - - - ComputeXamlGeneratedCompileInputs; - $(ComputeCompileInputsTargets) - - - - $(ComputeLinkInputsTargets); - CreateWinMD; - ComputeGeneratedWinMD; - MarkupCompilePass2; - ComputeInvalidXamlGenerated; - CompileXamlGeneratedFiles; - $(AfterBuildCompileTargets) - - - - $(XamlPreLinkDependsOn); - ComputeXamlGeneratedCLOutputs - - - True - true - true - - - - - $(ValidatePresenceOfAppxManifestItemsDependsOn); - _CreateContentItemOutOfCustomAppxManifest - - - - - - - - - %(Link.WindowsMetadataFile) - - - - - - - - - - - - - Generated Files\ - $(GeneratedFilesDir) - $(ExtensionsToDeleteOnClean);*.g.h;*.g.cpp;*.xaml - - - - - - - XamlGeneratedFilesOutputGroup;$(GeneratedFilesOutputGroupDependsOn) - - - - - - - - - - - - - - - XamlGenerated - - - XamlGenerated - - - XamlGenerated - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - DesignTimeMarkupCompilation - - - DesignTimeMarkupCompilation - - - - - CppDesignTimeMarkupCompilation;$(MarkupCompilePass1DependsOn) - - - - - - - - diff --git a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.CSharp.Targets b/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.CSharp.Targets deleted file mode 100644 index 71083c4af9..0000000000 --- a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.CSharp.Targets +++ /dev/null @@ -1,34 +0,0 @@ - - - - - .NETCore - v4.5 - 8.0 - - true - true - true - false - true - - True - - - true - - - - - - diff --git a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.Common.Targets b/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.Common.Targets deleted file mode 100644 index 5eb2460729..0000000000 --- a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.Common.Targets +++ /dev/null @@ -1,539 +0,0 @@ - - - - - - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win8Express\11.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Win8Express\11.0\Setup\VC@ProductDir) - $(VCInstallDir_110) - - true - - - @(ReferenceAssemblyPaths); - $(WindowsSDK80Path) - - - - - - - - - - - - - - - - $(TargetName) - - $(RootNamespace) - $(RootNamespace) - - $(TargetName) - - - - $(AvailablePlatforms),ARM - - - - ResolveKeySource; - MarkupCompilePass1; - XamlPreCompile; - MarkupCompilePass2; - $(PrepareResourcesDependsOn) - - - true - true - 6.02 - 6.00 - - _OnXamlPreCompileError - - - true - - - $(IntermediateOutputPath) - - - - - - - $(FrameworkSDKRoot)bin - - - true - - - - - - - - - - - - - - - - - - - - - - - - DesignTimeMarkupCompilation; - $(CoreCompileDependsOn) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(WarningLevel) - 0 - - - - - - - - - $(PrevWarningLevel) - 1 - - - - - - @(XamlIntermediateAssembly->'%(Identity)') - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(XamlGeneratedOutputPath) - $(OutDir) - - - - - - - - - - GetPackagingOutputs; - $(PrepareLibraryLayoutDependsOn) - - - - - - - - <_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'ContentFilesProjectOutputGroup'" /> - <_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'CustomOutputGroupForPackaging'" /> - - - - - - - - - - - $(ResolveReferencesDependsOn); - ImplicitlyExpandTargetFramework; - ImplicitlyExpandTargetPlatform - - - - $(ImplicitlyExpandTargetFrameworkDependsOn); - GetReferenceAssemblyPaths - - - - - - - - false - false - $(TargetFrameworkMonikerDisplayName) - $(TargetFrameworkMoniker) - ImplicitlyExpandTargetFramework - True - - - - - - - - - <_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" - Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'"/> - - - - - - - - true - false - $(TargetPlatformMoniker) - $(TargetPlatformIdentifier) - ImplicitlyExpandTargetPlatform - True - - - - - - - - - <_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" - Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetPlatform'"/> - - - - diff --git a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.VisualBasic.Targets b/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.VisualBasic.Targets deleted file mode 100644 index 382e8a58b3..0000000000 --- a/tools/MSBuild/Microsoft/WindowsXaml/v11.0/Microsoft.Windows.UI.Xaml.VisualBasic.Targets +++ /dev/null @@ -1,34 +0,0 @@ - - - - - .NETCore - v4.5 - 8.0 - - true - true - true - false - true - - True - - true - true - - - - - - diff --git a/tools/NCover/CoverLib.dll b/tools/NCover/CoverLib.dll deleted file mode 100644 index c2783d3f4e..0000000000 Binary files a/tools/NCover/CoverLib.dll and /dev/null differ diff --git a/tools/NCover/Coverage.xsl b/tools/NCover/Coverage.xsl deleted file mode 100644 index b95f56d9dd..0000000000 --- a/tools/NCover/Coverage.xsl +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - NCover Code Coverage Report - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- javascript:toggle( - ) - - - - - - - - -
- - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
VisitsLineEndColumnEndDocument
- - - exdatacell - hldatacell - datacell - - - - --- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - -
- javascript:toggle( - ) - - - - - - - - -
- - - -
- - - - - - - -
- - -
-
- - - - - - -
- - - -
- - - - - - - - -
- - -

Modules summary

- - - - - - - - -
-
-
-
- - - - - - -
- - - -
- - - - - - - - -
- - -

- NCover Code Coverage Report -

- - - - - - -
- Expand - | - Collapse -
-
-
- -
- Top -
- - - - - - - - - - - - - - - - - -
Excluded - - - - - - - - - -
-
- \ No newline at end of file diff --git a/tools/NCover/MSVCP71.dll b/tools/NCover/MSVCP71.dll deleted file mode 100644 index 69efdc52cf..0000000000 Binary files a/tools/NCover/MSVCP71.dll and /dev/null differ diff --git a/tools/NCover/MSVCP80.dll b/tools/NCover/MSVCP80.dll deleted file mode 100644 index cc13b93def..0000000000 Binary files a/tools/NCover/MSVCP80.dll and /dev/null differ diff --git a/tools/NCover/MSVCR71.dll b/tools/NCover/MSVCR71.dll deleted file mode 100644 index 018eac9cb3..0000000000 Binary files a/tools/NCover/MSVCR71.dll and /dev/null differ diff --git a/tools/NCover/MSVCR80.dll b/tools/NCover/MSVCR80.dll deleted file mode 100644 index 3d9561ac56..0000000000 Binary files a/tools/NCover/MSVCR80.dll and /dev/null differ diff --git a/tools/NCover/NCover.Console.exe b/tools/NCover/NCover.Console.exe deleted file mode 100644 index ed77b30f31..0000000000 Binary files a/tools/NCover/NCover.Console.exe and /dev/null differ diff --git a/tools/NCover/NCover.Console.exe.config b/tools/NCover/NCover.Console.exe.config deleted file mode 100644 index eb0a31aff7..0000000000 --- a/tools/NCover/NCover.Console.exe.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/tools/NCover/NCover.Framework.dll b/tools/NCover/NCover.Framework.dll deleted file mode 100644 index ff1a9a90c5..0000000000 Binary files a/tools/NCover/NCover.Framework.dll and /dev/null differ diff --git a/tools/NCover/NCoverFAQ.html b/tools/NCover/NCoverFAQ.html deleted file mode 100644 index 376719b005..0000000000 --- a/tools/NCover/NCoverFAQ.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - - -

NCover FAQ

-

If you have questions that this document does not address, contact - Peter Waldschmidt.

-

1. What is code coverage analysis?

-

A code coverage analyzer monitors your code at runtime and - records information about which lines of code were executed. NCover shows each - sequence point in your application along with the number of times that point - was executed. Sequence points are generated by the compiler and stored in the - debug information (.pdb) files. A sequence point basically corresponds to a - single program statement (often a line of code) in your high-level language.

-

2. Why would I want to do code coverage analysis?

-

Unit test suites are often used as a quality tool during the - development process to keep the codebase stable as it changes and expands. - Tools such as NUnit are often used to run and - report on the test suites. However, when implementing unit testing in your - build process, you have no way of knowing how much of your code the unit tests - are actually testing. This is where code coverage comes in. You can run NUnit - within NCover and use the code coverage report to determine which code was not - tested by that particular test suite.

-

3. What versions of the CLR does NCover support?

-

At this time, NCover has only been tested on the .NET framework - version 1.1.4322.

-

4. What is the command line syntax for NCover?

-

Here is the usage info from the NCover command line:

-
Usage: NCover /c <command line> [/a <assembly list>]
-
-/c Command line to launch profiled application.
-/a List of assemblies to profile. i.e. "MyAssembly1;MyAssembly2"
-/v Enable verbose logging (show instrumented code)
-        
-
    -
  • - The /c command-line argument is required and specifies the command-line of the - .NET application you want to analyze. -
  • - The /a command-line argument specifies the assemblies that you want to analyze. - NCover can only analyze assemblies that have .pdb files included with them. If - you do not specify the /a argument, NCover will attempt to analyze every loaded - assembly that has debug information available. -
  • - The /v command-line argument makes the profiler emit all the original IL and - modified IL instructions to the coverage log. This is useful for debugging - purposes. Beware that this can make your coverage log file very large! -
  • -
-

5. Does NCover required a special compilation step for my code?

-

No. Some code coverage tools change your source code and force - you to recompile it into a special build.  NCover is designed to work - on shipping code.  NCover uses the .NET Framework profiling API to monitor - your code. It does require build symbols, but can be run on release code - without any modifications.

-

6. How does NCover work?

-

NCover uses the .NET Framework profiler API to monitor an - application's execution. When a method is loaded by the CLR, NCover retrieves - the IL and replaces it with instrumented IL code.  NCover does not change - your original IL code, it simply inserts new code to update a visit - counter at each sequence point.  After the .NET process - shuts down, the profiler outputs statistics to a file in the current - directory. -

-

7. How do I analyze an ASP.NET application with NCover?

-

xmspc got this to work on ASP.NET. See his post - on the message board for more information. Here are the basics for getting it - to work on Windows XP. -

-
-

- 1) Ensure the NCoverLib COM component is registered (setup does this, but you - can manually register it with regsvr32 if you wish). -

-

- 2) Set the machine-wide COR profiling environment variables (or find some other - way to get them set in the aspnet_wp.exe's environment): -
-   COR_ENABLE_PROFILING=1 -
-   COR_PROFILER=CvrLib.CoverageProfiler -

-

3) Create %windir%\System32\Coverage.log and - %windir%\System32\Coverage.xml and grant .\ASPNET read+write+modify permission - to these 2 files only. -

-

4) Force a restart of IIS so aspnet_wp.exe picks up the new - environment variables. Coverage info will be written to the System32 - directory. -

-

All ASP.Net processes (on Windows XP for sure, don't know about - Windows 2003) use %windir%\System32 as their working dir, therefore if multiple - processes are running they will stomp over the Coverage files. -

-

...would be nice if NCover used AppDomain basedir and/or value - from app config file to set output file dir... -

-
-

8. What is the output of NCover?

-

NCover writes three files to the directory after analysis - completes. -

    -
  • - Coverage.log - This file is a log of the events and messages from the profiler - during the analysis process. Most of the time, error messages are recorded in - this log. If you enable verbose logging, the coverage log will contain - disassembly of the original and instrumented IL code. -
  • - Coverage.xml - This file is the analysis output of NCover. You can see an - example of the output below. -
  • - Coverage.xsl - This file is a simple XML transformation that makes the XML - output easily readable. -
  • -
- Example XML output -
<method class="NCoverTest.ClassLoaded" name="HasDeadCode">
-    <seqpnt document="C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs"
-            column="13" line="48" endcolumn="58" endline="48" visitcount="1" /> 
-    <seqpnt document="C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs" 
-            column="13" line="49" endcolumn="22" endline="49" visitcount="1" /> 
-    <seqpnt document="C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs" 
-            column="17" line="50" endcolumn="24" endline="50" visitcount="1" /> 
-    <seqpnt document="C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs" 
-            column="13" line="51" endcolumn="48" endline="51" visitcount="0" /> 
-    <seqpnt document="C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs" 
-            column="9" line="52"  endcolumn="10" endline="52" visitcount="0" /> 
-</method>
-
-

- Example transformed output -
-
NCoverTest.ClassLoaded.HasDeadCode
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Visit CountLineColumnEnd LineEnd ColumnDocument
148134858C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs
149134922C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs
150175024C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs
051135148C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs
05295210C:\Dev\Utilities\ncover\NCoverTest\NCoverTest.cs
-
-

-

9. How do you test NCover?

-

Unfortunately, all the original testing was done with production - code that cannot be published. I have started on a test suite called - NCoverTest. It is pretty anemic right now, but feel free to chip in and - contribute some tests.

- - diff --git a/tools/NCover/ncover.exe b/tools/NCover/ncover.exe deleted file mode 100644 index 83a5231608..0000000000 Binary files a/tools/NCover/ncover.exe and /dev/null differ diff --git a/tools/NuGet.exe b/tools/NuGet.exe deleted file mode 100644 index 324daa842c..0000000000 Binary files a/tools/NuGet.exe and /dev/null differ diff --git a/tools/StatLight/Ionic.Zip.Reduced.dll b/tools/StatLight/Ionic.Zip.Reduced.dll deleted file mode 100644 index da074366df..0000000000 Binary files a/tools/StatLight/Ionic.Zip.Reduced.dll and /dev/null differ diff --git a/tools/StatLight/Microsoft.Silverlight.Testing.License.txt b/tools/StatLight/Microsoft.Silverlight.Testing.License.txt deleted file mode 100644 index 9d2591faf8..0000000000 --- a/tools/StatLight/Microsoft.Silverlight.Testing.License.txt +++ /dev/null @@ -1,11 +0,0 @@ -MSDN CODE GALLERY BINARY LICENSE - -You are free to install, use, copy and distribute any number of copies of the software, in object code form, provided that you retain: - -• all copyright, patent, trademark, and attribution notices that are present in the software, -• this list of conditions, and -• the following disclaimer in the documentation and/or other materials provided with the software. - -The software is licensed “as-is.” You bear the risk of using it. No express warranties, guarantees or conditions are provided. To the extent permitted under your local laws, the implied warranties of merchantability, fitness for a particular purpose and non-infringement are excluded. - -This license does not grant you any rights to use any other party’s name, logo, or trademarks. All rights not specifically granted herein are reserved. \ No newline at end of file diff --git a/tools/StatLight/StatLight.Client.For.MSTest2009July.xap b/tools/StatLight/StatLight.Client.For.MSTest2009July.xap deleted file mode 100644 index a96a451aa5..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2009July.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2009November.xap b/tools/StatLight/StatLight.Client.For.MSTest2009November.xap deleted file mode 100644 index 478d463a92..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2009November.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2009October.xap b/tools/StatLight/StatLight.Client.For.MSTest2009October.xap deleted file mode 100644 index 0d72427092..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2009October.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2010April.xap b/tools/StatLight/StatLight.Client.For.MSTest2010April.xap deleted file mode 100644 index 85a0fc7155..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2010April.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2010March.xap b/tools/StatLight/StatLight.Client.For.MSTest2010March.xap deleted file mode 100644 index c73263a1d8..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2010March.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2010May.xap b/tools/StatLight/StatLight.Client.For.MSTest2010May.xap deleted file mode 100644 index 3e4b0ad17e..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2010May.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2011December.xap b/tools/StatLight/StatLight.Client.For.MSTest2011December.xap deleted file mode 100644 index 8c7bf61bc0..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2011December.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2011Feb.xap b/tools/StatLight/StatLight.Client.For.MSTest2011Feb.xap deleted file mode 100644 index 581f16fb5b..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2011Feb.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2011June.xap b/tools/StatLight/StatLight.Client.For.MSTest2011June.xap deleted file mode 100644 index 850351edd0..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2011June.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.MSTest2011October.xap b/tools/StatLight/StatLight.Client.For.MSTest2011October.xap deleted file mode 100644 index 42283d4f3c..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.MSTest2011October.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.UnitDriven2009December.xap b/tools/StatLight/StatLight.Client.For.UnitDriven2009December.xap deleted file mode 100644 index 62ad693e12..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.UnitDriven2009December.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Client.For.XUnitContrib2011April.xap b/tools/StatLight/StatLight.Client.For.XUnitContrib2011April.xap deleted file mode 100644 index 580030709e..0000000000 Binary files a/tools/StatLight/StatLight.Client.For.XUnitContrib2011April.xap and /dev/null differ diff --git a/tools/StatLight/StatLight.Core.dll b/tools/StatLight/StatLight.Core.dll deleted file mode 100644 index 3886991b21..0000000000 Binary files a/tools/StatLight/StatLight.Core.dll and /dev/null differ diff --git a/tools/StatLight/StatLight.EULA.txt b/tools/StatLight/StatLight.EULA.txt deleted file mode 100644 index 8a7cc39a7d..0000000000 --- a/tools/StatLight/StatLight.EULA.txt +++ /dev/null @@ -1,3 +0,0 @@ -See: - -http://statlight.codeplex.com/license \ No newline at end of file diff --git a/tools/StatLight/StatLight.exe b/tools/StatLight/StatLight.exe deleted file mode 100644 index 6b59bb3cd8..0000000000 Binary files a/tools/StatLight/StatLight.exe and /dev/null differ diff --git a/tools/StatLight/StatLight.exe.config b/tools/StatLight/StatLight.exe.config deleted file mode 100644 index b13a8d8b64..0000000000 --- a/tools/StatLight/StatLight.exe.config +++ /dev/null @@ -1,41 +0,0 @@ - - - - -
- - - - - - - - Red - - - White - - - Cyan - - - Yellow - - - Green - - - - - false - - - - - - - - diff --git a/tools/ildasm.exe b/tools/ildasm.exe deleted file mode 100644 index bf32c6f8e0..0000000000 Binary files a/tools/ildasm.exe and /dev/null differ diff --git a/tools/ildasm.exe.config b/tools/ildasm.exe.config deleted file mode 100644 index ec38be97bb..0000000000 --- a/tools/ildasm.exe.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tools/nunit/Failure.jpg b/tools/nunit/Failure.jpg deleted file mode 100644 index 658905fd98..0000000000 Binary files a/tools/nunit/Failure.jpg and /dev/null differ diff --git a/tools/nunit/Ignored.jpg b/tools/nunit/Ignored.jpg deleted file mode 100644 index 95b7fdbd14..0000000000 Binary files a/tools/nunit/Ignored.jpg and /dev/null differ diff --git a/tools/nunit/NUnitFitTests.html b/tools/nunit/NUnitFitTests.html deleted file mode 100644 index ca5cd4ff70..0000000000 --- a/tools/nunit/NUnitFitTests.html +++ /dev/null @@ -1,277 +0,0 @@ - - - -

NUnit Acceptance Tests

-

- Developers love self-referential programs! Hence, NUnit has always run all it's - own tests, even those that are not really unit tests. -

Now, beginning with NUnit 2.4, NUnit has top-level tests using Ward Cunningham's - FIT framework. At this time, the tests are pretty rudimentary, but it's a start - and it's a framework for doing more. -

Running the Tests

-

Open a console or shell window and navigate to the NUnit bin directory, which - contains this file. To run the test under Microsoft .Net, enter the command -

    runFile NUnitFitTests.html TestResults.html .
- To run it under Mono, enter -
    mono runFile.exe NUnitFitTests.html TestResults.html .
- Note the space and dot at the end of each command. The results of your test - will be in TestResults.html in the same directory. -

Platform and CLR Version

- - - - -
NUnit.Fixtures.PlatformInfo
-

Verify Unit Tests

-

- Load and run the NUnit unit tests, verifying that the results are as expected. - When these tests are run on different platforms, different numbers of tests may - be skipped, so the values for Skipped and Run tests are informational only. -

- The number of tests in each assembly should be constant across all platforms - - any discrepancy usually means that one of the test source files was not - compiled on the platform. There should be no failures and no tests ignored. -

Note: - At the moment, the nunit.extensions.tests assembly is failing because the - fixture doesn't initialize addins in the test domain. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NUnit.Fixtures.AssemblyRunner
AssemblyTests()Run()Skipped()Ignored()Failures()
nunit.framework.tests.dll397  00
nunit.core.tests.dll355  00
nunit.util.tests.dll238  00
nunit.mocks.tests.dll43  00
nunit.extensions.tests.dll5  00
nunit-console.tests.dll40  00
nunit.uikit.tests.dll34  00
nunit-gui.tests.dll15  00
nunit.fixtures.tests.dll6  00
-

Code Snippet Tests

-

- These tests create a test assembly from a snippet of code and then load and run - the tests that it contains, verifying that the structure of the loaded tests is - as expected and that the number of tests run, skipped, ignored or failed is - correct. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NUnit.Fixtures.SnippetRunner
CodeTree()Run()Skipped()Ignored()Failures()
public class TestClass
-{
-}
-
EMPTY0000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-}
-
TestClass0000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-    [Test]
-    public void T1() { }
-    [Test]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass
->T1
->T2
->T3
-
3000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass1
-{
-    [Test]
-    public void T1() { }
-}
-
-[TestFixture]
-public class TestClass2
-{
-    [Test]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass1
->T1
-TestClass2
->T2
->T3
-
3000
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-    [Test]
-    public void T1() { }
-    [Test, Ignore]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass
->T1
->T2
->T3
-
2010
using NUnit.Framework;
-
-[TestFixture]
-public class TestClass
-{
-    [Test]
-    public void T1() { }
-    [Test, Explicit]
-    public void T2() { }
-    [Test]
-    public void T3() { }
-}
-
TestClass
->T1
->T2
->T3
-
2100
-

Summary Information

- - - - -
fit.Summary
- - diff --git a/tools/nunit/NUnitTests.config b/tools/nunit/NUnitTests.config deleted file mode 100644 index 406366a4dd..0000000000 --- a/tools/nunit/NUnitTests.config +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/nunit/NUnitTests.nunit b/tools/nunit/NUnitTests.nunit deleted file mode 100644 index 7195b61f58..0000000000 --- a/tools/nunit/NUnitTests.nunit +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tools/nunit/Success.jpg b/tools/nunit/Success.jpg deleted file mode 100644 index 3d8e76092f..0000000000 Binary files a/tools/nunit/Success.jpg and /dev/null differ diff --git a/tools/nunit/TestResult.xml b/tools/nunit/TestResult.xml deleted file mode 100644 index e7e79903c7..0000000000 --- a/tools/nunit/TestResult.xml +++ /dev/null @@ -1,1298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/clr.bat b/tools/nunit/clr.bat deleted file mode 100644 index 0a838482ca..0000000000 --- a/tools/nunit/clr.bat +++ /dev/null @@ -1,96 +0,0 @@ -@echo off -rem Run a program under a particular version of the .Net framework -rem by setting the COMPLUS_Version environment variable. -rem -rem This command was written by Charlie Poole for the NUnit project. -rem You may use it separately from NUnit at your own risk. - -if "%1"=="/?" goto help -if "%1"=="?" goto help -if "%1"=="" goto GetVersion -if /I "%1"=="off" goto RemoveVersion -if "%2"=="" goto SetVersion -goto main - -:help -echo Control the version of the .Net framework that is used. The -echo command has several forms: -echo. -echo CLR -echo Reports the version of the CLR that has been set -echo. -echo CLR version -echo Sets the local shell environment to use a specific -echo version of the CLR for subsequent commands. -echo. -echo CLR version command [arguments] -echo Executes a single command using the specified CLR version. -echo. -echo CLR off -echo Turns off specific version selection for commands -echo. -echo The CLR version may be specified as vn.n.n or n.n.n. In addition, -echo the following shortcuts are recognized: -echo net-1.0, 1.0 For version 1.0.3705 -echo net-1.1, 1.1 For version 1.1.4322 -echo beta2 For version 2.0.50215 -echo net-2.0, 2.0 For version 2.0.50727 -echo. -echo NOTE: -echo Any specific settings for required or supported runtime in -echo the ^ section of a program's config file will -echo override the version specified by this command, and the -echo command will have no effect. -echo. -goto done - -:main - -setlocal -set CMD= -call :SetVersion %1 -shift /1 - -:loop 'Copy remaining arguments to form the command -if "%1"=="" goto run -set CMD=%CMD% %1 -shift /1 -goto :loop - -:run 'Execute the command -%CMD% -endlocal -goto done - -:SetVersion -set COMPLUS_Version=%1 - -rem Substitute proper format for certain names -if /I "%COMPLUS_Version:~0,1%"=="v" goto useit -if /I "%COMPLUS_Version%"=="net-1.0" set COMPLUS_Version=v1.0.3705&goto report -if /I "%COMPLUS_Version%"=="1.0" set COMPLUS_Version=v1.0.3705&goto report -if /I "%COMPLUS_Version%"=="net-1.1" set COMPLUS_Version=v1.1.4322&goto report -if /I "%COMPLUS_Version%"=="1.1" set COMPLUS_Version=v1.1.4322&goto report -if /I "%COMPLUS_Version%"=="beta2" set COMPLUS_Version=v2.0.50215&goto report -if /I "%COMPLUS_Version%"=="net-2.0" set COMPLUS_Version=v2.0.50727&goto report -if /I "%COMPLUS_Version%"=="2.0" set COMPLUS_Version=v2.0.50727&goto report - -rem Add additional substitutions here, branching to report - -rem assume it's a version number without 'v' -set COMPLUS_Version=v%COMPLUS_Version% - -:report -echo Setting CLR version to %COMPLUS_Version% -goto done - -:GetVersion -if "%COMPLUS_Version%"=="" echo CLR version is not set -if NOT "%COMPLUS_Version%"=="" echo CLR version is set to %COMPLUS_Version% -goto done - -:RemoveVersion -set COMPLUS_Version= -echo CLR version is no longer set - -:done \ No newline at end of file diff --git a/tools/nunit/fit.dll b/tools/nunit/fit.dll deleted file mode 100644 index 40bbef0e29..0000000000 Binary files a/tools/nunit/fit.dll and /dev/null differ diff --git a/tools/nunit/license.html b/tools/nunit/license.html deleted file mode 100644 index b56782ffab..0000000000 --- a/tools/nunit/license.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - -NUnit - License - - - - - - - - - - - - - -
- -

License

- -

Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. -Vorontsov, Charlie Poole
-Copyright © 2000-2004 Philip A. Craig

-

This software is provided 'as-is', without any express or implied warranty. In - no event will the authors be held liable for any damages arising from the use - of this software.

-

Permission is granted to anyone to use this software for any purpose, including - commercial applications, and to alter it and redistribute it freely, subject to - the following restrictions:

-

1. The origin of this software must not be misrepresented; you must not claim - that you wrote the original software. If you use this software in a product, an - acknowledgment (see the following) in the product documentation is required.

-

Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. - Vorontsov or Copyright © 2000-2002 Philip A. Craig

-

2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software.

-

3. This notice may not be removed or altered from any source distribution.

- -

License Note

-

This license is based on -the open source zlib/libpng license. The idea was to keep the license -as simple as possible to encourage use of NUnit in free and commercial -applications and libraries, but to keep the source code together and to give -credit to the NUnit contributors for their efforts. While this license allows -shipping NUnit in source and binary form, if shipping a NUnit variant is the -sole purpose of your product, please let -us know.

- -
- - - - - - - - - - - - diff --git a/tools/nunit/loadtest-assembly.dll b/tools/nunit/loadtest-assembly.dll deleted file mode 100644 index 56b12eae5b..0000000000 Binary files a/tools/nunit/loadtest-assembly.dll and /dev/null differ diff --git a/tools/nunit/mock-assembly.dll b/tools/nunit/mock-assembly.dll deleted file mode 100644 index 2e70dca808..0000000000 Binary files a/tools/nunit/mock-assembly.dll and /dev/null differ diff --git a/tools/nunit/mock-assembly.dll.config b/tools/nunit/mock-assembly.dll.config deleted file mode 100644 index 22f0349409..0000000000 --- a/tools/nunit/mock-assembly.dll.config +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/nonamespace-assembly.dll b/tools/nunit/nonamespace-assembly.dll deleted file mode 100644 index 0be3054bb7..0000000000 Binary files a/tools/nunit/nonamespace-assembly.dll and /dev/null differ diff --git a/tools/nunit/notestfixtures-assembly.dll b/tools/nunit/notestfixtures-assembly.dll deleted file mode 100644 index 104e3d4c45..0000000000 Binary files a/tools/nunit/notestfixtures-assembly.dll and /dev/null differ diff --git a/tools/nunit/nunit-console-runner.dll b/tools/nunit/nunit-console-runner.dll deleted file mode 100644 index f2dae538b3..0000000000 Binary files a/tools/nunit/nunit-console-runner.dll and /dev/null differ diff --git a/tools/nunit/nunit-console-x86.exe b/tools/nunit/nunit-console-x86.exe deleted file mode 100644 index f964cb5802..0000000000 Binary files a/tools/nunit/nunit-console-x86.exe and /dev/null differ diff --git a/tools/nunit/nunit-console-x86.exe.config b/tools/nunit/nunit-console-x86.exe.config deleted file mode 100644 index b52af5fa71..0000000000 --- a/tools/nunit/nunit-console-x86.exe.config +++ /dev/null @@ -1,110 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/nunit-console.exe b/tools/nunit/nunit-console.exe deleted file mode 100644 index 35feb52d87..0000000000 Binary files a/tools/nunit/nunit-console.exe and /dev/null differ diff --git a/tools/nunit/nunit-console.exe.config b/tools/nunit/nunit-console.exe.config deleted file mode 100644 index bdb206f865..0000000000 --- a/tools/nunit/nunit-console.exe.config +++ /dev/null @@ -1,117 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/nunit-console.tests.dll b/tools/nunit/nunit-console.tests.dll deleted file mode 100644 index 39cb9d4fce..0000000000 Binary files a/tools/nunit/nunit-console.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit-gui-runner.dll b/tools/nunit/nunit-gui-runner.dll deleted file mode 100644 index cfae55db95..0000000000 Binary files a/tools/nunit/nunit-gui-runner.dll and /dev/null differ diff --git a/tools/nunit/nunit-gui.exe b/tools/nunit/nunit-gui.exe deleted file mode 100644 index b40112b4f8..0000000000 Binary files a/tools/nunit/nunit-gui.exe and /dev/null differ diff --git a/tools/nunit/nunit-gui.exe.config b/tools/nunit/nunit-gui.exe.config deleted file mode 100644 index 3035c12e2c..0000000000 --- a/tools/nunit/nunit-gui.exe.config +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/nunit-gui.tests.dll b/tools/nunit/nunit-gui.tests.dll deleted file mode 100644 index a74e087315..0000000000 Binary files a/tools/nunit/nunit-gui.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit-server.exe b/tools/nunit/nunit-server.exe deleted file mode 100644 index 4ad5068adf..0000000000 Binary files a/tools/nunit/nunit-server.exe and /dev/null differ diff --git a/tools/nunit/nunit-server.tests.dll b/tools/nunit/nunit-server.tests.dll deleted file mode 100644 index f74d7f4237..0000000000 Binary files a/tools/nunit/nunit-server.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit-test-server.dll b/tools/nunit/nunit-test-server.dll deleted file mode 100644 index 2a97f029e4..0000000000 Binary files a/tools/nunit/nunit-test-server.dll and /dev/null differ diff --git a/tools/nunit/nunit-x86.exe b/tools/nunit/nunit-x86.exe deleted file mode 100644 index e894f17333..0000000000 Binary files a/tools/nunit/nunit-x86.exe and /dev/null differ diff --git a/tools/nunit/nunit-x86.exe.config b/tools/nunit/nunit-x86.exe.config deleted file mode 100644 index 89dae01a42..0000000000 --- a/tools/nunit/nunit-x86.exe.config +++ /dev/null @@ -1,121 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/nunit.core.dll b/tools/nunit/nunit.core.dll deleted file mode 100644 index a31edfdd9e..0000000000 Binary files a/tools/nunit/nunit.core.dll and /dev/null differ diff --git a/tools/nunit/nunit.core.extensions.dll b/tools/nunit/nunit.core.extensions.dll deleted file mode 100644 index ca1ce33531..0000000000 Binary files a/tools/nunit/nunit.core.extensions.dll and /dev/null differ diff --git a/tools/nunit/nunit.core.interfaces.dll b/tools/nunit/nunit.core.interfaces.dll deleted file mode 100644 index 2c48764c8a..0000000000 Binary files a/tools/nunit/nunit.core.interfaces.dll and /dev/null differ diff --git a/tools/nunit/nunit.core.tests.dll b/tools/nunit/nunit.core.tests.dll deleted file mode 100644 index ca04c8f7cf..0000000000 Binary files a/tools/nunit/nunit.core.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit.exe b/tools/nunit/nunit.exe deleted file mode 100644 index d9ea11a545..0000000000 Binary files a/tools/nunit/nunit.exe and /dev/null differ diff --git a/tools/nunit/nunit.exe.config b/tools/nunit/nunit.exe.config deleted file mode 100644 index 89dae01a42..0000000000 --- a/tools/nunit/nunit.exe.config +++ /dev/null @@ -1,121 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/nunit/nunit.extensions.tests.dll b/tools/nunit/nunit.extensions.tests.dll deleted file mode 100644 index adbaa185e9..0000000000 Binary files a/tools/nunit/nunit.extensions.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit.fixtures.dll b/tools/nunit/nunit.fixtures.dll deleted file mode 100644 index bb4c00a035..0000000000 Binary files a/tools/nunit/nunit.fixtures.dll and /dev/null differ diff --git a/tools/nunit/nunit.fixtures.tests.dll b/tools/nunit/nunit.fixtures.tests.dll deleted file mode 100644 index 665773362b..0000000000 Binary files a/tools/nunit/nunit.fixtures.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit.framework.dll b/tools/nunit/nunit.framework.dll deleted file mode 100644 index 2a0a0aa326..0000000000 Binary files a/tools/nunit/nunit.framework.dll and /dev/null differ diff --git a/tools/nunit/nunit.framework.extensions.dll b/tools/nunit/nunit.framework.extensions.dll deleted file mode 100644 index 91e05857a6..0000000000 Binary files a/tools/nunit/nunit.framework.extensions.dll and /dev/null differ diff --git a/tools/nunit/nunit.framework.tests.dll b/tools/nunit/nunit.framework.tests.dll deleted file mode 100644 index 372a97cae8..0000000000 Binary files a/tools/nunit/nunit.framework.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit.framework.xml b/tools/nunit/nunit.framework.xml deleted file mode 100644 index 911ebf8b8a..0000000000 --- a/tools/nunit/nunit.framework.xml +++ /dev/null @@ -1,5622 +0,0 @@ - - - - nunit.framework - - - - - EmptyStringConstraint tests whether a string is empty. - - - - - EmptyConstraint tests a whether a string or collection is empty, - postponing the decision about which test is applied until the - type of the actual argument is known. - - - - - The Constraint class is the base of all built-in or - user-defined constraints in NUnit. It provides the operator - overloads used to combine constraints. - - - - - Static UnsetObject used to detect derived constraints - failing to set the actual value. - - - - - If true, all string comparisons will ignore case - - - - - If true, strings in error messages will be clipped - - - - - If true, arrays will be treated as collections, allowing - those of different dimensions to be compared - - - - - If non-zero, equality comparisons within the specified - tolerance will succeed. - - - - - IComparer object used in comparisons for some constraints. - - - - - The actual value being tested against a constraint - - - - - Flag the constraint to use a tolerance when determining equality. - Currently only used for doubles and floats. - - Tolerance to be used - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Write the failure message to the MessageWriter provided - as an argument. The default implementation simply passes - the constraint and the actual value to the writer, which - then displays the constraint description and the value. - - Constraints that need to provide additional details, - such as where the error occured can override this. - - The MessageWriter on which to display the message - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Flag the constraint to ignore case and return self. - - - - - Flag the constraint to suppress string clipping - and return self. - - - - - Flag the constraint to compare arrays as collections - and return self. - - - - - Class used to detect any derived constraints - that fail to set the actual value in their - Matches override. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubstringConstraint can test whether a string contains - the expected substring. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - StartsWithConstraint can test whether a string starts - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EndsWithConstraint can test whether a string ends - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - RegexConstraint can test whether a string matches - the pattern provided. - - - - - Initializes a new instance of the class. - - The pattern. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ConstraintBuilder is used to resolve the Not and All properties, - which serve as prefix operators for constraints. With the addition - of an operand stack, And and Or could be supported, but we have - left them out in favor of a simpler, more type-safe implementation. - Use the & and | operator overloads to combine constraints. - - - - - Implicitly convert ConstraintBuilder to an actual Constraint - at the point where the syntax demands it. - - - - - - - Resolves the chain of constraints using an - EqualConstraint as base. - - - - - Resolves the chain of constraints using a - SameAsConstraint as base. - - - - - Resolves the chain of constraints using a - LessThanConstraint as base. - - - - - Resolves the chain of constraints using a - GreaterThanConstraint as base. - - - - - Resolves the chain of constraints using a - LessThanOrEqualConstraint as base. - - - - - Resolves the chain of constraints using a - LessThanOrEqualConstraint as base. - - - - - Resolves the chain of constraints using a - GreaterThanOrEqualConstraint as base. - - - - - Resolves the chain of constraints using a - GreaterThanOrEqualConstraint as base. - - - - - Resolves the chain of constraints using an - ExactTypeConstraint as base. - - - - - Resolves the chain of constraints using an - InstanceOfTypeConstraint as base. - - - - - Resolves the chain of constraints using an - AssignableFromConstraint as base. - - - - - Resolves the chain of constraints using a - ContainsConstraint as base. This constraint - will, in turn, make use of the appropriate - second-level constraint, depending on the - type of the actual argument. - - - - - Resolves the chain of constraints using a - CollectionContainsConstraint as base. - - The expected object - - - - Resolves the chain of constraints using a - StartsWithConstraint as base. - - - - - Resolves the chain of constraints using a - StringEndingConstraint as base. - - - - - Resolves the chain of constraints using a - StringMatchingConstraint as base. - - - - - Resolves the chain of constraints using a - CollectionEquivalentConstraint as base. - - - - - Resolves the chain of constraints using a - CollectionContainingConstraint as base. - - - - - Resolves the chain of constraints using a - CollectionSubsetConstraint as base. - - - - - Resolves the chain of constraints using a - PropertyConstraint as base - - - - - Resolves the chain of constraints using a - PropertyCOnstraint on Length as base - - - - - - - Resolves the chain of constraints using a - PropertyCOnstraint on Length as base - - - - - - - Modifies the ConstraintBuilder by pushing a Prop operator on the - ops stack and the name of the property on the opnds stack. - - - - - - - Resolve a constraint that has been recognized by applying - any pending operators and returning the resulting Constraint. - - A constraint that incorporates all pending operators - - - - Resolves the chain of constraints using - EqualConstraint(null) as base. - - - - - Resolves the chain of constraints using - EqualConstraint(true) as base. - - - - - Resolves the chain of constraints using - EqualConstraint(false) as base. - - - - - Resolves the chain of constraints using - Is.NaN as base. - - - - - Resolves the chain of constraints using - Is.Empty as base. - - - - - Resolves the chain of constraints using - Is.Unique as base. - - - - - Modifies the ConstraintBuilder by pushing a Not operator on the stack. - - - - - Modifies the ConstraintBuilder by pushing a Not operator on the stack. - - - - - Modifies the ConstraintBuilder by pushing an All operator on the stack. - - - - - Modifies the ConstraintBuilder by pushing a Some operator on the stack. - - - - - Modifies the constraint builder by pushing All and Not operators on the stack - - - - - CollectionConstraint is the abstract base class for - constraints that operate on collections. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Protected method to be implemented by derived classes - - - - - - - CollectionTally counts (tallies) the number of - occurences of each object in one or more enuerations. - - - - - Construct a CollectionTally object from a collection - - - - - - Remove the counts for a collection from the tally, - so long as their are sufficient items to remove. - The tallies are not permitted to become negative. - - The collection to remove - True if there were enough items to remove, otherwise false - - - - Test whether all the counts are equal to a given value - - The value to be looked for - True if all counts are equal to the value, otherwise false - - - - Get the count of the number of times an object is present in the tally - - - - - EmptyCollectionConstraint tests whether a colletion is empty. - - - - - Check that the collection is empty - - - - - - - Write the constraint description to a MessageWriter - - - - - - UniqueItemsConstraint tests whether all the items in a - collection are unique. - - - - - Check that all items are unique. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionContainsConstraint is used to test whether a collection - contains an expected object as a member. - - - - - Construct a CollectionContainsConstraint - - - - - - Test whether the expected item is contained in the collection - - - - - - - Write a descripton of the constraint to a MessageWriter - - - - - - CollectionEquivalentCOnstraint is used to determine whether two - collections are equivalent. - - - - - Construct a CollectionEquivalentConstraint - - - - - - Test whether two collections are equivalent - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionSubsetConstraint is used to determine whether - one collection is a subset of another - - - - - Construct a CollectionSubsetConstraint - - The collection that the actual value is expected to be a subset of - - - - Test whether the actual collection is a subset of - the expected collection provided. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - EqualConstraint is able to compare an actual value with the - expected value provided in its constructor. - - - - - Initializes a new instance of the class. - - The expected value. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write a failure message. Overridden to provide custom - failure messages for EqualConstraint. - - The MessageWriter to write to - - - - Write description of this constraint - - The MessageWriter to write to - - - - Helper method to compare two arrays - - - - - Method to compare two DirectoryInfo objects - - first directory to compare - second directory to compare - true if equivalent, false if not - - - - Display the failure information for two collections that did not match. - - The MessageWriter on which to display - The expected collection. - The actual collection - The depth of this failure in a set of nested collections - - - - Displays a single line showing the types and sizes of the expected - and actual collections or arrays. If both are identical, the value is - only shown once. - - The MessageWriter on which to display - The expected collection or array - The actual collection or array - The indentation level for the message line - - - - Displays a single line showing the point in the expected and actual - arrays at which the comparison failed. If the arrays have different - structures or dimensions, both values are shown. - - The MessageWriter on which to display - The expected array - The actual array - Index of the failure point in the underlying collections - The indentation level for the message line - - - - Abstract base class used for prefixes - - - - - The base constraint - - - - - Construct given a base constraint - - - - - - Set all modifiers applied to the prefix into - the base constraint before matching - - - - - NotConstraint negates the effect of some other constraint - - - - - Initializes a new instance of the class. - - The base constraint to be negated. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - AllItemsConstraint applies another constraint to each - item in a collection, succeeding if they all succeed. - - - - - Construct an AllItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SomeItemsConstraint applies another constraint to each - item in a collection, succeeding if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SomeItemsConstraint applies another constraint to each - item in a collection, succeeding if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SameAsConstraint tests whether an object is identical to - the object passed to its constructor - - - - - Initializes a new instance of the class. - - The expected object. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - TypeConstraint is the abstract base for constraints - that take a Type as their expected value. - - - - - The expected Type used by the constraint - - - - - Construct a TypeConstraint for a given Type - - - - - - Write the actual value for a failing constraint test to a - MessageWriter. TypeCOnstraints override this method to write - the name of the type. - - The writer on which the actual value is displayed - - - - ExactTypeConstraint is used to test that an object - is of the exact type provided in the constructor - - - - - Construct an ExactTypeConstraint for a given Type - - - - - - Test that an object is of the exact type specified - - - - - - - Write the description of this constraint to a MessageWriter - - - - - - InstanceOfTypeConstraint is used to test that an object - is of the same type provided or derived from it. - - - - - Construct an InstanceOfTypeConstraint for the type provided - - - - - - Test whether an object is of the specified type or a derived type - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - AssignableFromConstraint is used to test that an object - can be assigned from a given Type. - - - - - Construct an AssignableFromConstraint for the type provided - - - - - - Test whether an object can be assigned from the specified type - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - Abstract base class for constraints that compare values to - determine if one is greater than, equal to or less than - the other. - - - - - The value against which a comparison is to be made - - - - - If true, less than returns success - - - - - if true, equal returns success - - - - - if true, greater than returns success - - - - - The predicate used as a part of the description - - - - - Initializes a new instance of the class. - - The value against which to make a comparison. - if set to true less succeeds. - if set to true equal succeeds. - if set to true greater succeeds. - String used in describing the constraint. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Tests whether a value is greater than the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is greater than or equal to the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is less than the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - Tests whether a value is less than or equal to the value supplied to its constructor - - - - - Initializes a new instance of the class. - - The expected value. - - - - The Numerics class contains common operations on numeric values. - - - - - Checks the type of the object, returning true if - the object is a numeric type. - - The object to check - true if the object is a numeric type - - - - Checks the type of the object, returning true if - the object is a floating point numeric type. - - The object to check - true if the object is a floating point numeric type - - - - Checks the type of the object, returning true if - the object is a fixed point numeric type. - - The object to check - true if the object is a fixed point numeric type - - - - Test two numeric values for equality, performing the usual numeric - conversions and using a provided or default tolerance. If the value - referred to by tolerance is null, this method may set it to a default. - - The expected value - The actual value - A reference to the numeric tolerance in effect - True if the values are equal - - - - Compare two numeric values, performing the usual numeric conversions. - - The expected value - The actual value - - - - - ContainsConstraint tests a whether a string contains a substring - or a collection contains an object. It postpones the decision of - which test to use until the type of the actual argument is known. - This allows testing whether a string is contained in a collection - or as a substring of another string using the same syntax. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Summary description for PropertyConstraint. - - - - - Initializes a new instance of the class. - - The name. - The constraint to apply to the property. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - BinaryOperation is the abstract base of all constraints - that combine two other constraints in some fashion. - - - - - The first constraint being combined - - - - - The second constraint being combined - - - - - Construct a BinaryOperation from two other constraints - - The first constraint - The second constraint - - - - AndConstraint succeeds only if both members succeed. - - - - - Create an AndConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply both member constraints to an actual value, succeeding - succeeding only if both of them succeed. - - The actual value - True if the constraints both succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - OrConstraint succeeds if either member succeeds - - - - - Create an OrConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply the member constraints to an actual value, succeeding - succeeding as soon as one of them succeeds. - - The actual value - True if either constraint succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - The Is class is a helper class with properties and methods - that supply a number of constraints used in Asserts. - - - - - Is.Null returns a static constraint that tests for null - - - - - Is.True returns a static constraint that tests whether a value is true - - - - - Is.False returns a static constraint that tests whether a value is false - - - - - Is.NaN returns a static constraint that tests whether a value is an NaN - - - - - Is.Empty returns a static constraint that tests whether a string or collection is empty - - - - - Is.Unique returns a static constraint that tests whether a collection contains all unque items. - - - - - Is.EqualTo returns a constraint that tests whether the - actual value equals the supplied argument - - - - - - - Is.SameAs returns a constraint that tests whether the - actual value is the same object as the supplied argument. - - - - - - - Is.GreaterThan returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Is.GreaterThanOrEqualTo returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Is.AtLeast is a synonym for Is.GreaterThanOrEqualTo - - - - - Is.LessThan returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Is.LessThanOrEqualTo returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Is.AtMost is a synonym for Is.LessThanOrEqualTo - - - - - Is.TypeOf returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Is.InstanceOfType returns a constraint that tests whether - the actual value is of the type supplied as an argument - or a derived type. - - - - - Is.AssignableFrom returns a constraint that tests whether - the actual value is assignable from the type supplied as - an argument. - - - - - - - Is.EquivalentTo returns a constraint that tests whether - the actual value is a collection containing the same - elements as the collection supplied as an arument - - - - - Is.SubsetOf returns a constraint that tests whether - the actual value is a subset of the collection - supplied as an arument - - - - - Is.Not returns a ConstraintBuilder that negates - the constraint that follows it. - - - - - Is.All returns a ConstraintBuilder, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. This property is - a synonym for Has.AllItems. - - - - - The Iz class is a synonym for Is intended for use in VB, - which regards Is as a keyword. - - - - - The Text class is a helper class with properties and methods - that supply a number of constraints used with strings. - - - - - Contains returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - DoesNotContain returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - StartsWith returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - DoesNotStartWith returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - EndsWith returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - DoesNotEndWith returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Matches returns a constraint that succeeds if the actual - value matches the pattern supplied as an argument. - - - - - - - DoesNotMatch returns a constraint that failss if the actual - value matches the pattern supplied as an argument. - - - - - - - Text.All returns a ConstraintBuilder, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - The List class is a helper class with properties and methods - that supply a number of constraints used with lists and collections. - - - - - List.Map returns a ListMapper, which can be used to map - the original collection to another collection. - - - - - - - ListMapper is used to transform a collection used as an actual argument - producing another collection to be used in the assertion. - - - - - Construct a ListMapper based on a collection - - The collection to be transformed - - - - Produces a collection containing all the values of a property - - The collection of property values - - - - - Summary description for HasNoPrefixB. - - - - - Returns a new ConstraintBuilder, which will apply the - following constraint to a named property of the object - being tested. - - The name of the property - - - - Returns a new PropertyConstraint checking for the - existence of a particular property value. - - The name of the property to look for - The expected value of the property - - - - Returns a new PropertyConstraint for the Length property - - - - - - - Returns a new PropertyConstraint or the Count property - - - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - The expected object - - - - Has.No returns a ConstraintBuilder that negates - the constraint that follows it. - - - - - Has.AllItems returns a ConstraintBuilder, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Has.Some returns a ConstraintBuilder, which will apply - the following constraint to all members of a collection, - succeeding if any of them succeed. It is a synonym - for Has.Item. - - - - - Has.None returns a ConstraintBuilder, which will apply - the following constraint to all members of a collection, - succeeding only if none of them succeed. - - - - - Nested class that allows us to restrict the number - of key words that may appear after Has.No. - - - - - Return a ConstraintBuilder conditioned to apply - the following constraint to a property. - - The property name - A ConstraintBuilder - - - - Return a Constraint that succeeds if the expected object is - not contained in a collection. - - The expected object - A Constraint - - - - The Assert class contains a collection of static methods that - implement the most common assertions used in NUnit. - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display if the condition is true - Arguments to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display if the condition is true - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to be displayed when the object is null - Arguments to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to be displayed when the object is null - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to be displayed when the object is not null - Arguments to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to be displayed when the object is not null - - - - Verifies that the object that is passed in is equal to null - If the object is not null null then an - is thrown. - - The object that is to be tested - - - - Verifies that the double is passed is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to be displayed when the object is not null - Arguments to be used in formatting the message - - - - Verifies that the double is passed is an NaN value. - If the object is not NaN then an - is thrown. - - The object that is to be tested - The message to be displayed when the object is not null - - - - Verifies that the double is passed is an NaN value. - If the object is not NaN then an - is thrown. - - The object that is to be tested - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that a string is empty - that is equal to string.Emtpy - - The string to be tested - The message to be displayed on failure - - - - Assert that a string is empty - that is equal to string.Emtpy - - The string to be tested - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that a string is empty - that is equal to string.Emtpy - - The string to be tested - The message to be displayed on failure - - - - Assert that a string is empty - that is equal to string.Emtpy - - The string to be tested - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing ICollection - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The messge to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The messge to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - A message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - A message to display in case of failure - An array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - A message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - A message to display in case of failure - An array of objects to be used in formatting the message - - - - Verifies that two ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that two ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - - - - Verifies that two ints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that two longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - - - - Verifies that two longs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two uints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that two uints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - - - - Verifies that two uints are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two ulongs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that two ulongs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - - - - Verifies that two ulongs are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two decimals are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that two decimal are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message that will be displayed on failure - - - - Verifies that two decimals are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equals then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equals then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message that will be displayed on failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equals then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two floats are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equals then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message displayed upon failure - Arguments to be used in formatting the message - - - - Verifies that two floats are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equals then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message displayed upon failure - - - - Verifies that two floats are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equals then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. All - non-numeric types are compared by using the Equals method. - Arrays are compared by comparing each element using the same rules. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display if objects are not equal - Arguments to be used in formatting the message - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. All - non-numeric types are compared by using the Equals method. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display if objects are not equal - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. All - non-numeric types are compared by using the Equals method. - If they are not equal an is thrown. - - The value that is expected - The actual value - - - - Asserts that two objects are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two objects are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two objects are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two ints are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two ints are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two ints are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two longss are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two longs are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two longs are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two uints are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two uints are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two uints are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two ulongs are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two ulongs are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two ulong are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two decimals are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two decimals are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two decimals are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two floats are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two floats are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two floats are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two doubles are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two doubles are not equal. If they are equal - an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two doubles are not equal. If they are equal - an is thrown. - - The expected object - The actual object - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are not the same object. - Arguments to be used in formatting the message - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to be displayed when the object is null - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to be displayed when the two objects are the same object. - Arguments to be used in formatting the message - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to be displayed when the objects are the same - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - - - - Throws an with the message and arguments - that are passed in. This is used by the other Assert functions. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This is used by the other Assert functions. - - The message to initialize the with. - - - - Throws an . - This is used by the other Assert functions. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as ignored. - - - - - NOTE: The use of asserters for extending NUnit has - now been replaced by the use of constraints. This - method is marked obsolete. - - Test the condition asserted by an asserter and throw - an assertion exception using provided message on failure. - - An object that implements IAsserter - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeedingt if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeedingt if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater or equal to than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater or equal to than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater or equal to than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than or equal to the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message that will be displayed on failure - - - - Verifies that the first value is greater than the second - value. If they are not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message that will be displayed on failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Gets the number of assertions executed so far and - resets the counter to zero. - - - - - Enumeration indicating how the expected message parameter is to be used - - - - Expect an exact match - - - Expect a message containing the parameter string - - - Match the regular expression provided as a parameter - - - - ExpectedExceptionAttribute - - - - - - Constructor for a non-specific exception - - - - - Constructor for a given type of exception - - The type of the expected exception - - - - Constructor for a given exception name - - The full name of the expected exception - - - - Constructor for a given type of exception and expected message text - - The type of the expected exception - The expected message text - - - - Constructor for a given exception name and expected message text - - The full name of the expected exception - The expected messge text - - - - Gets or sets the expected exception type - - - - - Gets or sets the full Type name of the expected exception - - - - - Gets or sets the expected message text - - - - - Gets or sets the user message displayed in case of failure - - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets the name of a method to be used as an exception handler - - - - - A set of Assert methods operationg on one or more collections - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - The message that will be displayed on failure - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - NOTE: The use of asserters for extending NUnit has - now been replaced by the use of constraints. This - class is marked obsolete. - - AbstractAsserter is the base class for all asserters. - Asserters encapsulate a condition test and generation - of an AssertionException with a tailored message. They - are used by the Assert class as helper objects. - - User-defined asserters may be passed to the - Assert.DoAssert method in order to implement - extended asserts. - - - - - NOTE: The use of asserters for extending NUnit has - now been replaced by the use of constraints. This - interface is marked obsolete. - - The interface implemented by an asserter. Asserters - encapsulate a condition test and generation of an - AssertionException with a tailored message. They - are used by the Assert class as helper objects. - - User-defined asserters may be passed to the - Assert.DoAssert method in order to implement - extended asserts. - - - - - Test the condition for the assertion. - - True if the test succeeds - - - - Return the message giving the failure reason. - The return value is unspecified if no failure - has occured. - - - - - The user-defined message for this asserter. - - - - - Arguments to use in formatting the user-defined message. - - - - - Our failure message object, initialized as needed - - - - - Constructs an AbstractAsserter - - The message issued upon failure - Arguments to be used in formatting the message - - - - Test method to be implemented by derived types. - Default always succeeds. - - True if the test succeeds - - - - AssertionFailureMessage object used internally - - - - - Message related to a failure. If no failure has - occured, the result is unspecified. - - - - - The Assertion class is obsolete and has been - replaced by the Assert class. - - - - - Asserts that a condition is true. If it isn't it throws - an . - - The message to display is the condition - is false - The evaluated condition - - - - Asserts that a condition is true. If it isn't it throws - an . - - The evaluated condition - - - - /// Asserts that two doubles are equal concerning a delta. If the - expected value is infinity then the delta value is ignored. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - /// Asserts that two singles are equal concerning a delta. If the - expected value is infinity then the delta value is ignored. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - Asserts that two objects are equal. If they are not - an is thrown. - - - Asserts that two ints are equal. If they are not - an is thrown. - - - Asserts that two ints are equal. If they are not - an is thrown. - - - Asserts that two doubles are equal concerning a delta. - If the expected value is infinity then the delta value is ignored. - - - - Asserts that two floats are equal concerning a delta. - If the expected value is infinity then the delta value is ignored. - - - - - Asserts that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. Numeric - types are compared via string comparision on their contents to - avoid problems comparing values between different types. All - non-numeric types are compared by using the Equals method. - If they are not equal an is thrown. - - - - Asserts that an object isn't null. - - - Asserts that an object isn't null. - - - Asserts that an object is null. - - - Asserts that an object is null. - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - - - Asserts that two objects refer to the same object. - If they are not an is thrown. - - - - Fails a test with no message. - - - Fails a test with the given message. - - - - Thrown when an assertion failed. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - AssertionFailureMessage encapsulates a failure message - issued as a result of an Assert failure. - - - - - Number of characters before a highlighted position before - clipping will occur. Clipped text is replaced with an - elipsis "..." - - - - - Number of characters after a highlighted position before - clipping will occur. Clipped text is replaced with an - elipsis "..." - - - - - Prefix used to start an expected value line. - Must be same length as actualPrefix. - - - - - Prefix used to start an actual value line. - Must be same length as expectedPrefix. - - - - - Construct an AssertionFailureMessage with a message - and optional arguments. - - - - - - - Construct an empty AssertionFailureMessage - - - - - Add an expected value line to the message containing - the text provided as an argument. - - Text describing what was expected. - - - - Add an actual value line to the message containing - the text provided as an argument. - - Text describing the actual value. - - - - Add an expected value line to the message containing - a string representation of the object provided. - - An object representing the expected value - - - - Add an expected value line to the message containing a double - and the tolerance used in making the comparison. - - The expected value - The tolerance specified in the Assert - - - - Add an actual value line to the message containing - a string representation of the object provided. - - An object representing what was actually found - - - - Display two lines that communicate the expected value, and the actual value - - The expected value - The actual value found - - - - Display two lines that communicate the expected value, the actual value and - the tolerance used in comparing two doubles. - - The expected value - The actual value found - The tolerance specified in the Assert - - - - Draws a marker under the expected/actual strings that highlights - where in the string a mismatch occurred. - - The position of the mismatch - - - - Reports whether the string lengths are the same or different, and - what the string lengths are. - - The expected string - The actual string value - - - - Called to create additional message lines when two objects have been - found to be unequal. If the inputs are strings, a special message is - rendered that can help track down where the strings are different, - based on differences in length, or differences in content. - - If the inputs are not strings, the ToString method of the objects - is used to show what is different about them. - - The expected value - The actual value - True if a case-insensitive comparison is being performed - - - - Called to create additional message lines when two doubles have been - found to be unequal, within the specified tolerance. - - - - - Constructs a message that can be displayed when the content of two - strings are different, but the string lengths are the same. The - message will clip the strings to a reasonable length, centered - around the first position where they are mismatched, and draw - a line marking the position of the difference to make comparison - quicker. - - The expected string value - The actual string value - True if a case-insensitive comparison is being performed - - - - Display a standard message showing the differences found between - two arrays that were expected to be equal. - - The expected array value - The actual array value - The index at which a difference was found - - - - Display a standard message showing the differences found between - two collections that were expected to be equal. - - The expected collection value - The actual collection value - The index at which a difference was found - - - - Get an array of indices representing the point in a collection or - array corresponding to a single int index into the collection. - - The collection to which the indices apply - Index in the collection - Array of indices - - - - Displays elements from a list on a line - - Text to prefix the line with - The list of items to display - The index in the list of the first element to display - The maximum number of elements to display - - - - Formats an object for display in a message line - - The object to be displayed - - - - - Tests two objects to determine if they are strings. - - - - - - - - Renders up to M characters before, and up to N characters after - the specified index position. If leading or trailing text is - clipped, and elipses "..." is added where the missing text would - be. - - Clips strings to limit previous or post newline characters, - since these mess up the comparison - - - - - - - - Shows the position two strings start to differ. Comparison - starts at the start index. - - - - - -1 if no mismatch found, or the index where mismatch found - - - - Turns CR, LF, or TAB into visual indicator to preserve visual marker - position. This is done by replacing the '\r' into '\\' and 'r' - characters, and the '\n' into '\\' and 'n' characters, and '\t' into - '\\' and 't' characters. - - Thus the single character becomes two characters for display. - - - - - - - Attribute used to apply a category to a test - - - - - The name of the category - - - - - Construct attribute for a given category - - The name of the category - - - - Protected constructor uses the Type name as the name - of the category. - - - - - The name of the category - - - - - Abstract base for Attributes that are used to include tests - in the test run based on environmental settings. - - - - - Constructor with no included items specified, for use - with named property syntax. - - - - - Constructor taking one or more included items - - Comma-delimited list of included items - - - - Name of the item that is needed in order for - a test to run. Multiple itemss may be given, - separated by a comma. - - - - - Name of the item to be excluded. Multiple items - may be given, separated by a comma. - - - - - The reason for including or excluding the test - - - - - PlatformAttribute is used to mark a test fixture or an - individual method as applying to a particular platform only. - - - - - Constructor with no platforms specified, for use - with named property syntax. - - - - - Constructor taking one or more platforms - - Comma-deliminted list of platforms - - - - CultureAttribute is used to mark a test fixture or an - individual method as applying to a particular Culture only. - - - - - Constructor with no cultures specified, for use - with named property syntax. - - - - - Constructor taking one or more cultures - - Comma-deliminted list of cultures - - - - MessageWriter is the abstract base for classes that write - constraint descriptions and messages in some form. The - class has separate methods for writing various components - of a message, allowing implementations to tailor the - presentation as needed. - - - - - Construct a MessageWriter given a culture - - - - - Method to write single line message with optional args, usually - written to precede the general failure message. - - The message to be written - Any arguments used in formatting the message - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the Expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in locating the point where the strings differ - If true, the strings should be clipped to fit the line - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for a modifier - - The modifier. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Abstract method to get the max line length - - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Returns the representation of a type as used in NUnitLite. - This is the same as Type.ToString() except for arrays, - which are displayed with their declared sizes. - - - - - - - Converts any control characters in a string - to their escaped representation. - - The string to be converted - The converted string - - - - Return the a string representation for a set of indices into an array - - Array of indices for which a string is needed - - - - Get an array of indices representing the point in a collection or - array corresponding to a single int index into the collection. - - The collection to which the indices apply - Index in the collection - Array of indices - - - - Clip a string to a given length, starting at a particular offset, returning the clipped - string with ellipses representing the removed parts - - The string to be clipped - The maximum permitted length of the result string - The point at which to start clipping - The clipped string - - - - Clip the expected and actual strings in a coordinated fashion, - so that they may be displayed together. - - - - - - - - - Shows the position two strings start to differ. Comparison - starts at the start index. - - The expected string - The actual string - The index in the strings at which comparison should start - Boolean indicating whether case should be ignored - -1 if no mismatch found, or the index where mismatch found - - - - Summary description for SetCultureAttribute. - - - - - PropertyAttribute is used to attach information to a test as a name/value pair.. - - - - - The property name - - - - - The property value - - - - - Construct a PropertyAttribute with a name and value - - The name of the property - The property value - - - - Constructor for use by inherited classes that use the - name of the type as the property name. - - - - - Gets the property name - - - - - Gets the property value - - - - - Construct given the name of a culture - - - - - - TextMessageWriter writes constraint descriptions and messages - in displayable form as a text stream. It tailors the display - of individual message components to form the standard message - format of NUnit assertion failure messages. - - - - - Prefix used for the expected value line of a message - - - - - Prefix used for the actual value line of a message - - - - - Length of a message prefix - - - - - Construct a TextMessageWriter - - - - - Construct a TextMessageWriter, specifying a user message - and optional formatting arguments. - - - - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in string comparisons - If true, clip the strings to fit the max line length - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Write the text for a modifier. - - The modifier. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Write the generic 'Expected' line for a constraint - - The constraint that failed - - - - Write the generic 'Expected' line for a given value - - The expected value - - - - Write the generic 'Expected' line for a given value - and tolerance. - - The expected value - The tolerance within which the test was made - - - - Write the generic 'Actual' line for a constraint - - The constraint for which the actual value is to be written - - - - Write the generic 'Actual' line for a given value - - The actual value causing a failure - - - - Gets or sets the maximum line length for this writer - - - - - Basic Asserts on strings. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - - - - Asserts that a string matches an expected regular expression pattern. - - The expected expression - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string matches an expected regular expression pattern. - - The expected expression - The actual string - The message to display in case of failure - - - - Asserts that a string matches an expected regular expression pattern. - - The expected expression - The actual string - - - - AssertionHelper is an optional base class for user tests, - allowing the use of shorter names for constraints and - asserts and avoiding conflict with the definition of - , from which it inherits much of its - behavior, in certain mock object frameworks. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to - . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to - . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to . - - The evaluated condition - - - - Returns a ListMapper based on a collection. - - The original collection - - - - - Summary description for FileAssert. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if objects are not equal - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the two Stream are the same. - Arguments to be used in formatting the message - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the Streams are the same. - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - GlobalSettings is a place for setting default values used - by the framework in performing asserts. - - - - - Default tolerance for floating point equality - - - - - Obsolete class, formerly used to identify tests through - inheritance. Avoid using this class for new tests. - - - - - Method called immediately before running the test. - - - - - Method Called immediately after running the test. It is - guaranteed to be called, even if an exception is thrown. - - - - - Attribute used to mark a class that contains one-time SetUp - and/or TearDown methods that apply to all the tests in a - namespace or an assembly. - - - - - SetUpFixtureAttribute is used to identify a SetUpFixture - - - - - Attribute used to mark a static (shared in VB) property - that returns a list of tests. - - - - - Attribute used to identify a method that is called - immediately after each test is run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Descriptive text for this test - - - - - [TestFixture] - public class ExampleClass - {} - - - - - Descriptive text for this fixture - - - - - Attribute used to identify a method that is - called before any tests in a fixture are run. - - - - - Attribute used to identify a method that is called after - all the tests in a fixture have run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Attribute used to mark a test that is to be ignored. - Ignored tests result in a warning message when the - tests are run. - - - - - Constructs the attribute without giving a reason - for ignoring the test. - - - - - Constructs the attribute giving a reason for ignoring the test - - The reason for ignoring the test - - - - The reason for ignoring a test - - - - - ExplicitAttribute marks a test or test fixture so that it will - only be run if explicitly executed from the gui or command line - or if it is included by use of a filter. The test will not be - run simply because an enclosing suite is run. - - - - - Default constructor - - - - - Constructor with a reason - - The reason test is marked explicit - - - - The reason test is marked explicit - - - - - Attribute used to provide descriptive text about a - test case or fixture. - - - - - Construct the attribute - - Text describing the test - - - - Gets the test description - - - - - Interface implemented by a user fixture in order to - validate any expected exceptions. It is only called - for test methods marked with the ExpectedException - attribute. - - - - - Method to handle an expected exception - - The exception to be handled - - - diff --git a/tools/nunit/nunit.mocks.dll b/tools/nunit/nunit.mocks.dll deleted file mode 100644 index 472d841a09..0000000000 Binary files a/tools/nunit/nunit.mocks.dll and /dev/null differ diff --git a/tools/nunit/nunit.mocks.tests.dll b/tools/nunit/nunit.mocks.tests.dll deleted file mode 100644 index a12acb549a..0000000000 Binary files a/tools/nunit/nunit.mocks.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit.uikit.dll b/tools/nunit/nunit.uikit.dll deleted file mode 100644 index 448142988e..0000000000 Binary files a/tools/nunit/nunit.uikit.dll and /dev/null differ diff --git a/tools/nunit/nunit.uikit.tests.dll b/tools/nunit/nunit.uikit.tests.dll deleted file mode 100644 index b8bb56528d..0000000000 Binary files a/tools/nunit/nunit.uikit.tests.dll and /dev/null differ diff --git a/tools/nunit/nunit.util.dll b/tools/nunit/nunit.util.dll deleted file mode 100644 index 8f51b27842..0000000000 Binary files a/tools/nunit/nunit.util.dll and /dev/null differ diff --git a/tools/nunit/nunit.util.tests.dll b/tools/nunit/nunit.util.tests.dll deleted file mode 100644 index 95fb4db78f..0000000000 Binary files a/tools/nunit/nunit.util.tests.dll and /dev/null differ diff --git a/tools/nunit/runFile.exe b/tools/nunit/runFile.exe deleted file mode 100644 index a794458669..0000000000 Binary files a/tools/nunit/runFile.exe and /dev/null differ diff --git a/tools/nunit/runFile.exe.config b/tools/nunit/runFile.exe.config deleted file mode 100644 index f58f099b6a..0000000000 --- a/tools/nunit/runFile.exe.config +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/nunit/test-assembly.dll b/tools/nunit/test-assembly.dll deleted file mode 100644 index 227b84fb0a..0000000000 Binary files a/tools/nunit/test-assembly.dll and /dev/null differ diff --git a/tools/nunit/test-utilities.dll b/tools/nunit/test-utilities.dll deleted file mode 100644 index 340b34e173..0000000000 Binary files a/tools/nunit/test-utilities.dll and /dev/null differ diff --git a/tools/nunit/timing-tests.dll b/tools/nunit/timing-tests.dll deleted file mode 100644 index 846ee3ca2e..0000000000 Binary files a/tools/nunit/timing-tests.dll and /dev/null differ diff --git a/tools/psake/.gitattributes b/tools/psake/.gitattributes deleted file mode 100644 index d7c444cb12..0000000000 --- a/tools/psake/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* -crlf \ No newline at end of file diff --git a/tools/psake/.gitignore b/tools/psake/.gitignore deleted file mode 100644 index 664a786058..0000000000 --- a/tools/psake/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -[B|b]in -*.nupkg -Thumbs.db \ No newline at end of file diff --git a/tools/psake/NuGet.exe b/tools/psake/NuGet.exe deleted file mode 100644 index 8f61340295..0000000000 Binary files a/tools/psake/NuGet.exe and /dev/null differ diff --git a/tools/psake/NuGetPackageBuilder.ps1 b/tools/psake/NuGetPackageBuilder.ps1 deleted file mode 100644 index 66b9ed851b..0000000000 --- a/tools/psake/NuGetPackageBuilder.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -param( - [int]$buildNumber = 0 - ) - -if(Test-Path Env:\APPVEYOR_BUILD_NUMBER){ - $buildNumber = [int]$Env:APPVEYOR_BUILD_NUMBER - Write-Host "Using APPVEYOR_BUILD_NUMBER" -} - -"Build number $buildNumber" - -$scriptpath = $MyInvocation.MyCommand.Path -$dir = Split-Path $scriptpath - -$psakeVersion = (gc $dir\psake.psm1 | Select-String -Pattern "$psake.Version = " | Select-Object -first 1).Line -$start = $psakeVersion.IndexOf('"') + 1 -$end = $psakeVersion.IndexOf('"',$start) -$psakeVersion = $psakeVersion.Substring($start, $end - $start) -$nugetVersion = "$psakeVersion-build" + $buildNumber.ToString().PadLeft(5, '0') - -"psake version $psakeVersion" -"nuget version $nugetVersion" - -$destDir = "$dir\bin" -if (Test-Path $destDir -PathType container) { - Remove-Item $destDir -Recurse -Force -} - -Copy-Item -Recurse $dir\nuget $destDir -Copy-Item -Recurse $dir\en-US $destDir\tools\en-US -Copy-Item -Recurse $dir\examples $destDir\tools\examples -@( "psake.cmd", "psake.ps1", "psake.psm1", "psake-config.ps1", "README.markdown", "license.txt") | - % { Copy-Item $dir\$_ $destDir\tools } - -.\nuget pack "$destDir\psake.nuspec" -Verbosity quiet -Version $nugetVersion diff --git a/tools/psake/README.markdown b/tools/psake/README.markdown deleted file mode 100644 index 5745a942eb..0000000000 --- a/tools/psake/README.markdown +++ /dev/null @@ -1,48 +0,0 @@ -Welcome to the psake project. -============================= - -psake is a build automation tool written in PowerShell. It avoids the angle-bracket tax associated with executable XML by leveraging the PowerShell syntax in your build scripts. -psake has a syntax inspired by rake (aka make in Ruby) and bake (aka make in Boo), but is easier to script because it leverages your existing command-line knowledge. - -psake is pronounced sake – as in Japanese rice wine. It does NOT rhyme with make, bake, or rake. - -## How to get started: - -**Step 1:** Download and extract the project - -You will need to "unblock" the zip file before extracting - PowerShell by default does not run files downloaded from the internet. -Just right-click the zip and click on "properties" and click on the "unblock" button. - -**Step 2:** CD into the directory where you extracted the project (where the psake.psm1 file is) - -> Import-Module .\psake.psm1 - -If you encounter the following error "Import-Module : ...psake.psm1 cannot be loaded because the execution of scripts is disabled on this system." Please see "get-help about_signing" for more details. - -1. Run PowerShell as administrator -2. Set-ExecutionPolicy RemoteSigned - -> Get-Help Invoke-psake -Full -> - this will show you help and examples of how to use psake - -**Step 3:** Run some examples - -> CD .\examples -> -> Invoke-psake -> - This will execute the "default" task in the "default.ps1" -> -> Invoke-psake .\default.ps1 Clean -> - will execute the single task in the default.ps1 script - -## How To Contribute, Collaborate, Communicate - -If you'd like to get involved with psake, we have discussion groups over at google: **[psake-dev](http://groups.google.com/group/psake-dev)** **[psake-users](http://groups.google.com/group/psake-users)** - -Anyone can fork the main repository and submit patches, as well. And lastly, the [wiki](http://wiki.github.com/psake/psake/) and [issues list](http://github.com/psake/psake/issues) are also open for additions, edits, and discussion. - -Also check out the **[psake-contrib](http://github.com/psake/psake-contrib)** project for scripts, modules and functions to help you with a build. - -## License - -psake is released under the [MIT license](http://www.opensource.org/licenses/MIT). diff --git a/tools/psake/README.txt b/tools/psake/README.txt deleted file mode 100644 index b9f1b0c524..0000000000 --- a/tools/psake/README.txt +++ /dev/null @@ -1,16 +0,0 @@ - -How to get started. - -- Download and extract the project -- Open up a PowerShell V2 console window -- CD into the directory where you extracted the project (where the psake.psm1 file is) -> Import-Module .\psake.psm1 -> Get-Help Invoke-psake -Full - - this will show you help and examples of how to use psake - - -> CD .\examples -> Invoke-psake - - This will execute the "default" task in the "default.ps1" -> Invoke-psake .\default.ps1 Clean - - will execute the single task in the default.ps1 script diff --git a/tools/psake/en-US/psake.psm1-help.xml b/tools/psake/en-US/psake.psm1-help.xml deleted file mode 100644 index 5e1a88626d..0000000000 --- a/tools/psake/en-US/psake.psm1-help.xml +++ /dev/null @@ -1,2130 +0,0 @@ - - - - - Invoke-psake - - Runs a psake build script. - - - - - Invoke - psake - - - - This function runs a psake build script - - - - Invoke-psake - - buildFile - String - - - taskList - String[] - - - framework - String - - - docs - SwitchParameter - - - parameters - Hashtable - - - properties - Hashtable - - - nologo - SwitchParameter - - - - - - buildFile - - The path to the psake build script to execute - - String - - String - - - 'default.ps1' - - - taskList - - A comma-separated list of task names to execute - - String[] - - String[] - - - - - - framework - - The version of the .NET framework you want to use during build. You can append x86 or x64 to force a specific framework. If not specified, x86 or x64 will be detected based on the bitness of the PowerShell process. -Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x64', '4.5', '4.5x86', '4.5x64', '4.5.1', '4.5.1x86', '4.5.1x64' - - String - - String - - - '3.5' - - - docs - - Prints a list of tasks and their descriptions - - SwitchParameter - - SwitchParameter - - - - - - parameters - - A hashtable containing parameters to be passed into the current build script. These parameters will be processed before the 'Properties' function of the script is processed. This means you can access parameters from within the 'Properties' function! - - - Hashtable - - Hashtable - - - - - - properties - - A hashtable containing properties to be passed into the current build script. These properties will override matching properties that are found in the 'Properties' function of the script. - - Hashtable - - Hashtable - - - - - - nologo - - Do not display the startup banner and copyright message. - - SwitchParameter - - SwitchParameter - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - ---- Exceptions ---- - If there is an exception thrown during the running of a build script psake will set the '$psake.build_success' variable to $false. To detect failue outside PowerShell (for example by build server), finish PowerShell process with non-zero exit code when '$psake.build_success' is $false. Calling psake from 'cmd.exe' with 'psake.cmd' will give you that behaviour. - - - - ---- $psake variable ---- - When the psake module is loaded a variable called $psake is created which is a hashtable -containing some variables: - -$psake.version # contains the current version of psake -$psake.context # holds onto the current state of all variables -$psake.run_by_psake_build_tester # indicates that build is being run by psake-BuildTester -$psake.config_default # contains default configuration - # can be overriden in psake-config.ps1 in directory with psake.psm1 or in directory with current build script -$psake.build_success # indicates that the current build was successful -$psake.build_script_file # contains a System.IO.FileInfo for the current build script -$psake.build_script_dir # contains the fully qualified path to the current build script - -You should see the following when you display the contents of the $psake variable right after importing psake - -PS projects:\psake> Import-Module .\psake.psm1 -PS projects:\psake> $psake - -Name Value ----- ----- -run_by_psake_build_tester False -version 4.2 -build_success False -build_script_file -build_script_dir -config_default @{framework=3.5; ... -context {} - -After a build is executed the following $psake values are updated: build_script_file, build_script_dir, build_success - -PS projects:\psake> Invoke-psake .\examples\default.ps1 -Executing task: Clean -Executed Clean! -Executing task: Compile -Executed Compile! -Executing task: Test -Executed Test! - -Build Succeeded! - ----------------------------------------------------------------------- -Build Time Report ----------------------------------------------------------------------- -Name Duration ----- -------- -Clean 00:00:00.0798486 -Compile 00:00:00.0869948 -Test 00:00:00.0958225 -Total: 00:00:00.2712414 - -PS projects:\psake> $psake - -Name Value ----- ----- -build_script_file YOUR_PATH\examples\default.ps1 -run_by_psake_build_tester False -build_script_dir YOUR_PATH\examples -context {} -version 4.2 -build_success True -config_default @{framework=3.5; ... - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - Invoke-psake - - Description - ----------- - Runs the 'default' task in the '.build.ps1' build script - - - - - - - - - - - - -------------- EXAMPLE 2 -------------- - - C:\PS> - - Invoke-psake '.\build.ps1' Tests,Package - - Description - ----------- - Runs the 'Tests' and 'Package' tasks in the '.build.ps1' build script - - - - - - - - - - - - -------------- EXAMPLE 3 -------------- - - C:\PS> - - Invoke-psake Tests - - Description - ----------- - This example will run the 'Tests' tasks in the 'default.ps1' build script. The 'default.ps1' is assumed to be in the current directory. - - - - - - - - - - - - -------------- EXAMPLE 4 -------------- - - C:\PS> - - Invoke-psake 'Tests, Package' - - Description - ----------- - This example will run the 'Tests' and 'Package' tasks in the 'default.ps1' build script. The 'default.ps1' is assumed to be in the current directory. - NOTE: The quotes around the list of tasks to execute is required if you want to execute more than 1 task. - - - - - - - - - - - -------------- EXAMPLE 5 -------------- - - C:\PS> - - Invoke-psake .\build.ps1 -docs - - Description - ----------- - Prints a report of all the tasks and their dependencies and descriptions and then exits - - - - - - - - - - - - -------------- EXAMPLE 6 -------------- - - C:\PS> - - Invoke-psake .\parameters.ps1 -parameters @{"p1"="v1";"p2"="v2"} - - Description - ----------- - Runs the build script called 'parameters.ps1' and passes in parameters 'p1' and 'p2' with values 'v1' and 'v2' - Here's the .\parameters.ps1 build script: - - - properties { - $my_property = $p1 + $p2 -} - -task default -depends TestParams - -task TestParams { - Assert ($my_property -ne $null) '$my_property should not be null' -} - - Notice how you can refer to the parameters that were passed into the script from within the “properties” function. The value of the $p1 variable should be the string “v1” and the value of the $p2 variable should be “v2”. - - - - - - - - - - -------------- EXAMPLE 7 -------------- - - C:\PS> - - Invoke-psake .\properties.ps1 -properties @{"x"="1";"y"="2"} - - Description - ----------- - Runs the build script called 'properties.ps1' and passes in parameters 'x' and 'y' with values '1' and '2' - This feature allows you to over-ride existing properties in your build script. - - Here's the .\properties.ps1 build script - properties { - $x = $null - $y = $null - $z = $null -} - -task default -depends TestProperties - -task TestProperties { - Assert ($x -ne $null) "x should not be null" - Assert ($y -ne $null) "y should not be null" - Assert ($z -eq $null) "z should be null" -} - - - - - - - - - - - - - Task - - - - Include - - - - Properties - - - - FormatTaskName - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - TaskTearDown - - Adds a scriptblock to the build that will be executed after each task - - - - - - - - - - This function will accept a scriptblock that will be executed after each -task in the build script. - - - - TaskTearDown - - teardown - ScriptBlock - - - - - - teardown - - A scriptblock to execute - - ScriptBlock - - ScriptBlock - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - A sample build script is shown below: - -Task default -depends Test - -Task Test -depends Compile, Clean { -} - -Task Compile -depends Clean { -} - -Task Clean { -} - -TaskTearDown { - "Running 'TaskTearDown' for task $context.Peek().currentTaskName" -} - - Description - ----------- - The script above produces the following output: - Executing task, Clean... -Running 'TaskTearDown' for task Clean -Executing task, Compile... -Running 'TaskTearDown' for task Compile -Executing task, Test... -Running 'TaskTearDown' for task Test - -Build Succeeded - - - - - - - - - - - - Task - - - - Include - - - - Properties - - - - Invoke-psake - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - TaskSetup - - Adds a scriptblock that will be executed before each task - - - - - - - - - - This function will accept a scriptblock that will be executed before each -task in the build script. - - - - TaskSetup - - setup - ScriptBlock - - - - - - setup - - A scriptblock to execute - - ScriptBlock - - ScriptBlock - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - A sample build script is shown below: - -Task default -depends Test - -Task Test -depends Compile, Clean { -} - -Task Compile -depends Clean { -} - -Task Clean { -} - -TaskSetup { - "Running 'TaskSetup' for task $context.Peek().currentTaskName" -} - - Description - ----------- - The script above produces the following output: - Running 'TaskSetup' for task Clean -Executing task, Clean... -Running 'TaskSetup' for task Compile -Executing task, Compile... -Running 'TaskSetup' for task Test -Executing task, Test... - -Build Succeeded - - - - - - - - - - - - Task - - - - Include - - - - Properties - - - - Invoke-psake - - - - FormatTaskName - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - Framework - - Sets the version of the .NET framework you want to use during build. - - - - - - - - - - This function will accept a string containing version of the .NET framework to use during build. Possible values: '1.0', '1.1', '2.0', '2.0x86', '2.0x64', '3.0', '3.0x86', '3.0x64', '3.5', '3.5x86', '3.5x64', '4.0', '4.0x86', '4.0x64', '4.5', '4.5x86', '4.5x64', '4.5.1', '4.5.1x86', '4.5.1x64'. Default is '3.5*', where x86 or x64 will be detected based on the bitness of the PowerShell process. - - - - Framework - - framework - string - - - - - - framework - - Version of the .NET framework to use during build. - - string - - string - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - -Framework "4.0" - -Task default -depends Compile - -Task Compile -depends Clean { - msbuild /version -} - - Description - ----------- - The script above will output detailed version of msbuid v4 - - - - - - - - - - - - Task - - - - Include - - - - Properties - - - - Invoke-psake - - - - FormatTaskName - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - - - - - FormatTaskName - - This function allows you to change how psake renders the task name during a build. - - - - - - - - - - This function takes either a string which represents a format string (formats using the -f format operator see “help about_operators”) or it can accept a script block that has a single parameter that is the name of the task that will be executed. - - - - FormatTaskName - - format - String or ScriptBlock - - - - - - format - - A format string or a scriptblock to execute - - String or ScriptBlock - - String or ScriptBlock - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - A sample build script that uses a format string is shown below: - -Task default -depends TaskA, TaskB, TaskC - -FormatTaskName "-------- {0} --------" - -Task TaskA { - "TaskA is executing" -} - -Task TaskB { - "TaskB is executing" -} - -Task TaskC { - "TaskC is executing" -} - - Description - ----------- - The script above produces the following output: - -------- TaskA -------- -TaskA is executing --------- TaskB -------- -TaskB is executing --------- TaskC -------- -TaskC is executing - -Build Succeeded! - - - - - - - - - - -------------- EXAMPLE 2 -------------- - - C:\PS> - - A sample build script that uses a ScriptBlock is shown below: - -Task default -depends TaskA, TaskB, TaskC - -FormatTaskName { - param($taskName) - write-host "Executing Task: $taskName" -foregroundcolor blue -} - -Task TaskA { - "TaskA is executing" -} - -Task TaskB { - "TaskB is executing" -} - -Task TaskC { - "TaskC is executing" -} - - Description - ----------- - The preceding example uses the scriptblock parameter to the FormatTaskName function to render each task name in the color blue. - Note: the $taskName parameter is arbitrary it could be named anything - - - - - - - - - - - - Task - - - - Include - - - - Properties - - - - Invoke-psake - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - Include - - Include the functions or code of another powershell script file into the current build script's scope - - - - - - - - - - A build script may declare an "includes" function which allows you to define a file containing powershell code to be included and added to the scope of the currently running build script. Code from such file will be executed after code from build script. - - - - Include - - fileNamePathToInclude - String - - - - - - fileNamePathToInclude - - A string containing the path and name of the powershell file to include - - String - - String - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - A sample build script is shown below: - -Include ".\build_utils.ps1" - -Task default -depends Test - -Task Test -depends Compile, Clean { -} - -Task Compile -depends Clean { -} - -Task Clean { -} - - Description - ----------- - The script above includes all the functions and variables defined in the ".\build_utils.ps1" script into the current build script's scope - Note: You can have more than 1 "Include" function defined in the build script - - - - - - - - - - - - Task - - - - FormatTaskName - - - - Properties - - - - Invoke-psake - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - Properties - - Define a scriptblock that contains assignments to variables that will be available to all tasks in the build script - - - - - - - - - - A build script may declare a "Properies" function which allows you to define variables that will be available to all the "Task" functions in the build script. - - - - Properties - - properties - ScriptBlock - - - - - - properties - - The script block containing all the variable assignment statements - - ScriptBlock - - ScriptBlock - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - A sample build script is shown below: - -Properties { - $build_dir = "c:\build" - $connection_string = "datasource=localhost;initial catalog=northwind;integrated security=sspi" -} - -Task default -depends Test - -Task Test -depends Compile, Clean { -} - -Task Compile -depends Clean { -} - -Task Clean { -} - - Description - ----------- - Note: You can have more than 1 "Properties" function defined in the build script - - - - - - - - - - - - - - - Task - - - - FormatTaskName - - - - Include - - - - Invoke-psake - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - Task - - Defines a build task to be executed by psake - - - - - - - - - - This function creates a 'task' object that will be used by the psake engine to execute a build task. Note: There must be at least one task called 'default' in the build script - - - - Task - - Name - String - - - Action - ScriptBlock - - - PreAction - ScriptBlock - - - PostAction - ScriptBlock - - - Precondition - ScriptBlock - - - Postcondition - ScriptBlock - - - ContinueOnError - Boolean - - - Depends - String[] - - - RequiredVariables - String[] - - - Description - String[] - - - - - - Name - - The name of the task - - String - - String - - - - - - Action - - A scriptblock containing the statements to execute for the task. - - ScriptBlock - - ScriptBlock - - - - - - PreAction - - A scriptblock to be executed before the 'Action' scriptblock. Note: This parameter is ignored if the 'Action' scriptblock is not defined. - - ScriptBlock - - ScriptBlock - - - - - - PostAction - - A scriptblock to be executed after the 'Action' scriptblock. Note: This parameter is ignored if the 'Action' scriptblock is not defined. - - ScriptBlock - - ScriptBlock - - - - - - Precondition - - A scriptblock that is executed to determine if the task is executed or skipped. This scriptblock should return $true or $false - - ScriptBlock - - ScriptBlock - - - - - - Postcondition - - A scriptblock that is executed to determine if the task completed its job correctly. An exception is thrown if the scriptblock returns $false. - - ScriptBlock - - ScriptBlock - - - - - - ContinueOnError - - If this switch parameter is set then the task will not cause the build to fail when an exception is thrown by the task - - SwitchParameter - - SwitchParameter - - - - - - Depends - - An array of task names that this task depends on. These tasks will be executed before the current task is executed. - - String[] - - String[] - - - - - - RequiredVariables - - An array of names of variables that must be set to run this task. - - String[] - - String[] - - - - - - Description - - A description of the task. - - String - - String - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - A sample build script is shown below: - -Task default -Depends Test - -Task Test -Depends Compile, Clean { - "This is a test" -} - -Task Compile -Depends Clean { - "Compile" -} - -Task Clean { - "Clean" -} - -The 'default' task is required and should not contain an 'Action' parameter. -It uses the 'Depends' parameter to specify that 'Test' is a dependency - -The 'Test' task uses the 'Depends' parameter to specify that 'Compile' and 'Clean' are dependencies -The 'Compile' task depends on the 'Clean' task. - -Note: -The 'Action' parameter is defaulted to the script block following the 'Clean' task. - -An equivalent 'Test' task is shown below: - -Task Test -Depends Compile, Clean -Action { - $testMessage -} - -The output for the above sample build script is shown below: -Executing task, Clean... -Clean -Executing task, Compile... -Compile -Executing task, Test... -This is a test - -Build Succeeded! - ----------------------------------------------------------------------- -Build Time Report ----------------------------------------------------------------------- -Name Duration ----- -------- -Clean 00:00:00.0065614 -Compile 00:00:00.0133268 -Test 00:00:00.0225964 -Total: 00:00:00.0782496 - - - - - - - - - - - - - - - - Properties - - - - FormatTaskName - - - - Include - - - - Invoke-psake - - - - TaskSetup - - - - TaskTearDown - - - - Assert - - - - Framework - - - - - - - - Assert - - Helper function for "Design by Contract" assertion checking. - - - - - - - - - - This is a helper function that makes the code less noisy by eliminating many of the "if" statements that are normally required to verify assumptions in the code. - - - - Assert - - conditionToCheck - Boolean - - - failureMessage - String - - - - - - conditionToCheck - - The boolean condition to evaluate - - Boolean - - Boolean - - - - - - failureMessage - - The error message used for the exception if the conditionToCheck parameter is false - - String - - String - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - Assert $false "This always throws an exception" - - - - - - - - - - - - - -------------- EXAMPLE 2 -------------- - - C:\PS> - - Assert ( ($i % 2) -eq 0 ) "$i is not an even number" - - Description - ----------- - This exmaple may throw an exception if $i is not an even number - - Note: - It might be necessary to wrap the condition with paranthesis to force PS to evaluate the condition -so that a boolean value is calculated and passed into the 'conditionToCheck' parameter. - -Example: - Assert 1 -eq 2 "1 doesn't equal 2" - -PS will pass 1 into the condtionToCheck variable and PS will look for a parameter called "eq" and -throw an exception with the following message "A parameter cannot be found that matches parameter name 'eq'" - -The solution is to wrap the condition in () so that PS will evaluate it first. - - Assert (1 -eq 2) "1 doesn't equal 2" - - - - - - - - - - - - - Task - - - - FormatTaskName - - - - Include - - - - Invoke-psake - - - - TaskSetup - - - - TaskTearDown - - - - Properties - - - - - Framework - - - - - - - Exec - - Helper function for executing command-line programs. - - - - - - - - - - This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode to see if an error occcured. If an error is detected then an exception is thrown. This function allows you to run command-line programs without having to explicitly check fthe $lastexitcode variable. - - - - Exec - - cmd - ScriptBlock - - - errorMessage - String - - - - - - cmd - - The scriptblock to execute. This scriptblock will typically contain the command-line invocation. - - ScriptBlock - - Boolean - - - - - - failureMessage - - The error message used for the exception that is thrown. - - String - - String - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed" - - This example calls the svn command-line client. - - - - - - - - - - - - - - Assert - - - - FormatTaskName - - - - Include - - - - Invoke-psake - - - - Properties - - - - Task - - - - TaskSetup - - - - TaskTearDown - - - - - Framework - - - - - - - Invoke-Task - - Executes another task in the current build script. - - - - - - - - - - This is a function that will allow you to invoke a Task from within another Task in the current build script. - - - - Invoke-Task - - taskName - String - - - - - - taskName - - The name of the task to execute. - - String - - String - - - - - - - - - None - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - -------------- EXAMPLE 1 -------------- - - C:\PS> - - Invoke-Task "Compile" - - This example calls the "Compile" task. - - - - - - - - - - - - - - Assert - - - - Exec - - - - FormatTaskName - - - - Include - - - - Invoke-psake - - - - Properties - - - - Task - - - - TaskSetup - - - - TaskTearDown - - - - Framework - - - - - diff --git a/tools/psake/examples/checkvariables.ps1 b/tools/psake/examples/checkvariables.ps1 deleted file mode 100644 index 0d6b0b1219..0000000000 --- a/tools/psake/examples/checkvariables.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -Properties { - $x = 1 - $y = 2 -} - -FormatTaskName "[{0}]" - -Task default -Depends Verify - -Task Verify -Description "This task verifies psake's variables" { - - Assert (Test-Path 'variable:\psake') "psake variable was not exported from module" - - Assert ($psake.ContainsKey("version")) "psake variable does not contain 'version'" - Assert ($psake.ContainsKey("context")) "psake variable does not contain 'context'" - Assert ($psake.ContainsKey("build_success")) "psake variable does not contain 'build_success'" - Assert ($psake.ContainsKey("build_script_file")) "psake variable does not contain 'build_script_file'" - Assert ($psake.ContainsKey("build_script_dir")) "psake variable does not contain 'build_script_dir'" - - Assert (![string]::IsNullOrEmpty($psake.version)) '$psake.version was null or empty' - Assert ($psake.context -ne $null) '$psake.context was null' - Assert (!$psake.build_success) '$psake.build_success should be $false' - Assert ($psake.build_script_file -ne $null) '$psake.build_script_file was null' - Assert ($psake.build_script_file.Name -eq "checkvariables.ps1") ("psake variable: {0} was not equal to 'checkvariables.ps1'" -f $psake.build_script_file.Name) - Assert (![string]::IsNullOrEmpty($psake.build_script_dir)) '$psake.build_script_dir was null or empty' - - Assert ($psake.context.Peek().tasks.Count -ne 0) "psake context variable 'tasks' had length zero" - Assert ($psake.context.Peek().properties.Count -ne 0) "psake context variable 'properties' had length zero" - Assert ($psake.context.Peek().includes.Count -eq 0) "psake context variable 'includes' should have had length zero" - Assert ($psake.context.Peek().config -ne $null) "psake context variable 'config' was null" - - Assert ($psake.context.Peek().currentTaskName -eq "Verify") 'psake variable: $currentTaskName was not set correctly' -} \ No newline at end of file diff --git a/tools/psake/examples/continueonerror.ps1 b/tools/psake/examples/continueonerror.ps1 deleted file mode 100644 index 08a366cdfa..0000000000 --- a/tools/psake/examples/continueonerror.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -Task default -Depends TaskA - -Task TaskA -Depends TaskB { - "Task - A" -} - -Task TaskB -Depends TaskC -ContinueOnError { - "Task - B" - throw "I failed on purpose!" -} - -Task TaskC { - "Task - C" -} \ No newline at end of file diff --git a/tools/psake/examples/default.ps1 b/tools/psake/examples/default.ps1 deleted file mode 100644 index 4aca3586b5..0000000000 --- a/tools/psake/examples/default.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -properties { - $testMessage = 'Executed Test!' - $compileMessage = 'Executed Compile!' - $cleanMessage = 'Executed Clean!' -} - -task default -depends Test - -task Test -depends Compile, Clean { - $testMessage -} - -task Compile -depends Clean { - $compileMessage -} - -task Clean { - $cleanMessage -} - -task ? -Description "Helper to display task info" { - Write-Documentation -} \ No newline at end of file diff --git a/tools/psake/examples/formattaskname_scriptblock.ps1 b/tools/psake/examples/formattaskname_scriptblock.ps1 deleted file mode 100644 index e4919b9733..0000000000 --- a/tools/psake/examples/formattaskname_scriptblock.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -properties { - $testMessage = 'Executed Test!' - $compileMessage = 'Executed Compile!' - $cleanMessage = 'Executed Clean!' -} - -task default -depends Test - -formatTaskName { - param($taskName) - write-host $taskName -foregroundcolor Green -} - -task Test -depends Compile, Clean { - $testMessage -} - -task Compile -depends Clean { - $compileMessage -} - -task Clean { - $cleanMessage -} \ No newline at end of file diff --git a/tools/psake/examples/formattaskname_string.ps1 b/tools/psake/examples/formattaskname_string.ps1 deleted file mode 100644 index 66874900c6..0000000000 --- a/tools/psake/examples/formattaskname_string.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -properties { - $testMessage = 'Executed Test!' - $compileMessage = 'Executed Compile!' - $cleanMessage = 'Executed Clean!' -} - -task default -depends Test - -formatTaskName "-------{0}-------" - -task Test -depends Compile, Clean { - $testMessage -} - -task Compile -depends Clean { - $compileMessage -} - -task Clean { - $cleanMessage -} \ No newline at end of file diff --git a/tools/psake/examples/msbuild40.ps1 b/tools/psake/examples/msbuild40.ps1 deleted file mode 100644 index d02c325b6c..0000000000 --- a/tools/psake/examples/msbuild40.ps1 +++ /dev/null @@ -1,8 +0,0 @@ -Framework "4.0" -# Framework "4.0x64" - -task default -depends ShowMsBuildVersion - -task ShowMsBuildVersion { - msbuild /version -} \ No newline at end of file diff --git a/tools/psake/examples/nested.ps1 b/tools/psake/examples/nested.ps1 deleted file mode 100644 index 36fc830e68..0000000000 --- a/tools/psake/examples/nested.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -Properties { - $x = 1 -} - -Task default -Depends RunNested1, RunNested2, CheckX - -Task RunNested1 { - Invoke-psake .\nested\nested1.ps1 -} - -Task RunNested2 { - Invoke-psake .\nested\nested2.ps1 -} - -Task CheckX{ - Assert ($x -eq 1) '$x was not 1' -} \ No newline at end of file diff --git a/tools/psake/examples/nested/nested1.ps1 b/tools/psake/examples/nested/nested1.ps1 deleted file mode 100644 index 81790ec94e..0000000000 --- a/tools/psake/examples/nested/nested1.ps1 +++ /dev/null @@ -1 +0,0 @@ -Properties { $x = 100 } Task default -Depends Nested1CheckX Task Nested1CheckX{ Assert ($x -eq 100) '$x was not 100' } \ No newline at end of file diff --git a/tools/psake/examples/nested/nested2.ps1 b/tools/psake/examples/nested/nested2.ps1 deleted file mode 100644 index 7a4a2b8c06..0000000000 --- a/tools/psake/examples/nested/nested2.ps1 +++ /dev/null @@ -1 +0,0 @@ -Properties { $x = 200 } Task default -Depends Nested2CheckX Task Nested2CheckX{ Assert ($x -eq 200) '$x was not 200' } \ No newline at end of file diff --git a/tools/psake/examples/parameters.ps1 b/tools/psake/examples/parameters.ps1 deleted file mode 100644 index cde5d3cd14..0000000000 --- a/tools/psake/examples/parameters.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -properties { - $my_property = $p1 + $p2 -} - -task default -depends TestParams - -task TestParams { - Assert ($my_property -ne $null) "`$my_property should not be null. Run with -parameters @{'p1' = 'v1'; 'p2' = 'v2'}" -} \ No newline at end of file diff --git a/tools/psake/examples/passingParametersString/build.Release.Version.bat b/tools/psake/examples/passingParametersString/build.Release.Version.bat deleted file mode 100644 index 9a734ccc43..0000000000 --- a/tools/psake/examples/passingParametersString/build.Release.Version.bat +++ /dev/null @@ -1,3 +0,0 @@ -powershell -Command "& {Import-Module .\..\..\psake.psm1; Invoke-psake .\parameters.ps1 -parameters @{"buildConfiguration"='Release';} }" - -Pause \ No newline at end of file diff --git a/tools/psake/examples/passingParametersString/parameters.ps1 b/tools/psake/examples/passingParametersString/parameters.ps1 deleted file mode 100644 index 2259320645..0000000000 --- a/tools/psake/examples/passingParametersString/parameters.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -properties { - $buildOutputPath = ".\bin\$buildConfiguration" -} - -task default -depends DoRelease - -task DoRelease { - Assert ("$buildConfiguration" -ne $null) "buildConfiguration should not have been null" - Assert ("$buildConfiguration" -eq 'Release') "buildConfiguration=[$buildConfiguration] should have been 'Release'" - - Write-Host "" - Write-Host "" - Write-Host "" - Write-Host -NoNewline "Would build output into path " - Write-Host -NoNewline -ForegroundColor Green "$buildOutputPath" - Write-Host -NoNewline " for build configuration " - Write-Host -ForegroundColor Green "$buildConfiguration" - Write-Host -NoNewline "." - Write-Host "" - Write-Host "" - Write-Host "" -} diff --git a/tools/psake/examples/preandpostaction.ps1 b/tools/psake/examples/preandpostaction.ps1 deleted file mode 100644 index fcb36e6f7f..0000000000 --- a/tools/psake/examples/preandpostaction.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -task default -depends Test - -task Test -depends Compile, Clean -PreAction {"Pre-Test"} -Action { - "Test" -} -PostAction {"Post-Test"} - -task Compile -depends Clean { - "Compile" -} - -task Clean { - "Clean" -} \ No newline at end of file diff --git a/tools/psake/examples/preandpostcondition.ps1 b/tools/psake/examples/preandpostcondition.ps1 deleted file mode 100644 index ce855fb3f6..0000000000 --- a/tools/psake/examples/preandpostcondition.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -properties { - $runTaskA = $false - $taskBSucceded = $true -} - -task default -depends TaskC - -task TaskA -precondition { $runTaskA -eq $true } { - "TaskA executed" -} - -task TaskB -postcondition { $taskBSucceded -eq $true } { - "TaskB executed" -} - -task TaskC -depends TaskA,TaskB { - "TaskC executed." -} \ No newline at end of file diff --git a/tools/psake/examples/properties.ps1 b/tools/psake/examples/properties.ps1 deleted file mode 100644 index 35c4933bed..0000000000 --- a/tools/psake/examples/properties.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -properties { - $x = $null - $y = $null - $z = $null -} - -task default -depends TestProperties - -task TestProperties { - Assert ($x -ne $null) "x should not be null. Run with -properties @{'x' = '1'; 'y' = '2'}" - Assert ($y -ne $null) "y should not be null. Run with -properties @{'x' = '1'; 'y' = '2'}" - Assert ($z -eq $null) "z should be null" -} \ No newline at end of file diff --git a/tools/psake/examples/requiredvariables.ps1 b/tools/psake/examples/requiredvariables.ps1 deleted file mode 100644 index aca0c7bff0..0000000000 --- a/tools/psake/examples/requiredvariables.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -properties { - $x = $null - $y = $null - $z = $null -} - -task default -depends TestRequiredVariables - -# you can put arguments to task in multiple lines using ` -task TestRequiredVariables ` - -description "This task shows how to make a variable required to run task. Run this script with -properties @{x = 1; y = 2; z = 3}" ` - -requiredVariables x, y, z ` -{ -} diff --git a/tools/psake/examples/tasksetupandteardown.ps1 b/tools/psake/examples/tasksetupandteardown.ps1 deleted file mode 100644 index 4a94c856b6..0000000000 --- a/tools/psake/examples/tasksetupandteardown.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -TaskSetup { - "Executing task setup" -} - -TaskTearDown { - "Executing task tear down" -} - -Task default -depends TaskB - -Task TaskA { - "TaskA executed" -} - -Task TaskB -depends TaskA { - "TaskB executed" -} diff --git a/tools/psake/images/SakeBottle.jpg b/tools/psake/images/SakeBottle.jpg deleted file mode 100644 index a3f6692e60..0000000000 Binary files a/tools/psake/images/SakeBottle.jpg and /dev/null differ diff --git a/tools/psake/images/SakeBottleLicense.txt b/tools/psake/images/SakeBottleLicense.txt deleted file mode 100644 index 7563976e93..0000000000 --- a/tools/psake/images/SakeBottleLicense.txt +++ /dev/null @@ -1,4 +0,0 @@ -SakeBottle.jpg -An American produced bottle of Ginjo Sake. -Shawn Clark Lazyeights Photography http://lazyeights.net/cpg/displayimage.php?pos=-122 -This work is licensed under the Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/). \ No newline at end of file diff --git a/tools/psake/images/psake.pdn b/tools/psake/images/psake.pdn deleted file mode 100644 index 8bd0beff7e..0000000000 Binary files a/tools/psake/images/psake.pdn and /dev/null differ diff --git a/tools/psake/images/psake.png b/tools/psake/images/psake.png deleted file mode 100644 index 8ce869fd41..0000000000 Binary files a/tools/psake/images/psake.png and /dev/null differ diff --git a/tools/psake/license.txt b/tools/psake/license.txt deleted file mode 100644 index a85529fbad..0000000000 --- a/tools/psake/license.txt +++ /dev/null @@ -1,20 +0,0 @@ -psake -Copyright (c) 2012-13 James Kovacs, Damian Hickey and Contributors - -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. \ No newline at end of file diff --git a/tools/psake/nuget/psake.nuspec b/tools/psake/nuget/psake.nuspec deleted file mode 100644 index 051416af55..0000000000 --- a/tools/psake/nuget/psake.nuspec +++ /dev/null @@ -1,15 +0,0 @@ - - - - psake - 0.0.0 - James Kovacs - James Kovacs, Damian Hickey - https://github.com/psake/psake - false - psake is a build automation tool written in PowerShell - psake is a build automation tool written in PowerShell. It avoids the angle-bracket tax associated with executable XML by leveraging the PowerShell syntax in your build scripts. psake has a syntax inspired by rake (aka make in Ruby) and bake (aka make in Boo), but is easier to script because it leverages your existent command-line knowledge. psake is pronounced sake - as in Japanese rice wine. It does NOT rhyme with make, bake, or rake. You can also install with chocolatey (http://nuget.org/List/Packages/chocolatey) and have global psake. - en-US - build powershell chocolatey - - diff --git a/tools/psake/nuget/tools/chocolateyInstall.ps1 b/tools/psake/nuget/tools/chocolateyInstall.ps1 deleted file mode 100644 index 88c22ad6dc..0000000000 --- a/tools/psake/nuget/tools/chocolateyInstall.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -try { - $nugetPath = $env:ChocolateyInstall - $nugetExePath = Join-Path $nuGetPath 'bin' - $packageBatchFileName = Join-Path $nugetExePath "psake.bat" - - $psakeDir = (Split-Path -parent $MyInvocation.MyCommand.Definition) - #$path = ($psakeDir | Split-Path | Join-Path -ChildPath 'psake.cmd') - $path = Join-Path $psakeDir 'psake.cmd' - Write-Host "Adding $packageBatchFileName and pointing to $path" - "@echo off - ""$path"" %*" | Out-File $packageBatchFileName -encoding ASCII - - write-host "PSake is now ready. You can type 'psake' from any command line at any path. Get started by typing 'psake /?'" - - Write-ChocolateySuccess 'psake' -} catch { - Write-ChocolateyFailure 'psake' "$($_.Exception.Message)" - throw -} \ No newline at end of file diff --git a/tools/psake/nuget/tools/init.ps1 b/tools/psake/nuget/tools/init.ps1 deleted file mode 100644 index 5ae4d2d590..0000000000 --- a/tools/psake/nuget/tools/init.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -param($installPath, $toolsPath, $package) - -$psakeModule = Join-Path $toolsPath psake.psm1 -import-module $psakeModule - -@" -======================== -psake - Automated builds with powershell -======================== -"@ | Write-Host \ No newline at end of file diff --git a/tools/psake/psake-buildTester.ps1 b/tools/psake/psake-buildTester.ps1 deleted file mode 100644 index 03ccf80b16..0000000000 --- a/tools/psake/psake-buildTester.ps1 +++ /dev/null @@ -1,84 +0,0 @@ -function Main() -{ - write-host "Running psake build tests" -ForeGroundColor GREEN - remove-module psake -ea SilentlyContinue - import-module .\psake.psm1 - $psake.run_by_psake_build_tester = $true - $results = runBuilds - remove-module psake - - "" - $results | Sort 'Name' | % { if ($_.Result -eq "Passed") { write-host ($_.Name + " (Passed)") -ForeGroundColor 'GREEN'} else { write-host ($_.Name + " (Failed)") -ForeGroundColor 'RED'}} - "" - - $failed = $results | ? { $_.Result -eq "Failed" } - if ($failed) - { - write-host "One or more of the build files failed" -ForeGroundColor RED - exit 1 - } - else - { - write-host "All Builds Passed" -ForeGroundColor GREEN - exit 0 - } -} - -function runBuilds() -{ - $buildFiles = ls specs\*.ps1 - $testResults = @() - - #Add a fake build file to the $buildFiles array so that we can verify - #that Invoke-psake fails - $non_existant_buildfile = "" | select Name, FullName - $non_existant_buildfile.Name = "specifying_a_non_existant_buildfile_should_fail.ps1" - $non_existant_buildfile.FullName = "c:\specifying_a_non_existant_buildfile_should_fail.ps1" - $buildFiles += $non_existant_buildfile - - foreach($buildFile in $buildFiles) - { - $testResult = "" | select Name, Result - $testResult.Name = $buildFile.Name - invoke-psake $buildFile.FullName -Parameters @{'p1'='v1'; 'p2'='v2'} -Properties @{'x'='1'; 'y'='2'} -Initialization { if(!$container) { $container = @{}; } $container.bar = "bar"; $container.baz = "baz"; $bar = 2; $baz = 3 } | Out-Null - $testResult.Result = (getResult $buildFile.Name $psake.build_success) - $testResults += $testResult - if ($testResult.Result -eq "Passed") - { - write-host "." -ForeGroundColor GREEN -NoNewLine - } - else - { - write-host "F" -ForeGroundColor RED -NoNewLine - } - } - - return $testResults -} - -function getResult([string]$fileName, [bool]$buildSucceeded) -{ - $shouldSucceed = $null - if ($fileName.EndsWith("_should_pass.ps1")) - { - $shouldSucceed = $true - } - elseif ($fileName.EndsWith("_should_fail.ps1")) - { - $shouldSucceed = $false - } - else - { - throw "Invalid specification syntax. Specs should end with _should_pass or _should_fail. $fileName" - } - if ($buildSucceeded -eq $shouldSucceed) - { - "Passed" - } - else - { - "Failed" - } -} - -main \ No newline at end of file diff --git a/tools/psake/psake-config.ps1 b/tools/psake/psake-config.ps1 deleted file mode 100644 index 545870161b..0000000000 --- a/tools/psake/psake-config.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -<# -------------------------------------------------------------------- -Defaults -------------------------------------------------------------------- -$config.buildFileName="default.ps1" -$config.framework = "4.0" -$config.taskNameFormat="Executing {0}" -$config.verboseError=$false -$config.coloredOutput = $true -$config.modules=$null - -------------------------------------------------------------------- -Load modules from .\modules folder and from file my_module.psm1 -------------------------------------------------------------------- -$config.modules=(".\modules\*.psm1",".\my_module.psm1") - -------------------------------------------------------------------- -Use scriptblock for taskNameFormat -------------------------------------------------------------------- -$config.taskNameFormat= { param($taskName) "Executing $taskName at $(get-date)" } -#> diff --git a/tools/psake/specs/bad_PreAndPostActions_should_fail.ps1 b/tools/psake/specs/bad_PreAndPostActions_should_fail.ps1 deleted file mode 100644 index facdfb8ba2..0000000000 --- a/tools/psake/specs/bad_PreAndPostActions_should_fail.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -task default -depends Test - -task Test -depends Compile, Clean -PreAction {"Pre-Test"} -PostAction {"Post-Test"} - -task Compile -depends Clean { - "Compile" -} - -task Clean { - "Clean" -} \ No newline at end of file diff --git a/tools/psake/specs/calling_invoke-task_should_pass.ps1 b/tools/psake/specs/calling_invoke-task_should_pass.ps1 deleted file mode 100644 index e986dfd24d..0000000000 --- a/tools/psake/specs/calling_invoke-task_should_pass.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -task default -depends A,B - -task A { -} - -task B { - "inside task B before calling task C" - invoke-task C - "inside task B after calling task C" -} - -task C { -} \ No newline at end of file diff --git a/tools/psake/specs/circular_dependency_in_tasks_should_fail.ps1 b/tools/psake/specs/circular_dependency_in_tasks_should_fail.ps1 deleted file mode 100644 index 9cea08eb2f..0000000000 --- a/tools/psake/specs/circular_dependency_in_tasks_should_fail.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -task default -depends A -task A -depends B { } -task B -depends A { } diff --git a/tools/psake/specs/default_task_with_action_should_fail.ps1 b/tools/psake/specs/default_task_with_action_should_fail.ps1 deleted file mode 100644 index 5d20507ce7..0000000000 --- a/tools/psake/specs/default_task_with_action_should_fail.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default { - "Starting to do stuff..." - "Adding stuff... 1 + 1 =" + (1+1) - "Stuff done!" -} \ No newline at end of file diff --git a/tools/psake/specs/dotNet4.5.1_should_pass.ps1 b/tools/psake/specs/dotNet4.5.1_should_pass.ps1 deleted file mode 100644 index fc34b8d979..0000000000 --- a/tools/psake/specs/dotNet4.5.1_should_pass.ps1 +++ /dev/null @@ -1,8 +0,0 @@ -Framework "4.5.1x86" - -task default -depends MsBuild - -task MsBuild { - $output = &msbuild /version 2>&1 - Assert ($output -NotLike "12.0") '$output should contain 12.0' -} diff --git a/tools/psake/specs/dotNet4_should_pass.ps1 b/tools/psake/specs/dotNet4_should_pass.ps1 deleted file mode 100644 index 09e5a87776..0000000000 --- a/tools/psake/specs/dotNet4_should_pass.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -Framework '4.0' - -task default -depends MsBuild - -task MsBuild { - exec { msbuild /version } -} diff --git a/tools/psake/specs/duplicate_alias_should_fail.ps1 b/tools/psake/specs/duplicate_alias_should_fail.ps1 deleted file mode 100644 index 06b10758cc..0000000000 --- a/tools/psake/specs/duplicate_alias_should_fail.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -task default -task A -alias a {} -task B -alias b {} -task C -alias a {} \ No newline at end of file diff --git a/tools/psake/specs/duplicate_tasks_should_fail.ps1 b/tools/psake/specs/duplicate_tasks_should_fail.ps1 deleted file mode 100644 index f21c77a5a3..0000000000 --- a/tools/psake/specs/duplicate_tasks_should_fail.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -task A {} -task B {} -task A {} \ No newline at end of file diff --git a/tools/psake/specs/executing_module_function_that_depends_on_another_module_should_pass.ps1 b/tools/psake/specs/executing_module_function_that_depends_on_another_module_should_pass.ps1 deleted file mode 100644 index 512b03fa82..0000000000 --- a/tools/psake/specs/executing_module_function_that_depends_on_another_module_should_pass.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends test - -task test { - invoke-psake modules\default.ps1 -} \ No newline at end of file diff --git a/tools/psake/specs/explicitly_specified_32bit_build_should_pass.ps1 b/tools/psake/specs/explicitly_specified_32bit_build_should_pass.ps1 deleted file mode 100644 index 78e282e03f..0000000000 --- a/tools/psake/specs/explicitly_specified_32bit_build_should_pass.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -Framework '4.0x86' - -task default -depends MsBuild - -task MsBuild { - exec { msbuild /version } -} diff --git a/tools/psake/specs/failing_postcondition_should_fail.ps1 b/tools/psake/specs/failing_postcondition_should_fail.ps1 deleted file mode 100644 index 70f12f1fdf..0000000000 --- a/tools/psake/specs/failing_postcondition_should_fail.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -task default -depends A,B,C - -task A { - "TaskA" -} - -task B -postcondition { return $false } { - "TaskB" -} - -task C { - "TaskC" -} \ No newline at end of file diff --git a/tools/psake/specs/missing_task_should_fail.ps1 b/tools/psake/specs/missing_task_should_fail.ps1 deleted file mode 100644 index 587d89dead..0000000000 --- a/tools/psake/specs/missing_task_should_fail.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends Test - -task Test -depends Compile, Clean { - Write-Host "Running PSake" -} diff --git a/tools/psake/specs/modules/ModuleA.psm1 b/tools/psake/specs/modules/ModuleA.psm1 deleted file mode 100644 index 6e72c83f61..0000000000 --- a/tools/psake/specs/modules/ModuleA.psm1 +++ /dev/null @@ -1,5 +0,0 @@ -function Execute-ModuleAFunction { - Execute-ModuleBFunction -} - -Export-ModuleMember -Function "Execute-ModuleAFunction" \ No newline at end of file diff --git a/tools/psake/specs/modules/ModuleB.psm1 b/tools/psake/specs/modules/ModuleB.psm1 deleted file mode 100644 index c35a3729f1..0000000000 --- a/tools/psake/specs/modules/ModuleB.psm1 +++ /dev/null @@ -1,4 +0,0 @@ -function Execute-ModuleBFunction { -} - -Export-ModuleMember -Function "Execute-ModuleBFunction" \ No newline at end of file diff --git a/tools/psake/specs/modules/default.ps1 b/tools/psake/specs/modules/default.ps1 deleted file mode 100644 index c28b834afd..0000000000 --- a/tools/psake/specs/modules/default.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends test - -task test { - Execute-ModuleAFunction -} \ No newline at end of file diff --git a/tools/psake/specs/modules/psake-config.ps1 b/tools/psake/specs/modules/psake-config.ps1 deleted file mode 100644 index 71e7450843..0000000000 --- a/tools/psake/specs/modules/psake-config.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$config.modules = @("ModuleA.psm1", "ModuleB.psm1") -$config.moduleScope = "global" \ No newline at end of file diff --git a/tools/psake/specs/multiline_blocks_should_pass.ps1 b/tools/psake/specs/multiline_blocks_should_pass.ps1 deleted file mode 100644 index 9ac8925e94..0000000000 --- a/tools/psake/specs/multiline_blocks_should_pass.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -task default -depends doStuff -task doStuff { - "Starting to do stuff..." - "Adding stuff... 1 + 1 =" + (1+1) - "Stuff done!" -} \ No newline at end of file diff --git a/tools/psake/specs/nested/always_fail.ps1 b/tools/psake/specs/nested/always_fail.ps1 deleted file mode 100644 index faf1e756e8..0000000000 --- a/tools/psake/specs/nested/always_fail.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Task default -Depends AlwaysFail - -Task AlwaysFail { - Assert $false "This should always fail." -} \ No newline at end of file diff --git a/tools/psake/specs/nested/nested1.ps1 b/tools/psake/specs/nested/nested1.ps1 deleted file mode 100644 index 81790ec94e..0000000000 --- a/tools/psake/specs/nested/nested1.ps1 +++ /dev/null @@ -1 +0,0 @@ -Properties { $x = 100 } Task default -Depends Nested1CheckX Task Nested1CheckX{ Assert ($x -eq 100) '$x was not 100' } \ No newline at end of file diff --git a/tools/psake/specs/nested/nested2.ps1 b/tools/psake/specs/nested/nested2.ps1 deleted file mode 100644 index 7a4a2b8c06..0000000000 --- a/tools/psake/specs/nested/nested2.ps1 +++ /dev/null @@ -1 +0,0 @@ -Properties { $x = 200 } Task default -Depends Nested2CheckX Task Nested2CheckX{ Assert ($x -eq 200) '$x was not 200' } \ No newline at end of file diff --git a/tools/psake/specs/nested/whatifpreference.ps1 b/tools/psake/specs/nested/whatifpreference.ps1 deleted file mode 100644 index be7d291e36..0000000000 --- a/tools/psake/specs/nested/whatifpreference.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Task default -Depends WhatIfCheck - -Task WhatIfCheck { - Assert ($p1 -eq 'whatifcheck') '$p1 was not whatifcheck' -} diff --git a/tools/psake/specs/nested_builds_should_pass.ps1 b/tools/psake/specs/nested_builds_should_pass.ps1 deleted file mode 100644 index 36fc830e68..0000000000 --- a/tools/psake/specs/nested_builds_should_pass.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -Properties { - $x = 1 -} - -Task default -Depends RunNested1, RunNested2, CheckX - -Task RunNested1 { - Invoke-psake .\nested\nested1.ps1 -} - -Task RunNested2 { - Invoke-psake .\nested\nested2.ps1 -} - -Task CheckX{ - Assert ($x -eq 1) '$x was not 1' -} \ No newline at end of file diff --git a/tools/psake/specs/nested_builds_that_fail_should_fail.ps1 b/tools/psake/specs/nested_builds_that_fail_should_fail.ps1 deleted file mode 100644 index 06227d7317..0000000000 --- a/tools/psake/specs/nested_builds_that_fail_should_fail.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -Task default -Depends RunAlwaysFail - -Task RunAlwaysFail { - Invoke-psake .\nested\always_fail.ps1 -} diff --git a/tools/psake/specs/nonzero_lastexitcode_should_pass.ps1 b/tools/psake/specs/nonzero_lastexitcode_should_pass.ps1 deleted file mode 100644 index e7e19ccd15..0000000000 --- a/tools/psake/specs/nonzero_lastexitcode_should_pass.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends MSBuildWithError - -task MSBuildWithError { - msbuild ThisFileDoesNotExist.sln -} \ No newline at end of file diff --git a/tools/psake/specs/running_aspnet_compiler_under_dotNet35_should_pass.ps1 b/tools/psake/specs/running_aspnet_compiler_under_dotNet35_should_pass.ps1 deleted file mode 100644 index 9ce3a00228..0000000000 --- a/tools/psake/specs/running_aspnet_compiler_under_dotNet35_should_pass.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -Framework '3.5' - -task default -depends AspNetCompiler - -task AspNetCompiler { - aspnet_compiler - if ($LastExitCode -ne 1) { - throw 'Error: Could not execute aspnet_compiler' - } - $global:LastExitCode = 0 -} diff --git a/tools/psake/specs/simple_properties_and_tasks_should_pass.ps1 b/tools/psake/specs/simple_properties_and_tasks_should_pass.ps1 deleted file mode 100644 index cd5d71f845..0000000000 --- a/tools/psake/specs/simple_properties_and_tasks_should_pass.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -properties { - $testMessage = 'Executed Test!' - $compileMessage = 'Executed Compile!' - $cleanMessage = 'Executed Clean!' -} - -task default -depends Test - -task Test -depends Compile, Clean { - $testMessage -} - -task Compile -depends Clean { - $compileMessage -} - -task Clean { - $cleanMessage -} \ No newline at end of file diff --git a/tools/psake/specs/task_with_alias_and_dependencies_should_pass.ps1 b/tools/psake/specs/task_with_alias_and_dependencies_should_pass.ps1 deleted file mode 100644 index 3443e62beb..0000000000 --- a/tools/psake/specs/task_with_alias_and_dependencies_should_pass.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends Task_With_Alias - -task Task_With_Alias -depends Task_Dependency -alias twa {} - -task Task_Dependency {} \ No newline at end of file diff --git a/tools/psake/specs/task_with_alias_should_pass.ps1 b/tools/psake/specs/task_with_alias_should_pass.ps1 deleted file mode 100644 index 595e3d95dd..0000000000 --- a/tools/psake/specs/task_with_alias_should_pass.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends twbdn - -task Task_With_Big_Descriptve_Name -alias twbdn { - "Doing stuff inside task with alias" -} diff --git a/tools/psake/specs/tasksetup_should_pass.ps1 b/tools/psake/specs/tasksetup_should_pass.ps1 deleted file mode 100644 index 46fb2786fc..0000000000 --- a/tools/psake/specs/tasksetup_should_pass.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -TaskSetup { - "executing task setup" -} - -Task default -depends Compile, Test, Deploy - -Task Compile { - "Compiling" -} - -Task Test -depends Compile { - "Testing" -} - -Task Deploy -depends Test { - "Deploying" -} \ No newline at end of file diff --git a/tools/psake/specs/using_PreAndPostActions_should_pass.ps1 b/tools/psake/specs/using_PreAndPostActions_should_pass.ps1 deleted file mode 100644 index fcb36e6f7f..0000000000 --- a/tools/psake/specs/using_PreAndPostActions_should_pass.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -task default -depends Test - -task Test -depends Compile, Clean -PreAction {"Pre-Test"} -Action { - "Test" -} -PostAction {"Post-Test"} - -task Compile -depends Clean { - "Compile" -} - -task Clean { - "Clean" -} \ No newline at end of file diff --git a/tools/psake/specs/using_exec_and_nonzero_lastexitcode_should_fail.ps1 b/tools/psake/specs/using_exec_and_nonzero_lastexitcode_should_fail.ps1 deleted file mode 100644 index 480b1db4e0..0000000000 --- a/tools/psake/specs/using_exec_and_nonzero_lastexitcode_should_fail.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -task default -depends MSBuildWithError - -task MSBuildWithError { - exec { msbuild ThisFileDoesNotExist.sln } -} \ No newline at end of file diff --git a/tools/psake/specs/using_framework_should_pass.ps1 b/tools/psake/specs/using_framework_should_pass.ps1 deleted file mode 100644 index cb368a2235..0000000000 --- a/tools/psake/specs/using_framework_should_pass.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -task default -depends FrameworkFunction - -task FrameworkFunction { - AssertFramework '2.0' - AssertFramework '3.5' - AssertFramework '4.0' -} - -function AssertFramework{ - param( - [string]$framework - ) - Framework $framework - $msBuildVersion = msbuild /version - Assert ($msBuildVersion[0].ToLower().StartsWith("microsoft (r) build engine version $framework")) '$msBuildVersion does not start with "$framework"' -} \ No newline at end of file diff --git a/tools/psake/specs/using_initialization_block_should_pass.ps1 b/tools/psake/specs/using_initialization_block_should_pass.ps1 deleted file mode 100644 index 1e71165aac..0000000000 --- a/tools/psake/specs/using_initialization_block_should_pass.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -properties { - $container = @{} - $container.foo = "foo" - $container.bar = $null - $foo = 1 - $bar = 1 -} - -task default -depends TestInit - -task TestInit { - # values are: - # 1: original - # 2: overide - # 3: new - - Assert ($container.foo -eq "foo") "$container.foo should be foo" - Assert ($container.bar -eq "bar") "$container.bar should be bar" - Assert ($container.baz -eq "baz") "$container.baz should be baz" - Assert ($foo -eq 1) "$foo should be 1" - Assert ($bar -eq 2) "$bar should be 2" - Assert ($baz -eq 3) "$baz should be 3" -} \ No newline at end of file diff --git a/tools/psake/specs/using_msbuild_should_pass.ps1 b/tools/psake/specs/using_msbuild_should_pass.ps1 deleted file mode 100644 index 72fbc7796e..0000000000 --- a/tools/psake/specs/using_msbuild_should_pass.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -task default -depends DisplayNotice -task DisplayNotice { - exec { msbuild /version } -} \ No newline at end of file diff --git a/tools/psake/specs/using_parameters_should_pass.ps1 b/tools/psake/specs/using_parameters_should_pass.ps1 deleted file mode 100644 index 63c7e12443..0000000000 --- a/tools/psake/specs/using_parameters_should_pass.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -properties { - $my_property = $p1 + $p2 -} - -task default -depends TestParams - -task TestParams { - Assert ($my_property -ne $null) '$my_property should not be null' -} \ No newline at end of file diff --git a/tools/psake/specs/using_postcondition_should_pass.ps1 b/tools/psake/specs/using_postcondition_should_pass.ps1 deleted file mode 100644 index 0173c5bd20..0000000000 --- a/tools/psake/specs/using_postcondition_should_pass.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -task default -depends A,B,C - -task A { - "TaskA" -} - -task B -postcondition { return $true } { - "TaskB" -} - -task C { - "TaskC" -} \ No newline at end of file diff --git a/tools/psake/specs/using_precondition_should_pass.ps1 b/tools/psake/specs/using_precondition_should_pass.ps1 deleted file mode 100644 index 8be98a64a4..0000000000 --- a/tools/psake/specs/using_precondition_should_pass.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -task default -depends A,B,C - -task A { - "TaskA" -} - -task B -precondition { return $false } { - "TaskB" -} - -task C -precondition { return $true } { - "TaskC" -} \ No newline at end of file diff --git a/tools/psake/specs/using_properties_should_pass.ps1 b/tools/psake/specs/using_properties_should_pass.ps1 deleted file mode 100644 index eb758c1c66..0000000000 --- a/tools/psake/specs/using_properties_should_pass.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -properties { - $x = $null - $y = $null - $z = $null -} - -task default -depends TestProperties - -task TestProperties { - Assert ($x -ne $null) "x should not be null" - Assert ($y -ne $null) "y should not be null" - Assert ($z -eq $null) "z should be null" -} \ No newline at end of file diff --git a/tools/psake/specs/using_required_when_not_set_should_fail.ps1 b/tools/psake/specs/using_required_when_not_set_should_fail.ps1 deleted file mode 100644 index e7cc422eef..0000000000 --- a/tools/psake/specs/using_required_when_not_set_should_fail.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -properties { - $x = $null - $y = $null - $z = $null -} - -task default -depends TestProperties - -task TestProperties -requiredVariables z{ -} diff --git a/tools/psake/specs/using_required_when_set_should_pass.ps1 b/tools/psake/specs/using_required_when_set_should_pass.ps1 deleted file mode 100644 index 9857045d4f..0000000000 --- a/tools/psake/specs/using_required_when_set_should_pass.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -properties { - $x = $null - $y = $null -} - -task default -depends TestRequired - -task TestRequired -requiredVariables x, y { -} diff --git a/tools/psake/specs/whatif_preference_should_pass.ps1 b/tools/psake/specs/whatif_preference_should_pass.ps1 deleted file mode 100644 index fa4f0b30f6..0000000000 --- a/tools/psake/specs/whatif_preference_should_pass.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -Task default -Depends RunWhatIf - -Task RunWhatIf { - try { - ## Setup the -whatif flag globally - $global:WhatIfPreference = $true - - ## Ensure that psake ends up by calling something with -whatif e.g. Set-Item - $parameters = @{p1='whatifcheck';} - - Invoke-psake .\nested\whatifpreference.ps1 -parameters $parameters - } finally { - $global:WhatIfPreference = $false - } -} diff --git a/tools/psake/specs/writing_psake_variables_should_pass.ps1 b/tools/psake/specs/writing_psake_variables_should_pass.ps1 deleted file mode 100644 index 18d378a093..0000000000 --- a/tools/psake/specs/writing_psake_variables_should_pass.ps1 +++ /dev/null @@ -1,34 +0,0 @@ -properties { - $x = 1 -} - -task default -depends Verify - -task Verify -description "This task verifies psake's variables" { - - #Verify the exported module variables - cd variable: - Assert (Test-Path "psake") "variable psake was not exported from module" - - Assert ($psake.ContainsKey("build_success")) "'psake' variable does not contain key 'build_success'" - Assert ($psake.ContainsKey("version")) "'psake' variable does not contain key 'version'" - Assert ($psake.ContainsKey("build_script_file")) "'psake' variable does not contain key 'build_script_file'" - Assert ($psake.ContainsKey("build_script_dir")) "'psake' variable does not contain key 'build_script_dir'" - - Assert (!$psake.build_success) '$psake.build_success should be $false' - Assert ($psake.version) '$psake.version was null or empty' - Assert ($psake.build_script_file) '$psake.build_script_file was null' - Assert ($psake.build_script_file.Name -eq "writing_psake_variables_should_pass.ps1") '$psake.build_script_file.Name was not equal to "writing_psake_variables_should_pass.ps1"' - Assert ($psake.build_script_dir) '$psake.build_script_dir was null or empty' - - Assert ($psake.context.Count -eq 1) '$psake.context should have had a length of one (1) during script execution' - - $config = $psake.context.peek().config - Assert ($config) '$psake.config is $null' - Assert ((new-object "System.IO.FileInfo" $config.buildFileName).FullName -eq $psake.build_script_file.FullName) ('$psake.context.peek().config.buildFileName not equal to "{0}"' -f $psake.build_script_file.FullName) - Assert ($config.framework -eq "4.0") '$psake.context.peek().config.framework not equal to "4.0"' - Assert ($config.taskNameFormat -eq "Executing {0}") '$psake.context.peek().config.taskNameFormat not equal to "Executing {0}"' - Assert (!$config.verboseError) '$psake.context.peek().config.verboseError should be $false' - Assert ($config.coloredOutput) '$psake.context.peek().config.coloredOutput should be $false' - Assert ($config.modules -eq $null) '$psake.context.peek().config.modules is not $null' -} \ No newline at end of file diff --git a/tools/psake/tabexpansion/PsakeTabExpansion.ps1 b/tools/psake/tabexpansion/PsakeTabExpansion.ps1 deleted file mode 100644 index e5a45a2f55..0000000000 --- a/tools/psake/tabexpansion/PsakeTabExpansion.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -$global:psakeSwitches = @('-docs', '-task', '-properties', '-parameters') - -function script:psakeSwitches($filter) { - $psakeSwitches | where { $_ -like "$filter*" } -} - -function script:psakeDocs($filter, $file) { - if ($file -eq $null -or $file -eq '') { $file = 'default.ps1' } - psake $file -docs | out-string -Stream |% { if ($_ -match "^[^ ]*") { $matches[0]} } |? { $_ -ne "Name" -and $_ -ne "----" -and $_ -like "$filter*" } -} - -function script:psakeFiles($filter) { - ls "$filter*.ps1" |% { $_.Name } -} - -function PsakeTabExpansion($lastBlock) { - switch -regex ($lastBlock) { - '(invoke-psake|psake) ([^\.]*\.ps1)? ?.* ?\-ta?s?k? (\S*)$' { # tasks only - psakeDocs $matches[3] $matches[2] | sort - } - '(invoke-psake|psake) ([^\.]*\.ps1)? ?.* ?(\-\S*)$' { # switches only - psakeSwitches $matches[3] | sort - } - '(invoke-psake|psake) ([^\.]*\.ps1) ?.* ?(\S*)$' { # switches or tasks - @(psakeDocs $matches[3] $matches[2]) + @(psakeSwitches $matches[3]) | sort - } - '(invoke-psake|psake) (\S*)$' { - @(psakeFiles $matches[2]) + @(psakeDocs $matches[2] 'default.ps1') + @(psakeSwitches $matches[2]) | sort - } - } -} diff --git a/tools/psake/tabexpansion/Readme.PsakeTab.txt b/tools/psake/tabexpansion/Readme.PsakeTab.txt deleted file mode 100644 index 199b05fab0..0000000000 --- a/tools/psake/tabexpansion/Readme.PsakeTab.txt +++ /dev/null @@ -1,39 +0,0 @@ -_________________________________________________________ -A powershell script for tab completion of psake module build commands - - tab completion for file name: psake d -> psake .\default.ps1 - - tab completion for parameters (docs,task,parameters,properties): psake -t -> psake -task - - tab completion for task: psake -t c -> psake -task Clean ---------------------------------------------------------- - -_________________________________________________________ -Profile example ---------------------------------------------------------- -Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) -. ./PsakeTabExpansion.ps1 -Pop-Location - -if((Test-Path Function:\TabExpansion) -and (-not (Test-Path Function:\DefaultTabExpansion))) { - Rename-Item Function:\TabExpansion DefaultTabExpansion -} - -# Set up tab expansion and include psake expansion -function TabExpansion($line, $lastWord) { - $lastBlock = [regex]::Split($line, '[|;]')[-1] - - switch -regex ($lastBlock) { - # Execute psake tab completion for all psake-related commands - '(Invoke-psake|psake) (.*)' { PsakeTabExpansion $lastBlock } - # Fall back on existing tab expansion - default { DefaultTabExpansion $line $lastWord } - } -} ---------------------------------------------------------- - -_________________________________________________________ -Based on work by: - - - Keith Dahlby, http://solutionizing.net/ - - Mark Embling, http://www.markembling.info/ - - Jeremy Skinner, http://www.jeremyskinner.co.uk/ - - Dusty Candland, http://www.candland.net/blog ---------------------------------------------------------- diff --git a/tools/psake/teamcity.ps1 b/tools/psake/teamcity.ps1 deleted file mode 100644 index bb81e04053..0000000000 --- a/tools/psake/teamcity.ps1 +++ /dev/null @@ -1,126 +0,0 @@ -function TeamCity-TestSuiteStarted([string]$name) { - Write-Output "##teamcity[testSuiteStarted name='$name']" -} - -function TeamCity-TestSuiteFinished([string]$name) { - Write-Output "##teamcity[testSuiteFinished name='$name']" -} - -function TeamCity-TestStarted([string]$name) { - Write-Output "##teamcity[testStarted name='$name']" -} - -function TeamCity-TestFinished([string]$name) { - Write-Output "##teamcity[testFinished name='$name']" -} - -function TeamCity-TestIgnored([string]$name, [string]$message='') { - Write-Output "##teamcity[testIgnored name='$name' message='$message']" -} - -function TeamCity-TestOutput([string]$name, [string]$output) { - Write-Output "##teamcity[testStdOut name='$name' out='$output']" -} - -function TeamCity-TestError([string]$name, [string]$output) { - Write-Output "##teamcity[testStdErr name='$name' out='$output']" -} - -function TeamCity-TestFailed([string]$name, [string]$message, [string]$details='', [string]$type='', [string]$expected='', [string]$actual='') { - $output="##teamcity[testFailed "; - if (![string]::IsNullOrEmpty($type)) { - $output += " type='$type'" - } - - $output += " name='$name' message='$message' details='$details'" - - if (![string]::IsNullOrEmpty($expected)) { - $output += " expected='$expected'" - } - if (![string]::IsNullOrEmpty($actual)) { - $output += " actual='$actual'" - } - - $output += ']' - Write-Output $output -} - -function TeamCity-PublishArtifact([string]$path) { - Write-Output "##teamcity[publishArtifacts '$path']" -} - -function TeamCity-ReportBuildStart([string]$message) { - Write-Output "##teamcity[progessStart '$message']" -} - -function TeamCity-ReportBuildProgress([string]$message) { - Write-Output "##teamcity[progessMessage '$message']" -} - -function TeamCity-ReportBuildFinish([string]$message) { - Write-Output "##teamcity[progessFinish '$message']" -} - -function TeamCity-ReportBuildStatus([string]$status, [string]$text='') { - Write-Output "##teamcity[buildStatus '$status' text='$text']" -} - -function TeamCity-SetBuildNumber([string]$buildNumber) { - Write-Output "##teamcity[buildNumber '$buildNumber']" -} - -function TeamCity-SetBuildStatistic([string]$key, [string]$value) { - Write-Output "##teamcity[buildStatisticValue key='$key' value='$value']" -} - -function TeamCity-CreateInfoDocument([string]$buildNumber='', [boolean]$status=$true, [string[]]$statusText=$null, [System.Collections.IDictionary]$statistics=$null) { - $doc=New-Object xml; - $buildEl=$doc.CreateElement('build'); - - if (![string]::IsNullOrEmpty($buildNumber)) { - $buildEl.SetAttribute('number', $buildNumber); - } - - $buildEl=$doc.AppendChild($buildEl); - - $statusEl=$doc.CreateElement('statusInfo'); - if ($status) { - $statusEl.SetAttribute('status', 'SUCCESS'); - } else { - $statusEl.SetAttribute('status', 'FAILURE'); - } - - if ($statusText -ne $null) { - foreach ($text in $statusText) { - $textEl=$doc.CreateElement('text'); - $textEl.SetAttribute('action', 'append'); - $textEl.set_InnerText($text); - $textEl=$statusEl.AppendChild($textEl); - } - } - - $statusEl=$buildEl.AppendChild($statusEl); - - if ($statistics -ne $null) { - foreach ($key in $statistics.Keys) { - $val=$statistics.$key - if ($val -eq $null) { - $val='' - } - - $statEl=$doc.CreateElement('statisticsValue'); - $statEl.SetAttribute('key', $key); - $statEl.SetAttribute('value', $val.ToString()); - $statEl=$buildEl.AppendChild($statEl); - } - } - - return $doc; -} - -function TeamCity-WriteInfoDocument([xml]$doc) { - $dir=(Split-Path $buildFile) - $path=(Join-Path $dir 'teamcity-info.xml') - - $doc.Save($path); -} \ No newline at end of file