예제 #1
0
        public UpdateShopTest()
        {
            model = new UpdateShopModel()
            {
                MinutesForTurn    = 5,
                Name              = "name 2",
                SimultaneousTurns = 5
            };
            var returnShop = new Shop("code 1", "name 1")
            {
                MinutesForTurn    = 1,
                SimultaneousTurns = 1
            };

            _shopRepo = new Mock <IShopRepository>();
            _shopRepo.Setup(x => x.Get(It.IsAny <Guid>()))
            .Returns(returnShop)
            .Verifiable();
            _shopRepo.Setup(x => x.Update(It.Is <Shop>(s =>
                                                       s.Name == model.Name &&
                                                       s.MinutesForTurn == model.MinutesForTurn &&
                                                       s.SimultaneousTurns == model.SimultaneousTurns &&
                                                       s.Code == returnShop.Code)))
            .Verifiable();

            _uow = new Mock <IUnitOfWork>();
            _uow.Setup(x => x.Save()).Verifiable();

            _service = new UpdateShop(_shopRepo.Object, _uow.Object);
        }
예제 #2
0
        public void Execute(UpdateShopModel model)
        {
            var shop = _shopRepo.Get(model.ShopId);

            shop.Update(model.Name, model.SimultaneousTurns, model.MinutesForTurn);
            _shopRepo.Update(shop);
            _uow.Save();
        }