/// <summary> /// Compacts the path so it only contains the elements that are from /// the namespace of the last element in the path. /// </summary> /// <remarks>This method is used when we need to know the path for a /// particular namespace and do not care about the complete path. /// </remarks> public void Compact() { if (_elements.HasItems) { var lastName = Elements.GetLast(); var index = LastIndexNotMatchingNamespace(lastName.Namespace); if (index != -1) { _elements.RemoveFirst(index + 1); } } }
public void RemoveFirstItemFromEmptyCollectionDoesNotThrowArgumentOutOfRangeException() { qualifiedNameCollection = new QualifiedNameCollection(); Assert.DoesNotThrow(delegate { qualifiedNameCollection.RemoveFirst(); }); }
public void RemoveFirstItemFromCollectionRemovesFirstName() { qualifiedNameCollection.RemoveFirst(); Assert.AreSame(secondName, qualifiedNameCollection[0]); }