Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }