public void ReturnResultFromRepository() { var id = this.Fixture.Create <string>(); var expected = new Brewery(); var repository = new Mock <IRepository <Brewery> >(); repository.Setup(r => r.GetById(id)) .Returns(expected); var beerRepo = new Mock <IRepository <Beer> >(); var service = new BreweryService(repository.Object, beerRepo.Object); var result = service.GetById(id); Assert.AreSame(expected, result); }