本文整理汇总了C#中CloudServersProvider.ListAddressesByNetwork方法的典型用法代码示例。如果您正苦于以下问题:C# CloudServersProvider.ListAddressesByNetwork方法的具体用法?C# CloudServersProvider.ListAddressesByNetwork怎么用?C# CloudServersProvider.ListAddressesByNetwork使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CloudServersProvider
的用法示例。
在下文中一共展示了CloudServersProvider.ListAddressesByNetwork方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_Return_Addresses_By_Network_Name_For_Server2
public void Should_Return_Addresses_By_Network_Name_For_Server2()
{
var provider = new CloudServersProvider(_testIdentity);
var addresses = provider.ListAddressesByNetwork(_testServer2.Id, "public");
Assert.IsTrue(addresses.Any());
}
示例2: TestListAddressesByNetwork
public void TestListAddressesByNetwork()
{
IComputeProvider provider = new CloudServersProvider(Bootstrapper.Settings.TestIdentity);
INetworksProvider networksProvider = new CloudNetworksProvider(Bootstrapper.Settings.TestIdentity);
IEnumerable<CloudNetwork> networks = networksProvider.ListNetworks();
bool foundAddress = false;
foreach (CloudNetwork network in networks)
{
Console.WriteLine("Network: {0}", network.Label);
IEnumerable<IPAddress> addresses = provider.ListAddressesByNetwork(_server.Id, network.Label);
foreach (IPAddress address in addresses)
{
foundAddress = true;
Console.WriteLine(" {0}", address);
}
}
if (!foundAddress)
Assert.Inconclusive("Couldn't find addresses on any network for the server.");
}