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"); }