Weighing: Differentiate between scale and terminal

This commit is contained in:
2026-08-03 10:56:36 +02:00
parent 0d8cdd5d6e
commit 309f118739
20 changed files with 130 additions and 158 deletions
@@ -5,7 +5,7 @@ namespace Tests.UnitTests.WeighingTests {
public class ScaleTestSitzendorfDMA03Baby {
private MockScale Mock;
private GassnerScale Scale;
private GassnerEnqScale Scale;
[OneTimeSetUp]
public void SetupScale() {
@@ -32,29 +32,23 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234;
Mock.Tare = 0;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1234,
TareWeight = 0,
NetWeight = 1234,
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
GrossWeight = 1234, TareWeight = 0, NetWeight = 1234,
ScaleId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
}));
Mock.Weight = 1235;
Mock.Tare = 46;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1281,
TareWeight = 46,
NetWeight = 1235,
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
GrossWeight = 1281, TareWeight = 46, NetWeight = 1235,
ScaleId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
}));
Mock.Weight = 1236;
Mock.Tare = 92;
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
GrossWeight = 1328,
TareWeight = 92,
NetWeight = 1236,
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
GrossWeight = 1328, TareWeight = 92, NetWeight = 1236,
ScaleId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
}));
}
@@ -63,35 +57,23 @@ namespace Tests.UnitTests.WeighingTests {
Mock.Weight = 1234;
Mock.Tare = 92;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 1326,
TareWeight = 92,
NetWeight = 1234,
WeighingId = "1",
FullWeighingId = "1",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
GrossWeight = 1326, TareWeight = 92, NetWeight = 1234,
ScaleId = "1", WeighingId = "1", FullWeighingId = "1",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
}));
Mock.Weight = 3333;
Mock.Tare = 41;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 3374,
TareWeight = 41,
NetWeight = 3333,
WeighingId = "2",
FullWeighingId = "2",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
GrossWeight = 3374, TareWeight = 41, NetWeight = 3333,
ScaleId = "1", WeighingId = "2", FullWeighingId = "2",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
}));
Mock.Weight = 4321;
Mock.Tare = 0;
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
GrossWeight = 4321,
TareWeight = 0,
NetWeight = 4321,
WeighingId = "3",
FullWeighingId = "3",
Date = new DateOnly(2020, 10, 15),
Time = new TimeOnly(12, 34),
GrossWeight = 4321, TareWeight = 0, NetWeight = 4321,
ScaleId = "1", WeighingId = "3", FullWeighingId = "3",
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
}));
}