public void When_Body_With_Text_Payload_Is_Valid_Json_Should_Be_Valid(string json, string expectedPayload) { var message = new Message(Encoding.UTF8.GetBytes(json)); var target = new LoRaCloudToDeviceMessageWrapper(this.sampleDevice, message); Assert.True(target.IsValid(out _)); Assert.Equal(expectedPayload, Encoding.UTF8.GetString(target.GetPayload())); }
public void When_Body_Has_MacCommand_Should_Contain_It_List(string json) { var message = new Message(Encoding.UTF8.GetBytes(json)); var target = new LoRaCloudToDeviceMessageWrapper(this.sampleDevice, message); Assert.True(target.IsValid(out _)); Assert.Single(target.MacCommands); Assert.IsType <DevStatusRequest>(target.MacCommands.First()); }
public void When_Body_Has_MacCommand_With_Parameters_Should_Contain_It_List(string json) { var message = new Message(Encoding.UTF8.GetBytes(json)); var target = new LoRaCloudToDeviceMessageWrapper(this.sampleDevice, message); Assert.True(target.IsValid(out _)); Assert.Single(target.MacCommands); Assert.IsType <DutyCycleRequest>(target.MacCommands.First()); var dutyCycleCmd = (DutyCycleRequest)target.MacCommands.First(); Assert.Equal(2, dutyCycleCmd.DutyCyclePL); }