[#71] Weighing: Fix reconnection behaviour when COM port is connected/disconnected
This commit is contained in:
@@ -91,7 +91,7 @@ namespace Tests.UnitTests.WeighingTests {
|
||||
public void Test_03_Moving() {
|
||||
MockA.Weight = 1_000;
|
||||
MockA.Error = "moving";
|
||||
IOException ex = Assert.ThrowsAsync<IOException>(async () => await ScaleA!.Weigh());
|
||||
var ex = Assert.ThrowsAsync<WeighingException>(async () => await ScaleA!.Weigh());
|
||||
Assert.That(ex.Message, Contains.Substring("Waage in Bewegung"));
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Tests.UnitTests.WeighingTests {
|
||||
public void Test_04_Overloaded() {
|
||||
MockA.Weight = 10_000;
|
||||
MockA.Error = "overloaded";
|
||||
IOException ex = Assert.ThrowsAsync<IOException>(async () => await ScaleA!.Weigh());
|
||||
var ex = Assert.ThrowsAsync<WeighingException>(async () => await ScaleA!.Weigh());
|
||||
Assert.That(ex.Message, Contains.Substring("Waage in Überlast"));
|
||||
}
|
||||
|
||||
@@ -107,14 +107,14 @@ namespace Tests.UnitTests.WeighingTests {
|
||||
public void Test_05_InvalidResponse() {
|
||||
MockA.Weight = 1_000;
|
||||
MockA.Error = "invalid";
|
||||
Assert.ThrowsAsync<IOException>(async () => await ScaleA!.Weigh());
|
||||
Assert.ThrowsAsync<FormatException>(async () => await ScaleA!.Weigh());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_06_InvalidCrc() {
|
||||
MockA.Weight = 1_000;
|
||||
MockA.Error = "crc";
|
||||
IOException ex = Assert.ThrowsAsync<IOException>(async () => await ScaleA!.Weigh());
|
||||
var ex = Assert.ThrowsAsync<WeighingException>(async () => await ScaleA!.Weigh());
|
||||
Assert.That(ex.Message, Contains.Substring("Invalid CRC16 checksum"));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Tests.UnitTests.WeighingTests {
|
||||
public void Test_07_InvalidUnit() {
|
||||
MockA.Weight = 1_000;
|
||||
MockA.Error = "unit";
|
||||
IOException ex = Assert.ThrowsAsync<IOException>(async () => await ScaleA!.Weigh());
|
||||
var ex = Assert.ThrowsAsync<WeighingException>(async () => await ScaleA!.Weigh());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user