public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); var cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void Test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable <Car> cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_usage() { RepositoryTestClass repositoryTest = new RepositoryTestClass(); IEnumerable<Car> cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_usage() { // Arrange var repository = new RepositoryTestClass(); // Act var cars = repository.GetCars(); // Assert Assert.IsNotNull(cars); }
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_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_mocking() { var cars = new List <Car>() { new Car() { CarId = 1, Description = "Mustang" }, new Car() { CarId = 2, Description = "Corvette" } }; var mockCarRepository = new Mock <ICarRepository>(); mockCarRepository.Setup(m => m.Get()).Returns(cars); var repositoryTest = new RepositoryTestClass(mockCarRepository.Object); var result = repositoryTest.GetCars(); Assert.IsTrue(result == cars); }
public void test_repository_mocking() { // Arrange var mockCarRepository = new Mock <ICarRepository>(); var repositoryTestClass = new RepositoryTestClass(mockCarRepository.Object); var cars = new List <Car> { new Car { CarId = 1, Description = "Car1" }, new Car { CarId = 2, Description = "Car2" } }; mockCarRepository.Setup(x => x.Get()).Returns(cars); // Act var actual = repositoryTestClass.GetCars(); // Assert Assert.AreSame(cars, actual); }
public void test_repository_usage() { var repositoryTest = new RepositoryTestClass(); var cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_mocking() { var cars = new List<Car>() { new Car() { CarId = 1, Description = "Mustang"}, new Car() { CarId = 2, Description = "Corvette"} }; var mockCarRepository = new Mock<ICarRepository>(); mockCarRepository.Setup(m => m.Get()).Returns(cars); var repositoryTest = new RepositoryTestClass(mockCarRepository.Object); var result = repositoryTest.GetCars(); Assert.IsTrue(result == cars); }