Exemple #1
0
        private SearchEngine CreateEngine()
        {
            var searchEngine = new SearchEngine();

            searchEngine.AddNonSponsoredLink(
                new NonSponsoredLink("fooblog.com", "some blog", DateTime.Today, LinkKind.Blog));
            searchEngine.AddNonSponsoredLink(
                new NonSponsoredLink("fooforum.com", "some forum", DateTime.Today, LinkKind.Forum));
            searchEngine.AddNonSponsoredLink(
                new NonSponsoredLink("foobar.com", "something else", DateTime.Today, LinkKind.Forum));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("fooshop.com", "some online store", "some guy", 0.25m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("foostore.com", "probably losing to Amazon", "some dude", 0.3m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("foolife.com", "definitely losing to Amazon", "some hippie", 0.2m));

            return(searchEngine);
        }
Exemple #2
0
        public void MoreThanFiveFinancialsShouldPass()
        {
            //Arrange
            var searchEngine = new SearchEngine();

            searchEngine.AddSponsoredLink(
                new SponsoredLink("fooshop.com", "something", "some guy", 0.25m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("foostore.com", "something", "some dude", 0.3m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("foolife.com", "something", "some hippie", 0.2m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("foobar.com", "something", "some bartender", 0.15m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("fooblog.com", "something", "some blogger", 0.25m));
            searchEngine.AddSponsoredLink(
                new SponsoredLink("fooforum.com", "something", "some forum admin", 0.4m));

            //Act
            searchEngine.Search("something");
            var results = searchEngine.GetFinancials();

            //Assert
            Assert.AreEqual(5, results.Count);
        }