public void CorrectCreateNavigator() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new ApplicationDbContext(options.Options); var service = new CreateServices(repository); var pilot = new RallyNavigatorsServices(repository); var input = new NavigatorViewModels { FirstName = "Pesho", LastName = "Ivanov", Energy = 100, }; var result = service.CreateNavigatorAsync(input); var resultPiot = pilot.GetNavigator(1); var resultId = resultPiot.Id; var resultFirstName = resultPiot.FirstName; var resultLastName = resultPiot.LastName; var resultEnergy = resultPiot.Energy; Assert.Equal("Pesho", resultFirstName); Assert.Equal("Ivanov", resultLastName); Assert.Equal(1, resultId); Assert.Equal(100, resultEnergy); Assert.Equal("Навигатора е успешно създадено.", result); }
public void CorrectRentalsPilot() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new ApplicationDbContext(options.Options); var money = new MoneyAccountServices(repository); var pilot = new RallyPilotsServices(repository); var navigator = new RallyNavigatorsServices(repository); var car = new CarServices(repository, pilot, navigator, money); var team = new TeamServices(repository, car, money, pilot, navigator); money.CreateMoneyAccount("Pesho"); team.CreateTeamAsync("Vidin", "Pesho").GetAwaiter().GetResult(); var t = team.FindUserAsync("Pesho").Result; var id = t.RallyPilotId; }