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

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

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

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

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

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