/// <summary> /// Creates a new sorted inserter using the specified sorting configuration. /// </summary> /// <param name="elementType">Type of the element.</param> /// <param name="sortBy">The sort by.</param> public SortedInserter(ElementType elementType, SortBy sortBy) { if (sortBy == null) { throw new ArgumentNullException("sortBy"); } _elementType = elementType; _sortBy = sortBy.Clone() as SortBy; }
public void CloneTest() { SortBy sortBy = new SortBy(); sortBy.By = ElementAttributeType.Name; sortBy.Direction = SortDirection.Descending; SortBy innerSortBy = new SortBy(); innerSortBy.By = ElementAttributeType.Type; innerSortBy.Direction = SortDirection.Ascending; sortBy.InnerSortBy = innerSortBy; SortBy clone = sortBy.Clone() as SortBy; Assert.AreEqual(sortBy.By, clone.By, "By was not copied correctly"); Assert.AreEqual(sortBy.Direction, clone.Direction, "Direction was not copied correctly"); Assert.IsNotNull(clone.InnerSortBy, "InnerSortBy was not copied correctly"); Assert.AreEqual(sortBy.InnerSortBy.By, clone.InnerSortBy.By, "InnerSortBy was not copied correctly"); Assert.AreEqual(sortBy.InnerSortBy.Direction, clone.InnerSortBy.Direction, "InnerSortBy was not copied correctly"); }