예제 #1
0
        public void AreInTheSameNamespaceAndSubnamespaceGeneric()
        {
            Func <Type, bool> sameNamespace = TypesThat.AreInTheSameNamespaceAs <IRpcApi>(true);

            Assert.True(sameNamespace(typeof(TypesThat)));

            Assert.False(sameNamespace(GetType()));
        }
예제 #2
0
        public void AreInTheSameNamespace()
        {
            Func <Type, bool> sameNamespace = TypesThat.AreInTheSameNamespaceAs(typeof(IRpcApi));

            Assert.True(sameNamespace(typeof(TypesThat)));

            Assert.False(sameNamespace(GetType()));
        }
예제 #3
0
        /// <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))));
        }