Skip to content

Instantly share code, notes, and snippets.

@joshrobb
Created September 30, 2010 12:04
Show Gist options
  • Save joshrobb/604468 to your computer and use it in GitHub Desktop.
Save joshrobb/604468 to your computer and use it in GitHub Desktop.
public abstract class Thing
{
}
public interface IMarker {}
public interface IUseful<T> : IMarker where T : Thing
{
T DoSomething();
}
public class Useful<T> : IUseful<T> where T : Thing
{
T DoSomething()
{
// ...
}
}
public class When_extracting_non_marker_interfaces
{
static Type[] _interfaces;
Establish context =()=>
_interfaces = typeof(Useful<>).GetGenericTypeDefinition().GetInterfaces();
Because of =()=> //nothing
It the_useful_interface_is_extracted =()=>
_interfaces.ShouldContain( typeof(IUseful<>).GetGenericTypeDefinition() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment