Ejemplo n.º 1
0
        public void test_factory_repository()
        {
            FactoryRepositoryTestClass repository = new FactoryRepositoryTestClass();
            IEnumerable <Car>          result     = repository.GetCars();

            Assert.IsTrue(result != null);
        }
Ejemplo n.º 2
0
        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);
        }