public void IotDataTests()
{
var topicName = "$aws/things/" + THING_NAME + "/shadow/update";
Client.Publish(new PublishRequest
{
Topic = topicName,
Qos = 1,
Payload = new MemoryStream(new byte[] { 1, 2, 3, 4 })
});
Client.Publish(new PublishRequest
{
Topic = topicName,
Qos = 1
});
topicName = "$aws/things/" + THING_NAME + "/shadow/get";
Client.Publish(new PublishRequest
{
Topic = topicName,
Qos = 1,
Payload = new MemoryStream(new byte[] { 1, 2, 3, 4 })
});
Client.Publish(new PublishRequest
{
Topic = topicName,
Qos = 1
});
var payload = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(
@"{ ""state"": {}}"
));
var updateThingShadowResponse = Client.UpdateThingShadow(new UpdateThingShadowRequest
{
ThingName = THING_NAME,
Payload = payload
});
Assert.IsTrue(payload.Length < updateThingShadowResponse.Payload.Length);
var getThingShadowResponse = Client.GetThingShadow(new GetThingShadowRequest
{
ThingName = THING_NAME
});
Assert.IsTrue(getThingShadowResponse.Payload.Length > 0);
var deleteThingShadowResponse = Client.DeleteThingShadow(new DeleteThingShadowRequest
{
ThingName = THING_NAME
});
Assert.IsTrue(getThingShadowResponse.Payload.Length > 0);
}