Esempio n. 1
0
        public RouteService(ActionController controller, int seconds, string routesPath)
        {
            IsRoutePlaying     = false;
            routesLoader       = new RouteLoader(routesPath);
            secondsToNextRoute = seconds;

            this.controller = controller;
        }
Esempio n. 2
0
        public void TestParseSuccess()
        {
            const string testData = "103э;103Э";
            var          route    = RouteLoader.Parse(testData);

            if (route.ExternalNumber != "103э" || route.YandexNumber != "103Э")
            {
                throw new Exception($"Parse route.");
            }
        }
Esempio n. 3
0
        public void TestParseEmptyStringFailed()
        {
            const string testData = "";

            try
            {
                _ = RouteLoader.Parse(testData);
            }
            catch (FormatException)
            {
                return;
            }
            throw new Exception($"An exception was expected `FormatException`.");
        }
Esempio n. 4
0
        public void TestParseStreamSkipeEmptySuccess()
        {
            const string testData =
                @"102;103
   

102;104
";

            byte[] byteArray = Encoding.ASCII.GetBytes(testData);
            using var ms = new MemoryStream(byteArray);
            using var sr = new StreamReader(ms);
            var routes = RouteLoader.Read(sr);

            if (routes.Count != 2)
            {
                throw new Exception($"2 routes were expected, {routes.Count} were considered.");
            }
        }