public void test_repository() { RepositoryTestClass repository = new RepositoryTestClass(); IEnumerable <Car> result = repository.GetCars(); Assert.IsTrue(result != null); }
public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable <Car> cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_mock() { List <Car> cars = new List <Car> { new Car { CarId = 1, Description = "abc" }, new Car { CarId = 2, Description = "abv" } }; Mock <ICarRepository> mockCarRepository = new Mock <ICarRepository>(); mockCarRepository.Setup(obj => obj.Get()).Returns(cars); RepositoryTestClass repository = new RepositoryTestClass(mockCarRepository.Object); IEnumerable <Car> result = repository.GetCars(); Assert.IsTrue(result != null); }
public void test_repository_mocking() { List <Car> cars = new List <Car>() { new Car() { CarId = 1, Description = "Mustang" }, new Car() { CarId = 2, Description = "Corvette" } }; Mock <ICarRepository> mockCarRepository = new Mock <ICarRepository>(); mockCarRepository.Setup(obj => obj.Get()).Returns(cars); RepositoryTestClass repositoryTest = new RepositoryTestClass(mockCarRepository.Object); IEnumerable <Car> ret = repositoryTest.GetCars(); Assert.IsTrue(ret == cars); }
public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable<Car> cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_mocking() { List<Car> cars = new List<Car>(){ new Car() { CarId = 1, Description = "Mustang" }, new Car() { CarId = 2, Description = "Corvette" } }; Mock<ICarRepository> mockCarRepository = new Mock<ICarRepository>(); mockCarRepository.Setup(obj => obj.Get()).Returns(cars); RepositoryTestClass repositoryTest = new RepositoryTestClass(mockCarRepository.Object); IEnumerable<Car> ret = repositoryTest.GetCars(); Assert.IsTrue(ret == cars); }