private static EnvironmentResource[] GetEnvironmentsForCustomer(EnvironmentResource[] environments, TenantResource tenant) { return(environments.Where(e => e.Name == "MT Production") .Concat(environments.Where(e => tenant.IsVIP() && e.Name == "MT Staging")) .Concat(environments.Where(e => tenant.IsBetaTester() && e.Name == "MT Beta")) .ToArray()); }
void TagCustomerByConvention(TenantResource customer, TagResource[] allTags) { var getTag = new Func <string, TagResource>(name => allTags.Single(t => t.Name == name)); var sharedTags = allTags.Where(t => t.Name.StartsWith("Shared")); customer.WithTag(getTag("External")); customer.WithTag(customer.IsVIP() ? getTag("VIP") : customer.IsTrial() ? getTag("Trial") : getTag("Standard")); customer.WithTag(customer.IsVIP() ? getTag("Dedicated") : sharedTags.GetRandom()); customer.WithTag(customer.IsEarlyAdopter() ? getTag("Early adopter") : getTag("Stable")); if (customer.IsBetaTester()) { customer.WithTag(getTag("2.x Beta")); } }