コード例 #1
0
        public void StudentGroupsNotNullAfterStudentsPageNavigatedToTest()
        {
            var _azureService     = new MockAzureService();
            var app               = new App(_azureService);
            var studentsViewModel = new TeacherStudentsPageViewModel(null, null);

            studentsViewModel.OnNavigatingTo(null);

            Assert.NotNull(studentsViewModel.Groups);
        }
コード例 #2
0
        public async Task StudentGroupCreatedInStudentsPageTest()
        {
            var _azureService  = new MockAzureService();
            var _dialogService = new MockPageDialogService();
            var app            = new App(_azureService);


            var studentsViewModel = new TeacherStudentsPageViewModel(null, _dialogService);

            studentsViewModel.OnNavigatingTo(null);
            studentsViewModel.ExecuteCreateGroupCommand();

            var studentGroupsTable = await _azureService.GetTableAsync <StudentGroup>();

            var studentGroups = await studentGroupsTable.ReadAllItemsAsync();

            Assert.IsTrue(studentGroups.Count == 3);
        }
コード例 #3
0
        public async Task StudentGroupDeletedInStudentsPageTest()
        {
            var _azureService  = new MockAzureService();
            var _dialogService = new MockPageDialogService();
            var app            = new App(_azureService);

            var viewModel = new TeacherStudentsPageViewModel(null, _dialogService);

            viewModel.OnNavigatingTo(null);

            var studentGroupsTable = await _azureService.GetTableAsync <StudentGroup>();

            var groupToDelete = (await studentGroupsTable.Where(s => s.Name == "Group1")).FirstOrDefault();

            var studentGroupsBefore = (await studentGroupsTable.ReadAllItemsAsync()).Count;

            viewModel.DeleteGroupCommand.Execute(groupToDelete);
            var studentGroupsAfter = (await studentGroupsTable.ReadAllItemsAsync()).Count;

            Assert.AreEqual(studentGroupsBefore - 1, studentGroupsAfter);
        }