|
18 | 18 |
|
19 | 19 | //$Authors = Jiri Cincura (jiri@cincura.net)
|
20 | 20 |
|
| 21 | +using System; |
21 | 22 | using System.Globalization;
|
22 | 23 | using System.Threading;
|
23 | 24 | using InterBaseSql.Data.Common;
|
@@ -791,4 +792,34 @@ public void ParsingServerHostnamesWithPort()
|
791 | 792 | Assert.AreEqual("texdba", cs.Password);
|
792 | 793 | Assert.AreEqual("None", cs.Charset);
|
793 | 794 | }
|
| 795 | + |
| 796 | + [Test] |
| 797 | + public void ParseSSLInfo() |
| 798 | + { |
| 799 | + var connectionString = $"data source=dev-machine;initial catalog=c:\\Embarcadero\\IB2017_64\\examples\\database\\employee_Copy.gdb;user id=sysdba;password=masterkey;SSL=True;ServerPublicFile=PF;ClientCertFile=CCF;ClientPassPhraseFile=CPPF"; |
| 800 | + var cs = new ConnectionString(connectionString); |
| 801 | + cs.Validate(); |
| 802 | + Assert.AreEqual("dev-machine", cs.DataSource); |
| 803 | + Assert.AreEqual("c:\\Embarcadero\\IB2017_64\\examples\\database\\employee_Copy.gdb", cs.Database); |
| 804 | + Assert.AreEqual(true, cs.SSL); |
| 805 | + Assert.AreEqual("PF", cs.ServerPublicFile); |
| 806 | + Assert.AreEqual("CCF", cs.ClientCertFile); |
| 807 | + Assert.AreEqual("CPPF", cs.ClientPassPhraseFile); |
| 808 | + connectionString = $"data source=dev-machine;initial catalog=c:\\Embarcadero\\IB2017_64\\examples\\database\\employee_Copy.gdb;user id=sysdba;password=masterkey;SSL=True;ServerPublicPath=PP;ClientCertFile=CCF;ClientPassPhrase=CPP"; |
| 809 | + cs = new ConnectionString(connectionString); |
| 810 | + cs.Validate(); |
| 811 | + Assert.AreEqual("PP", cs.ServerPublicPath); |
| 812 | + Assert.AreEqual("CPP", cs.ClientPassPhrase); |
| 813 | + } |
| 814 | + [Test] |
| 815 | + public void ParseSSLMutualExclusivity() |
| 816 | + { |
| 817 | + var connectionString = $"ServerPublicPath=PP;ServerPublicFile=PF"; |
| 818 | + var cs = new ConnectionString(connectionString); |
| 819 | + Assert.Throws<ArgumentException>(() => cs.Validate()); |
| 820 | + connectionString = $"ServerPublicPath=PP;ClientCertFile=CCF;ClientPassPhraseFile=CPPF"; |
| 821 | + cs = new ConnectionString(connectionString); |
| 822 | + Assert.Throws<ArgumentException>(() => cs.Validate()); |
| 823 | + } |
| 824 | + |
794 | 825 | }
|
0 commit comments