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