public async Task VoteAsync_ShouldRetutnCorrectResult() { MapperInitializer.InitializeMapper(); var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var transferRepository = new EfDeletableEntityRepository <Transfer>(context); var userRepository = new EfDeletableEntityRepository <ApplicationUser>(context); var transfersService = new TransfersService(transferRepository, userRepository); var seeder = new DbContextTestsSeeder(); await seeder.SeedTransfersAsync(context); var result = await transfersService.VoteAsync(1); Assert.True(result == 1, ErrorMessage); }
public async Task IsDriverAvailableByDate_ShouldRetutnFalse() { MapperInitializer.InitializeMapper(); var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var transferRepository = new EfDeletableEntityRepository <Transfer>(context); var userRepository = new EfDeletableEntityRepository <ApplicationUser>(context); var transfersService = new TransfersService(transferRepository, userRepository); var seeder = new DbContextTestsSeeder(); await seeder.SeedTransfersAsync(context); var result = await transfersService.IsDriverAvailableByDate(DateTime.Now, "bcd"); Assert.False(result, ErrorMessage); }
public async Task SettingUpTransfersStatusByDateAsync_ShouldReturnCorrectResult() { var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var seeder = new DbContextTestsSeeder(); await seeder.SeedTransfersAsync(context); var reservationsRepository = new EfDeletableEntityRepository <Reservation>(context); var transfersRepository = new EfDeletableEntityRepository <Transfer>(context); var hangfireService = new HangfireService(reservationsRepository, transfersRepository); var result = await hangfireService.SettingUpTransfersStatusByDateAsync(); Assert.True(result == 2, ErrorMessage); }
public async Task GetByUserAsync_ShouldReturnAllReservationsForUser(string clientId, int?reservationsPerPage, int skip) { MapperInitializer.InitializeMapper(); var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var transferRepository = new EfDeletableEntityRepository <Transfer>(context); var userRepository = new EfDeletableEntityRepository <ApplicationUser>(context); var transfersService = new TransfersService(transferRepository, userRepository); var seeder = new DbContextTestsSeeder(); await seeder.SeedTransfersAsync(context); await seeder.SeedUsersAsync(context); var result = await transfersService.GetByUserAsync(clientId, reservationsPerPage, skip); Assert.True(result.ToList().Count == 3, ErrorMessage); }
public async Task PayByIdAsync_ShouldRetutnCorrectResult_RankPlatinumUser() { MapperInitializer.InitializeMapper(); var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var transferRepository = new EfDeletableEntityRepository <Transfer>(context); var userRepository = new EfDeletableEntityRepository <ApplicationUser>(context); var transfersService = new TransfersService(transferRepository, userRepository); var seeder = new DbContextTestsSeeder(); await seeder.SeedTransfersAsync(context); await seeder.SeedUsersAsync(context); var transfer = transferRepository.GetByIdWithDeletedAsync(8); var result = await transfersService.PayByIdAsync(7, "efg"); Assert.True(result == 9, ErrorMessage); }