public void Example_1() { var ai = new AllergenIdentifier { Sets = ExampleInput.Select(x => new Set(x)).ToList() }; ai.Analyze(); Assert.Equal(4, ai.AllergenFreeIngredients.Count); Assert.Equal(5, ai.CountAllergenFreeIngredientsOccurrences()); }
public void Example_2() { var ai = new AllergenIdentifier { Sets = ExampleInput.Select(x => new Set(x)).ToList() }; ai.Analyze(); var dangerousIngredients = ai.Sets .SelectMany(x => x.DangerousIngredients) .Distinct() .OrderBy(x => x.Value) .Aggregate("", (c, n) => $"{c},{n.Key}")[1..]; Assert.Equal("mxmxvkd,sqjhc,fvjkl", dangerousIngredients); }