public void TestParseSuccess() { const string testData = "353173067906170;E111OK;bus"; var transport = TransportLoader.Parse(testData); if (transport.ExternalNumber != "E111OK" || transport.MonitoringNumber != "353173067906170" || transport.Type != "bus") { throw new Exception($"Parse transpor."); } }
public void TestParseEmptyStringFailed() { const string testData = ""; try { _ = TransportLoader.Parse(testData); } catch (FormatException) { return; } throw new Exception($"An exception was expected `FormatException`."); }
public void TestParseStreamSkipeEmptySuccess() { const string testData = @" 353173067906170;E111OK;bus 353173068562600;E222OK;bus "; byte[] byteArray = Encoding.ASCII.GetBytes(testData); using var ms = new MemoryStream(byteArray); using var sr = new StreamReader(ms); var transports = TransportLoader.Read(sr); if (transports.Count != 2) { throw new Exception($"2 routes were expected, {transports.Count} were considered."); } }