public async Task VoteAsync_ShouldRetutnCorrectResult()
        {
            MapperInitializer.InitializeMapper();
            var context         = ApplicationDbContextInMemoryFactory.InitializeContext();
            var tripsRepository = new EfDeletableEntityRepository <Trip>(context);
            var carsRepository  = new EfDeletableEntityRepository <Car>(context);
            var usersRepository = new EfDeletableEntityRepository <ApplicationUser>(context);
            var tripsService    = new TripsService(tripsRepository, usersRepository, carsRepository);
            var seeder          = new DbContextTestsSeeder();
            await seeder.SeedTripsAsync(context);

            var result = await tripsService.VoteAsync(1);

            Assert.True(result == 1, ErrorMessage);
        }
        public async Task GetByUserAsync_ShouldReturnAllReservationsForUser(string clientId, int?tripsPerPage, int skip)
        {
            MapperInitializer.InitializeMapper();
            var context         = ApplicationDbContextInMemoryFactory.InitializeContext();
            var tripsRepository = new EfDeletableEntityRepository <Trip>(context);
            var carsRepository  = new EfDeletableEntityRepository <Car>(context);
            var usersRepository = new EfDeletableEntityRepository <ApplicationUser>(context);
            var tripsService    = new TripsService(tripsRepository, usersRepository, carsRepository);
            var seeder          = new DbContextTestsSeeder();
            await seeder.SeedTripsAsync(context);

            await seeder.SeedUsersAsync(context);

            var result = await tripsService.GetByUserAsync(clientId, tripsPerPage, skip);

            Assert.True(result.ToList().Count == 2, ErrorMessage);
        }
        public async Task PayAsync_ShouldRetutnCorrectResultForDays_RankUser()
        {
            MapperInitializer.InitializeMapper();
            var context         = ApplicationDbContextInMemoryFactory.InitializeContext();
            var tripsRepository = new EfDeletableEntityRepository <Trip>(context);
            var carsRepository  = new EfDeletableEntityRepository <Car>(context);
            var usersRepository = new EfDeletableEntityRepository <ApplicationUser>(context);
            var tripsService    = new TripsService(tripsRepository, usersRepository, carsRepository);
            var seeder          = new DbContextTestsSeeder();
            await seeder.SeedTripsAsync(context);

            await seeder.SeedUsersAsync(context);

            var trip = await tripsRepository.All().Where(t => t.Id == 2).FirstOrDefaultAsync();

            var tripsServiceModel = trip.To <MyTripsServiceAllModel>();
            var result            = await tripsService.PayAsync(tripsServiceModel);

            Assert.True(result == 6, ErrorMessage);
        }