Esempio n. 1
0
 public void Arrange()
 {
     _fixture     = new Fixture();
     _baseAddress = new Uri(@"http://localhost");
     _httpClient  = new TestHttpClient(_baseAddress);
     _sut         = new BusinessCentralFinancePaymentsService(_httpClient, 3, "XXX", false);
 }
Esempio n. 2
0
        public async Task Then_the_nonsensitive_payment_data_is_logged()
        {
            //Arrange
            var loggerMock = new Mock <ILogger <BusinessCentralFinancePaymentsServiceWithLogging> >();

            _sut = new BusinessCentralFinancePaymentsService(_httpClient, 3, "XXX", false);
            var decorator = new BusinessCentralFinancePaymentsServiceWithLogging(_sut, loggerMock.Object, false);

            _httpClient.SetUpPostAsAsync(HttpStatusCode.Accepted);
            var payment1 = _fixture.Create <PaymentDto>();
            var payment2 = _fixture.Create <PaymentDto>();
            var req1     = payment1.Map(false);
            var req2     = payment2.Map(false);

            //Act
            await decorator.SendPaymentRequests(new List <PaymentDto> {
                payment1, payment2
            });

            //Assert
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req1.ActivityCode);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req1.AccountCode);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req1.CostCentreCode);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req1.RequestorUniquePaymentIdentifier);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req1.DueDate);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req2.ActivityCode);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req2.AccountCode);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req2.CostCentreCode);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req2.RequestorUniquePaymentIdentifier);
            loggerMock.VerifyLogContains(LogLevel.Information, Times.Once(), req2.DueDate);
        }
Esempio n. 3
0
        public void Then_the_PaymentLineDescription_is_constructed_with_uln_obfuscated(long uln, string expected)
        {
            _sut = new BusinessCentralFinancePaymentsService(_httpClient, 3, "XXX", true);

            var payment = _fixture.Build <PaymentDto>()
                          .With(x => x.EarningType, EarningType.FirstPayment)
                          .With(x => x.HashedLegalEntityId, "ABCD")

                          .With(x => x.ULN, uln)
                          .Create();

            var paymentRequest = payment.Map(true);

            paymentRequest.PaymentLineDescription.Should().Be($"Hire a new apprentice (first payment). Employer: ABCD ULN: {expected}");
        }