Exemple #1
0
        public void OnNewValue_SingleValue(double expected, double newValue)
        {
            var window = new GaugeWindowCalculator();

            window.OnNewValue(newValue);

            Assert.AreEqual(expected, window.GetValue());
        }
Exemple #2
0
        public void GetValue_Zero()
        {
            var window = new GaugeWindowCalculator();

            var result = window.GetValue();

            Assert.AreEqual(0, result);
        }
Exemple #3
0
        public void OnNextSecond_OneTime()
        {
            var window = new GaugeWindowCalculator();

            window.OnNewValue(10);
            window.OnNextSecond();
            window.OnNewValue(0);

            Assert.AreEqual(5.0, window.GetValue());
        }
Exemple #4
0
        public void OnNewValue_Sequence(double expected, double[] newValues)
        {
            var window = new GaugeWindowCalculator();

            foreach (var val in newValues)
            {
                window.OnNewValue(val);
            }

            Assert.AreEqual(expected, window.GetValue());
        }
Exemple #5
0
        public void OnNextSecond_(double expected, double firstVal, double populateVal, double lastVal, int populateTimes)
        {
            var window = new GaugeWindowCalculator();

            window.OnNewValue(firstVal);
            for (var i = 0; i < populateTimes; ++i)
            {
                window.OnNextSecond();
                window.OnNewValue(populateVal);
            }
            window.OnNextSecond();
            window.OnNewValue(lastVal);

            Assert.AreEqual(expected, window.GetValue());
        }