main
 1using jive;
 2using Machine.Specifications;
 3
 4namespace specs.unit.utility
 5{
 6  public class TypeExtensionsSpecs
 7  {
 8    [Subject(typeof (TypeExtensions))]
 9    public class when_getting_the_last_interface_for_a_type
10    {
11      It should_return_the_correct_one =
12        () => typeof (TestType).last_interface().should_be_equal_to(typeof (ITestType));
13    }
14
15    [Subject(typeof (TypeExtensions))]
16    public class when_getting_the_first_interface_for_a_type
17    {
18      It should_return_the_correct_one = () => typeof (TestType).first_interface().should_be_equal_to(typeof (IBase));
19    }
20
21    [Subject(typeof (TypeExtensions))]
22    public class when_checking_if_a_type_represents_a_generic_type_definition
23    {
24      It should_tell_the_truth = () =>
25      {
26        typeof (Registry<>).is_a_generic_type().should_be_true();
27        typeof (Registry<int>).is_a_generic_type().should_be_false();
28      };
29    }
30
31    public interface IBase {}
32
33    public class BaseType : IBase {}
34
35    public interface ITestType {}
36
37    public class TestType : BaseType, ITestType {}
38  }
39}