Пример #1
0
    static void Main(string[] args)
    {
        var agency         = new Agency();
        var inputGenerator = new InputGenerator();

        List <Invoice> invoices = inputGenerator.GenerateInvoices(10000);

        foreach (var inv in invoices)
        {
            agency.Create(inv);
        }

        var mostOccur = inputGenerator.MostOccur(invoices, x => x.DueDate);

        DateTime mostOccurDueDate = mostOccur.Key;

        DateTime minDueDate = mostOccurDueDate.AddYears(-1);
        DateTime maxDueDate = mostOccurDueDate.AddYears(1);

        var watch = new Stopwatch();

        watch.Start();
        try
        {
            agency.ThrowInvoiceInPeriod(minDueDate, maxDueDate);
        }
        catch (ArgumentException ignored)
        {
        }
        watch.Stop();

        long elapsedTime = watch.ElapsedMilliseconds;

        System.Console.WriteLine(elapsedTime);
    }