Beispiel #1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     AutoMapperInitializer.Initialize();
     services.AddAutoMapper();
     services.AddDependencyInjection(connectionString);
     services.AddMvc();
 }
Beispiel #2
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            AutoMapperInitializer.Initialize();
            SimpleInjectorContainer.Initialize();
        }
Beispiel #3
0
        public void Init()
        {
            _fakeBrsConfigurationTemplateRepository = new Mock <IBRSConfigurationTemplateRepository>();
            _fakeTenantSettingsRepository           = new Mock <ITenantSettingsRepository>();
            _fakeRunRepository                  = new Mock <IRunRepository>();
            _fakeScenarioRepository             = new Mock <IScenarioRepository>();
            _fakeSalesAreaRepository            = new Mock <ISalesAreaRepository>();
            _fakeCampaignRepository             = new Mock <ICampaignRepository>();
            _fakeDemographicRepository          = new Mock <IDemographicRepository>();
            _fakeDeliveryCappingGroupRepository = new Mock <IDeliveryCappingGroupRepository>();
            _fakeFeatureManager                 = new Mock <IFeatureManager>();
            _fakeRunTypeRepository              = new Mock <IRunTypeRepository>();
            _fakeAnalysisGroupRepository        = new Mock <IAnalysisGroupRepository>();
            _mapper = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _runsValidator = new RunsValidator(
                _fakeBrsConfigurationTemplateRepository.Object,
                _fakeTenantSettingsRepository.Object,
                _fakeRunRepository.Object,
                _fakeScenarioRepository.Object,
                _fakeSalesAreaRepository.Object,
                _fakeCampaignRepository.Object,
                _fakeDemographicRepository.Object,
                _fakeDeliveryCappingGroupRepository.Object,
                _fakeFeatureManager.Object,
                _fakeRunTypeRepository.Object,
                _fakeAnalysisGroupRepository.Object,
                _mapper);
        }
Beispiel #4
0
        public void Init()
        {
            _fakeRepository    = new Mock <IBRSConfigurationTemplateRepository>();
            _kpiFakeRepository = new Mock <IKPIPriorityRepository>();
            _fixture           = new Fixture();

            _mapper = AutoMapperInitializer.Initialize(Configuration.AutoMapperConfig.SetupAutoMapper);

            _validModels = CreateValidModels(1);

            _ = _fakeRepository
                .Setup(r => r.Get(It.Is <int>(x => x > 0)))
                .Returns(CreateRepositoryData().First());

            _ = _fakeRepository
                .Setup(r => r.GetAll())
                .Returns(CreateRepositoryData(3));

            _ = _kpiFakeRepository
                .Setup(x => x.GetAll())
                .Returns(GetKPIPriorities());

            _ = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _validator  = new CreateOrUpdateBRSConfigurationTemplateValidator(new CreateOrUpdateBRSConfigurationTemplateValidation(_kpiFakeRepository.Object, _fakeRepository.Object));
            _controller = new BRSTemplatesController(_fakeRepository.Object, _validator, _mapper);
        }
        public BooksControllerTests()
        {
            AutoMapperInitializer.Initialize();

            this.categoriesMock = new Mock <ICategoryService>();
            this.sut            = new BooksController(this.categoriesMock.Object, null, null, null, null, null);
        }
Beispiel #6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration["POSTGRES_STRING"] ?? "Host=localhost;Port=5432;Database=schedule_api_db_3;Username=postgres;Password=5525854565";
            var herokuString = Configuration["HEROKU_STRING"] ?? "";
            if (herokuString != "")
            {
                connectionString = HerokuToEfString(herokuString);
            }

            ScheduleContext.ConnectionString = connectionString;
            services.AddEntityFrameworkNpgsql()
                .AddDbContext<ScheduleContext>(options => options.UseNpgsql(connectionString));

            services.AddMvc();

            //services.AddTransient<IUnitOfWork, UnitOfWork>();

            AutoMapperInitializer.Initialize();

            services.AddSwaggerGen(c =>
                c.SwaggerDoc("v1", new Info()
                {
                    Title = "Schedule API",
                    Version = "v1"
                })
            );
        }
Beispiel #7
0
        public void Init()
        {
            _fixture                  = new SafeFixture();
            _fakeSpotRepository       = new Mock <ISpotRepository>();
            _fakeCampaignRepository   = new Mock <ICampaignRepository>();
            _fakeProductRepository    = new Mock <IProductRepository>();
            _fakeClashRepository      = new Mock <IClashRepository>();
            _fakeBreakRepository      = new Mock <IBreakRepository>();
            _fakeScheduleRepository   = new Mock <IScheduleRepository>();
            _fakeAuditEventRepository = new Mock <IAuditEventRepository>();
            _fakeDataChangeValidator  = new Mock <IDataChangeValidator>();

            _mapper = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _controller = new SpotsController(
                _fakeSpotRepository.Object,
                _fakeBreakRepository.Object,
                _fakeScheduleRepository.Object,
                _fakeDataChangeValidator.Object,
                _fakeAuditEventRepository.Object,
                new SpotModelCreator(_fakeCampaignRepository.Object, _fakeProductRepository.Object, _fakeClashRepository.Object, _mapper),
                _mapper
                );

            _controller.Request = new HttpRequestMessage();
            _controller.Request.SetConfiguration(new HttpConfiguration());
        }
Beispiel #8
0
        protected void Application_Start()
        {
            AutoMapperInitializer.Initialize();
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            DependencyResolver.SetResolver(new StructureMapDependencyResolver(() => Container ?? IoC.Container));

            IoC.Container.Configure(cfg =>
            {
                cfg.Scan(scan =>
                {
                    scan.TheCallingAssembly();
                    scan.WithDefaultConventions();
                });

                cfg.AddRegistry(new MediatorRegistry());
                cfg.For <ModelValidatorProvider>().Use <FluentValidationModelValidatorProvider>();
                cfg.For <IValidatorFactory>().Use(new ValidatorFactory(() => Container ?? IoC.Container));
                cfg.For <IFilterProvider>().Use(new FilterProvider(() => Container ?? IoC.Container));
                cfg.Policies.SetAllProperties(
                    sc =>
                {
                    sc.Matching(
                        p =>
                        p.DeclaringType.CanBeCastTo(typeof(ActionFilterAttribute)) &&
                        p.DeclaringType.Namespace.StartsWith("Employees") && !p.PropertyType.IsPrimitive &&
                        (p.PropertyType != typeof(string)));
                });
            });
        }
        public UserServiceTests()
        {
            AutoMapperInitializer.Initialize();

            this.databaseMock = BookHeavenDbContextInMemory.New();
            this.sut          = new UserService(this.databaseMock, null, null);
        }
Beispiel #10
0
        public void Init()
        {
            _fakeBreakRepository      = new Mock <IBreakRepository>();
            _fakeScheduleRepository   = new Mock <IScheduleRepository>();
            _fakeSpotRepository       = new Mock <ISpotRepository>();
            _fakeAuditEventRepository = new Mock <IAuditEventRepository>();
            _fakeDataChangeValidator  = new Mock <IDataChangeValidator>();
            _fakeMetadataRepository   = new Mock <IMetadataRepository>();
            _fakeSalesAreaRepository  = new Mock <ISalesAreaRepository>();

            _ = _fakeMetadataRepository
                .Setup(m => m.GetByKey(It.IsAny <MetaDataKeys>()))
                .Returns(new List <Data> {
                new Data {
                    Id    = 1,
                    Value = ValidBreakType
                }
            });

            _mapper = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _controller = new BreaksController(
                _fakeBreakRepository.Object,
                _mapper,
                _fakeScheduleRepository.Object,
                _fakeSpotRepository.Object,
                _fakeDataChangeValidator.Object,
                _fakeAuditEventRepository.Object,
                _fakeSalesAreaRepository.Object,
                null
                );
        }
        public void OnInit()
        {
            _fixture = new Fixture();
            _mapper  = AutoMapperInitializer.Initialize(Configuration.AutoMapperConfig.SetupAutoMapper);

            AssumeTargetIsInitialized();
        }
Beispiel #12
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            if (!Mutex.WaitOne(TimeSpan.Zero, true))
            {
                MessageBoxHelper.ShowInfoMessage("Application is already open.");
                return;
            }

            try
            {
                InitializeComponent();

                AppDomain.CurrentDomain.UnhandledException += UnhandledException;

                AutoMapperInitializer.Initialize();

                SqlIoC.InitializeBaseContainer();
                container = SqlIoC.GetNestedContainer();

                privateCertRepository = container.GetInstance <IPrivateCertRepository>();

                var page = container.GetInstance <MainWindow>();
                page.ShowInTaskbar = true;
                page.InitializeComponent();
                page.Show();
            }
            finally
            {
                Mutex.ReleaseMutex();
            }
        }
Beispiel #13
0
 /// <summary>
 ///Método de execução de rotinas durante a inicialização da API
 /// </summary>
 protected void Application_Start(object sender, EventArgs e)
 {
     // Realiza as configurações gerais da API
     GlobalConfiguration.Configure(WebApiConfig.Register);
     SimpleInjectorContainer.Initialize();
     AutoMapperInitializer.Initialize();
 }
        public BookServiceTests()
        {
            AutoMapperInitializer.Initialize();

            this.databaseMock   = BookHeavenDbContextInMemory.New();
            this.fileServicMock = new Mock <IFileService>();
            this.sut            = new BookService(this.databaseMock, this.fileServicMock.Object);
        }
        public UsersControllerTests()
        {
            AutoMapperInitializer.Initialize();

            this.usersMock  = new Mock <IUserService>();
            this.mapperMock = new Mock <IMapper>();
            this.sut        = new UsersController(this.usersMock.Object, this.mapperMock.Object, null, null, null, null);
        }
Beispiel #16
0
        public void Init()
        {
            _fakeFeatureManager = new Mock <IFeatureManager>();
            _fixture            = new Fixture();
            _mapper             = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _controller = new FeatureFlagsController(_fakeFeatureManager.Object, _mapper);
        }
Beispiel #17
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     AutoMapperInitializer.Initialize();
 }
Beispiel #18
0
        public void Test_Initialize()
        {
            productService   = new Mock <IProductService>();
            categoryService  = new Mock <ICategoryService>();
            products         = TestDataProvider.Products.ToList();
            productValidator = new Mock <IValidator <Product> >();

            AutoMapperInitializer.Initialize();
        }
Beispiel #19
0
        private static void RegisterMiscellaneous(IServiceCollection services)
        {
            AutoMapperInitializer.Initialize();

            services.AddSingleton(typeof(IMapper), provider => Mapper.Instance);
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped <IUnitOfWork, UnitOfWork>();
            services.AddScoped <IMediatorHandler, MediatorHandler>();
        }
Beispiel #20
0
        public HomeControllerTests()
        {
            AutoMapperInitializer.Initialize();

            this.usersMock      = new Mock <IUserService>();
            this.siteVisitsMock = new Mock <ISiteVisitService>();
            this.locationsMock  = new Mock <ILocationService>();
            this.sut            = new HomeController(this.usersMock.Object, this.siteVisitsMock.Object, this.locationsMock.Object);
        }
Beispiel #21
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     ModelBinders.Binders.Add(typeof(Cart), new CartModelBinder());
     AutoMapperInitializer.Initialize();
 }
Beispiel #22
0
 public QuestionDto GetQuestion(int id)
 {
     using (var dataContext = _dataProviderFactory.Create())
     {
         AutoMapperInitializer.Initialize();
         var question = dataContext.GetQuestion(id);
         return(Mapper.Map <Question, QuestionDto>(question));
     }
 }
Beispiel #23
0
 public List <QuestionDto> GetQuestions()
 {
     using (var dataContext = _dataProviderFactory.Create())
     {
         AutoMapperInitializer.Initialize();
         var questions = dataContext.GetQuestions();
         return(questions.Select(Mapper.Map <Question, QuestionDto>).ToList());
     }
 }
        public void Setup()
        {
            AutoMapperInitializer.Initialize();

            var connectionString = AppSettingsHelper.ConnectionString;

            var context = new MovieDatabaseContext(connectionString);

            _service = new MovieService(context);
        }
        public static void RegisterApplication(IServiceCollection services)
        {
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddTransient(typeof(IDesignTimeDbContextFactory <DataContext>), typeof(ContextFactory));

            services.AddTransient(typeof(IStudentService), typeof(StudentService));

            AutoMapperInitializer.Initialize();
            services.AddSingleton(typeof(IMapper), provider => Mapper.Instance);
        }
Beispiel #26
0
 public void SetUp()
 {
     AutoMapperInitializer.Reset();
     AutoMapperInitializer.Initialize();
     _client         = ObjectMother.GetClientValid();
     _clientRegister = Mapper.Map <ClientRegisterCommand>(_client);
     _clientUpdate   = Mapper.Map <ClientUpdateCommand>(_client);
     _clientRemove   = Mapper.Map <ClientRemoveCommand>(_client);
     _mockRepository = new Mock <IClientRepository>();
     _service        = new ClientService(_mockRepository.Object);
 }
Beispiel #27
0
        public void CalculateTrajectoryTest()
        {
            AutoMapperInitializer.Initialize();
            List <ProfilePathGridViewModel> profilePathGridViewModels = SerializeHelper.DeSerializeFromContents <List <ProfilePathGridViewModel> >(Resources.ProfilePathGridViewModel_9777_2);
            List <ProfilePathPoint>         mapProfilePathPoints      = Mapper.Map(profilePathGridViewModels, new List <ProfilePathPoint>());
            List <Point3D> profilePathPointsFromXml = SerializeHelper.DeSerializeFromContents <List <Point3D> >(Resources._3DProfilePathPoints_9777_2);
            CalculationTrajectoryService calculationTrajectoryService = new CalculationTrajectoryService();
            List <Point3D> profilePathPoints = calculationTrajectoryService.Get3DProfilePathPoints(mapProfilePathPoints);

            ProfilePathPointsAreEqual(profilePathPointsFromXml, profilePathPoints);
        }
Beispiel #28
0
        public void Init()
        {
            _fakeFlexibilityLevelRepository = new Mock <IFlexibilityLevelRepository>();

            _mapper = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _controller = new FlexibilityLevelsController(
                _fakeFlexibilityLevelRepository.Object,
                _mapper
                );
        }
Beispiel #29
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            AutoMapperInitializer.Initialize();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();
        }
        public void Setup()
        {
            // Arrange
            Mapper = AutoMapperInitializer.Initialize(Configuration.AutoMapperConfig.SetupAutoMapper);

            Fixture = new Fixture();
            FakeLibrarySalesAreaPassPrioritiesRepository = new Mock <ILibrarySalesAreaPassPrioritiesRepository>();
            FakeTenantSettingsRepository = new Mock <ITenantSettingsRepository>();
            FakeSalesAreaPassPriority    = Fixture.Create <LibrarySalesAreaPassPriority>();
            FakeTenantSettings           = Fixture.Create <TenantSettings>();
        }