Exemplo n.º 1
0
        public void ByteBufferRoundtripTest_Unpooled(byte[] input)
        {
            IByteBufferConverter converter  = new ByteBufferConverter(UnpooledByteBufferAllocator.Default);
            IByteBuffer          byteBuffer = converter.ToByteBuffer(input);

            Assert.NotNull(byteBuffer);
            byte[] convertedBytes = converter.ToByteArray(byteBuffer);
            Assert.NotNull(convertedBytes);
            Assert.Equal(input, convertedBytes);
        }
Exemplo n.º 2
0
            public TestDesiredUpdateMessage(string desiredJson)
            {
                this.CoreMessage = new EdgeMessage.Builder(Encoding.UTF8.GetBytes(desiredJson))
                                   .SetSystemProperties(new Dictionary <string, string>()
                {
                    [SystemProperties.OutboundUri] = Mqtt.Constants.OutboundUriTwinDesiredPropertyUpdate,
                    [SystemProperties.Version]     = 1.ToString()
                })
                                   .Build();

                this.PgMessage = new ProtocolGatewayMessage.Builder(ByteBufferConverter.ToByteBuffer(Encoding.UTF8.GetBytes(desiredJson)),
                                                                    "$iothub/twin/PATCH/properties/desired/?$version=1").Build();
            }
Exemplo n.º 3
0
 public Messages(string address, byte[] payload)
 {
     this.Source = new ProtocolGatewayMessage.Builder(ByteBufferConverter.ToByteBuffer(payload), address)
                   .Build();
     this.Expected = new EdgeMessage.Builder(payload).Build();
 }
Exemplo n.º 4
0
        public void ByteArrayConversionErrorTest_Unpooled(byte[] input, Type expectedException)
        {
            IByteBufferConverter converter = new ByteBufferConverter(UnpooledByteBufferAllocator.Default);

            Assert.Throws(expectedException, () => converter.ToByteBuffer(input));
        }