Skip to content

Commit

Permalink
fix-command/add a new test for the payload
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-mrq authored and kbeaugrand committed Apr 16, 2024
1 parent 134b20e commit 8778957
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@ public async Task ExecuteLoRaDeviceMessageMustBeSuccessfullWhenParametersAreProv
MockHttpClient.VerifyNoOutstandingExpectation();
}

[Test]
public void ExecuteLoRaDeviceMessageMustBeSuccessfullWhenParametersAndCommandAreProvided()
{
var command = "0113007801680100640064";

// Convert the hex frame to a byte array
var hexFrame = Enumerable.Range(0, command.Length / 2)
.Select(x => Convert.ToByte(command.Substring(x * 2, 2), 16))
.ToArray();

// Convert the byte array to a base64 string
var rawPayload = Convert.ToBase64String(hexFrame);

Assert.AreEqual("ARMAeAFoAQBkAGQ=", rawPayload);
}

[TestCase("CN_470_510_RP1")]
[TestCase("CN_470_510_RP2")]
[TestCase("EU_863_870")]
Expand Down

0 comments on commit 8778957

Please sign in to comment.