Review this LINQ helper against the stated reporting contract.
Enumerate caller data once, reject input beyond 100,000 orders, include signed refunds, group customer names case-insensitively, and return a materialized top ten ordered by total descending then name.
csharp
using System;
using System.Collections.Generic;
using System.Linq;
public sealed record Order(string Customer, decimal Amount);
public sealed record CustomerTotal(string Customer, decimal Amount);
public static class Reports
{
public static IReadOnlyList<CustomerTotal> Get(IEnumerable<Order> orders)
{
if (!orders.Any()) return [];
return orders
.Where(order => order.Amount > 0m)
.GroupBy(order => order.Customer)
.Select(group => new CustomerTotal(
group.Key,
group.Sum(order => order.Amount)))
.OrderByDescending(total => total.Amount)
.ThenBy(total => total.Customer, StringComparer.OrdinalIgnoreCase)
.Take(10)
.ToList();
}
}
generated code is illustrative, not from any one model