Beispiel #1
0
        public void RiveDeleteCountryNormal()
        {
            Continent continent = new Continent("Azië");
            Country   country   = new Country("vietnam", 95540000, 331212f, continent);
            Country   country2  = new Country("japan", 126500000, 377930f, continent);
            Country   country3  = new Country("thailand", 69430000, 513120f, continent);
            River     river     = new River("Mekong", 4.350, country);

            river.AddCountry(country2);
            river.AddCountry(country3);
            Action act = () => river.DeleteCountry(country3);

            act.Should().NotThrow();
        }
Beispiel #2
0
        public void RiverAddCountryAlreadyAddedThrowsException()
        {
            Continent continent = new Continent("Azië");
            Country   country   = new Country("vietnam", 95540000, 331212f, continent);
            River     river     = new River("Mekong", 4.350, country);
            Action    act       = () => river.AddCountry(country);

            act.Should().Throw <ArgumentException>().WithMessage("Country already added.");
        }
Beispiel #3
0
        public void RiveAddCountryNormal()
        {
            Continent continent = new Continent("Azië");
            Country   country   = new Country("vietnam", 95540000, 331212f, continent);
            Country   country2  = new Country("japan", 126500000, 377930f, continent);
            River     river     = new River("Mekong", 4.350, country);
            Action    act       = () => river.AddCountry(country2);

            act.Should().NotThrow();
            country.Rivers.Count.Should().Be(1);
            country2.Rivers.Count.Should().Be(1);
        }
Beispiel #4
0
        public void RiverDeleteCountryAlreadyRemovedThrowsException()
        {
            Continent continent = new Continent("Azië");
            Country   country   = new Country("vietnam", 95540000, 331212f, continent);
            Country   country2  = new Country("japan", 126500000, 377930f, continent);
            Country   country3  = new Country("thailand", 69430000, 513120f, continent);
            River     river     = new River("Mekong", 4.350, country);

            river.AddCountry(country2);
            Action act = () => river.DeleteCountry(country3);

            act.Should().Throw <Exception>().WithMessage("country: thailand was already removed.");
        }