Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8577


Ignore:
Timestamp:
09/05/12 14:24:13 (12 years ago)
Author:
mkommend
Message:

#1923: Changed type discovery to return only generic types with exactly the same type parameter and adapted the unit test accordingly.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/TypeExtensions.cs

    r8571 r8577  
    110110
    111111        if (baseTypeGenericArgument.IsGenericParameter ^ subTypeGenericArgument.IsGenericParameter) return false;
    112         if (baseTypeGenericArgument.IsAssignableFrom(subTypeGenericArgument)) continue;
     112        if (baseTypeGenericArgument == subTypeGenericArgument) continue;
    113113        if (!baseTypeGenericArgument.IsGenericParameter && !subTypeGenericArgument.IsGenericParameter) return false;
    114114
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.PluginInfraStructure-3.3/TypeDiscoveryTest.cs

    r8571 r8577  
    4141      Assert.IsTrue(typeof(List<int>).IsSubTypeOf(typeof(IList)));
    4242      Assert.IsTrue(typeof(List<>).IsSubTypeOf(typeof(IList)));
     43      Assert.IsFalse(typeof(NamedItemCollection<>).IsSubTypeOf(typeof(ICollection<IItem>)));
     44      Assert.IsFalse(typeof(NamedItemCollection<>).IsSubTypeOf(typeof(ICollection<NamedItem>)));
    4345
    44       Assert.IsTrue(typeof(IList<IItem>).IsSubTypeOf(typeof(IList<IItem>)));
    45       Assert.IsTrue(typeof(List<IntValue>).IsSubTypeOf(typeof(IList<IItem>)));
    46       Assert.IsTrue(typeof(List<IntValue>).IsSubTypeOf(typeof(List<IItem>)));
     46
     47      Assert.IsTrue(typeof(List<IItem>).IsSubTypeOf(typeof(IList<IItem>)));
     48      Assert.IsFalse(typeof(IList<IntValue>).IsSubTypeOf(typeof(IList<IItem>)));
     49      Assert.IsTrue(typeof(List<IItem>).IsSubTypeOf(typeof(IList<IItem>)));
    4750      Assert.IsFalse(typeof(ItemList<>).IsSubTypeOf(typeof(IList<IItem>)));
    4851      Assert.IsFalse(typeof(ItemList<>).IsSubTypeOf(typeof(List<IItem>)));
Note: See TracChangeset for help on using the changeset viewer.