コード例 #1
0
        public void Test_BuildWithNullMqttMessage()
        {
            MqttData data = new MqttData();

            data.Put("payload", "abc");
            KiiPushMessage.BuildWith(data).WithMqttMessage(null);
        }
コード例 #2
0
 /// <summary>
 /// Create builder with Data that will be sent only to MQTT devices.
 /// Corresponding to MQTT's custom payload.
 /// The data specified here will be merged with the data specified on <see cref="KiiPushMessage.BuildWith(KiiPushMessage.Data)"/>
 /// </summary>
 /// <remarks></remarks>
 /// <param name="data">MQTT specific data.</param>
 /// <returns>Builder of the message.</returns>
 /// <exception cref='ArgumentNullException'>
 /// Is thrown when an argument is null.
 /// </exception>
 public Builder WithMqttData(MqttData data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data must not be null");
     }
     this.data = data;
     return(this);
 }
コード例 #3
0
        public void Test_MqttMessage()
        {
            MqttData data = new MqttData();

            data.Put("payload", "abc");
            MqttMessage apns = MqttMessage.CreateBuilder()
                               .WithMqttData(data)
                               .Build();
            JsonObject json = apns.ToJson();

            Assert.AreEqual(true, json.Get("enabled"));
            Assert.AreEqual("abc", json.GetJsonObject("data").Get("payload"));
        }