예제 #1
0
        public void CalculateAverageWithoutDataTest()
        {
            MinuteWiseAverageCalculator calc = new MinuteWiseAverageCalculator();
            List<Measure> actual = calc.CalculateAverage();

            Assert.AreEqual(0, actual.Count);
        }
예제 #2
0
        public void CalculateAverageTest()
        {
            MinuteWiseAverageCalculator calc = new MinuteWiseAverageCalculator();
            DateTime time = BigMama.GetTestDate();
            var measureA = BigMama.GetTestMeasure(time, 100);
            var measureB = BigMama.GetTestMeasure(time.AddSeconds(10), 200);
            var expectedResultTime = Utils.GetWith0Second(time);

            calc.AddMeasure(measureA);
            calc.AddMeasure(measureB);
            double actual = calc.CalculateAverage()[0].OutputWattage;
            DateTime actualTime = calc.CalculateAverage()[0].DateTime;
            actual = calc.CalculateAverage()[0].OutputWattage;

            Assert.AreEqual(150, actual);
            Assert.AreEqual(expectedResultTime, actualTime);
        }