Esempio n. 1
0
        public void QueryChannelMinuteStatus()
        {
            List <FlowDevice> devices = FlowDbSimulator.CreateFlowDevice(TestInit.ServiceProvider, 1, 1, 2, true);

            TestInit.RefreshFlowCache(devices);

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


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

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

                    var hourStatus = service.QueryChannelHourStatus(relation.ChannelId);

                    //本小时列表

                    Assert.AreEqual(30, hourStatus.TodayHourLanes[0].Occupancy);

                    Assert.AreEqual(40, hourStatus.TodayHourLanes[0].TimeOccupancy);

                    for (int i = 1; i < hourStatus.TodayHourLanes.Count; ++i)
                    {
                        Assert.AreEqual(30, hourStatus.TodayHourLanes[i].Occupancy);

                        Assert.AreEqual(40, hourStatus.TodayHourLanes[i].TimeOccupancy);
                    }

                    //本小时图表
                    for (int i = 0; i < 55; ++i)
                    {
                        Assert.AreEqual(8 * laneCount, hourStatus.TodayHourCharts[0][i].Value);

                        for (int j = 1; j < hourStatus.TodayHourCharts.Count; ++j)
                        {
                            Assert.AreEqual(8, hourStatus.TodayHourCharts[j][i].Value);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public ChannelHourFlow QueryChannelHourStatus([FromRoute] string channelId)
 {
     return(_manager.QueryChannelHourStatus(channelId));
 }