Beispiel #1
0
        public static bool FieldsTagsPublishFormatTest()
        {
            try
            {
                FieldsTagsPublishFormat obj = new FieldsTagsPublishFormat();
                float value = (float)11.1;
                obj.SetSensorResult(new SensorResult()
                {
                    Value = (object)value
                });
                SensorLocation sensorLocation = new SensorLocation()
                {
                    Area = "area1", Location = "location1"
                };
                obj.SetSensorLocation(sensorLocation);

                JsonSerializer dataSerializer = new JsonSerializer(DateTimeFormat.ISO8601);
                string         jsonString     = dataSerializer.Serialize(obj);
                string         jsonExpected   = "";
                if (jsonString != jsonExpected)
                {
                    Console.WriteLine("Fail: FieldsTagsPublishFormatTest - Values did not match");
                    return(false);
                }

                Console.WriteLine("Success: FieldsTagsPublishFormatTest");
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fail: FieldsTagsPublishFormatTest - " + ex.Message);
                return(false);
            }
        }
Beispiel #2
0
 public void SetSensorLocation(SensorLocation sensorLocation)
 {
     FieldsTags[1] = sensorLocation;
 }