diff --git a/source/backend/api/Areas/Contacts/Controllers/SearchController.cs b/source/backend/api/Areas/Contacts/Controllers/SearchController.cs index a21fc05d2b..6daa70003c 100644 --- a/source/backend/api/Areas/Contacts/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Contacts/Controllers/SearchController.cs @@ -10,7 +10,6 @@ using Pims.Api.Policies; using Pims.Api.Services.Interfaces; using Pims.Dal.Entities.Models; -using Pims.Dal.Repositories; using Pims.Dal.Security; using Swashbuckle.AspNetCore.Annotations; diff --git a/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs b/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs index 4b22ea8693..eadd9e6202 100644 --- a/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs +++ b/source/backend/api/Areas/ExpropriationPayment/ExpropriationPaymentController.cs @@ -67,7 +67,7 @@ public IActionResult GetExpropriationPaymentById([FromRoute] long id) /// /// /// - /// Validate id matching + /// Validate id matching. [HttpPut("{id:long}")] [HasPermission(Permissions.AcquisitionFileEdit)] [Produces("application/json")] diff --git a/source/backend/api/Areas/Leases/Controllers/SearchController.cs b/source/backend/api/Areas/Leases/Controllers/SearchController.cs index 9fb40f17b2..5429d122ff 100644 --- a/source/backend/api/Areas/Leases/Controllers/SearchController.cs +++ b/source/backend/api/Areas/Leases/Controllers/SearchController.cs @@ -14,7 +14,6 @@ using Pims.Core.Json; using Pims.Dal.Entities.Models; using Pims.Dal.Security; -using Serilog.Core; using Swashbuckle.AspNetCore.Annotations; namespace Pims.Api.Areas.Lease.Controllers diff --git a/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs b/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs index b7609a6556..f11121a1dd 100644 --- a/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs +++ b/source/backend/api/Areas/Property/Controllers/PropertyContactController.cs @@ -60,14 +60,15 @@ public PropertyContactController(IPropertyRepository propertyRepository, IProper [TypeFilter(typeof(NullJsonResultFilter))] public IActionResult GetPropertyContacts(long propertyId) { - //var property = _propertyRepository.GetAllAssociationsById(propertyId); - - var propertyContacts = new List() { - new PropertyContactModel() { + // var property = _propertyRepository.GetAllAssociationsById(propertyId); + var propertyContacts = new List() + { + new PropertyContactModel() + { Id = 1, Person = new PersonModel() { Id = 1, FirstName = "John", Surname = "Doe" }, Purpose="Test Purpouse", - } + }, }; return new JsonResult(propertyContacts); diff --git a/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs b/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs index 9c7a87179b..76cd747d56 100644 --- a/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs +++ b/source/backend/api/Areas/Reports/Controllers/AcquisitionController.cs @@ -94,7 +94,7 @@ public IActionResult ExportAgreements([FromBody] AcquisitionReportFilterModel fi /// /// Exports compensation requisitions as Excel file. /// Include 'Accept' header to request the appropriate export - - /// ["application/application/vnd.ms-excel"] + /// ["application/application/vnd.ms-excel"]. /// /// /// The generated Excel file. diff --git a/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportModel.cs b/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportModel.cs index fac9d7800e..692e25cfb9 100644 --- a/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportModel.cs +++ b/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportModel.cs @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using System.Globalization; -using System.Linq; using System.Security.Claims; using Pims.Core.Extensions; using Pims.Dal.Entities; diff --git a/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportTotalsModel.cs b/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportTotalsModel.cs index d96727687f..41f9187fa0 100644 --- a/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportTotalsModel.cs +++ b/source/backend/api/Areas/Reports/Models/Acquisition/CompensationFinancialReportTotalsModel.cs @@ -122,6 +122,5 @@ private static void AddToProjectTotal(Dictionary dict, long proje dict.Add(projectId, financialValue); } } - } } diff --git a/source/backend/api/Constants/NoteType.cs b/source/backend/api/Constants/NoteType.cs index 41d473b748..558d771999 100644 --- a/source/backend/api/Constants/NoteType.cs +++ b/source/backend/api/Constants/NoteType.cs @@ -6,8 +6,6 @@ namespace Pims.Api.Constants [JsonConverter(typeof(JsonStringEnumMemberConverter))] public enum NoteType { - [EnumMember(Value = "activity")] - Activity, [EnumMember(Value = "acquisition_file")] Acquisition_File, [EnumMember(Value = "lease_file")] diff --git a/source/backend/api/Controllers/LookupController.cs b/source/backend/api/Controllers/LookupController.cs index efe11751fa..39616b7ea4 100644 --- a/source/backend/api/Controllers/LookupController.cs +++ b/source/backend/api/Controllers/LookupController.cs @@ -120,7 +120,6 @@ public IActionResult GetAll() var propertyResearchPurposeTypes = _mapper.Map(_lookupRepository.GetAllPropertyResearchPurposeTypes()); var propertyAnomalyTypes = _mapper.Map(_lookupRepository.GetAllPropertyAnomalyTypes()); var propertyRoadTypes = _mapper.Map(_lookupRepository.GetAllPropertyRoadTypes()); - //var propertyAdjacentLandTypes = _mapper.Map(_lookupRepository.GetAllPropertyAdjacentLandTypes()); var volumeUnitTypes = _mapper.Map(_lookupRepository.GetAllPropertyVolumeUnitTypes()); var propertyVolumetricTypes = _mapper.Map(_lookupRepository.GetAllPropertyVolumetricTypes()); var pphStatusType = _mapper.Map(_lookupRepository.GetAllPPHStatusType()); @@ -128,8 +127,6 @@ public IActionResult GetAll() var acquisitionFileStatusTypes = _mapper.Map(_lookupRepository.GetAllAcquisitionFileStatusTypes()); var acquisitionPhysFileStatusTypes = _mapper.Map(_lookupRepository.GetAllAcquisitionPhysFileStatusTypes()); var acquisitionTypes = _mapper.Map(_lookupRepository.GetAllAcquisitionTypes()); - var activityTemplateTypes = _mapper.Map(_lookupRepository.GetAllActivityTemplateTypes()); - var activityStatusTypes = _mapper.Map(_lookupRepository.GetAllActivityStatusTypes()); var acqFilePersonProfileTypes = _mapper.Map(_lookupRepository.GetAllAcqFilePersonProfileTypes()); var tenantTypes = _mapper.Map(_lookupRepository.GetAllTenantTypes()); var acqFundingTypes = _mapper.Map(_lookupRepository.GetAllAcquisitionFundingTypes()); @@ -180,7 +177,6 @@ public IActionResult GetAll() codes.AddRange(propertyResearchPurposeTypes); codes.AddRange(propertyAnomalyTypes); codes.AddRange(propertyRoadTypes); - //codes.AddRange(propertyAdjacentLandTypes); codes.AddRange(volumeUnitTypes); codes.AddRange(propertyVolumetricTypes); codes.AddRange(pphStatusType); @@ -188,8 +184,6 @@ public IActionResult GetAll() codes.AddRange(acquisitionFileStatusTypes); codes.AddRange(acquisitionPhysFileStatusTypes); codes.AddRange(acquisitionTypes); - codes.AddRange(activityTemplateTypes); - codes.AddRange(activityStatusTypes); codes.AddRange(acqFilePersonProfileTypes); codes.AddRange(tenantTypes); codes.AddRange(acqFundingTypes); diff --git a/source/backend/api/Models/Concepts/AcquisitionFile/AcquisitionFilePropertyModel.cs b/source/backend/api/Models/Concepts/AcquisitionFile/AcquisitionFilePropertyModel.cs index f4b6765073..5ab14c4360 100644 --- a/source/backend/api/Models/Concepts/AcquisitionFile/AcquisitionFilePropertyModel.cs +++ b/source/backend/api/Models/Concepts/AcquisitionFile/AcquisitionFilePropertyModel.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; namespace Pims.Api.Models.Concepts { diff --git a/source/backend/api/Models/Concepts/ExpropriationPayment/ExpropriationPaymentModel.cs b/source/backend/api/Models/Concepts/ExpropriationPayment/ExpropriationPaymentModel.cs index 87afbcb6cb..3f42563be7 100644 --- a/source/backend/api/Models/Concepts/ExpropriationPayment/ExpropriationPaymentModel.cs +++ b/source/backend/api/Models/Concepts/ExpropriationPayment/ExpropriationPaymentModel.cs @@ -26,6 +26,5 @@ public class ExpropriationPaymentModel : BaseAppModel public bool? IsDisabled { get; set; } public List PaymentItems { get; set; } - } } diff --git a/source/backend/api/Models/Concepts/InterestHolder/InterestHolderPropertyMap.cs b/source/backend/api/Models/Concepts/InterestHolder/InterestHolderPropertyMap.cs index 3b1fe0d8ab..31a70a17de 100644 --- a/source/backend/api/Models/Concepts/InterestHolder/InterestHolderPropertyMap.cs +++ b/source/backend/api/Models/Concepts/InterestHolder/InterestHolderPropertyMap.cs @@ -1,6 +1,5 @@ using System.Linq; using Mapster; -using Pims.Dal.Entities; using Entity = Pims.Dal.Entities; namespace Pims.Api.Models.Concepts diff --git a/source/backend/api/Models/Concepts/Lease/LeasePaymentReportMap.cs b/source/backend/api/Models/Concepts/Lease/LeasePaymentReportMap.cs index d4f76b8933..e8e3baec3e 100644 --- a/source/backend/api/Models/Concepts/Lease/LeasePaymentReportMap.cs +++ b/source/backend/api/Models/Concepts/Lease/LeasePaymentReportMap.cs @@ -40,7 +40,7 @@ public void Register(TypeAdapterConfig config) private static string GetFallbackPropertyIdentifier(PimsPropertyLease propertyLease) { PimsProperty property = propertyLease.Property; - if(property?.Pid != null) + if (property?.Pid != null) { return property.Pid.ToString().ConvertPIDToDash(); } diff --git a/source/backend/api/Models/Concepts/Note/EntityNoteModelMap.cs b/source/backend/api/Models/Concepts/Note/EntityNoteModelMap.cs index 450a492e12..29ce135847 100644 --- a/source/backend/api/Models/Concepts/Note/EntityNoteModelMap.cs +++ b/source/backend/api/Models/Concepts/Note/EntityNoteModelMap.cs @@ -7,23 +7,6 @@ public class EntityNoteModelMap : IRegister { public void Register(TypeAdapterConfig config) { - // PimsActivityInstanceNote -> EntityNoteModel - config.NewConfig() - .Map(dest => dest.Id, src => src.PimsActivityInstanceNoteId) - .Map(dest => dest.Note, src => src.Note) - .Map(dest => dest.Parent, src => src) - .Inherits(); - - // PimsActivityInstanceNote <- EntityNoteModel - config.NewConfig() - .Map(dest => dest.PimsActivityInstanceNoteId, src => src.Id) - .Map(dest => dest.Note, src => src.Note) - .Map(dest => dest.ActivityInstanceId, src => src.Parent.Id) - .Inherits(); - - config.NewConfig() - .ConstructUsing(src => new NoteParentModel { Id = src.ActivityInstanceId }); - // PimsAcquisitionFileNote -> EntityNoteModel config.NewConfig() .Map(dest => dest.Id, src => src.AcquisitionFileNoteId) diff --git a/source/backend/api/Models/Concepts/Property/PropertyContactModel.cs b/source/backend/api/Models/Concepts/Property/PropertyContactModel.cs index 3e8e2aceb7..b9f2bcd615 100644 --- a/source/backend/api/Models/Concepts/Property/PropertyContactModel.cs +++ b/source/backend/api/Models/Concepts/Property/PropertyContactModel.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; namespace Pims.Api.Models.Concepts { diff --git a/source/backend/api/Repositories/RestCommon/BaseRestRepository.cs b/source/backend/api/Repositories/RestCommon/BaseRestRepository.cs index 87d162aba4..8c6ebce57e 100644 --- a/source/backend/api/Repositories/RestCommon/BaseRestRepository.cs +++ b/source/backend/api/Repositories/RestCommon/BaseRestRepository.cs @@ -216,7 +216,7 @@ private static string GetFileNameFromContentDisposition(string contentDispositio const string fileNameFlag = "filename"; string[] parts = contentDisposition.Split("; "); string fileNamePart = parts.FirstOrDefault(x => x.Contains(fileNameFlag)); - return fileNamePart[(fileNameFlag.Length + 1) ..].Replace("\"", string.Empty); + return fileNamePart[(fileNameFlag.Length + 1)..].Replace("\"", string.Empty); } private async Task> ProcessResponse(HttpResponseMessage response) diff --git a/source/backend/api/Services/AcquisitionFileService.cs b/source/backend/api/Services/AcquisitionFileService.cs index 5e3402e8f9..fbf3d7514a 100644 --- a/source/backend/api/Services/AcquisitionFileService.cs +++ b/source/backend/api/Services/AcquisitionFileService.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Security.Claims; -using k8s.KubeConfigModels; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Pims.Api.Helpers.Exceptions; @@ -287,7 +286,7 @@ public PimsAcquisitionFile UpdateProperties(PimsAcquisitionFile acquisitionFile, foreach (var deletedProperty in differenceSet) { var acqFileProperties = _acquisitionFilePropertyRepository.GetPropertiesByAcquisitionFileId(acquisitionFile.Internal_Id).FirstOrDefault(ap => ap.PropertyId == deletedProperty.PropertyId); - if (acqFileProperties.PimsActInstPropAcqFiles.Any() || acqFileProperties.PimsTakes.Any()) + if (acqFileProperties.PimsTakes.Any()) { throw new BusinessRuleViolationException(); } diff --git a/source/backend/api/Services/DocumentService.cs b/source/backend/api/Services/DocumentService.cs index d10706a335..e2e9ffe432 100644 --- a/source/backend/api/Services/DocumentService.cs +++ b/source/backend/api/Services/DocumentService.cs @@ -28,13 +28,8 @@ namespace Pims.Api.Services /// public class DocumentService : BaseService, IDocumentService { - private readonly IDocumentRepository documentRepository; - private readonly IEdmsDocumentRepository documentStorageRepository; - private readonly IDocumentTypeRepository documentTypeRepository; - private readonly IAvService avService; - private readonly IMapper mapper; - - private static readonly string[] validExtensions = { + private static readonly string[] validExtensions = + { "txt", "pdf", "docx", @@ -56,6 +51,12 @@ public class DocumentService : BaseService, IDocumentService "kmz", }; + private readonly IDocumentRepository documentRepository; + private readonly IEdmsDocumentRepository documentStorageRepository; + private readonly IDocumentTypeRepository documentTypeRepository; + private readonly IAvService avService; + private readonly IMapper mapper; + public DocumentService( ClaimsPrincipal user, ILogger logger, @@ -306,7 +307,7 @@ public async Task> DownloadFileAsync(long mayanDocu this.User.ThrowIfNotAuthorized(Permissions.DocumentView); ExternalResult downloadResult = await documentStorageRepository.TryDownloadFileAsync(mayanDocumentId, mayanFileId); - if (isValidDocumentExtension(downloadResult.Payload.FileName)) + if (IsValidDocumentExtension(downloadResult.Payload.FileName)) { return downloadResult; } @@ -330,7 +331,7 @@ public async Task> DownloadFileLatestAsync(long may { if (documentResult.Payload != null) { - if (isValidDocumentExtension(documentResult.Payload.FileLatest.FileName)) + if (IsValidDocumentExtension(documentResult.Payload.FileLatest.FileName)) { ExternalResult downloadResult = await documentStorageRepository.TryDownloadFileAsync(documentResult.Payload.Id, documentResult.Payload.FileLatest.Id); return downloadResult; @@ -364,13 +365,19 @@ public async Task> DownloadFileLatestAsync(long may } } + private static bool IsValidDocumentExtension(string fileName) + { + var fileNameExtension = Path.GetExtension(fileName).Replace(".", string.Empty).ToLower(); + return validExtensions.Contains(fileNameExtension); + } + private async Task> UploadDocumentAsync(long documentType, IFormFile fileRaw) { this.Logger.LogInformation("Uploading storage document"); this.User.ThrowIfNotAuthorized(Permissions.DocumentAdd); await this.avService.ScanAsync(fileRaw); - if (isValidDocumentExtension(fileRaw.FileName)) + if (IsValidDocumentExtension(fileRaw.FileName)) { ExternalResult result = await documentStorageRepository.TryUploadDocumentAsync(documentType, fileRaw); return result; @@ -451,11 +458,5 @@ private async Task>> DeleteMetadata(long m return result; } - - private static bool isValidDocumentExtension(string fileName) - { - var fileNameExtension = Path.GetExtension(fileName).Replace(".", string.Empty).ToLower(); - return validExtensions.Contains(fileNameExtension); - } } } diff --git a/source/backend/api/Services/H120CategoryService.cs b/source/backend/api/Services/H120CategoryService.cs index 5c1aa865a2..aae9e00be2 100644 --- a/source/backend/api/Services/H120CategoryService.cs +++ b/source/backend/api/Services/H120CategoryService.cs @@ -28,6 +28,5 @@ public IEnumerable GetAll() return _h120CategoryRepository.GetAll(); } - } } diff --git a/source/backend/api/Services/IAcquisitionFileService.cs b/source/backend/api/Services/IAcquisitionFileService.cs index 553f079d34..f684d477b2 100644 --- a/source/backend/api/Services/IAcquisitionFileService.cs +++ b/source/backend/api/Services/IAcquisitionFileService.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Pims.Api.Areas.Acquisition.Models.Search; using Pims.Dal.Entities; using Pims.Dal.Entities.Models; using Pims.Dal.Exceptions; diff --git a/source/backend/api/Services/ICompReqFinancialService.cs b/source/backend/api/Services/ICompReqFinancialService.cs index bdef94c24f..5324121471 100644 --- a/source/backend/api/Services/ICompReqFinancialService.cs +++ b/source/backend/api/Services/ICompReqFinancialService.cs @@ -7,6 +7,7 @@ namespace Pims.Api.Services public interface ICompReqFinancialService { IEnumerable GetAllByAcquisitionFileId(long acquisitionFileId, bool? finalOnly); + IEnumerable SearchCompensationRequisitionFinancials(AcquisitionReportFilterModel filter); } } diff --git a/source/backend/api/Services/ICompensationRequisitionService.cs b/source/backend/api/Services/ICompensationRequisitionService.cs index f20404206b..b8bcf666e5 100644 --- a/source/backend/api/Services/ICompensationRequisitionService.cs +++ b/source/backend/api/Services/ICompensationRequisitionService.cs @@ -6,8 +6,6 @@ public interface ICompensationRequisitionService { PimsCompensationRequisition GetById(long compensationRequisitionId); - //PimsAcquisitionPayee GetPayeeByCompensationId(long compensationRequisitionId); - PimsCompensationRequisition Update(PimsCompensationRequisition compensationRequisition); bool DeleteCompensation(long compensationId); diff --git a/source/backend/api/Services/NoteService.cs b/source/backend/api/Services/NoteService.cs index b4ce676d2e..9854e1d643 100644 --- a/source/backend/api/Services/NoteService.cs +++ b/source/backend/api/Services/NoteService.cs @@ -58,14 +58,6 @@ public EntityNoteModel Add(NoteType type, EntityNoteModel model) switch (type) { - case NoteType.Activity: - PimsActivityInstanceNote pimsEntity = _mapper.Map(model); - - PimsActivityInstanceNote createdEntity = _entityNoteRepository.Add(pimsEntity); - _entityNoteRepository.CommitTransaction(); - - result = _mapper.Map(createdEntity); - break; case NoteType.Acquisition_File: PimsAcquisitionFileNote acqNoteEntity = _mapper.Map(model); @@ -136,7 +128,6 @@ public bool DeleteNote(NoteType type, long noteId, bool commitTransaction = true deleted = type switch { - NoteType.Activity => _entityNoteRepository.DeleteActivityNotes(noteId), NoteType.Acquisition_File => _entityNoteRepository.DeleteAcquisitionFileNotes(noteId), NoteType.Project => _entityNoteRepository.DeleteProjectNotes(noteId), NoteType.Lease_File => _entityNoteRepository.DeleteLeaseFileNotes(noteId), @@ -165,7 +156,6 @@ public IEnumerable GetNotes(NoteType type, long entityId) List notes = type switch { - NoteType.Activity => _entityNoteRepository.GetAllActivityNotesById(entityId).ToList(), NoteType.Acquisition_File => _entityNoteRepository.GetAllAcquisitionNotesById(entityId).ToList(), NoteType.Project => _entityNoteRepository.GetAllProjectNotesById(entityId).ToList(), NoteType.Lease_File => _entityNoteRepository.GetAllLeaseNotesById(entityId).ToList(), diff --git a/source/backend/core/Exceptions/ContractorNotInTeamException.cs b/source/backend/core/Exceptions/ContractorNotInTeamException.cs index 7064fcbe86..7bdca8f774 100644 --- a/source/backend/core/Exceptions/ContractorNotInTeamException.cs +++ b/source/backend/core/Exceptions/ContractorNotInTeamException.cs @@ -11,12 +11,11 @@ public class ContractorNotInTeamException : Exception { public ContractorNotInTeamException() { - } - public ContractorNotInTeamException(string message) : base(message) + public ContractorNotInTeamException(string message) + : base(message) { - } public ContractorNotInTeamException(string message, Exception innerException) diff --git a/source/backend/dal/Helpers/Extensions/AcquisitionOwnerExtensions.cs b/source/backend/dal/Helpers/Extensions/AcquisitionOwnerExtensions.cs index d8c5676814..c2b5b15011 100644 --- a/source/backend/dal/Helpers/Extensions/AcquisitionOwnerExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/AcquisitionOwnerExtensions.cs @@ -7,7 +7,7 @@ public static class AcquisitionOwnerExtensions { public static string FormatOwnerName(this PimsAcquisitionOwner pimsOwner) { - if(pimsOwner is null) + if (pimsOwner is null) { return string.Empty; } diff --git a/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs b/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs index 0d36ec8824..4dec9c0d68 100644 --- a/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs @@ -67,7 +67,7 @@ public static class PropertyExtensions if (!string.IsNullOrWhiteSpace(filter.PinOrPid)) { - //note - 2 part search required. all matches found by removing leading 0's, then matches filtered in subsequent step. This is because EF core does not support an lpad method. + // note - 2 part search required. all matches found by removing leading 0's, then matches filtered in subsequent step. This is because EF core does not support an lpad method. Regex nonInteger = new Regex("[^\\d]"); var formattedPidPin = Convert.ToInt32(nonInteger.Replace(filter.PinOrPid, string.Empty)).ToString(); query = query. diff --git a/source/backend/dal/Helpers/Extensions/ServiceCollectionExtensions.cs b/source/backend/dal/Helpers/Extensions/ServiceCollectionExtensions.cs index a57414c7fb..8ab8fd3aa9 100644 --- a/source/backend/dal/Helpers/Extensions/ServiceCollectionExtensions.cs +++ b/source/backend/dal/Helpers/Extensions/ServiceCollectionExtensions.cs @@ -45,8 +45,6 @@ public static IServiceCollection AddPimsDalRepositories(this IServiceCollection repositories.AddScoped(); repositories.AddScoped(); repositories.AddScoped(); - repositories.AddScoped(); - repositories.AddScoped(); repositories.AddScoped(); repositories.AddScoped(); repositories.AddScoped(); diff --git a/source/backend/dal/Models/PageFilter.cs b/source/backend/dal/Models/PageFilter.cs index cb10d107eb..2670d94528 100644 --- a/source/backend/dal/Models/PageFilter.cs +++ b/source/backend/dal/Models/PageFilter.cs @@ -78,7 +78,7 @@ public virtual bool IsValid() } /// - /// Convert a start index to a page for paging. + /// Convert a start index to a page for paging. /// /// /// diff --git a/source/backend/dal/Repositories/AcquisitionFilePropertyRepository.cs b/source/backend/dal/Repositories/AcquisitionFilePropertyRepository.cs index 220355e20f..9e32d05cb5 100644 --- a/source/backend/dal/Repositories/AcquisitionFilePropertyRepository.cs +++ b/source/backend/dal/Repositories/AcquisitionFilePropertyRepository.cs @@ -36,7 +36,6 @@ public List GetPropertiesByAcquisitionFileId(long a { return Context.PimsPropertyAcquisitionFiles .Where(x => x.AcquisitionFileId == acquisitionFileId) - .Include(rp => rp.PimsActInstPropAcqFiles) .Include(rp => rp.PimsTakes) .Include(rp => rp.Property) .ThenInclude(rp => rp.RegionCodeNavigation) @@ -80,11 +79,8 @@ public void Delete(PimsPropertyAcquisitionFile propertyAcquisitionFile) var propertyAcquisitionFileToDelete = Context.PimsPropertyAcquisitionFiles .Where(x => x.PropertyAcquisitionFileId == propertyAcquisitionFile.Internal_Id) - .Include(rp => rp.PimsActInstPropAcqFiles) .FirstOrDefault() ?? throw new KeyNotFoundException(); - propertyAcquisitionFileToDelete.PimsActInstPropAcqFiles.ForEach(s => Context.PimsActInstPropAcqFiles.Remove(s)); - Context.PimsPropertyAcquisitionFiles.Remove(propertyAcquisitionFileToDelete); } diff --git a/source/backend/dal/Repositories/DocumentActivityRepository.cs b/source/backend/dal/Repositories/DocumentActivityRepository.cs deleted file mode 100644 index 8bcc8a3cf3..0000000000 --- a/source/backend/dal/Repositories/DocumentActivityRepository.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Pims.Core.Extensions; -using Pims.Dal.Entities; - -namespace Pims.Dal.Repositories -{ - /// - /// DocumentActivityRepository class, provides a service layer to interact with document types within the datasource. - /// - public class DocumentActivityRepository : BaseRepository, IDocumentActivityRepository - { - #region Constructors - - /// - /// Creates a new instance of a DocumentActivityRepository, and initializes it with the specified arguments. - /// - /// - /// - /// - public DocumentActivityRepository(PimsContext dbContext, ClaimsPrincipal user, ILogger logger) - : base(dbContext, user, logger) - { - } - #endregion - - #region Methods - - /// - /// Get a list of all the document activity relationships for a given document. - /// - /// - public IList GetAllByDocument(long documentId) - { - return this.Context.PimsActivityInstanceDocuments - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentStatusTypeCodeNavigation) - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentType) - .Where(ad => ad.DocumentId == documentId) - .AsNoTracking() - .ToList(); - } - - /// - /// Get a list of all the document activity relationships for a given research file. - /// - /// - public IList GetAllByResearchFileActivities(long fileId) - { - return this.Context.PimsActivityInstanceDocuments - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentStatusTypeCodeNavigation) - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentType) - .Where(ad => ad.ActivityInstance.PimsResearchActivityInstances.Any(x => x.ResearchFileId == fileId)) - .AsNoTracking() - .ToList(); - } - - /// - /// Get a list of all the document activity relationships for a a given acquisition file. - /// - /// - public IList GetAllByAcquisitionFileActivities(long fileId) - { - return this.Context.PimsActivityInstanceDocuments - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentStatusTypeCodeNavigation) - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentType) - .Where(ad => ad.ActivityInstance.PimsAcquisitionActivityInstances.Any(x => x.AcquisitionFileId == fileId)) - .AsNoTracking() - .ToList(); - } - - /// - /// Get a list of all the document relationships for a given activity. - /// - /// - public IList GetAllByActivity(long activityId) - { - return this.Context.PimsActivityInstanceDocuments - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentStatusTypeCodeNavigation) - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentType) - .Where(ad => ad.ActivityInstanceId == activityId) - .AsNoTracking() - .ToList(); - } - - /// - /// Adds the passed document activity to the database. - /// - /// - /// - public PimsActivityInstanceDocument Add(PimsActivityInstanceDocument activityDocument) - { - activityDocument.ThrowIfNull(nameof(activityDocument)); - - var newEntry = this.Context.PimsActivityInstanceDocuments.Add(activityDocument); - if (newEntry.State == EntityState.Added) - { - return newEntry.Entity; - } - else - { - throw new InvalidOperationException("Could not create document"); - } - } - - /// - /// Deletes the passed document activity to the database. - /// - /// - /// - public bool Delete(PimsActivityInstanceDocument activityDocument) - { - if (activityDocument == null) - { - throw new ArgumentNullException(nameof(activityDocument), "activityDocument cannot be null."); - } - - this.Context.PimsActivityInstanceDocuments.Remove(new PimsActivityInstanceDocument() { ActivityInstanceDocumentId = activityDocument.ActivityInstanceDocumentId }); - return true; - } - - #endregion - } -} diff --git a/source/backend/dal/Repositories/DocumentActivityTemplateRepository.cs b/source/backend/dal/Repositories/DocumentActivityTemplateRepository.cs deleted file mode 100644 index f035fb0b85..0000000000 --- a/source/backend/dal/Repositories/DocumentActivityTemplateRepository.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Pims.Core.Extensions; -using Pims.Dal.Entities; - -namespace Pims.Dal.Repositories -{ - /// - /// DocumentActivityTemplateRepository class, provides a service layer to interact with activity template documents within the datasource. - /// - public class DocumentActivityTemplateRepository : BaseRepository, IDocumentActivityTemplateRepository - { - #region Constructors - - /// - /// Creates a new instance of a DocumentActivityTemplateRepository, and initializes it with the specified arguments. - /// - /// - /// - /// - public DocumentActivityTemplateRepository(PimsContext dbContext, ClaimsPrincipal user, ILogger logger) - : base(dbContext, user, logger) - { - } - #endregion - - #region Methods - - /// - /// Get a list of all the document activity template relationships for a given document. - /// - /// - public IList GetAllByDocument(long documentId) - { - return this.Context.PimsActivityTemplateDocuments - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentStatusTypeCodeNavigation) - .Include(ad => ad.Document) - .ThenInclude(d => d.DocumentType) - .Where(ad => ad.DocumentId == documentId) - .AsNoTracking() - .ToList(); - } - - /// - /// Get a list of all the document relationships for a given activity template. - /// - /// - public IList GetAllByActivityTemplate(long activityTemplateId) - { - return this.Context.PimsActivityTemplateDocuments - .Include(at => at.Document) - .ThenInclude(d => d.DocumentStatusTypeCodeNavigation) - .Include(at => at.Document) - .ThenInclude(d => d.DocumentType) - .Where(at => at.ActivityTemplateId == activityTemplateId) - .AsNoTracking() - .ToList(); - } - - /// - /// Adds the passed document activity template to the database. - /// - /// - /// - public PimsActivityTemplateDocument Add(PimsActivityTemplateDocument activityTemplateDocument) - { - activityTemplateDocument.ThrowIfNull(nameof(activityTemplateDocument)); - - var newEntry = this.Context.PimsActivityTemplateDocuments.Add(activityTemplateDocument); - if (newEntry.State == EntityState.Added) - { - return newEntry.Entity; - } - else - { - throw new InvalidOperationException("Could not create activity template document"); - } - } - - /// - /// Deletes the passed document activity template to the database. - /// - /// - /// - public bool Delete(PimsActivityTemplateDocument activityTemplateDocument) - { - if (activityTemplateDocument == null) - { - throw new ArgumentNullException(nameof(activityTemplateDocument), "activityTemplateDocument cannot be null."); - } - - this.Context.PimsActivityTemplateDocuments.Remove(new PimsActivityTemplateDocument() - { - ActivityTemplateId = activityTemplateDocument.ActivityTemplateId, - }); - return true; - } - - #endregion - } -} diff --git a/source/backend/dal/Repositories/DocumentRepository.cs b/source/backend/dal/Repositories/DocumentRepository.cs index 300c2925a8..fb78a95ce4 100644 --- a/source/backend/dal/Repositories/DocumentRepository.cs +++ b/source/backend/dal/Repositories/DocumentRepository.cs @@ -35,18 +35,6 @@ public DocumentRepository( #region Methods - public int GetTotalRelationCount(long documentId) - { - var document = this.Context.PimsDocuments.AsNoTracking() - .Include(d => d.PimsActivityInstanceDocuments) - .Where(d => d.DocumentId == documentId) - .AsNoTracking() - .FirstOrDefault(); - - // Add all document relationships - return document.PimsActivityInstanceDocuments.Count; - } - /// /// Get the document from the database based on document id. /// @@ -102,8 +90,6 @@ public bool Delete(PimsDocument document) // Need to load required related entities otherwise the below foreach may fail. var documentToDelete = this.Context.PimsDocuments.AsNoTracking() - .Include(d => d.PimsActivityInstanceDocuments) - .Include(d => d.PimsActivityTemplateDocuments) .Include(d => d.PimsResearchFileDocuments) .Include(d => d.PimsAcquisitionFileDocuments) .Include(d => d.PimsProjectDocuments) @@ -133,16 +119,6 @@ public bool Delete(PimsDocument document) this.Context.PimsLeaseDocuments.Remove(new PimsLeaseDocument() { Internal_Id = pimsLeaseDocument.Internal_Id }); } - foreach (var pimsActivityInstanceDocument in documentToDelete.PimsActivityInstanceDocuments) - { - this.Context.PimsActivityInstanceDocuments.Remove(new PimsActivityInstanceDocument() { Internal_Id = pimsActivityInstanceDocument.Internal_Id }); - } - - foreach (var pimsTemplateDocument in documentToDelete.PimsActivityTemplateDocuments) - { - this.Context.PimsActivityTemplateDocuments.Remove(new PimsActivityTemplateDocument() { Internal_Id = pimsTemplateDocument.Internal_Id }); - } - foreach (var pimsFormTypeDocument in documentToDelete.PimsFormTypes) { var updatedFormType = pimsFormTypeDocument; @@ -168,8 +144,6 @@ public List GetAllByDocumentType(string documentType) public int DocumentRelationshipCount(long documentId) { var documentRelationships = this.Context.PimsDocuments.AsNoTracking() - .Include(d => d.PimsActivityInstanceDocuments) - .Include(d => d.PimsActivityTemplateDocuments) .Include(d => d.PimsResearchFileDocuments) .Include(d => d.PimsAcquisitionFileDocuments) .Include(d => d.PimsProjectDocuments) @@ -182,8 +156,6 @@ public int DocumentRelationshipCount(long documentId) return documentRelationships.PimsResearchFileDocuments.Count + documentRelationships.PimsAcquisitionFileDocuments.Count + documentRelationships.PimsProjectDocuments.Count + - documentRelationships.PimsActivityInstanceDocuments.Count + - documentRelationships.PimsActivityTemplateDocuments.Count + documentRelationships.PimsFormTypes.Count + documentRelationships.PimsLeaseDocuments.Count; } diff --git a/source/backend/dal/Repositories/EntityNoteRepository.cs b/source/backend/dal/Repositories/EntityNoteRepository.cs index 4c5aae7d33..0b9a69d4a1 100644 --- a/source/backend/dal/Repositories/EntityNoteRepository.cs +++ b/source/backend/dal/Repositories/EntityNoteRepository.cs @@ -58,12 +58,6 @@ public IEnumerable GetAll(Func predicate) return this.Context.Set().AsNoTracking().Where(predicate).ToArray(); } - public IEnumerable GetAllActivityNotesById(long entityId) - { - return this.Context.PimsActivityInstanceNotes - .Where(x => x.ActivityInstanceId == entityId).Select(x => x.Note).ToList(); - } - public IEnumerable GetAllAcquisitionNotesById(long acquisitionId) { return this.Context.PimsAcquisitionFileNotes @@ -88,21 +82,6 @@ public IEnumerable GetAllResearchNotesById(long entityId) .Where(x => x.ResearchFileId == entityId).Select(x => x.Note).ToList(); } - public bool DeleteActivityNotes(long entityId) - { - var activityNotes = this.Context.PimsActivityInstanceNotes.Include(ai => ai.Note).Where(x => x.NoteId == entityId).ToList(); - if (activityNotes.Any()) - { - foreach (var activityNote in activityNotes) - { - this.Context.PimsActivityInstanceNotes.Remove(activityNote); - this.Context.PimsNotes.Remove(activityNote.Note); - } - return true; - } - return false; - } - public bool DeleteAcquisitionFileNotes(long noteId) { var acquisitionFileNotes = this.Context.PimsAcquisitionFileNotes. diff --git a/source/backend/dal/Repositories/Interfaces/ICompReqFinancialRepository.cs b/source/backend/dal/Repositories/Interfaces/ICompReqFinancialRepository.cs index 3511994892..766d62837f 100644 --- a/source/backend/dal/Repositories/Interfaces/ICompReqFinancialRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/ICompReqFinancialRepository.cs @@ -7,6 +7,7 @@ namespace Pims.Dal.Repositories public interface ICompReqFinancialRepository : IRepository { IEnumerable GetAllByAcquisitionFileId(long acquisitionFileId, bool? finalOnly); + IEnumerable SearchCompensationRequisitionFinancials(AcquisitionReportFilterModel filter); } } diff --git a/source/backend/dal/Repositories/Interfaces/IDocumentActivityRepository.cs b/source/backend/dal/Repositories/Interfaces/IDocumentActivityRepository.cs deleted file mode 100644 index a84306e228..0000000000 --- a/source/backend/dal/Repositories/Interfaces/IDocumentActivityRepository.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections.Generic; -using Pims.Dal.Entities; - -namespace Pims.Dal.Repositories -{ - /// - /// IDocumentActivityRepository interface, provides functions to interact with document activities within the datasource. - /// - public interface IDocumentActivityRepository : IRepository - { - IList GetAllByDocument(long documentId); - - IList GetAllByActivity(long activityId); - - IList GetAllByResearchFileActivities(long fileId); - - IList GetAllByAcquisitionFileActivities(long fileId); - - PimsActivityInstanceDocument Add(PimsActivityInstanceDocument activityDocument); - - bool Delete(PimsActivityInstanceDocument activityDocument); - } -} diff --git a/source/backend/dal/Repositories/Interfaces/IDocumentActivityTemplateRepository.cs b/source/backend/dal/Repositories/Interfaces/IDocumentActivityTemplateRepository.cs deleted file mode 100644 index 52091c45a7..0000000000 --- a/source/backend/dal/Repositories/Interfaces/IDocumentActivityTemplateRepository.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using Pims.Dal.Entities; - -namespace Pims.Dal.Repositories -{ - /// - /// IDocumentActivityTemplateRepository interface, provides functions to interact with document activity templates within the datasource. - /// - public interface IDocumentActivityTemplateRepository : IRepository - { - IList GetAllByDocument(long documentId); - - IList GetAllByActivityTemplate(long activityTemplateId); - - PimsActivityTemplateDocument Add(PimsActivityTemplateDocument activityTemplateDocument); - - bool Delete(PimsActivityTemplateDocument activityTemplateDocument); - } -} diff --git a/source/backend/dal/Repositories/Interfaces/IDocumentRepository.cs b/source/backend/dal/Repositories/Interfaces/IDocumentRepository.cs index aad31c02cf..d4f2bb9340 100644 --- a/source/backend/dal/Repositories/Interfaces/IDocumentRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/IDocumentRepository.cs @@ -8,8 +8,6 @@ namespace Pims.Dal.Repositories /// public interface IDocumentRepository : IRepository { - int GetTotalRelationCount(long documentId); - PimsDocument Add(PimsDocument document); PimsDocument TryGet(long documentId); diff --git a/source/backend/dal/Repositories/Interfaces/IEntityNoteRepository.cs b/source/backend/dal/Repositories/Interfaces/IEntityNoteRepository.cs index 7e3d9f0d6f..6d9018ac02 100644 --- a/source/backend/dal/Repositories/Interfaces/IEntityNoteRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/IEntityNoteRepository.cs @@ -12,8 +12,6 @@ T Add(T entity) IEnumerable GetAll(Func predicate) where T : class; - IEnumerable GetAllActivityNotesById(long entityId); - IEnumerable GetAllAcquisitionNotesById(long acquisitionId); IEnumerable GetAllLeaseNotesById(long leaseId); @@ -22,8 +20,6 @@ IEnumerable GetAll(Func predicate) IEnumerable GetAllResearchNotesById(long entityId); - bool DeleteActivityNotes(long entityId); - bool DeleteAcquisitionFileNotes(long noteId); bool DeleteLeaseFileNotes(long noteId); diff --git a/source/backend/dal/Repositories/Interfaces/ILeasePaymentRepository.cs b/source/backend/dal/Repositories/Interfaces/ILeasePaymentRepository.cs index 78847e6d1a..b256983ab2 100644 --- a/source/backend/dal/Repositories/Interfaces/ILeasePaymentRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/ILeasePaymentRepository.cs @@ -1,6 +1,6 @@ -using Pims.Dal.Entities; using System; using System.Collections.Generic; +using Pims.Dal.Entities; namespace Pims.Dal.Repositories { diff --git a/source/backend/dal/Repositories/Interfaces/ILeaseTenantRepository.cs b/source/backend/dal/Repositories/Interfaces/ILeaseTenantRepository.cs index a3edb1ae6f..04950b62b0 100644 --- a/source/backend/dal/Repositories/Interfaces/ILeaseTenantRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/ILeaseTenantRepository.cs @@ -12,6 +12,5 @@ public interface IPropertyImprovementRepository : IRepository GetByLeaseId(long leaseId); IEnumerable Update(long leaseId, IEnumerable pimsPropertyImprovements); - } } diff --git a/source/backend/dal/Repositories/Interfaces/ILookupRepository.cs b/source/backend/dal/Repositories/Interfaces/ILookupRepository.cs index a7ab65a5f7..b7ba741571 100644 --- a/source/backend/dal/Repositories/Interfaces/ILookupRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/ILookupRepository.cs @@ -90,10 +90,6 @@ public interface ILookupRepository : IRepository IEnumerable GetAllAcquisitionTypes(); - IEnumerable GetAllActivityTemplateTypes(); - - IEnumerable GetAllActivityStatusTypes(); - IEnumerable GetAllAcqFilePersonProfileTypes(); IEnumerable GetAllTenantTypes(); diff --git a/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs b/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs index 52bce07c2a..ce3c6f2c37 100644 --- a/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs @@ -11,6 +11,7 @@ namespace Pims.Dal.Repositories public interface IPropertyRepository : IRepository { int Count(); + Paged GetPage(PropertyFilter filter); PimsProperty GetById(long id); diff --git a/source/backend/dal/Repositories/LookupRepository.cs b/source/backend/dal/Repositories/LookupRepository.cs index 5640c4dc1b..9f2400c5c3 100644 --- a/source/backend/dal/Repositories/LookupRepository.cs +++ b/source/backend/dal/Repositories/LookupRepository.cs @@ -279,16 +279,6 @@ public IEnumerable GetAllAcquisitionTypes() return this.Context.PimsAcquisitionTypes.AsNoTracking().OrderBy(r => r.DisplayOrder).ToArray(); } - public IEnumerable GetAllActivityTemplateTypes() - { - return this.Context.PimsActivityTemplateTypes.AsNoTracking().ToArray(); - } - - public IEnumerable GetAllActivityStatusTypes() - { - return this.Context.PimsActivityInstanceStatusTypes.AsNoTracking().OrderBy(a => a.DisplayOrder).ToArray(); - } - public IEnumerable GetAllAcqFilePersonProfileTypes() { return this.Context.PimsAcqFlPersonProfileTypes.AsNoTracking().ToArray(); diff --git a/source/backend/dal/Repositories/ResearchFilePropertyRepository.cs b/source/backend/dal/Repositories/ResearchFilePropertyRepository.cs index 2d27493acf..4b5c2c35cc 100644 --- a/source/backend/dal/Repositories/ResearchFilePropertyRepository.cs +++ b/source/backend/dal/Repositories/ResearchFilePropertyRepository.cs @@ -35,13 +35,12 @@ public List GetAllByResearchFileId(long researchFileId return Context.PimsPropertyResearchFiles.AsNoTracking() .Where(x => x.ResearchFileId == researchFileId) .Include(rp => rp.PimsPrfPropResearchPurposeTypes) - .Include(rp => rp.PimsActInstPropRsrchFiles) .Include(rp => rp.Property) - .ThenInclude(rp => rp.RegionCodeNavigation) + .ThenInclude(rp => rp.RegionCodeNavigation) .Include(rp => rp.Property) - .ThenInclude(rp => rp.DistrictCodeNavigation) + .ThenInclude(rp => rp.DistrictCodeNavigation) .Include(rp => rp.Property) - .ThenInclude(rp => rp.Address) + .ThenInclude(rp => rp.Address) .ToList(); } @@ -71,12 +70,10 @@ public void Delete(PimsPropertyResearchFile propertyResearchFile) .Where(x => x.PropertyResearchFileId == propertyResearchFile.Internal_Id) .Include(rp => rp.Property) .Include(rp => rp.PimsPrfPropResearchPurposeTypes) - .Include(rp => rp.PimsActInstPropRsrchFiles) .FirstOrDefault() ?? throw new KeyNotFoundException(); // Delete any Property research purpose type associations existingPropertyResearchFile.PimsPrfPropResearchPurposeTypes.ForEach(purposeType => Context.PimsPrfPropResearchPurposeTypes.Remove(new PimsPrfPropResearchPurposeType() { Internal_Id = purposeType.Internal_Id })); - existingPropertyResearchFile.PimsActInstPropRsrchFiles.ForEach(s => Context.PimsActInstPropRsrchFiles.Remove(new PimsActInstPropRsrchFile() { Internal_Id = s.Internal_Id })); Context.Remove(new PimsPropertyResearchFile() { Internal_Id = propertyResearchFile.Internal_Id }); } diff --git a/source/backend/entities/Partials/ActInstPropAcqFile.cs b/source/backend/entities/Partials/ActInstPropAcqFile.cs deleted file mode 100644 index 4b325f8e03..0000000000 --- a/source/backend/entities/Partials/ActInstPropAcqFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// ActInstPropAcqFile class, provides an entity for the datamodel to manage acquisition properties. - /// - public partial class PimsActInstPropAcqFile : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - [NotMapped] - public override long Internal_Id { get => this.ActInstPropAcqFileId; set => this.ActInstPropAcqFileId = value; } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActInstPropRsrchFile.cs b/source/backend/entities/Partials/ActInstPropRsrchFile.cs deleted file mode 100644 index 70b8044cab..0000000000 --- a/source/backend/entities/Partials/ActInstPropRsrchFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// ActInstPropRsrchFile class, provides an entity for the datamodel to manage reseach properties. - /// - public partial class PimsActInstPropRsrchFile : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - [NotMapped] - public override long Internal_Id { get => this.ActInstPropRsrchFileId; set => this.ActInstPropRsrchFileId = value; } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityInstance.cs b/source/backend/entities/Partials/ActivityInstance.cs deleted file mode 100644 index f687d76b75..0000000000 --- a/source/backend/entities/Partials/ActivityInstance.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// PimsActivityInstance class, provides an entity for the datamodel to manage activity instances. - /// - public partial class PimsActivityInstance : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - [NotMapped] - public override long Internal_Id { get => this.ActivityInstanceId; set => this.ActivityInstanceId = value; } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityInstanceDocument.cs b/source/backend/entities/Partials/ActivityInstanceDocument.cs deleted file mode 100644 index cb99e98835..0000000000 --- a/source/backend/entities/Partials/ActivityInstanceDocument.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// PimsActivityInstanceDocument class, provides an entity for the datamodel to manage Activity document entities. - /// - public partial class PimsActivityInstanceDocument : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - [NotMapped] - public override long Internal_Id { get => this.ActivityInstanceDocumentId; set => this.ActivityInstanceDocumentId = value; } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityInstanceNote.cs b/source/backend/entities/Partials/ActivityInstanceNote.cs deleted file mode 100644 index 02ed2d4213..0000000000 --- a/source/backend/entities/Partials/ActivityInstanceNote.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// PimsActivityInstanceNote class, provides an entity for the datamodel to manage activity notes. - /// - public partial class PimsActivityInstanceNote : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - [NotMapped] - public override long Internal_Id { get => this.PimsActivityInstanceNoteId; set => this.PimsActivityInstanceNoteId = value; } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityInstanceStatusType.cs b/source/backend/entities/Partials/ActivityInstanceStatusType.cs deleted file mode 100644 index 3d51f16405..0000000000 --- a/source/backend/entities/Partials/ActivityInstanceStatusType.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// ActivityInstanceStatusType class, provides an entity for the datamodel to manage a list of lease types. - /// - public partial class PimsActivityInstanceStatusType : ITypeEntity - { - #region Properties - - /// - /// get/set - Primary key to identify activity status type. - /// - [NotMapped] - public string Id { get => ActivityInstanceStatusTypeCode; set => ActivityInstanceStatusTypeCode = value; } - #endregion - - #region Constructors - - /// - /// Create a new instance of a ActivityInstanceStatusType class. - /// - /// - public PimsActivityInstanceStatusType(string id) - : this() - { - } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityTemplate.cs b/source/backend/entities/Partials/ActivityTemplate.cs deleted file mode 100644 index eb0da16a47..0000000000 --- a/source/backend/entities/Partials/ActivityTemplate.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// PimsActivityTemplate class, provides an entity for the datamodel to manage a list of activity template types. - /// - public partial class PimsActivityTemplate : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - - /// - /// get/set - Primary key to identify volumetric type. - /// - [NotMapped] - public override long Internal_Id { get => ActivityTemplateId; set => ActivityTemplateId = value; } - #endregion - - #region Constructors - - /// - /// Create a new instance of a PimsActivityTemplate class. - /// - /// - public PimsActivityTemplate(long id, string activityTemplateTypeCode, PimsActivityTemplateType pimsActivityTemplateType) - : this() - { - Internal_Id = id; - this.ActivityTemplateTypeCode = activityTemplateTypeCode; - this.ActivityTemplateTypeCodeNavigation = pimsActivityTemplateType; - } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityTemplateDocument.cs b/source/backend/entities/Partials/ActivityTemplateDocument.cs deleted file mode 100644 index e1019ce3e5..0000000000 --- a/source/backend/entities/Partials/ActivityTemplateDocument.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// PimsActivityTemplateDocument class, provides an entity for the datamodel to manage Activity template document entities. - /// - public partial class PimsActivityTemplateDocument : StandardIdentityBaseAppEntity, IBaseAppEntity - { - #region Properties - [NotMapped] - public override long Internal_Id { get => this.ActivityTemplateDocumentId; set => this.ActivityTemplateDocumentId = value; } - #endregion - } -} diff --git a/source/backend/entities/Partials/ActivityTemplateType.cs b/source/backend/entities/Partials/ActivityTemplateType.cs deleted file mode 100644 index cea50515a2..0000000000 --- a/source/backend/entities/Partials/ActivityTemplateType.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - /// - /// PimsActivityTemplateType class, provides an entity for the datamodel to manage a list of activity template types. - /// - public partial class PimsActivityTemplateType : ITypeEntity - { - #region Properties - - /// - /// get/set - Primary key to activity template type. - /// - [NotMapped] - public string Id { get => ActivityTemplateTypeCode; set => ActivityTemplateTypeCode = value; } - #endregion - - #region Constructors - - /// - /// Create a new instance of a PimsVolumetricType class. - /// - /// - public PimsActivityTemplateType(string id) - : this() - { - Id = id; - } - #endregion - } -} diff --git a/source/backend/entities/PimsBaseContext.cs b/source/backend/entities/PimsBaseContext.cs index 6e1b995967..1496b61f34 100644 --- a/source/backend/entities/PimsBaseContext.cs +++ b/source/backend/entities/PimsBaseContext.cs @@ -28,8 +28,6 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsAcqChklstSectionTypes { get; set; } public virtual DbSet PimsAcqFlPersonProfileTypes { get; set; } public virtual DbSet PimsAcqPhysFileStatusTypes { get; set; } - public virtual DbSet PimsAcquisitionActivityInstances { get; set; } - public virtual DbSet PimsAcquisitionActivityInstanceHists { get; set; } public virtual DbSet PimsAcquisitionChecklistItems { get; set; } public virtual DbSet PimsAcquisitionChecklistItemHists { get; set; } public virtual DbSet PimsAcquisitionFiles { get; set; } @@ -47,22 +45,6 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsAcquisitionOwners { get; set; } public virtual DbSet PimsAcquisitionOwnerHists { get; set; } public virtual DbSet PimsAcquisitionTypes { get; set; } - public virtual DbSet PimsActInstPropAcqFiles { get; set; } - public virtual DbSet PimsActInstPropAcqFileHists { get; set; } - public virtual DbSet PimsActInstPropRsrchFiles { get; set; } - public virtual DbSet PimsActInstPropRsrchFileHists { get; set; } - public virtual DbSet PimsActivityInstances { get; set; } - public virtual DbSet PimsActivityInstanceDocuments { get; set; } - public virtual DbSet PimsActivityInstanceDocumentHists { get; set; } - public virtual DbSet PimsActivityInstanceHists { get; set; } - public virtual DbSet PimsActivityInstanceNotes { get; set; } - public virtual DbSet PimsActivityInstanceNoteHists { get; set; } - public virtual DbSet PimsActivityInstanceStatusTypes { get; set; } - public virtual DbSet PimsActivityTemplates { get; set; } - public virtual DbSet PimsActivityTemplateDocuments { get; set; } - public virtual DbSet PimsActivityTemplateDocumentHists { get; set; } - public virtual DbSet PimsActivityTemplateHists { get; set; } - public virtual DbSet PimsActivityTemplateTypes { get; set; } public virtual DbSet PimsAddresses { get; set; } public virtual DbSet PimsAddressHists { get; set; } public virtual DbSet PimsAddressUsageTypes { get; set; } @@ -121,8 +103,6 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsLandActTypes { get; set; } public virtual DbSet PimsLandSurveyorTypes { get; set; } public virtual DbSet PimsLeases { get; set; } - public virtual DbSet PimsLeaseActivityInstances { get; set; } - public virtual DbSet PimsLeaseActivityInstanceHists { get; set; } public virtual DbSet PimsLeaseCategoryTypes { get; set; } public virtual DbSet PimsLeaseConsultations { get; set; } public virtual DbSet PimsLeaseConsultationHists { get; set; } @@ -182,15 +162,21 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsProjectStatusTypes { get; set; } public virtual DbSet PimsPropInthldrInterestTypes { get; set; } public virtual DbSet PimsPropPropAnomalyTypes { get; set; } + public virtual DbSet PimsPropPropClassificationHists { get; set; } + public virtual DbSet PimsPropPropPurposes { get; set; } + public virtual DbSet PimsPropPropPurposeHists { get; set; } public virtual DbSet PimsPropPropRoadTypes { get; set; } public virtual DbSet PimsPropPropTenureTypes { get; set; } public virtual DbSet PimsPropResearchPurposeTypes { get; set; } public virtual DbSet PimsProperties { get; set; } public virtual DbSet PimsPropertyAcquisitionFiles { get; set; } public virtual DbSet PimsPropertyAcquisitionFileHists { get; set; } + public virtual DbSet PimsPropertyActivityHists { get; set; } public virtual DbSet PimsPropertyAnomalyTypes { get; set; } public virtual DbSet PimsPropertyBoundaryVws { get; set; } public virtual DbSet PimsPropertyClassificationTypes { get; set; } + public virtual DbSet PimsPropertyContacts { get; set; } + public virtual DbSet PimsPropertyContactHists { get; set; } public virtual DbSet PimsPropertyEvaluations { get; set; } public virtual DbSet PimsPropertyEvaluationHists { get; set; } public virtual DbSet PimsPropertyHists { get; set; } @@ -204,6 +190,7 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsPropertyOrganizationHists { get; set; } public virtual DbSet PimsPropertyPropertyServiceFiles { get; set; } public virtual DbSet PimsPropertyPropertyServiceFileHists { get; set; } + public virtual DbSet PimsPropertyPurposeTypes { get; set; } public virtual DbSet PimsPropertyResearchFiles { get; set; } public virtual DbSet PimsPropertyResearchFileHists { get; set; } public virtual DbSet PimsPropertyRoadTypes { get; set; } @@ -221,8 +208,6 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsRegionUsers { get; set; } public virtual DbSet PimsRegionUserHists { get; set; } public virtual DbSet PimsRequestSourceTypes { get; set; } - public virtual DbSet PimsResearchActivityInstances { get; set; } - public virtual DbSet PimsResearchActivityInstanceHists { get; set; } public virtual DbSet PimsResearchFiles { get; set; } public virtual DbSet PimsResearchFileDocuments { get; set; } public virtual DbSet PimsResearchFileDocumentHists { get; set; } @@ -565,60 +550,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasComment("Indicates if the code value is inactive."); }); - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.AcquisitionActivityInstanceId) - .HasName("ACQAIN_PK"); - - entity.Property(e => e.AcquisitionActivityInstanceId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACQUISITION_ACTIVITY_INSTANCE_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship is active."); - - entity.HasOne(d => d.AcquisitionFile) - .WithMany(p => p.PimsAcquisitionActivityInstances) - .HasForeignKey(d => d.AcquisitionFileId) - .HasConstraintName("PIM_ACQNFL_PIM_ACQAIN_FK"); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsAcquisitionActivityInstances) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_ACQAIN_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.AcquisitionActivityInstanceHistId) - .HasName("PIMS_ACQAIN_H_PK"); - - entity.Property(e => e.AcquisitionActivityInstanceHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACQUISITION_ACTIVITY_INSTANCE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - modelBuilder.Entity(entity => { entity.HasKey(e => e.AcquisitionChecklistItemId) @@ -1189,465 +1120,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasComment("Indicates if the code value is inactive."); }); - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActInstPropAcqFileId) - .HasName("AIPAFL_PK"); - - entity.HasComment("File to associate an activity instance with a subset of properties associated with the superset of acquisition file properties."); - - entity.Property(e => e.ActInstPropAcqFileId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACT_INST_PROP_ACQ_FILE_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship has been disabled."); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsActInstPropAcqFiles) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_AIPAFL_FK"); - - entity.HasOne(d => d.PropertyAcquisitionFile) - .WithMany(p => p.PimsActInstPropAcqFiles) - .HasForeignKey(d => d.PropertyAcquisitionFileId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_PRACQF_PIM_AIPAFL_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActInstPropAcqFileHistId) - .HasName("PIMS_AIPAFL_H_PK"); - - entity.Property(e => e.ActInstPropAcqFileHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACT_INST_PROP_ACQ_FILE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActInstPropRsrchFileId) - .HasName("AIPRFL_PK"); - - entity.HasComment("File to associate an activity instance with a subset of properties associated with the superset of research file properties."); - - entity.Property(e => e.ActInstPropRsrchFileId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACT_INST_PROP_RSRCH_FILE_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship has been disabled."); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsActInstPropRsrchFiles) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_AIPRFL_FK"); - - entity.HasOne(d => d.PropertyResearchFile) - .WithMany(p => p.PimsActInstPropRsrchFiles) - .HasForeignKey(d => d.PropertyResearchFileId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_PRSCRC_PIM_AIPRFL_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActInstPropRsrchFileHistId) - .HasName("PIMS_AIPRFL_H_PK"); - - entity.Property(e => e.ActInstPropRsrchFileHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACT_INST_PROP_RSRCH_FILE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityInstanceId) - .HasName("ACTINS_PK"); - - entity.HasComment("Table to contain all applicable activity instances for the PIMS PSP system."); - - entity.Property(e => e.ActivityInstanceId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_INSTANCE_ID_SEQ])"); - - entity.Property(e => e.ActivityDataJson) - .HasDefaultValueSql("('')") - .HasComment("JSON structure containing data specific to an activity instance."); - - entity.Property(e => e.ActivityInstanceStatusTypeCode).HasDefaultValueSql("('NOSTART')"); - - entity.Property(e => e.ActivityTemplateId).HasDefaultValueSql("((-1))"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.Description).HasComment("Description of the activity instance."); - - entity.HasOne(d => d.ActivityInstanceStatusTypeCodeNavigation) - .WithMany(p => p.PimsActivityInstances) - .HasForeignKey(d => d.ActivityInstanceStatusTypeCode) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_ACTIST_PIM_ACTINS_FK"); - - entity.HasOne(d => d.ActivityTemplate) - .WithMany(p => p.PimsActivityInstances) - .HasForeignKey(d => d.ActivityTemplateId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_ACTTMP_PIM_ACTINS_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityInstanceDocumentId) - .HasName("ACTDOC_PK"); - - entity.HasComment("Relates a document object to an activity instance."); - - entity.Property(e => e.ActivityInstanceDocumentId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_INSTANCE_DOCUMENT_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship has been disabled."); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsActivityInstanceDocuments) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_ACTDOC_FK"); - - entity.HasOne(d => d.Document) - .WithMany(p => p.PimsActivityInstanceDocuments) - .HasForeignKey(d => d.DocumentId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_DOCMNT_PIM_ACTDOC_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityInstanceDocumentHistId) - .HasName("PIMS_ACTDOC_H_PK"); - - entity.Property(e => e.ActivityInstanceDocumentHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_INSTANCE_DOCUMENT_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityInstanceHistId) - .HasName("PIMS_ACTINS_H_PK"); - - entity.Property(e => e.ActivityInstanceHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_INSTANCE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasComment("Relates a note object to an activity instance."); - - entity.Property(e => e.PimsActivityInstanceNoteId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_INSTANCE_NOTE_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship has been disabled."); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsActivityInstanceNotes) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_ACTINN_FK"); - - entity.HasOne(d => d.Note) - .WithMany(p => p.PimsActivityInstanceNotes) - .HasForeignKey(d => d.NoteId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_NOTE_PIM_ACTINN_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityInstanceNoteHistId) - .HasName("PIMS_ACTINN_H_PK"); - - entity.Property(e => e.ActivityInstanceNoteHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_INSTANCE_NOTE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityInstanceStatusTypeCode) - .HasName("ACTIST_PK"); - - entity.HasComment("Codified values for the activity instance status type."); - - entity.Property(e => e.ActivityInstanceStatusTypeCode).HasComment("Code value for the activity instance status type."); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.Description).HasComment("Description of the activity instance status type."); - - entity.Property(e => e.DisplayOrder).HasComment("Designates a preferred presentation order of the code descriptions."); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the code value is inactive."); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityTemplateId) - .HasName("ACTTMP_PK"); - - entity.Property(e => e.ActivityTemplateId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_TEMPLATE_ID_SEQ])"); - - entity.Property(e => e.ActivityTemplateJson) - .HasDefaultValueSql("('')") - .HasComment("JSON structure desribing how to construct the activity UI."); - - entity.Property(e => e.ActivityTemplateTypeCode).HasDefaultValueSql("('GENERAL')"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the code value is inactive."); - - entity.HasOne(d => d.ActivityTemplateTypeCodeNavigation) - .WithMany(p => p.PimsActivityTemplates) - .HasForeignKey(d => d.ActivityTemplateTypeCode) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_ACTTTY_PIM_ACTTMP_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityTemplateDocumentId) - .HasName("ACTMDO_PK"); - - entity.HasComment("Associative relationship between an activity template and a document. Useful in determining with templates reference a document and conversely, which documents reference an activity template."); - - entity.Property(e => e.ActivityTemplateDocumentId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_TEMPLATE_DOCUMENT_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship has been disabled."); - - entity.HasOne(d => d.ActivityTemplate) - .WithMany(p => p.PimsActivityTemplateDocuments) - .HasForeignKey(d => d.ActivityTemplateId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_ACTTMP_PIM_ACTMDO_FK"); - - entity.HasOne(d => d.Document) - .WithMany(p => p.PimsActivityTemplateDocuments) - .HasForeignKey(d => d.DocumentId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_DOCMNT_PIM_ACTMDO_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityTemplateDocumentHistId) - .HasName("PIMS_ACTMDO_H_PK"); - - entity.Property(e => e.ActivityTemplateDocumentHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_TEMPLATE_DOCUMENT_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityTemplateHistId) - .HasName("PIMS_ACTTMP_H_PK"); - - entity.Property(e => e.ActivityTemplateHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_ACTIVITY_TEMPLATE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ActivityTemplateTypeCode) - .HasName("ACTTTY_PK"); - - entity.HasComment("Codified values for the activity type."); - - entity.Property(e => e.ActivityTemplateTypeCode).HasComment("Code value for the activity type."); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.Description).HasComment("Description of the activity type."); - - entity.Property(e => e.DisplayOrder).HasComment("Designates a preferred presentation order of the code descriptions."); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the code value is inactive."); - }); - modelBuilder.Entity(entity => { entity.HasKey(e => e.AddressId) @@ -2083,6 +1555,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.CompensationRequisitionId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMPENSATION_REQUISITION_ID_SEQ])"); + entity.Property(e => e.AdvPmtServedDt).HasComment("Date that the advanced payment was made."); + entity.Property(e => e.AgreementDt).HasComment("Agreement date."); entity.Property(e => e.AlternateProjectId).HasComment("Link a file to an \"Alternate Project\", so the user can make alternate payments that may be due after the original file's project closes."); @@ -3151,7 +2625,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - entity.Property(e => e.InterestHolderTypeCode).HasDefaultValueSql("(N'INTHLDR')"); + entity.Property(e => e.InterestHolderTypeCode).HasDefaultValueSql("('INTHLDR')"); entity.Property(e => e.IsDisabled) .HasDefaultValueSql("(CONVERT([bit],(0)))") @@ -3493,79 +2967,26 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("PIM_LPRPTY_PIM_LEASE_FK"); - entity.HasOne(d => d.LeaseResponsibilityTypeCodeNavigation) - .WithMany(p => p.PimsLeases) - .HasForeignKey(d => d.LeaseResponsibilityTypeCode) - .HasConstraintName("PIM_LRESPT_PIM_LEASE_FK"); - - entity.HasOne(d => d.LeaseStatusTypeCodeNavigation) - .WithMany(p => p.PimsLeases) - .HasForeignKey(d => d.LeaseStatusTypeCode) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_LSSTYP_PIM_LEASE_FK"); - - entity.HasOne(d => d.Project) - .WithMany(p => p.PimsLeases) - .HasForeignKey(d => d.ProjectId) - .HasConstraintName("PIM_PROJCT_PIM_LEASE_FK"); - - entity.HasOne(d => d.RegionCodeNavigation) - .WithMany(p => p.PimsLeases) - .HasForeignKey(d => d.RegionCode) - .HasConstraintName("PIM_REGION_PIM_LEASE_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.LeaseActivityInstanceId) - .HasName("LSACIN_PK"); - - entity.HasComment("Associative entity between leases/licenses and activity instances."); - - entity.Property(e => e.LeaseActivityInstanceId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_LEASE_ACTIVITY_INSTANCE_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsLeaseActivityInstances) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_LSACIN_FK"); + entity.HasOne(d => d.LeaseResponsibilityTypeCodeNavigation) + .WithMany(p => p.PimsLeases) + .HasForeignKey(d => d.LeaseResponsibilityTypeCode) + .HasConstraintName("PIM_LRESPT_PIM_LEASE_FK"); - entity.HasOne(d => d.Lease) - .WithMany(p => p.PimsLeaseActivityInstances) - .HasForeignKey(d => d.LeaseId) + entity.HasOne(d => d.LeaseStatusTypeCodeNavigation) + .WithMany(p => p.PimsLeases) + .HasForeignKey(d => d.LeaseStatusTypeCode) .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_LEASE_PIM_LSACIN_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.LeaseActivityInstanceHistId) - .HasName("PIMS_LSACIN_H_PK"); + .HasConstraintName("PIM_LSSTYP_PIM_LEASE_FK"); - entity.Property(e => e.LeaseActivityInstanceHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_LEASE_ACTIVITY_INSTANCE_H_ID_SEQ])"); + entity.HasOne(d => d.Project) + .WithMany(p => p.PimsLeases) + .HasForeignKey(d => d.ProjectId) + .HasConstraintName("PIM_PROJCT_PIM_LEASE_FK"); - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + entity.HasOne(d => d.RegionCodeNavigation) + .WithMany(p => p.PimsLeases) + .HasForeignKey(d => d.RegionCode) + .HasConstraintName("PIM_REGION_PIM_LEASE_FK"); }); modelBuilder.Entity(entity => @@ -5223,6 +4644,77 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasConstraintName("PIM_PRPRTY_PIM_PRPRAT_FK"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropPropClassificationHistId) + .HasName("PIMS_PRPRCL_H_PK"); + + entity.Property(e => e.PropPropClassificationHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROP_PROP_CLASSIFICATION_H_ID_SEQ])"); + + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropPropPurposeId) + .HasName("PRPRPU_PK"); + + entity.HasComment("Defines the contacts that are associated with this property."); + + entity.Property(e => e.PropPropPurposeId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROP_PROP_PURPOSE_ID_SEQ])"); + + entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); + + entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.IsDisabled) + .HasDefaultValueSql("(CONVERT([bit],(0)))") + .HasComment("Indicates if the code is disabled."); + + entity.Property(e => e.PropertyId).HasComment("Primary key of the associated property."); + + entity.Property(e => e.PropertyPurposeTypeCode).HasComment("Primary key of the associated property purpose."); + + entity.HasOne(d => d.Property) + .WithMany(p => p.PimsPropPropPurposes) + .HasForeignKey(d => d.PropertyId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_PRPRTY_PIM_PRPRPU_FK"); + + entity.HasOne(d => d.PropertyPurposeTypeCodeNavigation) + .WithMany(p => p.PimsPropPropPurposes) + .HasForeignKey(d => d.PropertyPurposeTypeCode) + .HasConstraintName("PIM_PRPPUR_PIM_PRPRPU_FK"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropPropPurposeHistId) + .HasName("PIMS_PRPRPU_H_PK"); + + entity.Property(e => e.PropPropPurposeHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROP_PROP_PURPOSE_H_ID_SEQ])"); + + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.PropPropRoadTypeId) @@ -5350,6 +4842,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.PropertyId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROPERTY_ID_SEQ])"); + entity.Property(e => e.AdditionalDetails).HasComment("Additional details about the property."); + entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); @@ -5394,6 +4888,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasDefaultValueSql("(CONVERT([bit],(0)))") .HasComment("Is this a sensitive property?"); + entity.Property(e => e.IsTaxesPayable).HasComment("Indicates if the property taxes are being paid."); + + entity.Property(e => e.IsUtilitiesPayable).HasComment("Indicates if the utilities are being paid."); + entity.Property(e => e.IsVisibleToOtherAgencies) .HasDefaultValueSql("(CONVERT([bit],(0)))") .HasComment("Is the property visible to other agencies?"); @@ -5424,6 +4922,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.PphStatusUpdateUserid).HasComment("Userid that updated the Provincial Public Highway status."); + entity.Property(e => e.PropertyClassificationTypeCode).HasDefaultValueSql("('UNKNOWN')"); + entity.Property(e => e.PropertyDataSourceEffectiveDate).HasComment("Date the property was officially registered"); entity.Property(e => e.SurplusDeclarationComment).HasComment("Comment regarding the surplus declaration"); @@ -5577,6 +5077,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropertyActivityHistId) + .HasName("PIMS_PRPACT_H_PK"); + + entity.Property(e => e.PropertyActivityHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROPERTY_ACTIVITY_H_ID_SEQ])"); + + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.PropertyAnomalyTypeCode) @@ -5630,6 +5140,83 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.IsDisabled).HasDefaultValueSql("(CONVERT([bit],(0)))"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropertyContactId) + .HasName("PRPCNT_PK"); + + entity.HasComment("Defines the contacts that are associated with this property."); + + entity.Property(e => e.PropertyContactId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROPERTY_CONTACT_ID_SEQ])"); + + entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); + + entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.IsDisabled) + .HasDefaultValueSql("(CONVERT([bit],(0)))") + .HasComment("Indicates if the code is disabled."); + + entity.Property(e => e.OrganizationId).HasComment("Organization ID of the property contact."); + + entity.Property(e => e.PersonId).HasComment("Person ID of the property contact."); + + entity.Property(e => e.PrimaryContactId).HasComment("Primary contact for the organization"); + + entity.Property(e => e.PropertyId).HasComment("Primary key of the associated property."); + + entity.Property(e => e.Purpose).HasComment("Purpose of property contact"); + + entity.HasOne(d => d.Organization) + .WithMany(p => p.PimsPropertyContacts) + .HasForeignKey(d => d.OrganizationId) + .HasConstraintName("PIM_ORG_PIM_PRPCNT_FK"); + + entity.HasOne(d => d.Person) + .WithMany(p => p.PimsPropertyContactPeople) + .HasForeignKey(d => d.PersonId) + .HasConstraintName("PIM_PERSON_PIM_PRPCNT_FK"); + + entity.HasOne(d => d.PrimaryContact) + .WithMany(p => p.PimsPropertyContactPrimaryContacts) + .HasForeignKey(d => d.PrimaryContactId) + .HasConstraintName("PIM_PERSON_PIM_PRM_PRPCNT_FK"); + + entity.HasOne(d => d.Property) + .WithMany(p => p.PimsPropertyContacts) + .HasForeignKey(d => d.PropertyId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_PRPRTY_PIM_PRPCNT_FK"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropertyContactHistId) + .HasName("PIMS_PRPCNT_H_PK"); + + entity.Property(e => e.PropertyContactHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROPERTY_CONTACT_H_ID_SEQ])"); + + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.PropertyEvaluationId) @@ -5924,6 +5511,34 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.PropertyPurposeTypeCode) + .HasName("PRPPUR_PK"); + + entity.HasComment("Code table to describe the property purpose type."); + + entity.Property(e => e.PropertyPurposeTypeCode).HasComment("Code representing the purpose of the property."); + + entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); + + entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.Description).HasComment("Description of the purpose of the property."); + + entity.Property(e => e.DisplayOrder).HasComment("Force the display order of the codes."); + + entity.Property(e => e.IsDisabled) + .HasDefaultValueSql("(CONVERT([bit],(0)))") + .HasComment("Indicates if the code is disabled."); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.PropertyResearchFileId) @@ -6364,63 +5979,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasComment("Indicates if the code is disabled."); }); - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ResearchActivityInstanceId) - .HasName("RSCHAI_PK"); - - entity.HasComment("Relates a research file to an activity instance."); - - entity.Property(e => e.ResearchActivityInstanceId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_RESEARCH_ACTIVITY_INSTANCE_ID_SEQ])"); - - entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); - - entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); - - entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); - - entity.Property(e => e.IsDisabled) - .HasDefaultValueSql("(CONVERT([bit],(0)))") - .HasComment("Indicates if the relationship has been disabled."); - - entity.HasOne(d => d.ActivityInstance) - .WithMany(p => p.PimsResearchActivityInstances) - .HasForeignKey(d => d.ActivityInstanceId) - .HasConstraintName("PIM_ACTINS_PIM_RSCHAI_FK"); - - entity.HasOne(d => d.ResearchFile) - .WithMany(p => p.PimsResearchActivityInstances) - .HasForeignKey(d => d.ResearchFileId) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_RESRCH_PIM_RSCHAI_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ResearchActivityInstanceHistId) - .HasName("PIMS_RSCHAI_H_PK"); - - entity.Property(e => e.ResearchActivityInstanceHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_RESEARCH_ACTIVITY_INSTANCE_H_ID_SEQ])"); - - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - modelBuilder.Entity(entity => { entity.HasKey(e => e.ResearchFileId) @@ -7925,10 +7483,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACQUISITION_ACTIVITY_INSTANCE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACQUISITION_ACTIVITY_INSTANCE_ID_SEQ") .HasMin(1) .HasMax(2147483647); @@ -7995,42 +7549,22 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACT_INST_PROP_ACQ_FILE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACT_INST_PROP_ACQ_FILE_ID_SEQ") .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACT_INST_PROP_RSRCH_FILE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACT_INST_PROP_RSRCH_FILE_ID_SEQ") .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_INSTANCE_DOCUMENT_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_INSTANCE_DOCUMENT_ID_SEQ") .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_INSTANCE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_INSTANCE_ID_SEQ") .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_INSTANCE_NOTE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_INSTANCE_NOTE_ID_SEQ") .HasMin(1) .HasMax(2147483647); @@ -8051,18 +7585,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_TEMPLATE_DOCUMENT_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_TEMPLATE_DOCUMENT_ID_SEQ") .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_TEMPLATE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_ACTIVITY_TEMPLATE_ID_SEQ") .HasMin(1) .HasMax(2147483647); @@ -8263,10 +7789,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_LEASE_ACTIVITY_INSTANCE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_LEASE_ACTIVITY_INSTANCE_ID_SEQ") .HasMin(1) .HasMax(2147483647); @@ -8395,6 +7917,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PIMS_PROPERTY_ACTIVITY_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PRF_PROP_RESEARCH_PURPOSE_ID_SEQ") .HasMin(1) .HasMax(21474483647); @@ -8479,6 +8005,22 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PROP_PROP_CLASSIFICATION_H_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + + modelBuilder.HasSequence("PIMS_PROP_PROP_CLASSIFICATION_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + + modelBuilder.HasSequence("PIMS_PROP_PROP_PURPOSE_H_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + + modelBuilder.HasSequence("PIMS_PROP_PROP_PURPOSE_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PROP_PROP_ROAD_TYPE_ID_SEQ") .HasMin(1) .HasMax(2147483647); @@ -8495,10 +8037,22 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PROPERTY_ACTIVITY_H_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PROPERTY_ACTIVITY_ID_SEQ") .HasMin(1) .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PROPERTY_CONTACT_H_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + + modelBuilder.HasSequence("PIMS_PROPERTY_CONTACT_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_PROPERTY_EVALUATION_H_ID_SEQ") .HasMin(1) .HasMax(2147483647); @@ -8583,10 +8137,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_RESEARCH_ACTIVITY_INSTANCE_H_ID_SEQ") - .HasMin(1) - .HasMax(2147483647); - modelBuilder.HasSequence("PIMS_RESEARCH_ACTIVITY_INSTANCE_ID_SEQ") .HasMin(1) .HasMax(2147483647); diff --git a/source/backend/entities/ef/PimsAcquisitionActivityInstance.cs b/source/backend/entities/ef/PimsAcquisitionActivityInstance.cs deleted file mode 100644 index af9ba048b0..0000000000 --- a/source/backend/entities/ef/PimsAcquisitionActivityInstance.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACQUISITION_ACTIVITY_INSTANCE")] - [Index(nameof(AcquisitionFileId), Name = "ACQAIN_ACQUISITION_FILE_ID_IDX")] - [Index(nameof(ActivityInstanceId), nameof(AcquisitionFileId), Name = "ACQAIN_ACQ_ACTIVITY_TUC", IsUnique = true)] - [Index(nameof(ActivityInstanceId), Name = "ACQAIN_ACTIVITY_INSTANCE_ID_IDX")] - public partial class PimsAcquisitionActivityInstance - { - [Key] - [Column("ACQUISITION_ACTIVITY_INSTANCE_ID")] - public long AcquisitionActivityInstanceId { get; set; } - [Column("ACQUISITION_FILE_ID")] - public long AcquisitionFileId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(AcquisitionFileId))] - [InverseProperty(nameof(PimsAcquisitionFile.PimsAcquisitionActivityInstances))] - public virtual PimsAcquisitionFile AcquisitionFile { get; set; } - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsAcquisitionActivityInstances))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsAcquisitionActivityInstanceHist.cs b/source/backend/entities/ef/PimsAcquisitionActivityInstanceHist.cs deleted file mode 100644 index 723f39eea0..0000000000 --- a/source/backend/entities/ef/PimsAcquisitionActivityInstanceHist.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACQUISITION_ACTIVITY_INSTANCE_HIST")] - [Index(nameof(AcquisitionActivityInstanceHistId), nameof(EndDateHist), Name = "PIMS_ACQAIN_H_UK", IsUnique = true)] - public partial class PimsAcquisitionActivityInstanceHist - { - [Key] - [Column("_ACQUISITION_ACTIVITY_INSTANCE_HIST_ID")] - public long AcquisitionActivityInstanceHistId { get; set; } - [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] - public DateTime EffectiveDateHist { get; set; } - [Column("END_DATE_HIST", TypeName = "datetime")] - public DateTime? EndDateHist { get; set; } - [Column("ACQUISITION_ACTIVITY_INSTANCE_ID")] - public long AcquisitionActivityInstanceId { get; set; } - [Column("ACQUISITION_FILE_ID")] - public long AcquisitionFileId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsAcquisitionFile.cs b/source/backend/entities/ef/PimsAcquisitionFile.cs index d5a6b0f18b..9fdfefcb89 100644 --- a/source/backend/entities/ef/PimsAcquisitionFile.cs +++ b/source/backend/entities/ef/PimsAcquisitionFile.cs @@ -22,7 +22,6 @@ public partial class PimsAcquisitionFile { public PimsAcquisitionFile() { - PimsAcquisitionActivityInstances = new HashSet(); PimsAcquisitionChecklistItems = new HashSet(); PimsAcquisitionFileDocuments = new HashSet(); PimsAcquisitionFileForms = new HashSet(); @@ -148,8 +147,6 @@ public PimsAcquisitionFile() [ForeignKey(nameof(RegionCode))] [InverseProperty(nameof(PimsRegion.PimsAcquisitionFiles))] public virtual PimsRegion RegionCodeNavigation { get; set; } - [InverseProperty(nameof(PimsAcquisitionActivityInstance.AcquisitionFile))] - public virtual ICollection PimsAcquisitionActivityInstances { get; set; } [InverseProperty(nameof(PimsAcquisitionChecklistItem.AcquisitionFile))] public virtual ICollection PimsAcquisitionChecklistItems { get; set; } [InverseProperty(nameof(PimsAcquisitionFileDocument.AcquisitionFile))] diff --git a/source/backend/entities/ef/PimsActInstPropAcqFile.cs b/source/backend/entities/ef/PimsActInstPropAcqFile.cs deleted file mode 100644 index e097496328..0000000000 --- a/source/backend/entities/ef/PimsActInstPropAcqFile.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACT_INST_PROP_ACQ_FILE")] - [Index(nameof(ActivityInstanceId), Name = "AIPAFL_ACTIVITY_INSTANCE_ID_IDX")] - [Index(nameof(PropertyAcquisitionFileId), nameof(ActivityInstanceId), Name = "AIPAFL_ACT_INST_PROP_ACQ_FL_TUC", IsUnique = true)] - [Index(nameof(PropertyAcquisitionFileId), Name = "AIPAFL_PROPERTY_ACQUISITION_FILE_ID_IDX")] - public partial class PimsActInstPropAcqFile - { - [Key] - [Column("ACT_INST_PROP_ACQ_FILE_ID")] - public long ActInstPropAcqFileId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("PROPERTY_ACQUISITION_FILE_ID")] - public long PropertyAcquisitionFileId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsActInstPropAcqFiles))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - [ForeignKey(nameof(PropertyAcquisitionFileId))] - [InverseProperty(nameof(PimsPropertyAcquisitionFile.PimsActInstPropAcqFiles))] - public virtual PimsPropertyAcquisitionFile PropertyAcquisitionFile { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActInstPropRsrchFile.cs b/source/backend/entities/ef/PimsActInstPropRsrchFile.cs deleted file mode 100644 index 7b7a688db2..0000000000 --- a/source/backend/entities/ef/PimsActInstPropRsrchFile.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACT_INST_PROP_RSRCH_FILE")] - [Index(nameof(ActivityInstanceId), Name = "AIPRFL_ACTIVITY_INSTANCE_ID_IDX")] - [Index(nameof(PropertyResearchFileId), nameof(ActivityInstanceId), Name = "AIPRFL_ACT_INST_PROP_RSRCH_FL_TUC", IsUnique = true)] - [Index(nameof(PropertyResearchFileId), Name = "AIPRFL_PROPERTY_RESEARCH_FILE_ID_IDX")] - public partial class PimsActInstPropRsrchFile - { - [Key] - [Column("ACT_INST_PROP_RSRCH_FILE_ID")] - public long ActInstPropRsrchFileId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("PROPERTY_RESEARCH_FILE_ID")] - public long PropertyResearchFileId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsActInstPropRsrchFiles))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - [ForeignKey(nameof(PropertyResearchFileId))] - [InverseProperty(nameof(PimsPropertyResearchFile.PimsActInstPropRsrchFiles))] - public virtual PimsPropertyResearchFile PropertyResearchFile { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActInstPropRsrchFileHist.cs b/source/backend/entities/ef/PimsActInstPropRsrchFileHist.cs deleted file mode 100644 index 0588e765e0..0000000000 --- a/source/backend/entities/ef/PimsActInstPropRsrchFileHist.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACT_INST_PROP_RSRCH_FILE_HIST")] - [Index(nameof(ActInstPropRsrchFileHistId), nameof(EndDateHist), Name = "PIMS_AIPRFL_H_UK", IsUnique = true)] - public partial class PimsActInstPropRsrchFileHist - { - [Key] - [Column("_ACT_INST_PROP_RSRCH_FILE_HIST_ID")] - public long ActInstPropRsrchFileHistId { get; set; } - [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] - public DateTime EffectiveDateHist { get; set; } - [Column("END_DATE_HIST", TypeName = "datetime")] - public DateTime? EndDateHist { get; set; } - [Column("ACT_INST_PROP_RSRCH_FILE_ID")] - public long ActInstPropRsrchFileId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("PROPERTY_RESEARCH_FILE_ID")] - public long PropertyResearchFileId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActivityInstance.cs b/source/backend/entities/ef/PimsActivityInstance.cs deleted file mode 100644 index 2172ad1af2..0000000000 --- a/source/backend/entities/ef/PimsActivityInstance.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACTIVITY_INSTANCE")] - [Index(nameof(ActivityInstanceStatusTypeCode), Name = "ACTINS_ACTIVITY_INSTANCE_STATUS_TYPE_CODE_IDX")] - [Index(nameof(ActivityTemplateId), Name = "ACTINS_ACTIVITY_TEMPLATE_ID_IDX")] - public partial class PimsActivityInstance - { - public PimsActivityInstance() - { - PimsAcquisitionActivityInstances = new HashSet(); - PimsActInstPropAcqFiles = new HashSet(); - PimsActInstPropRsrchFiles = new HashSet(); - PimsActivityInstanceDocuments = new HashSet(); - PimsActivityInstanceNotes = new HashSet(); - PimsLeaseActivityInstances = new HashSet(); - PimsResearchActivityInstances = new HashSet(); - } - - [Key] - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("ACTIVITY_TEMPLATE_ID")] - public long ActivityTemplateId { get; set; } - [Required] - [Column("ACTIVITY_INSTANCE_STATUS_TYPE_CODE")] - [StringLength(20)] - public string ActivityInstanceStatusTypeCode { get; set; } - [Column("DESCRIPTION")] - [StringLength(500)] - public string Description { get; set; } - [Required] - [Column("ACTIVITY_DATA_JSON")] - public string ActivityDataJson { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceStatusTypeCode))] - [InverseProperty(nameof(PimsActivityInstanceStatusType.PimsActivityInstances))] - public virtual PimsActivityInstanceStatusType ActivityInstanceStatusTypeCodeNavigation { get; set; } - [ForeignKey(nameof(ActivityTemplateId))] - [InverseProperty(nameof(PimsActivityTemplate.PimsActivityInstances))] - public virtual PimsActivityTemplate ActivityTemplate { get; set; } - [InverseProperty(nameof(PimsAcquisitionActivityInstance.ActivityInstance))] - public virtual ICollection PimsAcquisitionActivityInstances { get; set; } - [InverseProperty(nameof(PimsActInstPropAcqFile.ActivityInstance))] - public virtual ICollection PimsActInstPropAcqFiles { get; set; } - [InverseProperty(nameof(PimsActInstPropRsrchFile.ActivityInstance))] - public virtual ICollection PimsActInstPropRsrchFiles { get; set; } - [InverseProperty(nameof(PimsActivityInstanceDocument.ActivityInstance))] - public virtual ICollection PimsActivityInstanceDocuments { get; set; } - [InverseProperty(nameof(PimsActivityInstanceNote.ActivityInstance))] - public virtual ICollection PimsActivityInstanceNotes { get; set; } - [InverseProperty(nameof(PimsLeaseActivityInstance.ActivityInstance))] - public virtual ICollection PimsLeaseActivityInstances { get; set; } - [InverseProperty(nameof(PimsResearchActivityInstance.ActivityInstance))] - public virtual ICollection PimsResearchActivityInstances { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActivityInstanceDocument.cs b/source/backend/entities/ef/PimsActivityInstanceDocument.cs deleted file mode 100644 index 66d4278db2..0000000000 --- a/source/backend/entities/ef/PimsActivityInstanceDocument.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACTIVITY_INSTANCE_DOCUMENT")] - [Index(nameof(DocumentId), nameof(ActivityInstanceId), Name = "ACTDOC_ACTIVITY_DOCUMENT_TUC", IsUnique = true)] - [Index(nameof(ActivityInstanceId), Name = "ACTDOC_ACTIVITY_INSTANCE_ID_IDX")] - [Index(nameof(DocumentId), Name = "ACTDOC_DOCUMENT_ID_IDX")] - public partial class PimsActivityInstanceDocument - { - [Key] - [Column("ACTIVITY_INSTANCE_DOCUMENT_ID")] - public long ActivityInstanceDocumentId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("DOCUMENT_ID")] - public long DocumentId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsActivityInstanceDocuments))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - [ForeignKey(nameof(DocumentId))] - [InverseProperty(nameof(PimsDocument.PimsActivityInstanceDocuments))] - public virtual PimsDocument Document { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActivityInstanceNote.cs b/source/backend/entities/ef/PimsActivityInstanceNote.cs deleted file mode 100644 index 7abc5a3ce1..0000000000 --- a/source/backend/entities/ef/PimsActivityInstanceNote.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACTIVITY_INSTANCE_NOTE")] - [Index(nameof(ActivityInstanceId), Name = "ACTINN_ACTIVITY_INSTANCE_ID_IDX")] - [Index(nameof(NoteId), nameof(ActivityInstanceId), Name = "ACTINN_ACTIVITY_NOTE_TUC", IsUnique = true)] - [Index(nameof(NoteId), Name = "ACTINN_NOTE_ID_IDX")] - public partial class PimsActivityInstanceNote - { - [Key] - [Column("PIMS_ACTIVITY_INSTANCE_NOTE_ID")] - public long PimsActivityInstanceNoteId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("NOTE_ID")] - public long NoteId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsActivityInstanceNotes))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - [ForeignKey(nameof(NoteId))] - [InverseProperty(nameof(PimsNote.PimsActivityInstanceNotes))] - public virtual PimsNote Note { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActivityInstanceNoteHist.cs b/source/backend/entities/ef/PimsActivityInstanceNoteHist.cs deleted file mode 100644 index b05fa8a337..0000000000 --- a/source/backend/entities/ef/PimsActivityInstanceNoteHist.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACTIVITY_INSTANCE_NOTE_HIST")] - [Index(nameof(ActivityInstanceNoteHistId), nameof(EndDateHist), Name = "PIMS_ACTINN_H_UK", IsUnique = true)] - public partial class PimsActivityInstanceNoteHist - { - [Key] - [Column("_ACTIVITY_INSTANCE_NOTE_HIST_ID")] - public long ActivityInstanceNoteHistId { get; set; } - [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] - public DateTime EffectiveDateHist { get; set; } - [Column("END_DATE_HIST", TypeName = "datetime")] - public DateTime? EndDateHist { get; set; } - [Column("PIMS_ACTIVITY_INSTANCE_NOTE_ID")] - public long PimsActivityInstanceNoteId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("NOTE_ID")] - public long NoteId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActivityInstanceStatusType.cs b/source/backend/entities/ef/PimsActivityInstanceStatusType.cs deleted file mode 100644 index 7039080103..0000000000 --- a/source/backend/entities/ef/PimsActivityInstanceStatusType.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACTIVITY_INSTANCE_STATUS_TYPE")] - public partial class PimsActivityInstanceStatusType - { - public PimsActivityInstanceStatusType() - { - PimsActivityInstances = new HashSet(); - } - - [Key] - [Column("ACTIVITY_INSTANCE_STATUS_TYPE_CODE")] - [StringLength(20)] - public string ActivityInstanceStatusTypeCode { get; set; } - [Required] - [Column("DESCRIPTION")] - [StringLength(200)] - public string Description { get; set; } - [Required] - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("DISPLAY_ORDER")] - public int? DisplayOrder { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [InverseProperty(nameof(PimsActivityInstance.ActivityInstanceStatusTypeCodeNavigation))] - public virtual ICollection PimsActivityInstances { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsActivityTemplateDocument.cs b/source/backend/entities/ef/PimsActivityTemplateDocument.cs deleted file mode 100644 index 9fc8fbf916..0000000000 --- a/source/backend/entities/ef/PimsActivityTemplateDocument.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_ACTIVITY_TEMPLATE_DOCUMENT")] - [Index(nameof(ActivityTemplateId), Name = "ACTMDO_ACTIVITY_TEMPLATE_ID_IDX")] - [Index(nameof(ActivityTemplateId), nameof(DocumentId), Name = "ACTMDO_ACT_TMP_DOC_TUC", IsUnique = true)] - [Index(nameof(DocumentId), Name = "ACTMDO_DOCUMENT_ID_IDX")] - public partial class PimsActivityTemplateDocument - { - [Key] - [Column("ACTIVITY_TEMPLATE_DOCUMENT_ID")] - public long ActivityTemplateDocumentId { get; set; } - [Column("DOCUMENT_ID")] - public long DocumentId { get; set; } - [Column("ACTIVITY_TEMPLATE_ID")] - public long ActivityTemplateId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityTemplateId))] - [InverseProperty(nameof(PimsActivityTemplate.PimsActivityTemplateDocuments))] - public virtual PimsActivityTemplate ActivityTemplate { get; set; } - [ForeignKey(nameof(DocumentId))] - [InverseProperty(nameof(PimsDocument.PimsActivityTemplateDocuments))] - public virtual PimsDocument Document { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsCompensationRequisition.cs b/source/backend/entities/ef/PimsCompensationRequisition.cs index b9f6e5c4f2..2c11ddbfec 100644 --- a/source/backend/entities/ef/PimsCompensationRequisition.cs +++ b/source/backend/entities/ef/PimsCompensationRequisition.cs @@ -66,6 +66,8 @@ public PimsCompensationRequisition() public DateTime? GenerationDt { get; set; } [Column("FINALIZED_DATE", TypeName = "date")] public DateTime? FinalizedDate { get; set; } + [Column("ADV_PMT_SERVED_DT", TypeName = "date")] + public DateTime? AdvPmtServedDt { get; set; } [Column("SPECIAL_INSTRUCTION")] [StringLength(2000)] public string SpecialInstruction { get; set; } diff --git a/source/backend/entities/ef/PimsCompensationRequisitionHist.cs b/source/backend/entities/ef/PimsCompensationRequisitionHist.cs index adf72b2cd2..025cdc1aca 100644 --- a/source/backend/entities/ef/PimsCompensationRequisitionHist.cs +++ b/source/backend/entities/ef/PimsCompensationRequisitionHist.cs @@ -60,6 +60,8 @@ public partial class PimsCompensationRequisitionHist public DateTime? GenerationDt { get; set; } [Column("FINALIZED_DATE", TypeName = "date")] public DateTime? FinalizedDate { get; set; } + [Column("ADV_PMT_SERVED_DT", TypeName = "date")] + public DateTime? AdvPmtServedDt { get; set; } [Column("SPECIAL_INSTRUCTION")] [StringLength(2000)] public string SpecialInstruction { get; set; } diff --git a/source/backend/entities/ef/PimsDocument.cs b/source/backend/entities/ef/PimsDocument.cs index d5ae27dc1f..4143506f78 100644 --- a/source/backend/entities/ef/PimsDocument.cs +++ b/source/backend/entities/ef/PimsDocument.cs @@ -16,8 +16,6 @@ public partial class PimsDocument public PimsDocument() { PimsAcquisitionFileDocuments = new HashSet(); - PimsActivityInstanceDocuments = new HashSet(); - PimsActivityTemplateDocuments = new HashSet(); PimsFormTypes = new HashSet(); PimsLeaseDocuments = new HashSet(); PimsProjectDocuments = new HashSet(); @@ -86,10 +84,6 @@ public PimsDocument() public virtual PimsDocumentTyp DocumentType { get; set; } [InverseProperty(nameof(PimsAcquisitionFileDocument.Document))] public virtual ICollection PimsAcquisitionFileDocuments { get; set; } - [InverseProperty(nameof(PimsActivityInstanceDocument.Document))] - public virtual ICollection PimsActivityInstanceDocuments { get; set; } - [InverseProperty(nameof(PimsActivityTemplateDocument.Document))] - public virtual ICollection PimsActivityTemplateDocuments { get; set; } [InverseProperty(nameof(PimsFormType.Document))] public virtual ICollection PimsFormTypes { get; set; } [InverseProperty(nameof(PimsLeaseDocument.Document))] diff --git a/source/backend/entities/ef/PimsLease.cs b/source/backend/entities/ef/PimsLease.cs index f5abde01d7..5f4e40aa4e 100644 --- a/source/backend/entities/ef/PimsLease.cs +++ b/source/backend/entities/ef/PimsLease.cs @@ -27,7 +27,6 @@ public partial class PimsLease public PimsLease() { PimsInsurances = new HashSet(); - PimsLeaseActivityInstances = new HashSet(); PimsLeaseConsultations = new HashSet(); PimsLeaseDocuments = new HashSet(); PimsLeaseNotes = new HashSet(); @@ -212,8 +211,6 @@ public PimsLease() public virtual PimsRegion RegionCodeNavigation { get; set; } [InverseProperty(nameof(PimsInsurance.Lease))] public virtual ICollection PimsInsurances { get; set; } - [InverseProperty(nameof(PimsLeaseActivityInstance.Lease))] - public virtual ICollection PimsLeaseActivityInstances { get; set; } [InverseProperty(nameof(PimsLeaseConsultation.Lease))] public virtual ICollection PimsLeaseConsultations { get; set; } [InverseProperty(nameof(PimsLeaseDocument.Lease))] diff --git a/source/backend/entities/ef/PimsLeaseActivityInstance.cs b/source/backend/entities/ef/PimsLeaseActivityInstance.cs deleted file mode 100644 index 205bbab371..0000000000 --- a/source/backend/entities/ef/PimsLeaseActivityInstance.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_LEASE_ACTIVITY_INSTANCE")] - [Index(nameof(ActivityInstanceId), Name = "LSACIN_ACTIVITY_INSTANCE_ID_IDX")] - [Index(nameof(LeaseId), nameof(ActivityInstanceId), Name = "LSACIN_LEASE_ACTIVITY_INSTANCE_TUC", IsUnique = true)] - [Index(nameof(LeaseId), Name = "LSACIN_LEASE_ID_IDX")] - public partial class PimsLeaseActivityInstance - { - [Key] - [Column("LEASE_ACTIVITY_INSTANCE_ID")] - public long LeaseActivityInstanceId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("LEASE_ID")] - public long LeaseId { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsLeaseActivityInstances))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - [ForeignKey(nameof(LeaseId))] - [InverseProperty(nameof(PimsLease.PimsLeaseActivityInstances))] - public virtual PimsLease Lease { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsLeaseActivityInstanceHist.cs b/source/backend/entities/ef/PimsLeaseActivityInstanceHist.cs deleted file mode 100644 index ca64c30c38..0000000000 --- a/source/backend/entities/ef/PimsLeaseActivityInstanceHist.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_LEASE_ACTIVITY_INSTANCE_HIST")] - [Index(nameof(LeaseActivityInstanceHistId), nameof(EndDateHist), Name = "PIMS_LSACIN_H_UK", IsUnique = true)] - public partial class PimsLeaseActivityInstanceHist - { - [Key] - [Column("_LEASE_ACTIVITY_INSTANCE_HIST_ID")] - public long LeaseActivityInstanceHistId { get; set; } - [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] - public DateTime EffectiveDateHist { get; set; } - [Column("END_DATE_HIST", TypeName = "datetime")] - public DateTime? EndDateHist { get; set; } - [Column("LEASE_ACTIVITY_INSTANCE_ID")] - public long LeaseActivityInstanceId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("LEASE_ID")] - public long LeaseId { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsNote.cs b/source/backend/entities/ef/PimsNote.cs index e1baa023ee..e790b605a9 100644 --- a/source/backend/entities/ef/PimsNote.cs +++ b/source/backend/entities/ef/PimsNote.cs @@ -13,7 +13,6 @@ public partial class PimsNote { public PimsNote() { - PimsActivityInstanceNotes = new HashSet(); PimsLeaseNotes = new HashSet(); PimsProjectNotes = new HashSet(); PimsResearchFileNotes = new HashSet(); @@ -70,8 +69,6 @@ public PimsNote() [InverseProperty("Note")] public virtual PimsAcquisitionFileNote PimsAcquisitionFileNote { get; set; } - [InverseProperty(nameof(PimsActivityInstanceNote.Note))] - public virtual ICollection PimsActivityInstanceNotes { get; set; } [InverseProperty(nameof(PimsLeaseNote.Note))] public virtual ICollection PimsLeaseNotes { get; set; } [InverseProperty(nameof(PimsProjectNote.Note))] diff --git a/source/backend/entities/ef/PimsOrganization.cs b/source/backend/entities/ef/PimsOrganization.cs index 5e2fe3ecb4..2116c00676 100644 --- a/source/backend/entities/ef/PimsOrganization.cs +++ b/source/backend/entities/ef/PimsOrganization.cs @@ -27,6 +27,7 @@ public PimsOrganization() PimsOrganizationAddresses = new HashSet(); PimsPersonOrganizations = new HashSet(); PimsProperties = new HashSet(); + PimsPropertyContacts = new HashSet(); PimsPropertyOrganizations = new HashSet(); PimsResearchFiles = new HashSet(); PimsSecurityDepositHolders = new HashSet(); @@ -143,6 +144,8 @@ public PimsOrganization() public virtual ICollection PimsPersonOrganizations { get; set; } [InverseProperty(nameof(PimsProperty.PropMgmtOrg))] public virtual ICollection PimsProperties { get; set; } + [InverseProperty(nameof(PimsPropertyContact.Organization))] + public virtual ICollection PimsPropertyContacts { get; set; } [InverseProperty(nameof(PimsPropertyOrganization.Organization))] public virtual ICollection PimsPropertyOrganizations { get; set; } [InverseProperty(nameof(PimsResearchFile.RequestorOrganizationNavigation))] diff --git a/source/backend/entities/ef/PimsPerson.cs b/source/backend/entities/ef/PimsPerson.cs index 5738f140b8..db7f18a1ca 100644 --- a/source/backend/entities/ef/PimsPerson.cs +++ b/source/backend/entities/ef/PimsPerson.cs @@ -23,6 +23,8 @@ public PimsPerson() PimsPersonOrganizations = new HashSet(); PimsProjectPeople = new HashSet(); PimsProperties = new HashSet(); + PimsPropertyContactPeople = new HashSet(); + PimsPropertyContactPrimaryContacts = new HashSet(); PimsResearchFiles = new HashSet(); PimsSecurityDepositHolders = new HashSet(); PimsSecurityDepositReturnHolders = new HashSet(); @@ -121,6 +123,10 @@ public PimsPerson() public virtual ICollection PimsProjectPeople { get; set; } [InverseProperty(nameof(PimsProperty.PropertyManager))] public virtual ICollection PimsProperties { get; set; } + [InverseProperty(nameof(PimsPropertyContact.Person))] + public virtual ICollection PimsPropertyContactPeople { get; set; } + [InverseProperty(nameof(PimsPropertyContact.PrimaryContact))] + public virtual ICollection PimsPropertyContactPrimaryContacts { get; set; } [InverseProperty(nameof(PimsResearchFile.RequestorNameNavigation))] public virtual ICollection PimsResearchFiles { get; set; } [InverseProperty(nameof(PimsSecurityDepositHolder.Person))] diff --git a/source/backend/entities/ef/PimsActivityInstanceHist.cs b/source/backend/entities/ef/PimsPropPropClassificationHist.cs similarity index 75% rename from source/backend/entities/ef/PimsActivityInstanceHist.cs rename to source/backend/entities/ef/PimsPropPropClassificationHist.cs index efccd10799..4882d09cf6 100644 --- a/source/backend/entities/ef/PimsActivityInstanceHist.cs +++ b/source/backend/entities/ef/PimsPropPropClassificationHist.cs @@ -8,28 +8,27 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACTIVITY_INSTANCE_HIST")] - [Index(nameof(ActivityInstanceHistId), nameof(EndDateHist), Name = "PIMS_ACTINS_H_UK", IsUnique = true)] - public partial class PimsActivityInstanceHist + [Table("PIMS_PROP_PROP_CLASSIFICATION_HIST")] + [Index(nameof(PropPropClassificationHistId), nameof(EndDateHist), Name = "PIMS_PRPRCL_H_UK", IsUnique = true)] + public partial class PimsPropPropClassificationHist { [Key] - [Column("_ACTIVITY_INSTANCE_HIST_ID")] - public long ActivityInstanceHistId { get; set; } + [Column("_PROP_PROP_CLASSIFICATION_HIST_ID")] + public long PropPropClassificationHistId { get; set; } [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] public DateTime EffectiveDateHist { get; set; } [Column("END_DATE_HIST", TypeName = "datetime")] public DateTime? EndDateHist { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("ACTIVITY_TEMPLATE_ID")] - public long ActivityTemplateId { get; set; } + [Column("PROP_PROP_CLASSIFICATION_ID")] + public long PropPropClassificationId { get; set; } + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } [Required] - [Column("ACTIVITY_INSTANCE_STATUS_TYPE_CODE")] + [Column("PROPERTY_CLASSIFICATION_TYPE_CODE")] [StringLength(20)] - public string ActivityInstanceStatusTypeCode { get; set; } - [Column("DESCRIPTION")] - [StringLength(500)] - public string Description { get; set; } + public string PropertyClassificationTypeCode { get; set; } + [Column("IS_DISABLED")] + public bool IsDisabled { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] diff --git a/source/backend/entities/ef/PimsActivityTemplateDocumentHist.cs b/source/backend/entities/ef/PimsPropPropPurpose.cs similarity index 67% rename from source/backend/entities/ef/PimsActivityTemplateDocumentHist.cs rename to source/backend/entities/ef/PimsPropPropPurpose.cs index ce4ad7b777..5eb939631d 100644 --- a/source/backend/entities/ef/PimsActivityTemplateDocumentHist.cs +++ b/source/backend/entities/ef/PimsPropPropPurpose.cs @@ -8,23 +8,20 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACTIVITY_TEMPLATE_DOCUMENT_HIST")] - [Index(nameof(ActivityTemplateDocumentHistId), nameof(EndDateHist), Name = "PIMS_ACTMDO_H_UK", IsUnique = true)] - public partial class PimsActivityTemplateDocumentHist + [Table("PIMS_PROP_PROP_PURPOSE")] + [Index(nameof(PropertyId), Name = "PRPRPU_PROPERTY_ID_IDX")] + [Index(nameof(PropertyPurposeTypeCode), Name = "PRPRPU_PROPERTY_PURPOSE_TYPE_CODE_IDX")] + public partial class PimsPropPropPurpose { [Key] - [Column("_ACTIVITY_TEMPLATE_DOCUMENT_HIST_ID")] - public long ActivityTemplateDocumentHistId { get; set; } - [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] - public DateTime EffectiveDateHist { get; set; } - [Column("END_DATE_HIST", TypeName = "datetime")] - public DateTime? EndDateHist { get; set; } - [Column("ACTIVITY_TEMPLATE_DOCUMENT_ID")] - public long ActivityTemplateDocumentId { get; set; } - [Column("DOCUMENT_ID")] - public long DocumentId { get; set; } - [Column("ACTIVITY_TEMPLATE_ID")] - public long ActivityTemplateId { get; set; } + [Column("PROP_PROP_PURPOSE_ID")] + public long PropPropPurposeId { get; set; } + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + [Column("PROPERTY_PURPOSE_TYPE_CODE")] + [StringLength(20)] + public string PropertyPurposeTypeCode { get; set; } + [Required] [Column("IS_DISABLED")] public bool? IsDisabled { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] @@ -65,5 +62,12 @@ public partial class PimsActivityTemplateDocumentHist [Column("DB_LAST_UPDATE_USERID")] [StringLength(30)] public string DbLastUpdateUserid { get; set; } + + [ForeignKey(nameof(PropertyId))] + [InverseProperty(nameof(PimsProperty.PimsPropPropPurposes))] + public virtual PimsProperty Property { get; set; } + [ForeignKey(nameof(PropertyPurposeTypeCode))] + [InverseProperty(nameof(PimsPropertyPurposeType.PimsPropPropPurposes))] + public virtual PimsPropertyPurposeType PropertyPurposeTypeCodeNavigation { get; set; } } } diff --git a/source/backend/entities/ef/PimsActivityTemplateHist.cs b/source/backend/entities/ef/PimsPropPropPurposeHist.cs similarity index 79% rename from source/backend/entities/ef/PimsActivityTemplateHist.cs rename to source/backend/entities/ef/PimsPropPropPurposeHist.cs index 2596fca69f..71bdc88424 100644 --- a/source/backend/entities/ef/PimsActivityTemplateHist.cs +++ b/source/backend/entities/ef/PimsPropPropPurposeHist.cs @@ -8,23 +8,24 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACTIVITY_TEMPLATE_HIST")] - [Index(nameof(ActivityTemplateHistId), nameof(EndDateHist), Name = "PIMS_ACTTMP_H_UK", IsUnique = true)] - public partial class PimsActivityTemplateHist + [Table("PIMS_PROP_PROP_PURPOSE_HIST")] + [Index(nameof(PropPropPurposeHistId), nameof(EndDateHist), Name = "PIMS_PRPRPU_H_UK", IsUnique = true)] + public partial class PimsPropPropPurposeHist { [Key] - [Column("_ACTIVITY_TEMPLATE_HIST_ID")] - public long ActivityTemplateHistId { get; set; } + [Column("_PROP_PROP_PURPOSE_HIST_ID")] + public long PropPropPurposeHistId { get; set; } [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] public DateTime EffectiveDateHist { get; set; } [Column("END_DATE_HIST", TypeName = "datetime")] public DateTime? EndDateHist { get; set; } - [Column("ACTIVITY_TEMPLATE_ID")] - public long ActivityTemplateId { get; set; } - [Required] - [Column("ACTIVITY_TEMPLATE_TYPE_CODE")] + [Column("PROP_PROP_PURPOSE_ID")] + public long PropPropPurposeId { get; set; } + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + [Column("PROPERTY_PURPOSE_TYPE_CODE")] [StringLength(20)] - public string ActivityTemplateTypeCode { get; set; } + public string PropertyPurposeTypeCode { get; set; } [Column("IS_DISABLED")] public bool IsDisabled { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] diff --git a/source/backend/entities/ef/PimsProperty.cs b/source/backend/entities/ef/PimsProperty.cs index 9eb5fc8113..796cf3bb98 100644 --- a/source/backend/entities/ef/PimsProperty.cs +++ b/source/backend/entities/ef/PimsProperty.cs @@ -33,9 +33,11 @@ public partial class PimsProperty public PimsProperty() { PimsPropPropAnomalyTypes = new HashSet(); + PimsPropPropPurposes = new HashSet(); PimsPropPropRoadTypes = new HashSet(); PimsPropPropTenureTypes = new HashSet(); PimsPropertyAcquisitionFiles = new HashSet(); + PimsPropertyContacts = new HashSet(); PimsPropertyEvaluations = new HashSet(); PimsPropertyLeases = new HashSet(); PimsPropertyOrganizations = new HashSet(); @@ -55,10 +57,6 @@ public PimsProperty() [Column("PROPERTY_TYPE_CODE")] [StringLength(20)] public string PropertyTypeCode { get; set; } - [Required] - [Column("PROPERTY_CLASSIFICATION_TYPE_CODE")] - [StringLength(20)] - public string PropertyClassificationTypeCode { get; set; } [Column("ADDRESS_ID")] public long? AddressId { get; set; } [Column("REGION_CODE")] @@ -89,6 +87,10 @@ public PimsProperty() [Column("PPH_STATUS_TYPE_CODE")] [StringLength(20)] public string PphStatusTypeCode { get; set; } + [Required] + [Column("PROPERTY_CLASSIFICATION_TYPE_CODE")] + [StringLength(20)] + public string PropertyClassificationTypeCode { get; set; } [Column("PROPERTY_DATA_SOURCE_EFFECTIVE_DATE", TypeName = "date")] public DateTime PropertyDataSourceEffectiveDate { get; set; } [Column("NAME")] @@ -166,6 +168,13 @@ public PimsProperty() [Column("ZONING_POTENTIAL")] [StringLength(50)] public string ZoningPotential { get; set; } + [Column("ADDITIONAL_DETAILS")] + [StringLength(4000)] + public string AdditionalDetails { get; set; } + [Column("IS_UTILITIES_PAYABLE")] + public bool? IsUtilitiesPayable { get; set; } + [Column("IS_TAXES_PAYABLE")] + public bool? IsTaxesPayable { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] @@ -249,12 +258,16 @@ public PimsProperty() public virtual PimsVolumetricType VolumetricTypeCodeNavigation { get; set; } [InverseProperty(nameof(PimsPropPropAnomalyType.Property))] public virtual ICollection PimsPropPropAnomalyTypes { get; set; } + [InverseProperty(nameof(PimsPropPropPurpose.Property))] + public virtual ICollection PimsPropPropPurposes { get; set; } [InverseProperty(nameof(PimsPropPropRoadType.Property))] public virtual ICollection PimsPropPropRoadTypes { get; set; } [InverseProperty(nameof(PimsPropPropTenureType.Property))] public virtual ICollection PimsPropPropTenureTypes { get; set; } [InverseProperty(nameof(PimsPropertyAcquisitionFile.Property))] public virtual ICollection PimsPropertyAcquisitionFiles { get; set; } + [InverseProperty(nameof(PimsPropertyContact.Property))] + public virtual ICollection PimsPropertyContacts { get; set; } [InverseProperty(nameof(PimsPropertyEvaluation.Property))] public virtual ICollection PimsPropertyEvaluations { get; set; } [InverseProperty(nameof(PimsPropertyLease.Property))] diff --git a/source/backend/entities/ef/PimsPropertyAcquisitionFile.cs b/source/backend/entities/ef/PimsPropertyAcquisitionFile.cs index d993840493..0bf7aea682 100644 --- a/source/backend/entities/ef/PimsPropertyAcquisitionFile.cs +++ b/source/backend/entities/ef/PimsPropertyAcquisitionFile.cs @@ -16,7 +16,6 @@ public partial class PimsPropertyAcquisitionFile { public PimsPropertyAcquisitionFile() { - PimsActInstPropAcqFiles = new HashSet(); PimsInthldrPropInterests = new HashSet(); PimsTakes = new HashSet(); } @@ -80,8 +79,6 @@ public PimsPropertyAcquisitionFile() [ForeignKey(nameof(PropertyId))] [InverseProperty(nameof(PimsProperty.PimsPropertyAcquisitionFiles))] public virtual PimsProperty Property { get; set; } - [InverseProperty(nameof(PimsActInstPropAcqFile.PropertyAcquisitionFile))] - public virtual ICollection PimsActInstPropAcqFiles { get; set; } [InverseProperty(nameof(PimsInthldrPropInterest.PropertyAcquisitionFile))] public virtual ICollection PimsInthldrPropInterests { get; set; } [InverseProperty(nameof(PimsTake.PropertyAcquisitionFile))] diff --git a/source/backend/entities/ef/PimsActivityInstanceDocumentHist.cs b/source/backend/entities/ef/PimsPropertyActivityHist.cs similarity index 50% rename from source/backend/entities/ef/PimsActivityInstanceDocumentHist.cs rename to source/backend/entities/ef/PimsPropertyActivityHist.cs index 15c9e41fa3..52b4751d75 100644 --- a/source/backend/entities/ef/PimsActivityInstanceDocumentHist.cs +++ b/source/backend/entities/ef/PimsPropertyActivityHist.cs @@ -8,25 +8,60 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACTIVITY_INSTANCE_DOCUMENT_HIST")] - [Index(nameof(ActivityInstanceDocumentHistId), nameof(EndDateHist), Name = "PIMS_ACTDOC_H_UK", IsUnique = true)] - public partial class PimsActivityInstanceDocumentHist + [Table("PIMS_PROPERTY_ACTIVITY_HIST")] + [Index(nameof(PropertyActivityHistId), nameof(EndDateHist), Name = "PIMS_PRPACT_H_UK", IsUnique = true)] + public partial class PimsPropertyActivityHist { [Key] - [Column("_ACTIVITY_INSTANCE_DOCUMENT_HIST_ID")] - public long ActivityInstanceDocumentHistId { get; set; } + [Column("_PROPERTY_ACTIVITY_HIST_ID")] + public long PropertyActivityHistId { get; set; } [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] public DateTime EffectiveDateHist { get; set; } [Column("END_DATE_HIST", TypeName = "datetime")] public DateTime? EndDateHist { get; set; } - [Column("ACTIVITY_INSTANCE_DOCUMENT_ID")] - public long ActivityInstanceDocumentId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("DOCUMENT_ID")] - public long DocumentId { get; set; } + [Column("PIMS_PROPERTY_ACTIVITY_ID")] + public long PimsPropertyActivityId { get; set; } + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + [Required] + [Column("PROP_MGMT_ACTIVITY_TYPE_CODE")] + [StringLength(20)] + public string PropMgmtActivityTypeCode { get; set; } + [Required] + [Column("PROP_MGMT_ACTIVITY_SUBTYPE_CODE")] + [StringLength(20)] + public string PropMgmtActivitySubtypeCode { get; set; } + [Column("PROP_MGMT_ACTIVITY_STATUS_TYPE_CODE")] + [StringLength(20)] + public string PropMgmtActivityStatusTypeCode { get; set; } + [Column("MINISTRY_CONTACT_ID")] + public long? MinistryContactId { get; set; } + [Column("VENDOR_ID")] + public long? VendorId { get; set; } + [Column("REQUEST_RECEIVED_DT", TypeName = "date")] + public DateTime? RequestReceivedDt { get; set; } + [Column("COMPLETION_DT", TypeName = "date")] + public DateTime? CompletionDt { get; set; } + [Required] + [Column("DESCRIPTION")] + [StringLength(2000)] + public string Description { get; set; } + [Column("REQUEST_SOURCE")] + [StringLength(2000)] + public string RequestSource { get; set; } + [Column("INVOLVED_PARTY")] + [StringLength(2000)] + public string InvolvedParty { get; set; } + [Column("PRETAX_AMT", TypeName = "money")] + public decimal? PretaxAmt { get; set; } + [Column("GST_AMT", TypeName = "money")] + public decimal? GstAmt { get; set; } + [Column("PST_AMT", TypeName = "money")] + public decimal? PstAmt { get; set; } + [Column("TOTAL_AMT", TypeName = "money")] + public decimal? TotalAmt { get; set; } [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } + public bool IsDisabled { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] diff --git a/source/backend/entities/ef/PimsActivityTemplate.cs b/source/backend/entities/ef/PimsPropertyContact.cs similarity index 57% rename from source/backend/entities/ef/PimsActivityTemplate.cs rename to source/backend/entities/ef/PimsPropertyContact.cs index 0ef86de1a4..7031dcd5b8 100644 --- a/source/backend/entities/ef/PimsActivityTemplate.cs +++ b/source/backend/entities/ef/PimsPropertyContact.cs @@ -8,26 +8,26 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACTIVITY_TEMPLATE")] - [Index(nameof(ActivityTemplateTypeCode), Name = "ACTTMP_ACTIVITY_TEMPLATE_TYPE_CODE_IDX")] - public partial class PimsActivityTemplate + [Table("PIMS_PROPERTY_CONTACT")] + [Index(nameof(OrganizationId), Name = "PRPCNT_ORGANIZATION_ID_IDX")] + [Index(nameof(PersonId), Name = "PRPCNT_PERSON_ID_IDX")] + [Index(nameof(PropertyId), Name = "PRPCNT_PROPERTY_ID_IDX")] + public partial class PimsPropertyContact { - public PimsActivityTemplate() - { - PimsActivityInstances = new HashSet(); - PimsActivityTemplateDocuments = new HashSet(); - } - [Key] - [Column("ACTIVITY_TEMPLATE_ID")] - public long ActivityTemplateId { get; set; } - [Required] - [Column("ACTIVITY_TEMPLATE_TYPE_CODE")] - [StringLength(20)] - public string ActivityTemplateTypeCode { get; set; } - [Required] - [Column("ACTIVITY_TEMPLATE_JSON")] - public string ActivityTemplateJson { get; set; } + [Column("PROPERTY_CONTACT_ID")] + public long PropertyContactId { get; set; } + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + [Column("PERSON_ID")] + public long? PersonId { get; set; } + [Column("ORGANIZATION_ID")] + public long? OrganizationId { get; set; } + [Column("PRIMARY_CONTACT_ID")] + public long? PrimaryContactId { get; set; } + [Column("PURPOSE")] + [StringLength(500)] + public string Purpose { get; set; } [Required] [Column("IS_DISABLED")] public bool? IsDisabled { get; set; } @@ -70,12 +70,17 @@ public PimsActivityTemplate() [StringLength(30)] public string DbLastUpdateUserid { get; set; } - [ForeignKey(nameof(ActivityTemplateTypeCode))] - [InverseProperty(nameof(PimsActivityTemplateType.PimsActivityTemplates))] - public virtual PimsActivityTemplateType ActivityTemplateTypeCodeNavigation { get; set; } - [InverseProperty(nameof(PimsActivityInstance.ActivityTemplate))] - public virtual ICollection PimsActivityInstances { get; set; } - [InverseProperty(nameof(PimsActivityTemplateDocument.ActivityTemplate))] - public virtual ICollection PimsActivityTemplateDocuments { get; set; } + [ForeignKey(nameof(OrganizationId))] + [InverseProperty(nameof(PimsOrganization.PimsPropertyContacts))] + public virtual PimsOrganization Organization { get; set; } + [ForeignKey(nameof(PersonId))] + [InverseProperty(nameof(PimsPerson.PimsPropertyContactPeople))] + public virtual PimsPerson Person { get; set; } + [ForeignKey(nameof(PrimaryContactId))] + [InverseProperty(nameof(PimsPerson.PimsPropertyContactPrimaryContacts))] + public virtual PimsPerson PrimaryContact { get; set; } + [ForeignKey(nameof(PropertyId))] + [InverseProperty(nameof(PimsProperty.PimsPropertyContacts))] + public virtual PimsProperty Property { get; set; } } } diff --git a/source/backend/entities/ef/PimsActInstPropAcqFileHist.cs b/source/backend/entities/ef/PimsPropertyContactHist.cs similarity index 71% rename from source/backend/entities/ef/PimsActInstPropAcqFileHist.cs rename to source/backend/entities/ef/PimsPropertyContactHist.cs index 64cbfa2d1c..14d88466f0 100644 --- a/source/backend/entities/ef/PimsActInstPropAcqFileHist.cs +++ b/source/backend/entities/ef/PimsPropertyContactHist.cs @@ -8,25 +8,32 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACT_INST_PROP_ACQ_FILE_HIST")] - [Index(nameof(ActInstPropAcqFileHistId), nameof(EndDateHist), Name = "PIMS_AIPAFL_H_UK", IsUnique = true)] - public partial class PimsActInstPropAcqFileHist + [Table("PIMS_PROPERTY_CONTACT_HIST")] + [Index(nameof(PropertyContactHistId), nameof(EndDateHist), Name = "PIMS_PRPCNT_H_UK", IsUnique = true)] + public partial class PimsPropertyContactHist { [Key] - [Column("_ACT_INST_PROP_ACQ_FILE_HIST_ID")] - public long ActInstPropAcqFileHistId { get; set; } + [Column("_PROPERTY_CONTACT_HIST_ID")] + public long PropertyContactHistId { get; set; } [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] public DateTime EffectiveDateHist { get; set; } [Column("END_DATE_HIST", TypeName = "datetime")] public DateTime? EndDateHist { get; set; } - [Column("ACT_INST_PROP_ACQ_FILE_ID")] - public long ActInstPropAcqFileId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("PROPERTY_ACQUISITION_FILE_ID")] - public long PropertyAcquisitionFileId { get; set; } + [Column("PROPERTY_CONTACT_ID")] + public long PropertyContactId { get; set; } + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + [Column("PERSON_ID")] + public long? PersonId { get; set; } + [Column("ORGANIZATION_ID")] + public long? OrganizationId { get; set; } + [Column("PRIMARY_CONTACT_ID")] + public long? PrimaryContactId { get; set; } + [Column("PURPOSE")] + [StringLength(500)] + public string Purpose { get; set; } [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } + public bool IsDisabled { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] diff --git a/source/backend/entities/ef/PimsPropertyHist.cs b/source/backend/entities/ef/PimsPropertyHist.cs index 609b2238e0..208019b14f 100644 --- a/source/backend/entities/ef/PimsPropertyHist.cs +++ b/source/backend/entities/ef/PimsPropertyHist.cs @@ -29,10 +29,6 @@ public partial class PimsPropertyHist [Column("PROPERTY_TYPE_CODE")] [StringLength(20)] public string PropertyTypeCode { get; set; } - [Required] - [Column("PROPERTY_CLASSIFICATION_TYPE_CODE")] - [StringLength(20)] - public string PropertyClassificationTypeCode { get; set; } [Column("ADDRESS_ID")] public long? AddressId { get; set; } [Column("REGION_CODE")] @@ -63,6 +59,10 @@ public partial class PimsPropertyHist [Column("PPH_STATUS_TYPE_CODE")] [StringLength(20)] public string PphStatusTypeCode { get; set; } + [Required] + [Column("PROPERTY_CLASSIFICATION_TYPE_CODE")] + [StringLength(20)] + public string PropertyClassificationTypeCode { get; set; } [Column("PROPERTY_DATA_SOURCE_EFFECTIVE_DATE", TypeName = "date")] public DateTime PropertyDataSourceEffectiveDate { get; set; } [Column("NAME")] @@ -128,6 +128,13 @@ public partial class PimsPropertyHist [Column("ZONING_POTENTIAL")] [StringLength(50)] public string ZoningPotential { get; set; } + [Column("ADDITIONAL_DETAILS")] + [StringLength(4000)] + public string AdditionalDetails { get; set; } + [Column("IS_UTILITIES_PAYABLE")] + public bool? IsUtilitiesPayable { get; set; } + [Column("IS_TAXES_PAYABLE")] + public bool? IsTaxesPayable { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] diff --git a/source/backend/entities/ef/PimsActivityTemplateType.cs b/source/backend/entities/ef/PimsPropertyPurposeType.cs similarity index 71% rename from source/backend/entities/ef/PimsActivityTemplateType.cs rename to source/backend/entities/ef/PimsPropertyPurposeType.cs index 8d0a69f78b..8d44566d0e 100644 --- a/source/backend/entities/ef/PimsActivityTemplateType.cs +++ b/source/backend/entities/ef/PimsPropertyPurposeType.cs @@ -8,18 +8,18 @@ namespace Pims.Dal.Entities { - [Table("PIMS_ACTIVITY_TEMPLATE_TYPE")] - public partial class PimsActivityTemplateType + [Table("PIMS_PROPERTY_PURPOSE_TYPE")] + public partial class PimsPropertyPurposeType { - public PimsActivityTemplateType() + public PimsPropertyPurposeType() { - PimsActivityTemplates = new HashSet(); + PimsPropPropPurposes = new HashSet(); } [Key] - [Column("ACTIVITY_TEMPLATE_TYPE_CODE")] + [Column("PROPERTY_PURPOSE_TYPE_CODE")] [StringLength(20)] - public string ActivityTemplateTypeCode { get; set; } + public string PropertyPurposeTypeCode { get; set; } [Required] [Column("DESCRIPTION")] [StringLength(200)] @@ -44,7 +44,7 @@ public PimsActivityTemplateType() [StringLength(30)] public string DbLastUpdateUserid { get; set; } - [InverseProperty(nameof(PimsActivityTemplate.ActivityTemplateTypeCodeNavigation))] - public virtual ICollection PimsActivityTemplates { get; set; } + [InverseProperty(nameof(PimsPropPropPurpose.PropertyPurposeTypeCodeNavigation))] + public virtual ICollection PimsPropPropPurposes { get; set; } } } diff --git a/source/backend/entities/ef/PimsPropertyResearchFile.cs b/source/backend/entities/ef/PimsPropertyResearchFile.cs index d5600de0fa..832104b753 100644 --- a/source/backend/entities/ef/PimsPropertyResearchFile.cs +++ b/source/backend/entities/ef/PimsPropertyResearchFile.cs @@ -16,7 +16,6 @@ public partial class PimsPropertyResearchFile { public PimsPropertyResearchFile() { - PimsActInstPropRsrchFiles = new HashSet(); PimsPrfPropResearchPurposeTypes = new HashSet(); } @@ -88,8 +87,6 @@ public PimsPropertyResearchFile() [ForeignKey(nameof(ResearchFileId))] [InverseProperty(nameof(PimsResearchFile.PimsPropertyResearchFiles))] public virtual PimsResearchFile ResearchFile { get; set; } - [InverseProperty(nameof(PimsActInstPropRsrchFile.PropertyResearchFile))] - public virtual ICollection PimsActInstPropRsrchFiles { get; set; } [InverseProperty(nameof(PimsPrfPropResearchPurposeType.PropertyResearchFile))] public virtual ICollection PimsPrfPropResearchPurposeTypes { get; set; } } diff --git a/source/backend/entities/ef/PimsResearchActivityInstance.cs b/source/backend/entities/ef/PimsResearchActivityInstance.cs deleted file mode 100644 index 62e9286057..0000000000 --- a/source/backend/entities/ef/PimsResearchActivityInstance.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_RESEARCH_ACTIVITY_INSTANCE")] - [Index(nameof(ActivityInstanceId), Name = "RSCHAI_ACTIVITY_INSTANCE_ID_IDX")] - [Index(nameof(ResearchFileId), Name = "RSCHAI_RESEARCH_FILE_ID_IDX")] - [Index(nameof(ResearchFileId), nameof(ActivityInstanceId), Name = "RSCHAI_RSRCH_FILE_ACTIVITY_TUC", IsUnique = true)] - public partial class PimsResearchActivityInstance - { - [Key] - [Column("RESEARCH_ACTIVITY_INSTANCE_ID")] - public long ResearchActivityInstanceId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("RESEARCH_FILE_ID")] - public long ResearchFileId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - - [ForeignKey(nameof(ActivityInstanceId))] - [InverseProperty(nameof(PimsActivityInstance.PimsResearchActivityInstances))] - public virtual PimsActivityInstance ActivityInstance { get; set; } - [ForeignKey(nameof(ResearchFileId))] - [InverseProperty(nameof(PimsResearchFile.PimsResearchActivityInstances))] - public virtual PimsResearchFile ResearchFile { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsResearchActivityInstanceHist.cs b/source/backend/entities/ef/PimsResearchActivityInstanceHist.cs deleted file mode 100644 index ba048ebf58..0000000000 --- a/source/backend/entities/ef/PimsResearchActivityInstanceHist.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Table("PIMS_RESEARCH_ACTIVITY_INSTANCE_HIST")] - [Index(nameof(ResearchActivityInstanceHistId), nameof(EndDateHist), Name = "PIMS_RSCHAI_H_UK", IsUnique = true)] - public partial class PimsResearchActivityInstanceHist - { - [Key] - [Column("_RESEARCH_ACTIVITY_INSTANCE_HIST_ID")] - public long ResearchActivityInstanceHistId { get; set; } - [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] - public DateTime EffectiveDateHist { get; set; } - [Column("END_DATE_HIST", TypeName = "datetime")] - public DateTime? EndDateHist { get; set; } - [Column("RESEARCH_ACTIVITY_INSTANCE_ID")] - public long ResearchActivityInstanceId { get; set; } - [Column("ACTIVITY_INSTANCE_ID")] - public long ActivityInstanceId { get; set; } - [Column("RESEARCH_FILE_ID")] - public long ResearchFileId { get; set; } - [Column("IS_DISABLED")] - public bool? IsDisabled { get; set; } - [Column("CONCURRENCY_CONTROL_NUMBER")] - public long ConcurrencyControlNumber { get; set; } - [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppCreateTimestamp { get; set; } - [Required] - [Column("APP_CREATE_USERID")] - [StringLength(30)] - public string AppCreateUserid { get; set; } - [Column("APP_CREATE_USER_GUID")] - public Guid? AppCreateUserGuid { get; set; } - [Required] - [Column("APP_CREATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppCreateUserDirectory { get; set; } - [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime AppLastUpdateTimestamp { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USERID")] - [StringLength(30)] - public string AppLastUpdateUserid { get; set; } - [Column("APP_LAST_UPDATE_USER_GUID")] - public Guid? AppLastUpdateUserGuid { get; set; } - [Required] - [Column("APP_LAST_UPDATE_USER_DIRECTORY")] - [StringLength(30)] - public string AppLastUpdateUserDirectory { get; set; } - [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbCreateTimestamp { get; set; } - [Required] - [Column("DB_CREATE_USERID")] - [StringLength(30)] - public string DbCreateUserid { get; set; } - [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] - public DateTime DbLastUpdateTimestamp { get; set; } - [Required] - [Column("DB_LAST_UPDATE_USERID")] - [StringLength(30)] - public string DbLastUpdateUserid { get; set; } - } -} diff --git a/source/backend/entities/ef/PimsResearchFile.cs b/source/backend/entities/ef/PimsResearchFile.cs index a4316c67be..d6f9a57244 100644 --- a/source/backend/entities/ef/PimsResearchFile.cs +++ b/source/backend/entities/ef/PimsResearchFile.cs @@ -18,7 +18,6 @@ public partial class PimsResearchFile public PimsResearchFile() { PimsPropertyResearchFiles = new HashSet(); - PimsResearchActivityInstances = new HashSet(); PimsResearchFileDocuments = new HashSet(); PimsResearchFileNotes = new HashSet(); PimsResearchFileProjects = new HashSet(); @@ -119,8 +118,6 @@ public PimsResearchFile() public virtual PimsResearchFileStatusType ResearchFileStatusTypeCodeNavigation { get; set; } [InverseProperty(nameof(PimsPropertyResearchFile.ResearchFile))] public virtual ICollection PimsPropertyResearchFiles { get; set; } - [InverseProperty(nameof(PimsResearchActivityInstance.ResearchFile))] - public virtual ICollection PimsResearchActivityInstances { get; set; } [InverseProperty(nameof(PimsResearchFileDocument.ResearchFile))] public virtual ICollection PimsResearchFileDocuments { get; set; } [InverseProperty(nameof(PimsResearchFileNote.ResearchFile))] diff --git a/source/backend/entities/ef/TmpPimsPropPropAdjacentLandType.cs b/source/backend/entities/ef/TmpPimsPropPropAdjacentLandType.cs deleted file mode 100644 index 466af12a53..0000000000 --- a/source/backend/entities/ef/TmpPimsPropPropAdjacentLandType.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -#nullable disable - -namespace Pims.Dal.Entities -{ - [Keyless] - [Table("TMP_PIMS_PROP_PROP_ADJACENT_LAND_TYPE")] - public partial class TmpPimsPropPropAdjacentLandType - { - [Column("PROPERTY_ID")] - public long? PropertyId { get; set; } - [Column("PROPERTY_ADJACENT_LAND_TYPE_CODE")] - [StringLength(50)] - public string PropertyAdjacentLandTypeCode { get; set; } - } -} diff --git a/source/backend/tests/core/Entities/ActivityHelper.cs b/source/backend/tests/core/Entities/ActivityHelper.cs deleted file mode 100644 index 91e392e2b7..0000000000 --- a/source/backend/tests/core/Entities/ActivityHelper.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using Entity = Pims.Dal.Entities; - -namespace Pims.Core.Test -{ - /// - /// EntityHelper static class, provides helper methods to create test entities. - /// - public static partial class EntityHelper - { - /// - /// Create a new instance of Activity. - /// - /// - /// - public static Entity.PimsActivityInstance CreateActivity(long id = 0, Entity.PimsNote[] notes = null, Entity.PimsDocument[] documents = null, Entity.PimsActivityTemplate template = null) - { - var activity = new Entity.PimsActivityInstance() - { - ActivityInstanceId = id, - AppCreateTimestamp = DateTime.Now, - AppCreateUserid = "admin", - AppCreateUserDirectory = string.Empty, - AppLastUpdateUserDirectory = string.Empty, - AppLastUpdateUserid = string.Empty, - DbCreateUserid = string.Empty, - DbLastUpdateUserid = string.Empty, - ConcurrencyControlNumber = 1, - ActivityInstanceStatusTypeCodeNavigation = new Entity.PimsActivityInstanceStatusType() { Id = "NOSTART" }, - }; - - if (notes != null) - { - foreach (var n in notes) - { - activity.PimsActivityInstanceNotes.Add(new Entity.PimsActivityInstanceNote() - { - ActivityInstance = activity, - ActivityInstanceId = activity.ActivityInstanceId, - Note = n, - NoteId = n.NoteId, - IsDisabled = false, - }); - } - } - if (documents != null) - { - foreach (var d in documents) - { - activity.PimsActivityInstanceDocuments.Add(new Entity.PimsActivityInstanceDocument() - { - ActivityInstance = activity, - ActivityInstanceId = activity.ActivityInstanceId, - Document = d, - DocumentId = d.Internal_Id, - IsDisabled = false, - }); - } - } - if (template != null) - { - activity.ActivityTemplate = template; - } - else - { - activity.ActivityTemplate = new Entity.PimsActivityTemplate(); - } - - return activity; - } - } -} diff --git a/source/backend/tests/core/Entities/ActivityTemplateHelper.cs b/source/backend/tests/core/Entities/ActivityTemplateHelper.cs deleted file mode 100644 index defc9e5d26..0000000000 --- a/source/backend/tests/core/Entities/ActivityTemplateHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Entity = Pims.Dal.Entities; - -namespace Pims.Core.Test -{ - /// - /// EntityHelper static class, provides helper methods to create test entities. - /// - public static partial class EntityHelper - { - /// - /// Create a new template of an Activity. - /// - /// - /// - public static Entity.PimsActivityTemplate CreateActivityTemplate(long id = 0) - { - var activityTemplate = new Entity.PimsActivityTemplate() - { - ActivityTemplateId = id, - AppCreateTimestamp = DateTime.Now, - AppCreateUserid = "admin", - AppCreateUserDirectory = string.Empty, - AppLastUpdateUserDirectory = string.Empty, - AppLastUpdateUserid = string.Empty, - DbCreateUserid = string.Empty, - DbLastUpdateUserid = string.Empty, - ActivityTemplateTypeCodeNavigation = new Entity.PimsActivityTemplateType() { Id = "testActivityTemplateTypeCode" }, - ConcurrencyControlNumber = 1, - }; - - return activityTemplate; - } - } -} diff --git a/source/backend/tests/core/Entities/DocumentHelper.cs b/source/backend/tests/core/Entities/DocumentHelper.cs index aa5a9915e6..a32e201150 100644 --- a/source/backend/tests/core/Entities/DocumentHelper.cs +++ b/source/backend/tests/core/Entities/DocumentHelper.cs @@ -8,34 +8,6 @@ namespace Pims.Core.Test /// public static partial class EntityHelper { - /// - /// Create a new instance of ActivityDocument. - /// - /// - /// - /// - /// - public static Entity.PimsActivityInstanceDocument CreateActivityDocument(Entity.PimsActivityInstance activity = null, Entity.PimsDocument document = null) - { - document ??= EntityHelper.CreateDocument("Test Document"); - activity ??= EntityHelper.CreateActivity(1); - - return new Entity.PimsActivityInstanceDocument() - { - Document = document, - ActivityInstance = activity, - AppCreateTimestamp = DateTime.Now, - AppCreateUserid = "admin", - AppCreateUserDirectory = string.Empty, - AppLastUpdateUserDirectory = string.Empty, - AppLastUpdateUserid = string.Empty, - DbCreateUserid = string.Empty, - DbLastUpdateUserid = string.Empty, - IsDisabled = false, - ConcurrencyControlNumber = 1, - }; - } - /// /// Create a new instance of a Document. /// diff --git a/source/backend/tests/core/Entities/LeaseHelper.cs b/source/backend/tests/core/Entities/LeaseHelper.cs index f85bbd0d6a..2e5e7e0b87 100644 --- a/source/backend/tests/core/Entities/LeaseHelper.cs +++ b/source/backend/tests/core/Entities/LeaseHelper.cs @@ -33,8 +33,15 @@ public static Entity.PimsLease CreateLease(int pid, string lFileNo = null, strin organization.PimsOrganizationAddresses.Add(new PimsOrganizationAddress() { Organization = organization, Address = address }); if (addProperty) { - lease.PimsPropertyLeases.Add(new PimsPropertyLease() { Property = new Entity.PimsProperty() { Pid = pid, Location = GeometryHelper.CreatePoint(0, 0, SpatialReference.BCALBERS), - }, Lease = lease, }); + lease.PimsPropertyLeases.Add(new PimsPropertyLease() + { + Property = new Entity.PimsProperty() + { + Pid = pid, + Location = GeometryHelper.CreatePoint(0, 0, SpatialReference.BCALBERS), + }, + Lease = lease, + }); } lease.MotiContact = $"{motiFirstName} {motiLastName}"; lease.LeaseProgramTypeCodeNavigation = pimsLeaseProgramType ?? new Entity.PimsLeaseProgramType() { Id = "testProgramType" }; diff --git a/source/backend/tests/core/Entities/NoteHelper.cs b/source/backend/tests/core/Entities/NoteHelper.cs index e74757c32c..7f8fc2d537 100644 --- a/source/backend/tests/core/Entities/NoteHelper.cs +++ b/source/backend/tests/core/Entities/NoteHelper.cs @@ -8,34 +8,6 @@ namespace Pims.Core.Test /// public static partial class EntityHelper { - /// - /// Create a new instance of ActivityNote. - /// - /// - /// - /// - /// - public static Entity.PimsActivityInstanceNote CreateActivityNote(Entity.PimsActivityInstance activity = null, Entity.PimsNote note = null) - { - note ??= EntityHelper.CreateNote("Test Note"); - activity ??= EntityHelper.CreateActivity(1); - - return new Entity.PimsActivityInstanceNote() - { - Note = note, - ActivityInstance = activity, - AppCreateTimestamp = DateTime.Now, - AppCreateUserid = "admin", - AppCreateUserDirectory = string.Empty, - AppLastUpdateUserDirectory = string.Empty, - AppLastUpdateUserid = string.Empty, - DbCreateUserid = string.Empty, - DbLastUpdateUserid = string.Empty, - IsDisabled = false, - ConcurrencyControlNumber = 1, - }; - } - /// /// Create a new instance of AcquisitionFileNote. /// diff --git a/source/backend/tests/core/Entities/UserHelper.cs b/source/backend/tests/core/Entities/UserHelper.cs index 54ca9593fe..8a40ce82f4 100644 --- a/source/backend/tests/core/Entities/UserHelper.cs +++ b/source/backend/tests/core/Entities/UserHelper.cs @@ -1,6 +1,6 @@ -using Pims.Dal.Entities; using System; using System.Collections.Generic; +using Pims.Dal.Entities; using Entity = Pims.Dal.Entities; namespace Pims.Core.Test diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs index 155ff8642a..2764eb0da1 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/AcquisitionControllerTest.cs @@ -33,10 +33,10 @@ public class AcquisitionControllerTest public AcquisitionControllerTest() { var helper = new TestHelper(); - _controller = helper.CreateController(Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); - _mapper = helper.GetService(); - _service = helper.GetService>(); - _compReqFinancialservice = helper.GetService>(); + this._controller = helper.CreateController(Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); + this._mapper = helper.GetService(); + this._service = helper.GetService>(); + this._compReqFinancialservice = helper.GetService>(); } #region Tests @@ -48,13 +48,13 @@ public void AddAcquisitionFile_Success() { // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); - _service.Setup(m => m.Add(It.IsAny(), It.IsAny>())).Returns(acqFile); + this._service.Setup(m => m.Add(It.IsAny(), It.IsAny>())).Returns(acqFile); // Act - var result = _controller.AddAcquisitionFile(_mapper.Map(acqFile), Array.Empty()); + var result = this._controller.AddAcquisitionFile(this._mapper.Map(acqFile), Array.Empty()); // Assert - _service.Verify(m => m.Add(It.IsAny(), It.IsAny>()), Times.Once()); + this._service.Verify(m => m.Add(It.IsAny(), It.IsAny>()), Times.Once()); } /// @@ -66,13 +66,13 @@ public void GetAcquisitionFile_Success() // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); - _service.Setup(m => m.GetById(It.IsAny())).Returns(acqFile); + this._service.Setup(m => m.GetById(It.IsAny())).Returns(acqFile); // Act - var result = _controller.GetAcquisitionFile(1); + var result = this._controller.GetAcquisitionFile(1); // Assert - _service.Verify(m => m.GetById(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetById(It.IsAny()), Times.Once()); } /// @@ -83,13 +83,13 @@ public void UpdateAcquisitionFile_Success() { // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); - _service.Setup(m => m.Update(It.IsAny(), It.IsAny>())).Returns(acqFile); + this._service.Setup(m => m.Update(It.IsAny(), It.IsAny>())).Returns(acqFile); // Act - var result = _controller.UpdateAcquisitionFile(1, _mapper.Map(acqFile), Array.Empty()); + var result = this._controller.UpdateAcquisitionFile(1, this._mapper.Map(acqFile), Array.Empty()); // Assert - _service.Verify(m => m.Update(It.IsAny(), It.IsAny>()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny(), It.IsAny>()), Times.Once()); } /// @@ -101,13 +101,13 @@ public void UpdateAcquisitionFileProperties_Success() // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); - _service.Setup(m => m.UpdateProperties(It.IsAny(), It.IsAny>())).Returns(acqFile); + this._service.Setup(m => m.UpdateProperties(It.IsAny(), It.IsAny>())).Returns(acqFile); // Act - var result = _controller.UpdateAcquisitionFileProperties(_mapper.Map(acqFile), Array.Empty()); + var result = this._controller.UpdateAcquisitionFileProperties(this._mapper.Map(acqFile), Array.Empty()); // Assert - _service.Verify(m => m.UpdateProperties(It.IsAny(), It.IsAny>()), Times.Once()); + this._service.Verify(m => m.UpdateProperties(It.IsAny(), It.IsAny>()), Times.Once()); } /// @@ -117,13 +117,13 @@ public void UpdateAcquisitionFileProperties_Success() public void GetFileCompReqH120_Success() { // Arrange - _compReqFinancialservice.Setup(m => m.GetAllByAcquisitionFileId(It.IsAny(), It.IsAny())).Returns(new List()); + this._compReqFinancialservice.Setup(m => m.GetAllByAcquisitionFileId(It.IsAny(), It.IsAny())).Returns(new List()); // Act - var result = _controller.GetFileCompReqH120(1, false); + var result = this._controller.GetFileCompReqH120(1, false); // Assert - _compReqFinancialservice.Verify(x => x.GetAllByAcquisitionFileId(It.IsAny(), false)); + this._compReqFinancialservice.Verify(x => x.GetAllByAcquisitionFileId(It.IsAny(), false)); } /// @@ -133,13 +133,13 @@ public void GetFileCompReqH120_Success() public void GetFileCompReqH120_FinalOnly() { // Arrange - _compReqFinancialservice.Setup(m => m.GetAllByAcquisitionFileId(It.IsAny(), It.IsAny())).Returns(new List()); + this._compReqFinancialservice.Setup(m => m.GetAllByAcquisitionFileId(It.IsAny(), It.IsAny())).Returns(new List()); // Act - var result = _controller.GetFileCompReqH120(1, true); + var result = this._controller.GetFileCompReqH120(1, true); // Assert - _compReqFinancialservice.Verify(x => x.GetAllByAcquisitionFileId(It.IsAny(), true)); + this._compReqFinancialservice.Verify(x => x.GetAllByAcquisitionFileId(It.IsAny(), true)); } #endregion diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs index 80e8e2318e..5a19b1be7a 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/ChecklistControllerTest.cs @@ -27,9 +27,9 @@ public class ChecklistControllerTest public ChecklistControllerTest() { var helper = new TestHelper(); - _controller = helper.CreateController(Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); - _mapper = helper.GetService(); - _service = helper.GetService>(); + this._controller = helper.CreateController(Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); + this._mapper = helper.GetService(); + this._service = helper.GetService>(); } #region Tests @@ -40,13 +40,13 @@ public ChecklistControllerTest() public void GetAcquisitionFileChecklist_Success() { // Arrange - _service.Setup(m => m.GetChecklistItems(It.IsAny())).Returns(new List()); + this._service.Setup(m => m.GetChecklistItems(It.IsAny())).Returns(new List()); // Act - var result = _controller.GetAcquisitionFileChecklist(1); + var result = this._controller.GetAcquisitionFileChecklist(1); // Assert - _service.Verify(m => m.GetChecklistItems(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetChecklistItems(It.IsAny()), Times.Once()); } /// @@ -57,17 +57,15 @@ public void UpdateAcquisitionFileChecklist_Success() { // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); - _service.Setup(m => m.UpdateChecklistItems(It.IsAny())).Returns(acqFile); + this._service.Setup(m => m.UpdateChecklistItems(It.IsAny())).Returns(acqFile); // Act - var result = _controller.UpdateAcquisitionFileChecklist(_mapper.Map(acqFile)); + var result = this._controller.UpdateAcquisitionFileChecklist(this._mapper.Map(acqFile)); // Assert - _service.Verify(m => m.UpdateChecklistItems(It.IsAny()), Times.Once()); + this._service.Verify(m => m.UpdateChecklistItems(It.IsAny()), Times.Once()); } - - #endregion } } diff --git a/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs b/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs index f51e153c1b..4eb17b9155 100644 --- a/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Acquisition/InterestHolderControllerTest.cs @@ -32,38 +32,38 @@ public class InterestHolderControllerTest public InterestHolderControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.AcquisitionFileView); - _service = _helper.GetService>(); - _mapper = _helper.GetService(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.AcquisitionFileView); + this._service = this._helper.GetService>(); + this._mapper = this._helper.GetService(); } [Fact] public void GetInterestHolderByAcquisitionFileId_Success() { // Arrange - _service.Setup(m => m.GetInterestHolders(It.IsAny())); + this._service.Setup(m => m.GetInterestHolders(It.IsAny())); // Act - var result = _controller.GetAcquisitionFileInterestHolders(1); + var result = this._controller.GetAcquisitionFileInterestHolders(1); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetInterestHolders(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetInterestHolders(It.IsAny()), Times.Once()); } [Fact] public void UpdateAcquisitionPropertyTakes_Success() { // Arrange - _service.Setup(m => m.UpdateInterestHolders(It.IsAny(), It.IsAny>())); + this._service.Setup(m => m.UpdateInterestHolders(It.IsAny(), It.IsAny>())); // Act - var result = _controller.UpdateInterestHolderFile(1, new List()); + var result = this._controller.UpdateInterestHolderFile(1, new List()); // Assert result.Should().BeOfType(); - _service.Verify(m => m.UpdateInterestHolders(It.IsAny(), It.IsAny>())); + this._service.Verify(m => m.UpdateInterestHolders(It.IsAny(), It.IsAny>())); } } } diff --git a/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs b/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs index ed3ab3bab9..f479cf4f66 100644 --- a/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Admin/FinancialCodeControllerTest.cs @@ -29,67 +29,67 @@ public class FinancialCodeControllerTest public FinancialCodeControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.SystemAdmin); - _service = _helper.GetService>(); - _mapper = _helper.GetService(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.SystemAdmin); + this._service = this._helper.GetService>(); + this._mapper = this._helper.GetService(); } [Fact] public void GetFinancialCodes_Success() { // Arrange - _service.Setup(m => m.GetAllFinancialCodes()); + this._service.Setup(m => m.GetAllFinancialCodes()); // Act - var result = _controller.GetFinancialCodes(); + var result = this._controller.GetFinancialCodes(); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetAllFinancialCodes(), Times.Once()); + this._service.Verify(m => m.GetAllFinancialCodes(), Times.Once()); } [Fact] public void GetFinancialCodeById_Success() { // Arrange - _service.Setup(m => m.GetById(It.IsAny(), It.IsAny())); + this._service.Setup(m => m.GetById(It.IsAny(), It.IsAny())); // Act - var result = _controller.GetFinancialCode(FinancialCodeTypes.BusinessFunction, 1); + var result = this._controller.GetFinancialCode(FinancialCodeTypes.BusinessFunction, 1); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetById(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetById(It.IsAny(), It.IsAny()), Times.Once()); } [Fact] public void AddFinancialCode_Success() { // Arrange - _service.Setup(m => m.Add(It.IsAny(), It.IsAny())); + this._service.Setup(m => m.Add(It.IsAny(), It.IsAny())); // Act - var result = _controller.AddFinancialCode(FinancialCodeTypes.BusinessFunction, new FinancialCodeModel()); + var result = this._controller.AddFinancialCode(FinancialCodeTypes.BusinessFunction, new FinancialCodeModel()); // Assert result.Should().BeOfType(); - _service.Verify(m => m.Add(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.Add(It.IsAny(), It.IsAny()), Times.Once()); } [Fact] public void AddFinancialCode_DuplicateCode_ShouldThrow() { // Arrange - _service.Setup(m => m.Add(It.IsAny(), It.IsAny())) + this._service.Setup(m => m.Add(It.IsAny(), It.IsAny())) .Throws(); // Act - var result = _controller.AddFinancialCode(FinancialCodeTypes.BusinessFunction, new FinancialCodeModel()); + var result = this._controller.AddFinancialCode(FinancialCodeTypes.BusinessFunction, new FinancialCodeModel()); // Assert result.Should().BeOfType(); - _service.Verify(m => m.Add(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.Add(It.IsAny(), It.IsAny()), Times.Once()); } [Fact] @@ -97,15 +97,15 @@ public void UpdateFinancialCode_Success() { // Arrange var code = EntityHelper.CreateFinancialCode(FinancialCodeTypes.BusinessFunction, 1, "CODE", "description"); - var model = _mapper.Map(code); - _service.Setup(m => m.Update(It.IsAny(), It.IsAny())).Returns(model); + var model = this._mapper.Map(code); + this._service.Setup(m => m.Update(It.IsAny(), It.IsAny())).Returns(model); // Act - var result = _controller.UpdateFinancialCode(FinancialCodeTypes.BusinessFunction, model.Id, model); + var result = this._controller.UpdateFinancialCode(FinancialCodeTypes.BusinessFunction, model.Id, model); // Assert result.Should().BeOfType(); - _service.Verify(m => m.Update(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny(), It.IsAny()), Times.Once()); } [Fact] @@ -113,16 +113,16 @@ public void UpdateFinancialCode_DuplicateCode_ShouldThrow() { // Arrange var code = EntityHelper.CreateFinancialCode(FinancialCodeTypes.BusinessFunction, 1, "CODE", "description"); - var model = _mapper.Map(code); - _service.Setup(m => m.Update(It.IsAny(), It.IsAny())) + var model = this._mapper.Map(code); + this._service.Setup(m => m.Update(It.IsAny(), It.IsAny())) .Throws(); // Act - var result = _controller.UpdateFinancialCode(FinancialCodeTypes.BusinessFunction, model.Id, model); + var result = this._controller.UpdateFinancialCode(FinancialCodeTypes.BusinessFunction, model.Id, model); // Assert result.Should().BeOfType(); - _service.Verify(m => m.Update(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny(), It.IsAny()), Times.Once()); } } } diff --git a/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs index 6e9552ee41..84f02bd14d 100644 --- a/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Contacts/SearchControllerTest.cs @@ -57,7 +57,7 @@ public class SearchControllerTest public SearchControllerTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } #region Tests @@ -70,10 +70,10 @@ public SearchControllerTest() public void GetProperties_All_Success(SModel.ContactFilterModel filter) { // Arrange - var controller = _helper.CreateController(Permissions.ContactView); + var controller = this._helper.CreateController(Permissions.ContactView); - var service = _helper.GetService>(); - var mapper = _helper.GetService(); + var service = this._helper.GetService>(); + var mapper = this._helper.GetService(); service.Setup(m => m.GetPage(It.IsAny())).Returns(new Paged()); @@ -92,10 +92,10 @@ public void GetProperties_All_Success(SModel.ContactFilterModel filter) public void GetProperties_Query_Success(Uri uri) { // Arrange - var controller = _helper.CreateController(Permissions.ContactView, uri); + var controller = this._helper.CreateController(Permissions.ContactView, uri); - var service = _helper.GetService>(); - var mapper = _helper.GetService(); + var service = this._helper.GetService>(); + var mapper = this._helper.GetService(); service.Setup(m => m.GetPage(It.IsAny())).Returns(new Paged()); @@ -113,11 +113,11 @@ public void GetProperties_Query_Success(Uri uri) public void GetProperties_Query_NoFilter_BadRequest() { // Arrange - var controller = _helper.CreateController(Permissions.ContactView); - var request = _helper.GetService>(); + var controller = this._helper.CreateController(Permissions.ContactView); + var request = this._helper.GetService>(); request.Setup(m => m.QueryString).Returns(new QueryString("?page=0")); - var service = _helper.GetService>(); + var service = this._helper.GetService>(); // Act // Assert @@ -132,9 +132,9 @@ public void GetProperties_Query_NoFilter_BadRequest() public void GetProperties_NoFilter_BadRequest() { // Arrange - var controller = _helper.CreateController(Permissions.ContactView); + var controller = this._helper.CreateController(Permissions.ContactView); - var service = _helper.GetService>(); + var service = this._helper.GetService>(); // Act // Assert diff --git a/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs b/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs index 9bf60bce63..85190932e2 100644 --- a/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/FinancialCodes/FinancialCodeControllerTest.cs @@ -28,24 +28,24 @@ public class FinancialCodeControllerTest public FinancialCodeControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.ProjectView); - _service = _helper.GetService>(); - _mapper = _helper.GetService(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.ProjectView); + this._service = this._helper.GetService>(); + this._mapper = this._helper.GetService(); } [Fact] public void GetFinancialCodesByType_Success() { // Arrange - _service.Setup(m => m.GetFinancialCodesByType(It.IsAny())); + this._service.Setup(m => m.GetFinancialCodesByType(It.IsAny())); // Act - var result = _controller.GetFinancialCodesByType(FinancialCodeTypes.BusinessFunction); + var result = this._controller.GetFinancialCodesByType(FinancialCodeTypes.BusinessFunction); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetFinancialCodesByType(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetFinancialCodesByType(It.IsAny()), Times.Once()); } } } diff --git a/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs b/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs index b395d845e3..95f7cbf505 100644 --- a/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Forms/FormDocumentControllerTest.cs @@ -32,8 +32,8 @@ public class FormDocumentControllerTest public FormDocumentControllerTest() { var helper = new TestHelper(); - _controller = helper.CreateController(Permissions.AcquisitionFileView); - _service = helper.GetService>(); + this._controller = helper.CreateController(Permissions.AcquisitionFileView); + this._service = helper.GetService>(); } #region Tests @@ -46,13 +46,13 @@ public void AddFormFile_Acquisition_Success() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny())).Returns(acquisitionFileForm); + this._service.Setup(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny())).Returns(acquisitionFileForm); // Act - var result = _controller.AddFormDocumentFile(FileType.Acquisition, new FormDocumentFileModel() { FormDocumentType = new FormDocumentTypeModel() { FormTypeCode = "H120" }, FileId = 1 }); + var result = this._controller.AddFormDocumentFile(FileType.Acquisition, new FormDocumentFileModel() { FormDocumentType = new FormDocumentTypeModel() { FormTypeCode = "H120" }, FileId = 1 }); // Assert - _service.Verify(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -64,14 +64,14 @@ public void AddFormFile_Acquisition_InvalidFileType() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny())).Returns(acquisitionFileForm); + this._service.Setup(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny())).Returns(acquisitionFileForm); // Act - Action act = () => _controller.AddFormDocumentFile(FileType.Unknown, new FormDocumentFileModel() { FormDocumentType = new FormDocumentTypeModel() { FormTypeCode = "H120" }, FileId = 1 }); + Action act = () => this._controller.AddFormDocumentFile(FileType.Unknown, new FormDocumentFileModel() { FormDocumentType = new FormDocumentTypeModel() { FormTypeCode = "H120" }, FileId = 1 }); // Assert act.Should().Throw(); - _service.Verify(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny()), Times.Never()); + this._service.Verify(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny()), Times.Never()); } /// @@ -83,13 +83,13 @@ public void GetFormFile_Acquisition_Success() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.GetAcquisitionForm(It.IsAny())).Returns(acquisitionFileForm); + this._service.Setup(m => m.GetAcquisitionForm(It.IsAny())).Returns(acquisitionFileForm); // Act - var result = _controller.GetFileForm(FileType.Acquisition, 1); + var result = this._controller.GetFileForm(FileType.Acquisition, 1); // Assert - _service.Verify(m => m.GetAcquisitionForm(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetAcquisitionForm(It.IsAny()), Times.Once()); } /// @@ -101,14 +101,14 @@ public void GetFormFile_Acquisition_InvalidFileType() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.GetAcquisitionForm(It.IsAny())).Returns(acquisitionFileForm); + this._service.Setup(m => m.GetAcquisitionForm(It.IsAny())).Returns(acquisitionFileForm); // Act - Action act = () => _controller.GetFileForm(FileType.Unknown, 1); + Action act = () => this._controller.GetFileForm(FileType.Unknown, 1); // Assert act.Should().Throw(); - _service.Verify(m => m.GetAcquisitionForm(It.IsAny()), Times.Never()); + this._service.Verify(m => m.GetAcquisitionForm(It.IsAny()), Times.Never()); } /// @@ -120,13 +120,13 @@ public void GetFormFiles_Acquisition_Success() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.GetAcquisitionForms(It.IsAny())).Returns(new List() { acquisitionFileForm }); + this._service.Setup(m => m.GetAcquisitionForms(It.IsAny())).Returns(new List() { acquisitionFileForm }); // Act - var result = _controller.GetFileForms(FileType.Acquisition, 1); + var result = this._controller.GetFileForms(FileType.Acquisition, 1); // Assert - _service.Verify(m => m.GetAcquisitionForms(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetAcquisitionForms(It.IsAny()), Times.Once()); } /// @@ -138,14 +138,14 @@ public void GetFormFiles_Acquisition_InvalidFileType() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny())).Returns(acquisitionFileForm); + this._service.Setup(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny())).Returns(acquisitionFileForm); // Act - Action act = () => _controller.AddFormDocumentFile(FileType.Unknown, new FormDocumentFileModel() { FormDocumentType = new FormDocumentTypeModel() { FormTypeCode = "H120" }, FileId = 1 }); + Action act = () => this._controller.AddFormDocumentFile(FileType.Unknown, new FormDocumentFileModel() { FormDocumentType = new FormDocumentTypeModel() { FormTypeCode = "H120" }, FileId = 1 }); // Assert act.Should().Throw(); - _service.Verify(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny()), Times.Never()); + this._service.Verify(m => m.AddAcquisitionForm(It.IsAny(), It.IsAny()), Times.Never()); } /// @@ -157,13 +157,13 @@ public void DeleteFormFile_Acquisition_Success() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.DeleteAcquisitionFileForm(It.IsAny())).Returns(true); + this._service.Setup(m => m.DeleteAcquisitionFileForm(It.IsAny())).Returns(true); // Act - var result = _controller.DeleteFileForm(FileType.Acquisition, 1); + var result = this._controller.DeleteFileForm(FileType.Acquisition, 1); // Assert - _service.Verify(m => m.DeleteAcquisitionFileForm(It.IsAny()), Times.Once()); + this._service.Verify(m => m.DeleteAcquisitionFileForm(It.IsAny()), Times.Once()); } /// @@ -175,14 +175,14 @@ public void DeleteFormFile_Acquisition_InvalidFileType() // Arrange var acquisitionFileForm = new PimsAcquisitionFileForm(); - _service.Setup(m => m.DeleteAcquisitionFileForm(It.IsAny())).Returns(true); + this._service.Setup(m => m.DeleteAcquisitionFileForm(It.IsAny())).Returns(true); // Act - Action act = () => _controller.DeleteFileForm(FileType.Unknown, 1); + Action act = () => this._controller.DeleteFileForm(FileType.Unknown, 1); // Assert act.Should().Throw(); - _service.Verify(m => m.DeleteAcquisitionFileForm(It.IsAny()), Times.Never()); + this._service.Verify(m => m.DeleteAcquisitionFileForm(It.IsAny()), Times.Never()); } #endregion } diff --git a/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs b/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs index 855b83d596..a8a624a8c3 100644 --- a/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/H120Category/H120CategoryControllerTest.cs @@ -32,24 +32,24 @@ public class H120CategoryControllerTest public H120CategoryControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.CompensationRequisitionView); - _service = _helper.GetService>(); - _mapper = _helper.GetService(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.CompensationRequisitionView); + this._service = this._helper.GetService>(); + this._mapper = this._helper.GetService(); } [Fact] public void GetTakesByPropertyId_Success() { // Arrange - _service.Setup(m => m.GetAll()); + this._service.Setup(m => m.GetAll()); // Act - var result = _controller.GetH120Categories(); + var result = this._controller.GetH120Categories(); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetAll(), Times.Once()); + this._service.Verify(m => m.GetAll(), Times.Once()); } } } diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs index d1a229ea5a..6a56bd0c4b 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseControllerTest.cs @@ -34,11 +34,11 @@ public class LeaseControllerTest public LeaseControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); - _repository = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); + this._repository = this._helper.GetService>(); } #region Tests @@ -53,13 +53,13 @@ public void GetLeases_All_Success() var lease = EntityHelper.CreateLease(1); - _service.Setup(m => m.GetById(It.IsAny())).Returns(lease); + this._service.Setup(m => m.GetById(It.IsAny())).Returns(lease); // Act - var result = _controller.GetLease(1); + var result = this._controller.GetLease(1); // Assert - _service.Verify(m => m.GetById(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetById(It.IsAny()), Times.Once()); } #endregion #region UpdateLeases @@ -72,13 +72,13 @@ public void UpdateLeases_All_Success() // Arrange var lease = EntityHelper.CreateLease(1); - _service.Setup(m => m.Update(It.IsAny(), new List())).Returns(lease); + this._service.Setup(m => m.Update(It.IsAny(), new List())).Returns(lease); // Act - var result = _controller.UpdateLease(_mapper.Map(lease), Array.Empty()); + var result = this._controller.UpdateLease(this._mapper.Map(lease), Array.Empty()); // Assert - _service.Verify(m => m.Update(It.IsAny(), new List()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny(), new List()), Times.Once()); } [Fact] @@ -87,13 +87,13 @@ public void UpdateLeases_AreaUnit_Success() // Arrange var lease = EntityHelper.CreateLease(1); - _service.Setup(m => m.Update(It.IsAny(), new List())).Returns(lease); + this._service.Setup(m => m.Update(It.IsAny(), new List())).Returns(lease); // Act - var result = _controller.UpdateLease(_mapper.Map(lease), Array.Empty()); + var result = this._controller.UpdateLease(this._mapper.Map(lease), Array.Empty()); // Assert - _service.Verify(m => m.Update(It.IsAny(), new List()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny(), new List()), Times.Once()); } #endregion #endregion diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs index 0ad0004b16..f0d69fce9c 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseImprovementControllerTest.cs @@ -31,10 +31,10 @@ public class LeaseImprovementControllerTest public LeaseImprovementControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _repository = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._repository = this._helper.GetService>(); } #region Tests @@ -49,13 +49,13 @@ public void UpdateImprovements_All_Success() var lease = EntityHelper.CreateLease(1); lease.PimsPropertyImprovements = new List() { new Dal.Entities.PimsPropertyImprovement() { Internal_Id = 1 } }; - _repository.Setup(m => m.UpdateImprovementsByLeaseId(It.IsAny(), It.IsAny>())).Returns(lease.PimsPropertyImprovements); + this._repository.Setup(m => m.UpdateImprovementsByLeaseId(It.IsAny(), It.IsAny>())).Returns(lease.PimsPropertyImprovements); // Act - var result = _controller.UpdateImprovements(lease.Internal_Id, _mapper.Map>(lease.PimsPropertyImprovements)); + var result = this._controller.UpdateImprovements(lease.Internal_Id, this._mapper.Map>(lease.PimsPropertyImprovements)); // Assert - _repository.Verify(m => m.UpdateImprovementsByLeaseId(It.IsAny(), It.IsAny>()), Times.Once()); + this._repository.Verify(m => m.UpdateImprovementsByLeaseId(It.IsAny(), It.IsAny>()), Times.Once()); } #endregion #endregion diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs index 2eb2ee89ed..6d3737d593 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeasePaymentControllerTest.cs @@ -30,10 +30,10 @@ public class LeasePaymentControllerTest public LeasePaymentControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); } #region Tests @@ -48,13 +48,13 @@ public void UpdateLeasePayments_Success() var lease = EntityHelper.CreateLease(1); var leasePayment = new Dal.Entities.PimsLeasePayment() { LeasePaymentId = 1 }; - _service.Setup(m => m.UpdatePayment(It.IsAny(), It.IsAny(), It.IsAny())).Returns(leasePayment); + this._service.Setup(m => m.UpdatePayment(It.IsAny(), It.IsAny(), It.IsAny())).Returns(leasePayment); // Act - var result = _controller.UpdatePayment(lease.LeaseId, leasePayment.LeasePaymentId, _mapper.Map(lease)); + var result = this._controller.UpdatePayment(lease.LeaseId, leasePayment.LeasePaymentId, this._mapper.Map(lease)); // Assert - _service.Verify(m => m.UpdatePayment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.UpdatePayment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -67,13 +67,13 @@ public void DeleteLeasePayments_Success() var lease = EntityHelper.CreateLease(1); var leasePayment = new Dal.Entities.PimsLeasePayment(); - _service.Setup(m => m.DeletePayment(It.IsAny(), It.IsAny())).Returns(true); + this._service.Setup(m => m.DeletePayment(It.IsAny(), It.IsAny())).Returns(true); // Act - var result = _controller.DeletePayment(lease.LeaseId, _mapper.Map(lease)); + var result = this._controller.DeletePayment(lease.LeaseId, this._mapper.Map(lease)); // Assert - _service.Verify(m => m.DeletePayment(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.DeletePayment(It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -86,13 +86,13 @@ public void AddLeasePayments_Success() var lease = EntityHelper.CreateLease(1); var leasePayment = new Dal.Entities.PimsLeasePayment(); - _service.Setup(m => m.AddPayment(It.IsAny(), It.IsAny())).Returns(leasePayment); + this._service.Setup(m => m.AddPayment(It.IsAny(), It.IsAny())).Returns(leasePayment); // Act - var result = _controller.AddPayment(lease.LeaseId, _mapper.Map(lease)); + var result = this._controller.AddPayment(lease.LeaseId, this._mapper.Map(lease)); // Assert - _service.Verify(m => m.AddPayment(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.AddPayment(It.IsAny(), It.IsAny()), Times.Once()); } #endregion } diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseTenantControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseTenantControllerTest.cs index fc10b34867..1ef41944c3 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseTenantControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseTenantControllerTest.cs @@ -29,10 +29,10 @@ public class LeaseTenantControllerTest public LeaseTenantControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _repository = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._repository = this._helper.GetService>(); } #region Tests @@ -46,13 +46,13 @@ public void UpdateLeaseTenants_Success() // Arrange var lease = EntityHelper.CreateLease(1); - _repository.Setup(m => m.UpdateTenantsByLeaseId(It.IsAny(), It.IsAny>())).Returns(lease.PimsLeaseTenants); + this._repository.Setup(m => m.UpdateTenantsByLeaseId(It.IsAny(), It.IsAny>())).Returns(lease.PimsLeaseTenants); // Act - var result = _controller.UpdateTenants(lease.LeaseId, _mapper.Map>(new List())); + var result = this._controller.UpdateTenants(lease.LeaseId, this._mapper.Map>(new List())); // Assert - _repository.Verify(m => m.UpdateTenantsByLeaseId(It.IsAny(), It.IsAny>()), Times.Once()); + this._repository.Verify(m => m.UpdateTenantsByLeaseId(It.IsAny(), It.IsAny>()), Times.Once()); } #endregion #endregion diff --git a/source/backend/tests/unit/api/Controllers/Leases/LeaseTermControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/LeaseTermControllerTest.cs index 470fda358b..374be21255 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/LeaseTermControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/LeaseTermControllerTest.cs @@ -30,10 +30,10 @@ public class LeaseTermControllerTest public LeaseTermControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); } #region Tests @@ -47,13 +47,13 @@ public void UpdateLeaseTerms_Success() var lease = EntityHelper.CreateLease(1); var leaseTerm = new Dal.Entities.PimsLeaseTerm() { LeaseTermId = 1 }; - _service.Setup(m => m.UpdateTerm(It.IsAny(), It.IsAny(), It.IsAny())).Returns(leaseTerm); + this._service.Setup(m => m.UpdateTerm(It.IsAny(), It.IsAny(), It.IsAny())).Returns(leaseTerm); // Act - var result = _controller.UpdateTerm(lease.LeaseId, leaseTerm.LeaseTermId, _mapper.Map(leaseTerm)); + var result = this._controller.UpdateTerm(lease.LeaseId, leaseTerm.LeaseTermId, this._mapper.Map(leaseTerm)); // Assert - _service.Verify(m => m.UpdateTerm(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.UpdateTerm(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -66,13 +66,13 @@ public void DeleteLeaseTerms_Success() var lease = EntityHelper.CreateLease(1); var leaseTerm = new Dal.Entities.PimsLeaseTerm(); - _service.Setup(m => m.DeleteTerm(It.IsAny(), It.IsAny())).Returns(true); + this._service.Setup(m => m.DeleteTerm(It.IsAny(), It.IsAny())).Returns(true); // Act - var result = _controller.DeleteTerm(lease.LeaseId, _mapper.Map(leaseTerm)); + var result = this._controller.DeleteTerm(lease.LeaseId, this._mapper.Map(leaseTerm)); // Assert - _service.Verify(m => m.DeleteTerm(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.DeleteTerm(It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -85,13 +85,13 @@ public void AddLeaseTerms_Success() var lease = EntityHelper.CreateLease(1); var leaseTerm = new Dal.Entities.PimsLeaseTerm(); - _service.Setup(m => m.AddTerm(It.IsAny(), It.IsAny())).Returns(leaseTerm); + this._service.Setup(m => m.AddTerm(It.IsAny(), It.IsAny())).Returns(leaseTerm); // Act - var result = _controller.AddTerm(lease.LeaseId, _mapper.Map(leaseTerm)); + var result = this._controller.AddTerm(lease.LeaseId, this._mapper.Map(leaseTerm)); // Assert - _service.Verify(m => m.AddTerm(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.AddTerm(It.IsAny(), It.IsAny()), Times.Once()); } #endregion } diff --git a/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs index 420224dc39..fba1c62653 100644 --- a/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Leases/SearchControllerTest.cs @@ -34,10 +34,10 @@ public class SearchControllerTest public SearchControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); } #region Variables @@ -68,13 +68,13 @@ public void GetLeases_All_Success(SModel.LeaseFilterModel filter) // Arrange var leases = new[] { EntityHelper.CreateLease(1) }; - _service.Setup(m => m.GetPage(It.IsAny(), false)).Returns(new Paged(leases)); + this._service.Setup(m => m.GetPage(It.IsAny(), false)).Returns(new Paged(leases)); // Act - var result = _controller.GetLeases(filter); + var result = this._controller.GetLeases(filter); // Assert - _service.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._service.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } /// @@ -87,13 +87,13 @@ public void GetProperties_Query_Success(Uri uri) // Arrange var leases = new[] { EntityHelper.CreateLease(1) }; - _service.Setup(m => m.GetPage(It.IsAny(), false)).Returns(new Paged(leases)); + this._service.Setup(m => m.GetPage(It.IsAny(), false)).Returns(new Paged(leases)); // Act - var result = _controller.GetLeases(); + var result = this._controller.GetLeases(); // Assert - _service.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._service.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } /// @@ -103,13 +103,13 @@ public void GetProperties_Query_Success(Uri uri) public void GetProperties_Query_NoFilter_BadRequest() { // Arrange - var request = _helper.GetService>(); + var request = this._helper.GetService>(); request.Setup(m => m.QueryString).Returns(new QueryString("?page=0")); // Act // Assert - Assert.Throws(() => _controller.GetLeases()); - _service.Verify(m => m.GetPage(It.IsAny(), false), Times.Never()); + Assert.Throws(() => this._controller.GetLeases()); + this._service.Verify(m => m.GetPage(It.IsAny(), false), Times.Never()); } /// @@ -121,8 +121,8 @@ public void GetProperties_NoFilter_BadRequest() // Act // Assert - Assert.Throws(() => _controller.GetLeases(null)); - _service.Verify(m => m.GetPage(It.IsAny(), false), Times.Never()); + Assert.Throws(() => this._controller.GetLeases(null)); + this._service.Verify(m => m.GetPage(It.IsAny(), false), Times.Never()); } #endregion #endregion diff --git a/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs b/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs index fc2abb184c..5bcabda0f9 100644 --- a/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/LookupControllerTest.cs @@ -39,10 +39,10 @@ public class LookupControllerTest #region Constructors public LookupControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.SystemAdmin); - _mapper = _helper.GetService(); - _repository = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.SystemAdmin); + this._mapper = this._helper.GetService(); + this._repository = this._helper.GetService>(); } #endregion @@ -56,13 +56,13 @@ public void GetPropertyClassificationTypeCodes() { Id = "Surplus Active", }; - _repository.Setup(m => m.GetAllPropertyClassificationTypes()).Returns(new[] { propertyClassification }); + this._repository.Setup(m => m.GetAllPropertyClassificationTypes()).Returns(new[] { propertyClassification }); // Act - var result = _controller.GetPropertyClassificationTypes(); + var result = this._controller.GetPropertyClassificationTypes(); // Assert - _repository.Verify(m => m.GetAllPropertyClassificationTypes(), Times.Once()); + this._repository.Verify(m => m.GetAllPropertyClassificationTypes(), Times.Once()); } [Fact] @@ -76,68 +76,67 @@ public void GetRoleCodes() Name = "Ministry of Health", Description = "The Ministry of Health", }; - _repository.Setup(m => m.GetAllRoles()).Returns(new[] { role }); + this._repository.Setup(m => m.GetAllRoles()).Returns(new[] { role }); // Act - var result = _controller.GetRoles(); + var result = this._controller.GetRoles(); // Assert - _repository.Verify(m => m.GetAllRoles(), Times.Once()); + this._repository.Verify(m => m.GetAllRoles(), Times.Once()); } [Fact] public void GetAll() { // Arrange - var memoryCache = _helper.GetService>(); + var memoryCache = this._helper.GetService>(); var cacheEntry = new Mock(); memoryCache.Setup(m => m.CreateEntry(It.IsAny())).Returns(cacheEntry.Object); var areaUnitTypes = EntityHelper.CreatePropertyAreaUnitType("area"); - _repository.Setup(m => m.GetAllPropertyAreaUnitTypes()).Returns(new[] { areaUnitTypes }); + this._repository.Setup(m => m.GetAllPropertyAreaUnitTypes()).Returns(new[] { areaUnitTypes }); var classificationTypes = EntityHelper.CreatePropertyClassificationType("classification"); - _repository.Setup(m => m.GetAllPropertyClassificationTypes()).Returns(new[] { classificationTypes }); + this._repository.Setup(m => m.GetAllPropertyClassificationTypes()).Returns(new[] { classificationTypes }); var countries = EntityHelper.CreateCountry(1, "CAN"); - _repository.Setup(m => m.GetAllCountries()).Returns(new[] { countries }); + this._repository.Setup(m => m.GetAllCountries()).Returns(new[] { countries }); var districts = EntityHelper.CreateDistrict(1, "district"); - _repository.Setup(m => m.GetAllDistricts()).Returns(new[] { districts }); + this._repository.Setup(m => m.GetAllDistricts()).Returns(new[] { districts }); var organizationTypes = EntityHelper.CreateOrganizationType("orgtype"); - _repository.Setup(m => m.GetAllOrganizationTypes()).Returns(new[] { organizationTypes }); + this._repository.Setup(m => m.GetAllOrganizationTypes()).Returns(new[] { organizationTypes }); var propertyTypes = EntityHelper.CreatePropertyType("property"); - _repository.Setup(m => m.GetAllPropertyTypes()).Returns(new[] { propertyTypes }); + this._repository.Setup(m => m.GetAllPropertyTypes()).Returns(new[] { propertyTypes }); var provinces = EntityHelper.CreateProvince(1, "BC"); - _repository.Setup(m => m.GetAllProvinces()).Returns(new[] { provinces }); + this._repository.Setup(m => m.GetAllProvinces()).Returns(new[] { provinces }); var regions = EntityHelper.CreateRegion(1, "region"); - _repository.Setup(m => m.GetAllRegions()).Returns(new[] { regions }); + this._repository.Setup(m => m.GetAllRegions()).Returns(new[] { regions }); var roleCodes = EntityHelper.CreateRole("admin"); - _repository.Setup(m => m.GetAllRoles()).Returns(new[] { roleCodes }); + this._repository.Setup(m => m.GetAllRoles()).Returns(new[] { roleCodes }); var tenureTypes = EntityHelper.CreatePropertyTenureType("tenure"); - _repository.Setup(m => m.GetAllPropertyTenureTypes()).Returns(new[] { tenureTypes }); + this._repository.Setup(m => m.GetAllPropertyTenureTypes()).Returns(new[] { tenureTypes }); // Act - var result = (JsonResult)_controller.GetAll(); + var result = (JsonResult)this._controller.GetAll(); // Assert var lookups = (IEnumerable)result.Value; - _repository.Verify(m => m.GetAllPropertyAreaUnitTypes(), Times.Once()); - _repository.Verify(m => m.GetAllPropertyClassificationTypes(), Times.Once()); - _repository.Verify(m => m.GetAllCountries(), Times.Once()); - _repository.Verify(m => m.GetAllDistricts(), Times.Once()); - _repository.Verify(m => m.GetAllOrganizationTypes(), Times.Once()); - _repository.Verify(m => m.GetAllPropertyTypes(), Times.Once()); - _repository.Verify(m => m.GetAllProvinces(), Times.Once()); - _repository.Verify(m => m.GetAllRegions(), Times.Once()); - _repository.Verify(m => m.GetAllPropertyTenureTypes(), Times.Once()); - + this._repository.Verify(m => m.GetAllPropertyAreaUnitTypes(), Times.Once()); + this._repository.Verify(m => m.GetAllPropertyClassificationTypes(), Times.Once()); + this._repository.Verify(m => m.GetAllCountries(), Times.Once()); + this._repository.Verify(m => m.GetAllDistricts(), Times.Once()); + this._repository.Verify(m => m.GetAllOrganizationTypes(), Times.Once()); + this._repository.Verify(m => m.GetAllPropertyTypes(), Times.Once()); + this._repository.Verify(m => m.GetAllProvinces(), Times.Once()); + this._repository.Verify(m => m.GetAllRegions(), Times.Once()); + this._repository.Verify(m => m.GetAllPropertyTenureTypes(), Times.Once()); } [Fact] @@ -150,7 +149,7 @@ public void GetAll_Cached() var mapper = helper.GetService(); var repository = helper.GetService>(); var memoryCache = helper.GetService>(); - var cachedResult = (object)new JsonResult(""); + var cachedResult = (object)new JsonResult(string.Empty); memoryCache.Setup(m => m.TryGetValue(It.IsAny(), out cachedResult)).Returns(true); diff --git a/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs b/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs index b142ee90fd..47ba35c546 100644 --- a/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Note/NoteControllerTest.cs @@ -42,10 +42,10 @@ public class NoteControllerTest public NoteControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.NoteAdd, Permissions.NoteView, Permissions.NoteEdit); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.NoteAdd, Permissions.NoteView, Permissions.NoteEdit); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); } #region Tests @@ -56,16 +56,16 @@ public NoteControllerTest() public void AddNote_Success() { // Arrange - var note = EntityHelper.CreateActivityNote(); - var noteModel = _mapper.Map(note); + var note = EntityHelper.CreateProjectNote(); + var noteModel = this._mapper.Map(note); - _service.Setup(m => m.Add(It.IsAny(), It.IsAny())).Returns(noteModel); + this._service.Setup(m => m.Add(It.IsAny(), It.IsAny())).Returns(noteModel); // Act - var result = _controller.AddNote(Constants.NoteType.Activity, noteModel); + var result = this._controller.AddNote(Constants.NoteType.Project, noteModel); // Assert - _service.Verify(m => m.Add(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.Add(It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -77,13 +77,13 @@ public void GetNotes_All_Success() // Arrange var notes = new[] { EntityHelper.CreateNote("Note 1"), EntityHelper.CreateNote("Note 2") }; - _service.Setup(m => m.GetNotes(It.IsAny(), It.IsAny())).Returns(notes); + this._service.Setup(m => m.GetNotes(It.IsAny(), It.IsAny())).Returns(notes); // Act - var result = _controller.GetNotes(Constants.NoteType.Activity, 1); + var result = this._controller.GetNotes(Constants.NoteType.Project, 1); // Assert - _service.Verify(m => m.GetNotes(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetNotes(It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -94,15 +94,15 @@ public void GetNoteById_Success() { // Arrange var note = EntityHelper.CreateNote("Note 1"); - var noteModel = _mapper.Map(note); + var noteModel = this._mapper.Map(note); - _service.Setup(m => m.GetById(It.IsAny())).Returns(noteModel); + this._service.Setup(m => m.GetById(It.IsAny())).Returns(noteModel); // Act - var result = _controller.GetNoteById(1); + var result = this._controller.GetNoteById(1); // Assert - _service.Verify(m => m.GetById(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetById(It.IsAny()), Times.Once()); } /// @@ -113,28 +113,28 @@ public void UpdateNote_Success() { // Arrange var note = EntityHelper.CreateNote("Note 1"); - var noteModel = _mapper.Map(note); + var noteModel = this._mapper.Map(note); - _service.Setup(m => m.Update(It.IsAny())).Returns(noteModel); + this._service.Setup(m => m.Update(It.IsAny())).Returns(noteModel); // Act - var result = _controller.UpdateNote(1, noteModel); + var result = this._controller.UpdateNote(1, noteModel); // Assert - _service.Verify(m => m.Update(It.IsAny()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny()), Times.Once()); } [Fact] public void Delete_Note_Success() { // Arrange - _service.Setup(m => m.DeleteNote(It.IsAny(), It.IsAny(), true)); + this._service.Setup(m => m.DeleteNote(It.IsAny(), It.IsAny(), true)); // Act - var result = _controller.DeleteNote(Constants.NoteType.Activity, 1); + var result = this._controller.DeleteNote(Constants.NoteType.Project, 1); // Assert - _service.Verify(m => m.DeleteNote(It.IsAny(), It.IsAny(), true), Times.Once()); + this._service.Verify(m => m.DeleteNote(It.IsAny(), It.IsAny(), true), Times.Once()); } #endregion } diff --git a/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs b/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs index d5ea9688e0..8d79c6af53 100644 --- a/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Organization/OrganizationControllerTest.cs @@ -29,10 +29,10 @@ public class OrganizationControllerTest public OrganizationControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); } #region Get /// @@ -44,13 +44,13 @@ public void GetOrganization_Success() // Arrange var organization = EntityHelper.CreateOrganization(1, "Test Name"); - _service.Setup(m => m.GetOrganization(It.IsAny())).Returns(organization); + this._service.Setup(m => m.GetOrganization(It.IsAny())).Returns(organization); // Act - var result = _controller.GetOrganization(1); + var result = this._controller.GetOrganization(1); // Assert - _service.Verify(m => m.GetOrganization(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetOrganization(It.IsAny()), Times.Once()); } #endregion #region Update @@ -64,13 +64,13 @@ public void UpdateOrganization_Success() var organization = EntityHelper.CreateOrganization(1, "Test Name"); - _service.Setup(m => m.UpdateOrganization(It.IsAny(), It.IsAny())).Returns(organization); + this._service.Setup(m => m.UpdateOrganization(It.IsAny(), It.IsAny())).Returns(organization); // Act - var result = _controller.UpdateOrganization(_mapper.Map(organization)); + var result = this._controller.UpdateOrganization(this._mapper.Map(organization)); // Assert - _service.Verify(m => m.UpdateOrganization(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.UpdateOrganization(It.IsAny(), It.IsAny()), Times.Once()); } #endregion } diff --git a/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs b/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs index 127222c736..c6b409b760 100644 --- a/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Projects/ProjectControllerTest.cs @@ -35,9 +35,9 @@ public class ProjectControllerTest public ProjectControllerTest() { var helper = new TestHelper(); - _controller = helper.CreateController(Permissions.ProjectAdd, Permissions.ProjectEdit, Permissions.ProjectView); - _mapper = helper.GetService(); - _service = helper.GetService>(); + this._controller = helper.CreateController(Permissions.ProjectAdd, Permissions.ProjectEdit, Permissions.ProjectView); + this._mapper = helper.GetService(); + this._service = helper.GetService>(); } #region Tests @@ -51,14 +51,14 @@ public void SearchProjects_Success() var project = EntityHelper.CreateProject(1, "7", "Test Project"); var projectList = new List() { project }; - _service.Setup(m => m.SearchProjects(It.IsAny(), It.IsAny())) + this._service.Setup(m => m.SearchProjects(It.IsAny(), It.IsAny())) .Returns(projectList); // Act - var result = _controller.SearchProjects("test string", 5); + var result = this._controller.SearchProjects("test string", 5); // Assert - _service.Verify(m => m.SearchProjects(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.SearchProjects(It.IsAny(), It.IsAny()), Times.Once()); } /// @@ -71,7 +71,7 @@ public void SearchProjects_BadRequest() var helper = new TestHelper(); // Act - Action act = () => _controller.SearchProjects("", 7); + Action act = () => this._controller.SearchProjects(string.Empty, 7); // Assert act.Should().Throw(); @@ -81,7 +81,7 @@ public void SearchProjects_BadRequest() public void UpdateProject_BadRequest() { // Act - var result = _controller.UpdateProject(1, new ProjectModel { Id = 2 }); + var result = this._controller.UpdateProject(1, new ProjectModel { Id = 2 }); // Assert result.Should().BeOfType(typeof(BadRequestObjectResult)); @@ -92,10 +92,10 @@ public void UpdateProject_Conflict() { var helper = new TestHelper(); - _service.Setup(x => x.Update(It.IsAny())).Throws(new DuplicateEntityException()); + this._service.Setup(x => x.Update(It.IsAny())).Throws(new DuplicateEntityException()); // Act - var result = _controller.UpdateProject(1, new ProjectModel { Id = 1 }); + var result = this._controller.UpdateProject(1, new ProjectModel { Id = 1 }); // Assert result.Should().BeOfType(typeof(ConflictObjectResult)); @@ -106,10 +106,10 @@ public void AddProject_Conflict() { var helper = new TestHelper(); - _service.Setup(x => x.Add(It.IsAny())).Throws(new DuplicateEntityException()); + this._service.Setup(x => x.Add(It.IsAny())).Throws(new DuplicateEntityException()); // Act - var result = _controller.AddProject(new ProjectModel { Id = 2 }); + var result = this._controller.AddProject(new ProjectModel { Id = 2 }); // Assert result.Should().BeOfType(typeof(ConflictObjectResult)); diff --git a/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs index c2a13239a2..14f6da034d 100644 --- a/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Projects/SearchControllerTest.cs @@ -1,3 +1,8 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using Moq; using Pims.Api.Areas.Projects.Controllers; using Pims.Api.Areas.Projects.Models; @@ -5,11 +10,6 @@ using Pims.Core.Test; using Pims.Dal.Entities; using Pims.Dal.Security; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Xunit; using ApiModel = Pims.Api.Areas.Projects.Models; using Entity = Pims.Dal.Entities.Models; diff --git a/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs b/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs index d3072092bf..080f209dd0 100644 --- a/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Property/PropertyControllerTest.cs @@ -26,10 +26,10 @@ public class PropertyControllerTest public PropertyControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.PropertyView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.PropertyView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); } #region Get @@ -43,13 +43,13 @@ public void GetConceptPropertyById_Success() var pid = 12345; var property = EntityHelper.CreateProperty(pid); - _service.Setup(m => m.GetById(It.IsAny())).Returns(property); + this._service.Setup(m => m.GetById(It.IsAny())).Returns(property); // Act - var result = _controller.GetConceptPropertyWithId(property.Internal_Id); + var result = this._controller.GetConceptPropertyWithId(property.Internal_Id); // Assert - _service.Verify(m => m.GetById(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetById(It.IsAny()), Times.Once()); } #endregion #region Update @@ -62,13 +62,13 @@ public void UpdateConceptProperty_Success() // Arrange var property = EntityHelper.CreateProperty(12345); - _service.Setup(m => m.Update(It.IsAny())).Returns(property); + this._service.Setup(m => m.Update(It.IsAny())).Returns(property); // Act - var result = _controller.UpdateConceptProperty(_mapper.Map(property)); + var result = this._controller.UpdateConceptProperty(this._mapper.Map(property)); // Assert - _service.Verify(m => m.Update(It.IsAny()), Times.Once()); + this._service.Verify(m => m.Update(It.IsAny()), Times.Once()); } #endregion } diff --git a/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs index 4835678270..a6f28782c9 100644 --- a/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs @@ -45,11 +45,9 @@ public class SearchControllerTest private TestHelper _helper; #endregion - - public SearchControllerTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } #region Tests @@ -62,12 +60,12 @@ public SearchControllerTest() public void GetProperties_All_Success(SModel.PropertyFilterModel filter) { // Arrange - var controller = _helper.CreateController(Permissions.PropertyView); + var controller = this._helper.CreateController(Permissions.PropertyView); var properties = new[] { EntityHelper.CreateProperty(1) }; - var repository = _helper.GetService>(); - var mapper = _helper.GetService(); + var repository = this._helper.GetService>(); + var mapper = this._helper.GetService(); var page = new Paged(properties, filter.Page, filter.Quantity); repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); @@ -91,12 +89,12 @@ public void GetProperties_All_Success(SModel.PropertyFilterModel filter) public void GetProperties_Query_Success(Uri uri) { // Arrange - var controller = _helper.CreateController(Permissions.PropertyView, uri); + var controller = this._helper.CreateController(Permissions.PropertyView, uri); var properties = new[] { EntityHelper.CreateProperty(1) }; - var repository = _helper.GetService>(); - var mapper = _helper.GetService(); + var repository = this._helper.GetService>(); + var mapper = this._helper.GetService(); var page = new Paged(properties); repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); diff --git a/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs index 11f7d2b44a..26e57c1568 100644 --- a/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Reports/LeaseControllerTest.cs @@ -60,15 +60,15 @@ public class LeaseControllerTest #endregion public LeaseControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.LeaseView); - _mapper = _helper.GetService(); - _service = _helper.GetService>(); - _paymentService = _helper.GetService>(); - _lookupRepository = _helper.GetService>(); - _webHost = _helper.GetService>(); - _headers = _helper.GetService>(); - _leaseService = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.LeaseView); + this._mapper = this._helper.GetService(); + this._service = this._helper.GetService>(); + this._paymentService = this._helper.GetService>(); + this._lookupRepository = this._helper.GetService>(); + this._webHost = this._helper.GetService>(); + this._headers = this._helper.GetService>(); + this._leaseService = this._helper.GetService>(); } #region Tests @@ -81,21 +81,21 @@ public LeaseControllerTest() public void ExportLeases_Csv_Success(LeaseFilterModel filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var leases = new[] { EntityHelper.CreateLease(1) }; var page = new Paged(leases, filter.Page, filter.Quantity); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.ExportLeases(filter); + var result = this._controller.ExportLeases(filter); // Assert var actionResult = Assert.IsType(result); var actualResult = Assert.IsType(actionResult.Content); Assert.Equal(ContentTypes.CONTENTTYPECSV, actionResult.ContentType); - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } /// @@ -106,25 +106,25 @@ public void ExportLeases_Csv_Success(LeaseFilterModel filter) public void ExportLeases_Csv_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var leases = new[] { EntityHelper.CreateLease(1) }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.ExportLeases(); + var result = this._controller.ExportLeases(); // Assert - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } [Fact] public void ExportLeases_Lease_Mapping() { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var lease = EntityHelper.CreateLease(1); lease.RegionCodeNavigation = new PimsRegion() { RegionCode = 1, Description = "region" }; @@ -144,13 +144,13 @@ public void ExportLeases_Lease_Mapping() var leases = new[] { lease }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.GetCrossJoinLeases(new LeaseFilterModel()).FirstOrDefault(); + var result = this._controller.GetCrossJoinLeases(new LeaseFilterModel()).FirstOrDefault(); // Assert - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); result.MotiRegion.Should().Be("region"); result.LFileNo.Should().Be("L-010-070"); result.StartDate.Should().Be(new DateTime(2000, 1, 1)); @@ -168,7 +168,7 @@ public void ExportLeases_Lease_Mapping() public void ExportLeases_LeaseTerm_Mapping() { // Arrange - var headers = _helper.GetService>(); + var headers = this._helper.GetService>(); headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var lease = EntityHelper.CreateLease(1); @@ -183,13 +183,13 @@ public void ExportLeases_LeaseTerm_Mapping() var leases = new[] { lease }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.GetCrossJoinLeases(new LeaseFilterModel()).FirstOrDefault(); + var result = this._controller.GetCrossJoinLeases(new LeaseFilterModel()).FirstOrDefault(); // Assert - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); result.CurrentTermStartDate.Should().Be(leaseTerm.TermStartDate); result.CurrentTermEndDate.Should().Be(leaseTerm.TermExpiryDate); result.TermStartDate.Should().Be(leaseTerm.TermStartDate); @@ -204,7 +204,7 @@ public void ExportLeases_LeaseTerm_Mapping() public void ExportLeases_LeaseTenant_Mapping() { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var lease = EntityHelper.CreateLease(1); var leaseOrgTenant = new PimsLeaseTenant(); @@ -218,13 +218,13 @@ public void ExportLeases_LeaseTenant_Mapping() var leases = new[] { lease }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.GetCrossJoinLeases(new LeaseFilterModel()); + var result = this._controller.GetCrossJoinLeases(new LeaseFilterModel()); // Assert - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); result.ToArray()[0].TenantName.Should().Be("org"); result.ToArray()[1].TenantName.Should().Be("first middle last"); } @@ -233,7 +233,7 @@ public void ExportLeases_LeaseTenant_Mapping() public void ExportLeases_LeaseProperty_Mapping() { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var lease = new PimsLease(); var property = new PimsProperty(); @@ -246,13 +246,13 @@ public void ExportLeases_LeaseProperty_Mapping() var leases = new[] { lease }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.GetCrossJoinLeases(new LeaseFilterModel()).FirstOrDefault(); + var result = this._controller.GetCrossJoinLeases(new LeaseFilterModel()).FirstOrDefault(); // Assert - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); result.Pid.Should().Be(1); result.Pin.Should().Be(2); result.CivicAddress.Should().Be("1 2 3 m"); @@ -264,7 +264,7 @@ public void ExportLeases_LeaseProperty_Mapping() public void ExportLeases_Cartesion() { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var lease = new PimsLease(); lease.PimsLeaseTerms.Add(new PimsLeaseTerm()); @@ -278,13 +278,13 @@ public void ExportLeases_Cartesion() var leases = new[] { lease }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.GetCrossJoinLeases(new LeaseFilterModel()); + var result = this._controller.GetCrossJoinLeases(new LeaseFilterModel()); // Assert - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); result.Count().Should().Be(9); } @@ -296,23 +296,23 @@ public void ExportLeases_Cartesion() public void ExportLeases_Excel_Success(LeaseFilterModel filter) { // Arrange - var headers = _helper.GetService>(); + var headers = this._helper.GetService>(); headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); var leases = new[] { EntityHelper.CreateLease(1) }; var page = new Paged(leases, filter.Page, filter.Quantity); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.ExportLeases(filter); + var result = this._controller.ExportLeases(filter); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } /// @@ -323,17 +323,17 @@ public void ExportLeases_Excel_Success(LeaseFilterModel filter) public void ExportLeases_Excel_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); var leases = new[] { EntityHelper.CreateLease(1) }; - var service = _helper.GetService>(); - var mapper = _helper.GetService(); + var service = this._helper.GetService>(); + var mapper = this._helper.GetService(); var page = new Paged(leases); service.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.ExportLeases(); + var result = this._controller.ExportLeases(); // Assert var actionResult = Assert.IsType(result); @@ -351,22 +351,22 @@ public void ExportLeases_Excel_Query_Success(Uri uri) public void ExportLeases_ExcelX_Success(LeaseFilterModel filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var leases = new[] { EntityHelper.CreateLease(1) }; var page = new Paged(leases, filter.Page, filter.Quantity); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.ExportLeases(filter); + var result = this._controller.ExportLeases(filter); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } /// @@ -377,22 +377,22 @@ public void ExportLeases_ExcelX_Success(LeaseFilterModel filter) public void ExportLeases_ExcelX_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var leases = new[] { EntityHelper.CreateLease(1) }; var page = new Paged(leases); - _leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); + this._leaseService.Setup(m => m.GetPage(It.IsAny(), false)).Returns(page); // Act - var result = _controller.ExportLeases(); + var result = this._controller.ExportLeases(); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); + this._leaseService.Verify(m => m.GetPage(It.IsAny(), false), Times.Once()); } /// @@ -481,27 +481,27 @@ public void ExportAggregatedLeases_ExcelX_Success() { // Arrange var helper = new TestHelper(); - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var lease = EntityHelper.CreateLease(1, region: new PimsRegion() { Id = 1 }); var leases = new[] { lease }; var path = Path.Combine(SolutionProvider.TryGetSolutionDirectoryInfo().FullName, "api"); - _webHost.SetupGet(m => m.ContentRootPath).Returns(path); + this._webHost.SetupGet(m => m.ContentRootPath).Returns(path); - _lookupRepository.Setup(m => m.GetAllRegions()).Returns(new List() { lease.RegionCodeNavigation }); - _lookupRepository.Setup(m => m.GetAllLeaseProgramTypes()).Returns(new List() { lease.LeaseProgramTypeCodeNavigation }); - _service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); + this._lookupRepository.Setup(m => m.GetAllRegions()).Returns(new List() { lease.RegionCodeNavigation }); + this._lookupRepository.Setup(m => m.GetAllLeaseProgramTypes()).Returns(new List() { lease.LeaseProgramTypeCodeNavigation }); + this._service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); // Act - var result = _controller.ExportAggregatedLeases(2021); + var result = this._controller.ExportAggregatedLeases(2021); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); + this._service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); } /// @@ -511,18 +511,18 @@ public void ExportAggregatedLeases_ExcelX_Success() public void ExportAggregatedLeases_ExcelX_InvalidFiscal() { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var leases = new[] { EntityHelper.CreateLease(1) }; var path = Path.Combine(SolutionProvider.TryGetSolutionDirectoryInfo().FullName, "api"); - _webHost.SetupGet(m => m.ContentRootPath).Returns(path); + this._webHost.SetupGet(m => m.ContentRootPath).Returns(path); - _service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); + this._service.Setup(m => m.GetAggregatedLeaseReport(It.IsAny())).Returns(leases); // Act // Assert - Assert.Throws(() => _controller.ExportAggregatedLeases(1800)); + Assert.Throws(() => this._controller.ExportAggregatedLeases(1800)); } #endregion @@ -537,15 +537,15 @@ public void ExportLeasePayments_ExcelX_Success() { // Arrange var helper = new TestHelper(); - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var path = Path.Combine(SolutionProvider.TryGetSolutionDirectoryInfo().FullName, "api"); - _webHost.SetupGet(m => m.ContentRootPath).Returns(path); + this._webHost.SetupGet(m => m.ContentRootPath).Returns(path); - _paymentService.Setup(m => m.GetAllByDateRange(It.IsAny(), It.IsAny())).Returns(new List()); + this._paymentService.Setup(m => m.GetAllByDateRange(It.IsAny(), It.IsAny())).Returns(new List()); // Act - var result = _controller.ExportLeasePayments(2021); + var result = this._controller.ExportLeasePayments(2021); // Assert var actionResult = Assert.IsType(result); diff --git a/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs index 2eccb1251c..ac6e636b04 100644 --- a/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs @@ -65,13 +65,13 @@ public class PropertyControllerTest public PropertyControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.PropertyView); - _mapper = _helper.GetService(); - _lookupRepository = _helper.GetService>(); - _webHost = _helper.GetService>(); - _headers = _helper.GetService>(); - _repository = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.PropertyView); + this._mapper = this._helper.GetService(); + this._lookupRepository = this._helper.GetService>(); + this._webHost = this._helper.GetService>(); + this._headers = this._helper.GetService>(); + this._repository = this._helper.GetService>(); } #region Tests @@ -84,21 +84,21 @@ public PropertyControllerTest() public void ExportProperties_Csv_Success(PropertyFilterModel filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var properties = new[] { EntityHelper.CreateProperty(1) }; var page = new Paged(properties, filter.Page, filter.Quantity); - _repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); // Act - var result = _controller.ExportProperties(filter); + var result = this._controller.ExportProperties(filter); // Assert var actionResult = Assert.IsType(result); var actualResult = Assert.IsType(actionResult.Content); Assert.Equal(ContentTypes.CONTENTTYPECSV, actionResult.ContentType); - _repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); } /// @@ -109,21 +109,21 @@ public void ExportProperties_Csv_Success(PropertyFilterModel filter) public void ExportProperties_Csv_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var properties = new[] { EntityHelper.CreateProperty(1) }; var page = new Paged(properties); - _repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); // Act - var result = _controller.ExportProperties(); + var result = this._controller.ExportProperties(); // Assert var actionResult = Assert.IsType(result); var actualResult = Assert.IsType(actionResult.Content); Assert.Equal(ContentTypes.CONTENTTYPECSV, actionResult.ContentType); - _repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); } /// @@ -134,22 +134,22 @@ public void ExportProperties_Csv_Query_Success(Uri uri) public void ExportProperties_Excel_Success(PropertyFilterModel filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); var properties = new[] { EntityHelper.CreateProperty(1) }; var page = new Paged(properties, filter.Page, filter.Quantity); - _repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); // Act - var result = _controller.ExportProperties(filter); + var result = this._controller.ExportProperties(filter); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); } /// @@ -160,22 +160,22 @@ public void ExportProperties_Excel_Success(PropertyFilterModel filter) public void ExportProperties_Excel_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); var properties = new[] { EntityHelper.CreateProperty(1) }; var page = new Paged(properties); - _repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); // Act - var result = _controller.ExportProperties(); + var result = this._controller.ExportProperties(); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); } /// @@ -186,22 +186,22 @@ public void ExportProperties_Excel_Query_Success(Uri uri) public void ExportProperties_ExcelX_Success(PropertyFilterModel filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var properties = new[] { EntityHelper.CreateProperty(1) }; var page = new Paged(properties, filter.Page, filter.Quantity); - _repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); // Act - var result = _controller.ExportProperties(filter); + var result = this._controller.ExportProperties(filter); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); } /// @@ -212,22 +212,22 @@ public void ExportProperties_ExcelX_Success(PropertyFilterModel filter) public void ExportProperties_ExcelX_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var properties = new[] { EntityHelper.CreateProperty(1) }; var page = new Paged(properties); - _repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page); // Act - var result = _controller.ExportProperties(); + var result = this._controller.ExportProperties(); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetPage(It.IsAny()), Times.Once()); } /// diff --git a/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs index 2a90e72d1e..a9a6c7706b 100644 --- a/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Reports/UserControllerTest.cs @@ -51,13 +51,13 @@ public class UserControllerTest public UserControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.PropertyView); - _mapper = _helper.GetService(); - _lookupRepository = _helper.GetService>(); - _webHost = _helper.GetService>(); - _headers = _helper.GetService>(); - _repository = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.PropertyView); + this._mapper = this._helper.GetService(); + this._lookupRepository = this._helper.GetService>(); + this._webHost = this._helper.GetService>(); + this._headers = this._helper.GetService>(); + this._repository = this._helper.GetService>(); } #region Tests @@ -70,22 +70,22 @@ public UserControllerTest() public void ExportUsers_Csv_Success(UserFilter filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), "username", "firstname", "lastname"); var users = new[] { user }; var page = new Paged(users, filter.Page, filter.Quantity); - _repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); // Act - var result = _controller.ExportUsers(filter); + var result = this._controller.ExportUsers(filter); // Assert var actionResult = Assert.IsType(result); var actualResult = Assert.IsType(actionResult.Content); Assert.Equal(ContentTypes.CONTENTTYPECSV, actionResult.ContentType); - _repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); } /// @@ -95,22 +95,22 @@ public void ExportUsers_Csv_Success(UserFilter filter) public void ExportUsers_Csv_Query_Success() { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), "username", "firstname", "lastname"); var users = new[] { user }; var page = new Paged(users); - _repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); // Act - var result = _controller.ExportUsers(); + var result = this._controller.ExportUsers(); // Assert var actionResult = Assert.IsType(result); var actualResult = Assert.IsType(actionResult.Content); Assert.Equal(ContentTypes.CONTENTTYPECSV, actionResult.ContentType); - _repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); } /// @@ -121,23 +121,23 @@ public void ExportUsers_Csv_Query_Success() public void ExportUsers_Excel_Success(UserFilter filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), "username", "firstname", "lastname"); var users = new[] { user }; var page = new Paged(users, filter.Page, filter.Quantity); - _repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); // Act - var result = _controller.ExportUsers(filter); + var result = this._controller.ExportUsers(filter); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); } /// @@ -148,23 +148,23 @@ public void ExportUsers_Excel_Success(UserFilter filter) public void ExportUsers_Excel_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), "username", "firstname", "lastname"); var users = new[] { user }; var page = new Paged(users); - _repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); // Act - var result = _controller.ExportUsers(); + var result = this._controller.ExportUsers(); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); } /// @@ -175,23 +175,23 @@ public void ExportUsers_Excel_Query_Success(Uri uri) public void ExportUsers_ExcelX_Success(UserFilter filter) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), "username", "firstname", "lastname"); var users = new[] { user }; var page = new Paged(users, filter.Page, filter.Quantity); - _repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); // Act - var result = _controller.ExportUsers(filter); + var result = this._controller.ExportUsers(filter); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); } /// @@ -202,23 +202,23 @@ public void ExportUsers_ExcelX_Success(UserFilter filter) public void ExportUsers_ExcelX_Query_Success(Uri uri) { // Arrange - _headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); + this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), "username", "firstname", "lastname"); var users = new[] { user }; var page = new Paged(users); - _repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); + this._repository.Setup(m => m.GetAllByFilter(It.IsAny())).Returns(page); // Act - var result = _controller.ExportUsers(); + var result = this._controller.ExportUsers(); // Assert var actionResult = Assert.IsType(result); Assert.Equal(ContentTypes.CONTENTTYPEEXCELX, actionResult.ContentType); Assert.NotNull(actionResult.FileDownloadName); Assert.True(actionResult.FileStream.Length > 0); - _repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); + this._repository.Verify(m => m.GetAllByFilter(It.IsAny()), Times.Once()); } /// diff --git a/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs index 9f32e78162..3e55a5b879 100644 --- a/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Research/ResearchControllerTest.cs @@ -46,7 +46,7 @@ public class SearchControllerTest public SearchControllerTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } #region Tests @@ -59,12 +59,12 @@ public SearchControllerTest() public void GetResearchFiles_All_Success(SModel.ResearchFilterModel filter) { // Arrange - var controller = _helper.CreateController(Permissions.ResearchFileView); + var controller = this._helper.CreateController(Permissions.ResearchFileView); var researchFiles = new[] { EntityHelper.CreateResearchFile(1) }; - var service = _helper.GetService>(); - var mapper = _helper.GetService(); + var service = this._helper.GetService>(); + var mapper = this._helper.GetService(); service.Setup(m => m.GetPage(It.IsAny())).Returns(new Paged(researchFiles)); @@ -87,12 +87,12 @@ public void GetResearchFiles_All_Success(SModel.ResearchFilterModel filter) public void GetResearchFiles_Query_Success(Uri uri) { // Arrange - var controller = _helper.CreateController(Permissions.ResearchFileView, uri); + var controller = this._helper.CreateController(Permissions.ResearchFileView, uri); var researchFiles = new[] { EntityHelper.CreateResearchFile(1) }; - var service = _helper.GetService>(); - var mapper = _helper.GetService(); + var service = this._helper.GetService>(); + var mapper = this._helper.GetService(); service.Setup(m => m.GetPage(It.IsAny())).Returns(new Paged(researchFiles)); @@ -114,11 +114,11 @@ public void GetResearchFiles_Query_Success(Uri uri) public void GetResearchFiles_Query_NoFilter_BadRequest() { // Arrange - var controller = _helper.CreateController(Permissions.ResearchFileView); - var request = _helper.GetService>(); + var controller = this._helper.CreateController(Permissions.ResearchFileView); + var request = this._helper.GetService>(); request.Setup(m => m.QueryString).Returns(new QueryString("?page=0")); - var service = _helper.GetService>(); + var service = this._helper.GetService>(); // Act // Assert @@ -133,9 +133,9 @@ public void GetResearchFiles_Query_NoFilter_BadRequest() public void GetResearchFiles_NoFilter_BadRequest() { // Arrange - var controller = _helper.CreateController(Permissions.ResearchFileView); + var controller = this._helper.CreateController(Permissions.ResearchFileView); - var service = _helper.GetService>(); + var service = this._helper.GetService>(); // Act // Assert @@ -150,9 +150,9 @@ public void GetResearchFiles_NoFilter_BadRequest() public void GetResearchFiles_InvalidFilter_BadRequest() { // Arrange - var controller = _helper.CreateController(Permissions.ResearchFileView); + var controller = this._helper.CreateController(Permissions.ResearchFileView); - var service = _helper.GetService>(); + var service = this._helper.GetService>(); var filter = new ResearchFilterModel() { CreatedOnStartDate = DateTime.Now, CreatedOnEndDate = DateTime.Now.AddDays(-1) }; // Act diff --git a/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs b/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs index b1c8435869..7cbe11910f 100644 --- a/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs @@ -31,66 +31,66 @@ public class TakesControllerTest public TakesControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.PropertyView, Permissions.AcquisitionFileView); - _service = _helper.GetService>(); - _mapper = _helper.GetService(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.PropertyView, Permissions.AcquisitionFileView); + this._service = this._helper.GetService>(); + this._mapper = this._helper.GetService(); } [Fact] public void GetTakesByAcquisitionFileId_Success() { // Arrange - _service.Setup(m => m.GetByFileId(It.IsAny())); + this._service.Setup(m => m.GetByFileId(It.IsAny())); // Act - var result = _controller.GetTakesByAcquisitionFileId(1); + var result = this._controller.GetTakesByAcquisitionFileId(1); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetByFileId(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetByFileId(It.IsAny()), Times.Once()); } [Fact] public void GetTakesByPropertyId_Success() { // Arrange - _service.Setup(m => m.GetByPropertyId(It.IsAny(), It.IsAny())); + this._service.Setup(m => m.GetByPropertyId(It.IsAny(), It.IsAny())); // Act - var result = _controller.GetTakesByPropertyId(1, 2); + var result = this._controller.GetTakesByPropertyId(1, 2); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetByPropertyId(It.IsAny(), It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetByPropertyId(It.IsAny(), It.IsAny()), Times.Once()); } [Fact] public void GetTakesCountByPropertyId_Success() { // Arrange - _service.Setup(m => m.GetCountByPropertyId(It.IsAny())); + this._service.Setup(m => m.GetCountByPropertyId(It.IsAny())); // Act - var result = _controller.GetTakesCountByPropertyId(1); + var result = this._controller.GetTakesCountByPropertyId(1); // Assert result.Should().BeOfType(); - _service.Verify(m => m.GetCountByPropertyId(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetCountByPropertyId(It.IsAny()), Times.Once()); } [Fact] public void UpdateAcquisitionPropertyTakes_Success() { // Arrange - _service.Setup(m => m.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>())); + this._service.Setup(m => m.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>())); // Act - var result = _controller.UpdateAcquisitionPropertyTakes(1, new List()); + var result = this._controller.UpdateAcquisitionPropertyTakes(1, new List()); // Assert result.Should().BeOfType(); - _service.Verify(m => m.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>())); + this._service.Verify(m => m.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>())); } } } diff --git a/source/backend/tests/unit/api/Controllers/Tenant/TenantControllerTest.cs b/source/backend/tests/unit/api/Controllers/Tenant/TenantControllerTest.cs index cbb513a024..17394f7886 100644 --- a/source/backend/tests/unit/api/Controllers/Tenant/TenantControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Tenant/TenantControllerTest.cs @@ -31,8 +31,8 @@ public class TenantControllerTest public TenantControllerTest() { - _helper = new TestHelper(); - _user = PrincipalHelper.CreateForPermission(); + this._helper = new TestHelper(); + this._user = PrincipalHelper.CreateForPermission(); } #region Tests @@ -47,10 +47,10 @@ public void Settings_200Response() Tenant = "TEST", }; mockOptions.Setup(m => m.CurrentValue).Returns(options); - var controller = _helper.CreateController(_user, mockOptions.Object); + var controller = this._helper.CreateController(this._user, mockOptions.Object); - var mapper = _helper.GetService(); - var repository = _helper.GetService>(); + var mapper = this._helper.GetService(); + var repository = this._helper.GetService>(); var tenant = EntityHelper.CreateTenant(1, "TEST"); repository.Setup(m => m.TryGetTenantByCode(tenant.Code)).Returns(tenant); @@ -73,10 +73,10 @@ public void Settings_NoTenantFound_204Response() Tenant = "TEST", }; mockOptions.Setup(m => m.CurrentValue).Returns(options); - var controller = _helper.CreateController(_user, mockOptions.Object); + var controller = this._helper.CreateController(this._user, mockOptions.Object); - var mapper = _helper.GetService(); - var repository = _helper.GetService>(); + var mapper = this._helper.GetService(); + var repository = this._helper.GetService>(); var tenant = EntityHelper.CreateTenant(1, "TEST"); repository.Setup(m => m.TryGetTenantByCode(tenant.Code)).Returns(null); @@ -97,10 +97,10 @@ public void Settings_TenantOptions_204Response() var mockOptions = new Mock>(); var options = new PimsOptions(); mockOptions.Setup(m => m.CurrentValue).Returns(options); - var controller = _helper.CreateController(_user, mockOptions.Object); + var controller = this._helper.CreateController(this._user, mockOptions.Object); - var mapper = _helper.GetService(); - var repository = _helper.GetService>(); + var mapper = this._helper.GetService(); + var repository = this._helper.GetService>(); repository.Setup(m => m.TryGetTenantByCode(null)).Returns(null); @@ -119,13 +119,13 @@ public void Settings_TenantOptions_204Response() public void UpdateTenant_200Response() { // Arrange - var controller = _helper.CreateController(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var controller = this._helper.CreateController(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); var tenant = EntityHelper.CreateTenant(1, "TEST"); repository.Setup(m => m.UpdateTenant(It.IsAny())).Returns(tenant); - var mapper = _helper.GetService(); + var mapper = this._helper.GetService(); var model = mapper.Map(tenant); diff --git a/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs b/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs index 5cbbaf69a6..99a68d2168 100644 --- a/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Tools/GeocoderControllerTest.cs @@ -34,8 +34,8 @@ public class GeocoderControllerTest public GeocoderControllerTest() { var helper = new TestHelper(); - _controller = helper.CreateController(Permissions.SystemAdmin); - _service = helper.GetService>(); + this._controller = helper.CreateController(Permissions.SystemAdmin); + this._service = helper.GetService>(); } #endregion @@ -67,13 +67,13 @@ public async void FindAddressesAsync_Success() }, }; - _service.Setup(m => m.GetSiteAddressesAsync(It.IsAny(), It.IsAny())).ReturnsAsync(addresses); + this._service.Setup(m => m.GetSiteAddressesAsync(It.IsAny(), It.IsAny())).ReturnsAsync(addresses); // Act - var result = await _controller.FindAddressesAsync("test"); + var result = await this._controller.FindAddressesAsync("test"); // Assert - _service.Verify(m => m.GetSiteAddressesAsync(It.IsAny(), It.IsAny())); + this._service.Verify(m => m.GetSiteAddressesAsync(It.IsAny(), It.IsAny())); } #endregion @@ -98,13 +98,13 @@ public async void FindNearestAddressAsync_Success() Geometry = new GeometryModel() { Coordinates = new[] { 2d, 1d } }, }; - _service.Setup(m => m.GetNearestSiteAsync(It.IsAny(), It.IsAny())).ReturnsAsync(address); + this._service.Setup(m => m.GetNearestSiteAsync(It.IsAny(), It.IsAny())).ReturnsAsync(address); // Act - var result = await _controller.FindNearestAddressAsync("test"); + var result = await this._controller.FindNearestAddressAsync("test"); // Assert - _service.Verify(m => m.GetNearestSiteAsync(It.IsAny(), It.IsAny())); + this._service.Verify(m => m.GetNearestSiteAsync(It.IsAny(), It.IsAny())); } #endregion @@ -135,13 +135,13 @@ public async void FindNearAddressesAsync_Success() }, }; - _service.Setup(m => m.GetNearSitesAsync(It.IsAny(), It.IsAny())).ReturnsAsync(addresses); + this._service.Setup(m => m.GetNearSitesAsync(It.IsAny(), It.IsAny())).ReturnsAsync(addresses); // Act - var result = await _controller.FindNearAddressesAsync("test"); + var result = await this._controller.FindNearAddressesAsync("test"); // Assert - _service.Verify(m => m.GetNearSitesAsync(It.IsAny(), It.IsAny())); + this._service.Verify(m => m.GetNearSitesAsync(It.IsAny(), It.IsAny())); } #endregion @@ -157,13 +157,13 @@ public async void FindPidsAsync_Success() Pids = "test1,test2", }; - _service.Setup(m => m.GetPids(It.IsAny(), It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.GetPids(It.IsAny(), It.IsAny())).ReturnsAsync(response); // Act - var result = await _controller.FindPidsAsync(testSiteId); + var result = await this._controller.FindPidsAsync(testSiteId); // Assert - _service.Verify(m => m.GetPids(testSiteId, It.IsAny())); + this._service.Verify(m => m.GetPids(testSiteId, It.IsAny())); } #endregion #endregion diff --git a/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs b/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs index dd88b03227..64bec18d22 100644 --- a/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs +++ b/source/backend/tests/unit/api/Controllers/Tools/LtsaControllerTest.cs @@ -28,9 +28,9 @@ public class LtsaControllerTest public LtsaControllerTest() { - _helper = new TestHelper(); - _controller = _helper.CreateController(Permissions.PropertyView); - _service = _helper.GetService>(); + this._helper = new TestHelper(); + this._controller = this._helper.CreateController(Permissions.PropertyView); + this._service = this._helper.GetService>(); } #region Tests @@ -45,15 +45,15 @@ public async void FindTitleSummariesAsync_Success() TitleSummaries = new List(), }; - _service.Setup(m => m.GetTitleSummariesAsync(It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.GetTitleSummariesAsync(It.IsAny())).ReturnsAsync(response); // Act - var result = await _controller.FindTitleSummariesAsync("123-456-789"); + var result = await this._controller.FindTitleSummariesAsync("123-456-789"); // Assert JsonResult actionResult = Assert.IsType(result); var results = Assert.IsAssignableFrom>(actionResult.Value); - _service.Verify(m => m.GetTitleSummariesAsync(It.IsAny()), Times.Once()); + this._service.Verify(m => m.GetTitleSummariesAsync(It.IsAny()), Times.Once()); } #endregion @@ -87,15 +87,15 @@ public async void PostParcelInfoOrderAsync_Success() // Arrange var response = new Model.OrderWrapper>(new Model.ParcelInfoOrder()); - _service.Setup(m => m.PostParcelInfoOrder(It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.PostParcelInfoOrder(It.IsAny())).ReturnsAsync(response); // Act - var result = await _controller.PostParcelInfoOrderAsync("titleNumber"); + var result = await this._controller.PostParcelInfoOrderAsync("titleNumber"); // Assert JsonResult actionResult = Assert.IsType(result); var results = Assert.IsAssignableFrom(actionResult.Value); - _service.Verify(m => m.PostParcelInfoOrder(It.IsAny()), Times.Once()); + this._service.Verify(m => m.PostParcelInfoOrder(It.IsAny()), Times.Once()); } [Fact] @@ -104,15 +104,15 @@ public async void PostParcelInfoOrderAsync_Success_ConvertPid() // Arrange var response = new Model.OrderWrapper>(new Model.ParcelInfoOrder()); - _service.Setup(m => m.PostParcelInfoOrder(It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.PostParcelInfoOrder(It.IsAny())).ReturnsAsync(response); // Act - var result = await _controller.PostParcelInfoOrderAsync("123456789"); + var result = await this._controller.PostParcelInfoOrderAsync("123456789"); // Assert JsonResult actionResult = Assert.IsType(result); var results = Assert.IsAssignableFrom(actionResult.Value); - _service.Verify(m => m.PostParcelInfoOrder(It.Is(s => s.Equals("123-456-789"))), Times.Once()); + this._service.Verify(m => m.PostParcelInfoOrder(It.Is(s => s.Equals("123-456-789"))), Times.Once()); } [Fact] @@ -121,10 +121,10 @@ public async void PostParcelInfoOrderAsync_MissingPidFailure() // Arrange var response = new Model.OrderWrapper>(new Model.ParcelInfoOrder()); - _service.Setup(m => m.PostParcelInfoOrder(It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.PostParcelInfoOrder(It.IsAny())).ReturnsAsync(response); // Act - await Assert.ThrowsAsync(() => _controller.PostParcelInfoOrderAsync(string.Empty)); + await Assert.ThrowsAsync(() => this._controller.PostParcelInfoOrderAsync(string.Empty)); } #endregion @@ -135,13 +135,13 @@ public async void PostSpcpOrderAsync_Success() // Arrange var response = new Model.OrderWrapper>(new Model.SpcpOrder()); - _service.Setup(m => m.PostSpcpOrder(It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.PostSpcpOrder(It.IsAny())).ReturnsAsync(response); // Act - var result = await _controller.PostSpcpOrderAsync("strataPlanNumber"); + var result = await this._controller.PostSpcpOrderAsync("strataPlanNumber"); // Assert - _service.Verify(m => m.PostSpcpOrder(It.IsAny()), Times.Once()); + this._service.Verify(m => m.PostSpcpOrder(It.IsAny()), Times.Once()); } #endregion @@ -152,13 +152,13 @@ public async void PostLtsaFieldsAsync_Success() // Arrange var response = new Model.LtsaOrders(); - _service.Setup(m => m.PostLtsaFields(It.IsAny())).ReturnsAsync(response); + this._service.Setup(m => m.PostLtsaFields(It.IsAny())).ReturnsAsync(response); // Act - var result = await _controller.PostLtsaFields("pid"); + var result = await this._controller.PostLtsaFields("pid"); // Assert - _service.Verify(m => m.PostLtsaFields(It.IsAny()), Times.Once()); + this._service.Verify(m => m.PostLtsaFields(It.IsAny()), Times.Once()); } #endregion #endregion diff --git a/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs b/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs index 9a03318326..8f78e4be89 100644 --- a/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs +++ b/source/backend/tests/unit/api/Helpers/PrincipalExtensionsTest.cs @@ -1,3 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using FluentAssertions; using Moq; using Pims.Api.Helpers.Exceptions; @@ -7,12 +13,6 @@ using Pims.Dal.Exceptions; using Pims.Dal.Repositories; using Pims.Dal.Security; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Xunit; namespace Pims.Api.Test.Helpers @@ -28,7 +28,7 @@ public class PrincipalExtensionsTest public PrincipalExtensionsTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } #region Tests diff --git a/source/backend/tests/unit/api/Mapping/LeasePaymentReportMapTest.cs b/source/backend/tests/unit/api/Mapping/LeasePaymentReportMapTest.cs index fb4b302d54..c210980f6e 100644 --- a/source/backend/tests/unit/api/Mapping/LeasePaymentReportMapTest.cs +++ b/source/backend/tests/unit/api/Mapping/LeasePaymentReportMapTest.cs @@ -34,7 +34,7 @@ public class LeasePaymentReportMapTest public LeasePaymentReportMapTest() { var helper = new TestHelper(); - _mapper = helper.GetService(); + this._mapper = helper.GetService(); } #region Tests @@ -44,11 +44,11 @@ public void MapLeasePaymentReport_Fallback_Pid() var lease = EntityHelper.CreateLease(1, addProperty: true); lease.PimsPropertyLeases.FirstOrDefault().Property.Pid = 111111111; var leasePayment = new PimsLeasePayment() { }; - + leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("111-111-111"); } @@ -64,7 +64,7 @@ public void MapLeasePaymentReport_Fallback_Pid_Multiple() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("111-111-111,222-222-222"); } @@ -80,7 +80,7 @@ public void MapLeasePaymentReport_Fallback_Pin() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("1"); } @@ -97,7 +97,7 @@ public void MapLeasePaymentReport_Fallback_Pin_Multiple() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("1,2"); } @@ -112,7 +112,7 @@ public void MapLeasePaymentReport_Fallback_Address() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(street address 1 Victoria)"); } @@ -128,7 +128,7 @@ public void MapLeasePaymentReport_Fallback_Address_Multiple() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(street address 1 Victoria),(street address 2 Victoria)"); } @@ -137,13 +137,13 @@ public void MapLeasePaymentReport_Fallback_Address_Multiple() public void MapLeasePaymentReport_Fallback_Address_Empty() { var lease = EntityHelper.CreateLease(1, addProperty: false); - lease.PimsPropertyLeases.Add(new PimsPropertyLease() { Name = "descriptive name" , Property = new PimsProperty() { Address = new PimsAddress() { StreetAddress1 = "", MunicipalityName = "Victoria" } } }); + lease.PimsPropertyLeases.Add(new PimsPropertyLease() { Name = "descriptive name", Property = new PimsProperty() { Address = new PimsAddress() { StreetAddress1 = string.Empty, MunicipalityName = "Victoria" } } }); var leasePayment = new PimsLeasePayment() { }; leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(descriptive name)"); } @@ -158,7 +158,7 @@ public void MapLeasePaymentReport_Fallback_Name() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(Property Name)"); } @@ -174,7 +174,7 @@ public void MapLeasePaymentReport_Fallback_Name_Multiple() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(Property Name),(Property Name 2)"); } @@ -183,13 +183,13 @@ public void MapLeasePaymentReport_Fallback_Name_Multiple() public void MapLeasePaymentReport_Fallback_Name_Empty() { var lease = EntityHelper.CreateLease(1, addProperty: false); - lease.PimsPropertyLeases.Add(new PimsPropertyLease() { Name = "" }); + lease.PimsPropertyLeases.Add(new PimsPropertyLease() { Name = string.Empty }); var leasePayment = new PimsLeasePayment() { }; leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("No Property Identifier"); } @@ -204,7 +204,7 @@ public void MapLeasePaymentReport_Fallback_Location() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(1, 2)"); } @@ -220,7 +220,7 @@ public void MapLeasePaymentReport_Fallback_Location_Multiple() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(1, 2),(3, 4)"); } @@ -235,7 +235,7 @@ public void MapLeasePaymentReport_Fallback_NoIdentifier() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("No Property Identifier"); } @@ -250,7 +250,7 @@ public void MapLeasePaymentReport_Fallback_PidPriority() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("000-000-001"); } @@ -265,7 +265,7 @@ public void MapLeasePaymentReport_Fallback_PinPriority() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("2"); } @@ -280,7 +280,7 @@ public void MapLeasePaymentReport_Fallback_AddressPriority() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(address)"); } @@ -295,7 +295,7 @@ public void MapLeasePaymentReport_Fallback_NamePriority() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(test)"); } @@ -310,7 +310,7 @@ public void MapLeasePaymentReport_Fallback_LocationPriority() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.PropertyList.Should().Be("(1, 2)"); } @@ -327,7 +327,7 @@ public void MapLeasePaymentReport_TenantList() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.TenantList.Should().Be("first,test org"); } @@ -344,7 +344,7 @@ public void MapLeasePaymentReport_ProgramType() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.Program.Should().Be("OTHER - DESC"); } @@ -361,7 +361,7 @@ public void MapLeasePaymentReport_PurposeType() leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.Purpose.Should().Be("OTHER - DESC"); } @@ -370,15 +370,15 @@ public void MapLeasePaymentReport_PurposeType() public void MapLeasePaymentReport_LastPaymentDate() { var lease = EntityHelper.CreateLease(1, addProperty: false); - + var leasePayment = new PimsLeasePayment() { PaymentReceivedDate = DateTime.Now }; var leasePaymentOld = new PimsLeasePayment() { PaymentReceivedDate = DateTime.Now.AddDays(-1) }; var leasePaymentOlder = new PimsLeasePayment() { PaymentReceivedDate = DateTime.Now.AddDays(-2) }; - leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() { leasePaymentOld, leasePayment, leasePaymentOlder } }; + leasePayment.LeaseTerm = new PimsLeaseTerm() { Lease = lease, PimsLeasePayments = new List() { leasePaymentOld, leasePayment, leasePaymentOlder } }; // Arrange - var mapped = _mapper.Map(leasePayment); + var mapped = this._mapper.Map(leasePayment); mapped.LatestPaymentDate.Should().Be(DateTime.Now.ToString("MMMM dd, yyyy")); } diff --git a/source/backend/tests/unit/api/Models/AgreementReportModelTest.cs b/source/backend/tests/unit/api/Models/AgreementReportModelTest.cs index a6f92763a3..9a191c7431 100644 --- a/source/backend/tests/unit/api/Models/AgreementReportModelTest.cs +++ b/source/backend/tests/unit/api/Models/AgreementReportModelTest.cs @@ -1,8 +1,8 @@ +using System; +using System.Collections.Generic; using FluentAssertions; using Pims.Api.Areas.Reports.Models.Agreement; using Pims.Dal.Entities; -using System; -using System.Collections.Generic; using Xunit; namespace Pims.Api.Test @@ -17,7 +17,6 @@ public void AgreementReportModel_TeamMember() var propCoord = new PimsAcquisitionFilePerson() { AcqFlPersonProfileTypeCode = "PROPCOORD", Person = new PimsPerson() { Surname = "test" } }; testAgreement.AcquisitionFile = new Dal.Entities.PimsAcquisitionFile() { PimsAcquisitionFilePeople = new List() { propCoord } }; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); @@ -32,12 +31,11 @@ public void AgreementReportModel_TeamMember_Null() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AcquisitionFile = new Dal.Entities.PimsAcquisitionFile() { PimsAcquisitionFilePeople = new List() { } }; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); // Assert - model.PropertyCoordinator.Should().Be(""); + model.PropertyCoordinator.Should().Be(string.Empty); } [Fact] @@ -47,12 +45,11 @@ public void AgreementReportModel_Date_Null() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AgreementDate = null; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); // Assert - model.AgreementDate.Should().Be(""); + model.AgreementDate.Should().Be(string.Empty); } [Fact] @@ -62,7 +59,6 @@ public void AgreementReportModel_Date() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AgreementDate = new DateTime(1990, 1, 1); - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); @@ -77,7 +73,6 @@ public void AgreementReportModel_Project() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AcquisitionFile = new Dal.Entities.PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } }; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); @@ -92,12 +87,11 @@ public void AgreementReportModel_Project_Null() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AcquisitionFile = new Dal.Entities.PimsAcquisitionFile() { Project = null }; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); // Assert - model.MinistryProject.Should().Be(""); + model.MinistryProject.Should().Be(string.Empty); } [Fact] @@ -107,7 +101,6 @@ public void AgreementReportModel_Product() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AcquisitionFile = new Dal.Entities.PimsAcquisitionFile() { Product = new PimsProduct() { Code = "test", Description = "description" } }; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); @@ -122,12 +115,11 @@ public void AgreementReportModel_Product_Null() var testAgreement = new Dal.Entities.PimsAgreement(); testAgreement.AcquisitionFile = new Dal.Entities.PimsAcquisitionFile() { Product = null }; - // Act var model = new AgreementReportModel(testAgreement, new System.Security.Claims.ClaimsPrincipal()); // Assert - model.Product.Should().Be(""); + model.Product.Should().Be(string.Empty); } } } diff --git a/source/backend/tests/unit/api/Models/CompensationFinancialReportModelTest.cs b/source/backend/tests/unit/api/Models/CompensationFinancialReportModelTest.cs index 367540e991..11ff13ece1 100644 --- a/source/backend/tests/unit/api/Models/CompensationFinancialReportModelTest.cs +++ b/source/backend/tests/unit/api/Models/CompensationFinancialReportModelTest.cs @@ -1,8 +1,8 @@ +using System; +using System.Collections.Generic; using FluentAssertions; using Pims.Api.Areas.Reports.Models.Acquisition; using Pims.Dal.Entities; -using System; -using System.Collections.Generic; using Xunit; namespace Pims.Api.Test @@ -15,7 +15,7 @@ public void CompensationFinancialReportModel_Date() // Arrange var testFinancial = new PimsCompReqFinancial { - CompensationRequisition = new PimsCompensationRequisition() { FinalizedDate = new DateTime(1990, 1, 1) } + CompensationRequisition = new PimsCompensationRequisition() { FinalizedDate = new DateTime(1990, 1, 1) }, }; // Act @@ -31,14 +31,14 @@ public void CompensationFinancialReportModel_Date_Null() // Arrange var testFinancial = new PimsCompReqFinancial { - CompensationRequisition = new PimsCompensationRequisition() { FinalizedDate = null } + CompensationRequisition = new PimsCompensationRequisition() { FinalizedDate = null }, }; // Act var model = new CompensationFinancialReportModel(testFinancial, new CompensationFinancialReportTotalsModel(new List()), new System.Security.Claims.ClaimsPrincipal()); // Assert - model.FinalDate.Should().Be(""); + model.FinalDate.Should().Be(string.Empty); } [Fact] @@ -47,7 +47,7 @@ public void CompensationFinancialReportModel_RequisitionState() // Arrange var testFinancial = new PimsCompReqFinancial { - CompensationRequisition = new PimsCompensationRequisition() { IsDraft = false } + CompensationRequisition = new PimsCompensationRequisition() { IsDraft = false }, }; // Act @@ -63,7 +63,7 @@ public void CompensationFinancialReportModel_RequisitionState_Null() // Arrange var testFinancial = new PimsCompReqFinancial { - CompensationRequisition = new PimsCompensationRequisition() { IsDraft = null } + CompensationRequisition = new PimsCompensationRequisition() { IsDraft = null }, }; // Act @@ -81,8 +81,8 @@ public void CompensationFinancialReportModel_FileNumberAndName() { CompensationRequisition = new PimsCompensationRequisition() { - AcquisitionFile = new PimsAcquisitionFile() { FileNumber = "9999", FileName = "test" } - } + AcquisitionFile = new PimsAcquisitionFile() { FileNumber = "9999", FileName = "test" }, + }, }; // Act @@ -100,15 +100,15 @@ public void CompensationFinancialReportModel_FileNumberAndName_Null() { CompensationRequisition = new PimsCompensationRequisition() { - AcquisitionFile = null - } + AcquisitionFile = null, + }, }; // Act var model = new CompensationFinancialReportModel(testFinancial, new CompensationFinancialReportTotalsModel(new List()), new System.Security.Claims.ClaimsPrincipal()); // Assert - model.AcquisitionNumberAndName.Should().Be(""); + model.AcquisitionNumberAndName.Should().Be(string.Empty); } [Fact] @@ -119,8 +119,8 @@ public void CompensationFinancialReportModel_Project() { CompensationRequisition = new PimsCompensationRequisition() { - AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } }, + }, }; // Act @@ -138,15 +138,15 @@ public void CompensationFinancialReportModel_Project_Null() { CompensationRequisition = new PimsCompensationRequisition() { - AcquisitionFile = new PimsAcquisitionFile() { Project = null } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = null }, + }, }; // Act var model = new CompensationFinancialReportModel(testFinancial, new CompensationFinancialReportTotalsModel(new List()), new System.Security.Claims.ClaimsPrincipal()); // Assert - model.MinistryProject.Should().Be(""); + model.MinistryProject.Should().Be(string.Empty); } [Fact] @@ -158,8 +158,8 @@ public void CompensationFinancialReportModel_AlternateProject() CompensationRequisition = new PimsCompensationRequisition() { AlternateProject = new PimsProject() { Code = "alternate", Description = "project" }, - AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } }, + }, }; // Act @@ -178,15 +178,15 @@ public void CompensationFinancialReportModel_AlternateProject_Null() CompensationRequisition = new PimsCompensationRequisition() { AlternateProject = null, - AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Code = "test", Description = "description" } }, + }, }; // Act var model = new CompensationFinancialReportModel(testFinancial, new CompensationFinancialReportTotalsModel(new List()), new System.Security.Claims.ClaimsPrincipal()); // Assert - model.AlternateProject.Should().Be(""); + model.AlternateProject.Should().Be(string.Empty); } [Fact] @@ -197,8 +197,8 @@ public void CompensationFinancialReportModel_Product() { CompensationRequisition = new PimsCompensationRequisition() { - AcquisitionFile = new PimsAcquisitionFile() { Product = new PimsProduct() { Code = "test", Description = "description" } } - } + AcquisitionFile = new PimsAcquisitionFile() { Product = new PimsProduct() { Code = "test", Description = "description" } }, + }, }; // Act @@ -216,15 +216,15 @@ public void CompensationFinancialReportModel_Product_Null() { CompensationRequisition = new PimsCompensationRequisition() { - AcquisitionFile = new PimsAcquisitionFile() { Product = null } - } + AcquisitionFile = new PimsAcquisitionFile() { Product = null }, + }, }; // Act var model = new CompensationFinancialReportModel(testFinancial, new CompensationFinancialReportTotalsModel(new List()), new System.Security.Claims.ClaimsPrincipal()); // Assert - model.Product.Should().Be(""); + model.Product.Should().Be(string.Empty); } [Fact] @@ -233,7 +233,7 @@ public void CompensationFinancialReportModel_FinancialActivity() // Arrange var testFinancial = new PimsCompReqFinancial { - FinancialActivityCode = new PimsFinancialActivityCode() { Code = "test", Description = "description" } + FinancialActivityCode = new PimsFinancialActivityCode() { Code = "test", Description = "description" }, }; // Act @@ -248,14 +248,14 @@ public void CompensationFinancialReportModel_FinancialActivity_Null() { var testFinancial = new PimsCompReqFinancial { - FinancialActivityCode = null + FinancialActivityCode = null, }; // Act var model = new CompensationFinancialReportModel(testFinancial, new CompensationFinancialReportTotalsModel(new List()), new System.Security.Claims.ClaimsPrincipal()); // Assert - model.FinancialActivityName.Should().Be(""); + model.FinancialActivityName.Should().Be(string.Empty); } [Fact] @@ -270,8 +270,8 @@ public void CompensationFinancialReportModel_ProjectDraftAmounts() CompensationRequisition = new PimsCompensationRequisition() { IsDraft = true, - AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Id = 1, Code = "test", Description = "description" } } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Id = 1, Code = "test", Description = "description" } }, + }, }; var totals = new CompensationFinancialReportTotalsModel(new List { testFinancial }); @@ -297,8 +297,8 @@ public void CompensationFinancialReportModel_ProjectDraftAmounts_Null() CompensationRequisition = new PimsCompensationRequisition() { IsDraft = true, - AcquisitionFile = new PimsAcquisitionFile() { Project = null } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = null }, + }, }; var totals = new CompensationFinancialReportTotalsModel(new List { testFinancial }); @@ -324,8 +324,8 @@ public void CompensationFinancialReportModel_ProjectFinalAmounts() CompensationRequisition = new PimsCompensationRequisition() { IsDraft = false, - AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Id = 1, Code = "test", Description = "description" } } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = new PimsProject() { Id = 1, Code = "test", Description = "description" } }, + }, }; var totals = new CompensationFinancialReportTotalsModel(new List { testFinancial }); @@ -351,8 +351,8 @@ public void CompensationFinancialReportModel_ProjectFinalAmounts_Null() CompensationRequisition = new PimsCompensationRequisition() { IsDraft = false, - AcquisitionFile = new PimsAcquisitionFile() { Project = null } - } + AcquisitionFile = new PimsAcquisitionFile() { Project = null }, + }, }; var totals = new CompensationFinancialReportTotalsModel(new List { testFinancial }); diff --git a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs index a8e741ab48..a93dd0d3a8 100644 --- a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs @@ -34,13 +34,13 @@ public class AcquisitionFileServiceTest public AcquisitionFileServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private AcquisitionFileService CreateAcquisitionServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - return _helper.Create(user); + return this._helper.Create(user); } #region Add @@ -48,13 +48,13 @@ private AcquisitionFileService CreateAcquisitionServiceWithPermissions(params Pe public void Add_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Returns(acqFile); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); // Act @@ -68,15 +68,15 @@ public void Add_Success() public void Add_CannotDetermineRegion() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.RegionCode = 4; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Returns(acqFile); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); // Act @@ -90,14 +90,14 @@ public void Add_CannotDetermineRegion() public void Add_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); // Act Action act = () => service.Add(acqFile, new List()); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Assert act.Should().Throw(); @@ -108,12 +108,12 @@ public void Add_NoPermission() public void Add_ContractorNotInTeamException_Fail_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -128,22 +128,22 @@ public void Add_ContractorNotInTeamException_Fail_IsContractor() public void Add_Success_IsContractor_AssignedToTeam() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople.Add(new PimsAcquisitionFilePerson() { PersonId = 1, AcqFlPersonProfileTypeCode = "test" }); acqFile.ConcurrencyControlNumber = 1; - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var newGuid = Guid.NewGuid(); var contractorUser = EntityHelper.CreateUser(1, newGuid, username: "Test", isContractor: true); contractorUser.PersonId = 1; userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Returns(acqFile); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); // Act @@ -157,11 +157,11 @@ public void Add_Success_IsContractor_AssignedToTeam() public void Add_ThrowIfNull() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.Add(null, new List()); @@ -175,14 +175,14 @@ public void Add_ThrowIfNull() public void Add_DuplicateTeam() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileAdd); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople.Add(new PimsAcquisitionFilePerson() { PersonId = 1, AcqFlPersonProfileTypeCode = "test" }); acqFile.PimsAcquisitionFilePeople.Add(new PimsAcquisitionFilePerson() { PersonId = 1, AcqFlPersonProfileTypeCode = "test" }); - var repository = _helper.GetService>(); - var lookupRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); // Act @@ -199,12 +199,12 @@ public void Add_DuplicateTeam() public void GetById_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); @@ -219,12 +219,12 @@ public void GetById_Success() public void GetById_NoPermission_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -241,7 +241,7 @@ public void GetById_NoPermission_IsContractor() public void GetById_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); @@ -258,22 +258,22 @@ public void GetById_NoPermission() public void Update_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())).Returns(new List()); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -287,21 +287,21 @@ public void Update_Success() public void Update_NotAuthorized_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); repository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { AcquisitionFileStatusTypeCode = acqFile.AcquisitionFileStatusTypeCode, }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -316,24 +316,24 @@ public void Update_NotAuthorized_IsContractor() public void Update_CannotDetermineRegion() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.RegionCode = 4; acqFile.ConcurrencyControlNumber = 1; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetRegion(It.IsAny())).Returns(acqFile.RegionCode); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())).Returns(new List()); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -347,11 +347,11 @@ public void Update_CannotDetermineRegion() public void Update_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.Update(acqFile, new List() { UserOverrideCode.AddLocationToProperty }); @@ -364,11 +364,11 @@ public void Update_NoPermission() public void Update_ThrowIf_Null() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.Update(null, new List()); @@ -382,15 +382,15 @@ public void Update_ThrowIf_Null() public void Update_Region_Violation() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetRegion(It.IsAny())).Returns((short)(acqFile.RegionCode + 100)); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -406,22 +406,22 @@ public void Update_Region_Violation() public void Update_Success_Region_UserOverride() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())).Returns(new List()); // Act @@ -435,7 +435,7 @@ public void Update_Success_Region_UserOverride() public void Update_PropertyOfInterest_Violation() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.AcquisitionFileStatusTypeCode = "COMPLT"; @@ -446,14 +446,14 @@ public void Update_PropertyOfInterest_Violation() var propertyAcqFile = new PimsPropertyAcquisitionFile() { Property = property }; acqFile.PimsPropertyAcquisitionFiles = new List() { propertyAcqFile }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -469,7 +469,7 @@ public void Update_PropertyOfInterest_Violation() public void Update_Success_PropertyOfInterest_UserOverride() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.AcquisitionFileStatusTypeCode = "COMPLT"; @@ -480,24 +480,24 @@ public void Update_Success_PropertyOfInterest_UserOverride() var propertyAcqFile = new PimsPropertyAcquisitionFile() { Property = property }; acqFile.PimsPropertyAcquisitionFiles = new List() { propertyAcqFile }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.TransferToCoreInventory(It.IsAny())); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())).Returns(new List()); // Act @@ -512,17 +512,17 @@ public void Update_Success_PropertyOfInterest_UserOverride() public void Update_Success_AddsNote() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; acqFile.AppCreateUserid = "TESTER"; - var repository = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var lookupRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var lookupRepository = this._helper.GetService>(); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())).Returns(new List()); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); @@ -530,15 +530,15 @@ public void Update_Success_AddsNote() repository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { AcquisitionFileStatusTypeCode = "CLOSED", - AcquisitionFileStatusTypeCodeNavigation = new PimsAcquisitionFileStatusType() { Description = "Closed" } + AcquisitionFileStatusTypeCodeNavigation = new PimsAcquisitionFileStatusType() { Description = "Closed" }, }); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); lookupRepository.Setup(x => x.GetAllAcquisitionFileStatusTypes()).Returns(new PimsAcquisitionFileStatusType[]{ new PimsAcquisitionFileStatusType() { Id = acqFile.AcquisitionFileStatusTypeCodeNavigation.Id, Description = acqFile.AcquisitionFileStatusTypeCodeNavigation.Description, - }}); + },}); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -554,19 +554,19 @@ public void Update_Success_AddsNote() public void UpdateProperties_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit, Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit, Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -576,45 +576,11 @@ public void UpdateProperties_Success() filePropertyRepository.Verify(x => x.GetPropertiesByAcquisitionFileId(It.IsAny()), Times.Once); } - [Fact] - public void UpdateProperties_Activities_Violation() - { - // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit, Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); - - var acqFile = EntityHelper.CreateAcquisitionFile(); - acqFile.ConcurrencyControlNumber = 1; - - var property = EntityHelper.CreateProperty(12345); - var propertyAcqFile = new PimsPropertyAcquisitionFile() { Property = property }; - propertyAcqFile.PimsActInstPropAcqFiles = new List() { new PimsActInstPropAcqFile() }; - acqFile.PimsPropertyAcquisitionFiles = new List() { propertyAcqFile }; - - var repository = _helper.GetService>(); - repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); - repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - - var propertyRepository = _helper.GetService>(); - propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(property); - - var filePropertyRepository = _helper.GetService>(); - filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); - - var userRepository = _helper.GetService>(); - userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); - - // Act - Action act = () => service.UpdateProperties(EntityHelper.CreateAcquisitionFile(), new List()); - - // Assert - act.Should().Throw(); - } - [Fact] public void UpdateProperties_Takes_Violation() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit, Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit, Permissions.AcquisitionFileAdd, Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; @@ -624,17 +590,17 @@ public void UpdateProperties_Takes_Violation() propertyAcqFile.PimsTakes = new List() { new PimsTake() }; acqFile.PimsPropertyAcquisitionFiles = new List() { propertyAcqFile }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(property); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -648,7 +614,7 @@ public void UpdateProperties_Takes_Violation() public void UpdateProperties_MatchProperties_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; @@ -656,17 +622,17 @@ public void UpdateProperties_MatchProperties_Success() var property = EntityHelper.CreateProperty(12345); acqFile.PimsPropertyAcquisitionFiles = new List() { new PimsPropertyAcquisitionFile() { Property = property } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(property); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -680,7 +646,7 @@ public void UpdateProperties_MatchProperties_Success() public void UpdateProperties_MatchProperties_NewProperty_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; @@ -688,22 +654,22 @@ public void UpdateProperties_MatchProperties_NewProperty_Success() var property = EntityHelper.CreateProperty(12345); acqFile.PimsPropertyAcquisitionFiles = new List() { new PimsPropertyAcquisitionFile() { Property = property } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); PimsPropertyAcquisitionFile updatedAcquisitionFileProperty = null; repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsPropertyAcquisitionFiles.ToList()); filePropertyRepository.Setup(x => x.Add(It.IsAny())).Callback(x => updatedAcquisitionFileProperty = x).Returns(acqFile.PimsPropertyAcquisitionFiles.FirstOrDefault()); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Throws(); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())).Returns(new Coordinate(924046.3314288399, 1088892.9140135897)); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -728,7 +694,7 @@ public void UpdateProperties_MatchProperties_NewProperty_Success() public void UpdateProperties_UpdatePropertyFile_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var property = EntityHelper.CreateProperty(12345); @@ -736,17 +702,17 @@ public void UpdateProperties_UpdatePropertyFile_Success() acqFile.PimsPropertyAcquisitionFiles = new List() { new PimsPropertyAcquisitionFile() { Internal_Id = 1, Property = property } }; acqFile.ConcurrencyControlNumber = 1; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(new List() { new PimsPropertyAcquisitionFile() { Internal_Id = 1, Property = property, PropertyName = "updated" } }); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Throws(); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -760,24 +726,24 @@ public void UpdateProperties_UpdatePropertyFile_Success() public void UpdateProperties_RemovePropertyFile_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; var property = EntityHelper.CreateProperty(12345); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(new List() { new PimsPropertyAcquisitionFile() { Property = property } }); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Throws(); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -791,7 +757,7 @@ public void UpdateProperties_RemovePropertyFile_Success() public void UpdateProperties_RemoveProperty_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.ConcurrencyControlNumber = 1; @@ -802,19 +768,19 @@ public void UpdateProperties_RemoveProperty_Success() property.PimsPropertyLeases = new List(); property.PimsPropertyAcquisitionFiles = new List() { new PimsPropertyAcquisitionFile() }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetPropertiesByAcquisitionFileId(It.IsAny())).Returns(new List() { new PimsPropertyAcquisitionFile() { Property = property } }); filePropertyRepository.Setup(x => x.GetAcquisitionFilePropertyRelatedCount(It.IsAny())).Returns(1); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Throws(); propertyRepository.Setup(x => x.GetAllAssociationsById(It.IsAny())).Returns(property); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -829,11 +795,11 @@ public void UpdateProperties_RemoveProperty_Success() public void UpdateProperties_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); @@ -849,19 +815,19 @@ public void UpdateProperties_NoPermission() public void UpdateProperties_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); - var acqFileRepository = _helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); // Act @@ -875,21 +841,21 @@ public void UpdateProperties_NotAuthorized_Contractor() public void Update_DuplicateTeam() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople.Add(new PimsAcquisitionFilePerson() { PersonId = 1, AcqFlPersonProfileTypeCode = "test" }); acqFile.PimsAcquisitionFilePeople.Add(new PimsAcquisitionFilePerson() { PersonId = 1, AcqFlPersonProfileTypeCode = "test" }); acqFile.ConcurrencyControlNumber = 1; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetRegion(It.IsAny())).Returns(acqFile.RegionCode); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -902,13 +868,13 @@ public void Update_DuplicateTeam() [Fact] public void Update_Contractor_Removed() { - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople.Add(new PimsAcquisitionFilePerson() { PersonId = 1, AcqFlPersonProfileTypeCode = EnumUserTypeCodes.CONTRACT.ToString() }); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); contractorUser.PersonId = 1; @@ -931,7 +897,7 @@ public void Update_Contractor_Removed() public void Update_FKExeption_Removed_AcqFileOwner() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionOwners = new List() { @@ -940,12 +906,12 @@ public void Update_FKExeption_Removed_AcqFileOwner() }, }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition() { @@ -955,9 +921,9 @@ public void Update_FKExeption_Removed_AcqFileOwner() }, }); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -973,7 +939,7 @@ public void Update_FKExeption_Removed_AcqFileOwner() public void Update_FKExeption_Removed_OwnerSolicitor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsInterestHolders = new List() { @@ -983,12 +949,12 @@ public void Update_FKExeption_Removed_OwnerSolicitor() }, }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition() { @@ -998,9 +964,9 @@ public void Update_FKExeption_Removed_OwnerSolicitor() }, }); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1016,7 +982,7 @@ public void Update_FKExeption_Removed_OwnerSolicitor() public void Update_FKExeption_Removed_OwnerRepresentative() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsInterestHolders = new List() { @@ -1026,12 +992,12 @@ public void Update_FKExeption_Removed_OwnerRepresentative() }, }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition() { @@ -1041,9 +1007,9 @@ public void Update_FKExeption_Removed_OwnerRepresentative() }, }); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1059,7 +1025,7 @@ public void Update_FKExeption_Removed_OwnerRepresentative() public void Update_FKExeption_Removed_PersonOfInterest() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople = new List() { @@ -1068,12 +1034,12 @@ public void Update_FKExeption_Removed_PersonOfInterest() }, }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition() { @@ -1083,9 +1049,9 @@ public void Update_FKExeption_Removed_PersonOfInterest() }, }); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1101,7 +1067,7 @@ public void Update_FKExeption_Removed_PersonOfInterest() public void Update_NewTotalAllowableCompensation_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople = new List() { @@ -1111,13 +1077,13 @@ public void Update_NewTotalAllowableCompensation_Success() }; var values = new List(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(Capture.In(values))).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRegion(It.IsAny())).Returns(1); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition() { @@ -1126,7 +1092,7 @@ public void Update_NewTotalAllowableCompensation_Success() }, }); - var lookupRepository = _helper.GetService>(); + var lookupRepository = this._helper.GetService>(); lookupRepository.Setup(x => x.GetAllRegions()).Returns(new List() { new PimsRegion() { Code = 4, RegionName = "Cannot determine" } }); // Act @@ -1142,7 +1108,7 @@ public void Update_NewTotalAllowableCompensation_Success() public void Update_NewTotalAllowableCompensation_Failure_LessThenCurrentFinancials() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionFilePeople = new List() { @@ -1151,13 +1117,13 @@ public void Update_NewTotalAllowableCompensation_Failure_LessThenCurrentFinancia }, }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); repository.Setup(x => x.GetRegion(It.IsAny())).Returns(1); - var compReqRepository = _helper.GetService>(); + var compReqRepository = this._helper.GetService>(); compReqRepository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition() { @@ -1166,7 +1132,7 @@ public void Update_NewTotalAllowableCompensation_Failure_LessThenCurrentFinancia }, }); - var compReqService = _helper.GetService>(); + var compReqService = this._helper.GetService>(); compReqService.Setup(c => c.GetAllByAcquisitionFileId(It.IsAny(), true)).Returns( new List() { new PimsCompReqFinancial() { TotalAmt = 1000 } }); @@ -1185,16 +1151,16 @@ public void Update_NewTotalAllowableCompensation_Failure_LessThenCurrentFinancia public void GetChecklist_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var acquisitionRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var acquisitionRepository = this._helper.GetService>(); repository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsAcquisitionChecklistItems.ToList()); acquisitionRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1208,12 +1174,12 @@ public void GetChecklist_Success() public void GetChecklist_Append_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var acquisitionRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var acquisitionRepository = this._helper.GetService>(); repository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())).Returns(new List()); repository.Setup(x => x.GetAllChecklistItemTypes()).Returns(new List() { new PimsAcqChklstItemType() { AcqChklstItemTypeCode = "TEST" } }); acquisitionRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); @@ -1232,13 +1198,13 @@ public void GetChecklist_Append_Success() public void GetChecklist_Append_IgnoreAcqFileByStatus() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(1); acqFile.AcqPhysFileStatusTypeCode = "COMPLT"; - var repository = _helper.GetService>(); - var acquisitionRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var acquisitionRepository = this._helper.GetService>(); repository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())).Returns(new List()); repository.Setup(x => x.GetAllChecklistItemTypes()).Returns(new List() { new PimsAcqChklstItemType() { AcqChklstItemTypeCode = "TEST" } }); acquisitionRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); @@ -1255,13 +1221,13 @@ public void GetChecklist_Append_IgnoreAcqFileByStatus() public void GetChecklist_Append_IgnoreItemByDate() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var acqFile = EntityHelper.CreateAcquisitionFile(1); acqFile.AppCreateTimestamp = new DateTime(2023, 1, 1); - var repository = _helper.GetService>(); - var acquisitionRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var acquisitionRepository = this._helper.GetService>(); repository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())).Returns(new List()); repository.Setup(x => x.GetAllChecklistItemTypes()).Returns(new List() { new PimsAcqChklstItemType() { AcqChklstItemTypeCode = "TEST", EffectiveDate = new DateTime(2024, 1, 1) } }); acquisitionRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); @@ -1278,7 +1244,7 @@ public void GetChecklist_Append_IgnoreItemByDate() public void GetChecklist_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); @@ -1293,14 +1259,14 @@ public void GetChecklist_NoPermission() public void GetChecklist_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); - var acqFileRepository = _helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -1315,19 +1281,19 @@ public void GetChecklist_NotAuthorized_Contractor() public void UpdateChecklist_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionChecklistItems = new List() { new PimsAcquisitionChecklistItem() { Internal_Id = 1, AcqChklstItemStatusTypeCode = "COMPLT" } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var fileChecklistRepository = _helper.GetService>(); + var fileChecklistRepository = this._helper.GetService>(); fileChecklistRepository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsAcquisitionChecklistItem() { Internal_Id = 1, AcqChklstItemStatusTypeCode = "INCOMP" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1343,19 +1309,19 @@ public void UpdateChecklist_Success() public void UpdateChecklist_ItemNotFound() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); acqFile.PimsAcquisitionChecklistItems = new List() { new PimsAcquisitionChecklistItem() { Internal_Id = 999, AcqChklstItemStatusTypeCode = "COMPLT" } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var fileChecklistRepository = _helper.GetService>(); + var fileChecklistRepository = this._helper.GetService>(); fileChecklistRepository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsAcquisitionChecklistItem() { Internal_Id = 1, AcqChklstItemStatusTypeCode = "INCOMP" } }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1373,11 +1339,11 @@ public void UpdateChecklist_ItemNotFound() public void UpdateChecklist_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsAcquisitionChecklistItems.ToList()); // Act @@ -1392,17 +1358,17 @@ public void UpdateChecklist_NoPermission() public void UpdateChecklist_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllChecklistItemsByAcquisitionFileId(It.IsAny())).Returns(acqFile.PimsAcquisitionChecklistItems.ToList()); - var acqFileRepository = _helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -1420,7 +1386,7 @@ public void UpdateChecklist_NotAuthorized_Contractor() public void GetCompensationsRequisitions_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); // Act Action act = () => service.GetAcquisitionCompensations(1); @@ -1433,13 +1399,13 @@ public void GetCompensationsRequisitions_NoPermissions() public void GetCompensationsRequisitions_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); - var acqFileRepository = _helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(EntityHelper.CreateAcquisitionFile()); // Act @@ -1453,16 +1419,16 @@ public void GetCompensationsRequisitions_NotAuthorized_Contractor() public void GetCompensationsRequisitions_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsCompensationRequisition(), }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1476,7 +1442,7 @@ public void GetCompensationsRequisitions_Success() public void AddCompensationsRequisitions_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); // Act Action act = () => service.AddCompensationRequisition(1, new PimsCompensationRequisition()); @@ -1489,8 +1455,8 @@ public void AddCompensationsRequisitions_NoPermissions() public void AddCompensationsRequisitions_NullException() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); - var userRepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); @@ -1505,8 +1471,8 @@ public void AddCompensationsRequisitions_NullException() public void AddCompensationsRequisitions_BadRequest_IdMissmatch() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); - var userRepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); @@ -1521,16 +1487,16 @@ public void AddCompensationsRequisitions_BadRequest_IdMissmatch() public void AddCompensationsRequisitions_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); - var repository = _helper.GetService>(); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); + var repository = this._helper.GetService>(); + var acqFilerepository = this._helper.GetService>(); var newCompensationReq = EntityHelper.CreateCompensationRequisition(1, 1); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); acqFilerepository.Setup(x => x.GetById(It.IsAny())).Returns(acquisitionFile); repository.Setup(x => x.Add(It.IsAny())).Returns(newCompensationReq); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -1545,16 +1511,16 @@ public void AddCompensationsRequisitions_NotAuthorized_Contractor() public void AddCompensationsRequisitions_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); - var repository = _helper.GetService>(); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); + var repository = this._helper.GetService>(); + var acqFilerepository = this._helper.GetService>(); var newCompensationReq = EntityHelper.CreateCompensationRequisition(1, 1); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); acqFilerepository.Setup(x => x.GetById(It.IsAny())).Returns(acquisitionFile); repository.Setup(x => x.Add(It.IsAny())).Returns(newCompensationReq); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1571,7 +1537,7 @@ public void AddCompensationsRequisitions_Success() public void GetInterestHolders_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); // Act Action act = () => service.GetInterestHolders(1); @@ -1584,13 +1550,13 @@ public void GetInterestHolders_NoPermissions() public void GetInterestHolders_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); - var acqFileRepository = _helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(EntityHelper.CreateAcquisitionFile()); // Act @@ -1604,16 +1570,16 @@ public void GetInterestHolders_NotAuthorized_Contractor() public void GetInterestHolders_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetInterestHoldersByAcquisitionFile(It.IsAny())) .Returns(new List() { new PimsInterestHolder(), }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -1627,7 +1593,7 @@ public void GetInterestHolders_Success() public void UpdateInterestHolders_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); // Act Action act = () => service.UpdateInterestHolders(1, new List() @@ -1643,15 +1609,15 @@ public void UpdateInterestHolders_NoPermissions() public void UpdateInterestHolders_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var repository = _helper.GetService>(); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var repository = this._helper.GetService>(); + var acqFilerepository = this._helper.GetService>(); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); acqFilerepository.Setup(x => x.GetById(It.IsAny())).Returns(acquisitionFile); repository.Setup(x => x.UpdateAllForAcquisition(It.IsAny(), It.IsAny>())).Returns(new List() { new PimsInterestHolder() }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -1766,12 +1732,12 @@ public void UpdateInterestHolders_FKExeption_Removed_InterestHolder() public void GetAgreementsByAcquisitionFileId_NoPermission_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -1788,12 +1754,12 @@ public void GetAgreementsByAcquisitionFileId_NoPermission_IsContractor() public void SearchAgreementsByAcquisitionFileId_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var filter = new AcquisitionReportFilterModel(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.SearchAgreements(It.IsAny())).Returns(new List()); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -1810,12 +1776,12 @@ public void SearchAgreementsByAcquisitionFileId_Success() public void SearchAgreementsByAcquisitionFileId_Region_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var filter = new AcquisitionReportFilterModel(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); var matchingAgreement = new PimsAgreement() { AcquisitionFile = new PimsAcquisitionFile() { RegionCode = 1 } }; var nonMatchingAgreement = new PimsAgreement() { AcquisitionFile = new PimsAcquisitionFile() { RegionCode = 2 } }; repository.Setup(x => x.SearchAgreements(It.IsAny())).Returns(new List() { matchingAgreement, nonMatchingAgreement }); @@ -1836,20 +1802,19 @@ public void SearchAgreementsByAcquisitionFileId_Region_Success() public void SearchAgreementsByAcquisitionFileId_Contractor_Filter() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var filter = new AcquisitionReportFilterModel(); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); var matchingPerson = new PimsAcquisitionFilePerson() { PersonId = user.PersonId }; var matchingAgreement = new PimsAgreement() { AcquisitionFile = new PimsAcquisitionFile() { RegionCode = 1, PimsAcquisitionFilePeople = new List() { matchingPerson } } }; var nonMatchingAgreement = new PimsAgreement() { AcquisitionFile = new PimsAcquisitionFile() { } }; repository.Setup(x => x.SearchAgreements(It.IsAny())).Returns(new List() { matchingAgreement, nonMatchingAgreement }); - user.PimsRegionUsers = new List() { new PimsRegionUser() { RegionCode = 1 } }; userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(user); @@ -1866,12 +1831,12 @@ public void SearchAgreementsByAcquisitionFileId_Contractor_Filter() public void SearchAgreementsByAcquisitionFileId_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); var filter = new AcquisitionReportFilterModel(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.SearchAgreements(It.IsAny())).Returns(new List()); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -1888,12 +1853,12 @@ public void SearchAgreementsByAcquisitionFileId_NoPermission() public void UpdateAgreementsByAcquisitionFileId_NoPermission_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -1914,12 +1879,12 @@ public void UpdateAgreementsByAcquisitionFileId_NoPermission_IsContractor() public void GetOwners_ByAcquisitionFileId_NoPermission_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -1940,11 +1905,11 @@ public void GetOwners_ByAcquisitionFileId_NoPermission_IsContractor() public void GetTeamMembers_NoPermission() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetTeamMembers(It.IsAny>(), null)).Returns(new List()); // Act @@ -1958,12 +1923,12 @@ public void GetTeamMembers_NoPermission() public void GetTeamMembers_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetTeamMembers(It.IsAny>(), It.IsAny())).Returns(new List()); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -1984,12 +1949,12 @@ public void GetTeamMembers_Success() public void GetProperties_ByAcquisitionFileId_NoPermission_IsContractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.AgreementView); var acqFile = EntityHelper.CreateAcquisitionFile(); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); @@ -2009,7 +1974,7 @@ public void GetProperties_ByAcquisitionFileId_NoPermission_IsContractor() public void GetExpPayments_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); // Act Action act = () => service.GetAcquisitionExpropriationPayments(1); @@ -2022,13 +1987,13 @@ public void GetExpPayments_NoPermissions() public void GetExpPayments_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); - var acqFileRepository = _helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(EntityHelper.CreateAcquisitionFile()); // Act @@ -2042,16 +2007,16 @@ public void GetExpPayments_NotAuthorized_Contractor() public void GetExpPayments_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView, Permissions.CompensationRequisitionView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())) .Returns(new List() { new PimsExpropriationPayment(), }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -2065,7 +2030,7 @@ public void GetExpPayments_Success() public void AddExpPayment_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); // Act Action act = () => service.AddExpropriationPayment(1, new PimsExpropriationPayment()); @@ -2078,8 +2043,8 @@ public void AddExpPayment_NoPermissions() public void AddExpPayment_NullException() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); - var userRepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); @@ -2094,8 +2059,8 @@ public void AddExpPayment_NullException() public void AddExpPayment_BadRequest_IdMissmatch() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); - var userRepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); @@ -2110,16 +2075,16 @@ public void AddExpPayment_BadRequest_IdMissmatch() public void AddExpPayment_NotAuthorized_Contractor() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); - var repository = _helper.GetService>(); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.CompensationRequisitionAdd); + var repository = this._helper.GetService>(); + var acqFilerepository = this._helper.GetService>(); var newExpPayment = EntityHelper.CreateExpropriationPayment(1, 1); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); acqFilerepository.Setup(x => x.GetById(It.IsAny())).Returns(acquisitionFile); repository.Setup(x => x.Add(It.IsAny())).Returns(newExpPayment); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); @@ -2134,16 +2099,16 @@ public void AddExpPayment_NotAuthorized_Contractor() public void AddExpPayment_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); - var repository = _helper.GetService>(); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit); + var repository = this._helper.GetService>(); + var acqFilerepository = this._helper.GetService>(); var newExpPayment = EntityHelper.CreateExpropriationPayment(1, 1); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); acqFilerepository.Setup(x => x.GetById(It.IsAny())).Returns(acquisitionFile); repository.Setup(x => x.Add(It.IsAny())).Returns(newExpPayment); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -2161,7 +2126,7 @@ public void AddExpPayment_Success() public void GetAcquisitionFileExport_NoPermissions() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(); + var service = this.CreateAcquisitionServiceWithPermissions(); var filter = new AcquisitionFilter(); // Act @@ -2175,18 +2140,18 @@ public void GetAcquisitionFileExport_NoPermissions() public void GetAcquisitionFileExport_Success() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var acqFilerepository = this._helper.GetService>(); var filter = new AcquisitionFilter(); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); acqFilerepository.Setup(x => x.GetAcquisitionFileExport(It.IsAny(), It.IsAny>(), It.IsAny())) .Returns(new List() { - acquisitionFile + acquisitionFile, }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -2202,8 +2167,8 @@ public void GetAcquisitionFileExport_Success() public void GetAcquisitionFileExport_Success_FlatProperties() { // Arrange - var service = CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); - var acqFilerepository = _helper.GetService>(); + var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileView); + var acqFilerepository = this._helper.GetService>(); var filter = new AcquisitionFilter(); var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); @@ -2218,7 +2183,7 @@ public void GetAcquisitionFileExport_Success_FlatProperties() { PropertyId = 100, Pid = 8000, - } + }, }, new PimsPropertyAcquisitionFile() { @@ -2228,17 +2193,17 @@ public void GetAcquisitionFileExport_Success_FlatProperties() { PropertyId = 200, Pid = 9000, - } + }, }, }; acqFilerepository.Setup(x => x.GetAcquisitionFileExport(It.IsAny(), It.IsAny>(), It.IsAny())) .Returns(new List() { - acquisitionFile + acquisitionFile, }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act diff --git a/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs b/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs index 91410b62ec..4aa0f6e0cd 100644 --- a/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs +++ b/source/backend/tests/unit/api/Services/CompReqFinancialServiceTest.cs @@ -1,3 +1,7 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; using FluentAssertions; using Moq; using Pims.Api.Services; @@ -7,10 +11,6 @@ using Pims.Dal.Exceptions; using Pims.Dal.Repositories; using Pims.Dal.Security; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using Xunit; namespace Pims.Api.Test.Services @@ -26,15 +26,15 @@ public class CompReqFinancialServiceTest public CompReqFinancialServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } [Fact] public void GetAllByAcquisitionFileId_Success() { // Arrange - var service = CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny(), null)); // Act @@ -48,8 +48,8 @@ public void GetAllByAcquisitionFileId_Success() public void GetAllByAcquisitionFileId_Unauthorized() { // Arrange - var service = CreateWithPermissions(Permissions.CompensationRequisitionEdit); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.CompensationRequisitionEdit); + var repo = this._helper.GetService>(); // Act Action act = () => service.GetAllByAcquisitionFileId(1, null); @@ -62,7 +62,7 @@ public void GetAllByAcquisitionFileId_Unauthorized() public void SearchCompensationRequisitionFinancials_Unauthorized() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); var filter = new AcquisitionReportFilterModel(); // Act @@ -76,12 +76,12 @@ public void SearchCompensationRequisitionFinancials_Unauthorized() public void SearchCompensationRequisitionFinancials_Success() { // Arrange - var service = CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView, Permissions.ProjectView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView, Permissions.ProjectView); + var repo = this._helper.GetService>(); repo.Setup(x => x.SearchCompensationRequisitionFinancials(It.IsAny())).Returns(new List()); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); var filter = new AcquisitionReportFilterModel(); @@ -97,16 +97,16 @@ public void SearchCompensationRequisitionFinancials_Success() public void SearchCompensationRequisitionFinancials_Region_Success() { // Arrange - var service = CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView, Permissions.ProjectView); + var service = this.CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView, Permissions.ProjectView); var matchingFinancial = new PimsCompReqFinancial { CompensationRequisition = new PimsCompensationRequisition { AcquisitionFile = new PimsAcquisitionFile { RegionCode = 1 } } }; var nonMatchingFinancial = new PimsCompReqFinancial { CompensationRequisition = new PimsCompensationRequisition { AcquisitionFile = new PimsAcquisitionFile { RegionCode = 2 } } }; - var repo = _helper.GetService>(); + var repo = this._helper.GetService>(); repo.Setup(x => x.SearchCompensationRequisitionFinancials(It.IsAny())).Returns(new List { matchingFinancial, nonMatchingFinancial }); var user = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: false); user.PimsRegionUsers = new List { new PimsRegionUser { RegionCode = 1 } }; - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(user); var filter = new AcquisitionReportFilterModel(); @@ -123,7 +123,7 @@ public void SearchCompensationRequisitionFinancials_Region_Success() public void SearchCompensationRequisitionFinancials_Contractor_Filter() { // Arrange - var service = CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView, Permissions.ProjectView); + var service = this.CreateWithPermissions(Permissions.CompensationRequisitionView, Permissions.AcquisitionFileView, Permissions.ProjectView); var contractorUser = EntityHelper.CreateUser(1, Guid.NewGuid(), username: "Test", isContractor: true); var matchingFinancial = new PimsCompReqFinancial @@ -134,15 +134,15 @@ public void SearchCompensationRequisitionFinancials_Contractor_Filter() { RegionCode = 1, PimsAcquisitionFilePeople = new List { new PimsAcquisitionFilePerson { PersonId = contractorUser.PersonId } } - } - } + }, + }, }; var nonMatchingFinancial = new PimsCompReqFinancial { CompensationRequisition = new PimsCompensationRequisition { AcquisitionFile = new PimsAcquisitionFile { } } }; - var repo = _helper.GetService>(); + var repo = this._helper.GetService>(); repo.Setup(x => x.SearchCompensationRequisitionFinancials(It.IsAny())).Returns(new List { matchingFinancial, nonMatchingFinancial }); contractorUser.PimsRegionUsers = new List { new PimsRegionUser { RegionCode = 1 } }; - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(contractorUser); var filter = new AcquisitionReportFilterModel(); @@ -158,7 +158,7 @@ public void SearchCompensationRequisitionFinancials_Contractor_Filter() private CompReqFinancialService CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - return _helper.Create(user); + return this._helper.Create(user); } } } diff --git a/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs b/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs index 3cdb57747c..851a3b330b 100644 --- a/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs +++ b/source/backend/tests/unit/api/Services/CompensationRequisitionServiceTest.cs @@ -30,14 +30,14 @@ public class CompensationRequisitionServiceTest public CompensationRequisitionServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } [Fact] public void GetById_NoPermission() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(); + var service = this.CreateCompRequisitionServiceWithPermissions(); // Act Action act = () => service.GetById(1); @@ -50,8 +50,8 @@ public void GetById_NoPermission() public void GetById_Success() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionView); - var repo = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetById(It.IsAny())).Returns(new PimsCompensationRequisition { Internal_Id = 1 }); // Act @@ -65,7 +65,7 @@ public void GetById_Success() public void Update_NoPermission() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(); + var service = this.CreateCompRequisitionServiceWithPermissions(); // Act Action act = () => service.Update(new PimsCompensationRequisition()); @@ -78,7 +78,7 @@ public void Update_NoPermission() public void Update_BadRequest_EntityIsNull() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); // Act Action act = () => service.Update(null); @@ -91,10 +91,10 @@ public void Update_BadRequest_EntityIsNull() public void Update_Success_Inserts_StatusChanged_Note() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var noteRepository = _helper.GetService>(); - var compensationRepository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var noteRepository = this._helper.GetService>(); + var compensationRepository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { TotalAllowableCompensation = 100 }); @@ -139,10 +139,10 @@ public void Update_Success_Inserts_StatusChanged_Note() public void Update_Success_Skips_StatusChanged_Note() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { TotalAllowableCompensation = 100 }); @@ -157,9 +157,8 @@ public void Update_Success_Skips_StatusChanged_Note() Internal_Id = 1, AcquisitionFileId = 1, ConcurrencyControlNumber = 2, - IsDraft = true - } - ); + IsDraft = true, + }); // Assert result.Should().NotBeNull(); @@ -173,9 +172,9 @@ public void Update_Success_Skips_StatusChanged_Note() public void Update_Status_BackToDraft_NoPermission() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = false }); @@ -186,7 +185,7 @@ public void Update_Status_BackToDraft_NoPermission() Internal_Id = 1, AcquisitionFileId = 1, ConcurrencyControlNumber = 2, - IsDraft = true + IsDraft = true, }); // Assert @@ -197,9 +196,9 @@ public void Update_Status_BackToDraft_NoPermission() public void Update_Status_BackToNull_NoPermission() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = false }); @@ -210,7 +209,7 @@ public void Update_Status_BackToNull_NoPermission() Internal_Id = 1, AcquisitionFileId = 1, ConcurrencyControlNumber = 2, - IsDraft = null + IsDraft = null, }); // Assert @@ -221,10 +220,10 @@ public void Update_Status_BackToNull_NoPermission() public void Update_Status_BackToDraft_AuthorizedAdmin() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit, Permissions.SystemAdmin); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit, Permissions.SystemAdmin); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { TotalAllowableCompensation = 100 }); @@ -240,7 +239,7 @@ public void Update_Status_BackToDraft_AuthorizedAdmin() Internal_Id = 1, AcquisitionFileId = 1, ConcurrencyControlNumber = 2, - IsDraft = true + IsDraft = true, }); // Assert @@ -255,10 +254,10 @@ public void Update_Status_BackToDraft_AuthorizedAdmin() public void Update_Status_BackToNull_AuthorizedAdmin() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit, Permissions.SystemAdmin); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit, Permissions.SystemAdmin); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { TotalAllowableCompensation = 100 }); @@ -274,7 +273,7 @@ public void Update_Status_BackToNull_AuthorizedAdmin() Internal_Id = 1, AcquisitionFileId = 1, ConcurrencyControlNumber = 2, - IsDraft = null + IsDraft = null, }); // Assert @@ -289,10 +288,10 @@ public void Update_Status_BackToNull_AuthorizedAdmin() public void Update_Success_Skips_StatusChanged_Note_FromNoStatus() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { TotalAllowableCompensation = 100 }); @@ -307,9 +306,8 @@ public void Update_Success_Skips_StatusChanged_Note_FromNoStatus() Internal_Id = 1, AcquisitionFileId = 1, ConcurrencyControlNumber = 2, - IsDraft = true - } - ); + IsDraft = true, + }); // Assert result.Should().NotBeNull(); @@ -323,11 +321,11 @@ public void Update_Success_Skips_StatusChanged_Note_FromNoStatus() public void Update_Success_ValidTotalAllowableCompensation() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var compReqH120Service = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var compReqH120Service = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = true }); ; @@ -346,9 +344,8 @@ public void Update_Success_ValidTotalAllowableCompensation() AcquisitionFileId = 1, ConcurrencyControlNumber = 2, IsDraft = true, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 1000 } } - } - ); + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 1000 } }, + }); // Assert result.Should().NotBeNull(); @@ -359,11 +356,11 @@ public void Update_Success_ValidTotalAllowableCompensation() public void Update_Success_ValidMultipleTotalAllowableCompensation() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var compReqH120Service = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var compReqH120Service = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = true }); ; @@ -377,7 +374,7 @@ public void Update_Success_ValidMultipleTotalAllowableCompensation() { TotalAllowableCompensation = 300, PimsCompensationRequisitions = new List() { new PimsCompensationRequisition() { Internal_Id = 1, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 100 } } } } + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 100 } } }, }, }); // Act @@ -387,9 +384,8 @@ public void Update_Success_ValidMultipleTotalAllowableCompensation() AcquisitionFileId = 1, ConcurrencyControlNumber = 2, IsDraft = false, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 200 } } - } - ); + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 200 } }, + }); // Assert result.Should().NotBeNull(); @@ -400,11 +396,11 @@ public void Update_Success_ValidMultipleTotalAllowableCompensation() public void Update_Success_TotalAllowableExceededDraft() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var compReqH120Service = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var compReqH120Service = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = true }); ; @@ -423,9 +419,8 @@ public void Update_Success_TotalAllowableExceededDraft() AcquisitionFileId = 1, ConcurrencyControlNumber = 2, IsDraft = true, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 1000 } } - } - ); + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 1000 } }, + }); // Assert result.Should().NotBeNull(); @@ -436,11 +431,11 @@ public void Update_Success_TotalAllowableExceededDraft() public void Update_Fail_TotalAllowableExceeded() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var compReqH120Service = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var compReqH120Service = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = true }); ; @@ -453,7 +448,7 @@ public void Update_Fail_TotalAllowableExceeded() { TotalAllowableCompensation = 99, PimsCompensationRequisitions = new List() { new PimsCompensationRequisition() { Internal_Id = 1, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 100 } } } } + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 100 } } }, }, }); // Act @@ -464,9 +459,8 @@ public void Update_Fail_TotalAllowableExceeded() AcquisitionFileId = 1, ConcurrencyControlNumber = 2, IsDraft = false, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 200 } } - } - ); + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 200 } }, + }); act.Should().Throw(); } @@ -474,11 +468,11 @@ public void Update_Fail_TotalAllowableExceeded() public void Update_Fail_ValidMultipleTotalAllowableCompensation() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); - var compReqH120Service = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var repository = _helper.GetService>(); - var acqFileRepository = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionEdit); + var compReqH120Service = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var repository = this._helper.GetService>(); + var acqFileRepository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())) .Returns(new PimsCompensationRequisition { Internal_Id = 1, AcquisitionFileId = 1, IsDraft = true }); ; @@ -487,13 +481,13 @@ public void Update_Fail_ValidMultipleTotalAllowableCompensation() compReqH120Service.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny(), true)).Returns( new List() { new PimsCompReqFinancial() { CompensationRequisitionId = 1, TotalAmt = 1000 }, - new PimsCompReqFinancial() { CompensationRequisitionId = 2, TotalAmt = 100 } }); + new PimsCompReqFinancial() { CompensationRequisitionId = 2, TotalAmt = 100 }, }); acqFileRepository.Setup(x => x.GetById(It.IsAny())).Returns(new PimsAcquisitionFile() { TotalAllowableCompensation = 299, PimsCompensationRequisitions = new List() { new PimsCompensationRequisition() { Internal_Id = 1, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 100 } } } } + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 100 } } }, }, }); // Act @@ -504,9 +498,8 @@ public void Update_Fail_ValidMultipleTotalAllowableCompensation() AcquisitionFileId = 1, ConcurrencyControlNumber = 2, IsDraft = false, - PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 200 } } - } - ); + PimsCompReqFinancials = new List() { new PimsCompReqFinancial() { TotalAmt = 200 } }, + }); act.Should().Throw(); } @@ -514,7 +507,7 @@ public void Update_Fail_ValidMultipleTotalAllowableCompensation() public void Delete_NoPermission() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(); + var service = this.CreateCompRequisitionServiceWithPermissions(); // Act Action act = () => service.DeleteCompensation(1); @@ -527,8 +520,8 @@ public void Delete_NoPermission() public void Delete_Success() { // Arrange - var service = CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionDelete); - var repo = _helper.GetService>(); + var service = this.CreateCompRequisitionServiceWithPermissions(Permissions.CompensationRequisitionDelete); + var repo = this._helper.GetService>(); repo.Setup(x => x.TryDelete(It.IsAny())); // Act @@ -541,8 +534,8 @@ public void Delete_Success() private CompensationRequisitionService CreateCompRequisitionServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(user); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(user); } } } diff --git a/source/backend/tests/unit/api/Services/CoordinateTransformServiceTest.cs b/source/backend/tests/unit/api/Services/CoordinateTransformServiceTest.cs index d1dce0c3ad..8fe6eda7e6 100644 --- a/source/backend/tests/unit/api/Services/CoordinateTransformServiceTest.cs +++ b/source/backend/tests/unit/api/Services/CoordinateTransformServiceTest.cs @@ -22,8 +22,8 @@ public class CoordinateTransformServiceTest public CoordinateTransformServiceTest() { - _helper = new TestHelper(); - _service = _helper.Create(); + this._helper = new TestHelper(); + this._service = this._helper.Create(); } #region Tests @@ -35,7 +35,7 @@ public void Transform_Wgs84_BcAlbers() // Act var location = new Coordinate(-127.18, 54.79); - var actual = _service.TransformCoordinates(4326, 3005, location); + var actual = this._service.TransformCoordinates(4326, 3005, location); // Assert actual.Should().Be(expected); @@ -49,7 +49,7 @@ public void Transform_BcAlbers_Wgs84() // Act var location = new Coordinate(924033.50, 1088851.50); - var actual = _service.TransformCoordinates(3005, 4326, location); + var actual = this._service.TransformCoordinates(3005, 4326, location); // Assert actual.Should().Be(expected); @@ -63,8 +63,8 @@ public void Transform_Not_Supported() // Act // Assert - _service.IsCoordinateSystemSupported(900913).Should().BeFalse(); - Assert.Throws(() => _service.TransformCoordinates(900913, 4326, location)); + this._service.IsCoordinateSystemSupported(900913).Should().BeFalse(); + Assert.Throws(() => this._service.TransformCoordinates(900913, 4326, location)); } #endregion } diff --git a/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs b/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs index cf82ba899c..19dcb52a0a 100644 --- a/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DocumentFileServiceTest.cs @@ -41,21 +41,21 @@ public class DocumentFileServiceTest public DocumentFileServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private DocumentFileService CreateDocumentFileServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } [Fact] public void GetFileDocuments_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); + var service = this.CreateDocumentFileServiceWithPermissions(); // Act Action sut = () => service.GetFileDocuments(Constants.FileType.Research, 1); @@ -68,7 +68,7 @@ public void GetFileDocuments_ShouldThrowException_NotAuthorized() public void GetFileDocuments_ShouldThrowException_BadRequestException() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentView); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentView); // Act Action sut = () => service.GetFileDocuments(Constants.FileType.Unknown, 1); @@ -81,8 +81,8 @@ public void GetFileDocuments_ShouldThrowException_BadRequestException() public void GetPimsDocumentTypes_Research_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.ResearchFileView); - var researchFileDocumentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.ResearchFileView); + var researchFileDocumentRepository = this._helper.GetService>(); researchFileDocumentRepository.Setup(x => x.GetAllByResearchFile(It.IsAny())).Returns(new List()); @@ -97,8 +97,8 @@ public void GetPimsDocumentTypes_Research_Success() public void GetPimsDocumentTypes_Acquisition_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.AcquisitionFileView); - var acquisitionFileDocumentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.AcquisitionFileView); + var acquisitionFileDocumentRepository = this._helper.GetService>(); acquisitionFileDocumentRepository.Setup(x => x.GetAllByAcquisitionFile(It.IsAny())).Returns(new List()); @@ -113,8 +113,8 @@ public void GetPimsDocumentTypes_Acquisition_Success() public void GetAllProjectDocuments_Project_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.ProjectView); - var projectRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.ProjectView); + var projectRepository = this._helper.GetService>(); projectRepository.Setup(x => x.GetAllProjectDocuments(It.IsAny())).Returns(new List()); @@ -129,8 +129,8 @@ public void GetAllProjectDocuments_Project_Success() public void GetAllDocuments_Lease_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.LeaseView); - var leaseRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentView, Permissions.LeaseView); + var leaseRepository = this._helper.GetService>(); leaseRepository.Setup(x => x.GetAllLeaseDocuments(It.IsAny())).Returns(new List()); @@ -145,8 +145,8 @@ public void GetAllDocuments_Lease_Success() public void GetPimsDocumentTypes_Lease_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var leaseRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var leaseRepository = this._helper.GetService>(); // Act Action sut = () => service.GetFileDocuments(Constants.FileType.Lease, 1); @@ -160,8 +160,8 @@ public void GetPimsDocumentTypes_Lease_NotAuthorized() public void GetPimsDocumentTypes_Project_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var projectRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var projectRepository = this._helper.GetService>(); // Act Action sut = () => service.GetFileDocuments(Constants.FileType.Project, 1); @@ -175,10 +175,10 @@ public void GetPimsDocumentTypes_Project_NotAuthorized() public void UploadDocumentAsync_Research_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var documentService = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var documentService = this._helper.GetService>(); - DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = _helper.GetFormFile(string.Empty) }; + DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = this._helper.GetFormFile(string.Empty) }; // Assert Func sut = async () => await service.UploadResearchDocumentAsync(1, uploadRequest); @@ -192,10 +192,10 @@ public void UploadDocumentAsync_Research_ShouldThrowException_NotAuthorized() public void UploadDocumentAsync_Acquisition_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var documentService = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var documentService = this._helper.GetService>(); - DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = _helper.GetFormFile(string.Empty) }; + DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = this._helper.GetFormFile(string.Empty) }; // Assert Func sut = async () => await service.UploadResearchDocumentAsync(1, uploadRequest); @@ -209,10 +209,10 @@ public void UploadDocumentAsync_Acquisition_ShouldThrowException_NotAuthorized() public void UploadDocumentAsync_Project_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var documentService = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var documentService = this._helper.GetService>(); - DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = _helper.GetFormFile(string.Empty) }; + DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = this._helper.GetFormFile(string.Empty) }; // Assert Func sut = async () => await service.UploadProjectDocumentAsync(1, uploadRequest); @@ -226,10 +226,10 @@ public void UploadDocumentAsync_Project_ShouldThrowException_NotAuthorized() public void UploadDocumentAsync_Lease_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var documentService = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var documentService = this._helper.GetService>(); - DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = _helper.GetFormFile(string.Empty) }; + DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = this._helper.GetFormFile(string.Empty) }; // Assert Func sut = async () => await service.UploadLeaseDocumentAsync(1, uploadRequest); @@ -243,9 +243,9 @@ public void UploadDocumentAsync_Lease_ShouldThrowException_NotAuthorized() public async void UploadDocumentAsync_Project_Sucess() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); - var documentService = _helper.GetService>(); - var projectRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); + var documentService = this._helper.GetService>(); + var projectRepository = this._helper.GetService>(); documentService.Setup(x => x.UploadDocumentAsync(It.IsAny())) .ReturnsAsync(new DocumentUploadResponse() @@ -253,7 +253,7 @@ public async void UploadDocumentAsync_Project_Sucess() Document = new DocumentModel() { Id = 1, - } + }, }); // Act @@ -261,7 +261,7 @@ public async void UploadDocumentAsync_Project_Sucess() { DocumentTypeMayanId = 3, DocumentTypeId = 4, - File = _helper.GetFormFile(string.Empty), + File = this._helper.GetFormFile(string.Empty), DocumentStatusCode = "DocumentStatus", }; @@ -276,9 +276,9 @@ public async void UploadDocumentAsync_Project_Sucess() public async void UploadDocumentAsync_Acquisition_Sucess() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); - var documentService = _helper.GetService>(); - var acquisitionFileDocumentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); + var documentService = this._helper.GetService>(); + var acquisitionFileDocumentRepository = this._helper.GetService>(); documentService.Setup(x => x.UploadDocumentAsync(It.IsAny())) .ReturnsAsync(new DocumentUploadResponse() @@ -286,7 +286,7 @@ public async void UploadDocumentAsync_Acquisition_Sucess() Document = new DocumentModel() { Id = 1, - } + }, }); // Act @@ -294,7 +294,7 @@ public async void UploadDocumentAsync_Acquisition_Sucess() { DocumentTypeMayanId = 3, DocumentTypeId = 4, - File = _helper.GetFormFile(string.Empty), + File = this._helper.GetFormFile(string.Empty), DocumentStatusCode = "DocumentStatus", }; @@ -309,9 +309,9 @@ public async void UploadDocumentAsync_Acquisition_Sucess() public async void UploadDocumentAsync_Research_Sucess() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); - var documentService = _helper.GetService>(); - var researchFileDocumentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); + var documentService = this._helper.GetService>(); + var researchFileDocumentRepository = this._helper.GetService>(); documentService.Setup(x => x.UploadDocumentAsync(It.IsAny())) .ReturnsAsync(new DocumentUploadResponse() @@ -319,7 +319,7 @@ public async void UploadDocumentAsync_Research_Sucess() Document = new DocumentModel() { Id = 1, - } + }, }); // Act @@ -327,7 +327,7 @@ public async void UploadDocumentAsync_Research_Sucess() { DocumentTypeMayanId = 3, DocumentTypeId = 4, - File = _helper.GetFormFile(string.Empty), + File = this._helper.GetFormFile(string.Empty), DocumentStatusCode = "DocumentStatus", }; @@ -342,9 +342,9 @@ public async void UploadDocumentAsync_Research_Sucess() public async void UploadDocumentAsync_Lease_Sucess() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); - var documentService = _helper.GetService>(); - var leaseRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentAdd); + var documentService = this._helper.GetService>(); + var leaseRepository = this._helper.GetService>(); documentService.Setup(x => x.UploadDocumentAsync(It.IsAny())) .ReturnsAsync(new DocumentUploadResponse() @@ -352,7 +352,7 @@ public async void UploadDocumentAsync_Lease_Sucess() Document = new DocumentModel() { Id = 1, - } + }, }); // Act @@ -360,7 +360,7 @@ public async void UploadDocumentAsync_Lease_Sucess() { DocumentTypeMayanId = 3, DocumentTypeId = 4, - File = _helper.GetFormFile(string.Empty), + File = this._helper.GetFormFile(string.Empty), DocumentStatusCode = "DocumentStatus", }; @@ -375,8 +375,8 @@ public async void UploadDocumentAsync_Lease_Sucess() public void DeleteDocumentResearch_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var documentRepository = this._helper.GetService>(); PimsResearchFileDocument doc = new() { @@ -396,9 +396,9 @@ public void DeleteDocumentResearch_ShouldThrowException_NotAuthorized() public async void DeleteDocumentResearch_Success_Status_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -424,9 +424,9 @@ public async void DeleteDocumentResearch_Success_Status_Success() public async void DeleteDocumentResearch_Success_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -452,9 +452,9 @@ public async void DeleteDocumentResearch_Success_Status_NotFound() public async void DeleteDocumentResearch_Success_NoResults_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var researchDocumentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var researchDocumentRepository = this._helper.GetService>(); researchDocumentRepository.Setup(x => x.GetAllByDocument(It.IsAny())).Returns(new List()); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -480,8 +480,8 @@ public async void DeleteDocumentResearch_Success_NoResults_Status_NotFound() public void DeleteDocumentAcquisition_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(); + var documentRepository = this._helper.GetService>(); PimsAcquisitionFileDocument doc = new() { @@ -501,9 +501,9 @@ public void DeleteDocumentAcquisition_ShouldThrowException_NotAuthorized() public async void DeleteDocumentAcquisition_Success_Status_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -529,9 +529,9 @@ public async void DeleteDocumentAcquisition_Success_Status_Success() public async void DeleteDocumentAcquisition_Success_NoResults_Status_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var acquisitionDocumentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var acquisitionDocumentRepository = this._helper.GetService>(); acquisitionDocumentRepository.Setup(x => x.GetAllByDocument(It.IsAny())).Returns(new List()); ; documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -557,9 +557,9 @@ public async void DeleteDocumentAcquisition_Success_NoResults_Status_Success() public async void DeleteDocumentAcquisition_Success_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -585,7 +585,7 @@ public async void DeleteDocumentAcquisition_Success_Status_NotFound() public void Delete_ProjectDocument_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); + var service = this.CreateDocumentFileServiceWithPermissions(); PimsProjectDocument doc = new() { @@ -604,9 +604,9 @@ public void Delete_ProjectDocument_ShouldThrowException_NotAuthorized() public async void Delete_ProjectDocument_Success_Status_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -632,9 +632,9 @@ public async void Delete_ProjectDocument_Success_Status_Success() public async void Delete_ProjectDocument_Success_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -660,9 +660,9 @@ public async void Delete_ProjectDocument_Success_Status_NotFound() public async void Delete_ProjectDocument_Success_NoResults_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var projectRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var projectRepository = this._helper.GetService>(); projectRepository.Setup(x => x.GetAllByDocument(It.IsAny())).Returns(new List()); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -688,7 +688,7 @@ public async void Delete_ProjectDocument_Success_NoResults_Status_NotFound() public void Delete_LeaseDocument_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(); + var service = this.CreateDocumentFileServiceWithPermissions(); PimsLeaseDocument doc = new() { @@ -707,9 +707,9 @@ public void Delete_LeaseDocument_ShouldThrowException_NotAuthorized() public async void Delete_LeaseDocument_Success_Status_Success() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -735,9 +735,9 @@ public async void Delete_LeaseDocument_Success_Status_Success() public async void Delete_LeaseDocument_Success_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.DocumentRelationshipCount(It.IsAny())).Returns(1); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) @@ -763,9 +763,9 @@ public async void Delete_LeaseDocument_Success_Status_NotFound() public async void Delete_LeaseDocument_Success_NoResults_Status_NotFound() { // Arrange - var service = CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); - var documentService = _helper.GetService>(); - var leaseRepository = _helper.GetService>(); + var service = this.CreateDocumentFileServiceWithPermissions(Permissions.DocumentDelete); + var documentService = this._helper.GetService>(); + var leaseRepository = this._helper.GetService>(); leaseRepository.Setup(x => x.GetAllLeaseDocuments(It.IsAny())).Returns(new List()); documentService.Setup(x => x.DeleteDocumentAsync(It.IsAny())) diff --git a/source/backend/tests/unit/api/Services/DocumentServiceTest.cs b/source/backend/tests/unit/api/Services/DocumentServiceTest.cs index 6774a13a2d..d819163db4 100644 --- a/source/backend/tests/unit/api/Services/DocumentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DocumentServiceTest.cs @@ -33,21 +33,21 @@ public class DocumentServiceTest public DocumentServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private DocumentService CreateDocumentServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } [Fact] public void GetPimsDocumentTypes_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); + var service = this.CreateDocumentServiceWithPermissions(); // Act Action sut = () => service.GetPimsDocumentTypes(); @@ -60,8 +60,8 @@ public void GetPimsDocumentTypes_ShouldThrowException_NotAuthorized() public void GetPimsDocumentTypes_Should_ReturnAllTypes() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentTypeRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentTypeRepository = this._helper.GetService>(); documentTypeRepository.Setup(x => x.GetAll()).Returns(new List()); @@ -76,10 +76,10 @@ public void GetPimsDocumentTypes_Should_ReturnAllTypes() public void UploadDocumentAsync_UploadRequest_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); - var documentTypeRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(); + var documentTypeRepository = this._helper.GetService>(); - DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = _helper.GetFormFile(string.Empty) }; + DocumentUploadRequest uploadRequest = new() { DocumentTypeId = 1, File = this._helper.GetFormFile(string.Empty) }; // Assert Func sut = async () => await service.UploadDocumentAsync(uploadRequest); @@ -93,9 +93,9 @@ public void UploadDocumentAsync_UploadRequest_ShouldThrowException_NotAuthorized public async void UploadDocumentAsync_UploadRequest_Success_NoMetadata() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentAdd); - var documentStorageRepository = _helper.GetService>(); - var avService = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentAdd); + var documentStorageRepository = this._helper.GetService>(); + var avService = this._helper.GetService>(); avService.Setup(x => x.ScanAsync(It.IsAny())).Returns(Task.CompletedTask); @@ -104,7 +104,7 @@ public async void UploadDocumentAsync_UploadRequest_Success_NoMetadata() { Status = ExternalResultStatus.Success, HttpStatusCode = System.Net.HttpStatusCode.OK, - Payload = new DocumentDetail() + Payload = new DocumentDetail(), }); // Act @@ -112,7 +112,7 @@ public async void UploadDocumentAsync_UploadRequest_Success_NoMetadata() { DocumentTypeMayanId = 3, DocumentTypeId = 4, - File = _helper.GetFormFile(string.Empty), + File = this._helper.GetFormFile(string.Empty), DocumentStatusCode = "DocumentStatus", DocumentMetadata = null, }; @@ -128,9 +128,9 @@ public async void UploadDocumentAsync_UploadRequest_Success_NoMetadata() public async void UploadDocumentAsync_UploadRequest_Sucess() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentAdd); - var documentStorageRepository = _helper.GetService>(); - var avService = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentAdd); + var documentStorageRepository = this._helper.GetService>(); + var avService = this._helper.GetService>(); avService.Setup(x => x.ScanAsync(It.IsAny())).Returns(Task.CompletedTask); @@ -139,7 +139,7 @@ public async void UploadDocumentAsync_UploadRequest_Sucess() { Status = ExternalResultStatus.Success, HttpStatusCode = System.Net.HttpStatusCode.OK, - Payload = new DocumentDetail() + Payload = new DocumentDetail(), }); // Act @@ -147,14 +147,14 @@ public async void UploadDocumentAsync_UploadRequest_Sucess() { DocumentTypeMayanId = 3, DocumentTypeId = 4, - File = _helper.GetFormFile(string.Empty), + File = this._helper.GetFormFile(string.Empty), DocumentStatusCode = "DocumentStatus", DocumentMetadata = new List { new DocumentMetadataUpdateModel() { Id=1, Value = "data", - } - } + }, + }, }; await service.UploadDocumentAsync(uploadRequest); @@ -169,8 +169,8 @@ public async void UploadDocumentAsync_UploadRequest_Sucess() public void UpdateDocumentAsync_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(); + var documentRepository = this._helper.GetService>(); DocumentUpdateRequest updateRequest = new() { @@ -192,8 +192,8 @@ public void UpdateDocumentAsync_ShouldThrowException_NotAuthorized() public void UpdateDocumentAsync_ShouldThrowException_BadRequest() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); + var documentRepository = this._helper.GetService>(); documentRepository.Setup(x => x.TryGet(It.IsAny())) .Returns((PimsDocument)null); @@ -218,9 +218,9 @@ public void UpdateDocumentAsync_ShouldThrowException_BadRequest() public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Updates_Sucess() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); - var documentRepository = _helper.GetService>(); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); + var documentRepository = this._helper.GetService>(); + var documentStorageRepository = this._helper.GetService>(); documentRepository.Setup(x => x.TryGet(It.IsAny())) .Returns(new PimsDocument()); @@ -246,8 +246,8 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Updates_Suce }, Value = "test_value" } - } - } + }, + }, }); documentStorageRepository.Setup(x => x.TryUpdateDocumentMetadataAsync(It.IsAny(), It.IsAny(), It.IsAny())) @@ -255,7 +255,7 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Updates_Suce { HttpStatusCode = System.Net.HttpStatusCode.OK, Status = ExternalResultStatus.Success, - Payload = new DocumentMetadata() + Payload = new DocumentMetadata(), }); DocumentUpdateRequest updateRequest = new() @@ -281,9 +281,9 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Updates_Suce public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Create_Sucess() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); - var documentRepository = _helper.GetService>(); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); + var documentRepository = this._helper.GetService>(); + var documentStorageRepository = this._helper.GetService>(); documentRepository.Setup(x => x.TryGet(It.IsAny())) .Returns(new PimsDocument()); @@ -299,8 +299,8 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Create_Suces Payload = new QueryResult() { Count = 0, - Results = new List() { } - } + Results = new List() { }, + }, }); documentStorageRepository.Setup(x => x.TryCreateDocumentMetadataAsync(It.IsAny(), It.IsAny(), It.IsAny())) @@ -316,7 +316,7 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Create_Suces { Id = 1, }, - } + }, }); DocumentUpdateRequest updateRequest = new() @@ -342,9 +342,9 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Create_Suces public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Delete_Sucess() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); - var documentRepository = _helper.GetService>(); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentEdit); + var documentRepository = this._helper.GetService>(); + var documentStorageRepository = this._helper.GetService>(); documentRepository.Setup(x => x.TryGet(It.IsAny())) .Returns(new PimsDocument()); @@ -370,8 +370,8 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Delete_Suces }, Value = "test_value" } - } - } + }, + }, }); documentStorageRepository.Setup(x => x.TryDeleteDocumentMetadataAsync(It.IsAny(), It.IsAny())) @@ -393,7 +393,7 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Delete_Suces new DocumentMetadataUpdateModel() { Id = 1, MetadataTypeId = 100, - Value = null + Value = null, }, }, }; @@ -410,8 +410,8 @@ public async void UpdateDocumentAsync_ShouldThrowException_Metadata_Delete_Suces public void DeleteDocument_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); - var documentRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(); + var documentRepository = this._helper.GetService>(); PimsDocument doc = new() { @@ -431,8 +431,8 @@ public void DeleteDocument_ShouldThrowException_NotAuthorized() public async void DeleteDocument_Success_Status_Success() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentDelete); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentDelete); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryDeleteDocument(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -457,8 +457,8 @@ public async void DeleteDocument_Success_Status_Success() public async void DeleteDocument_Success_Status_NotFound() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentDelete); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentDelete); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryDeleteDocument(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -483,8 +483,8 @@ public async void DeleteDocument_Success_Status_NotFound() public void GetStorageDocumenTypes_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(); + var documentStorageRepository = this._helper.GetService>(); // Act Func act = async () => await service.GetStorageDocumentTypes(null, page: 1, pageSize: 10); @@ -498,8 +498,8 @@ public void GetStorageDocumenTypes_ShouldThrowException_NotAuthorized() public async void GetStorageDocumentTypes_Success() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentTypesAsync(null, It.IsAny(), It.IsAny())) .ReturnsAsync(new ExternalResult>() @@ -509,8 +509,8 @@ public async void GetStorageDocumentTypes_Success() Payload = new QueryResult() { Count = 1, - Results = new List() - } + Results = new List(), + }, }); // Act @@ -524,21 +524,20 @@ public async void GetStorageDocumentTypes_Success() public void GetStorageDocumentList_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); + var service = this.CreateDocumentServiceWithPermissions(); // Act Func act = async () => await service.GetStorageDocumentList(null, page: 1, pageSize: 10); // Assert act.Should().Throw(); - } [Fact] public async void GetStorageDocumentList_Success() { - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentsListAsync(null, It.IsAny(), It.IsAny())) .ReturnsAsync(new ExternalResult>() @@ -548,8 +547,8 @@ public async void GetStorageDocumentList_Success() Payload = new QueryResult() { Count = 1, - Results = new List() - } + Results = new List(), + }, }); // Act @@ -563,19 +562,19 @@ public async void GetStorageDocumentList_Success() public async void GetDocumentTypeMetadataType_Success() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .ReturnsAsync(new ExternalResult>() { HttpStatusCode = System.Net.HttpStatusCode.OK, Status = ExternalResultStatus.Success, - Payload = new QueryResult() + Payload = new QueryResult(), }); // Act - await service.GetDocumentTypeMetadataType(1, "", page: 1, pageSize: 10); + await service.GetDocumentTypeMetadataType(1, string.Empty, page: 1, pageSize: 10); // Assert documentStorageRepository.Verify(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); @@ -585,10 +584,10 @@ public async void GetDocumentTypeMetadataType_Success() public void GetStorageDocumentMetadata_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); + var service = this.CreateDocumentServiceWithPermissions(); // Act - Func act = async () => await service.GetStorageDocumentMetadata(1, "", 1, 10); + Func act = async () => await service.GetStorageDocumentMetadata(1, string.Empty, 1, 10); // Assert act.Should().Throw(); @@ -598,8 +597,8 @@ public void GetStorageDocumentMetadata_ShouldThrowException_NotAuthorized() public async void GetStorageDocumentMetadata_Success() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentMetadataAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) .ReturnsAsync(new ExternalResult>() @@ -609,8 +608,8 @@ public async void GetStorageDocumentMetadata_Success() Payload = new QueryResult() { Count = 1, - Results = new List() - } + Results = new List(), + }, }); // Act @@ -624,7 +623,7 @@ public async void GetStorageDocumentMetadata_Success() public void DownloadFileAsync_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); + var service = this.CreateDocumentServiceWithPermissions(); // Act Func act = async () => await service.DownloadFileAsync(1, 2); @@ -637,8 +636,8 @@ public void DownloadFileAsync_ShouldThrowException_NotAuthorized() public async void DownloadFileAsync_Success() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryDownloadFileAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -648,7 +647,7 @@ public async void DownloadFileAsync_Success() Payload = new FileDownload() { FileName = "Test", - } + }, }); // Act @@ -662,7 +661,7 @@ public async void DownloadFileAsync_Success() public void DownloadFileLatestAsync_ShouldThrowException_NotAuthorized() { // Arrange - var service = CreateDocumentServiceWithPermissions(); + var service = this.CreateDocumentServiceWithPermissions(); // Act Func sut = async () => await service.DownloadFileLatestAsync(1); @@ -675,8 +674,8 @@ public void DownloadFileLatestAsync_ShouldThrowException_NotAuthorized() public async void DownloadFileLatestAsync_UnSuccessfull() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentAsync(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -697,8 +696,8 @@ public async void DownloadFileLatestAsync_UnSuccessfull() public async void DownloadFileLatestAsync_Successfull_PayloadNull() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentAsync(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -720,8 +719,8 @@ public async void DownloadFileLatestAsync_Successfull_PayloadNull() public async void DownloadFileLatestAsync_InvalidExtension() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentAsync(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -737,7 +736,7 @@ public async void DownloadFileLatestAsync_InvalidExtension() Id = 2, Size = 1, FileName = "MyFile.exe", - } + }, }, }); @@ -754,8 +753,8 @@ public async void DownloadFileLatestAsync_InvalidExtension() public async void DownloadFileLatestAsync_ValidExtension() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentAsync(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -771,7 +770,7 @@ public async void DownloadFileLatestAsync_ValidExtension() Id = 2, Size = 1, FileName = "MyFile.pdf", - } + }, }, }); @@ -787,8 +786,8 @@ public async void DownloadFileLatestAsync_ValidExtension() public async void DownloadFileLatestAsync_Successfull_Payload_Document() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryGetDocumentAsync(It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -799,7 +798,7 @@ public async void DownloadFileLatestAsync_Successfull_Payload_Document() Payload = new DocumentDetail() { Id = 1, - FileLatest = new FileLatest() { Id = 2, FileName = "MyFile.pdf" } + FileLatest = new FileLatest() { Id = 2, FileName = "MyFile.pdf" }, }, }); @@ -814,7 +813,7 @@ public async void DownloadFileLatestAsync_Successfull_Payload_Document() FilePayload = "156165165156asdasdasd==", Size = 1, FileName = "MyFile.pdf", - EncodingType = "base64" + EncodingType = "base64", }, }); @@ -829,8 +828,8 @@ public async void DownloadFileLatestAsync_Successfull_Payload_Document() public async void DownloadFileAsync_InvalidExtension() { // Arrange - var service = CreateDocumentServiceWithPermissions(Permissions.DocumentView); - var documentStorageRepository = _helper.GetService>(); + var service = this.CreateDocumentServiceWithPermissions(Permissions.DocumentView); + var documentStorageRepository = this._helper.GetService>(); documentStorageRepository.Setup(x => x.TryDownloadFileAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(new ExternalResult() @@ -842,7 +841,7 @@ public async void DownloadFileAsync_InvalidExtension() FileName = "Test.exe", FileNameExtension = "exe", FileNameWithoutExtension = "Test", - } + }, }); // Act diff --git a/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs b/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs index 40d6f759e0..8c5b37f6e2 100644 --- a/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs +++ b/source/backend/tests/unit/api/Services/DocumentSyncServiceTest.cs @@ -30,13 +30,13 @@ public class DocumentSyncServiceTest public DocumentSyncServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private DocumentSyncService CreateDocumentySyncServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - return _helper.Create(user); + return this._helper.Create(user); } private SyncModel CreateSyncModel(IList metadataModels = null, IList documentTypeModels = null) @@ -66,13 +66,13 @@ private ExternalResult> CreateDocumentType public void Update_MigrateMetadata_SingleLabelChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "test metadata", Name = "TEST" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "test metadata", Name = "TEST" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST_METADATA" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST_METADATA" } }))); MetadataType updatedMetadataType = null; mayanRepository.Setup(x => x.TryUpdateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) .Callback(x => updatedMetadataType = x).Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.OK, Payload = new MetadataType() { Label = "testUpdated", Name = "TEST" } })); @@ -90,13 +90,13 @@ public void Update_MigrateMetadata_SingleLabelChange() public void Update_MigrateMetadata_MultipleLabelChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "test metadata", Name = "TEST" }, new MetadataModel() { Label = "test metadata two", Name = "TEST_METADATA_TWO" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "test metadata", Name = "TEST" }, new MetadataModel() { Label = "test metadata two", Name = "TEST_METADATA_TWO" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST_METADATA" }, new MetadataType() { Label = "testTwo", Name = "test_metadata_two" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST_METADATA" }, new MetadataType() { Label = "testTwo", Name = "test_metadata_two" } }))); MetadataType updatedMetadataTypeOne = null; MetadataType updatedMetadataTypeTwo = null; mayanRepository.Setup(x => x.TryUpdateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) @@ -120,12 +120,12 @@ public void Update_MigrateMetadata_MultipleLabelChange() public void Add_SyncMetadata_Single() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "test", Name = "TEST" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "test", Name = "TEST" } }); - var mayanRepository = _helper.GetService>(); - mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(CreateMetadataResult())); + var mayanRepository = this._helper.GetService>(); + mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(this.CreateMetadataResult())); MetadataType createdMetadataType = null; mayanRepository.Setup(x => x.TryCreateMetadataTypeAsync(It.IsAny())).Callback(x => createdMetadataType = x).Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new MetadataType() { Label = "test", Name = "TEST" } })); @@ -144,12 +144,12 @@ public void Add_SyncMetadata_Single() public void Add_SyncMetadata_Multiple() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "test", Name = "TEST" }, new MetadataModel() { Label = "test2", Name = "TEST2" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "test", Name = "TEST" }, new MetadataModel() { Label = "test2", Name = "TEST2" } }); - var mayanRepository = _helper.GetService>(); - mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(CreateMetadataResult())); + var mayanRepository = this._helper.GetService>(); + mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(this.CreateMetadataResult())); MetadataType createdMetadataTypeOne = null; MetadataType createdMetadataTypeTwo = null; mayanRepository.Setup(x => x.TryCreateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) @@ -175,14 +175,14 @@ public void Add_SyncMetadata_Multiple() public void RemoveLingeringMetadata_SyncMetadata_Single() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(); + SyncModel model = this.CreateSyncModel(); model.RemoveLingeringMetadataTypes = true; - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); mayanRepository.Setup(x => x.TryDeleteMetadataTypeAsync(It.IsAny())).Returns(Task.FromResult(new ExternalResult() { Payload = "deleted" })); // Act @@ -199,14 +199,14 @@ public void RemoveLingeringMetadata_SyncMetadata_Single() public void RemoveLingeringMetadata_SyncMetadata_Multiple() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(); + SyncModel model = this.CreateSyncModel(); model.RemoveLingeringMetadataTypes = true; - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST" }, new MetadataType() { Label = "test2", Name = "TEST2" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST" }, new MetadataType() { Label = "test2", Name = "TEST2" } }))); mayanRepository.Setup(x => x.TryDeleteMetadataTypeAsync(It.IsAny())).Returns(Task.FromResult(new ExternalResult() { Payload = "deleted" })); // Act @@ -224,14 +224,14 @@ public void RemoveLingeringMetadata_SyncMetadata_Multiple() public void RemoveLingeringMetadata_SyncMetadata_RemoveNoneIfFalse() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(); + SyncModel model = this.CreateSyncModel(); model.RemoveLingeringMetadataTypes = false; - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST" }, new MetadataType() { Label = "test2", Name = "TEST2" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST" }, new MetadataType() { Label = "test2", Name = "TEST2" } }))); mayanRepository.Setup(x => x.TryDeleteMetadataTypeAsync(It.IsAny())).Returns(Task.FromResult(new ExternalResult() { Payload = "deleted" })); // Act @@ -248,13 +248,13 @@ public void RemoveLingeringMetadata_SyncMetadata_RemoveNoneIfFalse() public void Update_SyncMetadata_SingleLabelChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "testUpdated", Name = "TEST" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "testUpdated", Name = "TEST" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); MetadataType updatedMetadataType = null; mayanRepository.Setup(x => x.TryUpdateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) .Callback(x => updatedMetadataType = x).Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.OK, Payload = new MetadataType() { Label = "testUpdated", Name = "TEST" } })); @@ -275,13 +275,13 @@ public void Update_SyncMetadata_SingleLabelChange() public void Update_SyncMetadata_MultipleLabelChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "testUpdated", Name = "TEST" }, new MetadataModel() { Label = "testTwoUpdated", Name = "TESTTWO" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "testUpdated", Name = "TEST" }, new MetadataModel() { Label = "testTwoUpdated", Name = "TESTTWO" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST" }, new MetadataType() { Label = "testTwo", Name = "TESTTWO" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[2] { new MetadataType() { Label = "test", Name = "TEST" }, new MetadataType() { Label = "testTwo", Name = "TESTTWO" } }))); MetadataType updatedMetadataTypeOne = null; MetadataType updatedMetadataTypeTwo = null; mayanRepository.Setup(x => x.TryUpdateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) @@ -307,13 +307,13 @@ public void Update_SyncMetadata_MultipleLabelChange() public void Update_SyncMetadata_SingleNameChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "testUpdated", Name = "TESTUPDATED" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "testUpdated", Name = "TESTUPDATED" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); MetadataType createdMetadataType = null; mayanRepository.Setup(x => x.TryCreateMetadataTypeAsync(It.Is(x => x.Name == "TESTUPDATED"))) .Callback(x => createdMetadataType = x).Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new MetadataType() { Label = "test", Name = "TEST" } })); @@ -333,13 +333,13 @@ public void Update_SyncMetadata_SingleNameChange() public void Update_SyncMetadata_NoLabelChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(new List() { new MetadataModel() { Label = "test", Name = "TEST" } }); + SyncModel model = this.CreateSyncModel(new List() { new MetadataModel() { Label = "test", Name = "TEST" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { new MetadataType() { Label = "test", Name = "TEST" } }))); mayanRepository.Setup(x => x.TryUpdateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) .Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.OK, Payload = new MetadataType() { Label = "testUpdated", Name = "TEST" } })); mayanRepository.Setup(x => x.TryCreateMetadataTypeAsync(It.Is(x => x.Name == "TEST"))) @@ -363,11 +363,11 @@ public void Update_SyncMetadata_NoLabelChange() public void Add_SyncPimsDocumentTypes_Single() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() } }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List()); pimsDocumentRepository.Setup(x => x.Add(It.IsAny())).Returns(new PimsDocumentTyp()); @@ -385,14 +385,14 @@ public void Add_SyncPimsDocumentTypes_Single() public void Add_SyncPimsDocumentTypes_Multiple() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() }, - new DocumentTypeModel() { Name = "TESTTWO", Label = "testTwo" , Categories = new List() } + new DocumentTypeModel() { Name = "TESTTWO", Label = "testTwo" , Categories = new List() }, }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List()); pimsDocumentRepository.Setup(x => x.Add(It.IsAny())).Returns(new PimsDocumentTyp()); @@ -410,19 +410,19 @@ public void Add_SyncPimsDocumentTypes_Multiple() public void RemoveLingering_SyncPimsDocumentTypes_Single() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(); + SyncModel model = this.CreateSyncModel(); model.RemoveLingeringDocumentTypes = true; - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST" } }); // Act var result = service.SyncPimsDocumentTypes(model); // Assert - //TODO: mock and assert that the document types are being disabled. + // TODO: mock and assert that the document types are being disabled. result.Deleted.Should().HaveCount(1); result.Added.Should().BeEmpty(); result.Updated.Should().BeEmpty(); @@ -432,12 +432,12 @@ public void RemoveLingering_SyncPimsDocumentTypes_Single() public void RemoveLingering_SyncPimsDocumentTypes_Multiple() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(); + SyncModel model = this.CreateSyncModel(); model.RemoveLingeringDocumentTypes = true; - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST" }, new PimsDocumentTyp() { DocumentType = "TESTTWO" } }); // Act @@ -453,19 +453,19 @@ public void RemoveLingering_SyncPimsDocumentTypes_Multiple() public void RemoveLingering_SyncPimsDocumentTypes_DisableNoneIfFalse() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(); + SyncModel model = this.CreateSyncModel(); model.RemoveLingeringDocumentTypes = false; - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST" }, new PimsDocumentTyp() { DocumentType = "TESTTWO" } }); // Act var result = service.SyncPimsDocumentTypes(model); // Assert - //TODO: mock and assert that the document types are being disabled. + // TODO: mock and assert that the document types are being disabled. result.Deleted.Should().BeEmpty(); result.Added.Should().BeEmpty(); result.Updated.Should().BeEmpty(); @@ -475,11 +475,11 @@ public void RemoveLingering_SyncPimsDocumentTypes_DisableNoneIfFalse() public void Update_SyncPimsDocumentTypes_Single() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", Categories = new List() } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", Categories = new List() } }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST" } }); PimsDocumentTyp updatedDocumentTypeOne = null; pimsDocumentRepository.Setup(x => x.Update(It.IsAny())).Callback(x => updatedDocumentTypeOne = x).Returns(new PimsDocumentTyp()); @@ -499,14 +499,14 @@ public void Update_SyncPimsDocumentTypes_Single() public void Update_SyncPimsDocumentTypes_Multiple() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", Categories = new List() }, - new DocumentTypeModel() { Name = "TESTTWO", Label = "test two updated", Categories = new List() } + new DocumentTypeModel() { Name = "TESTTWO", Label = "test two updated", Categories = new List() }, }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); PimsDocumentTyp updatedDocumentTypeOne = null; PimsDocumentTyp updatedDocumentTypeTwo = null; pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST" }, new PimsDocumentTyp() { DocumentType = "TESTTWO" } }); @@ -529,11 +529,11 @@ public void Update_SyncPimsDocumentTypes_Multiple() public void Update_SyncPimsDocumentTypes_NoLabelChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() { "TEST_CATEGORY" }, DisplayOrder = 1 } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() { "TEST_CATEGORY" }, DisplayOrder = 1 } }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", @@ -541,10 +541,10 @@ public void Update_SyncPimsDocumentTypes_NoLabelChange() PimsDocumentCategorySubtypes = new List() { new PimsDocumentCategorySubtype() { DocumentCategoryTypeCode = "TEST_CATEGORY" - } + }, }, DisplayOrder = 1, - } + }, }); pimsDocumentRepository.Setup(x => x.Add(It.IsAny())).Returns(new PimsDocumentTyp()); pimsDocumentRepository.Setup(x => x.Update(It.IsAny())).Returns(new PimsDocumentTyp()); @@ -564,11 +564,11 @@ public void Update_SyncPimsDocumentTypes_NoLabelChange() public void Update_SyncPimsDocumentTypes_CategoryChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() { "TEST_CATEGORY_A" }, DisplayOrder = 1 } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", Categories = new List() { "TEST_CATEGORY_A" }, DisplayOrder = 1 } }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", @@ -576,10 +576,10 @@ public void Update_SyncPimsDocumentTypes_CategoryChange() PimsDocumentCategorySubtypes = new List() { new PimsDocumentCategorySubtype() { DocumentCategoryTypeCode = "TEST_CATEGORY_B" - } + }, }, DisplayOrder = 1, - } + }, }); pimsDocumentRepository.Setup(x => x.Add(It.IsAny())).Returns(new PimsDocumentTyp()); pimsDocumentRepository.Setup(x => x.Update(It.IsAny())).Returns(new PimsDocumentTyp()); @@ -599,13 +599,13 @@ public void Update_SyncPimsDocumentTypes_CategoryChange() public void Update_SyncPimsDocumentTypes_SingleNameChange() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { - new DocumentTypeModel() { Name = "TESTUPDATE", Label = "test", Categories = new List() } + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { + new DocumentTypeModel() { Name = "TESTUPDATE", Label = "test", Categories = new List() }, }); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test" } }); pimsDocumentRepository.Setup(x => x.Add(It.IsAny())).Returns(new PimsDocumentTyp()); pimsDocumentRepository.Setup(x => x.Update(It.IsAny())).Returns(new PimsDocumentTyp()); @@ -627,23 +627,23 @@ public void Update_SyncPimsDocumentTypes_SingleNameChange() public void Add_SyncPimsToMayan_SingleType() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test" } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test" } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeResult())); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.Setup(x => x.TryCreateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new DocumentType() { Id = 1 } })); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult())); + .Returns(Task.FromResult(this.CreateMetadataResult())); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test" } }); // Act @@ -663,30 +663,30 @@ public void Add_SyncPimsToMayan_SingleType() public void Add_SyncPimsToMayan_SingleTypeWithMetadata() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); DocumentType documentType = new DocumentType() { Label = "test" }; MetadataType metadataType = new MetadataType() { Name = "TESTMETADATA", Label = "test metadata" }; - SyncModel model = CreateSyncModel(documentTypeModels: new List() { + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", MetadataTypes = new List() { - new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } } } }); + new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } }, }, }); - var mayanRepository = _helper.GetService>(); - //on the first call mayan would not have the new document type. On the second call it should have been added. + var mayanRepository = this._helper.GetService>(); + // on the first call mayan would not have the new document type. On the second call it should have been added. mayanRepository.SetupSequence(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult())) - .Returns(Task.FromResult(CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult())) + .Returns(Task.FromResult(this.CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.Setup(x => x.TryCreateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new DocumentType() { Id = 1 } })); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { metadataType }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { metadataType }))); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test", MayanId = 1 } }); // Act @@ -706,28 +706,28 @@ public void Add_SyncPimsToMayan_SingleTypeWithMetadata() public void Add_SyncPimsToMayan_SingleTypeWithMetadata_MetadataDoesNotExist() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", MetadataTypes = new List() { - new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } } } }); + new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } }, }, }); - var mayanRepository = _helper.GetService>(); - //on the first call mayan would not have the new document type. On the second call it should have been added. + var mayanRepository = this._helper.GetService>(); + // on the first call mayan would not have the new document type. On the second call it should have been added. mayanRepository.SetupSequence(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult())) - .Returns(Task.FromResult(CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult())) + .Returns(Task.FromResult(this.CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.Setup(x => x.TryCreateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new DocumentType() { Id = 1 } })); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult())); + .Returns(Task.FromResult(this.CreateMetadataResult())); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test", MayanId = 1 } }); // Act @@ -747,38 +747,38 @@ public void Add_SyncPimsToMayan_SingleTypeWithMetadata_MetadataDoesNotExist() public void Add_SyncPimsToMayan_MultipleTypesWithMetadata() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); DocumentType documentTypeOne = new DocumentType() { Label = "test", Id = 1 }; MetadataType metadataTypeOne = new MetadataType() { Name = "TESTMETADATA", Label = "test metadata" }; DocumentType documentTypeTwo = new DocumentType() { Label = "test two", Id = 2 }; MetadataType metadataTypeTwo = new MetadataType() { Name = "TESTTWOMETADATA", Label = "test two metadata" }; - SyncModel model = CreateSyncModel(documentTypeModels: new List() { + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", MetadataTypes = new List() { - new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } } }, + new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" }, }, }, new DocumentTypeModel() { Name = "TESTTWO", Label = "test two", MetadataTypes = new List() { - new DocumentMetadataTypeModel() { Name = "TESTTWOMETADATA", Label = "test two metadata" } } } }); + new DocumentMetadataTypeModel() { Name = "TESTTWOMETADATA", Label = "test two metadata" } }, }, }); - var mayanRepository = _helper.GetService>(); - //on the first call mayan would not have the new document type. On the second call it should have been added. + var mayanRepository = this._helper.GetService>(); + // on the first call mayan would not have the new document type. On the second call it should have been added. mayanRepository.SetupSequence(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult())) - .Returns(Task.FromResult(CreateDocumentTypeResult(documentTypes: new DocumentType[2] { documentTypeOne, documentTypeTwo }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult())) + .Returns(Task.FromResult(this.CreateDocumentTypeResult(documentTypes: new DocumentType[2] { documentTypeOne, documentTypeTwo }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.SetupSequence(x => x.TryCreateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new DocumentType() { Id = 1 } })) .Returns(Task.FromResult(new ExternalResult() { HttpStatusCode = System.Net.HttpStatusCode.Created, Payload = new DocumentType() { Id = 2 } })); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[2] { metadataTypeOne, metadataTypeTwo }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[2] { metadataTypeOne, metadataTypeTwo }))); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test", MayanId = 1 }, - new PimsDocumentTyp() { DocumentType = "TESTTWO", DocumentTypeDescription = "test two", MayanId = 2 } }); + new PimsDocumentTyp() { DocumentType = "TESTTWO", DocumentTypeDescription = "test two", MayanId = 2 }, }); // Act var result = service.SyncPimsToMayan(model); @@ -799,30 +799,30 @@ public void Add_SyncPimsToMayan_MultipleTypesWithMetadata() public void Add_SyncPimsToMayan_SingleTypeWithMetadata_UpdateRequired() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); DocumentType documentType = new DocumentType() { Label = "test" }; MetadataType metadataType = new MetadataType() { Name = "TESTMETADATA", Label = "test metadata" }; - SyncModel model = CreateSyncModel(documentTypeModels: new List() { + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test", MetadataTypes = new List() { - new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata", Required = true } } } }); + new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata", Required = true } }, }, }); - var mayanRepository = _helper.GetService>(); - //on the first call mayan would not have the new document type. On the second call it should have been added. + var mayanRepository = this._helper.GetService>(); + // on the first call mayan would not have the new document type. On the second call it should have been added. mayanRepository.SetupSequence(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult())) - .Returns(Task.FromResult(CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult())) + .Returns(Task.FromResult(this.CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult(new DocumentTypeMetadataType() { DocumentType = documentType, MetadataType = metadataType, Required = false }))); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult(new DocumentTypeMetadataType() { DocumentType = documentType, MetadataType = metadataType, Required = false }))); mayanRepository.Setup(x => x.TryCreateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult())); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { metadataType }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { metadataType }))); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test", MayanId = 1 } }); // Act @@ -841,29 +841,29 @@ public void Add_SyncPimsToMayan_SingleTypeWithMetadata_UpdateRequired() public void Add_SyncPimsToMayan_DeleteLinkedMetadata() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); DocumentType documentType = new DocumentType() { Label = "test" }; MetadataType metadataType = new MetadataType() { Name = "TESTMETADATA", Label = "test metadata" }; - SyncModel model = CreateSyncModel(documentTypeModels: new List() { - new DocumentTypeModel() { Name = "TEST", Label = "test", MetadataTypes = new List() } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { + new DocumentTypeModel() { Name = "TEST", Label = "test", MetadataTypes = new List() }, }); - var mayanRepository = _helper.GetService>(); - //on the first call mayan would not have the new document type. On the second call it should have been added. + var mayanRepository = this._helper.GetService>(); + // on the first call mayan would not have the new document type. On the second call it should have been added. mayanRepository.SetupSequence(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult())) - .Returns(Task.FromResult(CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult())) + .Returns(Task.FromResult(this.CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult(new DocumentTypeMetadataType() { DocumentType = documentType, MetadataType = metadataType, Required = false }))); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult(new DocumentTypeMetadataType() { DocumentType = documentType, MetadataType = metadataType, Required = false }))); mayanRepository.Setup(x => x.TryCreateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult())); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { metadataType }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { metadataType }))); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test", MayanId = 1 } }); // Act @@ -882,23 +882,23 @@ public void Add_SyncPimsToMayan_DeleteLinkedMetadata() public void Update_SyncPimsToMayan_SingleType() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", MetadataTypes = new List() } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", MetadataTypes = new List() } }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult(new DocumentType[1] { new DocumentType() { Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult(new DocumentType[1] { new DocumentType() { Id = 1 } }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.Setup(x => x.TryUpdateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult())); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult())); + .Returns(Task.FromResult(this.CreateMetadataResult())); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test updated", MayanId = 1 } }); // Act @@ -917,26 +917,26 @@ public void Update_SyncPimsToMayan_SingleType() public void Update_SyncPimsToMayan_SingleTypeWithMetadata() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); MetadataType metadataType = new MetadataType() { Name = "TESTMETADATA", Label = "test metadata" }; - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", - MetadataTypes = new List() { new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } } } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", + MetadataTypes = new List() { new DocumentMetadataTypeModel() { Name = "TESTMETADATA", Label = "test metadata" } }, }, }); - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.SetupSequence(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult(new DocumentType[1] { new DocumentType() { Id = 1 } }))) - .Returns(Task.FromResult(CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult(new DocumentType[1] { new DocumentType() { Id = 1 } }))) + .Returns(Task.FromResult(this.CreateDocumentTypeResult(documentTypes: new DocumentType[1] { new DocumentType() { Label = "test", Id = 1 } }))); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.Setup(x => x.TryUpdateDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult())); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult(new MetadataType[1] { metadataType }))); + .Returns(Task.FromResult(this.CreateMetadataResult(new MetadataType[1] { metadataType }))); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { new PimsDocumentTyp() { DocumentType = "TEST", DocumentTypeDescription = "test updated", MayanId = 1 } }); // Act @@ -955,24 +955,24 @@ public void Update_SyncPimsToMayan_SingleTypeWithMetadata() public void RemoveLingering_SyncPimsToMayan_Success() { // Arrange - var service = CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateDocumentySyncServiceWithPermissions(Permissions.DocumentAdmin); - SyncModel model = CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", MetadataTypes = new List() } }); + SyncModel model = this.CreateSyncModel(documentTypeModels: new List() { new DocumentTypeModel() { Name = "TEST", Label = "test updated", MetadataTypes = new List() } }); model.RemoveLingeringDocumentTypes = true; - var mayanRepository = _helper.GetService>(); + var mayanRepository = this._helper.GetService>(); mayanRepository.Setup(x => x.TryGetDocumentTypeMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeMetadataTypeResult())); + .Returns(Task.FromResult(this.CreateDocumentTypeMetadataTypeResult())); mayanRepository.Setup(x => x.TryGetDocumentTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateDocumentTypeResult(new DocumentType[1] { new DocumentType() { Id = 1 } }))); + .Returns(Task.FromResult(this.CreateDocumentTypeResult(new DocumentType[1] { new DocumentType() { Id = 1 } }))); mayanRepository.Setup(x => x.TryDeleteDocumentTypeAsync(It.IsAny())) .Returns(Task.FromResult(new ExternalResult() { Payload = "deleted document type" })); - var mayanMetadataRepository = _helper.GetService>(); + var mayanMetadataRepository = this._helper.GetService>(); mayanMetadataRepository.Setup(x => x.TryGetMetadataTypesAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(Task.FromResult(CreateMetadataResult())); + .Returns(Task.FromResult(this.CreateMetadataResult())); - var pimsDocumentRepository = _helper.GetService>(); + var pimsDocumentRepository = this._helper.GetService>(); pimsDocumentRepository.Setup(x => x.GetAll()).Returns(new List() { }); // Act diff --git a/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs b/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs index ba22307744..68c63b2ee0 100644 --- a/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/ExpropriationPaymentServiceTest.cs @@ -1,14 +1,14 @@ -using FluentAssertions; -using Pims.Api.Services; -using Pims.Core.Test; -using Pims.Dal.Exceptions; -using Pims.Dal.Security; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using System.Threading.Tasks; +using FluentAssertions; +using Pims.Api.Services; +using Pims.Core.Test; +using Pims.Dal.Exceptions; +using Pims.Dal.Security; using Xunit; namespace Pims.Api.Test.Services @@ -23,13 +23,13 @@ public class ExpropriationPaymentServiceTest public ExpropriationPaymentServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } [Fact] public void GetById_NoPermission() { - var service = CreateServiceWithPermissions(); + var service = this.CreateServiceWithPermissions(); // Act Action act = () => service.GetById(1); @@ -41,8 +41,8 @@ public void GetById_NoPermission() private ExpropriationPaymentService CreateServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(user); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(user); } } } diff --git a/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs b/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs index 9c859b2ed4..b0c3d425e9 100644 --- a/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs +++ b/source/backend/tests/unit/api/Services/FinancialCodeServiceTest.cs @@ -30,27 +30,27 @@ public class FinancialCodeServiceTest public FinancialCodeServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private FinancialCodeService CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - return _helper.Create(user); + return this._helper.Create(user); } [Fact] public void GetAll_Success() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repo1 = _helper.GetService>(); - var repo2 = _helper.GetService>(); - var repo3 = _helper.GetService>(); - var repo4 = _helper.GetService>(); - var repo5 = _helper.GetService>(); - var repo6 = _helper.GetService>(); - var repo7 = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repo1 = this._helper.GetService>(); + var repo2 = this._helper.GetService>(); + var repo3 = this._helper.GetService>(); + var repo4 = this._helper.GetService>(); + var repo5 = this._helper.GetService>(); + var repo6 = this._helper.GetService>(); + var repo7 = this._helper.GetService>(); repo1.Setup(x => x.GetAllBusinessFunctionCodes()).Returns(new List()); repo2.Setup(x => x.GetAllChartOfAccountCodes()).Returns(new List()); @@ -78,7 +78,7 @@ public void GetAll_Success() public void GetAll_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.GetAllFinancialCodes(); @@ -91,8 +91,8 @@ public void GetAll_NoPermission() public void GetFinancialCodesByType_Success() { // Arrange - var service = CreateWithPermissions(Permissions.ProjectView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.ProjectView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetAllBusinessFunctionCodes()).Returns(new List()); @@ -108,7 +108,7 @@ public void GetFinancialCodesByType_Success() public void GetFinancialCodesByType_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.GetFinancialCodesByType(FinancialCodeTypes.BusinessFunction); @@ -121,8 +121,8 @@ public void GetFinancialCodesByType_NoPermission() public void GetById_Success() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetById(It.IsAny())); // Act @@ -136,7 +136,7 @@ public void GetById_Success() public void GetById_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.GetById(FinancialCodeTypes.BusinessFunction, 1); @@ -149,8 +149,8 @@ public void GetById_NoPermission() public void Add_Success() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())); // Act @@ -164,7 +164,7 @@ public void Add_Success() public void Add_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.Add(FinancialCodeTypes.BusinessFunction, new FinancialCodeModel()); @@ -177,8 +177,8 @@ public void Add_NoPermission() public void Add_ThrowIfNull() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())); // Act @@ -192,8 +192,8 @@ public void Add_ThrowIfNull() public void Add_ThrowIfDuplicateCodeFound() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Throws(); // Act @@ -213,12 +213,12 @@ public void Add_ThrowIfDuplicateCodeFound() public void Update_Success() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); var codeEntity = EntityHelper.CreateFinancialCode(FinancialCodeTypes.BusinessFunction, 1, "FOO", "Other description"); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(codeEntity as PimsBusinessFunctionCode); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); - var _mapper = _helper.GetService(); + var _mapper = this._helper.GetService(); // Act var model = _mapper.Map(codeEntity); @@ -232,7 +232,7 @@ public void Update_Success() public void Update_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.Update(FinancialCodeTypes.BusinessFunction, new FinancialCodeModel()); @@ -245,8 +245,8 @@ public void Update_NoPermission() public void Update_ThrowIf_Null() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())); // Act @@ -260,8 +260,8 @@ public void Update_ThrowIf_Null() public void Update_ThrowIf_DuplicateCodeFound() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Throws(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); @@ -284,8 +284,8 @@ public void Update_ThrowIf_DuplicateCodeFound() public void Update_ThrowIf_OlderVersion() { // Arrange - var service = CreateWithPermissions(Permissions.SystemAdmin); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.SystemAdmin); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(2); diff --git a/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs b/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs index 827362d559..b66c36887d 100644 --- a/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs +++ b/source/backend/tests/unit/api/Services/FormDocumentServiceTest.cs @@ -25,27 +25,27 @@ public class FormDocumentServiceTest public FormDocumentServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private FormDocumentService CreateFormDocumentServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - var service = _helper.Create(user); + var service = this._helper.Create(user); return service; } #region Tests #region Get - //GetAllFormDocumentTypes + // GetAllFormDocumentTypes [Fact] public void GetAllFormDocumentTypes_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.FormView); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.FormView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllFormTypes()); // Act @@ -59,9 +59,9 @@ public void GetAllFormDocumentTypes_Success() public void GetAllFormDocumentTypes_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.GetAllFormDocumentTypes(); @@ -71,15 +71,15 @@ public void GetAllFormDocumentTypes_NoPermission() repository.Verify(x => x.GetAllFormTypes(), Times.Never); } - //GetFormDocumentTypes + // GetFormDocumentTypes [Fact] public void GetFormDocumentTypes_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.FormView); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.FormView); string testTypeCode = "TEST_CODE"; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetByFormTypeCode(testTypeCode)); // Act @@ -93,10 +93,10 @@ public void GetFormDocumentTypes_Success() public void GetFormDocumentTypes_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); string testTypeCode = "TEST_CODE"; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.GetFormDocumentTypes(testTypeCode); @@ -109,19 +109,19 @@ public void GetFormDocumentTypes_NoPermission() #region UploadTemplateDocument - //UploadFormDocumentTemplateAsync + // UploadFormDocumentTemplateAsync [Fact] public void UploadFormDocumentTemplateAsync_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); string testTypeCode = "TEST_CODE"; DocumentUploadRequest testUploadRequest = new DocumentUploadRequest(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetByFormTypeCode(testTypeCode)).Returns(new PimsFormType()); - var documentService = _helper.GetService>(); + var documentService = this._helper.GetService>(); documentService.Setup(x => x.UploadDocumentAsync(testUploadRequest)); // Act @@ -135,11 +135,11 @@ public void UploadFormDocumentTemplateAsync_Success() public void UploadFormDocumentTemplateAsync_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); string testTypeCode = "TEST_CODE"; DocumentUploadRequest testUploadRequest = new DocumentUploadRequest(); - var documentService = _helper.GetService>(); + var documentService = this._helper.GetService>(); documentService.Setup(x => x.UploadDocumentAsync(testUploadRequest)); // Act @@ -154,19 +154,19 @@ public void UploadFormDocumentTemplateAsync_NoPermission() public void UploadFormDocumentTemplateAsync_DeleteIfPrevious() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); string testTypeCode = "TEST_CODE"; long testDocumentId = 1; PimsDocument testExistingDocument = new(); DocumentUploadRequest testUploadRequest = new DocumentUploadRequest(); - var formTypeRepositoryMock = _helper.GetService>(); + var formTypeRepositoryMock = this._helper.GetService>(); formTypeRepositoryMock.Setup(x => x.GetByFormTypeCode(testTypeCode)).Returns(new PimsFormType() { DocumentId = testDocumentId, Document = testExistingDocument }); - var documentServiceMock = _helper.GetService>(); + var documentServiceMock = this._helper.GetService>(); documentServiceMock.Setup(x => x.UploadDocumentAsync(testUploadRequest)); - var documentRepositoryMock = _helper.GetService>(); + var documentRepositoryMock = this._helper.GetService>(); documentRepositoryMock.Setup(x => x.DocumentRelationshipCount(testDocumentId)).Returns(1); documentServiceMock.Setup(x => x.DeleteDocumentAsync(testExistingDocument)).ReturnsAsync(new ExternalResult() { Status = ExternalResultStatus.Success }); @@ -183,19 +183,19 @@ public void UploadFormDocumentTemplateAsync_DeleteIfPrevious() public void UploadFormDocumentTemplateAsync_DeleteIfPrevious_Error() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); string testTypeCode = "TEST_CODE"; long testDocumentId = 1; PimsDocument testExistingDocument = new(); DocumentUploadRequest testUploadRequest = new DocumentUploadRequest(); - var formTypeRepositoryMock = _helper.GetService>(); + var formTypeRepositoryMock = this._helper.GetService>(); formTypeRepositoryMock.Setup(x => x.GetByFormTypeCode(testTypeCode)).Returns(new PimsFormType() { DocumentId = testDocumentId, Document = testExistingDocument }); - var documentServiceMock = _helper.GetService>(); + var documentServiceMock = this._helper.GetService>(); documentServiceMock.Setup(x => x.UploadDocumentAsync(testUploadRequest)); - var documentRepositoryMock = _helper.GetService>(); + var documentRepositoryMock = this._helper.GetService>(); documentRepositoryMock.Setup(x => x.DocumentRelationshipCount(testDocumentId)).Returns(1); documentServiceMock.Setup(x => x.DeleteDocumentAsync(testExistingDocument)).ReturnsAsync(new ExternalResult() { Status = ExternalResultStatus.Error }); @@ -216,17 +216,17 @@ public void UploadFormDocumentTemplateAsync_DeleteIfPrevious_Error() public void DeleteFormDocumentTemplateAsync_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); string testTypeCode = "TEST_CODE"; long testDocumentId = 1; PimsDocument testDocument = new PimsDocument(); PimsFormType testFormType = new PimsFormType() { DocumentId = testDocumentId, Document = testDocument, FormTypeCode = testTypeCode }; DocumentUploadRequest testUploadRequest = new DocumentUploadRequest(); - var documentServiceMock = _helper.GetService>(); + var documentServiceMock = this._helper.GetService>(); documentServiceMock.Setup(x => x.UploadDocumentAsync(testUploadRequest)); - var documentRepositoryMock = _helper.GetService>(); + var documentRepositoryMock = this._helper.GetService>(); documentRepositoryMock.Setup(x => x.DocumentRelationshipCount(testDocumentId)).Returns(1); // Act @@ -240,17 +240,17 @@ public void DeleteFormDocumentTemplateAsync_Success() public void DeleteFormDocumentTemplateAsync_NoDocumentRemoval_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.DocumentAdmin); string testTypeCode = "TEST_CODE"; long testDocumentId = 1; PimsDocument testDocument = new PimsDocument(); PimsFormType testFormType = new PimsFormType() { DocumentId = testDocumentId, FormTypeCode = testTypeCode, Document = testDocument }; - var formTypeRepositoryMock = _helper.GetService>(); + var formTypeRepositoryMock = this._helper.GetService>(); formTypeRepositoryMock.Setup(x => x.SetFormTypeDocument(testFormType)).Returns(testFormType); formTypeRepositoryMock.Setup(x => x.CommitTransaction()); - var documentRepositoryMock = _helper.GetService>(); + var documentRepositoryMock = this._helper.GetService>(); documentRepositoryMock.Setup(x => x.DocumentRelationshipCount(testDocumentId)).Returns(5); // Act @@ -265,11 +265,11 @@ public void DeleteFormDocumentTemplateAsync_NoDocumentRemoval_Success() public void DeleteFormDocumentTemplateAsync_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); long testDocumentId = 1; PimsFormType testFormType = new PimsFormType() { DocumentId = testDocumentId }; - var documentRepositoryMock = _helper.GetService>(); + var documentRepositoryMock = this._helper.GetService>(); // Act Func act = () => service.DeleteFormDocumentTemplateAsync(testFormType); @@ -286,9 +286,9 @@ public void DeleteFormDocumentTemplateAsync_NoPermission() public void AddFormFile_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.FormAdd); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.FormAdd); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())); // Act @@ -302,9 +302,9 @@ public void AddFormFile_Success() public void AddFormFile_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.AddAcquisitionForm(new PimsFormType() { Id = "H120" }, 1); @@ -321,9 +321,9 @@ public void AddFormFile_NoPermission() public void GetFormFile_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.FormView); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.FormView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetByAcquisitionFileFormId(It.IsAny())); // Act @@ -337,9 +337,9 @@ public void GetFormFile_Success() public void GetFormFile_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.GetAcquisitionForm(1); @@ -355,9 +355,9 @@ public void GetFormFile_NoPermission() public void GetFormFiles_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.FormView); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.FormView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())); // Act @@ -371,9 +371,9 @@ public void GetFormFiles_Success() public void GetFormFiles_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.GetAcquisitionForms(1); @@ -389,9 +389,9 @@ public void GetFormFiles_NoPermission() public void DeleteFormFile_Success() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(Permissions.FormDelete); + var service = this.CreateFormDocumentServiceWithPermissions(Permissions.FormDelete); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.TryDelete(It.IsAny())); // Act @@ -405,9 +405,9 @@ public void DeleteFormFile_Success() public void DeleteFormFile_NoPermission() { // Arrange - var service = CreateFormDocumentServiceWithPermissions(); + var service = this.CreateFormDocumentServiceWithPermissions(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.DeleteAcquisitionFileForm(1); diff --git a/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs b/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs index 1bb1c19f18..899354ade1 100644 --- a/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs +++ b/source/backend/tests/unit/api/Services/H120CategoryServiceTest.cs @@ -1,3 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; using FluentAssertions; using Moq; using Pims.Api.Services; @@ -5,12 +11,6 @@ using Pims.Dal.Exceptions; using Pims.Dal.Repositories; using Pims.Dal.Security; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Xunit; namespace Pims.Api.Test.Services @@ -26,15 +26,15 @@ public class H120CategoryServiceTest public H120CategoryServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } [Fact] public void GetAll() { // Arrange - var service = CreateWithPermissions(Permissions.CompensationRequisitionView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.CompensationRequisitionView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetAll()); // Act @@ -44,11 +44,10 @@ public void GetAll() repo.Verify(x => x.GetAll(), Times.Once); } - private H120CategoryService CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - return _helper.Create(user); + return this._helper.Create(user); } } } diff --git a/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs b/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs index a7a51f3e46..3250ecd278 100644 --- a/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs +++ b/source/backend/tests/unit/api/Services/LeaseReportsServiceTest.cs @@ -82,7 +82,6 @@ public void GetAggregatedLeases_Success() this.MockCommonServices(); this.leaseRepository.Setup(x => x.GetAllByFilter(It.IsAny(), It.IsAny>(), true)).Returns(new List() { lease }); this.userRepository.Setup(x => x.GetByKeycloakUserId(It.IsAny())).Returns(new PimsUser() { PimsRegionUsers = new List() }); - // Act var leases = this.leaseReportsService.GetAggregatedLeaseReport(2022); diff --git a/source/backend/tests/unit/api/Services/LeaseServiceTest.cs b/source/backend/tests/unit/api/Services/LeaseServiceTest.cs index a88095711b..cd7512919f 100644 --- a/source/backend/tests/unit/api/Services/LeaseServiceTest.cs +++ b/source/backend/tests/unit/api/Services/LeaseServiceTest.cs @@ -28,14 +28,14 @@ public class LeaseServiceTest public LeaseServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private LeaseService CreateLeaseService(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } #region Tests @@ -44,27 +44,27 @@ private LeaseService CreateLeaseService(params Permissions[] permissions) public void Update_WithoutStatusNote() { // Arrange - var service = CreateLeaseService(Permissions.LeaseEdit); + var service = this.CreateLeaseService(Permissions.LeaseEdit); var currentLeaseEntity = new PimsLease() { LeaseId = 1, - LeaseStatusTypeCode = "STATUS_A" + LeaseStatusTypeCode = "STATUS_A", }; var leaseEntity = new PimsLease() { LeaseId = 1, - LeaseStatusTypeCode = "STATUS_A" + LeaseStatusTypeCode = "STATUS_A", }; - var leaseRepository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var leaseRepository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); leaseRepository.Setup(x => x.GetNoTracking(It.IsAny())).Returns(currentLeaseEntity); leaseRepository.Setup(x => x.Get(It.IsAny())).Returns(EntityHelper.CreateLease(1)); userRepository.Setup(x => x.GetByKeycloakUserId(It.IsAny())).Returns(new PimsUser()); - var noteRepository = _helper.GetService>(); + var noteRepository = this._helper.GetService>(); // Act var result = service.Update(leaseEntity, new List()); @@ -77,27 +77,27 @@ public void Update_WithoutStatusNote() public void Update_WithStatusNote() { // Arrange - var service = CreateLeaseService(Permissions.LeaseEdit); + var service = this.CreateLeaseService(Permissions.LeaseEdit); var currentLeaseEntity = new PimsLease() { LeaseId = 1, - LeaseStatusTypeCode = "STATUS_A" + LeaseStatusTypeCode = "STATUS_A", }; var leaseEntity = new PimsLease() { LeaseId = 1, - LeaseStatusTypeCode = "STATUS_B" + LeaseStatusTypeCode = "STATUS_B", }; - var leaseRepository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var leaseRepository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); leaseRepository.Setup(x => x.GetNoTracking(It.IsAny())).Returns(currentLeaseEntity); leaseRepository.Setup(x => x.Get(It.IsAny())).Returns(EntityHelper.CreateLease(1)); userRepository.Setup(x => x.GetByKeycloakUserId(It.IsAny())).Returns(new PimsUser()); - var noteRepository = _helper.GetService>(); + var noteRepository = this._helper.GetService>(); // Act var result = service.Update(leaseEntity, new List()); @@ -112,11 +112,11 @@ public void Update_Properties_Success() // Arrange var lease = EntityHelper.CreateLease(1); - var service = CreateLeaseService(Permissions.LeaseEdit, Permissions.LeaseView); - var leaseRepository = _helper.GetService>(); - var propertyLeaseRepository = _helper.GetService>(); - var propertyRepository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var service = this.CreateLeaseService(Permissions.LeaseEdit, Permissions.LeaseView); + var leaseRepository = this._helper.GetService>(); + var propertyLeaseRepository = this._helper.GetService>(); + var propertyRepository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(lease.PimsPropertyLeases.FirstOrDefault().Property); leaseRepository.Setup(x => x.GetNoTracking(It.IsAny())).Returns(lease); leaseRepository.Setup(x => x.Get(It.IsAny())).Returns(EntityHelper.CreateLease(1)); @@ -137,11 +137,11 @@ public void Update_Properties_Delete_Success() var lease = EntityHelper.CreateLease(1); var updatedLease = EntityHelper.CreateLease(2, addProperty: false); - var service = CreateLeaseService(Permissions.LeaseEdit, Permissions.LeaseView); - var leaseRepository = _helper.GetService>(); - var propertyLeaseRepository = _helper.GetService>(); - var propertyRepository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var service = this.CreateLeaseService(Permissions.LeaseEdit, Permissions.LeaseView); + var leaseRepository = this._helper.GetService>(); + var propertyLeaseRepository = this._helper.GetService>(); + var propertyRepository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); propertyLeaseRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsPropertyLeases); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(lease.PimsPropertyLeases.FirstOrDefault().Property); leaseRepository.Setup(x => x.GetNoTracking(It.IsAny())).Returns(lease); @@ -164,11 +164,11 @@ public void Update_Properties_Delete_POI_Success() deletedProperty.IsPropertyOfInterest = true; var updatedLease = EntityHelper.CreateLease(2, addProperty: false); - var service = CreateLeaseService(Permissions.LeaseEdit, Permissions.LeaseView); - var leaseRepository = _helper.GetService>(); - var propertyLeaseRepository = _helper.GetService>(); - var propertyRepository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var service = this.CreateLeaseService(Permissions.LeaseEdit, Permissions.LeaseView); + var leaseRepository = this._helper.GetService>(); + var propertyLeaseRepository = this._helper.GetService>(); + var propertyRepository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); propertyLeaseRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsPropertyLeases); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(deletedProperty); diff --git a/source/backend/tests/unit/api/Services/LeaseTermServiceTest.cs b/source/backend/tests/unit/api/Services/LeaseTermServiceTest.cs index 846e172753..bb19c07dcf 100644 --- a/source/backend/tests/unit/api/Services/LeaseTermServiceTest.cs +++ b/source/backend/tests/unit/api/Services/LeaseTermServiceTest.cs @@ -27,14 +27,14 @@ public class LeaseServiceTermTest public LeaseServiceTermTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private LeaseTermService CreateLeaseServiceTermWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } #region Tests @@ -45,8 +45,8 @@ public void AddTerm() // Arrange var lease = EntityHelper.CreateLease(1); - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit, Permissions.LeaseView); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit, Permissions.LeaseView); + var leaseTermRepository = this._helper.GetService>(); // Act var term = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease }; @@ -65,8 +65,8 @@ public void AddTerm_OverlappingDates() var originalTerm = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease, Internal_Id = 1 }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); // Act @@ -85,8 +85,8 @@ public void AddTerm_OverlappingDates_SameStartDateAsEndDate() var originalTerm = new PimsLeaseTerm() { TermStartDate = date, TermExpiryDate = date.AddDays(1), LeaseId = lease.Internal_Id, Lease = lease, Internal_Id = 1 }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); // Act @@ -104,8 +104,8 @@ public void AddTerm_OverlappingDates_SameStartDate() var originalTerm = new PimsLeaseTerm() { TermStartDate = DateTime.Now, TermExpiryDate = DateTime.Now.AddDays(10), LeaseId = lease.Internal_Id, Lease = lease, Internal_Id = 1 }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); // Act @@ -122,8 +122,8 @@ public void AddTerm_PaymentsNotExercised() var lease = EntityHelper.CreateLease(1); var payment = new PimsLeasePayment(); - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); // Act @@ -143,8 +143,8 @@ public void UpdateTerm() var originalTerm = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit, Permissions.LeaseView); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit, Permissions.LeaseView); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetById(It.IsAny(), It.IsAny())).Returns(originalTerm); // Act @@ -165,8 +165,8 @@ public void UpdateTerm_OverlappingDates() var originalTerm = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease, Internal_Id = 1 }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); // Act @@ -185,8 +185,8 @@ public void UpdateTerm_PaymentsNotExercised() var originalTerm = new PimsLeaseTerm() { TermStartDate = DateTime.Now, TermExpiryDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease, PimsLeasePayments = new List() { payment } }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); leaseTermRepository.Setup(x => x.GetById(It.IsAny(), It.IsAny())).Returns(originalTerm); @@ -207,8 +207,8 @@ public void DeleteTerm() var originalTerm = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease }; lease.PimsLeaseTerms = new List() { originalTerm }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetById(It.IsAny(), It.IsAny())).Returns(originalTerm); // Act @@ -229,8 +229,8 @@ public void DeleteTerm_Payments() var term = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease, PimsLeasePayments = new List() { payment } }; lease.PimsLeaseTerms = new List() { term }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); leaseTermRepository.Setup(x => x.GetById(It.IsAny(), It.IsAny())).Returns(term); @@ -248,8 +248,8 @@ public void DeleteTerm_Exer() var term = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease, LeaseTermStatusTypeCode = "EXER" }; lease.PimsLeaseTerms = new List() { term }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); leaseTermRepository.Setup(x => x.GetById(It.IsAny(), It.IsAny())).Returns(term); @@ -268,8 +268,8 @@ public void DeleteTerm_Initial() var term2 = new PimsLeaseTerm() { TermStartDate = DateTime.Now, LeaseId = lease.Internal_Id, Lease = lease }; lease.PimsLeaseTerms = new List() { term, term2 }; - var service = CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); - var leaseTermRepository = _helper.GetService>(); + var service = this.CreateLeaseServiceTermWithPermissions(Permissions.LeaseEdit); + var leaseTermRepository = this._helper.GetService>(); leaseTermRepository.Setup(x => x.GetAllByLeaseId(It.IsAny())).Returns(lease.PimsLeaseTerms); leaseTermRepository.Setup(x => x.GetById(It.IsAny(), It.IsAny())).Returns(term); diff --git a/source/backend/tests/unit/api/Services/NoteServiceTest.cs b/source/backend/tests/unit/api/Services/NoteServiceTest.cs index c98dccca1b..80376fc355 100644 --- a/source/backend/tests/unit/api/Services/NoteServiceTest.cs +++ b/source/backend/tests/unit/api/Services/NoteServiceTest.cs @@ -26,14 +26,14 @@ public class NoteServiceTest public NoteServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private NoteService CreateNoteServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } #region Tests @@ -42,33 +42,33 @@ private NoteService CreateNoteServiceWithPermissions(params Permissions[] permis public void Add_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteAdd); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteAdd); - var mapper = _helper.GetService(); - var activityNote = EntityHelper.CreateActivityNote(); - var noteModel = mapper.Map(activityNote); + var mapper = this._helper.GetService(); + var projectNote = EntityHelper.CreateProjectNote(); + var noteModel = mapper.Map(projectNote); - var repository = _helper.GetService>(); - repository.Setup(x => x.Add(It.IsAny())).Returns(activityNote); + var repository = this._helper.GetService>(); + repository.Setup(x => x.Add(It.IsAny())).Returns(projectNote); // Act - var result = service.Add(NoteType.Activity, noteModel); + var result = service.Add(NoteType.Project, noteModel); // Assert - repository.Verify(x => x.Add(It.IsAny()), Times.Once); + repository.Verify(x => x.Add(It.IsAny()), Times.Once); } [Fact] public void Add_AcquisitionFileNote_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteAdd); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteAdd); - var mapper = _helper.GetService(); + var mapper = this._helper.GetService(); var acquisitionFileNote = EntityHelper.CreateAcquisitionFileNote(); var noteModel = mapper.Map(acquisitionFileNote); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Returns(acquisitionFileNote); // Act @@ -82,13 +82,13 @@ public void Add_AcquisitionFileNote_Success() public void Add_ProjectNote_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteAdd); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteAdd); - var mapper = _helper.GetService(); + var mapper = this._helper.GetService(); var projectNote = EntityHelper.CreateProjectNote(); var noteModel = mapper.Map(projectNote); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Returns(projectNote); // Act @@ -102,13 +102,13 @@ public void Add_ProjectNote_Success() public void Add_ResearchNote_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteAdd); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteAdd); - var mapper = _helper.GetService(); + var mapper = this._helper.GetService(); var researchNote = EntityHelper.CreateResearchNote(); var noteModel = mapper.Map(researchNote); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Add(It.IsAny())).Returns(researchNote); // Act @@ -122,20 +122,20 @@ public void Add_ResearchNote_Success() public void Add_NoPermission() { // Arrange - var service = CreateNoteServiceWithPermissions(); + var service = this.CreateNoteServiceWithPermissions(); - var mapper = _helper.GetService(); - var activityNote = EntityHelper.CreateActivityNote(); + var mapper = this._helper.GetService(); + var activityNote = EntityHelper.CreateProjectNote(); var noteModel = mapper.Map(activityNote); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act - Action act = () => service.Add(NoteType.Activity, noteModel); + Action act = () => service.Add(NoteType.Project, noteModel); // Assert act.Should().Throw(); - repository.Verify(x => x.Add(It.IsAny()), Times.Never); + repository.Verify(x => x.Add(It.IsAny()), Times.Never); } #endregion @@ -144,11 +144,11 @@ public void Add_NoPermission() public void GetById_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteView); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteView); var note = EntityHelper.CreateNote("Test Note"); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(note); // Act @@ -162,7 +162,7 @@ public void GetById_Success() public void GetById_NoPermission() { // Arrange - var service = CreateNoteServiceWithPermissions(); + var service = this.CreateNoteServiceWithPermissions(); var note = EntityHelper.CreateNote("Test Note"); @@ -179,29 +179,29 @@ public void GetById_NoPermission() public void GetNotes_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteView); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteView); var notes = new[] { EntityHelper.CreateNote("Test Note 1"), EntityHelper.CreateNote("Test Note 2") }; - var repository = _helper.GetService>(); - repository.Setup(x => x.GetAllActivityNotesById(It.IsAny())).Returns(notes); + var repository = this._helper.GetService>(); + repository.Setup(x => x.GetAllProjectNotesById(It.IsAny())).Returns(notes); // Act - var result = service.GetNotes(NoteType.Activity, 1); + var result = service.GetNotes(NoteType.Project, 1); // Assert - repository.Verify(x => x.GetAllActivityNotesById(It.IsAny()), Times.Once); + repository.Verify(x => x.GetAllProjectNotesById(It.IsAny()), Times.Once); } [Fact] public void GetNotes_Project_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteView); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteView); var notes = new[] { EntityHelper.CreateNote("Test Note 1"), EntityHelper.CreateNote("Test Note 2") }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllProjectNotesById(It.IsAny())).Returns(notes); // Act @@ -215,11 +215,11 @@ public void GetNotes_Project_Success() public void GetNotes_Research_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteView); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteView); var notes = new[] { EntityHelper.CreateNote("Test Note 1"), EntityHelper.CreateNote("Test Note 2") }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetAllResearchNotesById(It.IsAny())).Returns(notes); // Act @@ -233,10 +233,10 @@ public void GetNotes_Research_Success() public void GetNotes_NoPermission() { // Arrange - var service = CreateNoteServiceWithPermissions(); + var service = this.CreateNoteServiceWithPermissions(); // Act - Action act = () => service.GetNotes(NoteType.Activity, 1); + Action act = () => service.GetNotes(NoteType.Project, 1); // Assert act.Should().Throw(); @@ -248,13 +248,13 @@ public void GetNotes_NoPermission() public void Update_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteEdit, Permissions.NoteView); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteEdit, Permissions.NoteView); - var mapper = _helper.GetService(); + var mapper = this._helper.GetService(); var note = EntityHelper.CreateNote("Test Note"); var model = mapper.Map(note); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(note); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(note); @@ -270,13 +270,13 @@ public void Update_Success() public void Update_NoPermission() { // Arrange - var service = CreateNoteServiceWithPermissions(); + var service = this.CreateNoteServiceWithPermissions(); - var mapper = _helper.GetService(); + var mapper = this._helper.GetService(); var note = EntityHelper.CreateNote("Test Note"); var model = mapper.Map(note); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act Action act = () => service.Update(model); @@ -292,26 +292,26 @@ public void Update_NoPermission() public void DeleteNote_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteDelete); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteDelete); - var repository = _helper.GetService>(); - repository.Setup(x => x.DeleteActivityNotes(It.IsAny())); + var repository = this._helper.GetService>(); + repository.Setup(x => x.DeleteProjectNotes(It.IsAny())); // Act - service.DeleteNote(NoteType.Activity, 1); + service.DeleteNote(NoteType.Project, 1); // Assert - repository.Verify(x => x.DeleteActivityNotes(It.IsAny()), Times.Once); + repository.Verify(x => x.DeleteProjectNotes(It.IsAny()), Times.Once); } [Fact] public void DeleteNote_AcquisitionFile_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteDelete); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteDelete); - var repository = _helper.GetService>(); - repository.Setup(x => x.DeleteActivityNotes(It.IsAny())); + var repository = this._helper.GetService>(); + repository.Setup(x => x.DeleteAcquisitionFileNotes(It.IsAny())); // Act service.DeleteNote(NoteType.Acquisition_File, 1); @@ -324,8 +324,8 @@ public void DeleteNote_AcquisitionFile_Success() public void DeleteNote_Project_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteDelete); - var repository = _helper.GetService>(); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteDelete); + var repository = this._helper.GetService>(); // Act service.DeleteNote(NoteType.Project, 1); @@ -338,8 +338,8 @@ public void DeleteNote_Project_Success() public void DeleteNote_Research_Success() { // Arrange - var service = CreateNoteServiceWithPermissions(Permissions.NoteDelete); - var repository = _helper.GetService>(); + var service = this.CreateNoteServiceWithPermissions(Permissions.NoteDelete); + var repository = this._helper.GetService>(); // Act service.DeleteNote(NoteType.Research_File, 1); @@ -352,16 +352,16 @@ public void DeleteNote_Research_Success() public void DeleteNote_NoPermission() { // Arrange - var service = CreateNoteServiceWithPermissions(); + var service = this.CreateNoteServiceWithPermissions(); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); // Act - Action act = () => service.DeleteNote(NoteType.Activity, 1); + Action act = () => service.DeleteNote(NoteType.Project, 1); // Assert act.Should().Throw(); - repository.Verify(x => x.DeleteActivityNotes(It.IsAny()), Times.Never); + repository.Verify(x => x.DeleteProjectNotes(It.IsAny()), Times.Never); } #endregion diff --git a/source/backend/tests/unit/api/Services/ProjectServiceTest.cs b/source/backend/tests/unit/api/Services/ProjectServiceTest.cs index 5a7eebf73f..66629dc0bc 100644 --- a/source/backend/tests/unit/api/Services/ProjectServiceTest.cs +++ b/source/backend/tests/unit/api/Services/ProjectServiceTest.cs @@ -25,30 +25,30 @@ public class ProjectServiceTest public ProjectServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private ProjectService CreateProjectServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } [Fact] public void Search_Success() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectView); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectView); var user = PrincipalHelper.CreateForPermission(Permissions.ProjectView); var project = EntityHelper.CreateProject(1, "7", "Test Project"); var projectList = new List() { project }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.SearchProjects(It.IsAny(), It.IsAny>(), It.IsAny())).Returns(projectList); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -62,7 +62,7 @@ public void Search_Success() public void Search_NoPermission() { // Arrange - var service = CreateProjectServiceWithPermissions(); + var service = this.CreateProjectServiceWithPermissions(); // Act Action act = () => service.SearchProjects("some string", 1); @@ -75,7 +75,7 @@ public void Search_NoPermission() public void Search_GetPage_ShouldFail_NotAuthorized() { // Arrange - var service = CreateProjectServiceWithPermissions(); + var service = this.CreateProjectServiceWithPermissions(); // Act Action result = () => service.GetPage(new ProjectFilter { ProjectName = "test" }); @@ -88,10 +88,10 @@ public void Search_GetPage_ShouldFail_NotAuthorized() public void Search_GetPage_ShouldFail_Filter_IsNull() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectView); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectView); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(new PimsUser()); // Act @@ -106,10 +106,10 @@ public void Search_GetPage_ShouldFail_Filter_IsNull() public void Search_GetPage_ShouldFail_Filter_IsInvalid() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectView); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectView); - var repository = _helper.GetService>(); - var userRepository = _helper.GetService>(); + var repository = this._helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(new PimsUser()); // Act @@ -124,18 +124,17 @@ public void Search_GetPage_ShouldFail_Filter_IsInvalid() public async void Search_GetPage_Success() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectView); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectView); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetPageAsync(It.IsAny(), It.IsAny>())) .ReturnsAsync(new Paged() { Page = 1, }); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(new PimsUser()); - // Act var result = await service.GetPage(new ProjectFilter { ProjectName = "test" }); @@ -148,16 +147,16 @@ public async void Search_GetPage_Success() public void GetAll_Success() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectView); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectView); var user = PrincipalHelper.CreateForPermission(Permissions.ProjectView); var project = EntityHelper.CreateProject(1, "7", "Test Project"); var projectList = new List() { project }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.SearchProjects(It.IsAny(), It.IsAny>(), It.IsAny())).Returns(projectList); - var userRepository = _helper.GetService>(); + var userRepository = this._helper.GetService>(); userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test")); // Act @@ -171,7 +170,7 @@ public void GetAll_Success() public void GetAll_NoPermission() { // Arrange - var service = CreateProjectServiceWithPermissions(); + var service = this.CreateProjectServiceWithPermissions(); // Act Action act = () => service.GetAll(); @@ -372,8 +371,8 @@ public void Update_Project_ShouldFail_NotAuthorized() public void Update_Project_ShouldFail_When_Null() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectEdit); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectEdit); + var repository = this._helper.GetService>(); // Act Action result = () => service.Update(null); @@ -428,8 +427,8 @@ public void Update_Project_ShouldFail_IfDuplicateProductInDb() public void Update_Project_Success() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectEdit); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectEdit); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(new PimsProject { Internal_Id = 1 }); repository.Setup(x => x.Get(It.IsAny())).Returns(new PimsProject() { @@ -449,26 +448,26 @@ public void Update_Project_Success() public void Update_Project_Success_AddsNote() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.ProjectEdit); + var service = this.CreateProjectServiceWithPermissions(Permissions.ProjectEdit); var project = EntityHelper.CreateProject(1, "9999", "TEST PROJECT"); project.ConcurrencyControlNumber = 1; project.AppCreateUserid = "TESTER"; - var projectRepository = _helper.GetService>(); - var noteRepository = _helper.GetService>(); - var lookupRepository = _helper.GetService>(); + var projectRepository = this._helper.GetService>(); + var noteRepository = this._helper.GetService>(); + var lookupRepository = this._helper.GetService>(); projectRepository.Setup(x => x.Update(It.IsAny())).Returns(project); projectRepository.Setup(x => x.Get(It.IsAny())).Returns(new PimsProject() { ProjectStatusTypeCode = "ACTIVE", - ProjectStatusTypeCodeNavigation = new PimsProjectStatusType() { Description = "Active" } + ProjectStatusTypeCodeNavigation = new PimsProjectStatusType() { Description = "Active" }, }); lookupRepository.Setup(x => x.GetAllProjectStatusTypes()).Returns(new PimsProjectStatusType[]{ new PimsProjectStatusType() { Id = project.ProjectStatusTypeCodeNavigation.Id, Description = project.ProjectStatusTypeCodeNavigation.Description, - }}); + },}); // Act var result = service.Update(project); diff --git a/source/backend/tests/unit/api/Services/PropertyServiceTest.cs b/source/backend/tests/unit/api/Services/PropertyServiceTest.cs index ddcef07a29..936cd5ee8c 100644 --- a/source/backend/tests/unit/api/Services/PropertyServiceTest.cs +++ b/source/backend/tests/unit/api/Services/PropertyServiceTest.cs @@ -28,14 +28,14 @@ public class PropertyServiceTest public PropertyServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private PropertyService CreateProjectServiceWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } #region Tests @@ -46,11 +46,11 @@ public void GetById_Success() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(Permissions.PropertyView); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.PropertyView); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(property); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())); // Act @@ -67,7 +67,7 @@ public void GetById_NoPermission() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(); + var service = this.CreateProjectServiceWithPermissions(); // Assert Assert.Throws(() => service.GetById(1)); @@ -81,11 +81,11 @@ public void GetByPid_Success() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(Permissions.PropertyView); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.PropertyView); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetByPid(It.IsAny())).Returns(property); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())); // Act @@ -102,7 +102,7 @@ public void GetByPid_NoPermission() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(); + var service = this.CreateProjectServiceWithPermissions(); // Assert Assert.Throws(() => service.GetByPid(1.ToString())); @@ -116,11 +116,11 @@ public void Update_Property_No_Reprojection_Success() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(Permissions.PropertyView, Permissions.PropertyEdit); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.PropertyView, Permissions.PropertyEdit); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny(), It.IsAny())).Returns(property); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())); var newValues = new PimsProperty(); @@ -143,12 +143,12 @@ public void Update_Property_With_Reprojection_Success() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(Permissions.PropertyView, Permissions.PropertyEdit); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.PropertyView, Permissions.PropertyEdit); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny(), It.IsAny())).Returns(property); var projected = new Coordinate(14000, 9200); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())).Returns(projected); var newValues = new PimsProperty(); @@ -169,12 +169,12 @@ public void Update_Property_With_Reprojection_Success() public void Update_Property_KeyNotFound() { // Arrange - var service = CreateProjectServiceWithPermissions(Permissions.PropertyView, Permissions.PropertyEdit); + var service = this.CreateProjectServiceWithPermissions(Permissions.PropertyView, Permissions.PropertyEdit); // Try to update a non-existent property var property = EntityHelper.CreateProperty(1); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(property, It.IsAny())).Throws(); // Assert @@ -187,8 +187,8 @@ public void Update_Property_NoPermission() // Arrange var property = EntityHelper.CreateProperty(1); - var service = CreateProjectServiceWithPermissions(Permissions.PropertyView); - var repository = _helper.GetService>(); + var service = this.CreateProjectServiceWithPermissions(Permissions.PropertyView); + var repository = this._helper.GetService>(); // Assert Assert.Throws(() => service.Update(property)); diff --git a/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs b/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs index 60959c6b3b..8b5233ef5b 100644 --- a/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/ResearchFileServiceTest.cs @@ -27,15 +27,15 @@ public class ResearchFileServiceTest public ResearchFileServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private ResearchFileService CreateResearchFileServiceWithPermissions(params Permissions[] permissions) { ClaimsPrincipal user = PrincipalHelper.CreateForPermission(permissions); user.AddClaim("idir_username", "TestIdirUsername@domain"); - _helper.CreatePimsContext(user, true); - return _helper.Create(); + this._helper.CreatePimsContext(user, true); + return this._helper.Create(); } #region Tests @@ -46,8 +46,8 @@ public void GetPage() // Arrange var researchFile = EntityHelper.CreateResearchFile(1); - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileView); - var researchRepository = _helper.GetService>(); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileView); + var researchRepository = this._helper.GetService>(); researchRepository.Setup(x => x.GetPage(It.IsAny())); // Act @@ -61,7 +61,7 @@ public void GetPage() public void GetPage_NoPermission() { // Arrange - var service = CreateResearchFileServiceWithPermissions(); + var service = this.CreateResearchFileServiceWithPermissions(); // Assert Assert.Throws(() => service.GetPage(new ResearchFilter())); @@ -79,11 +79,11 @@ public void UpdateProperties_Delete() pimsPropertyResearchFile.PimsPrfPropResearchPurposeTypes = new List() { new PimsPrfPropResearchPurposeType() { } }; researchFile.PimsPropertyResearchFiles.Add(pimsPropertyResearchFile); - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); - var researchRepository = _helper.GetService>(); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var researchRepository = this._helper.GetService>(); researchRepository.Setup(x => x.GetPage(It.IsAny())); researchRepository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(2); - var researchFilePropertyRepository = _helper.GetService>(); + var researchFilePropertyRepository = this._helper.GetService>(); researchFilePropertyRepository.Setup(x => x.Delete(It.IsAny())); researchFilePropertyRepository.Setup(x => x.GetAllByResearchFileId(It.IsAny())).Returns(researchFile.PimsPropertyResearchFiles.ToList()); @@ -101,7 +101,7 @@ public void UpdateProperties_Delete() public void UpdateProperties_MatchProperties_PID_Success() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); var researchFile = EntityHelper.CreateResearchFile(); researchFile.ConcurrencyControlNumber = 1; @@ -109,14 +109,14 @@ public void UpdateProperties_MatchProperties_PID_Success() var property = EntityHelper.CreateProperty(12345); researchFile.PimsPropertyResearchFiles = new List() { new PimsPropertyResearchFile() { Property = property } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(researchFile); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Returns(property); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetAllByResearchFileId(It.IsAny())).Returns(researchFile.PimsPropertyResearchFiles.ToList()); // Act @@ -130,7 +130,7 @@ public void UpdateProperties_MatchProperties_PID_Success() public void UpdateProperties_MatchProperties_PIN_Success() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); var researchFile = EntityHelper.CreateResearchFile(); researchFile.ConcurrencyControlNumber = 1; @@ -139,14 +139,14 @@ public void UpdateProperties_MatchProperties_PIN_Success() property.Pid = null; researchFile.PimsPropertyResearchFiles = new List() { new PimsPropertyResearchFile() { Property = property } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(researchFile); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPin(It.IsAny())).Returns(property); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetAllByResearchFileId(It.IsAny())).Returns(researchFile.PimsPropertyResearchFiles.ToList()); // Act @@ -160,7 +160,7 @@ public void UpdateProperties_MatchProperties_PIN_Success() public void UpdateProperties_MatchProperties_PID_NewProperty_Success() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); var researchFile = EntityHelper.CreateResearchFile(); researchFile.ConcurrencyControlNumber = 1; @@ -168,19 +168,19 @@ public void UpdateProperties_MatchProperties_PID_NewProperty_Success() var property = EntityHelper.CreateProperty(12345); researchFile.PimsPropertyResearchFiles = new List() { new PimsPropertyResearchFile() { Property = property } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); PimsPropertyResearchFile updatedResearchFileProperty = null; repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(researchFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetAllByResearchFileId(It.IsAny())).Returns(researchFile.PimsPropertyResearchFiles.ToList()); filePropertyRepository.Setup(x => x.Add(It.IsAny())).Callback(x => updatedResearchFileProperty = x).Returns(researchFile.PimsPropertyResearchFiles.FirstOrDefault()); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPid(It.IsAny())).Throws(); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())).Returns(new Coordinate(924046.3314288399, 1088892.9140135897)); // Act @@ -204,7 +204,7 @@ public void UpdateProperties_MatchProperties_PID_NewProperty_Success() public void UpdateProperties_MatchProperties_PIN_NewProperty_Success() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); var researchFile = EntityHelper.CreateResearchFile(); researchFile.ConcurrencyControlNumber = 1; @@ -213,19 +213,19 @@ public void UpdateProperties_MatchProperties_PIN_NewProperty_Success() property.Pid = null; researchFile.PimsPropertyResearchFiles = new List() { new PimsPropertyResearchFile() { Property = property } }; - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); PimsPropertyResearchFile updatedResearchFileProperty = null; repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(researchFile); - var filePropertyRepository = _helper.GetService>(); + var filePropertyRepository = this._helper.GetService>(); filePropertyRepository.Setup(x => x.GetAllByResearchFileId(It.IsAny())).Returns(researchFile.PimsPropertyResearchFiles.ToList()); filePropertyRepository.Setup(x => x.Add(It.IsAny())).Callback(x => updatedResearchFileProperty = x).Returns(researchFile.PimsPropertyResearchFiles.FirstOrDefault()); - var propertyRepository = _helper.GetService>(); + var propertyRepository = this._helper.GetService>(); propertyRepository.Setup(x => x.GetByPin(It.IsAny())).Throws(); - var coordinateService = _helper.GetService>(); + var coordinateService = this._helper.GetService>(); coordinateService.Setup(x => x.TransformCoordinates(It.IsAny(), It.IsAny(), It.IsAny())).Returns(new Coordinate(924046.3314288399, 1088892.9140135897)); // Act @@ -251,11 +251,11 @@ public void UpdateProperties_MatchProperties_PIN_NewProperty_Success() public void GetById_Success() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileView); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileView); var researchFile = EntityHelper.CreateResearchFile(1); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.GetById(It.IsAny())).Returns(researchFile); // Act @@ -269,7 +269,7 @@ public void GetById_Success() public void GetById_NoPermission() { // Arrange - var service = CreateResearchFileServiceWithPermissions(); + var service = this.CreateResearchFileServiceWithPermissions(); // Act Action act = () => service.GetById(1); @@ -285,10 +285,10 @@ public void Update_Success() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); var researchFile = EntityHelper.CreateResearchFile(1); - var repository = _helper.GetService>(); + var repository = this._helper.GetService>(); repository.Setup(x => x.Update(It.IsAny())).Returns(researchFile); repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1); repository.Setup(x => x.GetById(It.IsAny())).Returns(researchFile); @@ -304,7 +304,7 @@ public void Update_Success() public void Update_NoPermission() { // Arrange - var service = CreateResearchFileServiceWithPermissions(); + var service = this.CreateResearchFileServiceWithPermissions(); var researchFile = EntityHelper.CreateResearchFile(1); @@ -319,7 +319,7 @@ public void Update_NoPermission() public void Update_ThrowIf_Null() { // Arrange - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); // Act Action act = () => service.Update(null); @@ -348,14 +348,14 @@ public void Update_StatusChange_CreatesNote() ResearchFileStatusTypeCodeNavigation = oldStatusType, }; - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); - var researchRepositoryMock = _helper.GetService>(); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var researchRepositoryMock = this._helper.GetService>(); researchRepositoryMock.Setup(x => x.GetById(researchFileId)).Returns(existingResearchFile); researchRepositoryMock.Setup(x => x.Update(updatedResearchFileRequest)).Returns(updatedResearchFileRequest); - var lookupRepositoryMock = _helper.GetService>(); + var lookupRepositoryMock = this._helper.GetService>(); lookupRepositoryMock.Setup(x => x.GetAllResearchFileStatusTypes()).Returns(new List() { newStatusType, oldStatusType }); - var noteEntityRepositoryMock = _helper.GetService>(); + var noteEntityRepositoryMock = this._helper.GetService>(); // Act var updatedResearchFile = service.Update(updatedResearchFileRequest); @@ -383,14 +383,14 @@ public void Update_NoStatusChange_DoesNotCreateNote() ResearchFileStatusTypeCodeNavigation = sameStatusType, }; - var service = CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); - var researchRepositoryMock = _helper.GetService>(); + var service = this.CreateResearchFileServiceWithPermissions(Permissions.ResearchFileEdit); + var researchRepositoryMock = this._helper.GetService>(); researchRepositoryMock.Setup(x => x.GetById(researchFileId)).Returns(existingResearchFile); researchRepositoryMock.Setup(x => x.Update(updatedResearchFileRequest)).Returns(updatedResearchFileRequest); - var lookupRepositoryMock = _helper.GetService>(); + var lookupRepositoryMock = this._helper.GetService>(); lookupRepositoryMock.Setup(x => x.GetAllResearchFileStatusTypes()).Returns(new List() { sameStatusType }); - var noteEntityRepositoryMock = _helper.GetService>(); + var noteEntityRepositoryMock = this._helper.GetService>(); // Act var updatedResearchFile = service.Update(updatedResearchFileRequest); diff --git a/source/backend/tests/unit/api/Services/TakeServiceTest.cs b/source/backend/tests/unit/api/Services/TakeServiceTest.cs index a25ee15cd8..85e562120c 100644 --- a/source/backend/tests/unit/api/Services/TakeServiceTest.cs +++ b/source/backend/tests/unit/api/Services/TakeServiceTest.cs @@ -25,21 +25,21 @@ public class TakeServiceTest public TakeServiceTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private TakeService CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - return _helper.Create(user); + return this._helper.Create(user); } [Fact] public void GetByFileId_Success() { // Arrange - var service = CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetAllByAcquisitionFileId(It.IsAny())); // Act @@ -53,7 +53,7 @@ public void GetByFileId_Success() public void GetByFileId_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.GetByFileId(1); @@ -66,8 +66,8 @@ public void GetByFileId_NoPermission() public void GetByPropertyId_Success() { // Arrange - var service = CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetAllByPropertyId(It.IsAny(), It.IsAny())); // Act @@ -81,7 +81,7 @@ public void GetByPropertyId_Success() public void GetByPropertyId_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.GetByPropertyId(1, 2); @@ -94,8 +94,8 @@ public void GetByPropertyId_NoPermission() public void GetCountByPropertyId_Success() { // Arrange - var service = CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); - var repo = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); + var repo = this._helper.GetService>(); repo.Setup(x => x.GetCountByPropertyId(It.IsAny())); // Act @@ -109,7 +109,7 @@ public void GetCountByPropertyId_Success() public void GetCountByPropertyId_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.GetCountByPropertyId(1); @@ -122,8 +122,8 @@ public void GetCountByPropertyId_NoPermission() public void Update_Success() { // Arrange - var service = CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); - var repository = _helper.GetService>(); + var service = this.CreateWithPermissions(Permissions.PropertyView, Permissions.AcquisitionFileView); + var repository = this._helper.GetService>(); repository.Setup(x => x.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>())); @@ -138,7 +138,7 @@ public void Update_Success() public void Update_NoPermission() { // Arrange - var service = CreateWithPermissions(); + var service = this.CreateWithPermissions(); // Act Action act = () => service.UpdateAcquisitionPropertyTakes(1, new List()); diff --git a/source/backend/tests/unit/dal/Core/Extensions/AcquisitionFileExtensionsTests.cs b/source/backend/tests/unit/dal/Core/Extensions/AcquisitionFileExtensionsTests.cs index 73fc219899..f56b6d85e8 100644 --- a/source/backend/tests/unit/dal/Core/Extensions/AcquisitionFileExtensionsTests.cs +++ b/source/backend/tests/unit/dal/Core/Extensions/AcquisitionFileExtensionsTests.cs @@ -1,10 +1,10 @@ -using Pims.Dal.Helpers.Extensions; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using System.Threading.Tasks; +using Pims.Dal.Helpers.Extensions; using Xunit; namespace Pims.Core.Test.Extensions @@ -20,7 +20,7 @@ public class AcquisitionFileExtensionsTests public AcquisitionFileExtensionsTests() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } [Fact] @@ -58,7 +58,7 @@ public void AcquisitionFile_GetLegacyInterestHolders_returns_EmptyWhen_Empty() { // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); - acqFile.LegacyStakeholder = ""; + acqFile.LegacyStakeholder = string.Empty; // Act var sut = acqFile.GetLegacyInterestHolders(); diff --git a/source/backend/tests/unit/dal/Libraries/Keycloak/KeycloakServiceTest.cs b/source/backend/tests/unit/dal/Libraries/Keycloak/KeycloakServiceTest.cs index 547600de04..51f7a8fd8c 100644 --- a/source/backend/tests/unit/dal/Libraries/Keycloak/KeycloakServiceTest.cs +++ b/source/backend/tests/unit/dal/Libraries/Keycloak/KeycloakServiceTest.cs @@ -186,7 +186,7 @@ public void CreateKeycloakService() Secret = "[USE SECRETS]", Api = "https://api.loginproxy.gov.bc.ca/api/v1", Integration = "4379", - Environment = "test" + Environment = "test", }, }); @@ -225,7 +225,7 @@ public void CreateKeycloakService_ServiceAccount() Integration = "4379", Environment = "test", Audience = "pims-service-account", - Authority = "https://loginproxy.gov.bc.ca/auth/realms/standard" + Authority = "https://loginproxy.gov.bc.ca/auth/realms/standard", }, }); diff --git a/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs b/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs index 9bc569fe12..84c5a8dd8f 100644 --- a/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs +++ b/source/backend/tests/unit/dal/Libraries/Keycloak/PimsKeycloakUserServiceTest.cs @@ -45,8 +45,7 @@ public async Task UpdateUserAsync_Success() var kuser = new Pims.Keycloak.Models.UserModel() { Username = euser.BusinessIdentifierValue, - Attributes = new Dictionary() { { "idir_username", new string[1] { euser.BusinessIdentifierValue } } } - + Attributes = new Dictionary() { { "idir_username", new string[1] { euser.BusinessIdentifierValue } } }, }; var groups = new string[] { removeRole.Name.ToString() }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); @@ -118,7 +117,7 @@ public async Task UpdateUserAsync_Success_KeycloakRoleNotInPims() var kuser = new Pims.Keycloak.Models.UserModel() { Username = euser.BusinessIdentifierValue, - Attributes = new Dictionary() { { "idir_username", new string[1] { euser.BusinessIdentifierValue } } } + Attributes = new Dictionary() { { "idir_username", new string[1] { euser.BusinessIdentifierValue } } }, }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); keycloakServiceMock.Setup(m => m.GetUserGroupsAsync(euser.GuidIdentifierValue.Value)) @@ -210,7 +209,7 @@ public async Task UpdateUserAsync_KeycloakUserDoesNotMatch() var kuser = new Pims.Keycloak.Models.UserModel() { Username = "keycloak username", - Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } } + Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } }, }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); keycloakServiceMock.Setup(m => m.GetUserGroupsAsync(euser.GuidIdentifierValue.Value)) @@ -352,7 +351,7 @@ public async Task AppendToUserAsync_Success_AddRole() var kuser = new Pims.Keycloak.Models.UserModel() { Username = euser.BusinessIdentifierValue, - Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } } + Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } }, }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); keycloakServiceMock.Setup(m => m.GetUserGroupsAsync(euser.GuidIdentifierValue.Value)) @@ -412,7 +411,7 @@ public async Task AppendToUserAsync_Success_AddContactMethod() var kuser = new Pims.Keycloak.Models.UserModel() { Username = euser.BusinessIdentifierValue, - Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } } + Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } }, }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); keycloakServiceMock.Setup(m => m.GetUserGroupsAsync(euser.GuidIdentifierValue.Value)) @@ -581,7 +580,7 @@ public async Task UpdateAccessRequestAsync_Approved() var kuser = new Pims.Keycloak.Models.UserModel() { Username = eAccessRequest.User.BusinessIdentifierValue, - Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } } + Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } }, }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); @@ -634,7 +633,7 @@ public async Task UpdateAccessRequestAsync_Approved_RegionUpdate() var kuser = new Pims.Keycloak.Models.UserModel() { Username = eAccessRequest.User.BusinessIdentifierValue, - Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } } + Attributes = new Dictionary() { { "idir_username", new string[1] { "serviceaccount" } } }, }; keycloakServiceMock.Setup(m => m.GetUserAsync(It.IsAny())).ReturnsAsync(kuser); diff --git a/source/backend/tests/unit/dal/Libraries/Keycloak/ServiceCollectionExtensionsTest.cs b/source/backend/tests/unit/dal/Libraries/Keycloak/ServiceCollectionExtensionsTest.cs index 78d32a668c..100160fe95 100644 --- a/source/backend/tests/unit/dal/Libraries/Keycloak/ServiceCollectionExtensionsTest.cs +++ b/source/backend/tests/unit/dal/Libraries/Keycloak/ServiceCollectionExtensionsTest.cs @@ -40,7 +40,7 @@ public void AddKeycloakService_Success() Secret = "test", Api = "api", Environment = "test", - Integration = "4379" + Integration = "4379", }, }; mockConfig.Setup(m => m.Value).Returns(options); @@ -93,7 +93,7 @@ public void AddPimsKeycloakService_Success() Secret = "test", Api = "api", Environment = "test", - Integration = "4379" + Integration = "4379", }, }; mockConfig.Setup(m => m.Value).Returns(options); diff --git a/source/backend/tests/unit/dal/Libraries/Ltsa/LtsaServiceTest.cs b/source/backend/tests/unit/dal/Libraries/Ltsa/LtsaServiceTest.cs index 04510d45e6..6eef6d3e37 100644 --- a/source/backend/tests/unit/dal/Libraries/Ltsa/LtsaServiceTest.cs +++ b/source/backend/tests/unit/dal/Libraries/Ltsa/LtsaServiceTest.cs @@ -336,7 +336,7 @@ public async void GetTitleSummariesAsync_Error() .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, - Content = new StringContent(accessTokenResponse) + Content = new StringContent(accessTokenResponse), }); var httpClient = new HttpClient(mockMessageHandler.Object); diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs index 4bb8542ad2..0fa4eaa3aa 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionFileChecklistRepositoryTest.cs @@ -25,10 +25,10 @@ public class AcquisitionFileChecklistRepositoryTest public AcquisitionFileChecklistRepositoryTest() { - _helper = new TestHelper(); - _user = PrincipalHelper.CreateForPermission(Permissions.AcquisitionFileView, Permissions.AcquisitionFileEdit); - _context = _helper.CreatePimsContext(_user, true); - _repository = _helper.CreateRepository(_user); + this._helper = new TestHelper(); + this._user = PrincipalHelper.CreateForPermission(Permissions.AcquisitionFileView, Permissions.AcquisitionFileEdit); + this._context = this._helper.CreatePimsContext(this._user, true); + this._repository = this._helper.CreateRepository(this._user); } #region Get Acquisition Checklist Items By File Id @@ -37,10 +37,10 @@ public void GetByAcquisitionFileId_Success() { // Arrange var checklistItem = EntityHelper.CreateAcquisitionChecklistItem(); - _context.AddAndSaveChanges(checklistItem); + this._context.AddAndSaveChanges(checklistItem); // Act - var result = _repository.GetAllChecklistItemsByAcquisitionFileId(1); + var result = this._repository.GetAllChecklistItemsByAcquisitionFileId(1); // Assert result.Should().NotBeNull(); @@ -53,7 +53,7 @@ public void GetByAcquisitionFileId_Success() public void GetByAcquisitionFileId_NotFound() { // Act - var result = _repository.GetAllChecklistItemsByAcquisitionFileId(1); + var result = this._repository.GetAllChecklistItemsByAcquisitionFileId(1); // Assert result.Should().NotBeNull(); @@ -68,11 +68,11 @@ public void Update_Success() { // Arrange var checklistItem = EntityHelper.CreateAcquisitionChecklistItem(); - _context.AddAndSaveChanges(checklistItem); + this._context.AddAndSaveChanges(checklistItem); // Act checklistItem.AcqChklstItemStatusTypeCode = "updated"; - var result = _repository.Update(checklistItem); + var result = this._repository.Update(checklistItem); // Assert result.Should().NotBeNull(); @@ -84,7 +84,7 @@ public void Update_Success() public void Update_ThrowIfNull() { // Act - Action act = () => _repository.Update(null); + Action act = () => this._repository.Update(null); // Assert act.Should().Throw(); diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs index 7b4bd94c4e..eb25bb236d 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionFileDocumentRepositoryTest.cs @@ -48,7 +48,6 @@ public void DeleteAcquisition_Success() // Assert result.Should().BeTrue(); - } [Fact] diff --git a/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs index e78283f009..1ffaf1252f 100644 --- a/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AcquisitionRepositoryTest.cs @@ -220,8 +220,7 @@ public void Update_Acquisition_OwnerRep_Add() // Act var acquisitionUpdated = EntityHelper.CreateAcquisitionFile(acqFileId: 1, region: context.PimsRegions.FirstOrDefault()); acquisitionUpdated.PimsInterestHolders.Add( - new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = person.Internal_Id, Comment = "blah blah", InterestHolderTypeCode = "AOREP" } - ); + new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = person.Internal_Id, Comment = "blah blah", InterestHolderTypeCode = "AOREP" }); var result = repository.Update(acquisitionUpdated); @@ -248,8 +247,7 @@ public void Update_Acquisition_OwnerRep_Update() var acqFile = EntityHelper.CreateAcquisitionFile(region: context.PimsRegions.FirstOrDefault()); acqFile.PimsInterestHolders.Add( - new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = person.Internal_Id, Comment = "blah blah", InterestHolderTypeCode = "AOREP" } - ); + new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = person.Internal_Id, Comment = "blah blah", InterestHolderTypeCode = "AOREP" }); context.AddAndSaveChanges(acqFile); var repository = helper.CreateRepository(user); @@ -257,8 +255,7 @@ public void Update_Acquisition_OwnerRep_Update() // Act var acquisitionUpdated = EntityHelper.CreateAcquisitionFile(acqFileId: 1, region: context.PimsRegions.FirstOrDefault()); acquisitionUpdated.PimsInterestHolders.Add( - new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = updatePerson.Internal_Id, Comment = "updated comment", InterestHolderTypeCode = "AOREP" } - ); + new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = updatePerson.Internal_Id, Comment = "updated comment", InterestHolderTypeCode = "AOREP" }); var result = repository.Update(acquisitionUpdated); @@ -283,8 +280,7 @@ public void Update_Acquisition_OwnerRep_Remove() var acqFile = EntityHelper.CreateAcquisitionFile(region: context.PimsRegions.FirstOrDefault()); acqFile.PimsInterestHolders.Add( - new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = person.Internal_Id, Comment = "blah blah", InterestHolderTypeCode = "AOREP" } - ); + new PimsInterestHolder() { AcquisitionFileId = acqFile.Internal_Id, PersonId = person.Internal_Id, Comment = "blah blah", InterestHolderTypeCode = "AOREP" }); context.AddAndSaveChanges(acqFile); var repository = helper.CreateRepository(user); diff --git a/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs index c3b562ee5a..465eb20cca 100644 --- a/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs @@ -114,7 +114,6 @@ public void SearchAgreement() } #endregion - #endregion } } diff --git a/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs index f9d424e64b..b891f6f2c8 100644 --- a/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/BusinessFunctionCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class BusinessFunctionCodeRepositoryTest private BusinessFunctionCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null); diff --git a/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs index 891ad3e313..5e9d9e912b 100644 --- a/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ChartOfAccountsCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class ChartOfAccountsCodeRepositoryTest private ChartOfAccountsCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null); diff --git a/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs index 6322ca2c54..ed890decb9 100644 --- a/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs @@ -26,14 +26,14 @@ public class CompReqFinancialRepositoryTest public CompReqFinancialRepositoryTest() { - _helper = new TestHelper(); + this._helper = new TestHelper(); } private CompReqFinancialRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -46,11 +46,11 @@ public void GetAll_Success() CompensationRequisition = new PimsCompensationRequisition() { IsDraft = true, - AcquisitionFileId = 1 - } + AcquisitionFileId = 1, + }, }; - var repository = CreateWithPermissions(Permissions.CompensationRequisitionView); - _helper.AddAndSaveChanges(codeToAdd); + var repository = this.CreateWithPermissions(Permissions.CompensationRequisitionView); + this._helper.AddAndSaveChanges(codeToAdd); // Act var result = repository.GetAllByAcquisitionFileId(1, false); @@ -71,11 +71,11 @@ public void GetAll_FinalOnly() CompensationRequisition = new PimsCompensationRequisition() { IsDraft = true, - AcquisitionFileId = 1 - } + AcquisitionFileId = 1, + }, }; - var repository = CreateWithPermissions(Permissions.CompensationRequisitionView); - _helper.AddAndSaveChanges(codeToAdd); + var repository = this.CreateWithPermissions(Permissions.CompensationRequisitionView); + this._helper.AddAndSaveChanges(codeToAdd); // Act var result = repository.GetAllByAcquisitionFileId(1, true); @@ -90,7 +90,7 @@ public void GetAll_FinalOnly() public void GetAll_ThrowIfNotAuthorized() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.GetAllByAcquisitionFileId(1, true); @@ -113,12 +113,12 @@ public void SearchCompensationRequisitionFinancials_Project() CompensationRequisition = new PimsCompensationRequisition { AcquisitionFileId = acqFile.Internal_Id, - AcquisitionFile = acqFile - } + AcquisitionFile = acqFile, + }, }; - var repository = CreateWithPermissions(Permissions.AcquisitionFileAdd); - _helper.AddAndSaveChanges(financial); + var repository = this.CreateWithPermissions(Permissions.AcquisitionFileAdd); + this._helper.AddAndSaveChanges(financial); // Act var filter = new AcquisitionReportFilterModel() { Projects = new List { 1 } }; @@ -142,12 +142,12 @@ public void SearchCompensationRequisitionFinancials_AlternateProject() AcquisitionFileId = acqFile.Internal_Id, AcquisitionFile = acqFile, AlternateProject = new PimsProject() { Id = 1 }, - AlternateProjectId = 1 - } + AlternateProjectId = 1, + }, }; - var repository = CreateWithPermissions(Permissions.AcquisitionFileAdd); - _helper.AddAndSaveChanges(financial); + var repository = this.CreateWithPermissions(Permissions.AcquisitionFileAdd); + this._helper.AddAndSaveChanges(financial); // Act var filter = new AcquisitionReportFilterModel() { Projects = new List { 1 } }; @@ -170,12 +170,12 @@ public void SearchCompensationRequisitionFinancials_Team() CompensationRequisition = new PimsCompensationRequisition { AcquisitionFileId = acqFile.Internal_Id, - AcquisitionFile = acqFile - } + AcquisitionFile = acqFile, + }, }; - var repository = CreateWithPermissions(Permissions.AcquisitionFileAdd); - _helper.AddAndSaveChanges(financial); + var repository = this.CreateWithPermissions(Permissions.AcquisitionFileAdd); + this._helper.AddAndSaveChanges(financial); // Act var filter = new AcquisitionReportFilterModel() { AcquisitionTeamPersons = new List { 1 } }; diff --git a/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs index be001daa0d..9eb07b3e07 100644 --- a/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/CostTypeCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class CostTypeCodeRepositoryTest private CostTypeCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null); diff --git a/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs index e262978578..975b7c4bbd 100644 --- a/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/FinancialActivityCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class FinancialActivityCodeRepositoryTest private FinancialActivityCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null); diff --git a/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs index e602419d12..194684dd74 100644 --- a/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/H120CategoryRepositoryTest.cs @@ -26,8 +26,8 @@ public class H120CategoryRepositoryTest private H120CategoryRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -39,8 +39,8 @@ public void GetAll_Success() H120CategoryId = 1, Description = "Bar", }; - var repository = CreateWithPermissions(Permissions.CompensationRequisitionView); - _helper.AddAndSaveChanges(codeToAdd); + var repository = this.CreateWithPermissions(Permissions.CompensationRequisitionView); + this._helper.AddAndSaveChanges(codeToAdd); // Act var result = repository.GetAll(); @@ -55,7 +55,7 @@ public void GetAll_Success() public void Add_ThrowIfNotAuthorized() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.GetAll(); diff --git a/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs index 077a0465f1..70e9b8504f 100644 --- a/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/InterestHolderRepositoryTest.cs @@ -59,7 +59,7 @@ public void Get_Success() InterestHolderTypeCodeNavigation = new PimsInterestHolderType() { InterestHolderTypeCode = "test", - } + }, }; helper.AddAndSaveChanges(interestHolder); @@ -126,7 +126,7 @@ public void Update_AddMultiple() // Act var response = repository.UpdateAllForAcquisition(1, new List() { new PimsInterestHolder() { AcquisitionFileId = 1, PersonId = 1, PimsInthldrPropInterests = new List() }, - new PimsInterestHolder() { AcquisitionFileId = 1, PersonId = 2, PimsInthldrPropInterests = new List() }}); + new PimsInterestHolder() { AcquisitionFileId = 1, PersonId = 2, PimsInthldrPropInterests = new List() },}); // Assert context.PimsAcquisitionFiles.FirstOrDefault().PimsInterestHolders.Should().HaveCount(2); @@ -147,7 +147,7 @@ public void Update_AddGrandchild() // Act var response = repository.UpdateAllForAcquisition(1, new List() { new PimsInterestHolder() { AcquisitionFileId = 1, PersonId = 1, - PimsInthldrPropInterests = new List() { new PimsInthldrPropInterest() { PropertyAcquisitionFileId = 1 } } } }); + PimsInthldrPropInterests = new List() { new PimsInthldrPropInterest() { PropertyAcquisitionFileId = 1 } }, }, }); // Assert context.PimsAcquisitionFiles.FirstOrDefault().PimsInterestHolders.Should().HaveCount(1); @@ -170,7 +170,7 @@ public void Update_UpdateGrandchild() PersonId = 1, InterestHolderId = 1, PimsInthldrPropInterests = new List() { - new PimsInthldrPropInterest() { PimsInthldrPropInterestId = 1, PropertyAcquisitionFileId = 1, PimsPropInthldrInterestTypes = new List(){new PimsPropInthldrInterestType(){InterestHolderInterestTypeCode="TEST_PimsPropInthldrInterestType"}} } } + new PimsInthldrPropInterest() { PimsInthldrPropInterestId = 1, PropertyAcquisitionFileId = 1, PimsPropInthldrInterestTypes = new List() {new PimsPropInthldrInterestType() {InterestHolderInterestTypeCode="TEST_PimsPropInthldrInterestType"}} }, }, }; interestHolder.AcquisitionFile = EntityHelper.CreateAcquisitionFile(1); helper.AddAndSaveChanges(interestHolder); @@ -179,10 +179,10 @@ public void Update_UpdateGrandchild() var response = repository.UpdateAllForAcquisition(1, new List() { new PimsInterestHolder() { AcquisitionFileId = 1, PersonId = 1, InterestHolderId = 1, PimsInthldrPropInterests = new List() { new PimsInthldrPropInterest() { PimsInthldrPropInterestId = 1, PropertyAcquisitionFileId = 2, - PimsPropInthldrInterestTypes = new List(){ + PimsPropInthldrInterestTypes = new List() { new PimsPropInthldrInterestType() { InterestHolderInterestTypeCode="TEST_PimsPropInthldrInterestType"} } - } } } }); + } }, }, }); // Assert context.PimsInterestHolders.Should().HaveCount(1); @@ -242,7 +242,7 @@ public void Update_DeleteChild() AcquisitionFileId = 1, PersonId = 1, InterestHolderId = 1, - PimsInthldrPropInterests = new List() + PimsInthldrPropInterests = new List(), }; var interestHolderPropertyInterest = new PimsInthldrPropInterest() { @@ -251,8 +251,8 @@ public void Update_DeleteChild() InterestHolderId = 1, InterestHolder = interestHolder, PimsPropInthldrInterestTypes = new List() { - new PimsPropInthldrInterestType() { InterestHolderInterestTypeCode = "test" } - } + new PimsPropInthldrInterestType() { InterestHolderInterestTypeCode = "test" }, + }, }; interestHolder.PimsInthldrPropInterests.Add(interestHolderPropertyInterest); interestHolder.AcquisitionFile = EntityHelper.CreateAcquisitionFile(1); diff --git a/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs index 56bc928c78..eff56be4ef 100644 --- a/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/NoteRepositoryTest.cs @@ -30,21 +30,21 @@ public void Add_Success() var helper = new TestHelper(); var user = PrincipalHelper.CreateForPermission(Permissions.NoteAdd); - var activity = EntityHelper.CreateActivity(1); + var acquisitionFile = EntityHelper.CreateAcquisitionFile(1); - var context = helper.CreatePimsContext(user, true).AddAndSaveChanges(activity); + var context = helper.CreatePimsContext(user, true).AddAndSaveChanges(acquisitionFile); var repository = helper.CreateRepository(user); - var activityNote = EntityHelper.CreateActivityNote(activity); + var activityNote = EntityHelper.CreateAcquisitionFileNote(acquisitionFile); // Act var result = repository.Add(activityNote); // Assert result.Should().NotBeNull(); - result.Should().BeAssignableTo(); + result.Should().BeAssignableTo(); result.Note.NoteTxt.Should().Be("Test Note"); - result.ActivityInstance.ActivityInstanceId.Should().Be(1); + result.AcquisitionFile.AcquisitionFileId.Should().Be(1); } [Fact] @@ -57,7 +57,7 @@ public void Add_ThrowIfNull() var repository = helper.CreateRepository(user); // Act - Action act = () => repository.Add(null); + Action act = () => repository.Add(null); // Assert act.Should().Throw(); @@ -106,7 +106,7 @@ public void GetById_NotFound() #region Get All Notes for Entity [Fact] - public void GetActivityNotes_Success() + public void GetProjectNotes_Success() { // Arrange var helper = new TestHelper(); @@ -114,14 +114,15 @@ public void GetActivityNotes_Success() var note1 = EntityHelper.CreateNote("Test Note 1", id: 1); var note2 = EntityHelper.CreateNote("Test Note 2", id: 2); - var activity = EntityHelper.CreateActivity(1, new[] { note1, note2 }); + var project = EntityHelper.CreateProject(1, "PROJECT_CODE_TEST", "Some Description"); + project.PimsProjectNotes = new List() { new PimsProjectNote() { Note = note1 }, new PimsProjectNote() { Note = note2 } }; - var context = helper.CreatePimsContext(user, true).AddAndSaveChanges(activity); + var context = helper.CreatePimsContext(user, true).AddAndSaveChanges(project); var repository = helper.CreateRepository(user); // Act - var result = repository.GetAllActivityNotesById(1); + var result = repository.GetAllProjectNotesById(1); // Assert result.Should().NotBeNull(); @@ -154,7 +155,7 @@ public void GetAcquisitionFileNotes_Success() } [Fact] - public void GetActivityNotes_NotFound() + public void GetProjectNotes_NotFound() { // Arrange var helper = new TestHelper(); @@ -164,7 +165,7 @@ public void GetActivityNotes_NotFound() var repository = helper.CreateRepository(user); // Act - var result = repository.GetAllActivityNotesById(1); + var result = repository.GetAllProjectNotesById(1); // Assert result.Should().NotBeNull(); @@ -234,19 +235,19 @@ public void Update_KeyNotFound() #region Delete [Fact] - public void Delete_Activity_Success() + public void Delete_Project_Success() { // Arrange var helper = new TestHelper(); var user = PrincipalHelper.CreateForPermission(); - var activityNote = EntityHelper.CreateActivityNote(); - var context = helper.CreatePimsContext(user, true).AddAndSaveChanges(activityNote); + var projectNote = EntityHelper.CreateProjectNote(); + var context = helper.CreatePimsContext(user, true).AddAndSaveChanges(projectNote); var repository = helper.CreateRepository(user); // Act - var deleted = repository.DeleteActivityNotes(1); + var deleted = repository.DeleteProjectNotes(1); // Assert deleted.Should().BeTrue(); diff --git a/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs index e5326b3eea..4fa2d12169 100644 --- a/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ProductRepositoryTest.cs @@ -80,7 +80,7 @@ public void GetByProductBatch_MultipleChanges() var result = repository.GetByProductBatch(new List() { new PimsProduct() { Code = "code1", Description = "desc2" }, - new PimsProduct() { Code = "code2", Description = "desc1" } + new PimsProduct() { Code = "code2", Description = "desc1" }, }, project.Id); // Assert diff --git a/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs index 24fa5ae36c..087a4814e7 100644 --- a/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/ResponsibilityCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class ResponsibilityCodeRepositoryTest private ResponsibilityCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null); diff --git a/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs index a2b09ab99e..8c43f60e23 100644 --- a/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/WorkActivityCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class WorkActivityCodeRepositoryTest private WorkActivityCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null); diff --git a/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs index 273da3a826..31b7c56e1d 100644 --- a/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/YearlyFinancialCodeRepositoryTest.cs @@ -25,8 +25,8 @@ public class YearlyFinancialCodeRepositoryTest private YearlyFinancialCodeRepository CreateWithPermissions(params Permissions[] permissions) { var user = PrincipalHelper.CreateForPermission(permissions); - _helper.CreatePimsContext(user, true); - return _helper.CreateRepository(user); + this._helper.CreatePimsContext(user, true); + return this._helper.CreateRepository(user); } [Fact] @@ -37,10 +37,10 @@ public void Add_Success() { Code = "FOO", Description = "Bar", - EffectiveDate = new DateTime(1995, 07, 20) + EffectiveDate = new DateTime(1995, 07, 20), }; - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act var result = repository.Add(codeToAdd); @@ -56,7 +56,7 @@ public void Add_Success() public void Add_ThrowIfNull() { // Arrange - var repository = CreateWithPermissions(Permissions.SystemAdmin); + var repository = this.CreateWithPermissions(Permissions.SystemAdmin); // Act Action act = () => repository.Add(null);