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)); }
public void SingletonTotalPopulationTest() { var cf = new ConfigurableRecordFinder(new DummyDataBase()); var names = new[] { "alpha", "gamma" }; int totalPopulation = cf.GetTotalPopulation(names); Assert.AreEqual(totalPopulation, 4); }
public void DependantTotalPopulationTest() { var db = new DummyDatabase(); var rf = new ConfigurableRecordFinder(db); Assert.That( rf.GetTotalPopulation(new[] { "alpha", "gamma" }), Is.EqualTo(4)); }
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)); }
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)); }
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" })}"); }