Beispiel #1
0
        public void TestFeaturedEmployers()
        {
            Get(HomeUrl);

            var employers = _featuredQuery.GetFeaturedEmployers().OrderBy(e => e.Name).ToList();
            var nodes     = Browser.CurrentHtml.DocumentNode.SelectNodes("//div[@class='homepage-section jobs-by-employers']//div[@class='homepage-centered-image']/img");

            Assert.IsNotNull(nodes);
            Assert.AreEqual(employers.Count, nodes.Count);
            foreach (var node in nodes)
            {
                var found = false;

                var url = HttpUtility.HtmlDecode(node.Attributes["src"].Value);
                foreach (var employer in employers)
                {
                    // The url is a content url and therefore contains versioning information, so ignore that.

                    if (!employer.LogoUrl.StartsWith("~/content", StringComparison.InvariantCultureIgnoreCase))
                    {
                        Assert.Fail("Featured employer logo url '" + employer.LogoUrl + "' is not a content url.");
                    }

                    var logoUrl = employer.LogoUrl.Substring("~/content".Length);
                    if (url.EndsWith(logoUrl, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Assert.IsTrue(string.Compare("javascript:loadPage('" + new ReadOnlyApplicationUrl("~/search/jobs", new ReadOnlyQueryString("advertiser", employer.Name, "SortOrder", "2")).PathAndQuery + "');", node.Attributes["onclick"].Value, true) == 0);
                        found = true;
                        break;
                    }
                }

                Assert.IsTrue(found);
            }
        }
Beispiel #2
0
 private IList <FeaturedEmployerModel> GetFeaturedEmployers()
 {
     return((from e in _featuredQuery.GetFeaturedEmployers()
             orderby e.LogoOrder
             select new FeaturedEmployerModel
     {
         Name = e.Name,
         SearchUrl = SearchRoutes.Search.GenerateUrl(new { advertiser = e.Name, sortOrder = 2 }),
         LogoUrl = new ContentUrl(StaticEnvironment.GetFileVersion(Assembly.GetExecutingAssembly()), e.LogoUrl)
     }).ToList());
 }