public async Task StudentsNotNullAfterStudentsSearchPageNavigatedToTest() { var _azureService = new MockAzureService(); var app = new App(_azureService); var viewModel = new StudentsSearchPageViewModel(null, null); await _azureService.SyncOfflineCacheAsync(); var group = new StudentGroup(); var navigationParams = new NavigationParameters { { "model", group } }; viewModel.OnNavigatingTo(navigationParams); Assert.NotNull(viewModel.Students); }
public async Task StudentsNotNullAfterStudentsManagingPageNavigatedToTest() { var _azureService = new MockAzureService(); var app = new App(_azureService); var viewModel = new StudentsSearchPageViewModel(null, null); await _azureService.SyncOfflineCacheAsync(); var group = (await(await _azureService.GetTableAsync <StudentGroup>()) .Where(s => s.Name == "Group1")) .FirstOrDefault(); var navigationParams = new NavigationParameters { { "model", group } }; viewModel.OnNavigatingTo(navigationParams); Assert.NotNull(viewModel.Students); }
public async Task StudentAddedInStudentsSearchPageTest() { var _azureService = new MockAzureService(); var _dialogService = new MockPageDialogService(); var app = new App(_azureService); var viewModel = new StudentsSearchPageViewModel(null, _dialogService); await _azureService.SyncOfflineCacheAsync(); var group = (await(await _azureService.GetTableAsync <StudentGroup>()) .Where(s => s.Name == "Group2")) .FirstOrDefault(); var navigationParams = new NavigationParameters { { "model", group } }; viewModel.OnNavigatingTo(navigationParams); var groupBefore = (await(await _azureService.GetTableAsync <User>()) .Where(s => s.StudentGroup_Id == group.Id)) .Count; var student = (await(await _azureService.GetTableAsync <User>()) .Where(s => s.FirstName == "C" && s.LastName == "C")) .FirstOrDefault(); viewModel.StudentSelected = student; viewModel.AddStudent.Execute(); var groupAfter = (await(await _azureService.GetTableAsync <User>()) .Where(s => s.StudentGroup_Id == group.Id)) .Count; Assert.IsTrue(groupAfter == groupBefore + 1); }