public static async Task ClassInitAsync(TestContext context)
        {
            app = new TestApplication();
            await app.InitializeAsync(context);

            await app.OpenAsync();

            userCategoryCollection = app.GetService(typeof(IUserCategoryCollection)) as IUserCategoryCollection;
        }
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(IUserCategoryCollection_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         categories     = cremaHost.GetService(typeof(IUserCategoryCollection)) as IUserCategoryCollection;
     });
 }
        public static async Task <IUserCategory[]> GenerateCategoriesAsync(this IUserCategoryCollection userCategoryCollection, Authentication authentication, int count)
        {
            var itemList = new List <IUserCategory>(count);

            for (var i = 0; i < count; i++)
            {
                var item = await userCategoryCollection.GenerateCategoryAsync(authentication);

                itemList.Add(item);
            }
            return(itemList.ToArray());
        }
        public static async Task <IUserCategory> GenerateCategoryAsync(this IUserCategoryCollection userCategoryCollection, Authentication authentication)
        {
            var category = RandomUtility.Within(50) == true ? userCategoryCollection.Root : await userCategoryCollection.GetRandomUserCategoryAsync();

            return(await category.AddNewCategoryAsync(authentication, RandomUtility.NextIdentifier()));
        }
 public static Task <IUserCategory> GetRandomUserCategoryAsync(this IUserCategoryCollection userCategoryCollection, Func <IUserCategory, bool> predicate)
 {
     return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.RandomOrDefault(predicate)));
 }
 public static Task <IUserCategory> GetRandomUserCategoryAsync(this IUserCategoryCollection userCategoryCollection)
 {
     return(GetRandomUserCategoryAsync(userCategoryCollection, DefaultPredicate));
 }
Exemple #7
0
 public static Task RemoveCategoriesDeletedEventHandlerAsync(this IUserCategoryCollection userCategoryCollection, ItemsDeletedEventHandler <IUserCategory> handler)
 {
     return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.CategoriesDeleted -= handler));
 }
Exemple #8
0
 public static Task AddCategoriesMovedEventHandlerAsync(this IUserCategoryCollection userCategoryCollection, ItemsMovedEventHandler <IUserCategory> handler)
 {
     return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.CategoriesMoved += handler));
 }
Exemple #9
0
 public static Task <IUserCategory[]> GetUserCategoriesAsync(this IUserCategoryCollection userCategoryCollection)
 {
     return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.ToArray()));
 }
Exemple #10
0
 public static Task <IUserCategory> GetUserCategoryAsync(this IUserCategoryCollection userCategoryCollection, string categoryPath)
 {
     return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection[categoryPath]));
 }
Exemple #11
0
 public static Task <bool> ContainsAsync(this IUserCategoryCollection userCategoryCollection, string categoryPath)
 {
     return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.Contains(categoryPath)));
 }