diff options
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.TelemetryTester.CLI/MockHistorySource.cs')
| -rw-r--r-- | Software/Visual_Studio/Utilities/Tango.TelemetryTester.CLI/MockHistorySource.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.TelemetryTester.CLI/MockHistorySource.cs b/Software/Visual_Studio/Utilities/Tango.TelemetryTester.CLI/MockHistorySource.cs new file mode 100644 index 000000000..6ecd7e637 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.TelemetryTester.CLI/MockHistorySource.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Tango.Telemetry; + +namespace Tango.TelemetryTester.CLI +{ + public class MockHistorySource : ITelemetryHistorySource + { + public string Name { get; } + + public int ProvidedCount { get; set; } + + public MockHistorySource(string name) + { + Name = name; + } + + public Task<bool> CanRequestHistory(DateTime from) => Task.FromResult(true); + + public Task<IEnumerable<ITelemetry>> RequestHistory(DateTime from) + { + Logger.LogInfo($"[HistorySource] Providing historical telemetry at {DateTime.UtcNow}"); + + ProvidedCount++; + + return Task.FromResult<IEnumerable<ITelemetry>>(new[] + { + new MockTelemetry { Time = DateTime.UtcNow.AddSeconds(-30) } + }); + } + + public void Dispose() { } + } +} |
