示例#1
0
        public void TestRandomize(int problemSetSize, int totalProblems, bool isCorrect)
        {
            string s1  = "s1";
            string g1  = "g1";
            string sgp = s1 + g1 + "-";

            SkillsDataManager sdm = new SkillsDataManager();

            sdm.AddSkill(s1, false);

            ProblemDataManager pdm = new ProblemDataManager();

            for (int i = 0; i < totalProblems; i++)
            {
                pdm.AddProblem(s1, g1, sgp + i.ToString(), 0, 0, 0);
            }

            //Hold the completed problems for later comparison
            IList <string> completedList = new List <string>();

            for (int i = 0; i < totalProblems / problemSetSize; i++)
            {
                DefaultAssessmentBuilder dab = new DefaultAssessmentBuilder(pdm, sdm);
                dab.AddProblem(problemSetSize, g1, "randgrp321");
                Assessment     assess = dab.Build();
                IList <string> probs  = assess.GetProblemSequence();
                foreach (string prob in probs)
                {
                    pdm.MarkCompleted(prob, isCorrect);
                    Assert.IsFalse(completedList.Contains(prob), prob + ": Already in List");
                    completedList.Add(prob);
                }
            }
        }
        public void TestGetSkillForGroupId()
        {
            ProblemDataManager dataManager = new ProblemDataManager();

            dataManager.AddProblem("Skill1", "Group1", "Problem1", 0, 0, 0);
            Assert.AreEqual("Skill1", dataManager.GetSkillForGroupId("Group1"));
        }
        public void TestAddProblem()
        {
            ProblemDataManager dataManager = new ProblemDataManager();

            dataManager.AddProblem("Skill1", "Group1", "Problem1", 0, 0, 0);
            Assert.AreEqual(1, dataManager.GetProblemCount());
        }
        public void TestGetProblemsFromGroup()
        {
            ProblemDataManager dataManager = new ProblemDataManager();

            dataManager.AddProblem("Skill1", "Group1", "Problem1", 1, 0, 1);
            dataManager.AddProblem("Skill1", "Group2", "Problem2", 0, 0, 0);
            dataManager.AddProblem("Skill1", "Group1", "Problem3", 1, 0, 2);
            Assert.AreEqual(3, dataManager.GetProblemCount());

            Assert.AreEqual(1, dataManager.GetProblemsFromGroup(1, "Group1").Count);
            Assert.AreEqual(2, dataManager.GetProblemsFromGroup(2, "Group1").Count);

            Assert.AreEqual("Problem1", dataManager.GetProblemsFromGroup(2, "Group1")[0]);
            Assert.AreEqual("Problem3", dataManager.GetProblemsFromGroup(2, "Group1")[1]);

            dataManager.MarkCompleted("Problem1", true);

            Assert.AreEqual(2, dataManager.GetProblemsFromGroup(2, "Group1").Count);
            Assert.AreEqual("Problem3", dataManager.GetProblemsFromGroup(2, "Group1")[0]);
            Assert.AreEqual("Problem1", dataManager.GetProblemsFromGroup(2, "Group1")[1]);
        }
        public void TestMarkComplete()
        {
            ProblemDataManager dataManager = new ProblemDataManager();

            dataManager.AddProblem("Skill1", "Group1", "Problem1", 0, 0, 0);
            dataManager.MarkCompleted("Problem1", true);
            dataManager.MarkCompleted("Problem1", false);
            ProblemsMockDataStorageDelegate storage = new ProblemsMockDataStorageDelegate();

            dataManager.StoreData(storage);

            Assert.AreEqual(1, storage.callCount);
            Assert.AreEqual(2, storage.timesAttempt);
            Assert.AreEqual(1, storage.correct);
        }
示例#6
0
        public void TestBasicAssessment()
        {
            SkillsDataManager sdm = new SkillsDataManager();

            sdm.AddSkill("s1", false);

            ProblemDataManager pdm = new ProblemDataManager();

            pdm.AddProblem("s1", "grp1", "s1g1-1", 0, 0, 0);

            DefaultAssessmentBuilder dab = new DefaultAssessmentBuilder(pdm, sdm);

            dab.AddProblem(1, "grp1", "randomGrp");

            Assessment assess = dab.Build();

            Assert.IsNotNull(assess);

            IList <string> probIds = assess.GetProblemSequence();

            Assert.AreEqual(probIds.Count, 1);
            Assert.AreEqual(probIds[0], "s1g1-1");
        }