Exemplo n.º 1
0
        public void TestewYorkPopulation()
        {
            var db         = SingletonDatabase.GetInstance();
            var population = db.GetPopulation("New York");

            Assert.AreEqual(17800000, population);
        }
Exemplo n.º 2
0
        public void TestTokyoPopulation()
        {
            var db         = SingletonDatabase.GetInstance();
            var population = db.GetPopulation("Tokyo");

            Assert.AreEqual(33200000, population);
        }
Exemplo n.º 3
0
        public void IsSingletonTest()
        {
            var db  = SingletonDatabase.GetInstance();
            var db2 = SingletonDatabase.GetInstance();

            Assert.That(db, Is.SameAs(db2));
            Assert.AreEqual(1, SingletonDatabase.Count);
        }
Exemplo n.º 4
0
        public int GetTotalPopulation(IEnumerable <string> names)
        {
            int result = 0;

            foreach (var name in names)
            {
                result += SingletonDatabase.GetInstance().GetPopulation(name);
            }
            return(result);
        }