예제 #1
0
        private void TestPanoramaServerUrls()
        {
            var PWEB         = "panoramaweb.org";
            var PWEB_FULL    = "https://panoramaweb.org/";
            var PWEB_LK      = "panoramaweb.org/labkey";
            var PWEB_LK_FULL = "https://panoramaweb.org/labkey/";

            var serverUri = PanoramaUtil.ServerNameToUri(PWEB);
            var pServer   = new PanoramaServer(serverUri, string.Empty, string.Empty);

            Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_FULL);
            Assert.IsFalse(pServer.RemoveContextPath());
            Assert.IsTrue(pServer.AddLabKeyContextPath());
            Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_LK_FULL);

            serverUri = PanoramaUtil.ServerNameToUri(PWEB_LK);
            pServer   = new PanoramaServer(serverUri, string.Empty, string.Empty);
            Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_LK_FULL);
            Assert.IsFalse(pServer.AddLabKeyContextPath());
            Assert.IsTrue(pServer.RemoveContextPath());
            Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_FULL);

            serverUri = PanoramaUtil.ServerNameToUri(PWEB_LK);
            pServer   = new PanoramaServer(serverUri, string.Empty, string.Empty);
            Assert.AreEqual(pServer.ServerUri, PWEB_LK_FULL);
            Assert.IsTrue(pServer.Redirect(PWEB_FULL + PanoramaUtil.ENSURE_LOGIN_PATH,
                                           PanoramaUtil.ENSURE_LOGIN_PATH));
            Assert.AreEqual(pServer.ServerUri, PWEB_FULL);

            Assert.IsFalse(pServer.Redirect("/labkey/" + PanoramaUtil.ENSURE_LOGIN_PATH, PanoramaUtil.ENSURE_LOGIN_PATH));              // Need full URL
            Assert.IsFalse(pServer.Redirect("http:/another.server/" + PanoramaUtil.ENSURE_LOGIN_PATH, PanoramaUtil.ENSURE_LOGIN_PATH)); // Not the same host
        }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (FilePath != null ? FilePath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PanoramaServer != null ? PanoramaServer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ LibraryRevision;
         return(hashCode);
     }
 }