我正在使用C#,我想对云存储的连接进行单元测试,这是我给出的基本参数。我无法弄清楚如何为它编写有意义的测试。
有人可以告诉我我应该写的是为了测试连接吗?
[TestMethod()]
[DeploymentItem("SkinImagingCloudConnectionLayer.dll")]
public void SetUpConnectionTest()
{
CloudConnection_Accessor.SetUpConnection();
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}
private static void SetUpConnection()
{
// Use the local storage account.
//cloudStorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
cloudStorageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=*****;AccountKey=LBQ8k1myLKUKry03******************Itid+9BpV45GHAIWQ==");
#region Select (or create) a Blob Container... it's like a Folder!
// Create the blob client, which provides
// authenticated access to the Blob service.
blobClient = cloudStorageAccount.CreateCloudBlobClient();
// Get the container reference.
blobContainer = blobClient.GetContainerReference("cp300");
// Create the container if it does not exist.
blobContainer.CreateIfNotExist();
// Set permissions on the container.
containerPermissions = new BlobContainerPermissions();
// This sample sets the container to have public blobs. Your application
// needs may be different. See the documentation for BlobContainerPermissions
// for more information about blob container permissions.
containerPermissions.PublicAccess = BlobContainerPublicAccessType.Blob;
blobContainer.SetPermissions(containerPermissions);
#endregion
}
答案 0 :(得分:0)
只是说清楚。您正在创建集成测试 - 而不是单元测试:o)