public static void ClassInit(TestContext textContext) { controller = new UserDemandController(UserDemandServiceGenerator.GetMockService().Object); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); AutoMapperInit.BuildMap(); }
public void Initialize() { TestBootstrapper.TestServiceStructureMap(); AutoMapperInit.BuildMap(); domainService = ObjectFactory.GetInstance <IUserService>(); domainService.UserRepository = ObjectFactory.GetInstance <IUserRepository>(); domainService.UnitOfWork = ObjectFactory.GetInstance <IUnitOfWork>(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); AutoMapperInit.BuildMap(); AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimsIdentity.DefaultNameClaimType; }
public void Initialize() { TestBootstrapper.TestServiceStructureMap(); AutoMapperInit.BuildMap(); userService = ObjectFactory.GetInstance <IUserService>(); userController = new UserController(userService); MockControllerHelpers.RegisterTestRoutes(); }
protected void Application_Start() { AutoMapperInit.Init(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
/// <summary> /// Starts the application /// </summary> protected void Application_Start() { ApplicationContext.AppConfigure(); StructuremapMvc.Start(); AutoMapperInit.CreateMappings(); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); IoCFilterProvider <IIoCFilter> .ApplyToAllFilters(); ObjectFactory.GetInstance <ITestService>(); }
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsEnvironment("Development")) { // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately. builder.AddApplicationInsightsSettings(developerMode: true); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); AutoMapperInit.Init(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); AutoMapperInit.BuildMap(); ControllerBuilder.Current.SetControllerFactory(new IOCControllerFactory()); // Configure FluentValidation to use StructureMap var factory = new FluentValidatorFactory(); // Tell MVC to use FluentValidation for validation ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(factory)); DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; }
public Form1() { InitializeComponent(); AutoMapperInit.Start(); }
public static void ClassInit(TestContext textContext) { domainService = new NewsLetterService(); domainService.UnitOfWork = UnitOfWorkGenerator.MockUnitOfWork(); AutoMapperInit.BuildMap(); }
public NetworkManager() { mapper = AutoMapperInit.Init(); }
public void Setup() { AutoMapperInit.Start(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { #region AutoMapper configuration services.AddAutoMapper(); var mapperConfig = AutoMapperInit.InitMappings(); IMapper mapper = mapperConfig.CreateMapper(); services.AddSingleton(mapper); #endregion //Dependency Injection DependencyInit.Init(services); services.AddScoped <ITokenHelper, TokenHelper>(); #region Swagger configuration services.AddSwaggerGen(s => { s.SwaggerDoc("v1", new Info { Title = "ELBHO/HBO-stagemarkt API", Version = "V1", Description = "An API providing endpoints for reading/writing operations on: vacancies, companies, users", Contact = new Contact { Name = "Joshua Volkers", Email = "*****@*****.**" } }); var security = new Dictionary <string, IEnumerable <string> > { { "Bearer", new string[] { } } }; s.AddSecurityDefinition("Bearer", new ApiKeyScheme() { Description = "JWT Authorization header using the Bearer scheme. Example: Authorization: Bearer {token}", Name = "Authorization", In = "header", Type = "apiKey" }); s.AddSecurityRequirement(security); var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); s.IncludeXmlComments(xmlPath); s.DescribeAllEnumsAsStrings(); }); #endregion #region JWT validation configuration var tokenOptions = new TokenValidationParameters { ClockSkew = TimeSpan.FromMinutes(5), ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = Configuration.GetValue <string>("JWTIssuer"), ValidAudience = Configuration.GetValue <string>("JWTAudience"), RequireExpirationTime = true, IssuerSigningKey = new SymmetricSecurityKey( Encoding.UTF8.GetBytes(Configuration.GetValue <string>("JWTSigningKey"))) }; services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.TokenValidationParameters = tokenOptions; }); #endregion services.AddMvc() .AddJsonOptions(options => { options.SerializerSettings.Formatting = Formatting.Indented; }); }
public LocationManager() { mapper = AutoMapperInit.Init(); }
static ArticlesControllerTests() //<-- static constructor { AutoMapperInit.Initialize(); }