private void OnProjectChanged(object sender, EventArgs e) { if ((sender is Picker picker) && (picker.SelectedItem is Project project)) { viewModel.SetProjectOfWorkshift(project); } }
public void SetProjectOfWorkshift_NewViewModel_ProjectIsSet(int projectId) { // Arrange App.GenerateTestData().Wait(); var workshiftRepository = new WorkshiftRepository(); var projectRepository = new ProjectRepository(); var workshift = workshiftRepository.GetItemAsync(1).Result; viewModel = new AddWorkshiftViewModel(workshift); var project = projectRepository.GetItemAsync(projectId).Result; // Act viewModel.SetProjectOfWorkshift(project); // Assert Assert.Equal(projectId, viewModel.Item.ProjectId); }