Skip to content

Commit

Permalink
Test updates and code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
asanchezr authored and devinleighsmith committed May 31, 2024
1 parent 462acb4 commit bf32c66
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
3 changes: 0 additions & 3 deletions source/backend/api/Services/DispositionFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Pims.Dal.Entities.Extensions;
using Pims.Dal.Entities.Models;
using Pims.Dal.Exceptions;
using Pims.Dal.Helpers;
using Pims.Dal.Helpers.Extensions;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
Expand All @@ -29,7 +28,6 @@ public class DispositionFileService : IDispositionFileService
private readonly IUserRepository _userRepository;
private readonly IDispositionFileRepository _dispositionFileRepository;
private readonly IDispositionFilePropertyRepository _dispositionFilePropertyRepository;
private readonly ICoordinateTransformService _coordinateService;
private readonly IPropertyRepository _propertyRepository;
private readonly IPropertyService _propertyService;
private readonly ILookupRepository _lookupRepository;
Expand All @@ -55,7 +53,6 @@ public DispositionFileService(
_logger = logger;
_dispositionFileRepository = dispositionFileRepository;
_dispositionFilePropertyRepository = dispositionFilePropertyRepository;
_coordinateService = coordinateService;
_propertyRepository = propertyRepository;
_propertyService = propertyService;
_lookupRepository = lookupRepository;
Expand Down
3 changes: 0 additions & 3 deletions source/backend/api/Services/LeaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Pims.Dal.Entities;
using Pims.Dal.Entities.Models;
using Pims.Dal.Exceptions;
using Pims.Dal.Helpers;
using Pims.Dal.Helpers.Extensions;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
Expand All @@ -24,7 +23,6 @@ public class LeaseService : BaseService, ILeaseService
private readonly ILogger _logger;
private readonly ILeaseRepository _leaseRepository;
private readonly IPropertyImprovementRepository _propertyImprovementRepository;
private readonly ICoordinateTransformService _coordinateService;
private readonly IPropertyRepository _propertyRepository;
private readonly IPropertyLeaseRepository _propertyLeaseRepository;
private readonly IEntityNoteRepository _entityNoteRepository;
Expand Down Expand Up @@ -53,7 +51,6 @@ public LeaseService(
_logger = logger;
_user = user;
_leaseRepository = leaseRepository;
_coordinateService = coordinateTransformService;
_propertyRepository = propertyRepository;
_propertyLeaseRepository = propertyLeaseRepository;
_entityNoteRepository = entityNoteRepository;
Expand Down
4 changes: 0 additions & 4 deletions source/backend/api/Services/ResearchFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
using System.Security.Claims;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Pims.Api.Models.CodeTypes;
using Pims.Core.Extensions;
using Pims.Dal.Entities;
using Pims.Dal.Entities.Models;
using Pims.Dal.Exceptions;
using Pims.Dal.Helpers;
using Pims.Dal.Helpers.Extensions;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
Expand All @@ -23,7 +21,6 @@ public class ResearchFileService : IResearchFileService
private readonly IResearchFileRepository _researchFileRepository;
private readonly IResearchFilePropertyRepository _researchFilePropertyRepository;
private readonly IPropertyRepository _propertyRepository;
private readonly ICoordinateTransformService _coordinateService;
private readonly ILookupRepository _lookupRepository;
private readonly IEntityNoteRepository _entityNoteRepository;
private readonly IPropertyService _propertyService;
Expand All @@ -44,7 +41,6 @@ public ResearchFileService(
_researchFileRepository = researchFileRepository;
_researchFilePropertyRepository = researchFilePropertyRepository;
_propertyRepository = propertyRepository;
_coordinateService = coordinateService;
_lookupRepository = lookupRepository;
_entityNoteRepository = entityNoteRepository;
_propertyService = propertyService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,19 @@ public void GetProperties_ByDispositionFileId_Success_Reproject()
var dispFile = EntityHelper.CreateDispositionFile();

var repository = this._helper.GetService<Mock<IDispositionFilePropertyRepository>>();
repository.Setup(x => x.GetPropertiesByDispositionFileId(It.IsAny<long>())).Returns(new List<PimsDispositionFileProperty>() { new PimsDispositionFileProperty() { Property = new PimsProperty() { Location = new Point(1, 1) } } });
var coordinateService = this._helper.GetService<Mock<ICoordinateTransformService>>();
coordinateService.Setup(x => x.TransformCoordinates(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<Coordinate>())).Returns(new Coordinate(1, 1));
repository.Setup(x => x.GetPropertiesByDispositionFileId(It.IsAny<long>()))
.Returns(new List<PimsDispositionFileProperty>() { new PimsDispositionFileProperty() { Property = new PimsProperty() { Location = new Point(1, 1) } } });

var propertyService = this._helper.GetService<Mock<IPropertyService>>();
propertyService.Setup(x => x.TransformAllPropertiesToLatLong(It.IsAny<List<PimsDispositionFileProperty>>()))
.Returns<List<PimsDispositionFileProperty>>(x => x);

// Act
var properties = service.GetProperties(1);

// Assert
repository.Verify(x => x.GetPropertiesByDispositionFileId(It.IsAny<long>()), Times.Once);
coordinateService.Verify(x => x.TransformCoordinates(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<Coordinate>()), Times.Once);
propertyService.Verify(x => x.TransformAllPropertiesToLatLong(It.IsAny<List<PimsDispositionFileProperty>>()), Times.Once);
properties.FirstOrDefault().Property.Location.Coordinates.Should().BeEquivalentTo(new Coordinate[] { new Coordinate(1, 1) });
}
#endregion
Expand Down
4 changes: 2 additions & 2 deletions source/frontend/src/features/mapSideBar/shared/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Polygon } from 'geojson';
import { MultiPolygon, Polygon } from 'geojson';

import { IMapProperty } from '@/components/propertySelector/models';
import { AreaUnitTypes } from '@/constants';
Expand Down Expand Up @@ -66,7 +66,7 @@ export class PropertyForm {
public pin?: string;
public latitude?: number;
public longitude?: number;
public polygon?: Polygon;
public polygon?: Polygon | MultiPolygon;
public planNumber?: string;
public name?: string;
public region?: number;
Expand Down
1 change: 1 addition & 0 deletions source/frontend/src/mocks/properties.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const getEmptyPropertyView = (): ApiGen_Concepts_PropertyView => ({
isActivePayableLease: false,
isReceivableLease: false,
isActiveReceivableLease: false,
historicalFileNumberStr: '',
});

export const getMockProperties: () => IProperty[] = () => [
Expand Down

0 comments on commit bf32c66

Please sign in to comment.