コード例 #1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            Trace.WriteLine("ClassInit");
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            StorageAccount = TestBase.GetCloudStorageAccountFromConfig();

            //init the blob helper for blob related operations
            BlobHelper = new CloudBlobHelper(StorageAccount);

            // import module
            string moduleFilePath = Test.Data.Get("ModuleFilePath");
            if (moduleFilePath.Length > 0)
                PowerShellAgent.ImportModule(moduleFilePath);

            // $context = New-AzureStorageContext -ConnectionString ...
            PowerShellAgent.SetStorageContext(StorageAccount.ToString(true));

            BlockFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            PageFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(BlockFilePath));
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(PageFilePath));

            // Generate block file and page file which are used for uploading
            Helper.GenerateMediumFile(BlockFilePath, 1);
            Helper.GenerateMediumFile(PageFilePath, 1);
        }
コード例 #2
0
        public void UseInvalidAccount()
        {
            Agent agent = new PowerShellAgent();

            // Create an invalid account
            string StorageAccountKey = Test.Data.Get("StorageAccountKey");

            PowerShellAgent.SetStorageContext(INVALID_ACCOUNT_NAME, StorageAccountKey);

            //TODO The test is too large, need to split it into different tests
            StorageContainerTest(agent);

            StorageQueueTest(agent);
            StorageTableTest(agent);

            string BlockFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            string PageFilePath  = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());

            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(BlockFilePath));
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(PageFilePath));
            // Generate block file and page file which are used for uploading
            Helper.GenerateMediumFile(BlockFilePath, 1);
            Helper.GenerateMediumFile(PageFilePath, 1);

            StorageBlobTest(agent, BlockFilePath, StorageBlob.BlobType.BlockBlob);
            StorageBlobTest(agent, PageFilePath, StorageBlob.BlobType.PageBlob);
        }
コード例 #3
0
        public static void MyClassInitialize(TestContext testContext)
        {
            Trace.WriteLine("ClassInit");
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            _StorageAccount = TestBase.GetCloudStorageAccountFromConfig();

            // import module
            string moduleFilePath = Test.Data.Get("ModuleFilePath");

            if (moduleFilePath.Length > 0)
            {
                PowerShellAgent.ImportModule(moduleFilePath);
            }

            // $context = New-AzureStorageContext -ConnectionString ...
            PowerShellAgent.SetStorageContext(_StorageAccount.ToString(true));
        }
コード例 #4
0
        public static void MyClassInitialize(TestContext testContext)
        {
            Trace.WriteLine("ClassInit");
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            // import module
            string moduleFilePath = Test.Data.Get("ModuleFilePath");

            if (moduleFilePath.Length > 0)
            {
                PowerShellAgent.ImportModule(moduleFilePath);
            }

            BlockFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            PageFilePath  = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(BlockFilePath));
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(PageFilePath));

            // Generate block file and page file which are used for uploading
            Helper.GenerateMediumFile(BlockFilePath, 1);
            Helper.GenerateMediumFile(PageFilePath, 1);
        }
コード例 #5
0
        public void UseInvalidAccount()
        {
            Agent agent = new PowerShellAgent();

            // Create an invalid account
            string StorageAccountKey = Test.Data.Get("StorageAccountKey");
            PowerShellAgent.SetStorageContext(INVALID_ACCOUNT_NAME, StorageAccountKey);

            //TODO The test is too large, need to split it into different tests
            StorageContainerTest(agent);

            StorageQueueTest(agent);
            StorageTableTest(agent);

            string BlockFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            string PageFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(BlockFilePath));
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(PageFilePath));
            // Generate block file and page file which are used for uploading
            Helper.GenerateMediumFile(BlockFilePath, 1);
            Helper.GenerateMediumFile(PageFilePath, 1);

            StorageBlobTest(agent, BlockFilePath, StorageBlob.BlobType.BlockBlob);
            StorageBlobTest(agent, PageFilePath, StorageBlob.BlobType.PageBlob);
        }