private void SetUp() { _locations = new List <Location> { new Location { Id = 1, Name = "Barcelona" }, new Location { Id = 2, Name = "Prague" }, new Location { Id = 3, Name = "Frankfurt" } }; _snapshotGroups = new List <SnapshotGroup> { new SnapshotGroup { Name = "December 2018" }, new SnapshotGroup { Name = "March 2019" } }; Task <IEnumerable <SnapshotGroup> > dataFetchOperation() { var tcs = new TaskCompletionSource <IEnumerable <SnapshotGroup> >(); tcs.SetResult(_snapshotGroups); return(tcs.Task); }; _snapshotDataService = Substitute.For <ILocationSnapshotDataService>(); _snapshotDataService.ChooseGroupByOperation(Arg.Any <GroupByCriteria>()) .Returns(dataFetchOperation); _locationDataService = Substitute.For <ILocationDataService>(); _locationDataService.GetAllLocationsAsync() .Returns(_ => { var tcs = new TaskCompletionSource <IEnumerable <Location> >(); tcs.SetResult(_locations); return(tcs.Task); }); _dialogService = Substitute.For <IDialogService>(); _dialogService.ShowConfirmationAsync(Arg.Any <string>()) .Returns(_ => { var tcs = new TaskCompletionSource <ConfirmationAnswer>(); tcs.SetResult(ConfirmationAnswer.OK); return(tcs.Task); }); _pictureService = Substitute.For <IPictureService>(); _locationDataImporter = Substitute.For <ILocationDataImporter>(); _dataSourceGovernor = Substitute.For <IDataSourceGovernor>(); _connectivityService = Substitute.For <IConnectivityService>(); _navigationService = Substitute.For <INavigationService>(); _platformSpecificActions = Substitute.For <IPlatformSpecificActions>(); }
public PropertiesViewModel(INavigationService navigationService, IAppSettingsProvider appSettingsProvider, IDataSourceGovernor dataSourceGovernor, IConnectivityService connectivityService, IDialogService dialogService) { _navigationService = navigationService; _appSettingsProvider = appSettingsProvider; _dataSourceGovernor = dataSourceGovernor; _connectivityService = connectivityService; _dialogService = dialogService; }
public LocationsViewModel(ILocationDataService locationDataService, ILocationSnapshotDataService locationSnapshotDataService, INavigationService navigationService, IDialogService dialogService, IPictureService pictureService, ILocationDataImporter locationDataImporter, IDataSourceGovernor dataSourceGovernor, IConnectivityService connectivityService, IPlatformSpecificActions platformSpecificActions) { _locationDataService = locationDataService; _locationSnapshotDataService = locationSnapshotDataService; _navigationService = navigationService; _dialogService = dialogService; _pictureService = pictureService; _locationDataImporter = locationDataImporter; _dataSourceGovernor = dataSourceGovernor; _connectivityService = connectivityService; _platformSpecificActions = platformSpecificActions; GroupByOptions = new List <GroupByCriteria> { GroupByCriteria.None, GroupByCriteria.CreatedDate, GroupByCriteria.Longitude, GroupByCriteria.Latitude, GroupByCriteria.Altitude }; SelectedLocations = new List <Location>(); GroupBy = GroupByCriteria.None; SelectionMode = SelectionMode.None; IsItemClickEnabled = true; IsInBrowseMode = true; IsInEditMode = false; IsInSelectMode = false; }