Example #1
0
        private static string QuestionsEveryoneAnsweredWithYes(this GroupResponse groupResponse)
        {
            if (groupResponse == null)
            {
                throw new ArgumentNullException(nameof(groupResponse));
            }

            var appearInAll = groupResponse.IndividualsResponses[0].YesTo;

            foreach (var response in groupResponse.IndividualsResponses)
            {
                appearInAll = response.YesTo.Where(x => appearInAll.Contains(x)).ToArray();
            }

            appearInAll = appearInAll.OrderBy(x => x).ToArray();

            var sb = new StringBuilder();

            foreach (var item in appearInAll)
            {
                sb.Append(item);
            }

            return(sb.ToString());
        }
Example #2
0
        public static int NumberOfQuestionsEveryoneAnsweredYesTo(this GroupResponse groupResponse)
        {
            if (groupResponse == null)
            {
                throw new ArgumentNullException(nameof(groupResponse));
            }

            return(groupResponse.QuestionsEveryoneAnsweredWithYes().Length);
        }
        private static GroupResponse CreateGroupResponse(string groupResponse)
        {
            var groupResponseRtn = new GroupResponse();

            foreach (var individualsYesNoResponse in groupResponse.Split(new[] { "\r\n", "\n", "\r" },
                                                                         StringSplitOptions.None))
            {
                groupResponseRtn.IndividualsResponses.Add(new IndividualsResponse(individualsYesNoResponse));
            }

            return(groupResponseRtn);
        }
Example #4
0
        public static string QuestionsAnsweredWithYes(this GroupResponse groupResponse)
        {
            if (groupResponse == null)
            {
                throw new ArgumentNullException(nameof(groupResponse));
            }

            var groupYesTo = groupResponse.IndividualsResponses.SelectMany(x => x.YesTo)
                             .Distinct()
                             .OrderBy(x => x);

            var sb = new StringBuilder();

            foreach (var item in groupYesTo)
            {
                sb.Append(item);
            }

            return(sb.ToString());
        }