using TuneBoss.Core.Models; namespace TuneBoss.Core.Tests; /// Shared builders for synthetic device data. internal static class TestData { public const byte Gen1 = 245, Gen2 = 1, Gen3 = 2; public static EcuInfo Ecu(byte appInfoVersion, byte fw, byte rpmMax = 130) => new() { Username = "SIM-RIDER", UniqueId = "AABBCCDD-EEFF0011-22334455", AppInfoVersion = appInfoVersion, FwVersion = fw, HwVersion = 10, UpgradeRpmMax = rpmMax, BikeManufacturer = 1, }; /// Wraps a data block in the 4-byte response header the parsers skip (51 xx xx 00). public static byte[] WithHeader(byte[] data, byte cmd = 0x43) { var p = new byte[4 + data.Length]; p[0] = 0x51; p[1] = cmd; p[2] = (byte)data.Length; p[3] = 0x00; Buffer.BlockCopy(data, 0, p, 4, data.Length); return p; } /// A valid 24-byte 1D block with chosen sign flags / multipliers. public static byte[] OneDimWire( byte[] axis, byte[] conv, byte rawSigned = 0, byte convSigned = 0, byte rawMult = 1, byte convMult = 1, byte maxRaw = 255, byte minRaw = 0, byte rawRound = 0, sbyte convOffset = 0) { var d = new byte[OneDimTable.WireLength]; Array.Copy(axis, 0, d, 0, 8); Array.Copy(conv, 0, d, 8, 8); d[16] = maxRaw; d[17] = minRaw; d[18] = rawSigned; d[19] = convSigned; d[20] = rawMult; d[21] = convMult; d[22] = rawRound; d[23] = unchecked((byte)convOffset); return d; } }