Exemplo n.º 1
0
        public async Task UserCantAddListTest()
        {
            var mockTodoListDataService = new MockTodoListDataService();
            var mockUserDataService     = new MockUserDataService();
            var mockGroupDataService    = new MockGroupDataService();
            var mockRoleTypeDataService = new MockRoleTypeDataServiceNegative();
            var mockNavigationService   = new MockNavigationService();
            var todoListViewModel       = new ToDoListsViewModel(mockTodoListDataService, mockUserDataService,
                                                                 mockGroupDataService, mockNavigationService, mockRoleTypeDataService);

            todoListViewModel.ListTitle = "test list4";
            Task.Factory.StartNew(() => todoListViewModel.AddNewItemCommand.Execute(null)).Wait();
            Assert.AreEqual(3, todoListViewModel.TodoLists.Count);
        }
Exemplo n.º 2
0
        public async Task UserCantDeleteTaskTest()
        {
            var mockUserDataService         = new MockUserDataService();
            var mockRoleTypeDataService     = new MockRoleTypeDataServiceNegative();
            var mockNavigationService       = new MockNavigationService();
            var mockTaskItemDataService     = new MockTaskItemDataService();
            var mockTaskSubitemDataServcice = new MockTaskSubitemDataService();

            var tasksListViewModel = new TasksListViewModel(mockNavigationService, mockTaskItemDataService,
                                                            mockUserDataService, mockRoleTypeDataService, mockTaskSubitemDataServcice);
            await tasksListViewModel.Refresh();

            int totalTaskItems = tasksListViewModel.TaskItems.Count;
            var taskItem       = tasksListViewModel.TaskItems.First();

            taskItem.IsCompleted = true;
            await Task.Factory.StartNew(() => tasksListViewModel.DeleteCompletedCommand.Execute(null));

            await Task.Delay(TimeSpan.FromSeconds(15));

            Assert.AreEqual(totalTaskItems, tasksListViewModel.TaskItems.Count);
        }