public static QuestionnaireTemplate FillNewQuestionnaireWithAnswers(IQuestionnaireService service, int[] answers, DateTime now, int userId) { GenericError error; QuestionnaireTemplate localizedTemplate = service.GetQuestionnaireTemplate(1, locale, out error, DateTime.Now, userId); Assert.IsTrue(localizedTemplate.QuestionCategories.Count == 7); for (int i = 0; i < localizedTemplate.QuestionCategories.Count; i++) { QuestionCategory q = localizedTemplate.QuestionCategories[i]; q.CategoryQuestion.QuestionAnwer = new QuestionAnwer { Answer = answers[i] }; } localizedTemplate.QuestionCategories.ForEach( cq => cq.Questions.ForEach(q => q.QuestionAnwer = new QuestionAnwer { Answer = 1 })); localizedTemplate.QuestionCategories[5].Questions[3].QuestionAnwer.Answer = -1; service.SubmitAnsweredTemplate(userId, localizedTemplate, now); return(localizedTemplate); }