public async Task <IActionResult> Index() { var employees = EmployeeQuery.GetEmployees(); var employeesQuantity = EmployeeQuery.GetEmployeesQuantity(); var vehiclesQuantity = VehicleQuery.GetVehiclesQuantity(); await Task.WhenAll(employees, employeesQuantity, vehiclesQuantity); ViewBag.EmployeesQuantity = employeesQuantity.Result; ViewBag.VehiclesQuantity = vehiclesQuantity.Result; return(View(employees.Result)); }
public async Task Should_ReturnEmployees_When_GetEmployees(string employeeFileData, IEnumerable <Employee> expectedEmployees) { var streamReader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(employeeFileData))); var employeeFileReader = new EmployeeFileReader(() => streamReader); var employeeQuery = new EmployeeQuery(() => employeeFileReader); var employees = await employeeQuery.GetEmployees(new[] { "192667735736991251148855951122872467118", "92667735736991251148855951122872467118" }); employees.Should().BeEquivalentTo(expectedEmployees); }