Exemple #1
0
        public async Task GroupByEmployeeIdentifierGetHighCountInOrders()
        {
            List <Employees> employeeList = await OrderOperations.GetEmployeesTask();

            IGrouping <int, Employees> employee = OrderOperations.EmployeeMostOrders(employeeList);

            // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/default-values
            Assert.IsTrue(employee != default);

            Debug.WriteLine($"Order count: {employee.Count()} employee id: {employee.Key}");

            SqlOperations.Server   = ".\\SQLEXPRESS";
            SqlOperations.Database = "NorthWind2020";

            //    |   |
            //    V   V    <- Discards
            var(_, _, dictionary) = SqlOperations.EmployeeMostOrders();

            Assert.AreEqual(employee.Count(), dictionary.FirstOrDefault().Value);
        }