public void test_repository_factory_mocking2() { 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 mockDataRepositoryFactory = new Mock <IDataRepositoryFactory>(); mockDataRepositoryFactory.Setup(m => m.GetDataRepository <ICarRepository>()).Returns(mockCarRepository.Object); var repositoryFactoryTest = new RepositoryFactoryTestClass(mockDataRepositoryFactory.Object); var result = repositoryFactoryTest.GetCars(); Assert.IsTrue(result == cars); }
public void test_factory_mocking2() { 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); Mock <IDataRepositoryFactory> mockDataRepository = new Mock <IDataRepositoryFactory>(); mockDataRepository.Setup(obj => obj.GetDataRepository <ICarRepository>()).Returns(mockCarRepository.Object); RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object); IEnumerable <Car> ret = factoryTest.GetCars(); Assert.IsTrue(ret == cars); }
public void Test_repository_factory_usage() { RepositoryFactoryTestClass repositoryFactoryTestClass = new RepositoryFactoryTestClass(); IEnumerable <Car> cars = repositoryFactoryTestClass.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_factory_usage() { RepositoryFactoryTestClass factory = new RepositoryFactoryTestClass(); IEnumerable <Car> cars = factory.GetCars(); Assert.IsNotNull(cars); }
public void test_repository_factory_usage() { RepositoryFactoryTestClass repositoryTest = new RepositoryFactoryTestClass(); var cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_factory_usage() { var factoryTest = new RepositoryFactoryTestClass(); var cars = factoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_factory_usage() { RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(); IEnumerable <Car> cars = factoryTest.GetCars(); Assert.IsTrue(cars != null, "Cars list cant be null"); }
public void test_repository_factory_usage() { RepositoryFactoryTestClass repositoryTest = new RepositoryFactoryTestClass(); IEnumerable<Car> cars = repositoryTest.GetCars(); Assert.IsTrue(cars != null); }
public void test_repository_factory_usage() { // Arrange var repositoryFactory = new RepositoryFactoryTestClass(); // Act var cars = repositoryFactory.GetCars(); // Assert Assert.IsNotNull(cars); }
public void test_repository_factory_mocking1() { var cars = new List<Car>() { new Car() { CarId = 1, Description = "Mustang"}, new Car() { CarId = 2, Description = "Corvette"} }; var mockDataRepositoryFactory = new Mock<IDataRepositoryFactory>(); mockDataRepositoryFactory.Setup(m => m.GetDataRepository<ICarRepository>().Get()).Returns(cars); var repositoryFactoryTest = new RepositoryFactoryTestClass(mockDataRepositoryFactory.Object); var result = repositoryFactoryTest.GetCars(); Assert.IsTrue(result == cars); }
public void test_repository_factory_mockup() { List<Car> cars = new List<Car>() { new Car(){CarId = 1, Description = "Mustang"}, new Car(){CarId = 2, Description = "Corvette"} }; Mock<IDataRepositoryFactory> mockDataRepository = new Mock<IDataRepositoryFactory>(); mockDataRepository.Setup(obj => obj.GetDataRepository<ICarRepository>().Get()).Returns(cars); RepositoryFactoryTestClass repositoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object); IEnumerable<Car> ret = repositoryTest.GetCars(); Assert.IsTrue(ret == cars); }
public void test_repository_factory_mocking() { List <Car> cars = new List <Car>() { new Car { CarId = 1, Description = "Mustang" }, new Car { CarId = 2, Description = "Vaz" } }; Mock <IDataRepositoryFactory> mock = new Mock <IDataRepositoryFactory>(); mock.Setup(obj => obj.GetDataRepository <ICarRepository>().Get()).Returns(cars); RepositoryFactoryTestClass factory = new RepositoryFactoryTestClass(mock.Object); IEnumerable <Car> dcars = factory.GetCars(); Assert.IsTrue(cars == dcars); }
public void test_repository_factory_mocking() { // Arrange var repositoryFactory = new Mock <IDataRepositoryFactory>(); var cars = new List <Car> { new Car { CarId = 1, Description = "Car1" }, new Car { CarId = 2, Description = "Car2" } }; repositoryFactory.Setup(x => x.GetDataRepository <ICarRepository>().Get()).Returns(cars); var repositoryFactoryTest = new RepositoryFactoryTestClass(repositoryFactory.Object); // Act var actual = repositoryFactoryTest.GetCars(); // Assert Assert.AreSame(cars, actual); }