private static async void BuiltInStorageTests(List <PublicTopic> firstTopics) { PhotosRepository repo = new PhotosRepository(); var topicNames = firstTopics.Select(x => x.Title); Parallel.Invoke( () => { if (!TheAppContext.IsTravisCI) { repo.CreateTopics(topicNames); } }, () => { /* * Parallel.ForEach(topicsWithBlobs, (topicWithBlobs) => * { * var idContentList = topicWithBlobs.Blobs.Select(x => x.IdContent).ToList(); * repo.CreateContent(idContentList); * Console.WriteLine($"Saved {idContentList.Count} related blobs of Topic: {topicWithBlobs.Title}"); * }); */ }); var topics = new[] { "One Topic", "Another Topic" }; var totalActions = new List <Action>(); foreach (var topic_ in topics) { var topic = topic_; Action[] actions = new Action[] { () => repo.AddUserAction(topic, "Tester", "Disliked-content", UserAction.Dislike), () => repo.AddUserAction(topic, "Tester", "Liked-content", UserAction.Like), () => repo.AddUserAction(topic, "Another Tester", "Liked-content", UserAction.Like), () => repo.AddUserAction(topic, "Tester", "Starred-content", UserAction.Star), () => repo.AddUserAction(topic, "Tester", "Shared-content", UserAction.Share), () => { repo.AddUserAction(topic, "Tester", "Double-Liked-content", UserAction.Like); repo.AddUserAction(topic, "Tester", "Double-Liked-content", UserAction.Like); }, () => { repo.AddUserAction(topic, "Tester", "Liked-and-then-Disliked-content", UserAction.Like); repo.AddUserAction(topic, "Tester", "Liked-and-then-Disliked-content", UserAction.Dislike); }, () => { repo.AddUserAction(topic, "Tester", "Disliked-and-then-Liked-content", UserAction.Dislike); repo.AddUserAction(topic, "Tester", "Disliked-and-then-Liked-content", UserAction.Like); }, }; totalActions.AddRange(actions); } var numThreads = totalActions.Count; ParallelOptions opts = new ParallelOptions() { MaxDegreeOfParallelism = numThreads }; Parallel.ForEach(totalActions, opts, (a) => { try { a(); } catch { } }); try { repo.GetUserPhotosByTopic("One Topic", "Tester"); Stopwatch sw = Stopwatch.StartNew(); var byUser = await repo.GetUserPhotosByTopic("One Topic", "Tester"); Console.WriteLine($"Marks retrieved in {sw.Elapsed}:"); foreach (var userPhoto in byUser) { Console.WriteLine(" " + userPhoto.Value.ToDebugString()); } } catch (Exception ex) { Console.WriteLine("TEST FAILED: repo.GetUserPhotosByTopic(\"One Topic\", \"Tester\");"); Console.WriteLine(ex); } }