public DriverTestsV2() { _driver = DriverFake.Generate(); _driver.Orders = OrderFake.Generate(3); // Используем общую логику сериализации из базового класса _jsonString = SerializeObjectToJson(_driver); }
public async Task GetVacantDriversAsync__UrlWasCalledWithValidVerbAndContentType() { // Arrange var drivers = DriverFake.Generate(4); _httpTest.RespondWithJson(drivers); // Act await _restService.GetVacantDriversAsync(_currentDateTime); // Assert _httpTest.ShouldHaveCalled(_url).WithVerb(HttpMethod.Get); }
public void Get__DriverExistsInStorage__ReturnThisDriver_V2() { // Arrange var driver = DriverFake.Generate(); var driverId = _driverTestRepository.Create(_dbExecutor, driver); // Act var foundDriver = _query.Get(driverId); // Assert Assert.NotNull(foundDriver); Assert.Equal(driver.Phone, foundDriver.Phone); Assert.Equal(driver.FullName, foundDriver.FullName); }
public async Task GetVacantDriversAsync__ReturnValidVacantDrivers() { // Arrange var drivers = DriverFake.Generate(4); _httpTest.RespondWithJson(drivers); // Act var vacantDrivers = await _restService.GetVacantDriversAsync(_currentDateTime); // Assert Assert.Equal(drivers.Count, vacantDrivers.Count); Assert.All(vacantDrivers, driver => drivers.Exists(e => e.Id == driver.Id)); Assert.True(vacantDrivers.All(e => drivers.Exists(driver => driver.Id == e.Id))); }
public void Get__DriverExistsInStorage__ReturnThisDriver_V1() { // Arrange var driver = DriverFake.Generate(); var insertDriverSql = $@" insert into Drivers(FullName, Phone) values (""{driver.FullName}"", ""{driver.Phone}""); select last_insert_rowid(); "; var driverId = _dbExecutor.Query <int>(insertDriverSql).First(); // Act var foundDriver = _query.Get(driverId); // Assert Assert.NotNull(foundDriver); Assert.Equal(driver.Phone, foundDriver.Phone); Assert.Equal(driver.FullName, foundDriver.FullName); }
public DriverTests() { _driver = DriverFake.Generate(); _driver.Orders = OrderFake.Generate(3); _jsonString = JsonConvert.SerializeObject(_driver); }