ScaleTestMatzen: Use hard coded date instead of current time
This commit is contained in:
@ -42,7 +42,7 @@ namespace Tests.WeighingTests {
|
|||||||
if (moving && incr)
|
if (moving && incr)
|
||||||
return ("<13>\r\n", false);
|
return ("<13>\r\n", false);
|
||||||
|
|
||||||
string data = $"00{(moving ? 1 : 0)}0{DateTime.Now:dd.MM.yyHH:mm}{(incr ? identNr : 0),4}1" +
|
string data = $"00{(moving ? 1 : 0)}0{new DateTime(2020, 10, 15, 12, 34, 0):dd.MM.yyHH:mm}{(incr ? identNr : 0),4}1" +
|
||||||
$"{weight,8}{0,8}{weight,8}{(unit ? "lb" : "kg")} {1,3}";
|
$"{weight,8}{0,8}{weight,8}{(unit ? "lb" : "kg")} {1,3}";
|
||||||
ushort checksum = Elwig.Helpers.Utils.CalcCrc16Modbus(data);
|
ushort checksum = Elwig.Helpers.Utils.CalcCrc16Modbus(data);
|
||||||
if (crc) checksum += 10;
|
if (crc) checksum += 10;
|
||||||
@ -72,15 +72,15 @@ namespace Tests.WeighingTests {
|
|||||||
public async Task Test_01_CurrentWeight() {
|
public async Task Test_01_CurrentWeight() {
|
||||||
Mock!.Weight = 1234;
|
Mock!.Weight = 1234;
|
||||||
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
|
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
|
||||||
Weight = 1234, Date = Utils.Today, Time = Utils.Time,
|
Weight = 1234, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
|
||||||
}));
|
}));
|
||||||
Mock!.Weight = 1235;
|
Mock!.Weight = 1235;
|
||||||
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
|
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
|
||||||
Weight = 1235, Date = Utils.Today, Time = Utils.Time,
|
Weight = 1235, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
|
||||||
}));
|
}));
|
||||||
Mock!.Weight = 1236;
|
Mock!.Weight = 1236;
|
||||||
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
|
Assert.That(await Scale!.GetCurrentWeight(), Is.EqualTo(new WeighingResult {
|
||||||
Weight = 1236, Date = Utils.Today, Time = Utils.Time,
|
Weight = 1236, Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,20 +89,20 @@ namespace Tests.WeighingTests {
|
|||||||
Mock!.Weight = 1234;
|
Mock!.Weight = 1234;
|
||||||
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
|
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
|
||||||
Weight = 1234, WeighingId = "1",
|
Weight = 1234, WeighingId = "1",
|
||||||
FullWeighingId = $"{DateTime.Today:yyyy-MM-dd}/1",
|
FullWeighingId = $"2020-10-15/1",
|
||||||
Date = Utils.Today, Time = Utils.Time,
|
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
|
||||||
}));
|
}));
|
||||||
Mock!.Weight = 3333;
|
Mock!.Weight = 3333;
|
||||||
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
|
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
|
||||||
Weight = 3333, WeighingId = "2",
|
Weight = 3333, WeighingId = "2",
|
||||||
FullWeighingId = $"{DateTime.Today:yyyy-MM-dd}/2",
|
FullWeighingId = $"2020-10-15/2",
|
||||||
Date = Utils.Today, Time = Utils.Time,
|
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
|
||||||
}));
|
}));
|
||||||
Mock!.Weight = 4321;
|
Mock!.Weight = 4321;
|
||||||
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
|
Assert.That(await Scale!.Weigh(), Is.EqualTo(new WeighingResult {
|
||||||
Weight = 4321, WeighingId = "3",
|
Weight = 4321, WeighingId = "3",
|
||||||
FullWeighingId = $"{DateTime.Today:yyyy-MM-dd}/3",
|
FullWeighingId = $"2020-10-15/3",
|
||||||
Date = Utils.Today, Time = Utils.Time,
|
Date = new DateOnly(2020, 10, 15), Time = new TimeOnly(12, 34),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user