C# 单元测试与云存储的连接?
我正在使用C语言,我想对云存储的连接进行单元测试,这是它给我的基本参数。我不知道如何为它编写一个有意义的测试 有人能告诉我应该写什么来测试连接吗C# 单元测试与云存储的连接?,c#,visual-studio,unit-testing,C#,Visual Studio,Unit Testing,我正在使用C语言,我想对云存储的连接进行单元测试,这是它给我的基本参数。我不知道如何为它编写一个有意义的测试 有人能告诉我应该写什么来测试连接吗 [TestMethod()] [DeploymentItem("SkinImagingCloudConnectionLayer.dll")] public void SetUpConnectionTest() { CloudConnection_Accessor.SetUpConnection(); Assert.Inconclusiv
[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
}
我只是想说清楚。您正在创建集成测试,而不是单元测试:o您要测试连接的哪些方面?你想连接到真实的东西还是存根?我想表明程序和云存储之间存在连接。SetUpConnection应该做什么?你能测试什么作为它被调用的成功工件?另外,由于您使用的是2个接口,因此这实际上是一个集成测试。为什么你有断言。非结论性陈述?你所说的连接存在是什么意思?它是开放的、在线的、可用的、正在使用的。。。你是什么意思?是的,很抱歉我对这一切的了解非常模糊,我将添加oter类中的代码,这可能会让事情变得更清楚一点