ScaleTestMatzen: Add more tests

This commit is contained in:
2024-02-18 20:47:12 +01:00
parent f4eb6456be
commit 7f4cfdc1b5
2 changed files with 67 additions and 11 deletions

View File

@ -44,6 +44,8 @@ namespace Elwig.Helpers.Weighing {
} else {
throw new ArgumentException("Unsupported scheme");
}
Stream.WriteTimeout = 250;
Stream.ReadTimeout = 11000;
if (empty != null) {
var parts = empty.Split(':');
@ -105,7 +107,7 @@ namespace Elwig.Helpers.Weighing {
line = await reader.ReadLineAsync();
if (LogPath != null) await File.AppendAllTextAsync(LogPath, $"{line}\r\n");
}
if (line == null || line.Length < 4 || !line.StartsWith("<") || !line.EndsWith(">")) {
if (line == null || line.Length < 4 || !line.StartsWith('<') || !line.EndsWith('>')) {
throw new IOException("Invalid response from scale");
}