Пример #1
0
        public void CheckTimeSlots()
        {
            //Act
            var timeSolt = CSVPRocessingMethods.GetSlots();

            //Assert
            Assert.IsNotNull(timeSolt);
            Assert.AreEqual(24, timeSolt.Count);
        }
Пример #2
0
        public void CSVProcessingDataTest()
        {
            //Arrange
            List <TaxiData> taxiDataSet = new List <TaxiData>
            {
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 0:15", passenger_count = 23
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 0:50", passenger_count = 15
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 5:20", passenger_count = 12
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 0:02", passenger_count = 6
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 5:45", passenger_count = 25
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 2:05", passenger_count = 9
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 3:45", passenger_count = 11
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 3:15", passenger_count = 16
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 4:35", passenger_count = 22
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 11:05", passenger_count = 10
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 11:55", passenger_count = 20
                },
                new TaxiData {
                    lpep_pickup_datetime = "1/1/2021 2:34", passenger_count = 28
                },
            };

            //Act
            var csvProcessedDatas = CSVPRocessingMethods.CreateProcessedCSVFile(taxiDataSet, null);

            //Assert
            Assert.IsNotNull(csvProcessedDatas);
            Assert.AreEqual(6, csvProcessedDatas.Count);
        }
Пример #3
0
        public void CheckSegmentsOfTime()
        {
            //Arrange
            string time = "01:18";

            //Act
            var timeSolt = CSVPRocessingMethods.GetSlot(time);

            //Assert
            Assert.IsNotNull(timeSolt.Segment);
            Assert.AreEqual("01", timeSolt.Segment);
            Assert.AreEqual(new TimeSpan(1, 0, 0), timeSolt.StartTime);
            Assert.AreEqual(new TimeSpan(1, 59, 59), timeSolt.EndTime);
        }
Пример #4
0
        public void SegmentEncoderTest(string input)
        {
            ScalarEncoder segmentEncoder = DateTimeEncoders.FetchSegmentEncoder();
            DateTime      dateTime       = DateTime.Parse(input);
            var           time           = dateTime.ToString("HH:mm");
            Slot          slot           = CSVPRocessingMethods.GetSlot(time);

            var result = segmentEncoder.Encode(slot.Segment);

            int[,] twoDimenArray = ArrayUtils.Make2DArray <int>(result, 100, 100);
            var twoDimArray = ArrayUtils.Transpose(twoDimenArray);

            NeoCortexUtils.DrawBitmap(twoDimArray, 1024, 1024, $"{dateTime.Day}.png", null);
        }
Пример #5
0
        public void TimeSlotTest(string time)
        {
            //Arrange
            var  solts    = CSVPRocessingMethods.GetSlots();
            var  testTime = TimeSpan.Parse(time);
            Slot slots    = solts.FirstOrDefault(x => x.EndTime >= testTime && x.StartTime <= testTime);

            //Act
            var timeSolt = CSVPRocessingMethods.GetSlot(time);

            //Assert
            Assert.AreEqual(slots.Segment, timeSolt.Segment);
            Assert.AreEqual(slots.StartTime, timeSolt.StartTime);
            Assert.AreEqual(slots.EndTime, timeSolt.EndTime);
        }
Пример #6
0
 public TimeSeriesUnitTests()
 {
     _csvPRocessingMethod = new CSVPRocessingMethods();
 }