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)); }
public static Task RemoveCategoriesDeletedEventHandlerAsync(this IUserCategoryCollection userCategoryCollection, ItemsDeletedEventHandler <IUserCategory> handler) { return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.CategoriesDeleted -= handler)); }
public static Task AddCategoriesMovedEventHandlerAsync(this IUserCategoryCollection userCategoryCollection, ItemsMovedEventHandler <IUserCategory> handler) { return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.CategoriesMoved += handler)); }
public static Task <IUserCategory[]> GetUserCategoriesAsync(this IUserCategoryCollection userCategoryCollection) { return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.ToArray())); }
public static Task <IUserCategory> GetUserCategoryAsync(this IUserCategoryCollection userCategoryCollection, string categoryPath) { return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection[categoryPath])); }
public static Task <bool> ContainsAsync(this IUserCategoryCollection userCategoryCollection, string categoryPath) { return(userCategoryCollection.Dispatcher.InvokeAsync(() => userCategoryCollection.Contains(categoryPath))); }