Ejemplo n.º 1
0
 public UserModuleTest() : base()
 {
     _userModule            = serviceProvider.GetService <IUserModule>();
     _stringConstant        = serviceProvider.GetService <IStringConstant>();
     _mockHttpClientService = serviceProvider.GetService <Mock <IHttpClientService> >();
     Initialize();
 }
Ejemplo n.º 2
0
 public UserController(IUserRepository userRepository, UserManager <ApplicationUser> userManager, IStringConstant stringConstant, IProjectRepository projectRepository)
 {
     _userRepository    = userRepository;
     _userManager       = userManager;
     _stringConstant    = stringConstant;
     _projectRepository = projectRepository;
 }
Ejemplo n.º 3
0
 public ProjectTests() : base()
 {
     _projectRepository         = serviceProvider.GetService <IProjectRepository>();
     _dataRepository            = serviceProvider.GetService <IDataRepository <Project, PromactOauthDbContext> >();
     _dataRepositoryProjectUser = serviceProvider.GetService <IDataRepository <ProjectUser, PromactOauthDbContext> >();
     _stringConstant            = serviceProvider.GetService <IStringConstant>();
     _userRepository            = serviceProvider.GetService <IUserRepository>();
 }
Ejemplo n.º 4
0
 public AccountController(IAccountRepository iAccountRepository, IStringConstant iStringConstant, IEmailSender iEmailSender, IConfiguration configuration, ILogManagement iLogManagement)
 {
     _iAccountRepository = iAccountRepository;
     _iStringConstant    = iStringConstant;
     _iEmailSender       = iEmailSender;
     Configuration       = configuration;
     _iLogManagement     = iLogManagement;
 }
Ejemplo n.º 5
0
 public RoleRepository(telebilling_v01Context dbTeleBilling_V01Context, IMapper mapper, IStringConstant iStringConstant
                       , ILogManagement ilogManagement)
 {
     _dbTeleBilling_V01Context = dbTeleBilling_V01Context;
     _iStringConstant          = iStringConstant;
     _mapper         = mapper;
     _iLogManagement = ilogManagement;
 }
Ejemplo n.º 6
0
 public DashboardRepository(telebilling_v01Context dbTeleBilling_V01Context, IStringConstant iStringConstant,
                            ILogManagement iLogManagement, IMapper mapper)
 {
     _dbTeleBilling_V01Context = dbTeleBilling_V01Context;
     _iStringConstant          = iStringConstant;
     _iLogManagement           = iLogManagement;
     _mapper = mapper;
 }
 public ExcelMappingRepository(telebilling_v01Context dbTeleBilling_V01Context, IMapper mapper, IStringConstant iStringConstant
                               , ILogManagement ilogManagement, IStaticDataRepository iStaticRepository)
 {
     _dbTeleBilling_V01Context = dbTeleBilling_V01Context;
     _iStringConstant          = iStringConstant;
     _mapper            = mapper;
     _iLogManagement    = ilogManagement;
     _iStaticRepository = iStaticRepository;
 }
Ejemplo n.º 8
0
 public UserRepositoryTest() : base()
 {
     _userRepository    = serviceProvider.GetService <IUserRepository>();
     _userManager       = serviceProvider.GetService <UserManager <ApplicationUser> >();
     _mapper            = serviceProvider.GetService <IMapper>();
     _stringConstant    = serviceProvider.GetService <IStringConstant>();
     _projectRepository = serviceProvider.GetService <IProjectRepository>();
     _mockEmailService  = serviceProvider.GetService <Mock <IEmailSender> >();
 }
Ejemplo n.º 9
0
 public CustomConsentService(IIdentityServerInteractionService interaction, IClientStore clientStore,
                             IResourceStore resourceStore, ILogger <CustomConsentService> logger, IStringConstant stringConstant)
 {
     _interaction    = interaction;
     _clientStore    = clientStore;
     _resourceStore  = resourceStore;
     _logger         = logger;
     _stringConstant = stringConstant;
 }
Ejemplo n.º 10
0
 public BillMemoRepository(telebilling_v01Context dbTeleBilling_V01Context, IMapper mapper, IStringConstant iStringConstant
                           , ILogManagement ilogManagement, IEmailSender iEmailSender)
 {
     _dbTeleBilling_V01Context = dbTeleBilling_V01Context;
     _iStringConstant          = iStringConstant;
     _mapper         = mapper;
     _iLogManagement = ilogManagement;
     _iEmailSender   = iEmailSender;
 }
Ejemplo n.º 11
0
 public ProjectRepository(IDataRepository <Project, PromactOauthDbContext> projectDataRepository, IDataRepository <ProjectUser, PromactOauthDbContext> projectUserDataRepository, IDataRepository <ApplicationUser, PromactOauthDbContext> userDataRepository, UserManager <ApplicationUser> userManager,
                          IMapper mapperContext, IStringConstant stringConstant, ILogger <ProjectRepository> logger)
 {
     _projectDataRepository     = projectDataRepository;
     _projectUserDataRepository = projectUserDataRepository;
     _userDataRepository        = userDataRepository;
     _mapperContext             = mapperContext;
     _userManager    = userManager;
     _stringConstant = stringConstant;
 }
Ejemplo n.º 12
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IEmailSender emailSender,
     ILoggerFactory loggerFactory,
     IHostingEnvironment hostingEnvironment,
     IStringConstant stringConstant,
     IOptionsMonitor <StringLiteral> stringLiterals)
 {
     _userManager        = userManager;
     _hostingEnvironment = hostingEnvironment;
     _signInManager      = signInManager;
     _emailSender        = emailSender;
     _logger             = loggerFactory.CreateLogger <AccountController>();
     _stringConstant     = stringConstant;
     _stringLiterals     = stringLiterals.CurrentValue;
 }
Ejemplo n.º 13
0
 public UserRepository(IDataRepository <ApplicationUser, PromactOauthDbContext> applicationUserDataRepository,
                       RoleManager <IdentityRole> roleManager,
                       UserManager <ApplicationUser> userManager, IEmailSender emailSender,
                       IMapper mapperContext, IDataRepository <ProjectUser, PromactOauthDbContext> projectUserRepository,
                       IProjectRepository projectRepository, IOptions <AppSettingUtil> appSettingUtil,
                       IDataRepository <Project, PromactOauthDbContext> projectDataRepository,
                       IStringConstant stringConstant,
                       IDataRepository <ProjectUser, PromactOauthDbContext> projectUserDataRepository, IEmailUtil emailUtil)
 {
     _applicationUserDataRepository = applicationUserDataRepository;
     _userManager               = userManager;
     _emailSender               = emailSender;
     _mapperContext             = mapperContext;
     _projectUserRepository     = projectUserRepository;
     _projectRepository         = projectRepository;
     _roleManager               = roleManager;
     _projectDataRepository     = projectDataRepository;
     _appSettingUtil            = appSettingUtil;
     _stringConstant            = stringConstant;
     _projectUserDataRepository = projectUserDataRepository;
     _emailUtil = emailUtil;
 }
Ejemplo n.º 14
0
 public UserController(IUserRepository userRepository, UserManager <ApplicationUser> userManager, IStringConstant stringConstant)
 {
     _userRepository = userRepository;
     _userManager    = userManager;
     _stringConstant = stringConstant;
 }
Ejemplo n.º 15
0
 public DefaultApiResources(IStringConstant stringConstant)
 {
     _stringConstant = stringConstant;
 }
Ejemplo n.º 16
0
 public LogManagement(telebilling_v01Context dbTeleBilling_V01Context, IStringConstant iStringConstant)
 {
     _dbTeleBilling_V01Context = dbTeleBilling_V01Context;
     _iStringConstant          = iStringConstant;
 }
Ejemplo n.º 17
0
        public AccountRepository(IConfiguration config, IStringConstant iStringConstant)

        {
            _config          = config;
            _iStringConstant = iStringConstant;
        }
 public ProjectController(IProjectRepository projectRepository, UserManager <ApplicationUser> userManager, IStringConstant stringConstant)
 {
     _projectRepository = projectRepository;
     _userManager       = userManager;
     _stringConstant    = stringConstant;
 }
Ejemplo n.º 19
0
 public SendGridEmailSender(IOptions <SendGridAPI> sendGridAPI, IStringConstant stringConstant, ILogger <AuthMessageSender> logger)
 {
     _sendGridAPI    = sendGridAPI;
     _stringConstant = stringConstant;
     _logger         = logger;
 }
Ejemplo n.º 20
0
 public HttpClientService(IStringConstant stringConstant)
 {
     _stringConstant = stringConstant;
 }
Ejemplo n.º 21
0
 public EmailUtil(IHostingEnvironment hostingEnvironment, IStringConstant stringConstant, ILoggerFactory loggerFactory)
 {
     _logger             = loggerFactory.CreateLogger <EmailUtil>();
     _hostingEnvironment = hostingEnvironment;
     _stringConstant     = stringConstant;
 }
Ejemplo n.º 22
0
        public BaseProvider()
        {
            var randomString = Guid.NewGuid().ToString();

            _mapperConfiguration = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new AutoMapperProfileConfiguration());
            });


            var services = new ServiceCollection();

            services.AddEntityFrameworkInMemoryDatabase();
            services.Configure <AppSettingUtil>(x =>
            {
                x.CasualLeave     = 14;
                x.PromactErpUrl   = "http://www.example.com";
                x.PromactOAuthUrl = "http://www.example.com";
                x.SickLeave       = 7;
            });

            services.Configure <StringLiteral>(y =>
            {
                y.Account = new Account();
                y.Account.EmailNotExists       = "Email does not exist";
                y.Account.SuccessfullySendMail = "We have sent you a link on {{emailaddress}} to reset password.Please check your email.";
                y.ConsumerApp = new ConsumerApp();
                y.ConsumerApp.CapitalAlphaNumericString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                y.ConsumerApp.AlphaNumericString        = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
            });


            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <PromactOauthDbContext>()
            .AddDefaultTokenProviders();
            services.AddScoped <IEnsureSeedData, EnsureSeedData>();
            services.AddScoped <IUserRepository, UserRepository>();
            services.AddScoped <IProjectRepository, ProjectRepository>();
            services.AddScoped <IConsumerAppRepository, ConsumerAppRepository>();
            services.AddScoped <IStringConstant, StringConstant>();
            services.AddScoped(typeof(IDataRepository <,>), typeof(DataRepository <,>));

            //Register Mapper
            services.AddSingleton <IMapper>(sp => _mapperConfiguration.CreateMapper());
            services.AddTransient <IEmailSender, AuthMessageSender>();
            services.AddDbContext <PromactOauthDbContext>(options => options.UseInMemoryDatabase(randomString), ServiceLifetime.Transient);

            // register IdentityServer4 dependencies
            services.AddScoped <ConfigurationStoreOptions>();
            var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
            Action <DbContextOptionsBuilder> dbContextOptionsAction = (builder => builder.UseInMemoryDatabase(randomString));

            services.AddDbContext <ConfigurationDbContext>(dbContextOptionsAction);
            services.AddTransient <IClientStore, ClientStore>();
            services.AddTransient <IResourceStore, ResourceStore>();
            services.AddTransient <ICorsPolicyService, CorsPolicyService>();

            // Http Client mocking
            var httpClientMock       = new Mock <IHttpClientService>();
            var httpClientMockObject = httpClientMock.Object;

            services.AddScoped(x => httpClientMock);
            services.AddScoped(x => httpClientMockObject);

            // Http Context mocking
            var authenticationManagerMock = new Mock <AuthenticationManager>();
            var httpContextMock           = new Mock <HttpContext>();

            httpContextMock.Setup(x => x.Authentication).Returns(authenticationManagerMock.Object);
            var httpContextAccessorMock = new Mock <IHttpContextAccessor>();

            httpContextAccessorMock.Setup(x => x.HttpContext).Returns(httpContextMock.Object);
            var httpContextMockObject = httpContextAccessorMock.Object;

            services.AddScoped(x => httpContextAccessorMock);
            services.AddScoped(x => httpContextMockObject);
            services.AddScoped(x => httpClientMockObject);

            //Register email service mock
            var emailServiceMock       = new Mock <IEmailSender>();
            var emailServiceMockObject = emailServiceMock.Object;

            services.AddScoped(x => emailServiceMock);
            services.AddScoped(x => emailServiceMockObject);


            //Register email util mock
            var emailUtilMock       = new Mock <IEmailUtil>();
            var emailUtilMockObject = emailUtilMock.Object;

            services.AddScoped(x => emailUtilMock);
            services.AddScoped(x => emailUtilMockObject);

            serviceProvider = services.BuildServiceProvider();
            RoleSeedFake(serviceProvider);

            //mock SendEmail and GetEmailTemplateForUserDetail methods
            _emailUtilMock    = serviceProvider.GetService <Mock <IEmailUtil> >();
            _mockEmailService = serviceProvider.GetService <Mock <IEmailSender> >();
            _stringConstant   = serviceProvider.GetService <IStringConstant>();
            _userRepository   = serviceProvider.GetService <IUserRepository>();
            _mockEmailService.Setup(x => x.SendEmail(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()));
            _emailUtilMock.Setup(x => x.GetEmailTemplateForUserDetail(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()));
        }
Ejemplo n.º 23
0
 public HomeController(UserManager <ApplicationUser> userManager, IStringConstant stringConstant)
 {
     _userManager    = userManager;
     _stringConstant = stringConstant;
 }
Ejemplo n.º 24
0
 public AccountController(IConfiguration configuration, IAccountRepository accountRepository, IStringConstant iStringConstant)
 {
     _configuration     = configuration;
     _accountRepository = accountRepository;
     _iStringConstant   = iStringConstant;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="httpClient">Wrapper of http client</param>
 /// <param name="stringConstant">Wrapper of string constant</param>
 public ProjectModule(IHttpClientService httpClient, IStringConstant stringConstant)
 {
     _httpClient     = httpClient;
     _stringConstant = stringConstant;
 }
Ejemplo n.º 26
0
 public ConsumerAppRepositoryTest() : base()
 {
     _consumerAppRespository = serviceProvider.GetService <IConsumerAppRepository>();
     _clientContext          = serviceProvider.GetService <IDataRepository <IdentityServer4.EntityFramework.Entities.Client, ConfigurationDbContext> >();
     _stringConstant         = serviceProvider.GetService <IStringConstant>();
 }
Ejemplo n.º 27
0
 public SecurityHeadersAttribute(IStringConstant stringConstant)
 {
     _stringConstant = stringConstant;
 }
Ejemplo n.º 28
0
 public AuthMessageSender(IOptions <EmailCrednetials> emailCrednetials, IStringConstant stringConstant)
 {
     _stringConstant   = stringConstant;
     _emailCrednetials = emailCrednetials;
 }
Ejemplo n.º 29
0
 public CustomProfileService(IUserClaimsPrincipalFactory <ApplicationUser> claimsFactory, UserManager <ApplicationUser> userManager, IStringConstant stringConstant)
 {
     _claimsFactory  = claimsFactory;
     _userManager    = userManager;
     _stringConstant = stringConstant;
 }