// When item (map service) in Listbox is selected, construct service url private void MySvcTreeView_SelectedItemChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs <object> e) { if (e.NewValue != null) { if (_webclient.IsBusy) { _webclient.CancelAsync(); } // Clear layers and set Extent to null (reset spatial reference) MyMap.Layers.Clear(); MyMap.Extent = null; // Get the service item selected MySvc svc = e.NewValue as MySvc; // Construct the url to the map service string svcUrl = string.Format("{0}/{1}/{2}", _serverUri, svc.Name, svc.Type); IDictionary <string, string> svcParameters = new Dictionary <string, string>(); svcParameters.Add("f", "json"); // Pass the map service url as an user object for the handler _webclient.DownloadStringAsync(new Uri(svcUrl), svcParameters, ArcGISWebClient.HttpMethods.Auto, svcUrl); } }
public async Task DoBusinessLogic_If2ndObjectNotExist_ThrowException() { var _repoMock = new Mock <IMyRepo>() { }; var _connectorMock = new Mock <IMyConnectorClass>(); _repoMock.Setup(r => r.GetConnector()).Returns(_connectorMock.Object); var _svc = new MySvc(_repoMock.Object); // This should return an object _repoMock.Setup(r => r.GetObjectByIdAsync <Foo>(It.IsAny <int>(), _connectorMock.Object)) .ReturnsAsync(new Foo()); // This should return null _repoMock.Setup(r => r.GetObjectByIdAsync <Bar>(It.IsAny <int>(), _connectorMock.Object)) .ReturnsAsync((Bar)null); await _svc.DoBusinessLogic(0, 0); }