public void Discovers_types_directly_or_implicitly() { var assemblies = new List<Assembly> {GetType().Assembly}; var assemblySource = new Mock<IAssemblySource>(); assemblySource.SetupGet(source => source.Assemblies).Returns(assemblies); var typeSource = new TypeSource(assemblySource.Object); var results = typeSource .Implementing<ITestTypeDiscoveryInterface>() .ToList(); Assert.AreEqual(2, results.Count); Assert.IsTrue(typeof(ITestTypeDiscoveryInterface).IsAssignableFrom(results.First())); Assert.IsTrue(typeof(ITestTypeDiscoveryInterface).IsAssignableFrom(results.Last())); }
public void Can_pass_desired_type_instead_of_using_generics() { var assemblies = new List<Assembly> { GetType().Assembly }; var assemblySource = new Mock<IAssemblySource>(); assemblySource.SetupGet(source => source.Assemblies).Returns(assemblies); var typeSource = new TypeSource(assemblySource.Object); var results = typeSource .Implementing(typeof(ITestTypeDiscoveryInterface)) .ToList(); Assert.AreEqual(2, results.Count); Assert.IsTrue(typeof(ITestTypeDiscoveryInterface).IsAssignableFrom(results.First())); Assert.IsTrue(typeof(ITestTypeDiscoveryInterface).IsAssignableFrom(results.Last())); }