Ejemplo n.º 1
0
        public ApoDivisonController()
        {
            var apoDivisionRepository = SetUpMockHelper.GetApoDivisionRepository();

            _apoDivisionService = new ApoDivisionService(apoDivisionRepository
                                                         , new ApoGroupService(SetUpMockHelper.GetApoGroupRepository(), SetUpMockHelper.GetApoDivisionRepository()));
        }
Ejemplo n.º 2
0
 public StudentControllerTest()
 {
     MapperHelper.SetUpMapper();
     _randomStudent = SetUpMockHelper.SetupStudents();
     _unitOfWork    = SetUpMockHelper.SetUpUnitOfWork();
     _urlHelper     = SetupUrlHelper();
     httpContext    = SetHttpContext().Object;
 }
Ejemplo n.º 3
0
 public ApoSubClassTest()
 {
     MapperHelper.SetUpMapper();
     _apoSubClassRepository = SetUpMockHelper.GetApoSubClassRepository();
     _apoSubClass           = DataInitializer.GetApoSubClass();
     _apoClass           = DataInitializer.GetApoClass();
     _apoClassRepository = SetUpMockHelper.GetApoClassRepository();
 }
Ejemplo n.º 4
0
 public ApoDeptServiceTest()
 {
     MapperHelper.SetUpMapper();
     _apoDivisionRepository = SetUpMockHelper.GetApoDivisionRepository();
     _apoDivision           = DataInitializer.GetApoDivisions();
     _apoGroupRepository    = SetUpMockHelper.GetApoGroupRepository();
     _apoGroup = DataInitializer.GetApoGroup();
     _apoDepartmentRepository = SetUpMockHelper.GetApoDepartmentRepository();
     _apoDepartment           = DataInitializer.GetApoDepartment();
 }
Ejemplo n.º 5
0
        public ProductServiceTest()
        {
            MapperHelper.SetUpMapper();

            _productDomains = DataInitializer.GetProductFromTextFile();
            _attrType       = DataInitializer.GetAllTypeAttributeTypeDomains();
            _attrValue      = DataInitializer.GetAttributeValueDomains();
            _productDetail  = DataInitializer.GetaProductAttributeHeaders();


            _productRepository = SetUpMockHelper.SetUpProductRepository();

            _attributeTypeService  = SetUpMockHelper.GetAttributeTypeService();
            _attributeValueService = SetUpMockHelper.GetAttributeValueService();
        }
Ejemplo n.º 6
0
 public ApoClassController()
 {
     _apoClassService = new ApoClassService(SetUpMockHelper.GetApoClassRepository(), SetUpMockHelper.GetApoDepartmentRepository());
 }
Ejemplo n.º 7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(Configuration);
            services.Configure<MongoDbSettings>(Configuration.GetSection("MongoDb"));
            services.AddSingleton<IUserStore<MongoIdentityUser>>(provider =>
            {
                var options = provider.GetService<IOptions<MongoDbSettings>>();
                var client = new MongoClient(options.Value.ConnectionString);
                var database = client.GetDatabase(options.Value.DatabaseName);

                return new MongoUserStore<MongoIdentityUser>(database);
            });

            services.Configure<IdentityOptions>(options =>
            {
                //var dataProtectionPath = Path.Combine(_env.WebRootPath, "identity-artifacts");
                options.Cookies.ApplicationCookie.AuthenticationScheme = "ApplicationCookie";
                //options.Cookies.ApplicationCookie.DataProtectionProvider = DataProtectionProvider.Create(dataProtectionPath);
                options.Lockout.AllowedForNewUsers = true;

                options.Password.RequireDigit = true;
                options.Password.RequireLowercase = false;
                options.Password.RequireUppercase = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequiredLength = 6;
            });

            // Services used by identity
            services.AddAuthentication(options =>
            {
                // This is the Default value for ExternalCookieAuthenticationScheme
                options.SignInScheme = new IdentityCookieOptions().ExternalCookieAuthenticationScheme;
            });

            // Hosting doesn't add IHttpContextAccessor by default
            services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();

            services.AddOptions();
            services.AddDataProtection();

            services.TryAddSingleton<IdentityMarkerService>();
            services.TryAddSingleton<IUserValidator<MongoIdentityUser>, UserValidator<MongoIdentityUser>>();
            services.TryAddSingleton<IPasswordValidator<MongoIdentityUser>, PasswordValidator<MongoIdentityUser>>();
            services.TryAddSingleton<IPasswordHasher<MongoIdentityUser>, PasswordHasher<MongoIdentityUser>>();
            services.TryAddSingleton<ILookupNormalizer, UpperInvariantLookupNormalizer>();
            services.TryAddSingleton<IdentityErrorDescriber>();
            services.TryAddSingleton<ISecurityStampValidator, SecurityStampValidator<MongoIdentityUser>>();
            services.TryAddSingleton<IUserClaimsPrincipalFactory<MongoIdentityUser>, UserClaimsPrincipalFactory<MongoIdentityUser>>();
            services.TryAddSingleton<UserManager<MongoIdentityUser>, UserManager<MongoIdentityUser>>();
            services.TryAddScoped<SignInManager<MongoIdentityUser>, SignInManager<MongoIdentityUser>>();

            AddDefaultTokenProviders(services);

            services.AddMvc();

            // Add application services.
            services.AddTransient<IEmailSender, AuthMessageSender>();
            services.AddTransient<ISmsSender, AuthMessageSender>();

            if (_env.EnvironmentName.Equals("Test"))
            {
                //services.AddScoped<IStudentRepository, LibraryRepository>();
                services.AddScoped<IUnitOfWork>(serviceProvider => SetUpMockHelper.SetUpUnitOfWork());

                services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();

                services.AddScoped<IUrlHelper>(implementationFactory =>
                {
                    var actionContext = implementationFactory.GetService<IActionContextAccessor>()
                    .ActionContext;
                    return new UrlHelper(actionContext);
                });
            }
        }
 public ApoDepartmentController()
 {
     _apoDepartmentService = new ApoDepartmentService(SetUpMockHelper.GetApoDivisionRepository(),
                                                      SetUpMockHelper.GetApoGroupRepository(), SetUpMockHelper.GetApoDepartmentRepository());
 }