Last active
December 12, 2015 04:08
-
-
Save emiaj/4712439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class InputQueryModel : InputCommandModel | |
| { | |
| } | |
| public class InputCommandModel | |
| { | |
| public string Name { get; set; } | |
| } | |
| [Test] | |
| public void smoke() | |
| { | |
| var typeDescriptorCache = new TypeDescriptorCache(); | |
| var accessorRules = new AccessorRules(); | |
| accessorRules.Add<InputCommandModel>(x => x.Name, new RequiredFieldRule()); | |
| // GREEN, reports 1 element | |
| typeDescriptorCache.GetPropertiesFor<InputCommandModel>() | |
| .Select(keyValuePair => keyValuePair.Value) | |
| .Select(property => new SingleProperty(property)) | |
| .SelectMany(accessorRules.AllRulesFor<IFieldValidationRule>) | |
| .ShouldHaveCount(1); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class InputQueryModel | |
| { | |
| public string Name { get; set; } | |
| } | |
| public class InputCommandModel : InputQueryModel | |
| { | |
| } | |
| [Test] | |
| public void smoke() | |
| { | |
| var typeDescriptorCache = new TypeDescriptorCache(); | |
| var accessorRules = new AccessorRules(); | |
| accessorRules.Add<InputCommandModel>(x => x.Name, new RequiredFieldRule()); | |
| // RED, reports 0 elements | |
| typeDescriptorCache.GetPropertiesFor<InputCommandModel>() | |
| .Select(keyValuePair => keyValuePair.Value) | |
| .Select(property => new SingleProperty(property)) | |
| .SelectMany(accessorRules.AllRulesFor<IFieldValidationRule>) | |
| .ShouldHaveCount(1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment