public void IfInputIsEmptyThenNoCompanyIsReturned()
        {
            GarbageParser      parser = null;
            ICompanyRepository repo   = null;

            var sut    = new SearchEngine(repo, parser);
            var result = sut.Search("");

            result.CompanyNames.Should().BeEmpty();
        }
예제 #2
0
        public void ShouldReturnTwoCompaniesForTwoGivenSearchKeywords()
        {
            var parserStub = new Mock <GarbageParser>();

            parserStub.Setup(x => x.Parse("bottle, vienna")).Returns(new List <string> {
                "BOTTLE", "VIENNA"
            });
            GarbageParser parser = parserStub.Object;

            var companyRepoStub = new Mock <ICompanyRepository>();

            companyRepoStub.Setup(x => x.FindBy("BOTTLE")).Returns(new List <Company> {
                new Company("C1")
            });
            companyRepoStub.Setup(x => x.FindBy("VIENNA")).Returns(new List <Company> {
                new Company("C2")
            });
            ICompanyRepository repo = companyRepoStub.Object;

            SearchEngine searchEngine = new SearchEngine(parser, repo);
            var          companies    = searchEngine.Search("bottle, vienna");

            companies.Names.Should().BeEquivalentTo("C1", "C2");
        }
예제 #3
0
 public SearchEngine(GarbageParser parser, ICompanyRepository repo)
 {
     this.parser = parser;
     this.repo   = repo;
 }
예제 #4
0
 public SearchEngine(ICompanyRepository repo, GarbageParser parser)
 {
     this.repo   = repo;
     this.parser = parser;
 }