Ejemplo n.º 1
0
        public void Given30Messages2DaysApart_StartingAt100AndDecreasingBy2BetweenEachMessage_DaysLeftEquals59()
        {
            Guid customerId = Guid.NewGuid();
            Guid deviceId   = Guid.NewGuid();

            List <MonitoringMessage> messages =
                new MonitoringMessageListBuilder(customerId, deviceId).AListOfMessages(29, 1, 100, 1).Build();

            ForecastingEngine engine   = new ForecastingEngine();
            DeviceForecast    forecast = engine.CalculateDeviceConsumableForecast(messages, deviceId);

            // 4 consumables for this device, all are decreasing at the same rate of 1 percent per day
            // which means they have 50 days left until hitting 10 percent
            Assert.AreEqual(4, forecast.ConsumableForecasts.Count);
            Assert.IsFalse(forecast.ConsumableForecasts.Any(x => x.CurrentLevel != 61));
            Assert.IsFalse(forecast.ConsumableForecasts.Any(x => x.AverageDailyUse != 1));
            Assert.IsFalse(forecast.ConsumableForecasts.Any(x => x.DaysRemainingToTenPercent != 50));
        }
Ejemplo n.º 2
0
        public void Given30Messages2DaysApart_StartingAt100AndDecreasingBy2BetweenEachMessage_DaysLeftEquals59()
        {
            Guid customerId = Guid.NewGuid();
            Guid deviceId = Guid.NewGuid();

            List<MonitoringMessage> messages =
                new MonitoringMessageListBuilder(customerId, deviceId).AListOfMessages(29, 1, 100, 1).Build();

            ForecastingEngine engine = new ForecastingEngine();
            DeviceForecast forecast = engine.CalculateDeviceConsumableForecast(messages, deviceId);

            // 4 consumables for this device, all are decreasing at the same rate of 1 percent per day
            // which means they have 50 days left until hitting 10 percent
            Assert.AreEqual(4, forecast.ConsumableForecasts.Count);
            Assert.IsFalse(forecast.ConsumableForecasts.Any(x => x.CurrentLevel != 61));
            Assert.IsFalse(forecast.ConsumableForecasts.Any(x => x.AverageDailyUse != 1));
            Assert.IsFalse(forecast.ConsumableForecasts.Any(x => x.DaysRemainingToTenPercent != 50));
        }