Ejemplo n.º 1
0
        public async Task SetUp()
        {
            var settings = new Dictionary <string, string>();

            settings.Add("Unimicro.Api.Url", "http://dummyUrl");
            settings.Add("Common_Api_Url", "http://dummyUrl");
            settings.Add("Integrations_Api_Url", "http://dummyUrl");

            _actions = (sc) =>
            {
                _unitService        = A.Fake <IUnitService>();
                _employeeService    = A.Fake <commonContracts.IEmployeeService>();
                _absenceTypeService = A.Fake <IAbsenceTypeService>();
                _unimicroClient     = A.Fake <IUnimicroClient>();
                A.CallTo(() => _unimicroClient.SignIn()).Returns(new Login {
                    AccessToken = "accessToken"
                });

                sc.ReplaceTransient <IDbContextFactory <TimeregDbContext>, InMemoryDbContextFactory>();
                sc.ReplaceScoped <IUnitService>(_unitService);
                sc.ReplaceScoped <commonContracts.IEmployeeService>(_employeeService);
                sc.ReplaceScoped <IAbsenceTypeService>(_absenceTypeService);
                sc.ReplaceScoped <IUnimicroClient>(_unimicroClient);
            };

            _testServer = new TestServerBuilder()
                          .WithPostConfigureCollection(_actions)
                          .WithConfigSettings(settings)
                          .Build <Startup>();

            _client = _testServer.CreateClientWithJwtToken(CustomerId, _userId);
            _mapper = _testServer.Host.Services.GetService <IMapper>();
            var dbFactory = _testServer.Host.Services.GetService <IDbContextFactory <TimeregDbContext> >();

            _db = await dbFactory.CreateDbContext();
        }
Ejemplo n.º 2
0
 public AbsenceTypeController(IAbsenceTypeService absenceTypeService, IAbsenceStatusService absenceStatusService)
 {
     this.absenceTypeService   = absenceTypeService;
     this.absenceStatusService = absenceStatusService;
 }
Ejemplo n.º 3
0
 public AbsenceStatusController(IAbsenceStatusService absenceService, IUserService userService, IAbsenceTypeService absenceTypeService)
 {
     this.absenceService     = absenceService;
     this.userService        = userService;
     this.absenceTypeService = absenceTypeService;
 }
Ejemplo n.º 4
0
 public AbsenceTypeController(IAbsenceTypeService service, IMapper mapper)
 {
     _service = service;
     _mapper  = mapper;
 }