public static void ClassInit(TestContext textContext)
 {
     controller               = new UserDemandController(UserDemandServiceGenerator.GetMockService().Object);
     controller.Request       = new HttpRequestMessage();
     controller.Configuration = new HttpConfiguration();
     AutoMapperInit.BuildMap();
 }
Exemplo n.º 2
0
 public void Initialize()
 {
     TestBootstrapper.TestServiceStructureMap();
     AutoMapperInit.BuildMap();
     domainService = ObjectFactory.GetInstance <IUserService>();
     domainService.UserRepository = ObjectFactory.GetInstance <IUserRepository>();
     domainService.UnitOfWork     = ObjectFactory.GetInstance <IUnitOfWork>();
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 5
0
 protected void Application_Start()
 {
     AutoMapperInit.Init();
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Exemplo n.º 6
0
        /// <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>();
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
 public Form1()
 {
     InitializeComponent();
     AutoMapperInit.Start();
 }
 public static void ClassInit(TestContext textContext)
 {
     domainService            = new NewsLetterService();
     domainService.UnitOfWork = UnitOfWorkGenerator.MockUnitOfWork();
     AutoMapperInit.BuildMap();
 }
Exemplo n.º 11
0
 public NetworkManager()
 {
     mapper = AutoMapperInit.Init();
 }
Exemplo n.º 12
0
 public void Setup()
 {
     AutoMapperInit.Start();
 }
Exemplo n.º 13
0
        // 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;
            });
        }
Exemplo n.º 14
0
 public LocationManager()
 {
     mapper = AutoMapperInit.Init();
 }
 static ArticlesControllerTests()       //<-- static constructor
 {
     AutoMapperInit.Initialize();
 }