Beispiel #1
0
        public void UpdateShoeNoDescriptionExpectException()
        {
            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.Update(shoe));

            Assert.Equal("Shoe needs a description", e.Message);
        }
Beispiel #2
0
        public void UpdateShoeTestShouldCallShoeRepoCreateOnce()
        {
            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.Update(shoe);
            shoeRepo.Verify(x => x.Update(It.IsAny <Shoe>()), Times.Once);
        }