public void CustomsOfficer_FindAllYesInAGroup_WorksAsExpected() { List <CustomsForm> _testData = _customsOfficer.CreateCustomsFormGroup("a bc cfh d"); string result = _customsOfficer.FindAllYesInAGroup(_testData); Assert.That(result, Is.EqualTo("abcfhd")); }
static void Main(string[] args) { CustomsOfficer customsOfficer = new CustomsOfficer(); List <string> rawData = Helper.ReadInDataAndSeparateWhenBlankLine("data.txt"); foreach (string data in rawData) { List <CustomsForm> singleGroup = customsOfficer.CreateCustomsFormGroup(data); customsOfficer.PopulateGroupOfGroups(singleGroup); } List <string> answeredYes = new List <string>(); foreach (List <CustomsForm> group in customsOfficer.groupOfGroups) { answeredYes.Add(customsOfficer.FindAllYesInAGroup(group)); } int result = customsOfficer.HowManyYesInAllGroups(answeredYes); Console.WriteLine($"The sum of all unique Yes answers in all groups is {result}."); // Challenge 2 result = 0; foreach (List <CustomsForm> group in customsOfficer.groupOfGroups) { result += customsOfficer.SecondTry(group); } Console.WriteLine($"The number of questions that everyone in a group answered Yes to is {result}."); }