public void AreInTheSameNamespaceAndSubnamespaceGeneric() { Func <Type, bool> sameNamespace = TypesThat.AreInTheSameNamespaceAs <IRpcApi>(true); Assert.True(sameNamespace(typeof(TypesThat))); Assert.False(sameNamespace(GetType())); }
public void AreInTheSameNamespace() { Func <Type, bool> sameNamespace = TypesThat.AreInTheSameNamespaceAs(typeof(IRpcApi)); Assert.True(sameNamespace(typeof(TypesThat))); Assert.False(sameNamespace(GetType())); }
/// <summary> /// Expose types in the same assembly and namespace as T /// </summary> /// <typeparam name="T"></typeparam> /// <param name="configuration"></param> /// <param name="includeSubnamespaces"></param> /// <returns></returns> public static ITypeSetExposureConfiguration ExposeNamespaceContaining <T>(this IRpcApi configuration, bool includeSubnamespaces = true) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } return(configuration.Expose(typeof(T).GetTypeInfo().Assembly.ExportedTypes.Where(TypesThat.AreInTheSameNamespaceAs <T>(includeSubnamespaces)))); }