public void IsAlarmOn_PsiPressureLessThanHighPressureAndGreaterThanLowPressure_False() { // Arrange var mockPressureSensor = new Mock <IPressureSensor>(); mockPressureSensor.Setup(m => m.GetPressurePsi()) .Returns((HighPressureThreshold + LowPressureThreshold) / 2); var tirePressureAlarm = new TirePressureAlarm(mockPressureSensor.Object); // Act var isAlarmOn = tirePressureAlarm.IsTireAlarmOn(); // Assert Assert.False(isAlarmOn); }
public void IsAlarmOn_PsiPressureLessThanLowPressureThreshold_True() { // Arrange var pressureOffset = 10; var mockPressureSensor = new Mock <IPressureSensor>(); mockPressureSensor.Setup(m => m.GetPressurePsi()).Returns(LowPressureThreshold - pressureOffset); var tirePressureAlarm = new TirePressureAlarm(mockPressureSensor.Object); // Act var isAlarmOn = tirePressureAlarm.IsTireAlarmOn(); // Assert Assert.True(isAlarmOn); }