public void TestQuestionsDuplicateCount() { TestQuestion testQuestion = new TestQuestion(); Testlet testlet = new Testlet(); // testlet.TestletId = "1"; testlet.SetQuestions = testQuestion.GetQuestions(); List <Question> testletCollection = testlet.Randomize(); Int32 duplicates = testletCollection.GroupBy(x => x.QuestionId).Where(g => g.Count() > 1).Count(); Assert.AreEqual(duplicates, 0); }
public void TestTotalCount() { TestQuestion testQuestion = new TestQuestion(); Testlet testlet = new Testlet(); // testlet.TestletId = "1"; testlet.SetQuestions = testQuestion.GetQuestions(); List <Question> testletCollection = testlet.Randomize(); Int32 questionsCount = testletCollection.Count; Assert.AreEqual(questionsCount, 10); }
public void TestOperationalQuestionsCount() { TestQuestion testQuestion = new TestQuestion(); Testlet testlet = new Testlet(); // testlet.TestletId = "1"; testlet.SetQuestions = testQuestion.GetQuestions(); List <Question> testletCollection = testlet.Randomize(); Int32 operationalTypeCount = testletCollection.Where(x => x.ItemType == QuestionTypeEnum.Operational).ToList().Count(); Assert.AreEqual(operationalTypeCount, 6); }
public void TestPreTestQuestionsCount() { //Testlet -- Collection TestQuestion testQuestion = new TestQuestion(); Testlet testlet = new Testlet(); // testlet.TestletId = "1"; testlet.SetQuestions = testQuestion.GetQuestions(); List <Question> testletCollection = testlet.Randomize(); Int32 preTestTypeCount = testletCollection.FindAll(x => x.ItemType == QuestionTypeEnum.Pretest).Count; Assert.AreEqual(preTestTypeCount, 4); }
static void Main(string[] args) { TestQuestion testQuestion = new TestQuestion(); var quesCollection = testQuestion.GetQuestions(); Testlet testlet = new Testlet(); testlet.SetQuestions = quesCollection; var randomQuestions = testlet.Randomize(); foreach (Question q in randomQuestions) { Console.WriteLine(q.QuestionId + " " + q.ItemType); } Console.ReadLine(); }