Skip to content

Instantly share code, notes, and snippets.

@bittercoder
Created September 30, 2010 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bittercoder/605152 to your computer and use it in GitHub Desktop.
Save bittercoder/605152 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<>).GetInterfaces()
.Where(i=>i.IsGenericType)
.Select(i=>i.GetGenericTypeDefinition());
Because of =()=>
// What goes here to make the following assertion pass?
It the_useful_interface_is_extracted =()=>
_interfaces.ShouldContain( typeof(IUseful<>) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment