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}."); }
public void CustomsOfficer_CreateCustomsFormGroup_WorksAsExpected() { List <CustomsForm> _testData = _customsOfficer.CreateCustomsFormGroup("a bc cfh d"); Assert.That(_testData[2].answeredYes, Is.EqualTo("cfh")); }