Exemple #1
0
        public void TestParseSuccess()
        {
            const string testData = "928;Y009OT;02/06/2020T04:55:00Z+03:00;02/06/2020T06:00:00Z+03:00";
            var          schedule = ScheduleLoader.Parse(testData);

            if (schedule.Route != "928" || schedule.Transport != "Y009OT" ||
                schedule.Begin != new DateTime(2020, 06, 02, 01, 55, 00, DateTimeKind.Utc).ToLocalTime() ||
                schedule.End != new DateTime(2020, 06, 02, 3, 00, 00, DateTimeKind.Utc).ToLocalTime())
            {
                throw new Exception($"Parse schedule.");
            }
        }
        public void TestParseFailed()
        {
            const string testData = "53173067906170E111OK;bus";

            try
            {
                _ = ScheduleLoader.Parse(testData);
            }
            catch (FormatException)
            {
                return;
            }
            throw new Exception($"An exception was expected `FormatException`.");
        }
Exemple #3
0
        public void TestParseEmptyStringFailed()
        {
            const string testData = "";

            try
            {
                _ = ScheduleLoader.Parse(testData);
            }
            catch (FormatException)
            {
                return;
            }
            throw new Exception($"An exception was expected `FormatException`.");
        }
Exemple #4
0
        public void TestParseFailed()
        {
            const string testData = "928;Y009OT;02/06/2020T04:65:00Z+03:00;02/06/2020T06:00:00Z+03:00";

            try
            {
                _ = ScheduleLoader.Parse(testData);
            }
            catch (FormatException)
            {
                return;
            }
            throw new Exception($"An exception was expected `FormatException`.");
        }