Ejemplo n.º 1
0
        public async Task Indexer_Arg0_Nonexistent_FailTestAsync()
        {
            var typeCollection = typeContext.GetService(typeof(ITypeCollection)) as ITypeCollection;
            var typeID         = await typeCollection.GenerateNewTypeNameAsync();

            await typeContext.Dispatcher.InvokeAsync(() => typeContext[typeID]);
        }
Ejemplo n.º 2
0
        public static async Task GenerateStandardAsync(this ITypeContext typeContext, Authentication authentication)
        {
            if (typeContext.GetService(typeof(ITypeCategoryCollection)) is ITypeCategoryCollection typeCategoryCollection)
            {
                var root = typeCategoryCollection.Root;
                {
                    await root.GenerateStandardTypeAsync(authentication);

                    await root.GenerateStandardFlagsAsync(authentication);
                }
                var category = await root.AddNewCategoryAsync(authentication);

                {
                    await category.GenerateStandardTypeAsync(authentication);

                    await category.GenerateStandardFlagsAsync(authentication);
                }
                var subCategory = await category.AddNewCategoryAsync(authentication);

                {
                    await subCategory.GenerateStandardTypeAsync(authentication);

                    await subCategory.GenerateStandardFlagsAsync(authentication);
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 3
0
 public static Task <ITypeCategory[]> GetTypeCategoriesAsync(this ITypeContext typeContext)
 {
     if (typeContext.GetService(typeof(ITypeCategoryCollection)) is ITypeCategoryCollection typeCategoryCollection)
     {
         return(typeCategoryCollection.GetCategoriesAsync());
     }
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
 public static Task <ITypeCategory> GetTypeCategoryAsync(this ITypeContext typeContext, string categoryPath)
 {
     if (typeContext.GetService(typeof(ITypeCategoryCollection)) is ITypeCategoryCollection typeCategoryCollection)
     {
         return(typeCategoryCollection.GetCategoryAsync(categoryPath));
     }
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
 public static Task <IType> GetTypeAsync(this ITypeContext typeContext, string typeName)
 {
     if (typeContext.GetService(typeof(ITypeCollection)) is ITypeCollection typeCollection)
     {
         return(typeCollection.GetTypeAsync(typeName));
     }
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 public static async Task <ITypeItem> GenerateAsync(this ITypeContext typeContext, Authentication authentication)
 {
     if (RandomUtility.Within(25) == true)
     {
         if (typeContext.GetService(typeof(ITypeCategoryCollection)) is ITypeCategoryCollection typeCategoryCollection)
         {
             return((await typeCategoryCollection.GenerateCategoryAsync(authentication)) as ITypeItem);
         }
     }
     else
     {
         if (typeContext.GetService(typeof(ITypeCollection)) is ITypeCollection typeCollection)
         {
             return((await typeCollection.GenerateTypeAsync(authentication)) as ITypeItem);
         }
     }
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
        public static async Task <IType> AddRandomTypeAsync(this ITypeContext typeContext, Authentication authentication)
        {
            if (typeContext.GetService(typeof(ITypeCategoryCollection)) is ITypeCategoryCollection typeCategoryCollection)
            {
                var category = await typeCategoryCollection.GetRandomTypeCategoryAsync();

                return(await AddRandomTypeAsync(category, authentication));
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 8
0
        public static async Task AddRandomTypesAsync(this ITypeContext typeContext, Authentication authentication, DataBaseSettings settings)
        {
            var minCount       = settings.TypeContext.MinTypeCount;
            var maxCount       = settings.TypeContext.MaxTypeCount;
            var count          = RandomUtility.Next(minCount, maxCount);
            var typeCollection = typeContext.GetService(typeof(ITypeCollection)) as ITypeCollection;

            while (typeCollection.Count < count)
            {
                await AddRandomTypeAsync(typeContext, authentication);
            }
        }
Ejemplo n.º 9
0
        public static async Task <ITypeCategory> AddRandomCategoryAsync(this ITypeContext typeContext, Authentication authentication)
        {
            if (typeContext.GetService(typeof(ITypeCategoryCollection)) is ITypeCategoryCollection typeCategoryCollection)
            {
                var category = RandomUtility.Within(33) == true ? typeCategoryCollection.Root : await typeCategoryCollection.GetRandomTypeCategoryAsync();

                if (GetLevel(category, (i) => i.Parent) > 4)
                {
                    return(null);
                }
                return(await category.AddRandomCategoryAsync(authentication));
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 10
0
 public void GetService()
 {
     Console.Write(typeContext.GetService(typeof(ICremaHost)));
 }