예제 #1
0
        public void ConfigurablePopulationTest()
        {
            var rf    = new ConfigurableRecordFinder(new DummyDatabase());
            var names = new[] { "alpha", "gamma" };
            int tp    = rf.GetTotalPopulation(names);

            Assert.That(tp, Is.EqualTo(4));
        }
예제 #2
0
        public void SingletonTotalPopulationTest()
        {
            var cf              = new ConfigurableRecordFinder(new DummyDataBase());
            var names           = new[] { "alpha", "gamma" };
            int totalPopulation = cf.GetTotalPopulation(names);

            Assert.AreEqual(totalPopulation, 4);
        }
예제 #3
0
        public void DependantTotalPopulationTest()
        {
            var db = new DummyDatabase();
            var rf = new ConfigurableRecordFinder(db);

            Assert.That(
                rf.GetTotalPopulation(new[] { "alpha", "gamma" }),
                Is.EqualTo(4));
        }
예제 #4
0
            public void ConfigurableTotalPopulationTest()
            {
                //database for test environment
                var rf    = new ConfigurableRecordFinder(new DummyDatabase());
                var names = new[] { "alpha", "gamma" };
                var tp    = rf.GetTotalPopulation(names);

                Assert.That(tp, Is.EqualTo(1 + 3));
            }
예제 #5
0
        public void ConfigurablePopulationTest()
        {
            // now in the ConfigurableRecordFinder we provide the db we want to use, for the test, will be the dummy one
            var rf = new ConfigurableRecordFinder(new DummyDatabase());
            // In this test we don't need to find records from the production db, we faked ones already
            var names = new[] { "alpha", "gamma" };
            int tp    = rf.GetTotalPopulation(names);

            Assert.That(tp, Is.EqualTo(4));
        }
예제 #6
0
        static void Main(string[] args)
        {
            var db  = SingletonDatabase.Instance;
            var db2 = SingletonDatabase.Instance;

            Console.WriteLine(db.GetPopulation("Kitchener"));
            Console.WriteLine($"db.Equals(db2): {db.Equals(db2)}");
            Console.WriteLine($"SingletonDatabase.Count: {SingletonDatabase.Count}");
            var rf = new SingletonRecordFinder();

            Console.WriteLine($"Total population of Kitchener and Waterloo: {rf.GetTotalPopulation(new [] { "Kitchener", "Waterloo" })}");
            var crf = new ConfigurableRecordFinder(new DummyDatabase());

            Console.WriteLine($"Total population of Kitchener and Waterloo with ConfigurableRecordFinder and DummyDatabase injected: {crf.GetTotalPopulation(new[] { "Kitchener", "Waterloo" })}");
        }