コード例 #1
0
        public async Task WhenATenancyRefIsGiven_ResponseShouldIncludePaymentsForThatTenancy()
        {
            var gateway = new StubTenanciesGateway();
            var payment = Fake.GeneratePaymentTransactionDetails();

            gateway.SetPaymentTransactionDetails(payment.TenancyRef, payment);

            var listAllPayments = new ListAllPayments(gateway);
            var response        = await listAllPayments.ExecuteAsync(payment.TenancyRef);

            var expectedResponse = new ListAllPayments.PaymentTransactionResponse
            {
                PaymentTransactions = new List <ListAllPayments.PaymentTransaction>
                {
                    new ListAllPayments.PaymentTransaction
                    {
                        Ref         = payment.TransactionRef,
                        Amount      = payment.Amount.ToString("C"),
                        Date        = string.Format("{0:u}", payment.Date),
                        Type        = payment.Type,
                        PropertyRef = payment.PropertyRef,
                        Description = payment.Description
                    }
                }
            };

            expectedResponse.PaymentTransactions[0].Should().BeEquivalentTo(response.PaymentTransactions[0]);
        }
コード例 #2
0
        public async Task WhenGivenATenancyRef_ShouldReturnAPaymentResponse()
        {
            var gateway         = new StubTenanciesGateway();
            var listAllPayments = new ListAllPayments(gateway);

            var payment = Fake.GeneratePaymentTransactionDetails();

            gateway.SetPaymentTransactionDetails(payment.TenancyRef, payment);

            var response = await listAllPayments.ExecuteAsync(payment.TenancyRef);

            Assert.IsType(typeof(ListAllPayments.PaymentTransactionResponse), response);
        }