public void Talk_Info_Extractor_Should_Return_Tuple_With_Valid_Title_And_Duration() { var talkInfoTuple = new Tuple <string, int>("Overdoing it in Python: ", 45); string title = "Overdoing it in Python: 45min"; var talkInfo = talkInfoExtrator.ExtractTalkTitleAndDuration(title); Assert.AreEqual(talkInfoTuple, talkInfo); }
public List <Talk> GenerateTalksFromInput(string[] fileContents) { List <Talk> talkList = new List <Talk>(); foreach (var fileContent in fileContents) { if (string.IsNullOrEmpty(fileContent)) { continue; } var titleAndTalkDurationTuple = talkInfoExtractor.ExtractTalkTitleAndDuration(fileContent); if (string.IsNullOrEmpty(titleAndTalkDurationTuple.Item1)) { continue; } var talk = new Talk(titleAndTalkDurationTuple.Item1, titleAndTalkDurationTuple.Item2); var validationResult = talkValidator.ValidateTalk(talk); if (validationResult.IsValid) { talkList.Add(talk); } } return(talkList.OrderBy(x => x.Duration).ToList()); }