public void TestDeleteMarkerInvalidId_DeleteMarkerResponseOkAndNoMarkerDeleted(string id) { var expectedType = typeof(DeleteMarkerResponseOk); const int dataCount = 5; //given a database with some markers var dummyData = _testUtilitiesImpl .CreateDummyMarkerData(_markerService, dataCount, _createdDocuments[0], _createdUsers[0]); var markerIdsBeforeDelete = ((GetMarkersResponseOk)_markerService.GetAllMarkers(_createdDocuments[0])) .Markers .Select(obj => obj.MarkerId) .ToArray(); //when we delete marker with non existing id var request = new DeleteMarkerRequest() { MarkerId = id }; var result = _markerService.DeleteMarker(request); //then we get a DeleteMarkerResponseOk //and no marker is deleted from the document var markerIdsAfterDelete = ((GetMarkersResponseOk)_markerService.GetAllMarkers(_createdDocuments[0])) .Markers .Select(obj => obj.MarkerId) .ToArray(); Assert.Multiple(() => { Assert.That(result, Is.TypeOf(expectedType)); Assert.That(markerIdsAfterDelete.Length, Is.EqualTo(markerIdsBeforeDelete.Length)); }); _testUtilitiesImpl.DestroyMarkersDummyData(_markerService, dummyData.ToArray()); }
async void ShowMarkersList() { _markersList = await _markerService.GetAllMarkers(); List <MarkerListViewItem> markersWithDistances = GetMarkersWithDistances(_markersList); // Create the ListView. _listView = new ListView { // Source of data items. ItemsSource = markersWithDistances, // Define template for displaying each item. // (Argument of DataTemplate constructor is called for // each item; it must return a Cell derivative.) ItemTemplate = new DataTemplate(() => { // Create views with bindings for displaying each property. Label nameLabel = new Label(); nameLabel.SetBinding(Label.TextProperty, "Marker.Title"); Label nodeIdLabel = new Label(); nodeIdLabel.SetBinding(Label.TextProperty, "DistanceAway"); /*nodeIdLabel.SetBinding(Label.TextProperty, * new Binding("DistanceAway", BindingMode.OneWay, * null, null, "Distance: {0}")); */ // Return an assembled ViewCell. return(new ViewCell { View = new StackLayout { Padding = new Thickness(0, 5), Orientation = StackOrientation.Horizontal, Children = { new StackLayout { VerticalOptions = LayoutOptions.Center, Spacing = 0, Children = { nameLabel, nodeIdLabel } } } } }); }) }; _listView.ItemTapped += async(sender, args) => { MarkerListViewItem marker = args.Item as MarkerListViewItem; if (marker == null) { return; } // TODO: Show marker detail screen //ShowMarkerLocation(marker.Title, "/?q=mobileapi/node/" + marker.NodeId); await Navigation.PushAsync(new MarkerInfoPage(marker.Marker)); _listView.SelectedItem = null; }; ContentGrid.Children.Add(_listView); }
public Response GetMarkers(string docId) { return(_markerService.GetAllMarkers(docId)); }