예제 #1
0
        public static Guid GetMandateId()
        {
            DirectDebitMandatesV2 mandatesResult = null;
            var controller = GetClient().DirectDebitMandates;

            try
            {
                mandatesResult = controller.ListMandates();
            }
            catch (APIException) { };

            Assert.IsTrue(mandatesResult != null);
            Assert.IsTrue(mandatesResult.Mandates.Count > 0);
            return((Guid)mandatesResult.Mandates.First().Uid);
        }
        public async Task TestListMandates()
        {
            // Perform API call
            DirectDebitMandatesV2 result = null;

            try
            {
                result = await _controller.ListMandatesAsync();
            }
            catch (APIException) {};

            // Test response code
            Assert.AreEqual(200, HTTPCallBackHandler.Response.StatusCode,
                            "Status should be 200");

            // Test headers
            var headers = new Dictionary <string, string>();

            headers.Add("Content-Type", "application/json");

            Assert.IsTrue(TestHelper.AreHeadersProperSubsetOf(
                              headers, HTTPCallBackHandler.Response.Headers),
                          "Headers should match");
        }