aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.TelemetryTester.CLI/MockTelemetry.cs
blob: fb96e58198e0c8b7e24a2ce884fe85d19cc11126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Text;
using Tango.Telemetry;

namespace Tango.TelemetryTester.CLI
{
    public class MockTelemetry : ITelemetry
    {
        public DateTime Time { get; set; }

        public string ToJson(Newtonsoft.Json.Formatting format = Newtonsoft.Json.Formatting.None, bool flatten = true)
        {
            return $"{{\"time\": \"{Time:o}\"}}";
        }

        public byte[] ToBytes(Newtonsoft.Json.Formatting format = Newtonsoft.Json.Formatting.None, bool flatten = true)
        {
            return Encoding.UTF8.GetBytes(ToJson(format, flatten));
        }
    }
}