コード例 #1
0
        public void RaisesAlertsIfMaxIsMoreThanThreshold()
        {
            var emailAlert = new EmailAlert();
            var ledAlert   = new LEDAlert();

            IAlerter[] alerters = { emailAlert, ledAlert };

            const float maxThreshold = 10.2F;
            var         statsAlerter = new StatsAlerter(maxThreshold, alerters);

            statsAlerter.checkAndAlert(new List <float> {
                0.2F, 11.9F, 4.3F, 8.5F
            });

            Assert.True(emailAlert.emailSent);
            Assert.True(ledAlert.ledGlows);
        }
        public void RaisesAlertsIfMaxIsMoreThanThreshold()
        {
            var emailAlert = new EmailAlert();
            var ledAlert   = new LEDAlert();

            IAlerter[] alerters = { emailAlert, ledAlert };

            const float  maxThreshold = 10.2f;
            List <float> numbers      = new List <float>();

            numbers.Add((float)0.2);
            numbers.Add((float)11.9);
            numbers.Add((float)4.3);
            numbers.Add((float)8.5);
            var statsAlerter = new StatsAlerter(maxThreshold, alerters);

            statsAlerter.checkAndAlert(numbers);

            Assert.True(emailAlert.emailSent);
            Assert.True(ledAlert.ledGlows);
        }