public void asd() { //Arange var mock = new Mock<ISensor>(); mock.Setup(r => r.PopNextPressurePsiValue()) .Returns(1); Sensor sensor = new Sensor(this.rndNumProv); Alarm alarm = new Alarm(mock.Object); Assert.IsFalse(alarm.AlarmOn); }
public static void Main() { Random rnd = new Random(); RandomNumberProvider rndNumProv = new RandomNumberProvider(rnd); Sensor sensor = new Sensor(rndNumProv); Alarm alarm = new Alarm(sensor); for (int i = 0; i < 10; i++) { alarm.Check(); Console.WriteLine(alarm.AlarmOn); } }