public void FindTheGapInTree2Test() { var root = new ClassTypeTree(new Type[] { typeof(A1), typeof(A2), typeof(A1B1C1D1) }); var match = root.Find(typeof(A1B1C1)); Assert.AreEqual(typeof(A1), match.Type); }
/// <summary> /// Initializes a new instance of the <see cref="SpatialTypeTree"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="selfType">Type of the this node.</param> /// <param name="types">The possible child types.</param> SpatialTypeTree(ClassTypeTree parent, Type selfType, IEnumerable <Type> types) : base(parent, selfType, types) { }
/// <summary> /// Creates a <see cref="ClassTypeTree"/> using the given values. This allows derived types of the /// <see cref="ClassTypeTree"/> to have their derived type be used for every node in the tree. /// </summary> /// <param name="parent">The parent node.</param> /// <param name="selfType">The type of this node.</param> /// <param name="types">All of the possible child nodes.</param> /// <returns> /// A <see cref="ClassTypeTree"/> using the given values. /// </returns> protected override ClassTypeTree CreateNode(ClassTypeTree parent, Type selfType, IEnumerable <Type> types) { return(new SpatialTypeTree(parent, selfType, types)); }
public void FindTheGapInTree2Test() { var root = new ClassTypeTree(new Type[] { typeof(A1), typeof(A2), typeof(A1B1C1D1) }); var match = root.Find(typeof(A1B1C1)); Assert.AreEqual(typeof(A1), match.Type); }