Exemplo n.º 1
0
        public void Match_NonExistingKey_ThrowException()
        {
            var countryLookup = new CountryLookup();

            countryLookup.Load();

            Assert.Throws <System.Collections.Generic.KeyNotFoundException>(() => countryLookup.Match("XX"));
        }
Exemplo n.º 2
0
        public void Match_ExistingKey_ReturnValue()
        {
            var countryLookup = new CountryLookup();

            countryLookup.Load();
            var country = countryLookup.Match("US");

            Assert.That(country, Is.EqualTo("United States of America"));
        }
        public void Match_IncrementalNonExistingKeys_ReturnValue()
        {
            var countryLookup = new CountryLookup();

            countryLookup.Load();
            var country = countryLookup.Match("XX");

            Assert.That(country, Is.EqualTo("Unknown"));

            country = countryLookup.Match("YY");
            Assert.That(country, Is.EqualTo("Unknown"));

            country = countryLookup.Match("ZZ");
            Assert.That(country, Is.EqualTo("Unknown"));
        }
        public void Match_IncrementalNonExistingKeys_IsReallyIncremental()
        {
            var countryLookup = new CountryLookup();

            countryLookup.Load();
            Assert.That(countryLookup.Count(), Is.EqualTo(0));

            var country = countryLookup.Match("US");

            Assert.That(countryLookup.Count(), Is.EqualTo(1));

            country = countryLookup.Match("XX");
            Assert.That(countryLookup.Count(), Is.EqualTo(1));

            country = countryLookup.Match("US");
            Assert.That(countryLookup.Count(), Is.EqualTo(1));
        }