public IEnumerable <LearnerPeriod> PivotLearnerPeriodisedValue(LearnerPeriodisedValues learnerPeriodisedValue)
 {
     return(new List <LearnerPeriod>()
     {
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 1, LnrOnProgPay = learnerPeriodisedValue.Period1
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 2, LnrOnProgPay = learnerPeriodisedValue.Period2
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 3, LnrOnProgPay = learnerPeriodisedValue.Period3
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 4, LnrOnProgPay = learnerPeriodisedValue.Period4
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 5, LnrOnProgPay = learnerPeriodisedValue.Period5
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 6, LnrOnProgPay = learnerPeriodisedValue.Period6
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 7, LnrOnProgPay = learnerPeriodisedValue.Period7
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 8, LnrOnProgPay = learnerPeriodisedValue.Period8
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 9, LnrOnProgPay = learnerPeriodisedValue.Period9
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 10, LnrOnProgPay = learnerPeriodisedValue.Period10
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 11, LnrOnProgPay = learnerPeriodisedValue.Period11
         },
         new LearnerPeriod()
         {
             LearnRefNumber = learnerPeriodisedValue.LearnRefNumber, Period = 12, LnrOnProgPay = learnerPeriodisedValue.Period12
         }
     });
 }
        public void PivotLearnerPeriodisedValue()
        {
            var learnerPeriodisedValue = new LearnerPeriodisedValues()
            {
                AttributeName  = "LnrOnProgPay",
                LearnRefNumber = "LearnRefNumber",
                Period1        = 1.1m,
                Period2        = 2.1m,
                Period3        = 3.1m,
                Period4        = 4.1m,
                Period5        = 5.1m,
                Period6        = 6.1m,
                Period7        = 7.1m,
                Period8        = 8.1m,
                Period9        = 9.1m,
                Period10       = 10.1m,
                Period11       = 11.1m,
                Period12       = 12.1m,
            };

            var pivoted = NewService().PivotLearnerPeriodisedValue(learnerPeriodisedValue).ToList();

            pivoted.Should().OnlyContain(p => p.LearnRefNumber == learnerPeriodisedValue.LearnRefNumber);

            pivoted[0].Period.Should().Be(1);
            pivoted[1].Period.Should().Be(2);
            pivoted[2].Period.Should().Be(3);
            pivoted[3].Period.Should().Be(4);
            pivoted[4].Period.Should().Be(5);
            pivoted[5].Period.Should().Be(6);
            pivoted[6].Period.Should().Be(7);
            pivoted[7].Period.Should().Be(8);
            pivoted[8].Period.Should().Be(9);
            pivoted[9].Period.Should().Be(10);
            pivoted[10].Period.Should().Be(11);
            pivoted[11].Period.Should().Be(12);

            pivoted[0].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period1);
            pivoted[1].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period2);
            pivoted[2].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period3);
            pivoted[3].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period4);
            pivoted[4].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period5);
            pivoted[5].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period6);
            pivoted[6].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period7);
            pivoted[7].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period8);
            pivoted[8].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period9);
            pivoted[9].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period10);
            pivoted[10].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period11);
            pivoted[11].LnrOnProgPay.Should().Be(learnerPeriodisedValue.Period12);
        }
예제 #3
0
 public FM25_FM35_Learner_PeriodisedValue BuildFM25_35_LearnerPeriodisedValues(LearnerPeriodisedValues learnerPeriodisedValues, int ukprn, string learnRefNumber)
 {
     return(new FM25_FM35_Learner_PeriodisedValue()
     {
         UKPRN = ukprn,
         LearnRefNumber = learnRefNumber,
         AttributeName = learnerPeriodisedValues.AttributeName,
         Period_1 = learnerPeriodisedValues.Period1,
         Period_2 = learnerPeriodisedValues.Period2,
         Period_3 = learnerPeriodisedValues.Period3,
         Period_4 = learnerPeriodisedValues.Period4,
         Period_5 = learnerPeriodisedValues.Period5,
         Period_6 = learnerPeriodisedValues.Period6,
         Period_7 = learnerPeriodisedValues.Period7,
         Period_8 = learnerPeriodisedValues.Period8,
         Period_9 = learnerPeriodisedValues.Period9,
         Period_10 = learnerPeriodisedValues.Period10,
         Period_11 = learnerPeriodisedValues.Period11,
         Period_12 = learnerPeriodisedValues.Period12
     });
 }