Model from Candidates.txt ex: 1;1;“Кандидат 1 в МИР 1 – Партия 1“ 1;2;“Кандидат 2 в МИР 1 – Партия 1“ 1;1000;“Независим кандидат 1 в МИР 1“ 2;1001;“Независим кандидат 1 в МИР 2“
Example #1
0
 public bool Equals(Candidate otherObj)
 {
     return otherObj.MirId == this.MirId
             && otherObj.PartyId == this.PartyId
             && otherObj.PartyType == this.PartyType
             && otherObj.Name == this.Name;
 }
 public void Parse_Candidate_From_String_Test()
 {
     string recordLine = "7;2;\"К7 на П2 в МИР7\""; // TODO: Initialize to an appropriate value
     //7;2;"К7 на П2 в МИР7"
     //7;3;"К1 на П3 в МИР7"
     Candidate expected = new Candidate(7, 2, "\"К7 на П2 в МИР7\""); // TODO: Initialize to an appropriate value
     Candidate actual;
     actual = InputParsers.ParseCandidateFromString(recordLine);
     Assert.AreEqual(expected, actual);
 }
Example #3
0
        /// <summary>
        /// Parsing line from Candidates.txt
        /// ex:
        /// Mir/Party/Sequence num/name
        /// 1;1;1;“Кандидат 1 в МИР 1 – Партия 1“
        /// 1;1;2;“Кандидат 2 в МИР 1 – Партия 1“
        /// </summary>
        /// <param name="recordLine"></param>
        /// <returns></returns>
        public static Candidate ParseCandidateFromString(string recordLine)
        {
            if (string.IsNullOrEmpty(recordLine))
            {
                throw new ArgumentNullException();
            }

            var propValues = recordLine.Split(SEPARATOR);

            var item = new Candidate(
                                mirId: int.Parse(propValues[0]),
                                partyId: int.Parse(propValues[1]),
                                name: propValues[2]
                            );

            return item;
        }