Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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));
            }
        }
Ejemplo n.º 4
0
        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.");
                }
            }
        }