示例#1
0
        public void RiverDeleteCountryOnly1CountryThrowsException()
        {
            Continent continent = new Continent("Azië");
            Country   country   = new Country("vietnam", 95540000, 331212f, continent);
            River     river     = new River("Mekong", 4.350, country);
            Action    act       = () => river.DeleteCountry(country);

            act.Should().Throw <ArgumentException>().WithMessage("Mekong needs to be in at least 1 country.");
        }
示例#2
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.");
        }
示例#3
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();
        }