Пример #1
0
        public void test_repository_usage()
        {
            RepositoryTestClass repositoryTest = new RepositoryTestClass();
            var cars = repositoryTest.GetCars();

            Assert.IsTrue(cars != null);
        }
Пример #2
0
        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);
        }
Пример #4
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        public void test_repository_usage()
        {
            var repositoryTest = new RepositoryTestClass();

            var cars = repositoryTest.GetCars();

            Assert.IsTrue(cars != null);
        }
Пример #10
0
        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);
        }