Пример #1
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");
        }
Пример #2
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));
        }
Пример #3
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");
        }
Пример #4
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");
                }
            }
        }