public void RemoveSpecialtyEntriesWithAliases_Test01() { List <SpecialtyAliasAndType> specialtiesAliasesAndTypes = new List <SpecialtyAliasAndType>(); int index; //No specialty entries specialtiesAliasesAndTypes.Add(new SpecialtyAliasAndType { Alias = "a1", EntryType = EntryTypes.Alias, Specialty = "sp1" }); specialtiesAliasesAndTypes.Add(new SpecialtyAliasAndType { Alias = "a2", EntryType = EntryTypes.Alias, Specialty = "sp1" }); specialtiesAliasesAndTypes.Add(new SpecialtyAliasAndType { Alias = "su1", EntryType = EntryTypes.Subspecialty, Specialty = "sp1" }); specialtiesAliasesAndTypes = Specialties.RemoveSpecialtyEntriesWithAliases(specialtiesAliasesAndTypes); Assert.AreEqual(3, specialtiesAliasesAndTypes.Count); index = 0; Assert.AreEqual("a1", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Alias, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("a2", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Alias, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("su1", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Subspecialty, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); //Specialty entry on its own. specialtiesAliasesAndTypes.Add(new SpecialtyAliasAndType { Alias = "sp2", EntryType = EntryTypes.Specialty, Specialty = null }); specialtiesAliasesAndTypes = Specialties.RemoveSpecialtyEntriesWithAliases(specialtiesAliasesAndTypes); Assert.AreEqual(4, specialtiesAliasesAndTypes.Count); index = 0; Assert.AreEqual("a1", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Alias, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("a2", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Alias, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("su1", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Subspecialty, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("sp2", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Specialty, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual(null, specialtiesAliasesAndTypes[index].Specialty); //Specialty entry with one or more aliases. specialtiesAliasesAndTypes.Add(new SpecialtyAliasAndType { Alias = "sp1", EntryType = EntryTypes.Specialty, Specialty = null }); specialtiesAliasesAndTypes = Specialties.RemoveSpecialtyEntriesWithAliases(specialtiesAliasesAndTypes); Assert.AreEqual(4, specialtiesAliasesAndTypes.Count); index = 0; Assert.AreEqual("a1", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Alias, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("a2", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Alias, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("su1", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Subspecialty, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual("sp1", specialtiesAliasesAndTypes[index].Specialty); index++; Assert.AreEqual("sp2", specialtiesAliasesAndTypes[index].Alias); Assert.AreEqual(EntryTypes.Specialty, specialtiesAliasesAndTypes[index].EntryType); Assert.AreEqual(null, specialtiesAliasesAndTypes[index].Specialty); }