예제 #1
0
        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());
        }
예제 #2
0
        public void GeCompaniesTest()
        {
            _companiesRepo.Setup(x => x.GetAll()).
            Returns(_data);
            var companies = _companiesService.GetCompanies();

            Assert.AreEqual(2, companies.Count);
        }