本文整理汇总了C#中Orleans.Runtime.Configuration.ClusterConfiguration.Load方法的典型用法代码示例。如果您正苦于以下问题:C# ClusterConfiguration.Load方法的具体用法?C# ClusterConfiguration.Load怎么用?C# ClusterConfiguration.Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orleans.Runtime.Configuration.ClusterConfiguration
的用法示例。
在下文中一共展示了ClusterConfiguration.Load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Config_NewConfigTest
public void Config_NewConfigTest()
{
TextReader input = File.OpenText("Config_TestSiloConfig.xml");
ClusterConfiguration config = new ClusterConfiguration();
config.Load(input);
input.Close();
Assert.AreEqual<int>(2, config.Globals.SeedNodes.Count, "Seed node count is incorrect");
Assert.AreEqual<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 11111), config.Globals.SeedNodes[0], "First seed node is set incorrectly");
Assert.AreEqual<IPEndPoint>(new IPEndPoint(IPAddress.IPv6Loopback, 22222), config.Globals.SeedNodes[1], "Second seed node is set incorrectly");
Assert.AreEqual<int>(12345, config.Defaults.Port, "Default port is set incorrectly");
Assert.AreEqual<string>("UnitTests.General.TestStartup,Tester", config.Defaults.StartupTypeName);
NodeConfiguration nc;
bool hasNodeConfig = config.TryGetNodeConfigurationForSilo("Node1", out nc);
Assert.IsTrue(hasNodeConfig, "Node Node1 has config");
Assert.AreEqual<int>(11111, nc.Port, "Port is set incorrectly for node Node1");
Assert.IsTrue(nc.IsPrimaryNode, "Node1 should be primary node");
Assert.IsTrue(nc.IsSeedNode, "Node1 should be seed node");
Assert.IsFalse(nc.IsGatewayNode, "Node1 should not be gateway node");
Assert.AreEqual<string>("UnitTests.General.TestStartup,Tester", nc.StartupTypeName, "Startup type should be copied automatically");
hasNodeConfig = config.TryGetNodeConfigurationForSilo("Node2", out nc);
Assert.IsTrue(hasNodeConfig, "Node Node2 has config");
Assert.AreEqual<int>(22222, nc.Port, "Port is set incorrectly for node Node2");
Assert.IsFalse(nc.IsPrimaryNode, "Node2 should not be primary node");
Assert.IsTrue(nc.IsSeedNode, "Node2 should be seed node");
Assert.IsTrue(nc.IsGatewayNode, "Node2 should be gateway node");
hasNodeConfig = config.TryGetNodeConfigurationForSilo("Store", out nc);
Assert.IsTrue(hasNodeConfig, "Node Store has config");
Assert.AreEqual<int>(12345, nc.Port, "IP port is set incorrectly for node Store");
Assert.IsFalse(nc.IsPrimaryNode, "Store should not be primary node");
Assert.IsFalse(nc.IsSeedNode, "Store should not be seed node");
Assert.IsFalse(nc.IsGatewayNode, "Store should not be gateway node");
//IPAddress[] ips = Dns.GetHostAddresses("");
//IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, 12345);
//for (int i = 0; i < ips.Length; i++)
//{
// if ((ips[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) && !IPAddress.Loopback.Equals(ips[i]))
// {
// ep = new IPEndPoint(ips[i], 12345);
// break;
// }
//}
//Assert.AreEqual<IPEndPoint>(ep, nc.Endpoint, "IP endpoint is set incorrectly for node Store");
}