From 4fbe395d2d9847bed65cebfa6a30de323c14e426 Mon Sep 17 00:00:00 2001 From: Kai Ilbertz Date: Mon, 11 Apr 2016 10:49:49 +0200 Subject: [PATCH] prepare release v1.1.4 --- CHANGELOG.md | 4 +++ README.md | 21 +++++++--------- src/Nca.Valdr.Core.Nuget/Package.nuspec | 2 +- src/Nca.Valdr.Core.Nuget/lib/Nca.Valdr.dll | Bin 22528 -> 22528 bytes src/Nca.Valdr.Core.Nuget/lib/Nca.Valdr.xml | 10 ++++++++ src/Nca.Valdr.Nuget/Package.nuspec | 2 +- src/Nca.Valdr.Nuget/lib/Nca.Valdr.Console.exe | Bin 10752 -> 10752 bytes src/Nca.Valdr.Nuget/lib/Nca.Valdr.dll | Bin 22528 -> 22528 bytes src/Nca.Valdr.Tests/DTOs/AddressDto.cs | 10 +++++++- src/Nca.Valdr.Tests/DTOs/Texts.Designer.cs | 9 +++++++ src/Nca.Valdr.Tests/DTOs/Texts.en.resx | 19 +++++++++------ src/Nca.Valdr.Tests/DTOs/Texts.resx | 19 +++++++++------ src/Nca.Valdr.Tests/ValidationTests.cs | 23 ++++++++++++++++-- src/Nca.Valdr/FutureAttribute.cs | 8 ++++++ src/Nca.Valdr/PastAttribute.cs | 8 ++++++ .../Properties/CommonAssemblyInfo.cs | 6 ++--- 16 files changed, 105 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1c5915..5c5208e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.1.4 - 2016-04-11 +- Future and past validation attributes added +- Moved the source to src folder + ## 1.1.3 - 2016-02-22 - Fixed bug with multiple resource files - Rename ValdrType/ValdrMember to ...Attribute diff --git a/README.md b/README.md index 17e70b3..1fcf5c0 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ PM> Install-Package Nca.Valdr In Visual Studio, right-click your project and under Properties/Build Events add the following Post-build event: ```Batchfile -$(SolutionDir)packages\Nca.Valdr.1.1.3\tools\Nca.Valdr.Console.exe -i:$(TargetDir)$(TargetFileName) -o:$(ProjectDir)app\app.valdr.js +$(SolutionDir)packages\Nca.Valdr.1.1.4\tools\Nca.Valdr.Console.exe -i:$(TargetDir)$(TargetFileName) -o:$(ProjectDir)app\app.valdr.js ``` Nca.Valdr.exe accepts the following parameters: @@ -58,20 +58,19 @@ This will add the core library to your project, which brings with it the parser ```csharp - public class ConstraintsController : Controller + public class ConstraintsController : ApiController { private readonly IParser _constraintParser; - public ConstraintsController(IParser constraintParser) + public ConstraintsController() { - _constraintParser = constraintParser; + _constraintParser = new Parser(); } - [Route("/api/Constraints")] - [ResponseCache(Duration = 600)] - public IActionResult Index() + [HttpGet] + public JObject Index() { - JObject constraints = _constraintParser.Parse( + return _constraintParser.Parse( //optional culture (for resolving validation messages from resource files) CultureInfo.CurrentCulture, //optional namespace filter - StartsWith search @@ -83,8 +82,6 @@ This will add the core library to your project, which brings with it the parser //assembly(s) to parse for constraint generation Assembly.GetAssembly(typeof (MyDTO)) ); - - return new ObjectResult(constraints); } } ``` @@ -125,8 +122,8 @@ The [.NET DataAnnotations](https://msdn.microsoft.com/en-us/library/system.compo | [StringLength](https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.stringlengthattribute%28v=vs.110%29.aspx) | [size](https://github.com/netceteragroup/valdr#size) | | | | [digits](https://github.com/netceteragroup/valdr#digits) | unsupported | | [RegularExpression](https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.regularexpressionattribute%28v=vs.110%29.aspx) | [pattern](https://github.com/netceteragroup/valdr#partern) | | -| | [future](https://github.com/netceteragroup/valdr#future--past) | unsupported | -| | [past](https://github.com/netceteragroup/valdr#future--past) | unsupported | +| Future | [future](https://github.com/netceteragroup/valdr#future--past) | Nca.Valdr namespace | +| Past | [past](https://github.com/netceteragroup/valdr#future--past) | Nca.Valdr namespace | | [EmailAddress](https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.emailaddressattribute%28v=vs.110%29.aspx) |[email](https://github.com/netceteragroup/valdr#email) | | | [URL](https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.urlattribute%28v=vs.110%29.aspx) |[url](https://github.com/netceteragroup/valdr#url) | | diff --git a/src/Nca.Valdr.Core.Nuget/Package.nuspec b/src/Nca.Valdr.Core.Nuget/Package.nuspec index d906ca5..fe70e07 100644 --- a/src/Nca.Valdr.Core.Nuget/Package.nuspec +++ b/src/Nca.Valdr.Core.Nuget/Package.nuspec @@ -2,7 +2,7 @@ Nca.Valdr.Core - 1.1.3 + 1.1.4 valdr .NET Validator Core Netcetera, Alex Ullrich ilbertz diff --git a/src/Nca.Valdr.Core.Nuget/lib/Nca.Valdr.dll b/src/Nca.Valdr.Core.Nuget/lib/Nca.Valdr.dll index d2742ec766e7aa46bbc893e61a5cdd39defc9394..20fe96ffc053739e22de7a247cf8939d5dac9666 100644 GIT binary patch delta 7338 zcmbVR3v^WFwch_ZXU>^(=D|!RnLG%R07)if5(osEAVl60t?t%9;FRY71;U!{}+3szfh5$?DDGYKJFU7A@d z-|TPifA9a_`#=BVOjhp_t9OYf)~g@Q^E5r$L;SvJTR&AjK~2Z<{0}W9nnd`lCR(XA z<%Yb^5_!RgFCogdb0UqWJ>LI*n1!1*`=a) z>ttoGnlW98^d++3Q@@9(E>gq<8atr(4n{$IX0#jWkz$CE5_^}PRniZl5v*Y&IV zP$IoyFw}V=V-*{MMnn)5g>(w)5d~7L0@jeb{0fpzaYu$QGbw1sP!R;Xr9-ev4mQ+& z#<(Q`(Mr9lhP**<#m~50K`X{Oy|HHphuhczfZn^UVneW7MC0ClDZa>X=tF^&Kx71j zViP@%giw^$*|dBBkqG&XpueFE4Pv7JZggn&OpT4UN4p25je%y!Kd)Z9cA{H~`)U|- z-aR(f{+|1edn-_(NH#`cDO&yPHsS%<&_=u z<>n}5j$*GedxUxPAu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k`rAG}YA1(X$dPV5uYl*3|K!saFa2~jAb{!c`c)Rc=_%d1q2(N<8|C*F%= zm!F}JtaQZ^jxSqTK-GZ)<+vE4qkFMCa0m3qw0X)0VwAo_=@5$pjml~or9T4v4gL$! zA?8AJkJQ{FHJj-P?TE4!_+QF)boq&LhIae^qC5#%Q~wQ^uI`t30E3R#sYm3f3&lsC zg=(v~FHo-*iXZw{s;^QwuwH$G&RRcKPr|fL{cmYmE|%eJ$W?ftme?9N1h1Wem(`i5 z(`%|F{wZ)m?VugLchry2%_7l?G(LpQQT4pE`5gGT^;dN*Pkkv_=#oQ>^?S8eaR>*i zCF=Yf`UFnyR`EM4OWP&x2@FE3-u`akK4pHJ)`sU_oy|Ba@EEX7+XCfzRe zCiwCJbgziwyNb@?>ruAQY-JVwkNQ4%`@fbh)!K6_mf6nc5r^7;HS(yId~o^^E6w}+ zTemfDEN*;h{L1#tV^*7iiqavtRtxf!mzI}Sw1;YUi?~ToZ5aL7o{O(!73{z7bVt^< z+rRw&p7+~2&ea)}E20m#{<-6vx9P~*(eu98zUI-_>wdba;J3cv#p{|1t4@69(epbF zZr_ym@E6ZKJ@vqwH3x6l_ti7Y4||*5S>b6~dHu;3KmF5ymbS{pd9@EsyFcgT`BlNA zBXTp}e&pnr^*^jWTJZ2^FXxw+7jZ4{uR*+{^KpiM`=J=m)Z;q=vpn_Yshi%u^Rf2H zkulqbCzlVfKVQ+l0{=Wrxwwq&-A`yaesfxLL&9`+Oj_<7oA{&?nA~Eim_e?r+WwQt i9YR#Jx7O{!k27Lg1<1;2KM_iJM0;@hpGE5s + + + Default constructor. + + Determines whether the specified date is in the past. @@ -28,6 +33,11 @@ Future date validation. + + + Default constructor. + + Determines whether the specified date is in the future. diff --git a/src/Nca.Valdr.Nuget/Package.nuspec b/src/Nca.Valdr.Nuget/Package.nuspec index 8f0c3a3..08cb166 100644 --- a/src/Nca.Valdr.Nuget/Package.nuspec +++ b/src/Nca.Valdr.Nuget/Package.nuspec @@ -2,7 +2,7 @@ Nca.Valdr - 1.1.3 + 1.1.4 valdr .NET Validator Netcetera ilbertz diff --git a/src/Nca.Valdr.Nuget/lib/Nca.Valdr.Console.exe b/src/Nca.Valdr.Nuget/lib/Nca.Valdr.Console.exe index 221f892e828a1bfcc2f1688d922943f438e5cb72..b053140754a6600a36ebf5e3b5f5518fd9b7008d 100644 GIT binary patch delta 153 zcmZn&X$YCn!F)HFdt-MfA0x};hkTZdESshI1$hMg9K|Qs8Zo(TabxE{w_@g*%{J1S zOnfGK1`G^bj0~)XdWL!?lZ$2V>Hu|zGXMb-5X&$!Fl5*Ou^ami;0tkfe{E97+5x+S2)YaXtH^((rF+yIa9?L#8F9R1pu^fDZ2mw delta 153 zcmZn&X$YCn!F*qVYh!mPA0zYRhkTZd%$ue81$hLbQfKf6dhxi=nSHQncZ=-5%{J1S zOnkHu|zGXMb-5X&$!Fl5*Ou^a8q8?H+PhDZ?2K^V&Y_GU<5)22IkG@70xm;8gHJfbQ(xa&Qvi5aa5970o|}EzW@LL diff --git a/src/Nca.Valdr.Nuget/lib/Nca.Valdr.dll b/src/Nca.Valdr.Nuget/lib/Nca.Valdr.dll index d2742ec766e7aa46bbc893e61a5cdd39defc9394..20fe96ffc053739e22de7a247cf8939d5dac9666 100644 GIT binary patch delta 7338 zcmbVR3v^WFwch_ZXU>^(=D|!RnLG%R07)if5(osEAVl60t?t%9;FRY71;U!{}+3szfh5$?DDGYKJFU7A@d z-|TPifA9a_`#=BVOjhp_t9OYf)~g@Q^E5r$L;SvJTR&AjK~2Z<{0}W9nnd`lCR(XA z<%Yb^5_!RgFCogdb0UqWJ>LI*n1!1*`=a) z>ttoGnlW98^d++3Q@@9(E>gq<8atr(4n{$IX0#jWkz$CE5_^}PRniZl5v*Y&IV zP$IoyFw}V=V-*{MMnn)5g>(w)5d~7L0@jeb{0fpzaYu$QGbw1sP!R;Xr9-ev4mQ+& z#<(Q`(Mr9lhP**<#m~50K`X{Oy|HHphuhczfZn^UVneW7MC0ClDZa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2c+|g`2GO&y97HcEYk+OaT5K-1k4XDUDOXB4B7G|**3xcx)xv%a zy-ij6Dd42QAA#}V_J{NVrR)Dk$0?rZ<|1Ss%G(q{>kbStna)T}2R-YXE~Y_VBz6f^ zUk)4^*dk`rAG}YA1(X$dPV5uYl*3|K!saFa2~jAb{!c`c)Rc=_%d1q2(N<8|C*F%= zm!F}JtaQZ^jxSqTK-GZ)<+vE4qkFMCa0m3qw0X)0VwAo_=@5$pjml~or9T4v4gL$! zA?8AJkJQ{FHJj-P?TE4!_+QF)boq&LhIae^qC5#%Q~wQ^uI`t30E3R#sYm3f3&lsC zg=(v~FHo-*iXZw{s;^QwuwH$G&RRcKPr|fL{cmYmE|%eJ$W?ftme?9N1h1Wem(`i5 z(`%|F{wZ)m?VugLchry2%_7l?G(LpQQT4pE`5gGT^;dN*Pkkv_=#oQ>^?S8eaR>*i zCF=Yf`UFnyR`EM4OWP&x2@FE3-u`akK4pHJ)`sU_oy|Ba@EEX7+XCfzRe zCiwCJbgziwyNb@?>ruAQY-JVwkNQ4%`@fbh)!K6_mf6nc5r^7;HS(yId~o^^E6w}+ zTemfDEN*;h{L1#tV^*7iiqavtRtxf!mzI}Sw1;YUi?~ToZ5aL7o{O(!73{z7bVt^< z+rRw&p7+~2&ea)}E20m#{<-6vx9P~*(eu98zUI-_>wdba;J3cv#p{|1t4@69(epbF zZr_ym@E6ZKJ@vqwH3x6l_ti7Y4||*5S>b6~dHu;3KmF5ymbS{pd9@EsyFcgT`BlNA zBXTp}e&pnr^*^jWTJZ2^FXxw+7jZ4{uR*+{^KpiM`=J=m)Z;q=vpn_Yshi%u^Rf2H zkulqbCzlVfKVQ+l0{=Wrxwwq&-A`yaesfxLL&9`+Oj_<7oA{&?nA~Eim_e?r+WwQt i9YR#Jx7O{!k27Lg1<1;2KM_iJM0;@hpGE5s - /// Address data transfer object + /// Address data transfer object. /// [DataContract(Name = "address")] [ValdrType(Name = "address")] public class AddressDto { + /// + /// Street name. + /// + [DataMember(Name = "street")] + [ValdrMember(Name = "street")] + [Display(ResourceType = typeof(Texts), Name = "Address_Street")] + public string Street { get; set; } + /// /// City name /// diff --git a/src/Nca.Valdr.Tests/DTOs/Texts.Designer.cs b/src/Nca.Valdr.Tests/DTOs/Texts.Designer.cs index 9a874eb..6e450b5 100644 --- a/src/Nca.Valdr.Tests/DTOs/Texts.Designer.cs +++ b/src/Nca.Valdr.Tests/DTOs/Texts.Designer.cs @@ -69,6 +69,15 @@ public static string Address_City { } } + /// + /// Looks up a localized string similar to Strasse. + /// + public static string Address_Street { + get { + return ResourceManager.GetString("Address_Street", resourceCulture); + } + } + /// /// Looks up a localized string similar to PLZ. /// diff --git a/src/Nca.Valdr.Tests/DTOs/Texts.en.resx b/src/Nca.Valdr.Tests/DTOs/Texts.en.resx index 6603c3b..3a86395 100644 --- a/src/Nca.Valdr.Tests/DTOs/Texts.en.resx +++ b/src/Nca.Valdr.Tests/DTOs/Texts.en.resx @@ -120,19 +120,22 @@ City - - Zip code + + Street - - {0} must be between {1} and {2} characters. + + Last name + + + First name {0} is required. - - First name + + {0} must be between {1} and {2} characters. - - Last name + + Zip code \ No newline at end of file diff --git a/src/Nca.Valdr.Tests/DTOs/Texts.resx b/src/Nca.Valdr.Tests/DTOs/Texts.resx index 6caddab..93b13c3 100644 --- a/src/Nca.Valdr.Tests/DTOs/Texts.resx +++ b/src/Nca.Valdr.Tests/DTOs/Texts.resx @@ -120,19 +120,22 @@ Ort - - PLZ + + Strasse - - {0} muss zwischen {1} und {2} Zeichen sein. + + Nachname + + + Vorname {0} ist obligatorisch. - - Vorname + + {0} muss zwischen {1} und {2} Zeichen sein. - - Nachname + + PLZ \ No newline at end of file diff --git a/src/Nca.Valdr.Tests/ValidationTests.cs b/src/Nca.Valdr.Tests/ValidationTests.cs index 9818cc6..52ce12a 100644 --- a/src/Nca.Valdr.Tests/ValidationTests.cs +++ b/src/Nca.Valdr.Tests/ValidationTests.cs @@ -10,7 +10,7 @@ public class ValidationTests { [Test] - public void PersonValidatorTest() + public void PersonValidatorInvalidTest() { // Arrange var person = new PersonDto @@ -28,8 +28,27 @@ public void PersonValidatorTest() Assert.That(isValid, Is.False); Assert.That(results[0].ErrorMessage, Is.EqualTo("First name is required.")); Assert.That(results[1].ErrorMessage, Is.EqualTo("Last name is required.")); - Assert.That(results[2].ErrorMessage, Is.EqualTo("The field validTo is invalid.")); + Assert.That(results[2].ErrorMessage, Is.EqualTo("validTo must be in the future")); Assert.That(results[3].ErrorMessage, Is.EqualTo("Birthday must be in the past.")); } + + [Test] + public void PersonValidatorValidTest() + { + // Arrange + var person = new PersonDto + { + FirstName = "Test", + LastName = "Test" + }; + var context = new ValidationContext(person, serviceProvider: null, items: null); + var results = new List(); + + // Act + var isValid = Validator.TryValidateObject(person, context, results, validateAllProperties: true); + + // Assert + Assert.That(isValid, Is.True); + } } } \ No newline at end of file diff --git a/src/Nca.Valdr/FutureAttribute.cs b/src/Nca.Valdr/FutureAttribute.cs index 85e6dd0..c2c32c7 100644 --- a/src/Nca.Valdr/FutureAttribute.cs +++ b/src/Nca.Valdr/FutureAttribute.cs @@ -10,6 +10,14 @@ [AttributeUsage(AttributeTargets.Property)] public sealed class FutureAttribute : ValidationAttribute { + /// + /// Default constructor. + /// + public FutureAttribute() + { + ErrorMessage = "{0} must be in the future"; + } + /// /// Determines whether the specified date is in the future. /// diff --git a/src/Nca.Valdr/PastAttribute.cs b/src/Nca.Valdr/PastAttribute.cs index d278efb..c4aa6ce 100644 --- a/src/Nca.Valdr/PastAttribute.cs +++ b/src/Nca.Valdr/PastAttribute.cs @@ -10,6 +10,14 @@ [AttributeUsage(AttributeTargets.Property)] public sealed class PastAttribute : ValidationAttribute { + /// + /// Default constructor. + /// + public PastAttribute() + { + ErrorMessage = "{0} must be in the past"; + } + /// /// Determines whether the specified date is in the past. /// diff --git a/src/Nca.Valdr/Properties/CommonAssemblyInfo.cs b/src/Nca.Valdr/Properties/CommonAssemblyInfo.cs index 04d9246..c72de50 100644 --- a/src/Nca.Valdr/Properties/CommonAssemblyInfo.cs +++ b/src/Nca.Valdr/Properties/CommonAssemblyInfo.cs @@ -27,6 +27,6 @@ // 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.1.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")] -[assembly: AssemblyInformationalVersion("1.1.3")] +[assembly: AssemblyVersion("1.1.4.0")] +[assembly: AssemblyFileVersion("1.1.4.0")] +[assembly: AssemblyInformationalVersion("1.1.4")]