예제 #1
0
 public void DestroyMarkersDummyData(IMarkerService markerService, params string[] ids)
 {
     foreach (var id in ids)
     {
         markerService.DeleteMarker(new DeleteMarkerRequest {
             MarkerId = id
         });
     }
 }
        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());
        }
        public IActionResult DeleteMarker(Guid markerId)
        {
            var response = _markerService.DeleteMarker(markerId, Requestor.User.Id);

            return(response.GetActionResult <Business.Models.Marker.Marker, Marker>(this));
        }
 public Response DeleteMarkerById([FromBody] DeleteMarkerRequest request)
 {
     return(_markerService.DeleteMarker(request));
 }