public void MapContractAllocation_Deliverables()
        {
            var contractAllocationNumber = "contractAllocationNumber";
            var fundingStreamCode        = "fundingStreamCode";
            var fundingStreamPeriodCode  = "fundingStreamPeriodCode";
            var period         = "period";
            var periodTypeCode = periodTypeCodeType.LEVY;
            var uopCode        = "uopCode";
            var startDate      = new DateTime(2017, 1, 1);
            var endDate        = new DateTime(2018, 1, 1);

            var fcsContractAllocation = new contractAllocationsContractAllocation()
            {
                contractAllocationNumber = contractAllocationNumber,
                fundingStream            = new fundingStream()
                {
                    fundingStreamCode = fundingStreamCode
                },
                fundingStreamPeriodCode = fundingStreamPeriodCode,
                period = new period()
                {
                    period1    = period,
                    periodType = new periodTypeType()
                    {
                        periodTypeCode = periodTypeCode
                    }
                },
                uopCode              = uopCode,
                startDateSpecified   = true,
                startDate            = startDate,
                endDateSpecified     = true,
                endDate              = endDate,
                contractDeliverables = new []
                {
                    new contractDeliverablesTypeContractDeliverable(),
                }
            };

            var contractAllocation = NewService().MapContractAllocation(fcsContractAllocation);

            contractAllocation.ContractAllocationNumber.Should().Be(contractAllocationNumber);
            contractAllocation.FundingStreamCode.Should().Be(fundingStreamCode);
            contractAllocation.FundingStreamPeriodCode.Should().Be(fundingStreamPeriodCode);
            contractAllocation.Period.Should().Be(period);
            contractAllocation.PeriodTypeCode.Should().Be("LEVY");
            contractAllocation.UoPCode.Should().Be(uopCode);
            contractAllocation.StartDate.Should().Be(startDate);
            contractAllocation.EndDate.Should().Be(endDate);
            contractAllocation.ContractDeliverables.Should().HaveCount(1);
        }
        public void FlattenContractAllocations()
        {
            var contractAllocation = new contractAllocationsContractAllocation()
            {
                contractAllocations = new[]
                {
                    new contractAllocationsContractAllocation(),
                    new contractAllocationsContractAllocation(),
                    new contractAllocationsContractAllocation(),
                }
            };

            NewService().FlattenContractAllocations(contractAllocation).Should().HaveCount(4);
        }
        public void MapContractAllocation_NullDates()
        {
            var contractAllocationNumber = "contractAllocationNumber";
            var fundingStreamCode        = "fundingStreamCode";
            var fundingStreamPeriodCode  = "fundingStreamPeriodCode";
            var period         = "period";
            var periodTypeCode = periodTypeCodeType.LEVY;
            var uopCode        = "uopCode";

            var fcsContractAllocation = new contractAllocationsContractAllocation()
            {
                contractAllocationNumber = contractAllocationNumber,
                fundingStream            = new fundingStream()
                {
                    fundingStreamCode = fundingStreamCode
                },
                fundingStreamPeriodCode = fundingStreamPeriodCode,
                period = new period()
                {
                    period1    = period,
                    periodType = new periodTypeType()
                    {
                        periodTypeCode = periodTypeCode
                    }
                },
                uopCode            = uopCode,
                startDateSpecified = false,
                endDateSpecified   = false,
            };

            var contractAllocation = NewService().MapContractAllocation(fcsContractAllocation);

            contractAllocation.ContractAllocationNumber.Should().Be(contractAllocationNumber);
            contractAllocation.FundingStreamCode.Should().Be(fundingStreamCode);
            contractAllocation.FundingStreamPeriodCode.Should().Be(fundingStreamPeriodCode);
            contractAllocation.Period.Should().Be(period);
            contractAllocation.PeriodTypeCode.Should().Be("LEVY");
            contractAllocation.UoPCode.Should().Be(uopCode);
            contractAllocation.StartDate.Should().BeNull();
            contractAllocation.EndDate.Should().BeNull();
        }
Exemplo n.º 4
0
        public ContractAllocation MapContractAllocation(contractAllocationsContractAllocation contractAllocation)
        {
            IEnumerable <ContractDeliverable> contractDeliverables = new List <ContractDeliverable>();

            if (contractAllocation.contractDeliverables != null)
            {
                contractDeliverables = contractAllocation.contractDeliverables.SelectMany(FlattenContractDeliverables).Select(MapContractDeliverable);
            }

            return(new ContractAllocation()
            {
                ContractAllocationNumber = contractAllocation.contractAllocationNumber,
                FundingStreamCode = contractAllocation.fundingStream?.fundingStreamCode,
                FundingStreamPeriodCode = contractAllocation.fundingStreamPeriodCode,
                Period = contractAllocation.period?.period1,
                PeriodTypeCode = contractAllocation.period?.periodType?.periodTypeCode.ToString(),
                UoPCode = contractAllocation.uopCode,
                StartDate = contractAllocation.startDateSpecified ? contractAllocation.startDate : default(DateTime?),
                EndDate = contractAllocation.endDateSpecified ? contractAllocation.endDate : null,
                ContractDeliverables = contractDeliverables.ToList()
            });
        }
Exemplo n.º 5
0
 public IEnumerable <contractAllocationsContractAllocation> FlattenContractAllocations(contractAllocationsContractAllocation contractAllocation)
 {
     return(contractAllocation.SelectRecursive(ca => ca.contractAllocations));
 }