public async Task GetByIdReturnsTransportWorkTicket() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new EfDeletableEntityRepository <TransportWorkTicket>(new ApplicationDbContext(options.Options)); var workTicketOne = new TransportWorkTicket { Date = DateTime.UtcNow, UserId = "341414153", CarId = "72804eudajhkhfvs-dasfa", StartKilometers = 200100, TravelledDistance = 441, EndKilometers = 200541, FuelAvailability = 55, FuelConsumption = 441 * (5 / 100), Residue = 55 - (441 * (5 / 100)) }; var workTicketTwo = new TransportWorkTicket { Date = DateTime.UtcNow, UserId = "341414153", CarId = "72804eudajhkhfvs-dasfa", StartKilometers = 200541, TravelledDistance = 100, EndKilometers = 200641, FuelAvailability = 55, FuelConsumption = 100 * (5 / 100), Residue = 55 - (100 * (5 / 100)) }; var workTicketThree = new TransportWorkTicket { Date = DateTime.UtcNow, UserId = "3414141890", CarId = "72804eu-jhkhfvs-dasfa", StartKilometers = 200800, TravelledDistance = 100, EndKilometers = 200900, FuelAvailability = 55, FuelConsumption = 100 * (5 / 100), Residue = 55 - (100 * (5 / 100)) }; await repository.AddAsync(workTicketOne); await repository.AddAsync(workTicketTwo); await repository.SaveChangesAsync(); var transportWorkTicketsService = new TransportWorkTicketsService(repository); AutoMapperConfig.RegisterMappings(typeof(TransportWorkTicketViewModel).Assembly); var workTicket = transportWorkTicketsService.GetById(workTicketOne.Id); Assert.Equal(workTicketOne.StartKilometers, workTicket.StartKilometers); Assert.Equal(workTicketOne.EndKilometers, workTicket.EndKilometers); Assert.Equal(workTicketOne.TravelledDistance, workTicket.TravelledDistance); Assert.Equal(workTicketOne.Date, workTicket.Date); Assert.Equal(workTicketOne.FuelAvailability, workTicket.FuelAvailability); Assert.Equal(workTicketOne.FuelConsumption, workTicket.FuelConsumption); }