Esempio n. 1
0
        public static ServicesModel Create()
        {
            var context    = DieteticSNSContextFactory.Create();
            var mapperMock = new Mock <IMapper>();

            var mapperConfigurationProfiles = new List <Profile>();
            var profiles = typeof(CountriesProfile).Assembly.GetTypes().Where(x => typeof(Profile).IsAssignableFrom(x));

            foreach (var profile in profiles)
            {
                mapperConfigurationProfiles.Add(Activator.CreateInstance(profile) as Profile);
            }

            var mapperConfiguration = new MapperConfiguration(cfg => cfg.AddProfiles(mapperConfigurationProfiles));

            var configuration = CreateConfiguration();

            return(new ServicesModel
            {
                Context = context,
                Mapper = mapperConfiguration.CreateMapper(),
                Configuration = configuration
            });
        }
 public void Dispose()
 {
     DieteticSNSContextFactory.Destroy(Context);
 }