-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
34 lines (27 loc) · 908 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Text.Json;
namespace FlightChallenge
{
internal class Program
{
static async Task Main(string[] args)
{
if (args.Length != 3)
{
Console.WriteLine("Usage: FlightChallenge.exe <start-date> <end-date> <agency-id>");
return;
}
if (!DateOnly.TryParse(args[0], out DateOnly startDate) || !DateOnly.TryParse(args[1], out DateOnly endDate) || !int.TryParse(args[2], out int agencyId))
{
Console.WriteLine("Invalid arguments.");
return;
}
using var db = new FlightDbContext();
var detector = new ChangeDetection(db);
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
var result = await detector.DetectChanges(startDate, endDate, agencyId);
stopwatch.Stop();
Console.WriteLine($"Execution Time: {stopwatch.ElapsedMilliseconds} ms, found {result.Count()} options");
Console.WriteLine(JsonSerializer.Serialize(result));
}
}
}