예제 #1
0
        public void OnlyComplete5MinDataIsReported()
        {
            var undertest = new TestLoader();
            var date = new DateTime(2014, 05, 14);
            undertest.Minute_Log_5s = new[]{
                new Minute_Log_5 { ApplianceID = 1, LogDate = date, Usage_00 = -1,   Usage_05 = -1 },
                new Minute_Log_5 { ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2 },
            };

            var result = undertest.Get5minPlugwiseYield(date, new[] { 1, 2 } /*specific appliances*/);
            // We expect a single result using just Usage_05 since that is complete.
            var expected = new[] {
                new YieldAggregate(date.AddMinutes(5),3, TimeSpan.FromMinutes(5))
            };
            CollectionAssert.AreEquivalent(expected, result);
        }
예제 #2
0
        public void InComplete5MinDataIsReported()
        {
            var undertest = new TestLoader();
            var date = new DateTime(2014, 05, 14);
            undertest.Minute_Log_5s = new[]{
                new Minute_Log_5 { ApplianceID = 1, LogDate = date, Usage_00 = -1,   Usage_05 = -1 },
                new Minute_Log_5 { ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2 },
            };

            var result = undertest.Get5minPlugwiseYield(date, new int[0] /*No specific appliances*/);
            var expected = new[] {
                new YieldAggregate (date.AddMinutes(00), 1, TimeSpan.FromMinutes(5)) ,
                new YieldAggregate (date.AddMinutes(05), 3, TimeSpan.FromMinutes(5)) ,
                new YieldAggregate (date.AddMinutes(10), 2, TimeSpan.FromMinutes(5))
            };
            CollectionAssert.AreEquivalent(expected, result);
        }
예제 #3
0
        public void OnlyComplete5MinDataIsReported()
        {
            var undertest = new TestLoader();
            var date      = new DateTime(2014, 05, 14);

            undertest.Minute_Log_5s = new[] {
                new Minute_Log_5 {
                    ApplianceID = 1, LogDate = date, Usage_00 = -1, Usage_05 = -1
                },
                new Minute_Log_5 {
                    ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2
                },
            };

            var result = undertest.Get5minPlugwiseYield(date, new[] { 1, 2 } /*specific appliances*/);
            // We expect a single result using just Usage_05 since that is complete.
            var expected = new[] {
                new YieldAggregate(date.AddMinutes(5), 3, TimeSpan.FromMinutes(5))
            };

            CollectionAssert.AreEquivalent(expected, result);
        }
예제 #4
0
        public void InComplete5MinDataIsReported()
        {
            var undertest = new TestLoader();
            var date      = new DateTime(2014, 05, 14);

            undertest.Minute_Log_5s = new[] {
                new Minute_Log_5 {
                    ApplianceID = 1, LogDate = date, Usage_00 = -1, Usage_05 = -1
                },
                new Minute_Log_5 {
                    ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2
                },
            };

            var result   = undertest.Get5minPlugwiseYield(date, new int[0] /*No specific appliances*/);
            var expected = new[] {
                new YieldAggregate(date.AddMinutes(00), 1, TimeSpan.FromMinutes(5)),
                new YieldAggregate(date.AddMinutes(05), 3, TimeSpan.FromMinutes(5)),
                new YieldAggregate(date.AddMinutes(10), 2, TimeSpan.FromMinutes(5))
            };

            CollectionAssert.AreEquivalent(expected, result);
        }