コード例 #1
0
        public IActionResult Filme(int id)
        {
            var        filme    = filmeService.Details(id);
            IMapper    iMapper  = autoMap.Configure().CreateMapper();
            FilmeModel filmeMod = iMapper.Map <FilmeModel>(filme); //Mapper.Map<FilmeModel>(filme);

            return(View(filmeMod));
        }
コード例 #2
0
        public ActionResult UpdateEmployerJob(JobViewModel jobViewModel)
        {
            ViewBag.MicroCredentialIdList = GetMicroCredentialIds();
            ViewBag.EmployerIdList        = GetEmployerIds();
            var employer = _repositoryEndPointService.GetEmployerByEmail(User.Identity.Name);

            if (employer == null)
            {
                return(View("Failed"));
            }
            var emptySelectJobIds = new List <SelectListItem> {
                new SelectListItem {
                    Text = "", Value = ""
                }
            };

            ViewBag.JobsIdList = GetJobIdsForEmployer(employer.EmployerId) ?? emptySelectJobIds;
            if (ModelState.IsValid)
            {
                var job = AutoMapperConfig.Configure().Map(jobViewModel, typeof(JobViewModel), typeof(Job)) as Job;
                _repositoryEndPointService.EmployerUpdateJob(job);
                return(View("Success"));
            }
            return(View(jobViewModel));
        }
コード例 #3
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.Configure();

            var builder = new ContainerBuilder();
            var config  = GlobalConfiguration.Configuration;

            builder.RegisterControllers(Assembly.GetExecutingAssembly());
            builder.RegisterApiControllers(typeof(UploadController).Assembly);
            builder.RegisterWebApiFilterProvider(config);
            builder.RegisterWebApiModelBinderProvider();
            builder.RegisterType <TwoC2PEntity>().As <DbContext>().InstancePerLifetimeScope();
            builder.RegisterType <DatabaseContext>().As <IDatabaseContext>().InstancePerLifetimeScope();
            builder.RegisterGeneric(typeof(BaseRepository <>)).As(typeof(IRepository <>));
            builder.RegisterType <PaymentRepository>().As <IPaymentRepository>().InstancePerLifetimeScope();
            builder.RegisterType <FileImport>().As <IFileImport>().InstancePerLifetimeScope();

            var container = builder.Build();

            config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
        }
コード例 #4
0
 public FlowTemplateControllerTests()
 {
     Library.Configuration.AutoMapperConfig.Configure();
     AutoMapperConfig.Configure();
     _flowTemplateService = A.Fake <IFlowTemplateService>();
     _sut = new FlowTemplatesController(_flowTemplateService);
 }
コード例 #5
0
ファイル: Global.asax.cs プロジェクト: rgkgit/IvyMobility
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory());
     AutoMapperConfig.Configure();
 }
コード例 #6
0
        public void Setup()
        {
            if (businessAPIController == null)
            {
                // var controllerContext = new Mock<ControllerContext>();
                // var principal = new Moq.Mock<IPrincipal>();
                //// principal.Setup(p => p.IsInRole("Administrator")).Returns(true);
                // principal.SetupGet(x => x.Identity.Name).Returns("*****@*****.**");
                // controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);

                var request = new Mock <HttpRequestBase>();
                // request.SetupGet(r => r.Form).Returns(formData);
                var context = new Mock <HttpContextBase>();
                context.SetupGet(c => c.Request).Returns(request.Object);


                businessAPIController = new BusinessAPIController();
                //HttpControllerContext context = new HttpControllerContext(new RequestContext(mockContext, new RouteData()), businessAPIController);
                //businessAPIController.ControllerContext = controllerContext.Object; ;
                businessAPIController.ControllerContext = new ControllerContext(context.Object, new RouteData(), businessAPIController);

                HelperMethods.SetupPostControllerForTest(businessAPIController, "BusinessAPI");
            }

            AutoMapperConfig.Configure();

            if (RouteTable.Routes.Count == 0)
            {
                RouteConfig.RegisterRoutes(RouteTable.Routes);
            }
        }
コード例 #7
0
        public BaseDBTest()
        {
            AutoMapperConfig <Y> .Configure();

            _con = new RSCoreDBContext();
            _uow = new EntityUnitofWork <Y>(_con);
        }
コード例 #8
0
        /// <summary>
        /// DI Configuration
        /// </summary>
        /// <param name="config">HttpConfiguration Object</param>
        private static void DiConfiguration(HttpConfiguration config)
        {
            //Load Autofac json
            var configBuilder = new ConfigurationBuilder();

            configBuilder.AddJsonFile(Constants.AutofacJsonFileName);

            var containerBuilder = new ContainerBuilder();

            // Register autofac configuration to container
            var module = new ConfigurationModule(configBuilder.Build());

            containerBuilder.RegisterModule(module);

            // Inject DB Context
            containerBuilder.RegisterType <Curbside.Infrastructure.Persistence.CurbsideContext>().InstancePerRequest();

            // Inject Mapper
            AutoMapperConfig.Configure();
            containerBuilder.Register(c => new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); })).AsSelf()
            .SingleInstance();
            containerBuilder.Register(c => c.Resolve <MapperConfiguration>().CreateMapper(c.Resolve)).As <IMapper>()
            .InstancePerLifetimeScope();

            // Register your Web API controllers.
            containerBuilder.RegisterApiControllers(Assembly.GetExecutingAssembly());

            // Inject Curbside Repository
            containerBuilder.RegisterGeneric(typeof(Curbside.Infrastructure.Persistence.CurbsideRepository <>))
            .As(typeof(Core.Persistence.IMediaRepository <>));

            var container = containerBuilder.Build();

            config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
        }
コード例 #9
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            AutoMapperConfig.Configure();
        }
コード例 #10
0
 protected void Application_Start()
 {
     //AutoMapper
     AutoMapperConfig.Configure();
     //Web Api
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
コード例 #11
0
        public ActionResult ApplyForJob(JobViewModel jobViewModel)
        {
            ViewBag.JobsIdList     = GetJobIds();
            ViewBag.EmployerIdList = GetEmployerIds();
            var candidate = _repositoryEndPointService.GetCandidateByEmailAddress(User.Identity.Name.ToLower());
            var candidateJobApplicationViewModel = new CandidateJobApplicationViewModel
            {
                CandidateId = candidate.CandidateId,
                EmployerId  = jobViewModel.EmployerId,
                JobId       = jobViewModel.JobId
            };

            ViewBag.CandidateId = candidate.CandidateId;

            if (ModelState.IsValid)
            {
                var mapper = AutoMapperConfig.Configure();
                var candidateApplication = mapper.Map <CandidateJobApplicationViewModel, CandidateJobApplication>(candidateJobApplicationViewModel);
                _repositoryEndPointService.AddNewCandidateJobApplication(candidateApplication);
                //Send Application to Employer Via EmailServices:

                return(View("Success"));
            }
            return(View(jobViewModel));
        }
コード例 #12
0
        public ActionResult ApplyForJob(int id = -1)
        {
            ViewBag.JobsIdList     = GetJobIds();
            ViewBag.EmployerIdList = GetEmployerIds();
            var candidate = _repositoryEndPointService.GetCandidateByEmailAddress(User.Identity.Name.ToLower());

            if (candidate != null)
            {
                ViewBag.CandidateId = candidate.CandidateId;
            }
            else
            {
                ViewBag.CandidateId = -1;
                return(View("Failed"));
            }
            var job = _repositoryEndPointService.GetJobsById(id);

            if (job == null)
            {
                return(View("Failed"));
            }
            var mapper       = AutoMapperConfig.Configure();
            var jobViewModel = mapper.Map <Job, JobViewModel>(job);

            return(View(jobViewModel));
        }
コード例 #13
0
        public void Configuration(IAppBuilder app)
        {
            var builder = AutofacConfig.Configure();

            _container = builder.Build();
            AutoMapperConfig.Configure();

            //log
            log4net.Config.XmlConfigurator.Configure();

            //cors
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

            //DI
            var config = new HttpConfiguration();

            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
            config.DependencyResolver = new SingleScopeDependencyResolver(_container);
            config.Filters.Add(_container.Resolve <SaveChangesActionFilter>());

            //swagger
            SwaggerConfig.Register(config);

            WebApiConfig.Register(config, _container);
            app.UseWebApi(config);
        }
コード例 #14
0
        public void ManagerManager_ApproveRequest()
        {
            AutoMapperConfig.Configure();
            // mock Repo logic
            var vacationRepo = new Mock <IGenericRepository <VacationRequest> >();
            var userRepo     = new Mock <IGenericRepository <User> >();
            var uoW          = new Mock <IUnitOfWork>();

            uoW.Setup(x => x.VacationRepo).Returns(vacationRepo.Object);
            uoW.Setup(x => x.UserRepo).Returns(userRepo.Object);

            var managerManager = new ManagerManager(uoW.Object);

            var dbStub = new VacationRequest()
            {
                Id        = 1,
                UserId    = 2,
                StartDate = new DateTime(2017, 05, 20)
            };
            var userStub = new User()
            {
                Id        = 2,
                LastName  = "Tarbinskyi",
                FirstName = "Viacheslav"
            };

            userRepo.Setup(x => x.GetByID(It.IsAny <int>())).Returns(userStub);
            vacationRepo.Setup(x => x.GetByID(It.IsAny <int>())).Returns(dbStub);
            managerManager.ApproveRequest(1, 2);
            Assert.AreEqual(dbStub.ApprovedBy, "Tarbinskyi Viacheslav");
            Assert.AreEqual(dbStub.Status, Status.Approved);
        }
コード例 #15
0
 protected override void Load(ContainerBuilder builder)
 {
     base.Load(builder);
     builder.RegisterType(typeof(UserFactory)).As(typeof(IUserFactory)).InstancePerLifetimeScope();
     builder.Register(ctn => AutoMapperConfig.Configure()).SingleInstance();
     builder.Register(ctn => ctn.Resolve <MapperConfiguration>().CreateMapper()).SingleInstance();
 }
コード例 #16
0
        public BaseUnitTest()
        {
            AutoMapperConfig <Y> .Configure();

            mockContext = new Mock <RSCoreDBContext>();
            IMUow       = new InMemoryUnitofWork <Y>();
        }
コード例 #17
0
ファイル: Startup.cs プロジェクト: jai2033shankar/CarWorkshop
        private void InitializeContainer(IApplicationBuilder app)
        {
            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            // Add application presentation components.
            container.RegisterMvcControllers(app);
            container.RegisterMvcViewComponents(app);

            // Add application services.

            // Cross-wire asp.net service.
            container.Register(app.ApplicationServices.GetService <CarWorkshopContext>, Lifestyle.Singleton);

            container.Register <IClientRepository, ClientRepository>(Lifestyle.Scoped);
            container.Register <IClientService, ClientService>(Lifestyle.Scoped);

            container.Register <IEmployeeRepository, EmployeeRepository>(Lifestyle.Scoped);
            container.Register <IEmployeeService, EmployeeService>(Lifestyle.Scoped);

            container.Register <ICarRepository, CarRepository>(Lifestyle.Scoped);
            container.Register <ICarService, CarService>(Lifestyle.Scoped);

            container.RegisterSingleton <IMapper>(AutoMapperConfig.Configure());


            config.RegisterServices(container);
        }
コード例 #18
0
        public void Initialize()
        {
            gameService = new Mock <IGameService>();

            var mock = new Mock <ControllerContext>();

            mock.SetupGet(p => p.HttpContext.User.Identity.Name).Returns("userName");
            mock.SetupGet(p => p.HttpContext.Request.IsAuthenticated).Returns(true);


            gamesController = new GameController(gameService.Object);
            gamesController.ControllerContext = mock.Object;
            gamesList = new List <Game>()
            {
                new Game {
                    Id = 1, Name = "Talisman", CategoryId = 1, Description = "Wyprawa do krainy smoków i magii! W tej pełnej przygód grze wyruszysz na niebezpieczną wyprawę po największy skarb, legendarną Koronę Władzy. Wcielisz się w wojownika, kapłana, czarnoksiężnika lub jednego z pozostałych jedenastu bohaterów władających magią lub mieczem.", Publisher = "Galakta", MaxNumberOfPlayers = 6, MinNumberOfPlayers = 2, PlayingTime = 150, PublishedDate = DateTime.Parse("2015-01-14"), SuggestedAge = 12, Accepted = true
                },
                new Game {
                    Id = 2, Name = "Wikingowie", CategoryId = 1, Description = "Gracze wcielają się w Jarlów wikingów, którzy walczą o władzę nad Północą i koronę Konunga. Władzę zdobędzie ten, który jako pierwszy złupi wszystkie wsie i przywiezie z nich córki thanów do swojego portu, jako symbol uznania jego praw do korony. ", Publisher = "Rebel", MaxNumberOfPlayers = 4, MinNumberOfPlayers = 3, PlayingTime = 90, PublishedDate = DateTime.Parse("2015-01-15"), SuggestedAge = 12, Accepted = true
                },
                new Game {
                    Id = 3, Name = "Wsiąść do Pociągu: Europa", CategoryId = 6, Description = " Ticket to Ride Europe to nowa wersja bestsellerowej gry Ticket to Ride, przeniesiona z obszaru Ameryki Północnej na Stary Kontynent. Zawiera nie tylko nową mapę, ale także nowe elementy gry, jak tunele, przeprawy promowe czy stacje kolejowe.", Publisher = "Rebel", MaxNumberOfPlayers = 5, MinNumberOfPlayers = 2, PlayingTime = 90, PublishedDate = DateTime.Parse("2015-01-16"), SuggestedAge = 8, Accepted = false
                },
            };

            AutoMapperConfig.Configure();
        }
コード例 #19
0
ファイル: Global.asax.cs プロジェクト: demirtasokan/gelis
 protected void Application_Start()
 {
     AutoMapperConfig.Configure();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     SimpleInjectorConfig.Register();
     log4net.Config.XmlConfigurator.Configure();
 }
コード例 #20
0
ファイル: Startup.cs プロジェクト: hyhuu99/serverjob
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            DIConfig.Configure(services, Configuration);
            AutoMapperConfig.Configure(services);

            AddIdentity(services, Configuration);
            services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            });

            services.AddAuthentication("Bearer").AddIdentityServerAuthentication(options =>
            {
                options.Authority            = Configuration["Authority"].ToString();
                options.RequireHttpsMetadata = false;
            });

            services.AddAuthorization(options =>
            {
                options.AddPolicy("Candidate",
                                  policy => policy.RequireClaim("scope", "Candidate"));
                options.AddPolicy("Company",
                                  policy => policy.RequireClaim("scope", "Company"));
            });

            services.AddCors();

            return(services.BuildServiceProvider(validateScopes: true));
        }
コード例 #21
0
ファイル: Startup.cs プロジェクト: arlek777/PlayTogether
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            AutoMapperConfig.Configure();

            app.UseAuthentication();
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });
        }
コード例 #22
0
        public void Initialize()
        {
            MockCountriesDal = new Mock <ICountriesDal>();
            AutoMapperConfig.Configure();

            CountryValidator = new CountryValidator(MockCountriesDal.Object, AutoMapperConfig.Mapper);
        }
コード例 #23
0
 public PaymentsService(IInvoicesRepository invoicesRepository, IPaymentRepository paymentRepository, IRmqProducer rmqProducer)
 {
     _invoicesRepository = invoicesRepository;
     _paymentRepository  = paymentRepository;
     _mapper             = AutoMapperConfig.Configure().CreateMapper();
     _rmqProducer        = rmqProducer;
 }
コード例 #24
0
        public void Initialize()
        {
            rateService = new Mock <IRateService>();
            gameService = new Mock <IGameService>();

            var mock = new Mock <ControllerContext>();

            mock.SetupGet(p => p.HttpContext.User.Identity.Name).Returns("userName");
            mock.SetupGet(p => p.HttpContext.Request.IsAuthenticated).Returns(true);


            ratesController = new RateController(rateService.Object, gameService.Object);
            ratesController.ControllerContext = mock.Object;
            ratesList = new List <Rate>()
            {
                new Rate {
                    Id = 1, GameId = 1, UserId = 1, Value = 6, PublishedDate = DateTime.Parse("2015-01-21")
                },
                new Rate {
                    Id = 2, GameId = 1, UserId = 2, Value = 5, PublishedDate = DateTime.Parse("2015-01-21")
                },
                new Rate {
                    Id = 3, GameId = 1, UserId = 3, Value = 3, PublishedDate = DateTime.Parse("2015-01-21")
                }
            };

            AutoMapperConfig.Configure();
        }
コード例 #25
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            //app.UseHttpsRedirection();

            app.UseStaticFiles();

            #region Swagger Settigs
            app.UseSwagger();
            app.UseSwaggerUI(x => { x.SwaggerEndpoint("/swagger/v1/swagger.json", "Tulpar Yazılım API"); });
            #endregion

            app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().AllowCredentials());

            app.UseMvc();
            app.UseAuthentication();

            AutoMapperConfig <Guid> .Configure();

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
        }
コード例 #26
0
ファイル: Startup.cs プロジェクト: profale/ProjetoSimples
        public void Configuration(IAppBuilder app)
        {
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
            //Configurar SimpleInjector
            var container = SimpleInjectorConfig.Configure();
            //configuracao necessaria para permitir o uso de injecao de dependencia, se necessária
            var config = new HttpConfiguration
            {
                DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container),
            };

            var formatters = config.Formatters;

            formatters.Remove(formatters.XmlFormatter);

            var jsonSettings = formatters.JsonFormatter.SerializerSettings;

            jsonSettings.Formatting       = Newtonsoft.Json.Formatting.None;
            jsonSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

            formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.None;
            formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling      = ReferenceLoopHandling.Ignore;

            //Informar que esta usando WebApi ou MVC
            app.UseWebApi(config);
            ConfigureWebApi(config);
            config.EnableCors();

            //registrar o AutoMapper..
            AutoMapperConfig.Configure();
        }
コード例 #27
0
        public void Should_return_flow_steps_when_getting_single_flow()
        {
            AutoMapperConfig.Configure();
            Library.Configuration.AutoMapperConfig.Configure();
            var steps = new List <IStep>
            {
                // TODO fix inheritance here
                new StartStep {
                    Id = 1, Name = "Start Step 1"
                },
                new CollectDataStep {
                    Id = 2, Name = "Collect Data 1"
                },
                new StopStep {
                    Id = 3, Name = "Stop Step 3"
                }
            };

            A.CallTo(() => _flowTemplateService.GetFlowTemplateSteps(1)).Returns(steps);
            A.CallTo(() => _flowTemplateService.GetFlowTemplate(1)).Returns(new FlowTemplate {
                Id = 1, Name = "Template 1", Steps = steps
            });

            var result = _sut.Get(1);

            Assert.Equal(3, result.Steps.Count);
        }
コード例 #28
0
        public ActionResult Index()
        {
            try
            {
                AutoMapperConfig autoMapperConfig = new AutoMapperConfig();
                var mapper = autoMapperConfig.Configure().CreateMapper();

                var produtos = _produtoService.ListarProdutos();

                DropListMovimentoViewModel model = new DropListMovimentoViewModel();

                var produtosViewModels = mapper.Map <ProdutoViewModel[]>(produtos);

                foreach (var item in produtosViewModels)
                {
                    model.ProdutosDisponiveis.Add(new SelectListItem
                    {
                        Text  = item.Descricao,
                        Value = item.Id.ToString()
                    });
                }

                return(View(model));
            }
            catch (ApplicationException e)
            {
                logger.Error(e, e.Message);
                return(View("Error", new HandleErrorInfo(e, "Error", "Index")));
            }
            catch (Exception e)
            {
                logger.Error(e, e.Message);
                return(View("Error", new HandleErrorInfo(e, "Error", "Index")));
            }
        }
コード例 #29
0
        /// <summary>
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// </summary>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAutoMapper(cfg => AutoMapperConfig.Configure(cfg));
            services.AddMassTransit(cfg =>
            {
                cfg.AddConsumer <DbPriceConsumer>();
            });

            services.AddSignalR();
            services.AddScoped <PriceWatcherHub>();
            services.AddSingleton <IPriceWatcher, CoinTreeWatcher>();
            services.AddScoped <DbPriceConsumer>();
            services.AddSingleton <IBus>(provider =>
            {
                return(Bus.Factory.CreateUsingInMemory(configure =>
                {
                    configure.ReceiveEndpoint("cointree_prices", endpoint => {
                        endpoint.LoadFrom(provider);
                    });
                }));
            });
            services.AddEntityFrameworkSqlite();
            services.AddDbContext <AppDbContext>(options => options.UseSqlite("Data Source=prices.db")); //only for development

            services.AddMemoryCache();
            services.AddMvc();
        }
        public void Initialize()
        {
            MockContractValidator            = new Mock <IContractValidator <DateRangeEffectiveContractObject> >();
            MockDateRangeEffectiveObjectsDal = new Mock <IDalBase <DateRangeEffectiveDtoObject, int> >();
            MockUser = new Mock <IIdPrincipal>();

            var config = new HttpConfiguration {
                IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always
            };
            var request   = new HttpRequestMessage(HttpMethod.Get, new Uri(string.Format(CultureInfo.InvariantCulture, "http://localhost/v1/{0}", StaticTestValues.ControllerName)));
            var route     = config.Routes.MapHttpRoute(StaticTestValues.GetDateRangeEffectiveContractObjectRouteName, string.Format(CultureInfo.InvariantCulture, "v1/{0}/{{id}}", StaticTestValues.ControllerName));
            var routeData = new HttpRouteData(route, new HttpRouteValueDictionary(new { controller = StaticTestValues.ControllerName }));

            AutoMapperConfig.Configure();

            DateRangeEffectiveContractObjectsController = new DateRangeEffectiveContractObjectsController(MockDateRangeEffectiveObjectsDal.Object, AutoMapperConfig.Mapper, MockContractValidator.Object)
            {
                ControllerContext = new HttpControllerContext(config, routeData, request),
                Request           = request,
                Configuration     = config,
                Url         = new UrlHelper(request),
                IdPrincipal = MockUser.Object
            };
            DateRangeEffectiveContractObjectsController.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;
            DateRangeEffectiveContractObjectsController.Request.Properties[HttpPropertyKeys.HttpRouteDataKey]     = routeData;
        }