Ejemplo n.º 1
0
        public async Task GetAllTaskItemsTest()
        {
            var mockUserDataService         = new MockUserDataService();
            var mockRoleTypeDataService     = new MockRoleTypeDataService();
            var mockNavigationService       = new MockNavigationService();
            var mockTaskItemDataService     = new MockTaskItemDataService();
            var mockTaskSubitemDataServcice = new MockTaskSubitemDataService();

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

            Assert.AreEqual(4, tasksListViewModel.TaskItems.Count);
        }
Ejemplo n.º 2
0
        public async Task UserCanDeleteTaskTest()
        {
            var mockUserDataService         = new MockUserDataService();
            var mockRoleTypeDataService     = new MockRoleTypeDataService();
            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 - 1, tasksListViewModel.TaskItems.Count);
        }