public void ServerTest() { Server srv; srv = new InstituteAccessServer(); srv.Load(new Dictionary <string, object> { { "base_url", "https://surf.eduvpn.nl/" } }); Assert.AreEqual(new Uri("https://surf.eduvpn.nl/"), srv.Base, "Base URI incorrect"); Assert.AreEqual("surf.eduvpn.nl", srv.ToString(), "Display name incorrect"); srv = new InstituteAccessServer(); srv.Load(new Dictionary <string, object> { { "base_url", "https://surf.eduvpn.nl/" }, { "display_name", "SURF" } }); Assert.AreEqual(new Uri("https://surf.eduvpn.nl/"), srv.Base, "Base URI incorrect"); Assert.AreEqual("SURF", srv.ToString(), "Display name incorrect"); srv = new SecureInternetServer(); srv.Load(new Dictionary <string, object> { { "base_url", "https://surf.eduvpn.nl/" }, { "country_code", "NL" }, { "support_contact", new List <object>() { "mailto:[email protected]" } }, }); Assert.AreEqual(new Uri("https://surf.eduvpn.nl/"), srv.Base, "Base URI incorrect"); Assert.AreEqual(new Country("NL").ToString(), srv.ToString(), "Display name incorrect"); Assert.AreEqual("NL", ((SecureInternetServer)srv).Country.Code, "Country code incorrect"); // Test issues. Assert.ThrowsException <eduJSON.MissingParameterException>(() => { srv = new InstituteAccessServer(); srv.Load(new Dictionary <string, object> { { "display_name", "SURF" }, }); }); Assert.ThrowsException <eduJSON.MissingParameterException>(() => { srv = new SecureInternetServer(); srv.Load(new Dictionary <string, object> { { "display_name", "SURF" }, }); }); }
/// <summary> /// Sets secure internet connecting server /// </summary> /// <param name="srv">Server</param> public void SetSecureInternetConnectingServer(SecureInternetServer srv) { Properties.Settings.Default.SecureInternetConnectingServer = srv.Base; RebuildSecureInternetServers(this, null); }