Example #1
0
        public void test_repository()
        {
            RepositoryTestClass repository = new RepositoryTestClass();
            IEnumerable <Car>   result     = repository.GetCars();

            Assert.IsTrue(result != null);
        }
Example #2
0
        public void test_repository_usage()
        {
            RepositoryTestClass repositoryTest = new RepositoryTestClass();

            IEnumerable <Car> cars = repositoryTest.GetCars();

            Assert.IsTrue(cars != null);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        public void test_repository_usage()
        {
            RepositoryTestClass repositoryTest = new RepositoryTestClass();

            IEnumerable<Car> cars = repositoryTest.GetCars();

            Assert.IsTrue(cars != null);
        }
Example #6
0
        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);
        }