Exemplo n.º 1
0
 public UrlopyModel(SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager, EfCoreVacationRepo efCoreVacation, AppDbContext context) : base(signInManager)
 {
     _signInManager  = signInManager;
     _context        = context;
     _efCoreVacation = efCoreVacation;
     _userManager    = userManager;
 }
Exemplo n.º 2
0
        public void VacationTime_AddNewVacationTime()
        {
            using (var db = new AppDbContext(Utilities.TestDbContextOptions()))
            {
                // Arrange
                DateTime dateFrom = new DateTime(2021, 12, 01);
                DateTime dateTo   = new DateTime(2021, 12, 31);

                var vacationRepo          = new EfCoreVacationRepo(db);
                var vacationTimeViewModel = new VacationTimeViewModel();
                var vacationTime          = new VacationTime()
                {
                    Id        = Guid.NewGuid(),
                    Person    = "master",
                    DateFrom  = dateFrom.ToString(CultureInfo.InvariantCulture),
                    DateTo    = dateTo.ToString(CultureInfo.InvariantCulture),
                    Reason    = "Testing vacation",
                    CreatedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.CurrentCulture),
                    UpdatedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.CurrentCulture),
                    TotalDays = vacationTimeViewModel.CalculateDays(dateFrom, dateTo).ToString(CultureInfo.InvariantCulture) + " dni"
                };

                // Act
                vacationRepo.Add(vacationTime);

                // Assert
                Assert.AreEqual((dateTo - dateFrom).TotalDays + " dni", vacationRepo.Get(vacationTime.Id).Result.TotalDays);
                Assert.AreEqual(vacationTime.Reason, vacationRepo.Get(vacationTime.Id).Result.Reason);
                Assert.IsNotNull(vacationRepo.Get(vacationTime.Id).Result.Person);
            }
        }
 public UsunUrlopModel(SignInManager <ApplicationUser> signInManager,
                       AppDbContext dbContext,
                       EfCoreVacationRepo efCoreVacation) : base(signInManager)
 {
     _signInManager  = signInManager;
     _context        = dbContext;
     _efCoreVacation = efCoreVacation;
 }