public void IfInputIsEmptyThenNoCompanyIsReturned() { GarbageParser parser = null; ICompanyRepository repo = null; var sut = new SearchEngine(repo, parser); var result = sut.Search(""); result.CompanyNames.Should().BeEmpty(); }
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"); }
public SearchEngine(GarbageParser parser, ICompanyRepository repo) { this.parser = parser; this.repo = repo; }
public SearchEngine(ICompanyRepository repo, GarbageParser parser) { this.repo = repo; this.parser = parser; }