public void EcsRequestTest()
        {
            var request  = new DescribeImagesRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.NotNull(response);
        }
Beispiel #2
0
        public void TestProductsWithLocationService()
        {
            var request  = new DescribeRegionsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.True(0 < response.Regions.Count);
        }
Beispiel #3
0
        public void TestProductsWithoutLocationService()
        {
            var request  = new ListAccessKeysRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.True(0 < response.AccessKeys.Count);
        }
        public void RamRequestTest()
        {
            var request  = new ListAccessKeysRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.NotNull(response.AccessKeys);
            Assert.NotNull(response.RequestId);
        }
        public void RdsRequestTest()
        {
            var request  = new DescribeRegionsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.NotNull(response);
            Assert.NotNull(response.RequestId);
        }
        public void SlbRequestTest()
        {
            var request  = new DescribeAccessControlListsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.NotNull(response);
            Assert.True(0 <= response.Acls.Count);
        }
        public void VpcRequestTest()
        {
            var request  = new DescribeVpcsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.NotNull(response);
            Assert.True(0 <= response.Vpcs.Count);
        }
        public void EcsHttpDebugTest()
        {
            Environment.SetEnvironmentVariable("DEBUG", "sdk");
            var request  = new DescribeRegionsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.True(null != response.RequestId);
            Assert.Null(Environment.GetEnvironmentVariable("DEBUG"));
        }
        public void ServerUnreachableTest()
        {
            var request = new CommonRequest();

            request.Domain  = "www.serverUnreachableTest.com";
            request.Version = "2018-11-28";
            request.Action  = "serverUnreachableTest";

            Assert.Throws <ClientException>(() => { FeatureCommon.GetDefaultClient().GetCommonResponse(request); });
        }
        public void CdnRequestTest()
        {
            var request = new DescribeCdnCertificateDetailRequest();

            request.CertName = "cdnRequestTest";

            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.NotNull(response);
            Assert.NotNull(response.RequestId);
        }
        public void JsonPostTypeTest()
        {
            var request = new DoActionsRequest();

            request.StackName   = "test";
            request.StackId     = "test";
            request.ContentType = FormatType.JSON;
            request.BodyParameters.Add("test", "test");

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

            Assert.NotNull(exception);
        }
        public void FormPutTypeTest()
        {
            var request = new UpdateStackRequest();

            request.StackName   = "test";
            request.StackId     = "test";
            request.ContentType = FormatType.FORM;
            request.BodyParameters.Add("ContentMD5NotMatched", "test");

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

            Assert.Equal("HTTPBadRequest", exception.ErrorCode);
        }
        public void TestVPCConnectTimeoutWithException()
        {
            var request = new DescribeAccessPointsRequest();

            request.SetConnectTimeoutInMilliSeconds(1);

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

            Assert.NotNull(exception.Message);
        }
        public void BasicRpcConnectionsTest()
        {
            var request = new CommonRequest();

            request.Domain  = "ecs-cn-hangzhou.aliyuncs.com";
            request.Version = "2014-05-26";
            request.Action  = "DescribeAccessPoints";

            var response = FeatureCommon.GetDefaultClient().GetCommonResponse(request);

            Assert.Equal("200", response.HttpStatus.ToString());
            Assert.NotNull(response.Data);
        }
        public void ParameterErrorTest()
        {
            var request = new CommonRequest();

            request.Domain  = "ecs-cn-hangzhou.aliyuncs.com";
            request.Version = "2014-05-26";
            request.Action  = "actionError";

            var response = FeatureCommon.GetDefaultClient().GetCommonResponse(request);
            var content  = Encoding.UTF8.GetString(response.HttpResponse.Content);

            Assert.Contains("Keyword=InvalidParameter", content);
        }
        public void FormPostTypeTest()
        {
            var request = new DoActionsRequest();

            request.StackName   = "test";
            request.StackId     = "test";
            request.ContentType = FormatType.FORM;
            request.BodyParameters.Add("test", "test");

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

            Assert.Equal("HTTPBadRequest", exception.ErrorCode);
            Assert.Equal("No action specified", exception.ErrorMessage);
        }
        public void TestTimeoutPriority()
        {
            var request = new DescribeAccessPointsRequest();

            request.SetConnectTimeoutInMilliSeconds(8000);
            var client = FeatureCommon.GetDefaultClient();

            client.SetConnectTimeoutInMilliSeconds(1);

            var response = client.GetAcsResponse(request);

            client.SetConnectTimeoutInMilliSeconds(5000);
            Assert.True(0 <= response.AccessPointSet.Count);
        }
        public void HttpsModeOfRpcConnectionTest()
        {
            var request = new CommonRequest();

            request.Domain   = "ecs-cn-hangzhou.aliyuncs.com";
            request.Version  = "2014-05-26";
            request.Action   = "DescribeAccessPoints";
            request.Protocol = ProtocolType.HTTPS;

            var response = FeatureCommon.GetDefaultClient().GetCommonResponse(request);

            Assert.Equal(200, response.HttpStatus);
            Assert.NotNull(response.Data);
        }
        public void BasicRoaConnectionsTest()
        {
            var request = new CommonRequest();

            request.Domain     = "ros.aliyuncs.com";
            request.Version    = "2015-09-01";
            request.Action     = "DescribeResourceTypes";
            request.UriPattern = "/resource_types";
            request.Method     = MethodType.GET;

            var response = FeatureCommon.GetDefaultClient().GetCommonResponse(request);

            Assert.Equal("200", response.HttpStatus.ToString());
            Assert.NotNull(response.Data);
        }
        public void HttpsModeOfRoaConnectionTest()
        {
            var request = new CommonRequest();

            request.Domain     = "ros.aliyuncs.com";
            request.Version    = "2015-09-01";
            request.Action     = "DescribeResourceTypes";
            request.UriPattern = "/resource_types";
            request.Method     = MethodType.GET;
            request.Protocol   = ProtocolType.HTTPS;

            var response = FeatureCommon.GetDefaultClient().GetCommonResponse(request);

            Assert.Equal(200, response.HttpStatus);
            Assert.NotNull(response.Data);
        }
        public void HttpProxyWithCredential()
        {
            var client = FeatureCommon.GetDefaultClient();

            var request = new DescribeAccessPointsRequest();

            client.SetHttpProxy("http://*****:*****@localhost:8989");
            var response = client.GetAcsResponse(request);

            var    expectValue = "HTTP/1.1 o_o";
            string actualValue;

            response.HttpResponse.Headers.TryGetValue("Via", out actualValue);

            Assert.Equal(expectValue, actualValue);
            Assert.NotNull(response.HttpResponse.Content);

            client.SetHttpProxy(null);
        }