public static void InitializeFactories(TestContext context)
        {
            LoggerFactory.SetCurrent(new TraceSourceLogFactory());

            EntityValidatorFactory.SetCurrent(new DataAnnotationsEntityValidatorFactory());

            var dto = new CountryDTO(); // this is only to force  current domain to load de .DTO assembly and all profiles

            var adapterfactory = new AutomapperTypeAdapterFactory();

            TypeAdapterFactory.SetCurrent(adapterfactory);
        }
Ejemplo n.º 2
0
        private void InitializeFactories()
        {
            EntityValidatorFactory.SetCurrent(new DataAnnotationsEntityValidatorFactory());

            var dto = new BlogDTO(); // this is only to force  current domain to load de .DTO assembly and all profiles

            var adapterfactory = new AutomapperTypeAdapterFactory();

            TypeAdapterFactory.SetCurrent(adapterfactory);

            //Localization
            LocalizationFactory.SetCurrent(new ResourcesManagerFactory());
        }
Ejemplo n.º 3
0
        public void Test1()
        {
            ITypeAdapterFactory typeAdapterFactory = new AutomapperTypeAdapterFactory();

            TypeAdapterFactory.SetCurrent(typeAdapterFactory);
            var adapter = TypeAdapterFactory.CreateAdapter();

            Person person = new Person {
                FirstName = "John", LastName = "Doe"
            };
            PersonDTO personDTO = adapter.Adapt <PersonDTO>(person);

            Assert.Equal("John", personDTO.FirstName);
            Assert.Equal("Doe", personDTO.LastName);
        }