2019-11-10 12:38:40 +00:00
|
|
|
|
using System;
|
2019-11-17 14:33:24 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using CommandLine;
|
2019-11-17 14:52:43 +00:00
|
|
|
|
using static NucuCar.TestClient.SensorsCommandLine;
|
2019-11-10 12:38:40 +00:00
|
|
|
|
|
|
|
|
|
namespace NucuCar.TestClient
|
|
|
|
|
{
|
2019-11-17 14:52:43 +00:00
|
|
|
|
internal class Program
|
2019-11-10 12:38:40 +00:00
|
|
|
|
{
|
2019-11-10 14:02:50 +00:00
|
|
|
|
// ReSharper disable once ArrangeTypeMemberModifiers
|
2019-11-17 14:33:24 +00:00
|
|
|
|
static void Main(string[] args)
|
2019-11-10 12:38:40 +00:00
|
|
|
|
{
|
2019-11-17 16:27:58 +00:00
|
|
|
|
// TODO: Add test for telemetry publisher.
|
|
|
|
|
// TODO: Add test for telemetry reader.
|
|
|
|
|
// Sample: https://github.com/Azure-Samples/azure-iot-samples-csharp/blob/master/iot-hub/Quickstarts/read-d2c-messages/ReadDeviceToCloudMessages.cs
|
2019-11-17 14:52:43 +00:00
|
|
|
|
Parser.Default.ParseArguments<SensorsCommandLineOptions>(args)
|
2019-11-17 14:33:24 +00:00
|
|
|
|
.WithParsed(opts => { RunSensorsTestCommand(opts).GetAwaiter().GetResult(); })
|
|
|
|
|
.WithNotParsed(HandleParseError);
|
2019-11-10 14:02:50 +00:00
|
|
|
|
}
|
2019-11-10 12:38:40 +00:00
|
|
|
|
|
2019-11-17 14:33:24 +00:00
|
|
|
|
private static void HandleParseError(IEnumerable<Error> errs)
|
2019-11-10 14:02:50 +00:00
|
|
|
|
{
|
2019-11-17 14:33:24 +00:00
|
|
|
|
foreach (var e in errs)
|
2019-11-10 14:02:50 +00:00
|
|
|
|
{
|
2019-11-17 14:54:02 +00:00
|
|
|
|
Console.WriteLine($"Argument parse error: {e}");
|
2019-11-10 14:02:50 +00:00
|
|
|
|
}
|
2019-11-10 12:38:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|