예제 #1
0
        public void GetAllTodoListsTest()
        {
            var mockTodoListDataService = new MockTodoListDataService();
            var mockUserDataService     = new MockUserDataService();
            var mockGroupDataService    = new MockGroupDataService();
            var mockRoleTypeDataService = new MockRoleTypeDataService();
            var mockNavigationService   = new MockNavigationService();
            var todoListViewModel       = new ToDoListsViewModel(mockTodoListDataService, mockUserDataService,
                                                                 mockGroupDataService, mockNavigationService, mockRoleTypeDataService);

            Assert.AreEqual(3, todoListViewModel.TodoLists.Count);
        }
예제 #2
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);
        }
예제 #3
0
        public async Task UserCanAddListTest()
        {
            var mockTodoListDataService = new MockTodoListDataService();
            var mockUserDataService     = new MockUserDataService();
            var mockGroupDataService    = new MockGroupDataService();
            var mockRoleTypeDataService = new MockRoleTypeDataService();
            var mockNavigationService   = new MockNavigationService();
            var todoListViewModel       = new ToDoListsViewModel(mockTodoListDataService, mockUserDataService,
                                                                 mockGroupDataService, mockNavigationService, mockRoleTypeDataService);

            todoListViewModel.ListTitle = "test list4";
            await Task.Factory.StartNew(() => todoListViewModel.AddNewItemCommand.Execute(null));

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

            Assert.AreEqual(4, todoListViewModel.TodoLists.Count);
        }
예제 #4
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);
        }