Пример #1
0
        public void UpdateItems()
        {
            var items = itemJsonRepo.GetAll();

            itemSellInManager.UpdateSellIn(items);
            itemQualityManager.UpdateQuality(items);
            itemJsonRepo.AddOrUpdate(items);

            items = itemXmlRepo.GetAll();
            itemSellInManager.UpdateSellIn(items);
            itemQualityManager.UpdateQuality(items);
            itemXmlRepo.AddOrUpdate(items);
        }
Пример #2
0
        static void Main(string[] args)
        {
            args = new string[] { @"C:\Workspace\itemsRepo" };
            Container           dependencyContainer = DependencyBinder.Register(args[0]);
            IItemJsonRepository jsonRepo            = dependencyContainer.GetInstance <IItemJsonRepository>();
            IItemXmlRepository  xmlRepo             = dependencyContainer.GetInstance <IItemXmlRepository>();
            IItemUpdateService  itemUpdateService   = dependencyContainer.GetInstance <IItemUpdateService>();

            System.Console.WriteLine("OMGHAI!");

            Items = new List <Item>()
            {
                new Item {
                    Name = Constants.DexVestPlus5, SellIn = 10, Quality = 20
                },
                new Item {
                    Name = Constants.AgedBrie, SellIn = 2, Quality = 0
                },
                new Item {
                    Name = Constants.MongooseElixir, SellIn = 5, Quality = 7
                },
                new Item {
                    Name = Constants.Sulfuras, SellIn = 0, Quality = 80
                },
                new Item {
                    Name = Constants.BackstagePass, SellIn = 15, Quality = 20
                },
                new Item {
                    Name = Constants.ConjuredManaCake, SellIn = 3, Quality = 6
                }
            };

            jsonRepo.AddOrUpdate(Items);
            xmlRepo.AddOrUpdate(Items);
            itemUpdateService.UpdateItems();


            //System.Console.ReadKey();

            var mainForm            = new GildedRoseForm();
            var itemUpdatePresenter = new ItemUpdatePresenter(mainForm.ItemView, jsonRepo, itemUpdateService);

            Application.Run(mainForm);
        }