Exemplo n.º 1
0
        public static async Task <bool> CheckIfLocationExists(LocationId id)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new SplurgeStopDbContext(connectionString);
            var repository       = new LocationRepository(context);

            return(await repository.ExistsAsync(id));
        }
Exemplo n.º 2
0
        public async Task Location_inserted_to_database()
        {
            Location location = await CreateValidLocation();

            var repository = new LocationRepository(fixture.context);
            var sut        = await repository.LoadAsync(location.Id);

            Assert.True(await repository.ExistsAsync(sut.Id));
            Assert.NotNull(sut.City);
            Assert.NotNull(sut.Country);
        }
Exemplo n.º 3
0
        public async Task Update_Location_country()
        {
            Location location = await CreateValidLocation();

            var repository = new LocationRepository(fixture.context);

            Assert.True(await repository.ExistsAsync(location.Id));

            var sut = await repository.LoadAsync(location.Id);

            Assert.NotNull(sut);

            var newCountry = await CountryHelpers.CreateValidCountry();

            await UpdateLocationCountry(sut.Id, newCountry);

            sut = await repository.LoadAsync(sut.Id);

            await fixture.context.Entry(sut).ReloadAsync();

            Assert.Equal(newCountry.Id, sut.Country.Id);
        }