public void Create_Cached_Plugin_File() { var types = new[] { typeof(PluginManager), typeof(PluginManagerTests), typeof(UmbracoContext) }; var typeList1 = new PluginManager.TypeList(typeof(object), null); foreach (var type in types) { typeList1.Add(type); } _manager.AddTypeList(typeList1); _manager.WriteCache(); var plugins = _manager.TryGetCached(typeof(object), null); var diffType = _manager.TryGetCached(typeof(object), typeof(ObsoleteAttribute)); Assert.IsTrue(plugins.Success); //this will be false since there is no cache of that type resolution kind Assert.IsFalse(diffType.Success); Assert.AreEqual(3, plugins.Result.Count()); var shouldContain = types.Select(x => x.AssemblyQualifiedName); //ensure they are all found Assert.IsTrue(plugins.Result.ContainsAll(shouldContain)); }
public void TypeList_Resolves_Explicit_Types() { var types = new HashSet <PluginManager.TypeList>(); var propEditors = new PluginManager.TypeList(typeof(PropertyEditor), null); propEditors.Add(typeof(LabelPropertyEditor)); types.Add(propEditors); var found = types.SingleOrDefault(x => x.BaseType == typeof(PropertyEditor) && x.AttributeType == null); Assert.IsNotNull(found); //This should not find a type list of this type var shouldNotFind = types.SingleOrDefault(x => x.BaseType == typeof(IParameterEditor) && x.AttributeType == null); Assert.IsNull(shouldNotFind); }
public void TypeList_Resolves_Explicit_Types() { var types = new HashSet <PluginManager.TypeList>(); var propEditors = new PluginManager.TypeList <PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes); propEditors.AddType(typeof(LabelPropertyEditor)); types.Add(propEditors); var found = types.SingleOrDefault(x => x.IsTypeList <PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes)); Assert.IsNotNull(found); //This should not find a type list of this type var shouldNotFind = types.SingleOrDefault(x => x.IsTypeList <IParameterEditor>(PluginManager.TypeResolutionKind.FindAllTypes)); Assert.IsNull(shouldNotFind); }
public void TypeList_Resolves_Explicit_Types() { var types = new HashSet<PluginManager.TypeList>(); var propEditors = new PluginManager.TypeList<PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes); propEditors.AddType(typeof(LabelPropertyEditor)); types.Add(propEditors); var found = types.SingleOrDefault(x => x.IsTypeList<PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes)); Assert.IsNotNull(found); //This should not find a type list of this type var shouldNotFind = types.SingleOrDefault(x => x.IsTypeList<IParameterEditor>(PluginManager.TypeResolutionKind.FindAllTypes)); Assert.IsNull(shouldNotFind); }