Example #1
0
        public void GivenIHaveACompanyWithAtLeastOneEmployee()
        {
            // Get the last company created, sorted by creation date
            IEnumerable <Company> items1 = new RestCall <List <Company> >(Method.GET, context.Get <string>("url"), context.Get <string>("companyResource")).Data();
            Company company = null;

            // Iterate through the company from most recent to least recent and find one with at least one employee
            foreach (Company companyItem in items1.OrderByDescending(companyItem => companyItem.creationDate).ToList())
            {
                if (companyItem.employees.Count > 0)
                {
                    company = companyItem;
                    break;
                }
            }
            company.Should().NotBeNull("No company was found to delete employees from");

            context["company"] = company;
            Logger.Debug($"Managing Company: {company.companyName} [id: {company.id}] ({company.employees.Count} employee(s)");
        }