Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
53e8df9
fixed Error message of StringLengthRule
h0lg Mar 25, 2011
92741b5
renamed ConcernOfComparingComplexModelMetadata to ConcernOfComparingM…
h0lg Mar 29, 2011
bab4892
changed reference to System.Web.Mvc from relative HintPath to GAC pre…
h0lg Mar 29, 2011
aa44a44
fixing psake by running tests using xunit.console.clr4.exe
h0lg Apr 4, 2011
86dee29
skipping test requiring EF to be installed
h0lg Apr 4, 2011
bd9cf4b
remove unused variable
h0lg Apr 4, 2011
2353877
corrected ErrorMessageFormat of RangeRule and parameter order of exce…
h0lg Apr 18, 2011
4508bad
updated gitignore with UpgradeReport files & *.orig files from KDiff3…
h0lg Apr 18, 2011
9a36a8f
fixed ClassRuleModelValidator.Validate method to use Metadata.Model a…
h0lg Apr 19, 2011
9874f1a
fixed comments
h0lg Apr 23, 2011
3d71c46
added ConvertEmptyStringToNull property to Metadata
h0lg Mar 28, 2011
491810a
just clarified tasks
h0lg Mar 29, 2011
8e05e47
task for writing missing Metadata.CopyMetaDataFrom tests
h0lg Apr 4, 2011
06baf71
added Custom DataType to IAsProperty
h0lg Apr 4, 2011
895b232
refactored RangeRule to accept IComparables
h0lg Apr 18, 2011
6dcf254
made RangeRule accessible to configuration API via Range(min,max) on …
h0lg Apr 18, 2011
7f0a573
refactored duplicated StringLength information into Getter function o…
h0lg Apr 18, 2011
e903680
added support for minimum string length in rule & configuration API
h0lg Apr 18, 2011
34c1f14
made PropertyMustMatchRule available in API throgh Class.PropertiesSh…
h0lg Apr 18, 2011
83e5b05
added task for System.Web.Mvc.IClientValidatable support
h0lg Apr 18, 2011
99e72f6
commented untested property mappings in Metadata.CopyMetaDataFrom
h0lg Apr 23, 2011
17806f9
copying DataTypeName on CopyMetadataFrom
h0lg Apr 23, 2011
29ef2f8
copying Description on CopyMetadataFrom
h0lg Apr 23, 2011
b1bce04
copying DisplayFormat on CopyMetadataFrom
h0lg Apr 23, 2011
2ccb7bf
copying EditorFormat on CopyMetadataFrom
h0lg Apr 23, 2011
e6636ee
copying HideSurroundingHtml on CopyMetadataFrom
h0lg Apr 23, 2011
a64a170
copying Readonly on CopyMetadataFrom
h0lg Apr 23, 2011
8b748ac
copying NullDisplayText on CopyMetadataFrom
h0lg Apr 23, 2011
b7ac31b
copying ShowDisplay on CopyMetadataFrom
h0lg Apr 23, 2011
4008eb9
copying ShowEditor on CopyMetadataFrom
h0lg Apr 23, 2011
47f0104
copying TemplateHint on CopyMetadataFrom
h0lg Apr 23, 2011
35bde53
copying Watermark on CopyMetadataFrom
h0lg Apr 23, 2011
4f312d0
copying ConvertEmptyStringToNull on CopyMetadataFrom
h0lg Apr 23, 2011
96e77b7
copying Hidden on CopyMetadataFrom
h0lg Apr 23, 2011
42922a7
copying Rules on CopyMetadataFrom
h0lg Apr 23, 2011
3650e3a
added XML docs for Metadata.Hidden
h0lg Apr 23, 2011
7ff2971
updated tasks
h0lg Apr 23, 2011
48495b8
tested for ContainerType being correct on copied metadata
h0lg Apr 23, 2011
80f5ea5
deleted tasks for Metadata properties that don't need to be copied
h0lg Apr 23, 2011
f1d0d89
wrote task for mapping missing Metadata properties in FluentMetadata.…
h0lg Apr 25, 2011
c608d16
added tasks for mapping to ModelMetadata.Description in MVC3
h0lg Apr 25, 2011
c9ad039
DisplayFormat is copied to ModelMetadata
h0lg Apr 25, 2011
2bdf8cb
EditorFormat is copied to ModelMetadata
h0lg Apr 25, 2011
f86ccd6
fixed mapping of DataTypeName to ModelMetadata
h0lg Apr 25, 2011
2b79b63
HideSurroundingHtml is copied to ModelMetadata
h0lg Apr 25, 2011
73d99ca
Readonly is copied to ModelMetadata
h0lg Apr 25, 2011
9cbcacf
refactored validation tests to use ComplexModel
h0lg Apr 25, 2011
bedb704
removed unneeded tests
h0lg Apr 25, 2011
bb2801a
Required is copied to ModelMetadata
h0lg Apr 25, 2011
09b0927
added test for ModelType being correct on ModelMetadata
h0lg Apr 25, 2011
d1fdd8a
NullDisplayText is copied to ModelMetadata
h0lg Apr 25, 2011
6280e94
ShowDisplay is copied to ModelMetadata
h0lg Apr 25, 2011
751a93a
ShowEditor is copied to ModelMetadata
h0lg Apr 25, 2011
147605d
TemplateHint is copied to ModelMetadata respecting HiddenInput as well
h0lg Apr 25, 2011
97ec385
added task for mapping ModelMetadata.Watermark in MVC3
h0lg Apr 25, 2011
1ec6f9e
removing lib from gitignore because library package's lib folders are…
h0lg Apr 4, 2011
12fabf8
updated FluentNHibernate from 1.0.0.593 to 1.2.0.712 and installed FN…
h0lg Jul 7, 2011
0fe119c
added PropertyMustMatchRegexRule & spec null value is valid
h0lg Jul 10, 2011
ed01a25
added PropertyMustMatchRegexRule Spec a value matching the pattern is…
h0lg Jul 11, 2011
876b82f
added PropertyMustMatchRegexRule Spec a value not matching the patter…
h0lg Jul 11, 2011
285d7d0
added PropertyMustMatchRegexRule Spec an empty string value is valid
h0lg Jul 11, 2011
b910fc2
added PropertyMustNotMatchRegexRule as negative of PropertyMustMatchR…
h0lg Jul 11, 2011
0fe9fa5
made Regex rules available in API via <property>.Should(.Not).MatchRe…
h0lg Jul 11, 2011
7c329f7
fixed build script requiring commit message to contain an 'm'
h0lg Jul 11, 2011
44d3e87
result of annoying visual studio project conversion
h0lg Jul 19, 2011
f02a836
refactored QueryFluentMetadata superficially & fixed typo in exceptio…
h0lg Jul 19, 2011
adca1d4
added FluentMetadata.FluentNHibernate.Specs project with first spec f…
h0lg Jul 19, 2011
94817c2
added spec for FluentMetaDataConvention ensuring it AppliesNullToNonR…
h0lg Jul 19, 2011
7fd9cb1
added spec for FluentMetaDataConvention ensuring it AppliesMaximumStr…
h0lg Jul 19, 2011
205b0da
added spec for FluentMetaDataConvention ensuring it DoesNotThrowAnExc…
h0lg Jul 19, 2011
54f6bb4
updated FluentNHibernate from 1.2.0.712 to 1.3.0.717
h0lg Aug 16, 2011
1ca0fc3
implemented IReferenceConvention on FluentMetaDataConvention
h0lg Aug 16, 2011
6f0a5b2
added ability to set localized display name (e.g. from resources) met…
h0lg Aug 19, 2011
b241c2e
added xunit projects fro Debug & Release configs
h0lg Aug 19, 2011
42b45bc
refactored regex rule
h0lg Sep 28, 2011
6778507
formatted for better readability
h0lg Sep 28, 2011
7c4544d
removed unused methods & ctors
h0lg Sep 28, 2011
55987b1
removed empty file
h0lg Sep 29, 2011
3c86700
formatted, removed using
h0lg Sep 29, 2011
7f65946
rewrote fluent interface for PropertyMustMatchRule
h0lg Sep 29, 2011
dbb423b
added a generic class rule and made it available in the fluent syntax…
h0lg Sep 29, 2011
b675c8c
added a generic property rule and made it available in the fluent syn…
h0lg Sep 29, 2011
71eb1d7
added PropertyMustBeLessThanOtherRule and made it available via Class…
h0lg Sep 29, 2011
cd9a18b
fixed typo
h0lg Oct 3, 2011
978ea00
made MetadataHelper internal and removed unused method
h0lg Oct 3, 2011
88da694
added spec for property metadata copied twice using CopyMetadataFrom<>()
h0lg Oct 3, 2011
dcffa5a
initial commit of CopyAutoMappedMetadata feature
h0lg Apr 1, 2011
acacf4d
added test for projected properties, for which AutoMapper does not pr…
h0lg Apr 1, 2011
586e9fc
added support for flattened properties
h0lg Apr 1, 2011
71807d2
refactored MemberMap, used strings instead of MemberInfos which is no…
h0lg Apr 4, 2011
974c80b
added test for destination property resolved from a source property, …
h0lg Apr 4, 2011
0a5f981
updated AutoMapper NuGet package from 1.1.0.118 to 2.1.266
h0lg Oct 31, 2011
8604258
rewrote AutoMapperHelper to take adavantage of new AutoMapper feature
h0lg Oct 31, 2011
4081238
refactored, cleaned up and formatted
h0lg Feb 22, 2012
1429e05
improved encapsulation, refactored and cleaned up
h0lg Mar 26, 2012
7afeeb6
changed test for WebUserIndexModel to test for WebUserIndexGetModel f…
h0lg Mar 27, 2012
151653d
fixed bugs in FluentMetadataBuilder concerning metadata copying from …
h0lg Mar 27, 2012
a4802a6
verified that DataAnnotationsModelValidatorProvider applies implicit …
h0lg Mar 21, 2012
469e297
moved the ModelValidator creation from FluentModelMetadata to FluentV…
h0lg Apr 4, 2012
61a4ee4
returning ModelClientValidationStringLengthRule for StringLengthRule
h0lg Apr 4, 2012
b363011
returning ModelClientValidationRangeRule for RangeRule
h0lg Mar 18, 2012
9c53ab6
returning ModelClientValidationRegexRule for PropertyMustMatchRegexRule
h0lg Mar 18, 2012
b09ecda
wrote and corrected XML docs
h0lg Apr 3, 2012
dcf61af
fixup! added ability to set localized display name (e.g. from resourc…
h0lg Apr 3, 2012
104bc04
added ability to set localized display format (e.g. from resources) m…
h0lg Apr 4, 2012
0ec8b7d
added ability to set localized editor format (e.g. from resources) me…
h0lg Apr 3, 2012
73c3d5e
added ability to set localized description (e.g. from resources) meta…
h0lg Apr 3, 2012
d5212ec
added ability to set localized watermark (e.g. from resources) metada…
h0lg Apr 3, 2012
7bd241f
added ability to set localized NullDisplayText (e.g. from resources) …
h0lg Apr 4, 2012
9b3556e
added ability to set localized error messages (e.g. from resources) f…
h0lg Apr 4, 2012
e20596f
added overload AsBuilder.Custom(DataType)
h0lg Apr 3, 2012
3f295c8
ran code analysis and fixed some issues: renamed, refactored, changed…
h0lg Apr 5, 2012
c082a70
prevented registration of duplicate generic class rules
h0lg Apr 5, 2012
b4ea647
prevented registration of duplicate PropertyMustBeLessThanOtherRules
h0lg Apr 5, 2012
742f6b3
prevented registration of duplicate rules for property related rules
h0lg Apr 5, 2012
a34d7a9
refactored
h0lg Apr 10, 2012
6cda25d
when metadata is copied from type A to type B, prevented copying clas…
h0lg Apr 10, 2012
ecf73c5
when metadata is copied from type A to type B, prevented copying prop…
h0lg Apr 10, 2012
652cfa2
changed API of MetadataDefinitionSorter to enable adding of metadata …
h0lg Apr 11, 2012
91db66a
corrected test method name
h0lg May 29, 2012
df8fab0
fixed errors in and added XML documentation
h0lg May 29, 2012
dadfb8a
replaced mind-bending Type.IsAssignalbleFrom calls wit type extension…
h0lg May 29, 2012
56207ce
refactored
h0lg May 29, 2012
546716f
output XML documentation files
h0lg Apr 30, 2012
b095cce
changed MetadataHelper.CopyMetadata to work with hidden inherited pro…
h0lg May 29, 2012
5a208a5
changed FluentMetadataProvider.GetProperyAccessor to work with hidden…
h0lg May 29, 2012
90ad35a
enabled NuGet package restore for solution
h0lg May 29, 2012
7d09352
added NuGet package folder to gitignore
h0lg May 29, 2012
53ddcf5
updated AutoMapper from 2.1.266 to 2.1.267
h0lg May 29, 2012
6885a39
updated FluentNHibernate from 1.3.0.717 to 1.3.0.727
h0lg May 29, 2012
d415d0f
updated FluentNHibernate from 1.3.0.727 to 1.3.0.733, NHibernate from…
h0lg Jul 20, 2012
cf6d65f
skipping EntityFramework tests that were written against a now outdat…
h0lg Dec 11, 2013
415fb28
formatted
h0lg Dec 11, 2013
6f380fe
removed unused method
h0lg Sep 7, 2012
9edb4c8
removed duplicated metadata in test
h0lg Dec 11, 2013
b411d01
Copying metadata for properties of complex types as well, not only fo…
h0lg Dec 11, 2013
d209c0e
updated AutoMapper NuGet package from 2.1.267 to 3.1.0
h0lg Dec 11, 2013
8e045f9
updated NHibernate NuGet package from 3.3.1.4000 to 3.3.3.4001
h0lg Dec 11, 2013
1281efb
updated Iesi.Collections NuGet package from 3.3.1.4000 to 3.3.3.4001
h0lg Dec 11, 2013
3497a90
updated entity framework from CTP to v6
h0lg Mar 25, 2013
236c267
simplified expression helper
h0lg Sep 7, 2012
a3f174e
moved comments into summaries
h0lg Dec 11, 2013
cf259fa
making sure the Required property value is in sync with the RequiredR…
h0lg Dec 11, 2013
edb5320
ignored visual studio user folder
h0lg Nov 11, 2019
137a814
installed xunit.runner.visualstudio from NuGet
h0lg Nov 11, 2019
9173c29
formatted, updated C# syntax, reordered members, added explicit acces…
h0lg Nov 11, 2019
bbbaf11
updated AutoMapper from 3.1.0 to 6.2.2 to enable mappings between non…
h0lg Nov 11, 2019
8875576
formatted, added access modifiers
h0lg Dec 17, 2019
c6c2898
copying metadata for non-public properties as well
h0lg Nov 11, 2019
df7d34d
only exposing public property metadata to MVC
h0lg Dec 17, 2019
bd46e94
formatted and refactored using auto-properties and expression bodies
h0lg Jul 22, 2021
ded2d30
exposing rule error messages to enable localization
h0lg Jul 22, 2021
ddd7195
updated to MVC 3
h0lg Mar 25, 2011
4d1615f
updated System.Web.Mvc from 3.0.0.0 to 3.0.0.1
h0lg Nov 11, 2019
5323972
updated MVC from 3.0.0.1 from GAC to 3.0.50813.1 from NuGet
h0lg Jul 22, 2021
10b6064
added RequestValidationEnabled property to Metadata (!~System.Web.Mvc…
h0lg Mar 29, 2011
b2aa160
Description is copied to ModelMetadata
h0lg Apr 25, 2011
ee3c23d
Watermark is copied to ModelMetadata
h0lg Apr 25, 2011
2432aaf
returning ModelClientValidationEqualToRule for PropertyMustMatchRule
h0lg Apr 5, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

*.user
*.obj
*.lib
*.suo
*.ncb
*.cache
*.gem
[Ll]ib
[Oo]bj
[Bb]in
[Bb]uild
Expand All @@ -14,4 +14,9 @@
_ReSharper*/
*.vs10x
Source/Gallio Reports
Source/TestResults
Source/TestResults
Source/_UpgradeReport_Files/
*.orig
Source/UpgradeLog*
Source/packages
Source/.vs
6 changes: 6 additions & 0 deletions Source/.nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file added Source/.nuget/NuGet.exe
Binary file not shown.
71 changes: 71 additions & 0 deletions Source/.nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Windows specific commands -->
<NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>

<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig Condition=" '$(OS)' != 'Windows_NT' ">packages.config</PackagesConfig>
<PackagesDir Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)packages</PackagesDir>

<!-- NuGet command -->
<NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<PackageSources>""</PackageSources>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>
</Project>
10 changes: 10 additions & 0 deletions Source/Debug.xunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<xunit>
<assemblies>
<assembly filename="FluentMetadata.Core.Specs\bin\Debug\FluentMetadata.Core.Specs.dll" shadow-copy="true" />
<assembly filename="FluentMetadata.EntityFramework.Specs\bin\Debug\FluentMetadata.EntityFramework.Specs.dll" shadow-copy="true" />
<assembly filename="FluentMetadata.FluentNHibernate.Specs\bin\Debug\FluentMetadata.FluentNHibernate.Specs.dll" shadow-copy="true" />
<assembly filename="FluentMetadata.MVC.Specs\bin\Debug\FluentMetadata.MVC.Specs.dll" shadow-copy="true" />
<assembly filename="FluentMetadata.AutoMapper.Specs\bin\Debug\FluentMetadata.AutoMapper.Specs.dll" shadow-copy="true" />
</assemblies>
</xunit>
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{36BC8904-D8F8-4778-A5BB-F27F1346BAE9}</ProjectGuid>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FluentMetadata.AutoMapper.Specs</RootNamespace>
<AssemblyName>FluentMetadata.AutoMapper.Specs</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=6.2.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.2.2\lib\net40\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit, Version=1.6.0.1516, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\external\xUnit\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SystemUnderTest.cs" />
<Compile Include="When_copying_metadata_from_an_AutoMapped_Type.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FluentMetadata.AutoMapper\FluentMetadata.AutoMapper.csproj">
<Project>{3EA6A0AC-8377-4C2F-A0EA-61278245620E}</Project>
<Name>FluentMetadata.AutoMapper</Name>
</ProjectReference>
<ProjectReference Include="..\FluentMetadata.Core\FluentMetadata.Core.csproj">
<Project>{C73F37FA-D859-4714-8335-35069322176A}</Project>
<Name>FluentMetadata.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
35 changes: 35 additions & 0 deletions Source/FluentMetadata.AutoMapper.Specs/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
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("FluentMetadata.AutoMapper.Specs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("FluentMetadata.AutoMapper.Specs")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[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("10e83014-1379-41a6-821d-50d5a1317676")]

// 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")]
68 changes: 68 additions & 0 deletions Source/FluentMetadata.AutoMapper.Specs/SystemUnderTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using AutoMapper;

namespace FluentMetadata.AutoMapper.Specs
{
internal class Source
{
public string MyProperty { get; set; }
internal string NonPublic { get; set; }
public int Named { get; set; }
public Nested Nested { get; set; }
public string StringField { get; set; }
}

internal class Nested
{
public FurtherNested FurtherNested { get; set; }
}

internal class FurtherNested
{
public int Id { get; set; }
}

internal class Destination
{
public string MyProperty { get; set; }
internal string NonPublic { get; set; }
public int Renamed { get; set; }
public int NestedFurtherNestedId { get; set; }
public int IntProperty { get; set; }
}

internal class FakeResolver : IMemberValueResolver<Source, Destination, string, int>
{
public int Resolve(Source source, Destination destination, string sourceMember, int destMember, ResolutionContext context)
{
return default(int);
}
}

internal class SourceMetaData : ClassMetadata<Source>
{
public SourceMetaData()
{
Class.Display.Name("rzjsfghgafsdfh");
Property(x => x.MyProperty).Display.Name("pockänsdfsdf");
Property(x => x.NonPublic).Description("non-public");
Property(x => x.Named).Description("adföoiulkanhsda");
Property(x => x.StringField).UIHint("üoicvnqwnb");
}
}

internal class FurtherNestedMetaData : ClassMetadata<FurtherNested>
{
public FurtherNestedMetaData()
{
Property(x => x.Id).Is.Required();
}
}

internal class TargetMetaData : ClassMetadata<Destination>
{
public TargetMetaData()
{
this.CopyAutoMappedMetadataFrom(typeof(Source));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using AutoMapper;
using Xunit;

namespace FluentMetadata.AutoMapper.Specs
{
public class When_copying_metadata_from_an_AutoMapped_Type
{
private readonly Metadata destinationMetadata;

public When_copying_metadata_from_an_AutoMapped_Type()
{
FluentMetadataBuilder.Reset();
Mapper.Reset();

Mapper.Initialize(cfg =>
{
cfg.ShouldMapProperty = pi => true; //in order to test NonPublic member mapping as well

cfg.CreateMap<Source, Destination>()
.ForMember(d => d.Renamed, o => o.MapFrom(s => s.Named))
.ForMember(d => d.IntProperty, o => o.ResolveUsing<FakeResolver, string>(s => s.StringField));
});

Mapper.AssertConfigurationIsValid();
FluentMetadataBuilder.ForAssemblyOfType<Source>();

destinationMetadata = QueryFluentMetadata.GetMetadataFor(typeof(Destination));
}

[Fact]
public void a_destination_property_should_have_metadata_from_the_source_property_it_is_mapped_to()
{
Assert.Equal("pockänsdfsdf", destinationMetadata.Properties[nameof(Destination.MyProperty)].GetDisplayName());
}

[Fact]
public void a_non_public_destination_property_should_have_metadata_from_the_source_property_it_is_mapped_to()
{
Assert.Equal("non-public", destinationMetadata.Properties[nameof(Destination.NonPublic)].GetDescription());
}

[Fact]
public void the_destination_type_should_have_metadata_from_the_source_type_it_is_mapped_to()
{
Assert.Equal("rzjsfghgafsdfh", destinationMetadata.GetDisplayName());
}

[Fact]
public void a_projected_destination_property_should_have_metadata_from_the_source_property_it_is_mapped_to()
{
Assert.Equal("adföoiulkanhsda", destinationMetadata.Properties[nameof(Destination.Renamed)].GetDescription());
}

[Fact]
public void a_flattened_destination_property_should_have_metadata_from_the_source_property_it_is_mapped_to()
{
Assert.Equal(true, destinationMetadata.Properties[nameof(Destination.NestedFurtherNestedId)].Required);
}

[Fact]
public void a_destination_property_resolved_from_a_source_property_should_have_metadata_from_the_source_property()
{
Assert.Equal("üoicvnqwnb", destinationMetadata.Properties[nameof(Destination.IntProperty)].TemplateHint);
}
}
}
11 changes: 11 additions & 0 deletions Source/FluentMetadata.AutoMapper.Specs/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.2.2.0" newVersion="6.2.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Loading