public void TestInitialize() { _homeUrl = new ReadOnlyApplicationUrl("~/"); _profileUrl = new ReadOnlyApplicationUrl("~/guests/profile"); _friendsUrl = new ReadOnlyApplicationUrl("~/guests/Friends.aspx"); _jobsUrl = new ReadOnlyApplicationUrl("~/search/jobs"); _resourcesUrl = new ReadOnlyApplicationUrl("~/members/resources"); _employerUrl = new ReadOnlyApplicationUrl(true, "~/employers", new ReadOnlyQueryString("ignorePreferred", "true")); _loginUrl = new ReadOnlyApplicationUrl(true, "~/login"); }
public void TestProfileRedirect() { var profileUrl = new ReadOnlyApplicationUrl(true, "~/members/profile"); var redirectedUrl = new ReadOnlyApplicationUrl(true, "~/login", new ReadOnlyQueryString("returnUrl", profileUrl.PathAndQuery)); var url = new ReadOnlyApplicationUrl(true, "~/ui/registered/networkers/NetworkerMyResumeForm.aspx"); AssertRedirect(url, profileUrl, redirectedUrl); url = new ReadOnlyApplicationUrl(true, "~/ui/registered/networkers/AboutMe.aspx"); AssertRedirect(url, profileUrl, redirectedUrl); url = new ReadOnlyApplicationUrl(true, "~/ui/registered/networkers/employmentdetails.aspx"); AssertRedirect(url, profileUrl, redirectedUrl); }
private void AssertBrand(IRegisteredUser member, VerticalTestData memberCommunityTestData, VerticalTestData communityData, bool showCommunity) { // Look for the brand if appropriate. if (member.AffiliateId != null && showCommunity) { var imageUrl = new ReadOnlyApplicationUrl(memberCommunityTestData.CandidateImageUrl); AssertPageContains(imageUrl.FileName); } else { var imageUrl = new ReadOnlyApplicationUrl(communityData.CandidateImageUrl); AssertPageDoesNotContain(imageUrl.FileName); } }
public void TestIndustryJobs() { // Choose an industry that has a url alias. var industry = _industriesQuery.GetIndustry("Healthcare, Medical & Pharmaceutical"); var expectedUrl = new ReadOnlyApplicationUrl("~/jobs/-/" + industry.UrlName + "-jobs"); TestUrl(expectedUrl); TestUrls( expectedUrl, new ReadOnlyApplicationUrl("~/jobs/-/" + industry.UrlName + "-jobs/"), new ReadOnlyApplicationUrl("~/jobs/-/" + industry.UrlName), new ReadOnlyApplicationUrl("~/jobs/-/" + industry.UrlAliases[0] + "-jobs"), new ReadOnlyApplicationUrl("~/jobs/-/" + industry.UrlAliases[0])); }
public void TestHttps() { var salary = new Salary { LowerBound = 80000, UpperBound = 90000 }; var expectedUrl = new ReadOnlyApplicationUrl(true, "~/candidates/melbourne-candidates/" + GetUrlSegment(salary)); // An http request should be sent to https. var url = new ReadOnlyApplicationUrl("~/candidates/melbourne-candidates/" + GetUrlSegment(salary)); Get(url); AssertUrl(expectedUrl); }
public void TestTinyUrlBracket() { var mapping = new TinyUrlMapping { TinyId = Guid.NewGuid(), Definition = "PasswordReminderEmail", LongUrl = new ReadOnlyApplicationUrl("~/terms"), }; _tinyUrlCommand.CreateMappings(new[] { mapping }); var url = new ReadOnlyApplicationUrl("~/url/" + mapping.TinyId.ToString("n") + ">"); AssertTinyUrl(url, mapping); }
public void TestStyleSheet() { var employer = CreateEmployer(); var jobAd = PostJobAd(employer); // Get the job. Get(GetJobUrl(jobAd.Id)); var stylesheetUrl = new ReadOnlyApplicationUrl("~/Content/Organisations/Css/JobAds/Database Consultants Australia (VIC) - 703317d4-da51-49e8-a553-b9c94af70156.css"); var nodes = Browser.CurrentHtml.DocumentNode.SelectNodes("//link"); Assert.IsNotNull(nodes); Assert.IsTrue(nodes.Any(n => string.Equals(n.Attributes["href"].Value, stylesheetUrl.Path, StringComparison.InvariantCultureIgnoreCase))); }
public void TestSearchJobsRewrite() { // Search var searchUrl = new ReadOnlyApplicationUrl("~/search/jobs"); Get(searchUrl); AssertUrl(searchUrl); // AdvancedSearch var url = new ReadOnlyApplicationUrl("~/search/jobs/advanced"); Get(url); AssertUrl(searchUrl); }
protected void AssertFavicon(string rootFolder, string favicon) { var xmlNode = Browser.CurrentHtml.DocumentNode.SelectSingleNode("/html/head/link[@type='image/x-icon']"); if (rootFolder == null || favicon == null) { Assert.IsNull(xmlNode); } else { Assert.IsNotNull(xmlNode); var url = new ReadOnlyApplicationUrl(new ReadOnlyApplicationUrl(rootFolder), favicon); Assert.AreEqual(url.PathAndQuery, xmlNode.Attributes["href"].Value); Assert.AreEqual("shortcut icon", xmlNode.Attributes["rel"].Value); } }
public void TestVisibilityLink() { var member = _memberAccountsCommand.CreateTestMember(0); LogIn(member); Get(_settingsUrl); // Follow the link. var url = new ReadOnlyApplicationUrl(Browser.CurrentHtml.DocumentNode.SelectSingleNode("//div[@class='visibility-link']/a").Attributes["href"].Value); Get(url); // Should be directed to the visibility settings page. AssertPage <VisibilitySettingsBasic>(); }
private SiteMapNode CreateRewriteNode(ReadOnlyApplicationUrl url, string method) { // Create the attributes. NameValueCollection attributes = new NameValueCollection(); attributes.Add("rewrite", XmlConvert.ToString(true)); if (!string.IsNullOrEmpty(method)) { attributes.Add("method", method); } attributes.Add("crawlable", XmlConvert.ToString(false)); // Create the node. return(CreateSiteMapNode(url, null, null, null, attributes)); }
private JsonResponseModel EditNote(ContenderNote note, string newText, bool?newIsShared) { var parameters = new NameValueCollection(); if (newText != null) { parameters.Add("text", newText); } if (newIsShared != null) { parameters.Add("isShared", newIsShared.ToString().ToLower()); } var url = new ReadOnlyApplicationUrl(_notesUrl, note.Id + "/edit"); return(Deserialize <JsonResponseModel>(Post(url, parameters))); }
public void TestCareer() { var redirectUrl = new ReadOnlyApplicationUrl("~/members/resources"); var url = new ReadOnlyApplicationUrl("~/career/index.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); url = new ReadOnlyApplicationUrl("~/career/findingjob.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); url = new ReadOnlyApplicationUrl("~/career/resumes.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); url = new ReadOnlyApplicationUrl("~/career/interviews.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); }
private JsonJobAdModel ProcessCandidates(Guid jobAdId, IEnumerable <Member> members, string action) { var parameters = new string[0]; if (members != null) { foreach (var member in members) { parameters = parameters.Concat(new[] { "candidateId", member.Id.ToString() }).ToArray(); } } var url = new ReadOnlyApplicationUrl(_baseApiUrl, jobAdId + "/" + action, new ReadOnlyQueryString(parameters)); var response = Post(url); return(new JavaScriptSerializer().Deserialize <JsonJobAdModel>(response)); }
private JsonListCountModel UnblockPermanentCandidates(params Member[] members) { var parameters = new NameValueCollection(); if (members != null) { foreach (var member in members) { parameters.Add("candidateId", member.Id.ToString()); } } var url = new ReadOnlyApplicationUrl(_baseBlockListsUrl, "unblockpermanentcandidates"); var response = Post(url, parameters); return(new JavaScriptSerializer().Deserialize <JsonListCountModel>(response)); }
public void TestRef() { // yellowpages.com.au: http://www.linkme.com.au/?ref=ypnav var queryString = "?ref=ypnav"; var url = new ReadOnlyApplicationUrl("~/" + queryString); var redirectUrl = new ReadOnlyApplicationUrl("~/"); AssertRedirect(url, redirectUrl, redirectUrl); // whitepages.com.au: http://www.linkme.com.au/?ref=wpnav queryString = "?ref=wpnav"; url = new ReadOnlyApplicationUrl("~/" + queryString); redirectUrl = new ReadOnlyApplicationUrl("~/"); AssertRedirect(url, redirectUrl, redirectUrl); }
public void TestAdvancedSearchJobs() { // Will be redirected to http. var url = new ReadOnlyApplicationUrl(false, "~/search/jobs/advanced"); var redirectUrl = new ReadOnlyApplicationUrl(false, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); url = new ReadOnlyApplicationUrl(true, "~/search/jobs/advanced"); redirectUrl = new ReadOnlyApplicationUrl(true, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); url = new ReadOnlyApplicationUrl(false, "~/search/jobs/AdvancedSearch.aspx"); redirectUrl = new ReadOnlyApplicationUrl(false, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); url = new ReadOnlyApplicationUrl(true, "~/search/jobs/AdvancedSearch.aspx"); redirectUrl = new ReadOnlyApplicationUrl(true, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); // Log in and do it again. var member = CreateMember(); LogIn(member); // Should be redirected to http. url = new ReadOnlyApplicationUrl(false, "~/search/jobs/advanced"); redirectUrl = new ReadOnlyApplicationUrl(false, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); url = new ReadOnlyApplicationUrl(true, "~/search/jobs/advanced"); redirectUrl = new ReadOnlyApplicationUrl(true, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); url = new ReadOnlyApplicationUrl(false, "~/search/jobs/AdvancedSearch.aspx"); redirectUrl = new ReadOnlyApplicationUrl(false, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); url = new ReadOnlyApplicationUrl(true, "~/search/jobs/AdvancedSearch.aspx"); redirectUrl = new ReadOnlyApplicationUrl(true, "~/search/jobs"); Test(url, HttpStatusCode.MovedPermanently, redirectUrl, true); }
public void TestInitialize() { _membersUrl = new ReadOnlyApplicationUrl(false, "~/", new ReadOnlyQueryString("ignorePreferred", "true")); _homeUrl = new ReadOnlyApplicationUrl(true, "~/employers"); _searchUrl = new ReadOnlyApplicationUrl(true, "~/search/candidates"); var savedSearchesUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/SavedResumeSearches.aspx"); _savedSearchesUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", savedSearchesUrl.Path)); var suggestedCandidatesUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/EmployerJobAdsSuggestions.aspx"); _suggestedCandidatesUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", suggestedCandidatesUrl.Path)); var candidateAlertsUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/SavedResumeSearchAlerts.aspx"); _candidateAlertsUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", candidateAlertsUrl.Path)); var flaggedCandidatesUrl = new ReadOnlyApplicationUrl(true, "~/employers/candidates/flaglist"); _flaggedCandidatesUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", flaggedCandidatesUrl.Path)); var manageFoldersUrl = new ReadOnlyApplicationUrl(true, "~/employers/candidates/folders"); _manageFoldersUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", manageFoldersUrl.Path)); var blocklistsUrl = new ReadOnlyApplicationUrl(true, "~/employers/candidates/blocklists/permanent"); _blocklistsUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", blocklistsUrl.Path)); _newJobAdUrl = new ReadOnlyApplicationUrl(true, "~/employers/jobads/jobad"); var openAdsUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/EmployerJobAds.aspx?mode=Open"); _openAdsUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", openAdsUrl.PathAndQuery)); var draftAdsUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/EmployerJobAds.aspx?mode=Draft"); _draftAdsUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", draftAdsUrl.PathAndQuery)); var closedAdsUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/EmployerJobAds.aspx?mode=Closed"); _closedAdsUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", closedAdsUrl.PathAndQuery)); var accountUrl = new ReadOnlyApplicationUrl("~/employers/settings"); _accountUrl = new ReadOnlyApplicationUrl(true, "~/employers/login", new ReadOnlyQueryString("returnUrl", accountUrl.Path)); _orderUrl = new ReadOnlyApplicationUrl("~/employers/products/neworder"); _resourcesUrl = new ReadOnlyApplicationUrl("~/employers/resources"); _loginUrl = new ReadOnlyApplicationUrl(true, "~/employers/login"); }
protected void AssertTrackingLink(ReadOnlyUrl url) { var path = url.Path; var applicationPath = new ReadOnlyApplicationUrl("~/").Path; Assert.IsTrue(path.StartsWith(applicationPath)); var applicationRelativePath = path.Substring(applicationPath.Length - 1); if (!TinyUrlTrackingRegex.Match(applicationRelativePath).Success) { Assert.Fail("Link '" + applicationRelativePath + "' does not correspond to a tracking url, '~/url/<guid>.aspx'."); } // Get the page. Get(url); Assert.AreEqual(0, Browser.CurrentPageText.Length); }
protected void TestNavs(ReadOnlyApplicationUrl url) { // Get everything securely. if (url.IsAbsolute || url.IsSecure != null) { GetPage(url.Scheme == Url.SecureScheme, url); } else { Get(url); } AssertHomeNav(_homeUrl); AssertNavs(_navs); AssertHeaderNavs(); AssertFooterNavs(); }
public void TestJobs() { // Get the job page. var url = new ReadOnlyApplicationUrl("~/jobs"); AssertNoRedirect(url); // Check that query strings are maintained. url = new ReadOnlyApplicationUrl("~/jobs/?name=value"); var redirectUrl = new ReadOnlyApplicationUrl("~/jobs?name=value"); AssertRedirect(url, redirectUrl, redirectUrl); url = new ReadOnlyApplicationUrl("~/jobs?name=value"); AssertNoRedirect(url); }
public void TestAdministratorLinks() { // Create an administrator and login. var administrator = _administratorAccountsCommand.CreateTestAdministrator(0); LogIn(administrator); // Assert the root page. var rootUrl = new ReadOnlyApplicationUrl(true, "/"); var url = new ReadOnlyApplicationUrl(true, "~/administrators/home").AbsoluteUri; var cookies = new CookieContainer(); cookies.Add(Browser.Cookies.GetCookies(new Uri(url))); AssertUrl(url, null, true, false, cookies, rootUrl); }
public void TestExternalRedirect() { var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0)); // Go to the page. var url = new ReadOnlyApplicationUrl("~/employers/login", new ReadOnlyQueryString("returnUrl", "http://www.yahoo.com/")); Get(url); // Sign in. SubmitLogIn(employer); // Should be directed to the employer home page and not the external site. AssertUrl(new ReadOnlyApplicationUrl(true, "~/search/candidates")); }
public void TestJobLocation() { var employer = CreateEmployer(); var industry = _industriesQuery.GetIndustries()[0]; // Post code. var location = GetLocation("Melbourne VIC 3000"); var jobAd = CreateJobAd(employer, "Manager", location, industry); var url = new ReadOnlyApplicationUrl("~/jobs/melbourne-jobs/" + industry.UrlName + "-jobs/" + jobAd.Id.ToString("n") + "-Manager"); Get(url); AssertUrl(new ReadOnlyApplicationUrl(true, "~/jobs/" + location.ToString().Replace(" ", "-").ToLower() + "/" + industry.UrlName + "/" + jobAd.Title.Replace(" ", "-").ToLower() + "/" + jobAd.Id)); AssertPageContains("Melbourne VIC 3000"); // Includes dodgy characters. location = GetLocation("East Melbourne, VIC 3002"); jobAd = CreateJobAd(employer, "Manager", location, industry); url = new ReadOnlyApplicationUrl("~/jobs/east-perth-wa-jobs/" + industry.UrlName + "-jobs/" + jobAd.Id.ToString("n") + "-Manager"); Get(url); AssertUrl(new ReadOnlyApplicationUrl(true, "~/jobs/" + location.ToString().Replace(" ", "-").ToLower() + "/" + industry.UrlName + "/" + jobAd.Title.Replace(" ", "-").ToLower() + "/" + jobAd.Id)); AssertPageContains("East Melbourne VIC 3002"); // Browse. url = new ReadOnlyApplicationUrl(true, "~/jobs/victoria-jobs/" + industry.UrlName + "-jobs"); Get(url); AssertUrl(url); var jobs = GetJobs(); Assert.IsTrue(jobs.Count > 0); foreach (var job in jobs) { url = new ReadOnlyApplicationUrl(true, job); // When browsing there should be no query string. Assert.IsTrue(url.QueryString.Count == 0); Get(url); AssertUrl(url); } }
public void TestServices() { // JobAds should not be redirected. var url = new ReadOnlyApplicationUrl(false, "~/jobads"); Test(url, HttpStatusCode.OK, null, false); url = new ReadOnlyApplicationUrl(true, "~/jobads"); Test(url, HttpStatusCode.OK, null, false); // GetSuggestedLocations should not be redirected. url = new ReadOnlyApplicationUrl(false, "~/service/GetSuggestedLocations.ashx"); Test(url, HttpStatusCode.OK, null, false); url = new ReadOnlyApplicationUrl(true, "~/service/GetSuggestedLocations.ashx"); Test(url, HttpStatusCode.OK, null, false); }
public void TestJobAdsRewrite() { var region = _locationQuery.GetRegion(_locationQuery.GetCountry("Australia"), "Melbourne"); var industry = _industriesQuery.GetIndustry("Accounting"); var jobAd = PostJobAd(industry, region); // Apply. var url = new ReadOnlyApplicationUrl("~/jobads/" + jobAd.Id.ToString("N") + "/apply"); Get(url); AssertUrl(new ReadOnlyApplicationUrl(true, "~/jobs/" + region.UrlName + "/" + industry.UrlName + "/" + jobAd.Title.ToLower() + "/" + jobAd.Id)); // View. url = new ReadOnlyApplicationUrl("~/jobads/" + jobAd.Id); Get(url); AssertUrl(new ReadOnlyApplicationUrl(true, "~/jobs/" + region.UrlName + "/" + industry.UrlName + "/" + jobAd.Title.ToLower() + "/" + jobAd.Id)); }
public void TestOldConfirm() { var member = CreateMember(0, CandidateStatus.AvailableNow); Assert.AreEqual(CandidateStatus.AvailableNow, _candidatesCommand.GetCandidate(member.Id).Status); // Follow link. var oldUrl = new ReadOnlyApplicationUrl(true, "~/members/profile/status/updateavailablenow"); var expectedUrl = new ReadOnlyApplicationUrl(true, "~/members/profile/status/update", new ReadOnlyQueryString("status", CandidateStatus.AvailableNow.ToString())); var loginUrl = GetLoginUrl(expectedUrl); AssertLink(oldUrl, loginUrl); SubmitLogIn(member); // Check status is same. ConfirmStatus(member, CandidateStatus.AvailableNow); }
public void TestDefaultAspx() { var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0)); var jobAd = _jobAdsCommand.PostTestJobAd(employer); // Get the job page. var url = new ReadOnlyApplicationUrl("~/jobs"); AssertNoRedirect(url); var redirectUrl = url; url = new ReadOnlyApplicationUrl("~/jobs/default.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); // Individual job. url = new ReadOnlyApplicationUrl(true, "~/jobs/" + jobAd.GetJobRelativePath()); AssertNoRedirect(url); redirectUrl = url; url = new ReadOnlyApplicationUrl(true, "~/jobs/" + jobAd.GetJobRelativePath() + "/default.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); // Browse jobs. url = new ReadOnlyApplicationUrl(false, "~/jobs/sydney-jobs/primary-industry-jobs"); AssertNoRedirect(url); redirectUrl = url; url = new ReadOnlyApplicationUrl(false, "~/jobs/sydney-jobs/primary-industry-jobs/default.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); // Home page. url = new ReadOnlyApplicationUrl("~/"); AssertNoRedirect(url); redirectUrl = url; url = new ReadOnlyApplicationUrl("~/default.aspx"); AssertRedirect(url, redirectUrl, redirectUrl); }
private void AddChildFolders(HttpContext context, SiteMapNode parentNode, DirectoryInfo parentInfo) { foreach (var childInfo in parentInfo.GetDirectories()) { var childUrl = new ReadOnlyApplicationUrl(new ApplicationUrl(parentNode.Url), childInfo.Name + "/"); // Folder nodes are not crawlable. var attributes = new NameValueCollection(); attributes["crawlable"] = false.ToString(); var childNode = CreateSiteMapNode(childUrl, null, null, null, attributes); AddNode(childNode, parentNode); // Recurse. AddChildNodes(context, childNode); } }
public void TestRedirects() { var redirectedUrl = new ReadOnlyApplicationUrl(true, "~/search/candidates"); var url = new ReadOnlyApplicationUrl("~/search/resumes/SimpleSearch.aspx"); AssertRedirect(url, redirectedUrl, redirectedUrl); url = new ReadOnlyApplicationUrl("~/search/resumes/AdvancedSearch.aspx"); AssertRedirect(url, redirectedUrl, redirectedUrl); redirectedUrl = new ReadOnlyApplicationUrl(true, "~/search/candidates/results"); url = new ReadOnlyApplicationUrl(true, "~/search/candidates/current"); AssertRedirect(url, redirectedUrl, redirectedUrl); redirectedUrl = new ReadOnlyApplicationUrl(true, "~/search/candidates/tips"); url = new ReadOnlyApplicationUrl(true, "~/search/resumes/Tips.aspx"); AssertRedirect(url, redirectedUrl, redirectedUrl); }