public void Init() { mockConsumer = new MMeterConsumer(); mockMeter = new ThermoMeter<Celsius>(mockConsumer); mockMeter.LowerThreshold = new Celsius(0); mockMeter.UpperThreshold = new Celsius(100); mockMeter.Fluctuation = new Celsius(1); mockMeter.ReadInterval = 500; mockInputReader = new MInputReader<Celsius>(); }
public void MixedSimpleEventTest() { mockInputReader = new MInputReader<Celsius>(); mockInputReader.ValuesToRead.Enqueue(new Celsius(0)); mockInputReader.ValuesToRead.Enqueue(new Celsius(100)); mockMeter.InputReader = mockInputReader; StartMeterHelper(); Assert.AreEqual(2, mockConsumer.Values.Count); Assert.AreEqual(1, mockConsumer.LowerThresholdWarnings.Count); Assert.AreEqual(1, mockConsumer.UpperThresholdWarnings.Count); }
public void LowerWarningWithFluctuation() { //A fahrenheit meter reading from celsius input mockInputReader = new MInputReader<Celsius>(); List<double> values = new List<double> { 2.0,1.0,1.0,0.0,-1,0.5,1.0,0 }; foreach (double value in values) { mockInputReader.ValuesToRead.Enqueue(new Celsius(value)); } mockMeter.InputReader = mockInputReader; StartMeterHelper(); Assert.AreEqual(1, mockConsumer.LowerThresholdWarnings.Count); }