public void test_factory_repository() { FactoryRepositoryTestClass repository = new FactoryRepositoryTestClass(); IEnumerable <Car> result = repository.GetCars(); Assert.IsTrue(result != null); }
public void test_factory_repository_mock() { List <Car> cars = new List <Car> { new Car { CarId = 1, Description = "abc" }, new Car { CarId = 2, Description = "abv" } }; Mock <IDataRepositoryFactory> mockCarRepository = new Mock <IDataRepositoryFactory>(); mockCarRepository.Setup(obj => obj.GetDataRepository <ICarRepository>().Get()).Returns(cars); FactoryRepositoryTestClass repository = new FactoryRepositoryTestClass(mockCarRepository.Object); IEnumerable <Car> result = repository.GetCars(); Assert.IsTrue(result != null); }