public static async Task <bool> CheckIfCityExists(CityId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new CityRepository(context); return(await repository.ExistsAsync(id)); }
public async Task City_inserted_to_database() { City city = await CreateValidCity(); var repository = new CityRepository(fixture.context); var sut = await repository.LoadAsync(city.Id); Assert.True(await repository.ExistsAsync(sut.Id)); Assert.True(sut.Name.Length > 0); }
public async Task Update_City_name() { City city = await CreateValidCity(); var repository = new CityRepository(fixture.context); Assert.True(await repository.ExistsAsync(city.Id)); var sut = await repository.LoadAsync(city.Id); var cityId = sut.Id; Assert.NotNull(sut); Assert.Equal("New Mansester", sut.Name); await UpdateCityName(sut.Id, "Manse"); await fixture.context.Entry(sut).ReloadAsync(); Assert.Equal("Manse", sut.Name); Assert.Equal(cityId, sut.Id); }