Tests: Add WeighingTests

This commit is contained in:
2024-02-18 17:31:10 +01:00
parent f13fb3aaf0
commit f4eb6456be
6 changed files with 186 additions and 11 deletions

View File

@ -4,36 +4,38 @@ namespace Elwig.Helpers.Weighing {
/// <summary>
/// Result of a weighing process on an industrial scale
/// </summary>
public class WeighingResult {
public struct WeighingResult {
/// <summary>
/// Measured net weight in kg
/// </summary>
public int? Weight = null;
public int? Weight;
/// <summary>
/// Weighing id (or IdentNr) provided by the scale
/// </summary>
public string? WeighingId = null;
public string? WeighingId;
/// <summary>
/// Wheighing id (or IdentNr) provided by the scale optionally combined with the current date
/// </summary>
public string? FullWeighingId = null;
public string? FullWeighingId;
/// <summary>
/// Date string provided by the scale
/// </summary>
public DateOnly? Date = null;
public DateOnly? Date;
/// <summary>
/// Time string provided by the scale
/// </summary>
public TimeOnly? Time = null;
public TimeOnly? Time;
/// <returns>&lt;Weight/WeighingId/Date/Time&gt;</returns>
override public string ToString() {
public override readonly string ToString() {
var w = Weight != null ? $"{Weight}kg" : "";
return $"<{w}/{WeighingId}/{Date:yyyy-MM-dd}/{Time:HH:mm}>";
}
}
}