Exemplo n.º 1
0
    public void CheckThrowsExceptionIfGivenPressureIsNegative
        (double pressureLevel)
    {
        fakeSensor
        .Setup(s => s.PopNextPressurePsiValue())
        .Returns(pressureLevel);

        alarm = new Alarm(fakeSensor.Object);

        Assert.That(() => alarm.Check(), Throws.Exception);
    }
Exemplo n.º 2
0
    public void AlarmDoesNotGoOnIfPressureIsWithinRange
        (double pressureLevel)
    {
        fakeSensor
        .Setup(s => s.PopNextPressurePsiValue())
        .Returns(pressureLevel);

        alarm = new Alarm(fakeSensor.Object);

        alarm.Check();

        Assert.That(alarm.AlarmOn, Is.EqualTo(false));
    }
Exemplo n.º 3
0
    public void AlarmGoesOnIfPressureLevelAboveHighPressureTreshHold
        (double pressureLevel)
    {
        fakeSensor
        .Setup(s => s.PopNextPressurePsiValue())
        .Returns(pressureLevel);

        alarm = new Alarm(fakeSensor.Object);

        alarm.Check();

        Assert.That(alarm.AlarmOn, Is.EqualTo(true));
    }