public RouteService(ActionController controller, int seconds, string routesPath) { IsRoutePlaying = false; routesLoader = new RouteLoader(routesPath); secondsToNextRoute = seconds; this.controller = controller; }
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."); } }
public void TestParseEmptyStringFailed() { const string testData = ""; try { _ = RouteLoader.Parse(testData); } catch (FormatException) { return; } throw new Exception($"An exception was expected `FormatException`."); }
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."); } }