当前位置: 首页>>代码示例>>C#>>正文


C# Agent.OutputValidation方法代码示例

本文整理汇总了C#中Agent.OutputValidation方法的典型用法代码示例。如果您正苦于以下问题:C# Agent.OutputValidation方法的具体用法?C# Agent.OutputValidation怎么用?C# Agent.OutputValidation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agent的用法示例。


在下文中一共展示了Agent.OutputValidation方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DownloadBlobTest

        /// <summary>
        /// Parameters:
        ///     Block:
        ///         True for BlockBlob, false for PageBlob
        /// </summary>
        internal void DownloadBlobTest(Agent agent, string UploadFilePath, string DownloadDirPath, Microsoft.WindowsAzure.Storage.Blob.BlobType Type)
        {
            string NEW_CONTAINER_NAME = Utility.GenNameString("upload-");
            string blobName = Path.GetFileName(UploadFilePath);

            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>>();
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Blob, blobName);

            dic["BlobType"] = Type;
            comp.Add(dic);

            // create the container
            CloudBlobContainer container = CommonStorageAccount.CreateCloudBlobClient().GetContainerReference(NEW_CONTAINER_NAME);
            container.CreateIfNotExists();

            try
            {
                bool bSuccess = false;
                // upload the blob file
                if (Type == Microsoft.WindowsAzure.Storage.Blob.BlobType.BlockBlob)
                    bSuccess = CommonBlobHelper.UploadFileToBlockBlob(NEW_CONTAINER_NAME, blobName, UploadFilePath);
                else if (Type == Microsoft.WindowsAzure.Storage.Blob.BlobType.PageBlob)
                    bSuccess = CommonBlobHelper.UploadFileToPageBlob(NEW_CONTAINER_NAME, blobName, UploadFilePath);
                Test.Assert(bSuccess, "upload file {0} to container {1} should succeed", UploadFilePath, NEW_CONTAINER_NAME);

                //--------------Download operation--------------
                string downloadFilePath = Path.Combine(DownloadDirPath, blobName);
                Test.Assert(agent.GetAzureStorageBlobContent(blobName, downloadFilePath, NEW_CONTAINER_NAME),
                    Utility.GenComparisonData("GetAzureStorageBlobContent", true));
                ICloudBlob blob = CommonBlobHelper.QueryBlob(NEW_CONTAINER_NAME, blobName);
                CloudBlobUtil.PackBlobCompareData(blob, dic);
                // Verification for returned values
                agent.OutputValidation(comp);

                Test.Assert(Helper.CompareTwoFiles(downloadFilePath, UploadFilePath),
                    String.Format("File '{0}' should be bit-wise identicial to '{1}'", downloadFilePath, UploadFilePath));
            }
            finally
            {
                // cleanup
                container.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:48,代码来源:StorageBVT.cs

示例2: UploadBlobTest

        /// <summary>
        /// Parameters:
        ///     Block:
        ///         True for BlockBlob, false for PageBlob
        /// </summary>
        internal void UploadBlobTest(Agent agent, string UploadFilePath, Microsoft.WindowsAzure.Storage.Blob.BlobType Type)
        {
            string NEW_CONTAINER_NAME = Utility.GenNameString("upload-");
            string blobName = Path.GetFileName(UploadFilePath);

            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>>();
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Blob, blobName);

            dic["BlobType"] = Type;
            comp.Add(dic);

            // create the container
            CloudBlobContainer container = CommonStorageAccount.CreateCloudBlobClient().GetContainerReference(NEW_CONTAINER_NAME);
            container.CreateIfNotExists();

            try
            {
                //--------------Upload operation--------------
                Test.Assert(agent.SetAzureStorageBlobContent(UploadFilePath, NEW_CONTAINER_NAME, Type), Utility.GenComparisonData("SendAzureStorageBlob", true));

                ICloudBlob blob = CommonBlobHelper.QueryBlob(NEW_CONTAINER_NAME, blobName);
                CloudBlobUtil.PackBlobCompareData(blob, dic);
                // Verification for returned values
                agent.OutputValidation(comp);
                Test.Assert(blob != null && blob.Exists(), "blob " + blobName + " should exist!");
            }
            finally
            {
                // cleanup
                container.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:37,代码来源:StorageBVT.cs

示例3: GetBlobTest

        /// <summary>
        /// Parameters:
        ///     Block:
        ///         True for BlockBlob, false for PageBlob
        /// </summary>
        internal void GetBlobTest(Agent agent, string UploadFilePath, Microsoft.WindowsAzure.Storage.Blob.BlobType Type)
        {
            string NEW_CONTAINER_NAME = Utility.GenNameString("upload-");
            string blobName = Path.GetFileName(UploadFilePath);

            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>>();
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Blob, blobName);

            dic["BlobType"] = Type;
            comp.Add(dic);

            // create the container
            CloudBlobContainer container = CommonStorageAccount.CreateCloudBlobClient().GetContainerReference(NEW_CONTAINER_NAME);
            container.CreateIfNotExists();

            try
            {
                bool bSuccess = false;
                // upload the blob file
                if (Type == Microsoft.WindowsAzure.Storage.Blob.BlobType.BlockBlob)
                    bSuccess = CommonBlobHelper.UploadFileToBlockBlob(NEW_CONTAINER_NAME, blobName, UploadFilePath);
                else if (Type == Microsoft.WindowsAzure.Storage.Blob.BlobType.PageBlob)
                    bSuccess = CommonBlobHelper.UploadFileToPageBlob(NEW_CONTAINER_NAME, blobName, UploadFilePath);
                Test.Assert(bSuccess, "upload file {0} to container {1} should succeed", UploadFilePath, NEW_CONTAINER_NAME);

                //--------------Get operation--------------
                Test.Assert(agent.GetAzureStorageBlob(blobName, NEW_CONTAINER_NAME), Utility.GenComparisonData("GetAzureStorageBlob", true));

                // Verification for returned values
                // get blob object using XSCL 
                ICloudBlob blob = CommonBlobHelper.QueryBlob(NEW_CONTAINER_NAME, blobName);
                blob.FetchAttributes();
                CloudBlobUtil.PackBlobCompareData(blob, dic);
                dic.Add("ICloudBlob", blob);

                agent.OutputValidation(comp);
            }
            finally
            {
                // cleanup
                container.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:48,代码来源:StorageBVT.cs

示例4: GetTableTest

        internal void GetTableTest(Agent agent)
        {
            string NEW_TABLE_NAME = Utility.GenNameString("Washington");
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Table, NEW_TABLE_NAME);
            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>> { dic };

            // create table if it does not exist
            CloudTable table = CommonStorageAccount.CreateCloudTableClient().GetTableReference(NEW_TABLE_NAME);
            table.CreateIfNotExists();

            dic.Add("CloudTable", table);

            try
            {
                //--------------Get operation--------------
                Test.Assert(agent.GetAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("GetAzureStorageTable", true));
                // Verification for returned values
                agent.OutputValidation(comp);
            }
            finally
            {
                // clean up
                table.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:25,代码来源:StorageBVT.cs

示例5: GetQueueTest

        internal void GetQueueTest(Agent agent)
        {
            string NEW_QUEUE_NAME = Utility.GenNameString("redmond-");
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Queue, NEW_QUEUE_NAME);
            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>> { dic };

            CloudQueue queue = CommonStorageAccount.CreateCloudQueueClient().GetQueueReference(NEW_QUEUE_NAME);
            // create queue if it does exist
            queue.CreateIfNotExists();

            dic.Add("CloudQueue", queue);
            try
            {
                //--------------Get operation--------------
                Test.Assert(agent.GetAzureStorageQueue(NEW_QUEUE_NAME), Utility.GenComparisonData("GetAzureStorageQueue", true));
                // Verification for returned values
                queue.FetchAttributes();
                agent.OutputValidation(comp);
            }
            finally
            {
                // clean up
                queue.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:25,代码来源:StorageBVT.cs

示例6: NewTableTest

        internal void NewTableTest(Agent agent)
        {
            string NEW_TABLE_NAME = Utility.GenNameString("Washington");
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Table, NEW_TABLE_NAME);
            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>> { dic };

            // delete table if it exists
            CloudTable table = CommonStorageAccount.CreateCloudTableClient().GetTableReference(NEW_TABLE_NAME);
            table.DeleteIfExists();

            try
            {
                //--------------New operation--------------
                Test.Assert(agent.NewAzureStorageTable(NEW_TABLE_NAME), Utility.GenComparisonData("NewAzureStorageTable", true));
                // Verification for returned values
                dic.Add("CloudTable", table);
                agent.OutputValidation(comp);
                Test.Assert(table.Exists(), "table {0} should exist!", NEW_TABLE_NAME);
            }
            finally
            {
                table.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:24,代码来源:StorageBVT.cs

示例7: SetContainerACLTest

        internal void SetContainerACLTest(Agent agent)
        {
            string NEW_CONTAINER_NAME = Utility.GenNameString("astoria-");

            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>>();
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Container, NEW_CONTAINER_NAME);
            comp.Add(dic);

            // create container if it does not exist
            CloudBlobContainer container = CommonStorageAccount.CreateCloudBlobClient().GetContainerReference(NEW_CONTAINER_NAME);
            container.CreateIfNotExists();

            try
            {
                BlobContainerPublicAccessType[] accessTypes = new BlobContainerPublicAccessType[] { 
                    BlobContainerPublicAccessType.Blob,
                    BlobContainerPublicAccessType.Container,
                    BlobContainerPublicAccessType.Off
                };

                // set PublicAccess as one value respetively
                foreach (var accessType in accessTypes)
                {
                    //--------------Set operation-------------- 
                    Test.Assert(agent.SetAzureStorageContainerACL(NEW_CONTAINER_NAME, accessType),
                        "SetAzureStorageContainerACL operation should succeed");
                    // Verification for returned values
                    dic["PublicAccess"] = accessType;
                    CloudBlobUtil.PackContainerCompareData(container, dic);
                    agent.OutputValidation(comp);

                    Test.Assert(container.GetPermissions().PublicAccess == accessType,
                        "PublicAccess should be equal: {0} = {1}", container.GetPermissions().PublicAccess, accessType);
                }
            }
            finally
            {
                // clean up
                container.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:41,代码来源:StorageBVT.cs

示例8: GetContainerTest

        internal void GetContainerTest(Agent agent)
        {
            string NEW_CONTAINER_NAME = Utility.GenNameString("astoria-");

            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Container, NEW_CONTAINER_NAME);

            // create container if it does not exist
            CloudBlobContainer container = CommonStorageAccount.CreateCloudBlobClient().GetContainerReference(NEW_CONTAINER_NAME);
            container.CreateIfNotExists();

            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>> { dic };

            try
            {
                //--------------Get operation--------------
                Test.Assert(agent.GetAzureStorageContainer(NEW_CONTAINER_NAME), Utility.GenComparisonData("GetAzureStorageContainer", true));
                // Verification for returned values
                container.FetchAttributes();
                dic.Add("CloudBlobContainer", container);
                CloudBlobUtil.PackContainerCompareData(container, dic);

                agent.OutputValidation(comp);
            }
            finally
            {
                // clean up
                container.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:29,代码来源:StorageBVT.cs

示例9: NewContainerTest

        internal void NewContainerTest(Agent agent)
        {
            string NEW_CONTAINER_NAME = Utility.GenNameString("astoria-");

            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Container, NEW_CONTAINER_NAME);
            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>> { dic };

            // delete container if it exists
            CloudBlobContainer container = CommonStorageAccount.CreateCloudBlobClient().GetContainerReference(NEW_CONTAINER_NAME);
            container.DeleteIfExists();

            try
            {
                //--------------New operation--------------
                Test.Assert(agent.NewAzureStorageContainer(NEW_CONTAINER_NAME), Utility.GenComparisonData("NewAzureStorageContainer", true));
                // Verification for returned values
                CloudBlobUtil.PackContainerCompareData(container, dic);
                agent.OutputValidation(comp);
                Test.Assert(container.Exists(), "container {0} should exist!", NEW_CONTAINER_NAME);
            }
            finally
            {
                // clean up
                container.DeleteIfExists();
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:26,代码来源:StorageBVT.cs

示例10: NewQueueTest

        internal void NewQueueTest(Agent agent)
        {
            string NEW_QUEUE_NAME = Utility.GenNameString("redmond-");
            Dictionary<string, object> dic = Utility.GenComparisonData(StorageObjectType.Queue, NEW_QUEUE_NAME);
            Collection<Dictionary<string, object>> comp = new Collection<Dictionary<string, object>>{ dic };

            CloudQueue queue = CommonStorageAccount.CreateCloudQueueClient().GetQueueReference(NEW_QUEUE_NAME);
            // delete queue if it exists
            queue.DeleteIfExists();

            try
            {
                //--------------New operation--------------
                Test.Assert(agent.NewAzureStorageQueue(NEW_QUEUE_NAME), Utility.GenComparisonData("NewAzureStorageQueue", true));
                dic.Add("CloudQueue", queue);
                dic["ApproximateMessageCount"] = null;

                // Verification for returned values
                agent.OutputValidation(comp);
                Test.Assert(queue.Exists(), "queue {0} should exist!", NEW_QUEUE_NAME);
            }
            finally
            {
                // clean up
                queue.DeleteIfExists();
            }
        }
开发者ID:xmbms,项目名称:azure-sdk-tools,代码行数:27,代码来源:CLICommonBVT.cs


注:本文中的Agent.OutputValidation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。