public void TestLoadServerDataFromFile() { // For test coverage purposes, we need to call this again servers.LoadServerDataFromFile(Path.Combine(TestContext.CurrentContext.WorkDirectory, "Fixtures", "servers.json")); Assert.AreEqual(9, serverList.Count); var vpnServerItems = servers.GetServerItems(); Assert.AreEqual(9, vpnServerItems.Count); // Verify if all countries are present Assert.AreEqual(4, vpnServerItems.Where(i => i.Value.Country == "Czech Republic").Count()); Assert.AreEqual(1, vpnServerItems.Where(i => i.Value.Country == "Hong Kong").Count()); Assert.AreEqual(2, vpnServerItems.Where(i => i.Value.Country == "Serbia").Count()); Assert.AreEqual(2, vpnServerItems.Where(i => i.Value.Country == "Austria").Count()); // Verify cities Assert.AreEqual(2, vpnServerItems.Where(i => i.Value.City == "Wien").Count()); Assert.AreEqual(1, vpnServerItems.Where(i => i.Value.City == "Hong Kong").Count()); Assert.AreEqual(2, vpnServerItems.Where(i => i.Value.City == "Belgrade").Count()); Assert.AreEqual(3, vpnServerItems.Where(i => i.Value.City == "Prague").Count()); Assert.AreEqual(1, vpnServerItems.Where(i => i.Value.City == "Brno").Count()); // Verify data for Wien var verifyServerItem = vpnServerItems.Where(i => i.Value.City == "Hong Kong").First(); Assert.AreEqual("10.64.0.1", verifyServerItem.Value.DNSServerAddress); Assert.AreEqual("209.58.188.180", verifyServerItem.Value.Endpoint); Assert.AreEqual("10.64.0.1", verifyServerItem.Value.IPv4Address); Assert.AreEqual("fc00:bbbb:bbbb:bb01::1", verifyServerItem.Value.IPv6Address); Assert.AreEqual("ZlAoBnq2CCqVfyHVkohdXRGGRdEXax65TdsS+CjjKmA=", verifyServerItem.Value.PublicKey); Assert.AreEqual(100, verifyServerItem.Value.Weight); Assert.AreEqual("hk1-wireguard", verifyServerItem.Value.Name); // Verify ports for Wien Assert.AreEqual(3, verifyServerItem.Value.Ports.Count); Assert.AreEqual(53, verifyServerItem.Value.Ports[0][0]); Assert.AreEqual(53, verifyServerItem.Value.Ports[0][1]); Assert.AreEqual(10000, verifyServerItem.Value.Ports[1][0]); Assert.AreEqual(51820, verifyServerItem.Value.Ports[1][1]); Assert.AreEqual(52000, verifyServerItem.Value.Ports[2][0]); Assert.AreEqual(60000, verifyServerItem.Value.Ports[2][1]); }
public void SetupServerListTest() { servers = new FxA.ServerList(); servers.LoadServerDataFromFile(Path.Combine(TestContext.CurrentContext.WorkDirectory, "Fixtures", "servers.json")); serverList = servers.GetServerList(); }