Пример #1
0
        public void ByContentAddTest()
        {
            this.SchoolNet().LoadWebPage();
            int    index               = 0;
            string uniqueId            = "ctl01";
            QuestionAnswerContent form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AnswerChoice, ItemType.MultipleChoice);

            Assert.AreEqual("By.Id: divNoAnswerContent" + index,
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");

            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AnswerChoice, ItemType.TrueFalse);
            Assert.AreEqual("By.Id: divNoAnswerContent" + index,
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");

            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AnswerChoice, ItemType.InlineResponse);
            Assert.AreEqual("By.Id: ctl00_MainContent_EditTestItemControl_RepeaterClozeStemAnswers_" + uniqueId + "_txtAnswerContent",
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");

            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AnswerChoice, ItemType.DragAndDrop);
            Assert.AreEqual("By.CssSelector: .tab-pane.ng-scope.active .listChoices li[data-ng-repeat='tabChoice in tab.AllChoices']:nth-of-type(" + index + ") div[data-ng-bind-html-unsafe]",
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");

            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AnswerChoice, ItemType.HotSpotSingleSelection);
            Assert.AreEqual("By.CssSelector: #tblAnswers tbody[ng-repeat='answer in TestItem.Answers']:nth-of-type(" + index + ") ..itemContent > #divNoanswer0A",
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");


            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AvailableChoice, ItemType.Matching);
            Assert.AreEqual("By.Id: divNoMatchChoiceContent" + index,
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");

            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.AvailableChoice, ItemType.DragAndDrop);
            Assert.AreEqual("By.CssSelector: .listChoices li[data-ng-repeat='choice in TestItem.Choices']:nth-of-type(" + index + ") .itemContent",
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");


            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.QuestionStem, ItemType.TrueFalse);
            Assert.AreEqual("By.Id: divNoMatchStemContent" + index,
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");


            form = new QuestionAnswerContent("T", index, uniqueId, ContentType.TargetContainer, ItemType.TrueFalse);
            Assert.AreEqual("By.CssSelector: .listChoices li[data-ng-repeat='container in TestItem.Containers']:nth-of-type(" + index + ") .itemContent",
                            form.ByContentAdd().ToString(), "ByContentAdd locator matches");
        }