示例#1
0
        public void Arrange()
        {
            _configuration = new PaymentsEventsApiConfiguration
            {
                ApiBaseUrl  = "some-url/",
                ClientToken = "super_secure_token"
            };

            _transfer = new AccountTransfer
            {
                TransferId        = 1,
                SenderAccountId   = 666,
                ReceiverAccountId = 777,
                Type = TransferType.Levy,
                RequiredPaymentId = Guid.NewGuid(),
                Amount            = 888
            };

            _httpClient = new Mock <SecureHttpClient>(MockBehavior.Strict);
            _httpClient.Setup(c => c.GetAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(JsonConvert.SerializeObject(new PageOfResults <AccountTransfer>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _transfer
                }
            })));

            _client = new Client.PaymentsEventsApiClient(_configuration, _httpClient.Object);
        }
示例#2
0
        public void Arrange()
        {
            _configuration = new Mock <IPaymentsEventsApiConfiguration>();
            _configuration.Setup(m => m.ApiBaseUrl).Returns(ExpectedApiBaseUrl);
            _configuration.Setup(m => m.ClientToken).Returns(ClientToken);

            _transfer = new AccountTransfer
            {
                TransferId        = 1,
                SenderAccountId   = 666,
                ReceiverAccountId = 777,
                Type = TransferType.Levy,
                RequiredPaymentId = Guid.NewGuid(),
                Amount            = 888
            };

            _httpMessageHandlerMock = SetupHttpMessageHandler(JsonConvert.SerializeObject(new PageOfResults <AccountTransfer>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _transfer
                }
            }));

            // use real http client with mocked handler
            var httpClient = new HttpClient(_httpMessageHandlerMock.Object);

            _client = new Client.PaymentsEventsApiClient(_configuration.Object, httpClient);
        }
        public void Arrange()
        {
            _configuration = new Mock <IPaymentsEventsApiConfiguration>();
            _configuration.Setup(m => m.ApiBaseUrl).Returns(ExpectedApiBaseUrl);
            _configuration.Setup(m => m.ClientToken).Returns(ClientToken);

            _httpMessageHandlerMock = SetupHttpMessageHandler(JsonConvert.SerializeObject(
                                                                  new PaymentStatistics()
            {
                TotalNumberOfPayments = 500,
                TotalNumberOfPaymentsWithRequiredPayment = 470
            }));

            // use real http client with mocked handler
            var httpClient = new HttpClient(_httpMessageHandlerMock.Object);

            _client = new Client.PaymentsEventsApiClient(_configuration.Object, httpClient);
        }
示例#4
0
        public void Arrange()
        {
            _configuration = new PaymentsEventsApiConfiguration
            {
                ApiBaseUrl = "some-url/",
                ClientToken = "super_secure_token"
            };

      
            _httpClient = new Mock<SecureHttpClient>();
            _httpClient.Setup(c => c.GetAsync( "some-url/api/v2/payments/statistics"))
                .ReturnsAsync(JsonConvert.SerializeObject(new PaymentStatistics()
                {
                    TotalNumberOfPayments = 500,
                    TotalNumberOfPaymentsWithRequiredPayment = 470
                }));

            _client = new Client.PaymentsEventsApiClient(_configuration, _httpClient.Object);
        }
        public void Arrange()
        {
            _configuration = new PaymentsEventsApiConfiguration
            {
                ApiBaseUrl  = "some-url/",
                ClientToken = "super_secure_token"
            };

            _periodEnd1 = new PeriodEnd
            {
                Id             = "1617-R01",
                CalendarPeriod = new CalendarPeriod
                {
                    Month = 9,
                    Year  = 2016
                },
                ReferenceData = new ReferenceDataDetails
                {
                    AccountDataValidAt    = new DateTime(2016, 9, 1),
                    CommitmentDataValidAt = new DateTime(2016, 9, 2)
                },
                CompletionDateTime = new DateTime(2016, 10, 3),
                Links = new PeriodEndLinks
                {
                    PaymentsForPeriod = "some-other-url"
                }
            };

            _httpClient = new Mock <SecureHttpClient>();
            _httpClient.Setup(c => c.GetAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(JsonConvert.SerializeObject(new[]
            {
                _periodEnd1
            })));

            _client = new Client.PaymentsEventsApiClient(_configuration, _httpClient.Object);
        }
        public void Arrange()
        {
            _configuration = new Mock <IPaymentsEventsApiConfiguration>();
            _configuration.Setup(m => m.ApiBaseUrl).Returns(ExpectedApiBaseUrl);
            _configuration.Setup(m => m.ClientToken).Returns(ClientToken);

            _periodEnd1 = new PeriodEnd
            {
                Id             = "1617-R01",
                CalendarPeriod = new CalendarPeriod
                {
                    Month = 9,
                    Year  = 2016
                },
                ReferenceData = new ReferenceDataDetails
                {
                    AccountDataValidAt    = new DateTime(2016, 9, 1),
                    CommitmentDataValidAt = new DateTime(2016, 9, 2)
                },
                CompletionDateTime = new DateTime(2016, 10, 3),
                Links = new PeriodEndLinks
                {
                    PaymentsForPeriod = "some-other-url"
                }
            };

            _httpMessageHandlerMock = SetupHttpMessageHandler(JsonConvert.SerializeObject(
                                                                  new[]
            {
                _periodEnd1
            }));

            // use real http client with mocked handler
            var httpClient = new HttpClient(_httpMessageHandlerMock.Object);

            _client = new Client.PaymentsEventsApiClient(_configuration.Object, httpClient);
        }
示例#7
0
        public void Arrange()
        {
            _configuration = new PaymentsEventsApiConfiguration
            {
                ApiBaseUrl  = "some-url/",
                ClientToken = "super_secure_token"
            };

            _dasPayment = new Payment
            {
                Id                = Guid.NewGuid().ToString(),
                Ukprn             = 123456,
                Uln               = 987654,
                EmployerAccountId = "ACC001",
                ApprenticeshipId  = 918273,
                DeliveryPeriod    = new CalendarPeriod
                {
                    Month = 8,
                    Year  = 2017
                },
                CollectionPeriod = new NamedCalendarPeriod
                {
                    Month = 9,
                    Year  = 2017
                },
                EvidenceSubmittedOn    = new DateTime(2017, 10, 1),
                EmployerAccountVersion = "A",
                ApprenticeshipVersion  = "B",
                FundingSource          = FundingSource.Levy,
                FundingAccountId       = 69,
                TransactionType        = TransactionType.Learning,
                Amount       = 1234.56m,
                StandardCode = 25,
                ContractType = ContractType.ContractWithEmployer
            };

            _nonDasPayment = new Payment
            {
                Id             = Guid.NewGuid().ToString(),
                Ukprn          = 654321,
                Uln            = 987654,
                DeliveryPeriod = new CalendarPeriod
                {
                    Month = 8,
                    Year  = 2017
                },
                CollectionPeriod = new NamedCalendarPeriod
                {
                    Month = 9,
                    Year  = 2017
                },
                EvidenceSubmittedOn = new DateTime(2017, 10, 1),
                FundingSource       = FundingSource.CoInvestedSfa,
                TransactionType     = TransactionType.Learning,
                Amount        = 987.65m,
                FrameworkCode = 550,
                ProgrammeType = 20,
                PathwayCode   = 6,
                ContractType  = ContractType.ContractWithSfa
            };

            _httpClient = new Mock <SecureHttpClient>();
            _httpClient.Setup(c => c.GetAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(JsonConvert.SerializeObject(new PageOfResults <Payment>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _dasPayment,
                    _nonDasPayment
                }
            })));

            _client = new Client.PaymentsEventsApiClient(_configuration, _httpClient.Object);
        }
        public void Arrange()
        {
            _configuration = new PaymentsEventsApiConfiguration
            {
                ApiBaseUrl  = "some-url/",
                ClientToken = "super_secure_token"
            };

            _dataLockEvent = new DataLockEvent
            {
                Id = 1,
                ProcessDateTime          = new DateTime(2017, 2, 8, 9, 10, 11),
                IlrFileName              = "ILR-123456",
                Ukprn                    = 123456,
                Uln                      = 987654,
                LearnRefNumber           = "Lrn1",
                AimSeqNumber             = 1,
                PriceEpisodeIdentifier   = "25-27-01/05/2017",
                ApprenticeshipId         = 1,
                EmployerAccountId        = 123,
                EventSource              = EventSource.Submission,
                HasErrors                = true,
                IlrStartDate             = new DateTime(2017, 5, 1),
                IlrStandardCode          = 27,
                IlrTrainingPrice         = 12000m,
                IlrEndpointAssessorPrice = 3000m,
                Errors                   = new []
                {
                    new DataLockEventError
                    {
                        ErrorCode         = "Err15",
                        SystemDescription = "Mismatch on price."
                    }
                },
                Periods = new []
                {
                    new DataLockEventPeriod
                    {
                        ApprenticeshipVersion = "1-019",
                        Period = new NamedCalendarPeriod
                        {
                            Id    = "1617-R09",
                            Month = 4,
                            Year  = 2017
                        },
                        IsPayable       = false,
                        TransactionType = TransactionType.Learning
                    },
                    new DataLockEventPeriod
                    {
                        ApprenticeshipVersion = "1-019",
                        Period = new NamedCalendarPeriod
                        {
                            Id    = "1617-R10",
                            Month = 5,
                            Year  = 2017
                        },
                        IsPayable = false
                    }
                },
                Apprenticeships = new []
                {
                    new DataLockEventApprenticeship
                    {
                        Version         = "19",
                        StartDate       = new DateTime(2017, 5, 1),
                        StandardCode    = 27,
                        NegotiatedPrice = 17500m,
                        EffectiveDate   = new DateTime(2017, 5, 1)
                    }
                }
            };

            _httpClient = new Mock <SecureHttpClient>();
            _httpClient.Setup(c => c.GetAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(JsonConvert.SerializeObject(new PageOfResults <DataLockEvent>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _dataLockEvent
                }
            })));

            _client = new Client.PaymentsEventsApiClient(_configuration, _httpClient.Object);
        }
        public void Arrange()
        {
            _configuration = new PaymentsEventsApiConfiguration
            {
                ApiBaseUrl  = "some-url/",
                ClientToken = "super_secure_token"
            };

            _submissionStandardEvent = new SubmissionEvent
            {
                Id                      = 1,
                IlrFileName             = "ILR-123456",
                FileDateTime            = new DateTime(2017, 2, 10, 8, 55, 23),
                SubmittedDateTime       = new DateTime(2017, 2, 10, 8, 59, 13),
                ComponentVersionNumber  = 1,
                Ukprn                   = 123456,
                Uln                     = 987654,
                StandardCode            = 27,
                ActualStartDate         = new DateTime(2017, 4, 1),
                PlannedEndDate          = new DateTime(2018, 5, 1),
                TrainingPrice           = 12000m,
                EndpointAssessorPrice   = 3000m,
                NiNumber                = "AB12345C",
                ApprenticeshipId        = 1,
                AcademicYear            = "1617",
                EmployerReferenceNumber = 123456,
                EPAOrgId                = "EPACodeI"
            };

            _submissionFrameworkEvent = new SubmissionEvent
            {
                Id                      = 1,
                IlrFileName             = "ILR-123456",
                FileDateTime            = new DateTime(2017, 2, 10, 8, 55, 23),
                SubmittedDateTime       = new DateTime(2017, 2, 10, 8, 59, 13),
                ComponentVersionNumber  = 1,
                Ukprn                   = 123456,
                Uln                     = 987654321,
                ProgrammeType           = 20,
                FrameworkCode           = 550,
                PathwayCode             = 6,
                ActualStartDate         = new DateTime(2017, 4, 1),
                PlannedEndDate          = new DateTime(2018, 5, 1),
                TrainingPrice           = 6000m,
                EndpointAssessorPrice   = 1500m,
                NiNumber                = "AB12345C",
                ApprenticeshipId        = 9,
                AcademicYear            = "1617",
                EmployerReferenceNumber = 123456,
                EPAOrgId                = "EPACodeI"
            };

            _httpClient = new Mock <SecureHttpClient>();
            _httpClient.Setup(c => c.GetAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(JsonConvert.SerializeObject(new PageOfResults <SubmissionEvent>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _submissionStandardEvent,
                    _submissionFrameworkEvent
                }
            })));

            _client = new Client.PaymentsEventsApiClient(_configuration, _httpClient.Object);
        }
        public void Arrange()
        {
            _configuration = new Mock <IPaymentsEventsApiConfiguration>();
            _configuration.Setup(m => m.ApiBaseUrl).Returns(ExpectedApiBaseUrl);
            _configuration.Setup(m => m.ClientToken).Returns(ClientToken);

            _submissionEvents = new List <SubmissionEvent>
            {
                new SubmissionEvent
                {
                    Id                      = 1,
                    IlrFileName             = "ILR-123456",
                    FileDateTime            = new DateTime(2017, 2, 10, 8, 55, 23),
                    SubmittedDateTime       = new DateTime(2017, 2, 10, 8, 59, 13),
                    ComponentVersionNumber  = 1,
                    Ukprn                   = 123456,
                    Uln                     = 987654321,
                    StandardCode            = 27,
                    ActualStartDate         = new DateTime(2017, 4, 1),
                    PlannedEndDate          = new DateTime(2018, 5, 1),
                    TrainingPrice           = 12000m,
                    EndpointAssessorPrice   = 3000m,
                    NiNumber                = "AB12345C",
                    ApprenticeshipId        = 1,
                    AcademicYear            = "1617",
                    EmployerReferenceNumber = 123456,
                    EPAOrgId                = "EPACodeI",
                    FamilyName              = "Jones",
                    GivenNames              = "David",
                    CompStatus              = 1
                },
                new SubmissionEvent
                {
                    Id                      = 1,
                    IlrFileName             = "ILR-123456",
                    FileDateTime            = new DateTime(2017, 2, 10, 8, 55, 23),
                    SubmittedDateTime       = new DateTime(2017, 2, 10, 8, 59, 13),
                    ComponentVersionNumber  = 1,
                    Ukprn                   = 123456,
                    Uln                     = 987654321,
                    ProgrammeType           = 20,
                    FrameworkCode           = 550,
                    PathwayCode             = 6,
                    ActualStartDate         = new DateTime(2017, 4, 1),
                    PlannedEndDate          = new DateTime(2018, 5, 1),
                    TrainingPrice           = 6000m,
                    EndpointAssessorPrice   = 1500m,
                    NiNumber                = "AB12345C",
                    ApprenticeshipId        = 9,
                    AcademicYear            = "1617",
                    EmployerReferenceNumber = 123456,
                    EPAOrgId                = "EPACodeI",
                    FamilyName              = "Jones",
                    GivenNames              = "David",
                    StandardCode            = 12,
                    CompStatus              = 1
                }
            };

            _httpMessageHandlerMock = SetupHttpMessageHandler(JsonConvert.SerializeObject(_submissionEvents));

            // use real http client with mocked handler
            var httpClient = new HttpClient(_httpMessageHandlerMock.Object);

            _client = new Client.PaymentsEventsApiClient(_configuration.Object, httpClient);
        }
        public void Arrange()
        {
            _configuration = new Mock <IPaymentsEventsApiConfiguration>();
            _configuration.Setup(m => m.ApiBaseUrl).Returns(ExpectedApiBaseUrl);
            _configuration.Setup(m => m.ClientToken).Returns(ClientToken);
            _dataLockEvent = new DataLockEvent
            {
                Id = 1,
                ProcessDateTime          = new DateTime(2017, 2, 8, 9, 10, 11),
                IlrFileName              = "ILR-123456",
                Ukprn                    = 123456,
                Uln                      = 987654,
                LearnRefNumber           = "Lrn1",
                AimSeqNumber             = 1,
                PriceEpisodeIdentifier   = "25-27-01/05/2017",
                ApprenticeshipId         = 1,
                EmployerAccountId        = 123,
                EventSource              = EventSource.Submission,
                HasErrors                = true,
                IlrStartDate             = new DateTime(2017, 5, 1),
                IlrStandardCode          = 27,
                IlrTrainingPrice         = 12000m,
                IlrEndpointAssessorPrice = 3000m,
                Errors                   = new[]
                {
                    new DataLockEventError
                    {
                        ErrorCode         = "Err15",
                        SystemDescription = "Mismatch on price."
                    }
                },
                Periods = new[]
                {
                    new DataLockEventPeriod
                    {
                        ApprenticeshipVersion = "1-019",
                        Period = new NamedCalendarPeriod
                        {
                            Id    = "1617-R09",
                            Month = 4,
                            Year  = 2017
                        },
                        IsPayable       = false,
                        TransactionType = TransactionType.Learning
                    },
                    new DataLockEventPeriod
                    {
                        ApprenticeshipVersion = "1-019",
                        Period = new NamedCalendarPeriod
                        {
                            Id    = "1617-R10",
                            Month = 5,
                            Year  = 2017
                        },
                        IsPayable = false
                    }
                },
                Apprenticeships = new[]
                {
                    new DataLockEventApprenticeship
                    {
                        Version         = "19",
                        StartDate       = new DateTime(2017, 5, 1),
                        StandardCode    = 27,
                        NegotiatedPrice = 17500m,
                        EffectiveDate   = new DateTime(2017, 5, 1)
                    }
                }
            };

            _httpMessageHandlerMock = SetupHttpMessageHandler(JsonConvert.SerializeObject(
                                                                  new PageOfResults <DataLockEvent>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _dataLockEvent
                }
            }));

            // use real http client with mocked handler
            var httpClient = new HttpClient(_httpMessageHandlerMock.Object);

            _client = new Client.PaymentsEventsApiClient(_configuration.Object, httpClient);
        }
        public void Arrange()
        {
            _configuration = new Mock <IPaymentsEventsApiConfiguration>();
            _configuration.Setup(m => m.ApiBaseUrl).Returns(ExpectedApiBaseUrl);
            _configuration.Setup(m => m.ClientToken).Returns(ClientToken);

            _dasPayment = new Payment
            {
                Id                = Guid.NewGuid().ToString(),
                Ukprn             = 123456,
                Uln               = 987654,
                EmployerAccountId = "ACC001",
                ApprenticeshipId  = 918273,
                DeliveryPeriod    = new CalendarPeriod
                {
                    Month = 8,
                    Year  = 2017
                },
                CollectionPeriod = new NamedCalendarPeriod
                {
                    Month = 9,
                    Year  = 2017
                },
                EvidenceSubmittedOn    = new DateTime(2017, 10, 1),
                EmployerAccountVersion = "A",
                ApprenticeshipVersion  = "B",
                FundingSource          = FundingSource.Levy,
                FundingAccountId       = 69,
                TransactionType        = TransactionType.Learning,
                Amount       = 1234.56m,
                StandardCode = 25,
                ContractType = ContractType.ContractWithEmployer
            };

            _nonDasPayment = new Payment
            {
                Id             = Guid.NewGuid().ToString(),
                Ukprn          = 654321,
                Uln            = 987654,
                DeliveryPeriod = new CalendarPeriod
                {
                    Month = 8,
                    Year  = 2017
                },
                CollectionPeriod = new NamedCalendarPeriod
                {
                    Month = 9,
                    Year  = 2017
                },
                EvidenceSubmittedOn = new DateTime(2017, 10, 1),
                FundingSource       = FundingSource.CoInvestedSfa,
                TransactionType     = TransactionType.Learning,
                Amount        = 987.65m,
                FrameworkCode = 550,
                ProgrammeType = 20,
                PathwayCode   = 6,
                ContractType  = ContractType.ContractWithSfa
            };

            _httpMessageHandlerMock = SetupHttpMessageHandler(JsonConvert.SerializeObject(
                                                                  new PageOfResults <Payment>
            {
                PageNumber         = 1,
                TotalNumberOfPages = 2,
                Items = new[]
                {
                    _dasPayment,
                    _nonDasPayment
                }
            }));

            // use real http client with mocked handler
            var httpClient = new HttpClient(_httpMessageHandlerMock.Object);

            _client = new Client.PaymentsEventsApiClient(_configuration.Object, httpClient);
        }