public MatchAccuracyMethod SelectsCorrectMatchAccuracyMethod( string urlSearch, MatchAccuracyMethod entryMam, MatchAccuracyMethod defaultMam, string[] overrideURLs = null, MatchAccuracyMethod[] overrideMethods = null) { var pwe = new PwEntry(true, true); var conf = new EntryConfig(entryMam); pwe.SetKPRPCConfig(conf); var urlSummary = URLSummary.FromURL(urlSearch); var dbConf = new DatabaseConfig() { DefaultMatchAccuracy = defaultMam }; if (overrideURLs != null) { for (int i = 0; i < overrideURLs.Length; i++) { dbConf.MatchedURLAccuracyOverrides.Add(overrideURLs[i], overrideMethods[i]); } } return(pwe.GetMatchAccuracyMethod(urlSummary, dbConf)); }
public void DataEndingWithFile() { var summary = URLSummary.FromURL("data:,_www.google.com.file://"); Assert.AreEqual("", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.IsNull(summary.Domain); }
public void StandardHttpsWithPortAndPath() { var summary = URLSummary.FromURL("http://www.google.com:12345/any/path"); Assert.AreEqual("www.google.com:12345", summary.HostnameAndPort); Assert.AreEqual("12345", summary.Port); Assert.AreEqual("google.com", summary.Domain.RegistrableDomain); }
public void StandardData() { var summary = URLSummary.FromURL("data:,_www.google.com"); Assert.AreEqual("", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.IsNull(summary.Domain); }
public void MalformedLocalFileWithExtension() { var summary = URLSummary.FromURL(@"c:\any\path\file.ext"); Assert.AreEqual(@"c:\any\path\file.ext", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.AreEqual("ext", summary.Domain.TLD); }
public void MalformedLocalFileWithoutExtension() { var summary = URLSummary.FromURL(@"c:\any\path\file"); Assert.AreEqual(@"c:\any\path\file", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.IsNull(summary.Domain.RegistrableDomain); }
public void StandardLocalFile() { var summary = URLSummary.FromURL("file://c/any/path/file.ext"); Assert.AreEqual("c/any/path/file.ext", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.IsNull(summary.Domain); }
public void DataEndingWithQSAndHttps() { var summary = URLSummary.FromURL("data:,_www.google.com?anything.https://"); Assert.AreEqual("", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.IsNull(summary.Domain); }
public void MalformedLocalFile() { var summary = URLSummary.FromURL(@"c:\any\path\file.ext"); Assert.AreEqual(@"c:\any\path\file.ext", summary.HostnameAndPort); Assert.AreEqual("", summary.Port); Assert.IsNull(summary.Domain); }
public MatchAccuracyEnum CalculatesCorrectMatchAccuracyScore(string urlEntry, string urlSearch, MatchAccuracyMethod entryMam) { var pwe = new PwEntry(true, true); pwe.Strings.Set("URL", new ProtectedString(false, urlEntry)); var conf = new EntryConfig(entryMam); pwe.SetKPRPCConfig(conf); var urlSummary = URLSummary.FromURL(urlSearch); return((MatchAccuracyEnum)KeePassRPCService.BestMatchAccuracyForAnyURL(pwe, conf, urlSearch, urlSummary, entryMam)); }