MIR class from MIRs.txt 1;“МИР 1“;10 2;“МИР 2“;5 3;“Чужбина“;0
Beispiel #1
0
 public bool Equals(Mir otherMir)
 {
     return otherMir.Id == this.Id
             && otherMir.Name == this.Name
             && otherMir.MandatesLimit == this.MandatesLimit;
 }
Beispiel #2
0
 public bool Equals(Mir otherMir)
 {
     return(otherMir.Id == this.Id &&
            otherMir.Name == this.Name &&
            otherMir.MandatesLimit == this.MandatesLimit);
 }
        /// <summary>
        /// Parse Mir from Mirs.txt
        /// ex:
        /// 1;“МИР 1“;10
        /// 2;“МИР 2“;5
        /// 3;“Чужбина“;0
        /// </summary>
        /// <param name="recordLine"></param>
        /// <returns></returns>
        public static Mir ParseMirFromString(string recordLine)
        {
            if (string.IsNullOrEmpty(recordLine))
            {
                throw new ArgumentNullException();
            }

            var propValues = recordLine.Split(SEPARATOR);

            var item = new Mir(
                                id: int.Parse(propValues[0]),
                                name: propValues[1],//.Substring(1,propValues[1].Length-2),
                                mandatesLimit: int.Parse(propValues[2])
                            );

            return item;
        }
 public void Parse_Mir_From_String_Test_1()
 {
     string recordLine = @"1;“МИР 1“;10";
     // 2;“МИР 2“;5
     // 3;“Чужбина“;0";
     Mir expected = new Mir(1, @"“МИР 1“", 10); // TODO: Initialize to an appropriate value
     Mir actual;
     actual = InputParsers.ParseMirFromString(recordLine);
     Assert.AreEqual(expected, actual);
 }