Ejemplo n.º 1
0
        public static void ClassInitialize()
        {
            //get a OSS client object
            _ossClient = OssClientFactory.CreateOssClientWithProxy();
            //get current class name, which is prefix of bucket/object
            _className = TestContext.CurrentContext.Test.FullName;
            _className = _className.Substring(_className.LastIndexOf('.') + 1).ToLowerInvariant();
            //create the bucket
            _bucketName = OssTestUtils.GetBucketName(_className);
            IOss ossClient = OssClientFactory.CreateOssClient();

            ossClient.CreateBucket(_bucketName);
        }
Ejemplo n.º 2
0
        public void ProxyAuthInvalidTestWithDiffrentHttpClient()
        {
            var key = OssTestUtils.GetObjectKey(_className);

            try
            {
                IOss ossClient = OssClientFactory.CreateOssClientWithProxy(Config.Endpoint,
                                                                           Config.DisabledAccessKeyId, Config.DisabledAccessKeySecret,
                                                                           Config.ProxyHost, Int32.Parse(Config.ProxyPort) + 2, null, null);

                OssTestUtils.ObjectExists(ossClient, _bucketName, key);

                Assert.Fail("Object Exists should not pass when it was invalid authorization");
            }
            catch (WebException e)
            {
                Assert.AreEqual(e.Status, WebExceptionStatus.ProtocolError);
            }
        }