Пример #1
0
        public void QueryList_BySection()
        {
            LaneFlowManager_Alone service     = TestInit.ServiceProvider.CreateScope().ServiceProvider.GetRequiredService <LaneFlowManager_Alone>();
            IMemoryCache          memoryCache = TestInit.ServiceProvider.GetRequiredService <IMemoryCache>();

            foreach (FlowDevice device in _devices)
            {
                foreach (var relation in device.FlowDevice_FlowChannels)
                {
                    HashSet <string> laneIds = new HashSet <string>(
                        memoryCache.GetLanes()
                        .Where(l => l.Channel.SectionId == relation.Channel.SectionId.Value)
                        .Select(l => l.DataId));
                    var list1 = service.QueryList(laneIds, DateTimeLevel.Minute, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                    for (int i = 0; i < list1.Count; ++i)
                    {
                        int    totalFlow          = 0;
                        int    totalDistance      = 0;
                        double totalTravelTime    = 0.0;
                        int    totalOccupancy     = 0;
                        int    totalTimeOccupancy = 0;
                        double totalHeadDistance  = 0.0;
                        int    totalCount         = 0;
                        foreach (string laneId in laneIds)
                        {
                            totalFlow          += _datas[laneId][i].Total;
                            totalDistance      += _datas[laneId][i].Distance;
                            totalTravelTime    += _datas[laneId][i].TravelTime;
                            totalOccupancy     += _datas[laneId][i].Occupancy;
                            totalTimeOccupancy += _datas[laneId][i].TimeOccupancy;
                            totalHeadDistance  += _datas[laneId][i].HeadDistance;
                            totalCount         += 1;
                        }
                        Assert.AreEqual(totalFlow, list1[i].Total);
                        Assert.AreEqual(totalOccupancy, list1[i].Occupancy);
                        Assert.AreEqual(totalTimeOccupancy, list1[i].TimeOccupancy);
                        Assert.AreEqual(totalHeadDistance, list1[i].HeadDistance);

                        Assert.IsTrue(Math.Abs(totalDistance / totalTravelTime * 3600 / 1000 - list1[i].AverageSpeed) < 0.1);
                        Assert.IsTrue(Math.Abs(totalHeadDistance / totalCount * (totalDistance / totalTravelTime) - list1[i].HeadSpace) < 0.1);
                    }

                    var list5 = service.QueryList(laneIds, DateTimeLevel.FiveMinutes, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                    for (int i = 0; i < list5.Count; ++i)
                    {
                        int    totalFlow          = 0;
                        int    totalDistance      = 0;
                        double totalTravelTime    = 0.0;
                        int    totalOccupancy     = 0;
                        int    totalTimeOccupancy = 0;
                        double totalHeadDistance  = 0.0;
                        int    totalCount         = 0;
                        foreach (string laneId in laneIds)
                        {
                            var list = _datas[laneId].Where(f =>
                                                            f.DateTime >= _startDate.AddMinutes(5 * i) &&
                                                            f.DateTime < _startDate.AddMinutes(5 * (i + 1))).ToList();
                            totalFlow          += list.Sum(f => f.Total);
                            totalDistance      += list.Sum(f => f.Distance);
                            totalTravelTime    += list.Sum(f => f.TravelTime);
                            totalOccupancy     += list.Sum(f => f.Occupancy);
                            totalTimeOccupancy += list.Sum(f => f.TimeOccupancy);
                            totalHeadDistance  += list.Sum(f => f.HeadDistance);
                            totalCount         += list.Count;
                        }

                        Assert.AreEqual(totalFlow, list5[i].Total);
                        Assert.AreEqual(totalOccupancy, list5[i].Occupancy);
                        Assert.AreEqual(totalTimeOccupancy, list5[i].TimeOccupancy);
                        Assert.AreEqual(totalHeadDistance, list5[i].HeadDistance);

                        Assert.IsTrue(Math.Abs(totalDistance / totalTravelTime * 3600 / 1000 - list5[i].AverageSpeed) < 0.1);
                        Assert.IsTrue(Math.Abs(totalHeadDistance / totalCount * (totalDistance / totalTravelTime) - list5[i].HeadSpace) < 0.1);
                    }

                    var list15 = service.QueryList(laneIds, DateTimeLevel.FifteenMinutes, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                    for (int i = 0; i < list15.Count; ++i)
                    {
                        int    totalFlow          = 0;
                        int    totalDistance      = 0;
                        double totalTravelTime    = 0.0;
                        int    totalOccupancy     = 0;
                        int    totalTimeOccupancy = 0;
                        double totalHeadDistance  = 0.0;
                        int    totalCount         = 0;
                        foreach (string laneId in laneIds)
                        {
                            var list = _datas[laneId].Where(f =>
                                                            f.DateTime >= _startDate.AddMinutes(15 * i) &&
                                                            f.DateTime < _startDate.AddMinutes(15 * (i + 1))).ToList();
                            totalFlow          += list.Sum(f => f.Total);
                            totalDistance      += list.Sum(f => f.Distance);
                            totalTravelTime    += list.Sum(f => f.TravelTime);
                            totalOccupancy     += list.Sum(f => f.Occupancy);
                            totalTimeOccupancy += list.Sum(f => f.TimeOccupancy);
                            totalHeadDistance  += list.Sum(f => f.HeadDistance);
                            totalCount         += list.Count;
                        }
                        Assert.AreEqual(totalFlow, list15[i].Total);
                        Assert.AreEqual(totalOccupancy, list15[i].Occupancy);
                        Assert.AreEqual(totalTimeOccupancy, list15[i].TimeOccupancy);
                        Assert.AreEqual(totalHeadDistance, list15[i].HeadDistance);

                        Assert.IsTrue(Math.Abs(totalDistance / totalTravelTime * 3600 / 1000 - list15[i].AverageSpeed) < 0.1);
                        Assert.IsTrue(Math.Abs(totalHeadDistance / totalCount * (totalDistance / totalTravelTime) - list15[i].HeadSpace) < 0.1);
                    }


                    var list60 = service.QueryList(laneIds, DateTimeLevel.Hour, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                    for (int i = 0; i < list60.Count; ++i)
                    {
                        int    totalFlow          = 0;
                        int    totalDistance      = 0;
                        double totalTravelTime    = 0.0;
                        int    totalOccupancy     = 0;
                        int    totalTimeOccupancy = 0;
                        double totalHeadDistance  = 0.0;
                        int    totalCount         = 0;
                        foreach (string laneId in laneIds)
                        {
                            var list = _datas[laneId].Where(f =>
                                                            f.DateTime >= _startDate.AddMinutes(60 * i) &&
                                                            f.DateTime < _startDate.AddMinutes(60 * (i + 1))).ToList();
                            totalFlow          += list.Sum(f => f.Total);
                            totalDistance      += list.Sum(f => f.Distance);
                            totalTravelTime    += list.Sum(f => f.TravelTime);
                            totalOccupancy     += list.Sum(f => f.Occupancy);
                            totalTimeOccupancy += list.Sum(f => f.TimeOccupancy);
                            totalHeadDistance  += list.Sum(f => f.HeadDistance);
                            totalCount         += list.Count;
                        }
                        Assert.AreEqual(totalFlow, list60[i].Total);
                        Assert.AreEqual(totalOccupancy, list60[i].Occupancy);
                        Assert.AreEqual(totalTimeOccupancy, list60[i].TimeOccupancy);
                        Assert.AreEqual(totalHeadDistance, list60[i].HeadDistance);

                        Assert.IsTrue(Math.Abs(totalDistance / totalTravelTime * 3600 / 1000 - list60[i].AverageSpeed) < 0.1);
                        Assert.IsTrue(Math.Abs(totalHeadDistance / totalCount * (totalDistance / totalTravelTime) - list60[i].HeadSpace) < 0.1);
                    }


                    var listDay = service.QueryList(laneIds, DateTimeLevel.Day, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                    for (int i = 0; i < listDay.Count; ++i)
                    {
                        int    totalFlow          = 0;
                        int    totalDistance      = 0;
                        double totalTravelTime    = 0.0;
                        int    totalOccupancy     = 0;
                        int    totalTimeOccupancy = 0;
                        double totalHeadDistance  = 0.0;
                        int    totalCount         = 0;
                        foreach (string laneId in laneIds)
                        {
                            var list = _datas[laneId].Where(f =>
                                                            f.DateTime >= _startDate.AddDays(i) &&
                                                            f.DateTime < _startDate.AddDays(i + 1)).ToList();
                            totalFlow          += list.Sum(f => f.Total);
                            totalDistance      += list.Sum(f => f.Distance);
                            totalTravelTime    += list.Sum(f => f.TravelTime);
                            totalOccupancy     += list.Sum(f => f.Occupancy);
                            totalTimeOccupancy += list.Sum(f => f.TimeOccupancy);
                            totalHeadDistance  += list.Sum(f => f.HeadDistance);
                            totalCount         += list.Count;
                        }
                        Assert.AreEqual(totalFlow, listDay[i].Total);
                        Assert.AreEqual(totalOccupancy, listDay[i].Occupancy);
                        Assert.AreEqual(totalTimeOccupancy, listDay[i].TimeOccupancy);
                        Assert.AreEqual(totalHeadDistance, listDay[i].HeadDistance);

                        Assert.IsTrue(Math.Abs(totalDistance / totalTravelTime * 3600 / 1000 - listDay[i].AverageSpeed) < 0.1);
                        Assert.IsTrue(Math.Abs(totalHeadDistance / totalCount * (totalDistance / totalTravelTime) - listDay[i].HeadSpace) < 0.1);
                    }


                    var listMonth = service.QueryList(laneIds, DateTimeLevel.Month, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                    for (int i = 0; i < listMonth.Count; ++i)
                    {
                        int    totalFlow          = 0;
                        int    totalDistance      = 0;
                        double totalTravelTime    = 0.0;
                        int    totalOccupancy     = 0;
                        int    totalTimeOccupancy = 0;
                        double totalHeadDistance  = 0.0;
                        int    totalCount         = 0;
                        foreach (string laneId in laneIds)
                        {
                            var list = _datas[laneId].Where(f =>
                                                            f.DateTime >= _startDate.AddMonths(i) &&
                                                            f.DateTime < _startDate.AddMonths(i + 1)).ToList();
                            totalFlow          += list.Sum(f => f.Total);
                            totalDistance      += list.Sum(f => f.Distance);
                            totalTravelTime    += list.Sum(f => f.TravelTime);
                            totalOccupancy     += list.Sum(f => f.Occupancy);
                            totalTimeOccupancy += list.Sum(f => f.TimeOccupancy);
                            totalHeadDistance  += list.Sum(f => f.HeadDistance);
                            totalCount         += list.Count;
                        }
                        Assert.AreEqual(totalFlow, listMonth[i].Total);
                        Assert.AreEqual(totalOccupancy, listMonth[i].Occupancy);
                        Assert.AreEqual(totalTimeOccupancy, listMonth[i].TimeOccupancy);
                        Assert.AreEqual(totalHeadDistance, listMonth[i].HeadDistance);

                        Assert.IsTrue(Math.Abs(totalDistance / totalTravelTime * 3600 / 1000 - listMonth[i].AverageSpeed) < 0.1);
                        Assert.IsTrue(Math.Abs(totalHeadDistance / totalCount * (totalDistance / totalTravelTime) - listMonth[i].HeadSpace) < 0.1);
                    }
                }
            }
        }
Пример #2
0
        public void QueryList_ByLane()
        {
            LaneFlowManager_Alone service = TestInit.ServiceProvider.CreateScope().ServiceProvider.GetRequiredService <LaneFlowManager_Alone>();

            foreach (FlowDevice device in _devices)
            {
                foreach (var relation in device.FlowDevice_FlowChannels)
                {
                    foreach (Lane lane in relation.Channel.Lanes)
                    {
                        var list1 = service.QueryList(lane.DataId, DateTimeLevel.Minute, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                        Assert.AreEqual(24 * 60 * _days, list1.Count);
                        for (int i = 0; i < list1.Count; ++i)
                        {
                            Assert.AreEqual(_datas[lane.DataId][i].Total, list1[i].Total);
                            Assert.IsTrue(Math.Abs(_datas[lane.DataId][i].AverageSpeed - list1[i].AverageSpeed) < 0.1);
                            Assert.IsTrue(Math.Abs(_datas[lane.DataId][i].HeadDistance - list1[i].HeadDistance) < 0.1);
                            Assert.IsTrue(Math.Abs(_datas[lane.DataId][i].HeadSpace - list1[i].HeadSpace) < 0.1);
                            Assert.AreEqual(_datas[lane.DataId][i].Occupancy, list1[i].Occupancy);
                            Assert.AreEqual(_datas[lane.DataId][i].TimeOccupancy, list1[i].TimeOccupancy);
                        }

                        var list5  = service.QueryList(lane.DataId, DateTimeLevel.FiveMinutes, _startDate, _startDate.AddDays(_days).AddMinutes(-1));
                        var datas5 = _datas[lane.DataId]
                                     .GroupBy(f => TimePointConvert.CurrentTimePoint(DateTimeLevel.FiveMinutes, f.DateTime))
                                     .Select(g => new LaneFlow
                        {
                            Cars          = g.Sum(f => f.Cars),
                            Vans          = g.Sum(f => f.Vans),
                            Tricycles     = g.Sum(f => f.Tricycles),
                            Trucks        = g.Sum(f => f.Trucks),
                            Buss          = g.Sum(f => f.Buss),
                            Motorcycles   = g.Sum(f => f.Motorcycles),
                            Bikes         = g.Sum(f => f.Bikes),
                            Persons       = g.Sum(f => f.Persons),
                            Occupancy     = g.Sum(f => f.Occupancy),
                            TimeOccupancy = g.Sum(f => f.TimeOccupancy),
                            HeadDistance  = g.Sum(f => f.HeadDistance),
                            TravelTime    = g.Sum(f => f.TravelTime),
                            Distance      = g.Sum(f => f.Distance),
                            Count         = g.Count()
                        }).ToList();
                        for (int i = 0; i < list5.Count; ++i)
                        {
                            Assert.AreEqual(datas5[i].Total, list5[i].Total);
                            Assert.IsTrue(Math.Abs(datas5[i].AverageSpeed - list5[i].AverageSpeed) < 0.1);
                            Assert.IsTrue(Math.Abs(datas5[i].HeadDistance - list5[i].HeadDistance) < 0.1);
                            Assert.IsTrue(Math.Abs(datas5[i].HeadSpace - list5[i].HeadSpace) < 0.1);
                            Assert.AreEqual(datas5[i].Occupancy, list5[i].Occupancy);
                            Assert.AreEqual(datas5[i].TimeOccupancy, list5[i].TimeOccupancy);
                        }

                        var list15 = service.QueryList(lane.DataId, DateTimeLevel.FifteenMinutes, _startDate, _startDate.AddDays(_days).AddMinutes(-1));

                        var datas15 = _datas[lane.DataId]
                                      .GroupBy(f => TimePointConvert.CurrentTimePoint(DateTimeLevel.FifteenMinutes, f.DateTime))
                                      .Select(g => new LaneFlow
                        {
                            Cars          = g.Sum(f => f.Cars),
                            Vans          = g.Sum(f => f.Vans),
                            Tricycles     = g.Sum(f => f.Tricycles),
                            Trucks        = g.Sum(f => f.Trucks),
                            Buss          = g.Sum(f => f.Buss),
                            Motorcycles   = g.Sum(f => f.Motorcycles),
                            Bikes         = g.Sum(f => f.Bikes),
                            Persons       = g.Sum(f => f.Persons),
                            Occupancy     = g.Sum(f => f.Occupancy),
                            TimeOccupancy = g.Sum(f => f.TimeOccupancy),
                            HeadDistance  = g.Sum(f => f.HeadDistance),
                            TravelTime    = g.Sum(f => f.TravelTime),
                            Distance      = g.Sum(f => f.Distance),
                            Count         = g.Count()
                        }).ToList();
                        for (int i = 0; i < list15.Count; ++i)
                        {
                            Assert.AreEqual(datas15[i].Total, list15[i].Total);
                            Assert.IsTrue(Math.Abs(datas15[i].AverageSpeed - list15[i].AverageSpeed) < 0.1);
                            Assert.IsTrue(Math.Abs(datas15[i].HeadDistance - list15[i].HeadDistance) < 0.1);
                            Assert.IsTrue(Math.Abs(datas15[i].HeadSpace - list15[i].HeadSpace) < 0.1);
                            Assert.AreEqual(datas15[i].Occupancy, list15[i].Occupancy);
                            Assert.AreEqual(datas15[i].TimeOccupancy, list15[i].TimeOccupancy);
                        }

                        var list60 = service.QueryList(lane.DataId, DateTimeLevel.Hour, _startDate, _startDate.AddDays(_days).AddMinutes(-1));

                        var datas60 = _datas[lane.DataId]
                                      .GroupBy(f => TimePointConvert.CurrentTimePoint(DateTimeLevel.Hour, f.DateTime))
                                      .Select(g => new LaneFlow
                        {
                            Cars          = g.Sum(f => f.Cars),
                            Vans          = g.Sum(f => f.Vans),
                            Tricycles     = g.Sum(f => f.Tricycles),
                            Trucks        = g.Sum(f => f.Trucks),
                            Buss          = g.Sum(f => f.Buss),
                            Motorcycles   = g.Sum(f => f.Motorcycles),
                            Bikes         = g.Sum(f => f.Bikes),
                            Persons       = g.Sum(f => f.Persons),
                            Occupancy     = g.Sum(f => f.Occupancy),
                            TimeOccupancy = g.Sum(f => f.TimeOccupancy),
                            HeadDistance  = g.Sum(f => f.HeadDistance),
                            TravelTime    = g.Sum(f => f.TravelTime),
                            Distance      = g.Sum(f => f.Distance),
                            Count         = g.Count()
                        }).ToList();
                        for (int i = 0; i < list60.Count; ++i)
                        {
                            Assert.AreEqual(datas60[i].Total, list60[i].Total);
                            Assert.IsTrue(Math.Abs(datas60[i].AverageSpeed - list60[i].AverageSpeed) < 0.1);
                            Assert.IsTrue(Math.Abs(datas60[i].HeadDistance - list60[i].HeadDistance) < 0.1);
                            Assert.IsTrue(Math.Abs(datas60[i].HeadSpace - list60[i].HeadSpace) < 0.1);
                            Assert.AreEqual(datas60[i].Occupancy, list60[i].Occupancy);
                            Assert.AreEqual(datas60[i].TimeOccupancy, list60[i].TimeOccupancy);
                        }

                        var listDay = service.QueryList(lane.DataId, DateTimeLevel.Day, _startDate, _startDate.AddDays(_days).AddMinutes(-1));

                        var datasDay = _datas[lane.DataId]
                                       .GroupBy(f => TimePointConvert.CurrentTimePoint(DateTimeLevel.Day, f.DateTime))
                                       .Select(g => new LaneFlow
                        {
                            Cars          = g.Sum(f => f.Cars),
                            Vans          = g.Sum(f => f.Vans),
                            Tricycles     = g.Sum(f => f.Tricycles),
                            Trucks        = g.Sum(f => f.Trucks),
                            Buss          = g.Sum(f => f.Buss),
                            Motorcycles   = g.Sum(f => f.Motorcycles),
                            Bikes         = g.Sum(f => f.Bikes),
                            Persons       = g.Sum(f => f.Persons),
                            Occupancy     = g.Sum(f => f.Occupancy),
                            TimeOccupancy = g.Sum(f => f.TimeOccupancy),
                            HeadDistance  = g.Sum(f => f.HeadDistance),
                            TravelTime    = g.Sum(f => f.TravelTime),
                            Distance      = g.Sum(f => f.Distance),
                            Count         = g.Count()
                        }).ToList();
                        for (int i = 0; i < listDay.Count; ++i)
                        {
                            Assert.AreEqual(datasDay[i].Total, listDay[i].Total);
                            Assert.IsTrue(Math.Abs(datasDay[i].AverageSpeed - listDay[i].AverageSpeed) < 0.1);
                            Assert.IsTrue(Math.Abs(datasDay[i].HeadDistance - listDay[i].HeadDistance) < 0.1);
                            Assert.IsTrue(Math.Abs(datasDay[i].HeadSpace - listDay[i].HeadSpace) < 0.1);
                            Assert.AreEqual(datasDay[i].Occupancy, listDay[i].Occupancy);
                            Assert.AreEqual(datasDay[i].TimeOccupancy, listDay[i].TimeOccupancy);
                        }

                        var listMonth = service.QueryList(lane.DataId, DateTimeLevel.Month, _startDate, _startDate.AddDays(_days).AddMinutes(-1));

                        var datasMonth = _datas[lane.DataId]
                                         .GroupBy(f => TimePointConvert.CurrentTimePoint(DateTimeLevel.Month, f.DateTime))
                                         .Select(g => new LaneFlow
                        {
                            Cars          = g.Sum(f => f.Cars),
                            Vans          = g.Sum(f => f.Vans),
                            Tricycles     = g.Sum(f => f.Tricycles),
                            Trucks        = g.Sum(f => f.Trucks),
                            Buss          = g.Sum(f => f.Buss),
                            Motorcycles   = g.Sum(f => f.Motorcycles),
                            Bikes         = g.Sum(f => f.Bikes),
                            Persons       = g.Sum(f => f.Persons),
                            Occupancy     = g.Sum(f => f.Occupancy),
                            TimeOccupancy = g.Sum(f => f.TimeOccupancy),
                            HeadDistance  = g.Sum(f => f.HeadDistance),
                            TravelTime    = g.Sum(f => f.TravelTime),
                            Distance      = g.Sum(f => f.Distance),
                            Count         = g.Count()
                        }).ToList();
                        for (int i = 0; i < listMonth.Count; ++i)
                        {
                            Assert.AreEqual(datasMonth[i].Total, listMonth[i].Total);
                            Assert.IsTrue(Math.Abs(datasMonth[i].AverageSpeed - datasMonth[i].AverageSpeed) < 0.1);
                            Assert.IsTrue(Math.Abs(datasMonth[i].HeadDistance - listMonth[i].HeadDistance) < 0.1);
                            Assert.IsTrue(Math.Abs(datasMonth[i].HeadSpace - listMonth[i].HeadSpace) < 0.1);
                            Assert.AreEqual(datasMonth[i].Occupancy, listMonth[i].Occupancy);
                            Assert.AreEqual(datasMonth[i].TimeOccupancy, listMonth[i].TimeOccupancy);
                        }
                    }
                }
            }
        }
Пример #3
0
        public void QueryChannelDayStatus()
        {
            DateTime          today   = DateTime.Today;
            List <FlowDevice> devices = FlowDbSimulator.CreateFlowDevice(TestInit.ServiceProvider, 1, 1, 2, true);
            List <DateTime>   dates   = new List <DateTime>
            {
                today.AddYears(-1),
                today.AddMonths(-1),
                today.AddDays(-1),
                today
            };

            TestInit.RefreshFlowCache(devices);

            FlowDbSimulator.CreateData(TestInit.ServiceProvider, devices, DataCreateMode.Fixed, dates, true);

            ChannelFlowsManager service = TestInit.ServiceProvider.GetRequiredService <ChannelFlowsManager>();

            LaneFlowManager_Alone manager = TestInit.ServiceProvider.GetRequiredService <LaneFlowManager_Alone>();

            foreach (FlowDevice device in devices)
            {
                foreach (var relation in device.FlowDevice_FlowChannels)
                {
                    int laneCount = relation.Channel.Lanes.Count;

                    var status = service.QueryChannelDayStatus(relation.ChannelId);

                    //今日列表
                    Assert.AreEqual(laneCount + 1, status.TodayDayLanes.Count);
                    int sum = 0;
                    for (int i = 0; i < relation.Channel.Lanes.Count; ++i)
                    {
                        var v     = manager.QueryList(relation.Channel.Lanes[i].DataId, DateTimeLevel.Minute, DateTime.Today, DateTime.Now);
                        int total = v.Sum(f => f.Total);
                        sum += total;
                        Assert.AreEqual(total, status.TodayDayLanes[i + 1].Total);
                        Assert.AreEqual(30, status.TodayDayLanes[i + 1].Occupancy);
                        Assert.AreEqual(40, status.TodayDayLanes[i + 1].TimeOccupancy);
                    }

                    Assert.AreEqual(sum, status.TodayDayLanes[0].Total);
                    Assert.AreEqual(30, status.TodayDayLanes[0].Occupancy);
                    Assert.AreEqual(40, status.TodayDayLanes[0].TimeOccupancy);

                    //昨天列表
                    Assert.AreEqual(laneCount + 1, status.YesterdayDayLanes.Count);
                    Assert.AreEqual(11520 * laneCount, status.YesterdayDayLanes[0].Total);
                    for (int i = 1; i < status.YesterdayDayLanes.Count; ++i)
                    {
                        Assert.AreEqual(11520, status.YesterdayDayLanes[i].Total);
                        Assert.AreEqual(30, status.YesterdayDayLanes[i].Occupancy);
                        Assert.AreEqual(40, status.YesterdayDayLanes[i].TimeOccupancy);
                    }

                    //上月列表
                    Assert.AreEqual(laneCount + 1, status.LastMonthDayLanes.Count);
                    Assert.AreEqual(11520 * laneCount, status.LastMonthDayLanes[0].Total);
                    for (int i = 1; i < status.LastMonthDayLanes.Count; ++i)
                    {
                        Assert.AreEqual(11520, status.LastMonthDayLanes[i].Total);
                        Assert.AreEqual(30, status.LastMonthDayLanes[i].Occupancy);
                        Assert.AreEqual(40, status.LastMonthDayLanes[i].TimeOccupancy);
                    }

                    //去年列表
                    Assert.AreEqual(laneCount + 1, status.LastYearDayLanes.Count);
                    Assert.AreEqual(11520 * laneCount, status.LastYearDayLanes[0].Total);
                    for (int i = 1; i < status.LastYearDayLanes.Count; ++i)
                    {
                        Assert.AreEqual(11520, status.LastYearDayLanes[i].Total);
                        Assert.AreEqual(30, status.LastYearDayLanes[i].Occupancy);
                        Assert.AreEqual(40, status.LastYearDayLanes[i].TimeOccupancy);
                    }

                    //今日图表
                    Assert.AreEqual(laneCount + 1, status.TodayDayCharts.Count);
                    Dictionary <int, int> sumValue = new Dictionary <int, int>();
                    for (int i = 0; i < relation.Channel.Lanes.Count; ++i)
                    {
                        for (int h = 0; h < DateTime.Now.Hour + 1; ++h)
                        {
                            var v     = manager.QueryList(relation.Channel.Lanes[i].DataId, DateTimeLevel.Hour, DateTime.Today.AddHours(h), DateTime.Today.AddHours(h));
                            int value = v.Sum(f => f.Total);
                            //今日每小时图表
                            Assert.AreEqual(value, status.TodayDayCharts[i + 1][h].Value);
                            if (sumValue.ContainsKey(h))
                            {
                                sumValue[h] += value;
                            }
                            else
                            {
                                sumValue.Add(h, value);
                            }
                        }
                    }
                    //今日每小时图表总和
                    for (int h = 0; h < DateTime.Now.Hour + 1; ++h)
                    {
                        Assert.AreEqual(sumValue[h], status.TodayDayCharts[0][h].Value);
                    }

                    //昨天图表
                    Assert.AreEqual(laneCount + 1, status.YesterdayDayCharts.Count);
                    //昨天总和图表横轴数量
                    Assert.AreEqual(24, status.YesterdayDayCharts[0].Count);
                    for (int h = 0; h < 24; ++h)
                    {
                        //昨天总和每个横轴的value和remart
                        Assert.AreEqual(480 * laneCount, status.YesterdayDayCharts[0][h].Value);
                        Assert.AreEqual(today.AddDays(-1).AddHours(h).ToString("yyyy-MM-dd HH"), status.YesterdayDayCharts[0][h].Remark);
                    }

                    for (int i = 1; i < status.YesterdayDayCharts.Count; ++i)
                    {
                        //各个车道图表横轴数量
                        Assert.AreEqual(24, status.YesterdayDayCharts[i].Count);
                        for (int h = 0; h < 24; ++h)
                        {
                            //每个横轴的value和remart
                            Assert.AreEqual(480, status.YesterdayDayCharts[i][h].Value);
                            Assert.AreEqual(today.AddDays(-1).AddHours(h).ToString("yyyy-MM-dd HH"), status.YesterdayDayCharts[i][h].Remark);
                        }
                    }

                    //上月图表
                    Assert.AreEqual(laneCount + 1, status.LastMonthDayCharts.Count);
                    Assert.AreEqual(24, status.LastMonthDayCharts[0].Count);
                    for (int h = 0; h < 24; ++h)
                    {
                        Assert.AreEqual(480 * laneCount, status.LastMonthDayCharts[0][h].Value);
                        Assert.AreEqual(today.AddMonths(-1).AddHours(h).ToString("yyyy-MM-dd HH"), status.LastMonthDayCharts[0][h].Remark);
                    }
                    for (int i = 1; i < status.LastMonthDayCharts.Count; ++i)
                    {
                        Assert.AreEqual(24, status.LastMonthDayCharts[i].Count);
                        for (int h = 0; h < 24; ++h)
                        {
                            Assert.AreEqual(480, status.LastMonthDayCharts[i][h].Value);
                            Assert.AreEqual(today.AddMonths(-1).AddHours(h).ToString("yyyy-MM-dd HH"), status.LastMonthDayCharts[i][h].Remark);
                        }
                    }

                    //去年图表
                    Assert.AreEqual(laneCount + 1, status.LastYearDayCharts.Count);
                    Assert.AreEqual(24, status.LastYearDayCharts[0].Count);
                    for (int h = 0; h < 24; ++h)
                    {
                        Assert.AreEqual(480 * laneCount, status.LastYearDayCharts[0][h].Value);
                        Assert.AreEqual(today.AddYears(-1).AddHours(h).ToString("yyyy-MM-dd HH"), status.LastYearDayCharts[0][h].Remark);
                    }
                    for (int i = 1; i < status.LastYearDayCharts.Count; ++i)
                    {
                        Assert.AreEqual(24, status.LastYearDayCharts[i].Count);
                        for (int h = 0; h < 24; ++h)
                        {
                            Assert.AreEqual(480, status.LastYearDayCharts[i][h].Value);
                            Assert.AreEqual(today.AddYears(-1).AddHours(h).ToString("yyyy-MM-dd HH"), status.LastYearDayCharts[i][h].Remark);
                        }
                    }
                }
            }
        }