public void AttributeSection() { AttributeSection inter = new AttributeSection(controller); inter.Target = ""; Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
/// <summary> /// Safely removes an attribue from it's section (removes empty sections). /// </summary> /// <param name="attr">The attribute to be removed.</param> public void RemoveAttribute(Attribute attr) { AttributeSection section = (AttributeSection)attr.Parent; if (section.Attributes.Count == 1) { Remove(section); return; } var newSection = (AttributeSection)section.Clone(); int i = 0; foreach (var a in section.Attributes) { if (a == attr) { break; } i++; } newSection.Attributes.Remove(newSection.Attributes.ElementAt(i)); Replace(section, newSection); }