public void DismissFromMyWork() { // wait for elastic search to update created entities Thread.Sleep(30000); Run(async() => { var viewModel = new OctaneMyItemsViewModel(); List <BaseEntity> searchedEntities = (List <BaseEntity>) await OctaneServices.GetInstance().SearchEntities(_dismissedStory.Id, 1); if (searchedEntities.Count != 1) { Assert.Fail("Failed to search created story by id"); } await MyWorkUtils.AddToMyWork(searchedEntities[0]); await viewModel.LoadMyItemsAsync(); var searchedMyWorkItem = viewModel.MyItems.ToList().Find(ui => ui.ID.Equals(_dismissedStory.Id)); Assert.IsTrue(searchedMyWorkItem.ID.Equals(_dismissedStory.Id)); await MyWorkUtils.RemoveFromMyWork(searchedMyWorkItem.Entity); await viewModel.LoadMyItemsAsync(); searchedMyWorkItem = viewModel.MyItems.ToList().Find(ui => ui.ID.Equals(_dismissedStory.Id)); Assert.IsTrue(searchedMyWorkItem == null); }).Wait(); }
public async static void AddToMyWork(BaseEntity entity) { if (entity == null) { return; } try { await MyWorkUtils.AddToMyWork(entity); MessageBox.Show("Added backlog item: " + entity.GetStringValue("name") + " to \"My Work\" ", ToolWindowHelper.AppName, MessageBoxButton.OK, MessageBoxImage.Information); await OctaneMyItemsViewModel.Instance.LoadMyItemsAsync(); } catch (Exception ex) { MessageBox.Show("Unable to add item to my work.\n\n" + "Failed with message: " + ex.Message, ToolWindowHelper.AppName, MessageBoxButton.OK, MessageBoxImage.Error); } }