public void ContinentRepositoryFunction_HasCountries_FunctionalityTest() { GeographyContextTest context = new GeographyContextTest(true); ContinentRepository repo = new ContinentRepository(context); repo.HasCountries(1).Should().BeFalse(); repo.HasCountries(3).Should().BeTrue(); }
public void CountryRepositoryFunction_AddCountry_FunctionalityTest() { GeographyContextTest context = new GeographyContextTest(true); CountryRepository countryRepo = new CountryRepository(context); ContinentRepository continentRepo = new ContinentRepository(context); Continent continent = new Continent("Continent60"); context.SaveChanges(); continentRepo.AddContinent(continent); context.SaveChanges(); countryRepo.AddCountry(4, "Country60", 20, 30.0f); context.SaveChanges(); var countryFromRepo = countryRepo.GetCountry(4, 2); continentRepo.HasCountries(4).Should().BeTrue(); countryFromRepo.Name.Should().Be("Country60"); countryFromRepo.Population.Should().Be(20); countryFromRepo.Surface.Should().Be(30.0f); countryFromRepo.Continent.Name.Should().Be("Continent60"); }