public void ParseSqlServerUri_ServerNoDatabaseTrusted_Parses() { const string uri = "mssqls://server"; var cs = SqlUri.Parse(uri); Trace.WriteLine(cs); var cn = new SqlConnectionStringBuilder(cs); Assert.AreEqual(true, cn.Encrypt); Assert.AreEqual("server", cn.DataSource); Assert.IsEmpty(cn.InitialCatalog); Assert.AreEqual(true, cn.IntegratedSecurity); }
public void ParseSqlServerUri_UsernameServerDatabases_Parses() { const string uri = "mssql://username@server/database"; var cs = SqlUri.Parse(uri); Trace.WriteLine(cs); var cn = new SqlConnectionStringBuilder(cs); Assert.AreEqual("username", cn.UserID); Assert.IsEmpty(cn.Password); Assert.AreEqual("server", cn.DataSource); Assert.AreEqual("database", cn.InitialCatalog); Assert.AreEqual(false, cn.IntegratedSecurity); Assert.AreEqual(false, cn.Encrypt); }
public void ParseSqlServerUri_UrlEncodedParameters_Parses() { var uri = string.Format("mssqls://{0}:{1}@{2}/{3}", HttpUtility.UrlEncode("us3rn@:name"), HttpUtility.UrlEncode("p@ssw@£$;"), HttpUtility.UrlEncode("srv-x"), HttpUtility.UrlEncode("database")); Trace.WriteLine(uri); var cs = SqlUri.Parse(uri); Trace.WriteLine(cs); var cn = new SqlConnectionStringBuilder(cs); Assert.AreEqual("us3rn@:name", cn.UserID); Assert.AreEqual("p@ssw@£$;", cn.Password); Assert.AreEqual("srv-x", cn.DataSource); Assert.AreEqual("database", cn.InitialCatalog); Assert.AreEqual(false, cn.IntegratedSecurity); Assert.AreEqual(true, cn.Encrypt); }