Esempio n. 1
0
        public void CreateShoeNoModelExpectException()
        {
            var          shoeRepo = new Mock <IShoeRepository>();
            IShoeService service  = new ShoeService(shoeRepo.Object);
            Shoe         shoe     = new Shoe()
            {
                Id    = 1,
                Brand = "Nike",
                //Model = "Airmax",
                Description = "Flot",
                Gender      = "Male",
                Picture     = "url",
                Price       = 500,
                Sizes       = new List <Size>()
                {
                    new Size()
                }
            };
            Exception e = Assert.Throws <ArgumentException>(() => service.Create(shoe));

            Assert.Equal("Shoe must have a model", e.Message);
        }
Esempio n. 2
0
        public void CreateShoeTestShouldCallShoeRepoCreateOnce()
        {
            var          shoeRepo = new Mock <IShoeRepository>();
            IShoeService service  = new ShoeService(shoeRepo.Object);
            Shoe         shoe     = new Shoe()
            {
                Id          = 1,
                Brand       = "Nike",
                Model       = "Airmax",
                Description = "Flot",
                Gender      = "Male",
                Picture     = "url",
                Price       = 500,
                Sizes       = new List <Size>()
                {
                    new Size()
                }
            };

            service.Create(shoe);
            shoeRepo.Verify(x => x.Create(It.IsAny <Shoe>()), Times.Once);
        }
Esempio n. 3
0
 public ShoeController(ShoeService sapatos)
 {
     _sapatos = sapatos;
 }
Esempio n. 4
0
 public ShoeController(IConfiguration configuration)
 {
     this.shoeService = new ShoeService(
         new ShoeRepository(
             configuration.GetConnectionString("ConnectionString")));
 }
Esempio n. 5
0
 public void SetUp()
 {
     this.shoeRepository = A.Fake <IShoeRepository>();
     this.shoeService    = new ShoeService(this.shoeRepository);
 }