public void MatchingPairVectorSkipsProperties() { var pair = new MatchingPair { FindingDateOfIncident = 1, LossDateOfIncident = 2, FindingCategory = 12, LossCategory = 13, FindingColors = new[] { 12.1, 16 }, LossColors = new[] { 12.1, 16 }, FindingMoney = 14, LossMoney = 15, PercentMatch = 0.65323 }; var vector = pair.ToVectorArray(new Dictionary <string, IndexableAttributeMetadata>(), new[] { nameof(MatchingPair.FindingColors), nameof(MatchingPair.LossColors), nameof(MatchingPair.FindingMoney), nameof(MatchingPair.LossMoney) }); Assert.That(vector, Is.EqualTo(new[] { 0.65323, 2, 1, 13, 12.0 })); }
private void SetUniqueControlIdentifiers() { //get a hash of the answer choice's: label and unique control identifier using WebDriver.FindElements(By.ClassName) QuestionStemUniqueControlIdentifiers = GetUniqueControlIdentifiers(ByMatchQuestionStemLabels); AnswerChoiceUniqueControlIdentifiers = GetUniqueControlIdentifiers(ByMatchAnswerChoiceLabels); //get the list of answer labels var keyList = new List <string>(); foreach (var key in AnswerChoiceUniqueControlIdentifiers.Keys) { keyList.Add(key); } QuestionStemList = new List <QuestionAnswerContent>(); //for each element in the hash foreach (var key in QuestionStemUniqueControlIdentifiers.Keys) { //is the key numeric? int index; bool isNumeric = int.TryParse(key, out index); if (isNumeric == true) { //get a numeric zero based index by subtracting 1 from the number of the question label index = index - 1; //get the unique control identifier string uniqueId = QuestionStemUniqueControlIdentifiers[key]; Report.Write("Question stem unique control identifier by key: " + key + "; index: " + index + "; ID: " + uniqueId); //create an question stem object var questionStem = new QuestionAnswerContent(key, index, uniqueId, ContentType.QuestionStem, ItemType.Matching, ControlPrefix); //add the question stem object to the collection (1, 2, 3) QuestionStemList.Add(questionStem); } } AnswerChoiceList = new List <QuestionAnswerContent>(); //for each element in the hash foreach (var key in AnswerChoiceUniqueControlIdentifiers.Keys) { //is the key numeric? int index; bool isNumeric = int.TryParse(key, out index); if (isNumeric == false) { //get a numeric zero based index based on the letter of the answer label index = this.GetIndexByAlphabet(key, keyList); //get the unique control identifier string uniqueId = AnswerChoiceUniqueControlIdentifiers[key]; Report.Write("Answer choice unique control identifier by key: " + key + "; index: " + index + "; ID: " + uniqueId); //create an answer choice object var answerChoice = new QuestionAnswerContent(key, index, uniqueId, ContentType.AvailableChoice, ItemType.Matching, ControlPrefix); //add the answer choice object to the collection (A, B, C, D) AnswerChoiceList.Add(answerChoice); } } MatchingPairList = new List <MatchingPair>(); //for each element in the hash foreach (var key in QuestionStemUniqueControlIdentifiers.Keys) { //is the key numeric? int index; bool isNumeric = int.TryParse(key, out index); if (isNumeric == true) { //get a numeric zero based index by subtracting 1 from the number of the question label index = index - 1; //get the unique control identifier string uniqueId = QuestionStemUniqueControlIdentifiers[key]; Report.Write("Matching pair unique control identifier by key: " + key + "; index: " + index + "; ID: " + uniqueId); //create an question stem object var matchingPair = new MatchingPair(key, index, uniqueId, ControlPrefix); //add the question stem object to the collection (1, 2, 3) MatchingPairList.Add(matchingPair); } } }