public static async Task <bool> CheckIfCountryExists(CountryId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new SplurgeStopDbContext(connectionString); var repository = new CountryRepository(context); return(await repository.ExistsAsync(id)); }
public async Task Country_inserted_to_database() { Country country = await CreateValidCountry(); var repository = new CountryRepository(fixture.context); var sut = await repository.LoadAsync(country.Id); Assert.True(await repository.ExistsAsync(sut.Id)); Assert.True(sut.Name.Length > 0); }
public async Task Update_Country_name() { Country country = await CreateValidCountry(); var repository = new CountryRepository(fixture.context); Assert.True(await repository.ExistsAsync(country.Id)); var sut = await repository.LoadAsync(country.Id); var countryId = sut.Id; Assert.NotNull(sut); Assert.Equal("Rapture", sut.Name); await UpdateCountryName(sut.Id, "Columbia"); await fixture.context.Entry(sut).ReloadAsync(); Assert.Equal("Columbia", sut.Name); Assert.Equal(countryId, sut.Id); }