Пример #1
0
 public JobController(IJobService jobService, IAbsenceService absenceService, IUserService userService, IAuditingService audit)
 {
     _jobService     = jobService;
     _absenceService = absenceService;
     _userService    = userService;
     _audit          = audit;
 }
        public async Task GetAllAbsences_WithDummyData_ShouldReturnCorrectResult()
        {
            string errorMessagePrefix = "AbsenceService GetAllAbsences() does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.absenceService = new AbsenceService(context);

            List <AbsenceServiceModel> actualResult = await this.absenceService.GetAllAbsences().ToListAsync();

            List <AbsenceServiceModel> expectedResult = context.Absences.To <AbsenceServiceModel>().ToList();

            Assert.Equal(expectedResult.Count, actualResult.Count);

            for (int i = 0; i < expectedResult.Count; i++)
            {
                var expectedEntity = expectedResult[i];
                var actualEntity   = actualResult[i];

                Assert.True(expectedEntity.Student.FullName == actualEntity.Student.FullName, errorMessagePrefix + " " + "FullName is not returned properly");
                Assert.True($"{expectedEntity.Student.Class.ClassNumber} {expectedEntity.Student.Class.ClassLetter}" == $"{actualEntity.Student.Class.ClassNumber} {actualEntity.Student.Class.ClassLetter}", errorMessagePrefix + " " + "Class Name is not returned properly");
                Assert.True(expectedEntity.Subject.Subject.Name == actualEntity.Subject.Subject.Name, errorMessagePrefix + " " + "Subject Name is not returned properly");
            }
        }
        public async Task CreateAbsence_WithCorrectData_ShouldSuccessfullyCreateOrder()
        {
            string errorMessagePrefix = "AbsenceService CreateAbsenceAsync() method does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.absenceService = new AbsenceService(context);

            var student = new Student
            {
                Id       = "test",
                FullName = "Test",
                Absences = new List <Absence>(),
            };

            await context.Students.AddAsync(student);

            await context.SaveChangesAsync();

            AbsenceServiceModel testAbsence = new AbsenceServiceModel
            {
                StudentId = student.Id,
                Student   = student.To <StudentServiceModel>(),
            };

            bool actualResult = await this.absenceService.CreateAbsenceAsync(testAbsence);

            var updatedStudent        = context.Students.First();
            var expectedAbsencesCount = 1;

            Assert.True(actualResult, errorMessagePrefix);
            Assert.Equal(updatedStudent.Absences.Count, expectedAbsencesCount);
        }
Пример #4
0
        public WorldRecordingContext(ILongTimeAbsenceService longabsenceService,
            IAbsenceService absenceService,
            IWorkingModelService wmManager,
            IColouringService colorManager,
            IEmployeeService emplService,
            IStoreService storeService,
            IWorkingTimePlanningService workingTimePlanningService,
            IAbsenceTimePlanningService absenceTimePlanningService,
            IWorkingTimeRecordingService workingTimeRecordingService,
            IAbsenceTimeRecordingService absenceTimeRecordingService
            )
        {
            _EmployeeService = emplService;
            _StoreService = storeService;
            _WorkingTimePlanningService = workingTimePlanningService;
            _AbsenceTimePlanningService = absenceTimePlanningService;

            _WorkingTimeRecordingService = workingTimeRecordingService;
            _AbsenceTimeRecordingService = absenceTimeRecordingService;

            m_countryabsences = new AbsenceManager(absenceService);
            m_longabsences = new LongTimeAbsenceManager(longabsenceService);
            m_workingmodelmanager = new WorkingModelManagerNew(wmManager);
            m_colormanager = new CountryColorManager(colorManager);

            _ViewDate = DateTime.Today;
            _BeginWeekDate = DateTimeHelper.GetMonday(DateTime.Today);
            _EndWeekDate = DateTimeHelper.GetSunday(DateTime.Today);
            _ViewDate = DateTime.Today;
        }
Пример #5
0
        public WorldRecordingContext(ILongTimeAbsenceService longabsenceService,
                                     IAbsenceService absenceService,
                                     IWorkingModelService wmManager,
                                     IColouringService colorManager,
                                     IEmployeeService emplService,
                                     IStoreService storeService,
                                     IWorkingTimePlanningService workingTimePlanningService,
                                     IAbsenceTimePlanningService absenceTimePlanningService,
                                     IWorkingTimeRecordingService workingTimeRecordingService,
                                     IAbsenceTimeRecordingService absenceTimeRecordingService
                                     )
        {
            _EmployeeService            = emplService;
            _StoreService               = storeService;
            _WorkingTimePlanningService = workingTimePlanningService;
            _AbsenceTimePlanningService = absenceTimePlanningService;

            _WorkingTimeRecordingService = workingTimeRecordingService;
            _AbsenceTimeRecordingService = absenceTimeRecordingService;

            m_countryabsences     = new AbsenceManager(absenceService);
            m_longabsences        = new LongTimeAbsenceManager(longabsenceService);
            m_workingmodelmanager = new WorkingModelManagerNew(wmManager);
            m_colormanager        = new CountryColorManager(colorManager);

            _ViewDate      = DateTime.Today;
            _BeginWeekDate = DateTimeHelper.GetMonday(DateTime.Today);
            _EndWeekDate   = DateTimeHelper.GetSunday(DateTime.Today);
            _ViewDate      = DateTime.Today;
        }
Пример #6
0
 public AbsenseController(IAbsenceService absenceService, IMappingService mappingService, IClassService classService, IMonthService monthService)
 {
     _absenceService = absenceService;
     _mappingService = mappingService;
     _classService   = classService;
     _monthService   = monthService;
 }
 public AvailabilityController(IUserService service, IJobService jobService, IAbsenceService absenceService, IAuditingService audit)
 {
     _service        = service;
     _jobService     = jobService;
     _absenceService = absenceService;
     _audit          = audit;
 }
Пример #8
0
 public AbsenceManager(IAbsenceService service)
 {
     _service = service;
     if (_service == null)
     {
         throw new NullReferenceException();
     }
 }
Пример #9
0
 public AbsenceManager(IAbsenceService service)
 {
     _service = service;
     if (_service == null)
     {
         throw new NullReferenceException();
     }
 }
Пример #10
0
 public LeaveController(ILeaveService service, IAuditingService audit, IDistrictService disService, IAbsenceService absenceService, IUserService userService)
 {
     _service        = service;
     _audit          = audit;
     _disService     = disService;
     _absenceService = absenceService;
     _userService    = userService;
 }
 public AbsenceExportController(IAbsenceExportService absenceExportService,
                                IMapper mapper,
                                IAbsenceService absenceService)
 {
     _absenceExportService = absenceExportService;
     _mapper         = mapper;
     _absenceService = absenceService;
 }
Пример #12
0
 Task IJob.Execute(IJobExecutionContext context)
 {
     _absenceService = new AbsenceService();
     _userService    = new UserService();
     return(Task.Run(() => {
         SendNotificationToPreferredSubstitutes();
     }));
 }
Пример #13
0
 public ClassController(IUserService userService, IClassService classService, IStudentService studentService, ISubjectService subjectService, IAbsenceService absenceService, IRemarkService remarkService, IGradeService gradeService)
 {
     this.userService    = userService;
     this.classService   = classService;
     this.studentService = studentService;
     this.subjectService = subjectService;
     this.absenceService = absenceService;
     this.remarkService  = remarkService;
     this.gradeService   = gradeService;
 }
        public async Task DeleteAbsence_WithNonExistentId_ShouldThrowArgumentNullException()
        {
            string errorMessagePrefix = "AbsenceService DeleteAbsenceAsync() method does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.absenceService = new AbsenceService(context);

            string testId = "Non_Existent";

            await Assert.ThrowsAsync <ArgumentNullException>(async() => await this.absenceService.DeleteAbsenceAsync(testId));
        }
        public async Task CreateAbsence_WithNonExistentStudent_ShouldReturnArgumentNullException()
        {
            string errorMessagePrefix = "AbsenceService CreateAbsenceAsync() method does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.absenceService = new AbsenceService(context);

            AbsenceServiceModel testAbsence = new AbsenceServiceModel();

            await Assert.ThrowsAsync <ArgumentNullException>(async() => await this.absenceService.CreateAbsenceAsync(testAbsence));
        }
        public async Task GetAllAbsences_WithZeroData_ShouldReturnEmptyResults()
        {
            string errorMessagePrefix = "AbsenceService GetAllAbsences() does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            this.absenceService = new AbsenceService(context);

            List <AbsenceServiceModel> actualResult = await this.absenceService.GetAllAbsences().ToListAsync();

            int expectedResult = 0;

            Assert.True(actualResult.Count == expectedResult, errorMessagePrefix);
        }
        public async Task DeleteAbsence_WithExistentId_ShouldSuccessfullyDeleteAbsence()
        {
            string errorMessagePrefix = "AbsenceService DeleteAbsenceAsync() method does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.absenceService = new AbsenceService(context);

            string testId = context.Absences.First().Id;

            await this.absenceService.DeleteAbsenceAsync(testId);

            Absence testAbsence = context.Absences.Find(testId);

            Assert.True(testAbsence.IsDeleted, errorMessagePrefix);
        }
Пример #18
0
 public AbsenceManager(IAbsenceService service, long countryid)
     : this(service)
 {
     CountryId = countryid;
 }
Пример #19
0
 public AbsenceController(IAbsenceService absenceService, IClassService classService, ISubjectService subjectService)
 {
     this.absenceService = absenceService;
     this.classService   = classService;
     this.subjectService = subjectService;
 }
Пример #20
0
 internal ImportAbsence(string fileName, IAbsenceService absenceService)
     : base(fileName, null)
 {
     _AbsenceService = absenceService;
 }
Пример #21
0
 internal ImportAbsence(string fileName, IAbsenceService absenceService)
     : base(fileName, null)
 {
     _AbsenceService = absenceService;
 }
 public AbsenceApprovedConsumer(IStaticCustomerId staticCustomerId, IAbsenceService absenceService, ILogger <AbsenceApprovedConsumer> logger)
 {
     _staticCustomerId = staticCustomerId;
     _absenceService   = absenceService;
     _logger           = logger;
 }
Пример #23
0
 public AbsenceController(IAbsenceService absenceService, UserManager <EdumanUser> userManager)
 {
     this.absenceService = absenceService;
     this.userManager    = userManager;
 }
Пример #24
0
 public AbsenceController(IAbsenceService absenceService, ICompteService compteService, IMailService mailService)
 {
     _absenceService = absenceService;
     _compteService  = compteService;
     _mailService    = mailService;
 }
Пример #25
0
 public Notification(IUserService userService, IAbsenceService absenceService)
 {
     _userService    = userService;
     _absenceService = absenceService;
 }
 public CommunicationController(IUserService service, IAbsenceService absenceService)
 {
     _service        = service;
     _absenceService = absenceService;
 }
Пример #27
0
 /// <summary>
 /// Initializes a new Instance of <see cref="AbsenceController"/>
 /// </summary>
 /// <param name="service">Injected <see cref="IAbsenceService"/></param>
 public AbsenceController(IAbsenceService service) => Service = service;
Пример #28
0
 public AbsenceController(IAbsenceService AbsenceService, IMapper mapper)
 {
     _absenceService = AbsenceService;
     _mapper         = mapper;
 }
 public AbsenceController(IAbsenceService absenceService,
                          ILogger <AbsenceController> logger)
 {
     _absenceService = absenceService;
     _logger         = logger;
 }
Пример #30
0
 public AbsenceManager(IAbsenceService service, long countryid)
     : this(service)
 {
     CountryId = countryid;
 }
 public NavMessageServiceBuilder WithFraværService(IAbsenceService absenceService)
 {
     _absenceService = absenceService;
     return(this);
 }