Ejemplo n.º 1
0
        public void DownloadWithInvalidKeyValueTest()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = fileUtil.DeleteFileIfExists(this.fileShare, cloudFileName);

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.DownloadFile(this.fileShare.Name, file.Name, Test.Data.Get("TempDir"), true, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
        }
Ejemplo n.º 2
0
        public void DownloadWithInvalidAccountTest()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            var    file          = fileUtil.DeleteFileIfExists(this.fileShare, cloudFileName);

            // Creates an storage context object with invalid account
            // name.
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountName: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.DownloadFile(this.fileShare.Name, file.Name, Test.Data.Get("TempDir"), true, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AccountIsDisabledFullQualifiedErrorId, AssertUtil.NameResolutionFailureFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId, AssertUtil.InvalidResourceFullQualifiedErrorId));
        }
Ejemplo n.º 3
0
        public void RemoveFileWithInvalidKeyValueTest()
        {
            string fileName = CloudFileUtil.GenerateUniqueFileName();

            fileUtil.CreateFile(this.fileShare, fileName);

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.RemoveFile(this.fileShare.Name, fileName, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
            fileUtil.AssertFileExists(this.fileShare, fileName, "File should not be removed when providing invalid credentials.");
        }
Ejemplo n.º 4
0
        public void UploadWithInvalidKeyValueTest()
        {
            string cloudFileName = CloudFileUtil.GenerateUniqueFileName();
            string localFilePath = Path.Combine(Test.Data.Get("TempDir"), CloudFileUtil.GenerateUniqueFileName());

            FileUtil.GenerateSmallFile(localFilePath, Utility.GetRandomTestCount(5, 10), true);

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.UploadFile(this.fileShare.Name, localFilePath, cloudFileName, false, false, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
        }
        public void NewDirectoryWithInvalidKeyValueTest()
        {
            string dir       = CloudFileUtil.GenerateUniqueDirectoryName();
            var    directory = this.fileShare.GetRootDirectoryReference().GetDirectoryReference(dir);

            directory.DeleteIfExists();

            // Creates an storage context object with invalid key value
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountKey: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.NewDirectory(this.fileShare.Name, dir, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AuthenticationFailedFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId));
            fileUtil.AssertDirectoryNotExists(this.fileShare, dir, "Directory should not be created when providing invalid credentials.");
        }
        public void RemoveDirectoryWithInvalidAccountTest()
        {
            string dir = CloudFileUtil.GenerateUniqueDirectoryName();

            fileUtil.EnsureDirectoryExists(this.fileShare, dir);

            // Creates an storage context object with invalid account
            // name.
            var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountName: true);
            object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));

            CommandAgent.RemoveDirectory(this.fileShare.Name, dir, invalidStorageContextObject);
            var result = CommandAgent.Invoke();

            CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AccountIsDisabledFullQualifiedErrorId, AssertUtil.NameResolutionFailureFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId, AssertUtil.InvalidResourceFullQualifiedErrorId));
            fileUtil.AssertDirectoryExists(this.fileShare, dir, "Directory should not be created when providing invalid credentials.");
        }
        public void RemoveFileShareWithInvalidAccountTest()
        {
            string fileShareName = CloudFileUtil.GenerateUniqueFileShareName();

            fileUtil.EnsureFileShareExists(fileShareName);
            try
            {
                // Creates an storage context object with invalid account
                // name.
                var    invalidAccount = CloudFileUtil.MockupStorageAccount(StorageAccount, mockupAccountName: true);
                object invalidStorageContextObject = CommandAgent.CreateStorageContextObject(invalidAccount.ToString(true));
                CommandAgent.RemoveFileShareByName(fileShareName, false, invalidStorageContextObject);
                var result = CommandAgent.Invoke();
                CommandAgent.AssertErrors(record => record.AssertError(AssertUtil.AccountIsDisabledFullQualifiedErrorId, AssertUtil.NameResolutionFailureFullQualifiedErrorId, AssertUtil.ResourceNotFoundFullQualifiedErrorId, AssertUtil.ProtocolErrorFullQualifiedErrorId, AssertUtil.InvalidResourceFullQualifiedErrorId));
                fileUtil.AssertFileShareExists(fileShareName, "File share should not be removed when providing invalid credentials.");
            }
            finally
            {
                fileUtil.DeleteFileShareIfExists(fileShareName);
            }
        }