private QuestionAnswerData getMultipleChoiceData2() { QuestionAnswerData createMultipleChoiceData = new QuestionAnswerData(); createMultipleChoiceData.ItemType = ItemType.MultipleChoice; createMultipleChoiceData.QuestionContent = "Which of the fishes pictured below is NOT a variety of goldfish?"; createMultipleChoiceData.TeacherExplanationList.Add("Teacher Explanation"); createMultipleChoiceData.StudentExplanationList.Add("Student Explanation"); createMultipleChoiceData.AnswerList.Add("A"); createMultipleChoiceData.AnswerList.Add("B"); createMultipleChoiceData.AnswerList.Add("C"); createMultipleChoiceData.AnswerList.Add("D"); createMultipleChoiceData.AnswerList.Add("E"); createMultipleChoiceData.CorrectAnswerList.Add("C"); createMultipleChoiceData.PointValuePair.Add("C", "1"); var fileNameDictionary = new Dictionary <string, string>(); fileNameDictionary.Add(createMultipleChoiceData.AnswerList[0], "Common goldfish.jpg"); fileNameDictionary.Add(createMultipleChoiceData.AnswerList[1], "Lionhead Goldfish.jpg"); fileNameDictionary.Add(createMultipleChoiceData.AnswerList[2], "Koi.jpg"); fileNameDictionary.Add(createMultipleChoiceData.AnswerList[3], "Oranda.jpg"); fileNameDictionary.Add(createMultipleChoiceData.AnswerList[4], "Shubunkin.jpg"); createMultipleChoiceData.FileUploadTree.Add(true, fileNameDictionary); return(createMultipleChoiceData); }
public void GetTestDataFromResxResourceTest() { this.SchoolNet().LoadWebPage(); try { QuestionAnswerData questionAnswerData = new QuestionAnswerData(); questionAnswerData.GetTestDataFromResxResource("UITests.Data.Assess.ItemCreateEdit.MultipleChoiceItemResource", "default_" + this.SchoolNet().TestConfiguration.ApplicationName, 0); Assert.AreEqual(ItemType.MultipleChoice, questionAnswerData.ItemType, "The item type is incorrect."); Assert.AreEqual(MultipleChoiceLayout.OneColumn, questionAnswerData.AnswerChoiceLayoutOption, "The answer choice layout is incorrect."); Assert.IsTrue(questionAnswerData.PointValuePair.ContainsKey("blue"), "The point value key is incorrect."); Assert.IsTrue(questionAnswerData.PointValuePair.ContainsValue("5"), "The point value is incorrect."); List <string> list = new List <string>(); list.Add("blue"); int i = 0; foreach (var item in questionAnswerData.CorrectAnswerList) { Assert.AreEqual(item, list[i], "The correct answer list is incorrect."); i++; } list.Add("purple"); list.Add("yellow"); list.Add("orange"); i = 0; foreach (var item in questionAnswerData.AnswerList) { Assert.AreEqual(item, list[i], "The answer list is incorrect."); i++; } list.Remove("blue"); list.Remove("purple"); list.Remove("yellow"); list.Remove("orange"); list.Add("teacher's explanation"); i = 0; foreach (var item in questionAnswerData.TeacherExplanationList) { Assert.AreEqual(item, list[i], "The teacher explanation list is incorrect."); i++; } list.Remove("teacher's explanation"); list.Add("student's explanation"); i = 0; foreach (var item in questionAnswerData.StudentExplanationList) { Assert.AreEqual(item, list[i], "The teacher explanation list is incorrect."); i++; } } catch (Exception e) { TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e); throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e); } }
/// <summary> /// associate the test tunnel's index with each item in the test list. /// (map the item ID to the test tunnel's index). /// </summary> public void AssociateTestTunnelIndexWithTestList() { foreach (var testTypeForm in TestList) { QuestionAnswerData data = (QuestionAnswerData)testTypeForm.Data; data.TestTunnelIndex = GetTunnelIndexByItemId(data.ItemID); } }
public void QuestionAnswerDataTest() { this.SchoolNet().LoadWebPage(); try { QuestionAnswerData questionAnswerData = new QuestionAnswerData(); Assert.IsNotNull(questionAnswerData, "QuestionAnswerData is null."); } catch (Exception e) { throw new Exception("" + e.GetBaseException()); } }
private QuestionAnswerData getTrueFalseData() { QuestionAnswerData createTrueFalseData = new QuestionAnswerData(); createTrueFalseData.ItemType = ItemType.TrueFalse; createTrueFalseData.QuestionContent = "Goldfish are a domesticated species."; createTrueFalseData.TeacherExplanationList.Add("teacher's explanation"); createTrueFalseData.StudentExplanationList.Add("student's explanation"); createTrueFalseData.AnswerList = createTrueFalseData.TrueFalseList; createTrueFalseData.CorrectAnswerList.Add("True"); createTrueFalseData.StudentAnswer = "True"; createTrueFalseData.PointValuePair.Add("True", "1"); return(createTrueFalseData); }
/// <summary> /// get an item from the test list by index /// </summary> /// <param name="index">the index</param> /// <returns>TestTypeForm</returns> public TestTypeForm GetItemFromTestListByIndex(int index) { TestTypeForm item = null; foreach (var testTypeForm in TestList) { QuestionAnswerData data = (QuestionAnswerData)testTypeForm.Data; if (data.TestTunnelIndex == index) { item = testTypeForm; break; } } return(item); }
/// <summary> /// get an item from the test list by item ID /// </summary> /// <param name="itemID">the item ID</param> /// <returns>TestTypeForm</returns> public TestTypeForm GetItemFromTestListByItemID(int itemID) { TestTypeForm item = null; foreach (var testTypeForm in TestList) { QuestionAnswerData data = (QuestionAnswerData)testTypeForm.Data; if (data.ItemID == itemID) { item = testTypeForm; break; } } return(item); }
private QuestionAnswerData getMultipleChoiceData1() { QuestionAnswerData createMultipleChoiceData = new QuestionAnswerData(); createMultipleChoiceData.ItemType = ItemType.MultipleChoice; createMultipleChoiceData.QuestionContent = "The contraction “won't” is short for:"; createMultipleChoiceData.TeacherExplanationList.Add("Teacher Explanation"); createMultipleChoiceData.StudentExplanationList.Add("Student Explanation"); createMultipleChoiceData.AnswerList.Add("Would not"); createMultipleChoiceData.AnswerList.Add("Will not"); createMultipleChoiceData.AnswerList.Add("Why not"); createMultipleChoiceData.AnswerList.Add("Is not"); createMultipleChoiceData.CorrectAnswerList.Add("Will not"); createMultipleChoiceData.PointValuePair.Add("Will not", "1"); return(createMultipleChoiceData); }
private QuestionAnswerData getOpenResponseData2() { //create new item open response QuestionAnswerData createOpenResponseData = new QuestionAnswerData(); createOpenResponseData.ItemType = ItemType.OpenResponse; createOpenResponseData.QuestionContent = "Provide examples of French language words that are now part of the English language."; createOpenResponseData.StudentAnswer = "students answer response"; createOpenResponseData.ResponseType = "Written"; createOpenResponseData.PointValueList.Add("10"); createOpenResponseData.NumberOfAnswerSheetPages = "2 Pages"; createOpenResponseData.ScoringInstructions = "scoring instructions"; createOpenResponseData.Exemplars = "exemplar information"; createOpenResponseData.FilePath = "C:\\uploadfile.txt"; createOpenResponseData.StudentInstructions = "student instructions"; return(createOpenResponseData); }
private QuestionAnswerData getOpenResponseData1() { //create new item open response QuestionAnswerData createOpenResponseData = new QuestionAnswerData(); createOpenResponseData.ItemType = ItemType.OpenResponse; createOpenResponseData.QuestionContent = "Write a short book report about your favorite novel. Maximum 100 words."; createOpenResponseData.StudentAnswer = "students answer response"; createOpenResponseData.ResponseType = "Written"; createOpenResponseData.PointValueList.Add("10"); createOpenResponseData.NumberOfAnswerSheetPages = "2 Pages"; createOpenResponseData.ScoringInstructions = "scoring instructions"; createOpenResponseData.Exemplars = "exemplar information"; createOpenResponseData.FilePath = "C:\\uploadfile.txt"; createOpenResponseData.StudentInstructions = "student instructions"; return(createOpenResponseData); }
private QuestionAnswerData getMultipleChoiceData3() { QuestionAnswerData createMultipleChoiceData = new QuestionAnswerData(); createMultipleChoiceData.ItemType = ItemType.MultipleChoice; createMultipleChoiceData.QuestionContent = "The month of September is which month of the year?"; createMultipleChoiceData.TeacherExplanationList.Add("Teacher Explanation"); createMultipleChoiceData.StudentExplanationList.Add("Student Explanation"); createMultipleChoiceData.AnswerList.Add("Seventh"); createMultipleChoiceData.AnswerList.Add("Eighth"); createMultipleChoiceData.AnswerList.Add("Ninth"); createMultipleChoiceData.AnswerList.Add("Tenth"); createMultipleChoiceData.AnswerList.Add("Thirteenth"); createMultipleChoiceData.AnswerList.Add("Seventeenth"); createMultipleChoiceData.CorrectAnswerList.Add("Ninth"); createMultipleChoiceData.PointValuePair.Add("Ninth", "1"); return(createMultipleChoiceData); }
//private bool Load(string fileName, string refID) //{ // string currentlist = ""; // int id = 0; // string line; // line = ""; // StreamReader theReader = new StreamReader(fileName, Encoding.Default); // using (theReader) // { // while (line != null) // { // line = theReader.ReadLine(); // if (line != null) // { // print("ENTRY: " + line); // line = line.Trim('\t'); // string[] split = line.Split(new string[] { ",," }, System.StringSplitOptions.None); // if (line.StartsWith("#")) // { // line = line.Remove(0, 1); // if (!questions.ContainsKey(line)) // { // questions.Add(split[0], new List<QuestionData>()); // } // currentlist = split[0]; // } // else // { // QuestionData data = new QuestionData(split[0],id.ToString(), currentlist, split[1], refID); // questions[currentlist].Add(data); // } // } // id++; // } // theReader.Close(); // return true; // } //} void LoadAnsweredList() { #if !UNITY_WEBGL if (!File.Exists(Application.dataPath + "/Files/answer.json")) { return; } string jsonData = File.ReadAllText(Application.dataPath + "/Files/answer.json"); if (string.IsNullOrEmpty(jsonData)) { return; } QuestionAnswerData allData = JsonUtility.FromJson <QuestionAnswerData>(jsonData); if (allData != null) { manager.SaveData = allData; } #endif }