示例#1
0
        public void LoadFeaturesFromNamespace_Returns_An_Empty_Collection_When_Parameters_Are_Invalid1()
        {
            Assembly invalidAssembly      = null;
            var      validNamespaceSuffix = "ProjectType";
            var      loadedFeatures       = FeatureLoader.LoadFeaturesFromNamespace(invalidAssembly, validNamespaceSuffix);

            CollectionAssert.IsEmpty(loadedFeatures);
        }
示例#2
0
        public void LoadFeaturesFromNamespace_Returns_An_Empty_Collection_When_Parameters_Are_Invalid2()
        {
            var validAssembly          = Assembly.GetAssembly(typeof(AspNetMvcFeature));
            var invalidNamespaceSuffix = string.Empty;
            var loadedFeatures         = FeatureLoader.LoadFeaturesFromNamespace(validAssembly, invalidNamespaceSuffix);

            CollectionAssert.IsEmpty(loadedFeatures);
        }
示例#3
0
        public void LoadFeaturesFromNamespace_Loads_All_Features_In_Namespace()
        {
            var namespaceSuffix    = nameof(global::CTA.FeatureDetection.ProjectType.CompiledFeatures);
            var assembly           = Assembly.GetAssembly(typeof(AspNetMvcFeature));
            var loadedFeatures     = FeatureLoader.LoadFeaturesFromNamespace(assembly, namespaceSuffix);
            var loadedFeatureNames = loadedFeatures.Select(f => f.Name);

            var expectedFeatureNames = new[]
            {
                nameof(AspNetMvcFeature),
                nameof(AspNetWebApiFeature),
                nameof(AspNetCoreMvcFeature),
                nameof(AspNetCoreWebApiFeature),
                nameof(WebClassLibraryFeature)
            };

            CollectionAssert.AreEquivalent(expectedFeatureNames, loadedFeatureNames);
        }