static void Main(string[] args) { string filename = Directory.GetCurrentDirectory() + "\\config.json"; string json = File.ReadAllText(filename); PragmaBeerConfig pragmaBeerConfig = JsonConvert.DeserializeObject <PragmaBeerConfig>(json); List <Monitor> monitors = new List <Monitor>(); foreach (ContainerTypeConfig containerTypeConfig in pragmaBeerConfig.ContainerTypes) { ContainerType containerType = new ContainerType(containerTypeConfig); //Add real thermometer reference here IThermometer stubThermometer = new TestingThermometer(containerTypeConfig.ThermometerGuid, "4,4,3.9,3.8,4,5,5.9,6,6.1"); Monitor monitor = new Monitor(stubThermometer, containerType); monitors.Add(monitor); } MonitorSchedule schedule = new MonitorSchedule(CheckIntervalSeconds, monitors); schedule.MonitorReadEvent += new EventHandler(MonitorSchedule__MonitorReadEvent); Console.WriteLine("{0:h:mm:ss.fff} Creating timer.\n", DateTime.Now); schedule.start(); Console.ReadLine(); }
public void Sanity() { //This is a harness for testing the testingThermometer! string expected = "4,4,4.1,4,3.9"; IThermometer thermometer = new TestingThermometer("1001", expected); List <double> temperatures = new List <double>(); for (int i = 0; i < 5; i++) { temperatures.Add(thermometer.Temperature()); } var result = String.Join(",", temperatures.ToArray()); Assert.Equal(expected, result); }