Exemple #1
0
        public void test_repository_usage()
        {
            RepoositoryTestClass repository = new RepoositoryTestClass();
            IEnumerable <Car>    cars       = repository.GetCars();

            Assert.IsNotNull(cars);
        }
Exemple #2
0
        public void test_repository_moking()
        {
            List <Car> cars = new List <Car>()
            {
                new Car {
                    CarId = 1, Description = "Mustang"
                },
                new Car {
                    CarId = 2, Description = "Vaz"
                }
            };
            Mock <ICarRepository> mock = new Mock <ICarRepository>();

            mock.Setup(obj => obj.Get()).Returns(cars);
            RepoositoryTestClass repository = new RepoositoryTestClass(mock.Object);
            IEnumerable <Car>    testCars   = repository.GetCars();

            Assert.IsTrue(testCars == cars);
        }