コード例 #1
0
        public void learnerPreferences()
        {
            LETSIRTE_Service client = getClient();
            cocdType         cmi    = new cocdType();

            cmi.exitSpecified = true;
            cmi.exit          = exit.suspend;

            cmi.learnerPreferenceAudioCaptioningSpecified = true;
            cmi.learnerPreferenceAudioCaptioning          = learnerPreferenceAudioCaptioning.on;

            cmi.learnerPreferenceAudioLevelSpecified = true;
            cmi.learnerPreferenceAudioLevel          = .5m;

            cmi.learnerPreferenceDeliverySpeedSpecified = true;
            cmi.learnerPreferenceDeliverySpeed          = .4m;

            cmi.learnerPreferenceLanguage = "en-GB";
            Log(cmi.ToString());
            client.Set(cmi);

            cmi = client.Get();

            Assert.AreEqual(learnerPreferenceAudioCaptioning.on, cmi.learnerPreferenceAudioCaptioning, "learnerPreferenceAudioCaptioning");
            Assert.AreEqual(.5m, cmi.learnerPreferenceAudioLevel, "learnerPreferenceAudioLevel");
            Assert.AreEqual(.4m, cmi.learnerPreferenceDeliverySpeed, "learnerPreferenceDeliverySpeed");
            Assert.AreEqual("en-GB", cmi.learnerPreferenceLanguage, "learnerPreferenceLanguage");
        }
コード例 #2
0
        public void location()
        {
            LETSIRTE_Service client = getClient();

            Log("verify open attempt");
            attemptSummary[] attempts = client.GetAttemptList();
            if (entry.other == attempts[attempts.Length - 1].entry)
            {
                Assert.Ignore(string.Format("Current attempt for registration {0} is closed, registration is closed, test can't continue.", RegId));
            }

            Log("Location: " + client.Get().location);
            cocdType cocd     = new cocdType();
            string   location = Guid.NewGuid().ToString();

            cocd.location = location;
            client.Set(cocd);

            cocd = client.Get();
            Assert.AreEqual(location, cocd.location, "location");

            client.Set(new cocdType());
            cocd = client.Get();
            Assert.AreEqual(location, cocd.location, "location");

            location = "";

            cocd.location = location;
            client.Set(cocd);

            cocd = client.Get();
            Assert.AreEqual(location, cocd.location, "location");
        }
コード例 #3
0
        public void commentTest()
        {
            LETSIRTE_Service client = getClient();

            cocdType cocd = new cocdType();

            cocd.commentsFromLearner = new commentType[1];

            cocd.commentsFromLearner[0] = new commentType();

            cocd.commentsFromLearner[0].timeStamp     = DateTime.Now;
            cocd.commentsFromLearner[0].location      = "right here";
            cocd.commentsFromLearner[0].identifier    = "comment1";
            cocd.commentsFromLearner[0].comment       = new commentTypeComment();
            cocd.commentsFromLearner[0].comment.Value = "new comment";

            //TODO: empty objective doesn't work cocd.commentsFromLearner[1] = new commentType();

            cocd.exit          = exit.suspend;
            cocd.exitSpecified = true;
            client.Set(cocd);
            cocd = client.Get();

            //cocd.commentsFromLearner[0].timeStamp = DateTime.Now;
            //Assert.AreEqual( "right here", cocd.commentsFromLearner[0].location);
            //Assert.AreEqual( "not yet implemented" ,cocd.commentsFromLearner[0].identifier);
            Assert.AreEqual("new comment", cocd.commentsFromLearner[0].comment.Value);
        }
コード例 #4
0
        public void interactionsLongFillIn()
        {
            LETSIRTE_Service client = getClient();

            string intFillInID = "Long_FillIn";

            cocdType        cocd  = client.Get();
            interactionType inter = cocd.GetInteraction(intFillInID, true);

            inter.type             = interactionTypeType.long_fill_in;
            inter.correctResponses = new correctResponsesType();
            inter.correctResponses.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.correctResponseLongFillIn, ItemsChoiceType.correctResponseLongFillIn };
            correctResponsesTypeCorrectResponseLongFillIn rsp  = new correctResponsesTypeCorrectResponseLongFillIn();
            correctResponsesTypeCorrectResponseLongFillIn rsp2 = new correctResponsesTypeCorrectResponseLongFillIn();

            inter.correctResponses.Items = new object[] { rsp, rsp2 };

            rsp.Value  = "answer 1";
            rsp2.Value = "answer 2";

            inter.description       = new interactionTypeDescription();
            inter.description.Value = "long fillin interaction";
            inter.learnerResponse   = new learnerResponseType();
            inter.learnerResponse.ItemsElementName = new ItemsChoiceType1[] { ItemsChoiceType1.learnerResponseLongFillIn };
            learnerResponseTypeLearnerResponseLongFillIn lrsp = new learnerResponseTypeLearnerResponseLongFillIn();

            inter.learnerResponse.Items = new object[] { lrsp };

            lrsp.Value = "answer 2";

            inter.result          = interactionTypeResult.correct;
            inter.resultSpecified = true;


            Assert.IsNotNull(inter, "inter");
            Assert.IsNotNull(inter.correctResponses, "inter.correctResponses");
            Assert.IsNotNull(inter.correctResponses.Items, "inter.correctResponses.Items");
            Assert.AreEqual(2, inter.correctResponses.Items.Length, "correct response count");
            Assert.AreEqual(1, inter.learnerResponse.Items.Length, "learner response count");
            Assert.AreEqual("answer 1", ((correctResponsesTypeCorrectResponseLongFillIn)inter.correctResponses.Items[0]).Value, "correct response 1");
            Assert.AreEqual("answer 2", ((correctResponsesTypeCorrectResponseLongFillIn)inter.correctResponses.Items[1]).Value, "correct response 2");
            Assert.AreEqual("answer 2", ((learnerResponseTypeLearnerResponseLongFillIn)inter.learnerResponse.Items[0]).Value, "learner response");


            cocd.exit          = exit.suspend;
            cocd.exitSpecified = true;
            client.Set(cocd);
            cocd = client.Get();

            inter = cocd.GetInteraction(intFillInID, false);
            Assert.IsNotNull(inter, "inter");
            Assert.IsNotNull(inter.correctResponses, "inter.correctResponses");
            Assert.IsNotNull(inter.correctResponses.Items, "inter.correctResponses.Items");
            Assert.AreEqual(2, inter.correctResponses.Items.Length, "correct response count");
            Assert.AreEqual(1, inter.learnerResponse.Items.Length, "learner response count");
            Assert.AreEqual("answer 1", ((correctResponsesTypeCorrectResponseLongFillIn)inter.correctResponses.Items[0]).Value, "correct response 1");
            Assert.AreEqual("answer 2", ((correctResponsesTypeCorrectResponseLongFillIn)inter.correctResponses.Items[1]).Value, "correct response 2");
            Assert.AreEqual("answer 2", ((learnerResponseTypeLearnerResponseLongFillIn)inter.learnerResponse.Items[0]).Value, "learner response");
        }
コード例 #5
0
        public void interactionsPerformanceTest()
        {
            LETSIRTE_Service client = getClient();

            string int2ID = "Performance_interaction_upd";

            cocdType        cocd = client.Get();
            interactionType perf = cocd.GetInteraction(int2ID, true);

            perf.type             = interactionTypeType.performance;
            perf.correctResponses = new correctResponsesType();
            perf.correctResponses.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.correctResponsePerformance, ItemsChoiceType.correctResponsePerformance };
            correctResponsesTypeCorrectResponsePerformance rsp  = new correctResponsesTypeCorrectResponsePerformance();
            correctResponsesTypeCorrectResponsePerformance rsp2 = new correctResponsesTypeCorrectResponsePerformance();

            perf.correctResponses.Items = new object[] { rsp, rsp2 };

            rsp.step = new correctResponsesTypeCorrectResponsePerformanceStep[] {
                new correctResponsesTypeCorrectResponsePerformanceStep("step_1", "answer 1"),
                new correctResponsesTypeCorrectResponsePerformanceStep("step_2_min_42", 42M, null)
            };
            rsp2.step = new correctResponsesTypeCorrectResponsePerformanceStep[] {
                new correctResponsesTypeCorrectResponsePerformanceStep("step_1_max_100", null, 100M),
                new correctResponsesTypeCorrectResponsePerformanceStep("step_2_minmax_no_limit", null, null)
            };

            perf.description       = new interactionTypeDescription();
            perf.description.Value = "performance interaction";
            perf.learnerResponse   = new learnerResponseType();
            perf.learnerResponse.ItemsElementName = new ItemsChoiceType1[] { ItemsChoiceType1.learnerResponsePerformance, ItemsChoiceType1.learnerResponsePerformance };
            learnerResponseTypeLearnerResponsePerformance lrsp  = new learnerResponseTypeLearnerResponsePerformance();
            learnerResponseTypeLearnerResponsePerformance lrsp2 = new learnerResponseTypeLearnerResponsePerformance();

            perf.learnerResponse.Items = new object[] { lrsp, lrsp2 };
            lrsp.stepName        = "step_1";
            lrsp.stepAnswer      = new learnerResponseTypeLearnerResponsePerformanceStepAnswer();
            lrsp.stepAnswer.Item = "answer 1";

            lrsp2.stepName        = "step_2_min_42";
            lrsp2.stepAnswer      = new learnerResponseTypeLearnerResponsePerformanceStepAnswer();
            lrsp2.stepAnswer.Item = 23M; // WRONG!

            perf.result          = interactionTypeResult.incorrect;
            perf.resultSpecified = true;

            interactionsPerfValidate(cocd.GetInteraction(int2ID, false));

            cocd.exit          = exit.suspend;
            cocd.exitSpecified = true;
            client.Set(cocd);
            cocd = client.Get();

            interactionsPerfValidate(cocd.GetInteraction(int2ID, false));
        }
コード例 #6
0
        public void set()
        {
            LETSIRTE_Service client = getClient();
            cocdType         cmi    = new cocdType();

            cmi.exitSpecified = true;
            cmi.exit          = exit.suspend;

            Log(cmi.ToString());
            client.Set(cmi);
        }
コード例 #7
0
        private void clear(exit exitValue)
        {
            Log(Environment.NewLine + "performing current attempt clear, exit: " + exitValue + Environment.NewLine);
            LETSIRTE_Service client = getClient();
            cocdType         cmi    = client.Get();

            int expectedLength = cmi.attemptNumber;

            cmi.progressMeasure           = null;
            cmi.progressMeasureSpecified  = true;
            cmi.completionStatus          = completionStatusType.unknown;
            cmi.completionStatusSpecified = true;
            cmi.successStatus             = successStatusType.unknown;
            cmi.successStatusSpecified    = true;
            cmi.scoreScaled          = null;
            cmi.scoreScaledSpecified = true;
            cmi.exit          = exitValue;
            cmi.exitSpecified = true;

            client.Set(cmi);

            attemptSummary[] attempts = client.GetAttemptList();
            foreach (attemptSummary att in attempts)
            {
                Log(att.ToString());
            }

            //Did we create a new attempt?
            Boolean exitCreatedNewAttempt = (exitValue == exit.normal || exitValue == exit.Item);

            expectedLength += (exitCreatedNewAttempt ? 1 : 0);

            Assert.AreEqual(expectedLength, attempts.Length);

            attemptSummary latest = attempts[attempts.Length - (1 + (exitCreatedNewAttempt ? 1 : 0))];

            Assert.AreEqual(cmi.scoreScaled, latest.scoreScaled);
            Assert.AreEqual(cmi.successStatus, latest.successStatus);
            Assert.AreEqual(cmi.completionStatus, latest.completionStatus);
            Assert.AreEqual(cmi.progressMeasure, latest.progressMeasure);
            Assert.AreEqual(exitValue == exit.suspend ? entry.resume : entry.other, latest.entry);
            Log("verified clear");
        }
コード例 #8
0
        //DE - Not even sure what this is testing, commenting out
        //[Test]
        public void generate()
        {
            LETSIRTE_Service client = getClient();

            Log("verify open attempt");
            attemptSummary[] attempts = client.GetAttemptList();
            if (entry.other == attempts[attempts.Length - 1].entry)
            {
                Assert.Ignore(string.Format("Current attempt for registration {0} is closed, registration is closed, test can't continue.", RegId));
            }

            Requests rq = new Requests();

            rq.interactionsFillIn();
            rq.interactionsLongFillIn();
            rq.interactionsPerformanceTest();
            rq.interactionsSequencing();
            rq.interactionsTest();
            clearTrace();

            // get
            cocdType cmi = client.Get();

            saveTrace("get", "");

            // set
            clearTrace();
            cmi.exit = exit.normal;
            cmi.attemptNumberSpecified = false;
            client.Set(cmi);
            saveTrace("set", "");

            // getattemptlist
            clearTrace();
            attempts = client.GetAttemptList();
            saveTrace("getAttemptList", "");

            //getAttempt
            clearTrace();
            client.GetAttempt(1);
            saveTrace("getAttempt", "");
        }
コード例 #9
0
        public void togglePassFail()
        {
            LETSIRTE_Service  client = getClient();
            cocdType          cmi    = client.Get();
            successStatusType status;

            Log("original success status: " + cmi.successStatus.ToString() + " specified: " + cmi.successStatusSpecified);

            cmi.successStatusSpecified = true;
            cmi.successStatus          = cmi.successStatus == successStatusType.failed ? successStatusType.passed : successStatusType.failed;
            status = cmi.successStatus;
            Log("success status set to: " + cmi.successStatus);
            cmi.exit          = exit.suspend;
            cmi.exitSpecified = true;
            client.Set(cmi);

            cmi = client.Get();
            Assert.IsTrue(cmi.successStatusSpecified, "set success status, therefore should still be marked specified");
            Assert.AreEqual(status, cmi.successStatus, "success status was just set and value not retained");
        }
コード例 #10
0
        public void objectiveTest()
        {
            LETSIRTE_Service client = getClient();

            string obj1ID = "test_obj_1";
            string obj2ID = "TeSt_obj_1";

            cocdType      cocd = client.Get();
            objectiveType obj  = cocd.GetObjective(obj1ID, true);

            obj.description            = new objectiveTypeDescription();
            obj.description.Value      = "test 1";
            obj.successStatus          = successStatusType.passed;
            obj.successStatusSpecified = true;

            obj                        = cocd.GetObjective(obj2ID, true);
            obj.description            = new objectiveTypeDescription();
            obj.description.Value      = "really objective 2";
            obj.successStatusSpecified = false;

            //cocd.AddObjective(new objectiveType()); //TODO: test creating and then doing nothing else with an objective -- doesn't work

            cocd.exit          = exit.suspend;
            cocd.exitSpecified = true;
            client.Set(cocd);
            cocd = client.Get();

            obj = cocd.GetObjective(obj2ID, false);
            Assert.IsNotNull(obj, obj2ID);
            Assert.AreEqual(obj2ID, obj.identifier);
            Assert.AreEqual(obj.description.Value, "really objective 2");
            Assert.AreEqual(successStatusType.unknown, obj.successStatus, obj.identifier + "success status ");

            obj = cocd.GetObjective(obj1ID, false);
            Assert.IsNotNull(obj, obj1ID);
            Assert.AreEqual(obj1ID, obj.identifier);
            Assert.AreEqual(obj.description.Value, "test 1");
            Assert.AreEqual(successStatusType.passed, obj.successStatus);
            Assert.AreEqual(true, obj.successStatusSpecified, obj.identifier + "success status specified");
        }
コード例 #11
0
        public void interactionsSequencing()
        {
            LETSIRTE_Service client = getClient();

            string intSeqId = "Sequencing";

            cocdType        cocd  = client.Get();
            interactionType inter = cocd.GetInteraction(intSeqId, true);

            inter.type             = interactionTypeType.sequencing;
            inter.correctResponses = new correctResponsesType();
            inter.correctResponses.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.correctResponseSequencing, ItemsChoiceType.correctResponseSequencing };
            correctResponsesTypeCorrectResponseSequencing rsp  = new correctResponsesTypeCorrectResponseSequencing();
            correctResponsesTypeCorrectResponseSequencing rsp2 = new correctResponsesTypeCorrectResponseSequencing();

            inter.correctResponses.Items = new object[] { rsp, rsp2 };

            rsp.step  = new string[] { "1", "2", "3", "4" };
            rsp2.step = new string[] { "A", "B", "C" };

            inter.description       = new interactionTypeDescription();
            inter.description.Value = "Sequencing interaction";
            inter.learnerResponse   = new learnerResponseType();
            inter.learnerResponse.ItemsElementName = new ItemsChoiceType1[] { ItemsChoiceType1.learnerResponseSequencing, ItemsChoiceType1.learnerResponseSequencing };
            learnerResponseTypeLearnerResponseSequencing lrsp = new learnerResponseTypeLearnerResponseSequencing();

            inter.learnerResponse.Items = new object[] { lrsp };

            lrsp.step = new string[] { "A", "B", "C" };

            inter.result          = interactionTypeResult.correct;
            inter.resultSpecified = true;

            Assert.IsNotNull(inter, "inter");
            Assert.IsNotNull(inter.correctResponses, "inter.correctResponses");
            Assert.IsNotNull(inter.correctResponses.Items, "inter.correctResponses.Items");
            Assert.AreEqual(2, inter.correctResponses.Items.Length, "correct response count");
            Assert.AreEqual(1, inter.learnerResponse.Items.Length, "learner response count");
            Assert.AreEqual(4, ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[0]).step.Length, "correct response 1 step count");
            Assert.AreEqual(3, ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[1]).step.Length, "correct response 2 step count");
            Assert.AreEqual("1,2,3,4", string.Join(",", ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[0]).step), "correct response 1");
            Assert.AreEqual("A,B,C", string.Join(",", ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[1]).step), "correct response 2");
            Assert.AreEqual("A,B,C", string.Join(",", ((learnerResponseTypeLearnerResponseSequencing)inter.learnerResponse.Items[0]).step), "learner response");


            cocd.exit          = exit.suspend;
            cocd.exitSpecified = true;
            client.Set(cocd);
            cocd = client.Get();

            inter = cocd.GetInteraction(intSeqId, false);
            Assert.IsNotNull(inter, "inter");
            Assert.IsNotNull(inter.correctResponses, "inter.correctResponses");
            Assert.IsNotNull(inter.correctResponses.Items, "inter.correctResponses.Items");
            Assert.AreEqual(2, inter.correctResponses.Items.Length, "correct response count");
            Assert.AreEqual(1, inter.learnerResponse.Items.Length, "learner response count");
            Assert.AreEqual(4, ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[0]).step.Length, "correct response 1 step count");
            Assert.AreEqual(3, ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[1]).step.Length, "correct response 2 step count");
            Assert.AreEqual("1,2,3,4", string.Join(",", ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[0]).step), "correct response 1");
            Assert.AreEqual("A,B,C", string.Join(",", ((correctResponsesTypeCorrectResponseSequencing)inter.correctResponses.Items[1]).step), "correct response 2");
            Assert.AreEqual("A,B,C", string.Join(",", ((learnerResponseTypeLearnerResponseSequencing)inter.learnerResponse.Items[0]).step), "learner response");
        }
コード例 #12
0
        private void interactionsTest(bool testArrayClear)
        {
            LETSIRTE_Service client = getClient();

            string int1ID = "test_interaction_1";

            cocdType        cocd = client.Get();
            interactionType int1 = cocd.GetInteraction(int1ID, true);

            int1.type             = interactionTypeType.fill_in;
            int1.correctResponses = new correctResponsesType();
            int1.correctResponses.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.correctResponseFillIn };
            correctResponsesTypeCorrectResponseFillIn rsp = new correctResponsesTypeCorrectResponseFillIn();

            int1.correctResponses.Items = new object[] { rsp };
            rsp.caseMatters             = false;
            rsp.orderMatters            = false;
            correctResponsesTypeCorrectResponseFillInMatchText match  = new correctResponsesTypeCorrectResponseFillInMatchText();
            correctResponsesTypeCorrectResponseFillInMatchText match2 = new correctResponsesTypeCorrectResponseFillInMatchText();

            rsp.matchText = new correctResponsesTypeCorrectResponseFillInMatchText[] { match, match2 };
            match.Value   = "answer 42";
            match2.Value  = "answer 2";

            int1.learnerResponse = new learnerResponseType();
            int1.learnerResponse.ItemsElementName = new ItemsChoiceType1[] { ItemsChoiceType1.learnerResponseFillIn };
            learnerResponseTypeLearnerResponseFillIn lrsp = new learnerResponseTypeLearnerResponseFillIn();

            int1.learnerResponse.Items = new object[] { lrsp };
            lrsp.Value = "ANSWER 1";

            int1.result             = interactionTypeResult.correct;
            int1.resultSpecified    = true;
            int1.timeStamp          = DateTime.UtcNow;
            int1.timeStampSpecified = true;

            int1.objectiveIds = new string[] { "id1", "id2" };

            cocd.exitSpecified = true;
            cocd.exit          = exit.suspend;
            client.Set(cocd);
            cocd = client.Get();

            int1 = cocd.GetInteraction(int1ID, false);
            Assert.AreEqual(interactionTypeType.fill_in, int1.type);

            Assert.AreEqual(((correctResponsesTypeCorrectResponseFillIn)int1.correctResponses.Items[0]).matchText[0].Value, "answer 42");
            learnerResponseTypeLearnerResponseFillIn lr = (learnerResponseTypeLearnerResponseFillIn)int1.learnerResponse.Items[0];

            Thread.Sleep(1000);

            Assert.AreEqual(lr.Value.ToLower(), "answer 1");
            Assert.AreEqual(interactionTypeResult.correct, int1.result);
            Assert.IsTrue(int1.resultSpecified);
            Assert.Greater(DateTime.UtcNow, int1.timeStamp);
            Assert.IsTrue(int1.timeStampSpecified);
            Assert.AreEqual("id2", int1.objectiveIds[1]);

            if (testArrayClear)
            {
                cocd.exitSpecified         = true;
                cocd.exit                  = exit.suspend;
                int1.learnerResponse.Items = new object[] { };
                int1.objectiveIds          = new string[] { };
                client.Set(cocd);
                cocd = client.Get();

                int1 = cocd.GetInteraction(int1ID, false);

                // null or length==0 is acceptable
                if (int1.learnerResponse != null && int1.learnerResponse.Items != null)
                {
                    Assert.AreEqual(0, int1.learnerResponse.Items.Length, "Failed to clear array");
                }
                // null or length==0 is acceptable
                if (int1.objectiveIds != null)
                {
                    Assert.AreEqual(0, int1.objectiveIds.Length, "Failed to clear array");
                }
            }
        }