public void CanInvalidateSimple() { var simple = new Simple(); MappingConfigurationLoader.LoadConfigurations(); IValidate <Simple> valid = new SimpleValidator(new AutoMapperMappingService()); var result = valid.Check(simple); Assert.False(result.IsValid); }
public void CanValidateSimple() { var simple = new Simple { Name = "Fozzy", EmailAddress = "*****@*****.**" }; MappingConfigurationLoader.LoadConfigurations(); IValidate <Simple> valid = new SimpleValidator(new AutoMapperMappingService()); var result = valid.Check(simple); Assert.True(result.IsValid); }
public void ValidationMessagesAreCorrectlyTransformed() { var simple = new Simple(); MappingConfigurationLoader.LoadConfigurations(); var validator = new SimpleValidator(new AutoMapperMappingService()); var fluentResults = validator.Validate(simple); var myResults = validator.Check(simple); Assert.Equal(fluentResults.IsValid, myResults.IsValid); foreach (var thing in fluentResults.Errors) { Assert.True(myResults.FailureMessages.Any(fm => fm.Message == thing.ErrorMessage)); } }
public static void Boot(BootConfiguration configuration) { lock (bootLock) { if (bootedKernel == null) { bootedKernel = new Kernel(); bootedKernel.Configuration = configuration; configuration.Out("Booting..."); bootedKernel.ServiceLocatorInstance = new NinjectServiceLocator(configuration.Modules); configuration.Out("Loaded Ninject Modules"); MappingConfigurationLoader.LoadConfigurations(); configuration.Out("Configured Object Mappings"); if (configuration.CheckServices) { bootedKernel.CheckServices(); } configuration.Out("Boot Complete."); } } }