Пример #1
0
        public static Tenancy ToDomain(this UhTenancyAgreement uhTenancyAgreement, UhAgreementType agreementType, UhTenureType tenureType, UHProperty property = null)
        {
            var tenure = tenureType == null
                ? null
                : $"{tenureType.UhTenureTypeId.Trim()}: {tenureType.Description.Trim()}";
            var agreement = agreementType?.UhAgreementTypeId == null
                ? null
                : $"{agreementType.UhAgreementTypeId.Trim()}: {agreementType.Description?.Trim()}";

            return(new Tenancy
            {
                TenancyAgreementReference = uhTenancyAgreement?.TenancyAgreementReference?.Trim(),
                CommencementOfTenancyDate = CheckDateOfBirthForNullValue(uhTenancyAgreement.CommencementOfTenancy),
                EndOfTenancyDate = CheckDateOfBirthForNullValue(uhTenancyAgreement.EndOfTenancy),
                CurrentBalance = uhTenancyAgreement.CurrentRentBalance,
                Present = uhTenancyAgreement.IsPresent,
                Terminated = uhTenancyAgreement.IsTerminated,
                PaymentReference = uhTenancyAgreement.PaymentReference,
                HouseholdReference = uhTenancyAgreement.HouseholdReference,
                PropertyReference = uhTenancyAgreement.PropertyReference,
                Service = uhTenancyAgreement.ServiceCharge,
                OtherCharge = uhTenancyAgreement.OtherCharges,
                Tenure = tenure,
                Agreement = agreement,
                Address = property?.AddressLine1.Trim(),
                Postcode = property?.Postcode.Trim()
            });
        }
Пример #2
0
        public void ToDomainWillMapDataWithOnlyMinimalRequiredData()
        {
            var tenure = new UhTenancyAgreement
            {
                IsPresent    = true,
                IsTerminated = false,
                TenancyAgreementReference = "12345/3"
            };
            var typeLookup = new UhAgreementType
            {
                UhAgreementTypeId = "M",
                Description       = "describing"
            };

            tenure.ToDomain(typeLookup).Should().BeEquivalentTo(new Tenancy
            {
                Present    = true,
                Terminated = false,
                TenancyAgreementReference = "12345/3",
                Agreement = "M: describing",
            });
        }
Пример #3
0
        public void ToDomainWillMapAddressDataFromTheProperty()
        {
            var tenure = new UhTenancyAgreement
            {
                IsPresent    = true,
                IsTerminated = false,
                TenancyAgreementReference = "12345/3"
            };
            var typeLookup = new UhAgreementType
            {
                UhAgreementTypeId = "M",
                Description       = "describing"
            };
            var property = new UHProperty
            {
                PropertyReference = "12333",
                AddressLine1      = "1 Hillman Road",
                Postcode          = "E8 1JJ"
            };
            var domain = tenure.ToDomain(typeLookup, property);

            domain.Address.Should().Be("1 Hillman Road");
            domain.Postcode.Should().Be("E8 1JJ");
        }
Пример #4
0
 public static Tenancy ToDomain(this UhTenancyAgreement uhTenancyAgreement, UhAgreementType agreementType, UHProperty property = null)
 {
     return(uhTenancyAgreement.ToDomain(agreementType, uhTenancyAgreement.UhTenureType, property));
 }