public void TestAllCropsLoaded() { //Arrange List <Crop> crops = null; ObservableCollection <Crop> expectedCrops = ListExtensions.ToObservableCollection(cropService.getAllCrops().Result); //Act var cropManagementViewModel = new CropSettingsViewModel(this.cropService, new NavigationService()); cropManagementViewModel.GetAllCrops(null); while (crops == null) { crops = cropManagementViewModel.CropList; } //Assert Assert.Equal(ListExtensions.ToObservableCollection(crops), expectedCrops); }
public async void GetAllCrops(object obj) { CropList = await cropService.getAllCrops(); }