public List<Skill> GetSkillsFromSkillList(string skills) { List<Skill> list = new List<Skill>(); char[] delimiterChars = { ',' }; string[] skillList = skills.Split(delimiterChars); foreach (string s in skillList) { Skill item = new Skill(); item = GetSkillBySkillName(s.Trim()); list.Add(item); } return list; }
public void GetSkillBySkillName_GetActualSkillByName() { //Arrange string skillName = "Twin Slash"; Skill expected = new Skill{ CanPassDown =true, Description = "Deals light Cut damage to one foe (2 hits)", Cost = "18 HP", Name ="Twin Slash", SkillType =SkillInheritanceType.Physical, Type ="Cut"}; //Act var result = model.GetSkillBySkillName(skillName); //Assert Assert.IsNotNull(result); Assert.AreEqual<Skill>(expected, result); }
protected List<Skill> BuildSkillList(StreamReader reader) { List<Skill> list = new List<Skill>(); using (TextReader textReader = reader) { var csv = new CsvReader(textReader); while (csv.Read()) { Skill skill = new Skill(); skill.CanPassDown = (csv.GetField<string>("Heritable") == "X") ? true : false; skill.Cost = csv.GetField<string>("Cost"); skill.Description = csv.GetField<string>("Description"); skill.Name = csv.GetField<string>("Skill"); skill.SkillType = (SkillInheritanceType)Enum.Parse(typeof(SkillInheritanceType), csv.GetField<string>("InheritanceType")); skill.Type = csv.GetField<string>("Type"); list.Add(skill); } } return list; }