public void GetCompanies_ShouldProperlyReturnAllCompanies() { //Arrange var mockedRepository = new Mock <IEfRepository <Company> >(); var mockedImageService = new Mock <IImageService>(); var companies = new List <Company>() { new Company { CompanyName = "Name", Description = "Description" }, new Company { CompanyName = "Name", Description = "Description" }, new Company { CompanyName = "Name", Description = "Description" } }.AsQueryable(); mockedRepository.Setup(x => x.GetAllQueryable).Returns(companies); var service = new CompaniesService(mockedRepository.Object, mockedImageService.Object); //Act var result = service.GetCompanies(); //Assert Assert.AreEqual(3, result.Count()); }
public void GeCompaniesTest() { _companiesRepo.Setup(x => x.GetAll()). Returns(_data); var companies = _companiesService.GetCompanies(); Assert.AreEqual(2, companies.Count); }