public void TestRemoveLink() { DeepLinker linker = new DeepLinker(); linker.LinkPath("api", (link) => { }); Assert.IsTrue(linker.IsLinked("api")); linker.RemoveLink("/api///"); Assert.IsFalse(linker.IsLinked("api")); }
public void TestLink() { DeepLinker.HookHandler handler = new DeepLinker.HookHandler((link) => {}); DeepLinker linker = new DeepLinker(); linker.LinkPath("api/", handler); Assert.IsTrue(linker.IsLinked("api")); Assert.IsTrue(linker.IsLinked("api/")); Assert.IsTrue(linker.IsLinked("/api")); linker = new DeepLinker(); linker.LinkPath("/api", handler); Assert.IsTrue(linker.IsLinked("api")); Assert.IsTrue(linker.IsLinked("api/")); Assert.IsTrue(linker.IsLinked("/api")); linker = new DeepLinker(); linker.LinkPath(null, handler); Assert.IsFalse(linker.IsLinked("api")); linker = new DeepLinker(); linker.LinkPath("api", null); Assert.IsFalse(linker.IsLinked("api")); linker = new DeepLinker(); linker.LinkPath("api?ab=ba", handler); Assert.IsTrue(linker.IsLinked("api")); linker = new DeepLinker(); linker.LinkPath("api/?ab=ba", handler); Assert.IsTrue(linker.IsLinked("api")); linker = new DeepLinker(); linker.LinkPath("pbtest://api", handler); Assert.IsTrue(linker.IsLinked("api")); }