public void GetTypes_ReturnsEmptyListIfNullAssemblies() { // Act ICollection <Type> actual = TypeUtilities.GetTypes(null, t => TypeUtilities.IsType <INotImplementedTestType>(t)); // Assert Assert.Empty(actual); }
public void GetTypes_ReturnsEmptyListIfNullAssemblyEntries() { // Arrange Assembly[] asms = new Assembly[4]; // Act ICollection <Type> actual = TypeUtilities.GetTypes(asms, t => TypeUtilities.IsType <INotImplementedTestType>(t)); // Assert Assert.Empty(actual); }
public void GetTypes_ReturnsEmptyIfNoneFound() { // Arrange Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies(); // Act ICollection <Type> actual = TypeUtilities.GetTypes(asms, t => TypeUtilities.IsType <INotImplementedTestType>(t)); // Assert Assert.Empty(actual); }
public void GetTypes_ReturnsExpectedTypes() { // Arrange Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies(); // Act ICollection <Type> actual = TypeUtilities.GetTypes(asms, t => TypeUtilities.IsType <ITestType>(t)); // Assert Assert.Equal(1, actual.Count); Assert.Equal(typeof(TestType), actual.Single()); }
public void GetInstances_CreatesExpectedInstances() { // Arrange var assemblies = AppDomain.CurrentDomain.GetAssemblies(); // Act var actual = TypeUtilities.GetInstances <ITestType>(assemblies, t => TypeUtilities.IsType <ITestType>(t)); // Assert Assert.Equal(1, actual.Count); Assert.IsType <TestType>(actual.Single()); }