/// <summary> /// Gets the expertises from the details array /// </summary> /// <returns>A <see cref="ExpertiseCollection"/></returns> private static ExpertiseCollection ParseExpertises() { ExpertiseCollection expertiseCollection = new ExpertiseCollection(); var expertiseStrings = _contactDetails.Where(s => s.StartsWith("EXPERTISE;")); foreach (string expertiseStr in expertiseStrings) { string expertiseString = expertiseStr.Replace("EXPERTISE;", ""); expertiseString = expertiseString.Replace("LEVEL=", ""); Expertise expertise = new Expertise(); if (expertiseString.StartsWith("HIGH") || expertiseString.StartsWith("high")) { expertise.Level = Level.High; expertise.Area = expertiseString.Replace("HIGH:", "").Replace("high:", "").Trim(); expertiseCollection.Add(expertise); } else if (expertiseString.StartsWith("MEDIUM") || expertiseString.StartsWith("medium")) { expertise.Level = Level.Medium; expertise.Area = expertiseString.Replace("MEDIUM:", "").Replace("medium:", "").Trim(); expertiseCollection.Add(expertise); } else if (expertiseString.StartsWith("LOW") || expertiseString.StartsWith("low")) { expertise.Level = Level.Low; expertise.Area = expertiseString.Replace("LOW:", "").Replace("low:", "").Trim(); expertiseCollection.Add(expertise); } } return(expertiseCollection); }
public void InsertAndRemove() { Assert.DoesNotThrow(delegate { Expertise expertise = new Expertise(); ExpertiseCollection expertiseCollection = new ExpertiseCollection(); expertiseCollection.Add(expertise); expertise = expertiseCollection[0]; expertiseCollection[0] = expertise; expertiseCollection.Remove(expertise); }); }
public void InsertAndRemoveNonExistentIndices() { ExpertiseCollection expertiseCollection = new ExpertiseCollection(); Assert.Throws <IndexOutOfRangeException>(delegate { var expertise_ = expertiseCollection[0]; }); var expertise = new Expertise(); Assert.Throws <IndexOutOfRangeException>(delegate { expertiseCollection[0] = expertise; }); }