/// <summary>
        ///     Initializes a new instance of the <see cref="HigherUnitDecorator" /> class.
        /// </summary>
        /// <param name="higherUnit">The unit this decorater wraps.</param>
        /// <param name="decoratorService">The <see cref="IDecoratorService" />.</param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="higherUnit" /> or <paramref name="decoratorService" />is a null
        ///     reference.
        /// </exception>
        public HigherUnitDecorator(HigherUnit higherUnit, IDecoratorService decoratorService)
        {
            Contract.Requires <ArgumentNullException>(higherUnit != null);
            Contract.Requires <ArgumentNullException>(decoratorService != null);

            this._decoratorService = decoratorService;

            Name          = higherUnit.Name;
            base.Superior = higherUnit.Superior;

            foreach (var subordinate in higherUnit.Subordinates)
            {
                base.AddSubordinate(this._decoratorService.Decorate(subordinate));
            }

            this._subordinatesView = CollectionViewSource.GetDefaultView(base.Subordinates) as ListCollectionView;

            Contract.Assert(this._subordinatesView != null);

            this._subordinatesView.CustomSort = new UnitComparer();
        }
 /// <summary>
 ///     Decorates the specified <see cref="HigherUnit" />.
 /// </summary>
 /// <param name="higherUnit">The <see cref="HigherUnit" />.</param>
 /// <returns>The decorated <see cref="HigherUnit" />.</returns>
 public HigherUnitDecorator Decorate(HigherUnit higherUnit)
 {
     return (higherUnit != null) ? new HigherUnitDecorator(higherUnit, this) : null;
 }
 /// <summary>
 ///     Decorates the specified <see cref="HigherUnit" />.
 /// </summary>
 /// <param name="higherUnit">The <see cref="HigherUnit" />.</param>
 /// <returns>The decorated <see cref="HigherUnit" />.</returns>
 public HigherUnitDecorator Decorate(HigherUnit higherUnit)
 {
     return((higherUnit != null) ? new HigherUnitDecorator(higherUnit, this) : null);
 }