Exemple #1
0
        public void GetByBrandFalse()
        {
            var carRepository = new Mock <ICarRepository>();

            carRepository.Setup(x => x.GetByBrand(It.IsAny <string>()))
            .Returns(new List <CarEntity>());

            var carBusiness = new CarBusiness(carRepository.Object);

            var result = carBusiness.GetByBrand("Fiat");

            Assert.DoesNotContain(result, x => x.Brand.Contains("Fiat"));
        }
Exemple #2
0
        public void GetByBrandSucess()
        {
            var carRepository = new Mock <ICarRepository>();
            var carList       = new List <CarEntity>
            {
                new CarEntity {
                    Id = 1, UniqueKey = Guid.NewGuid(), Brand = "Fiat", Model = "Uno", Year = "1550"
                },
            };

            carRepository.Setup(x => x.GetByBrand(It.IsAny <string>())).Returns(carList);
            var carBusiness = new CarBusiness(carRepository.Object);

            var result = carBusiness.GetByBrand("Fiat");

            Assert.Contains(result, x => x.Brand == "Fiat");
        }