public void TestAddNewEndPointManually()
        {
            var profile    = DefaultProfile.GetProfile("cn-wenzhou", GetBasicAccessKeyId(), GetBasicAccessKeySecret());
            var testClient = new Acs.Core.DefaultAcsClient(profile);

            DescribeRegionsRequest request = new DescribeRegionsRequest();

            var exceptionMsg = Assert.Throws <ClientException>(() =>
            {
                var response = testClient.GetAcsResponse(request);
            });

            Assert.Equal("Can not find endpoint to access.", exceptionMsg.ErrorMessage);

            DefaultProfile.AddEndpoint("cn-wenzhou", "cn-wenzhou", "Ecs", "abc.cn-wenzhou.endpoint-test.exception.com");

            Assert.Throws <ClientException>(() =>
            {
                testClient.GetAcsResponse(request);
            });
        }
        public void TestAddExistingEndpointManually()
        {
            DescribeRegionsRequest request = new DescribeRegionsRequest();
            var profile    = DefaultProfile.GetProfile("cn-wenzhou", GetBasicAccessKeyId(), GetBasicAccessKeySecret());
            var testClient = new Acs.Core.DefaultAcsClient(profile);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", "Ecs", "abc.cn-hangzhou.endpoint-test.exception.com");

            Assert.Throws <ClientException>(() =>
            {
                testClient.GetAcsResponse(request);
            });
        }
        public void BearerTokenAccessTest()
        {
            BearerTokenCredential bearerTokenCredential = new BearerTokenCredential(GetBearerToken());

            base.profile = DefaultProfile.GetProfile("cn-hangzhou");
            client       = new Acs.Core.DefaultAcsClient(base.profile, bearerTokenCredential);

            ListPhoneNumbersRequest request = new ListPhoneNumbersRequest();

            var exception = Assert.Throws <ClientException>(() =>
            {
                var response = client.GetAcsResponse(request);
            });

            Assert.Equal("InvalidBearerToken.Inactive", exception.ErrorCode);
        }