예제 #1
0
        public static void TestAddNewCurrentDelivery(DateTime expectedArrivalDate)
        {
            //getting all items
            IEnumerable <Item> allItems;

            using (var iRepo = new ItemRepository(new InventoryContext()))
            {
                allItems = iRepo.GetAll();
            }

            //getting vars

            //getting dict
            var itemsToQuantity = new Dictionary <Item, int>();

            foreach (Item item in allItems.Take(1))
            {
                itemsToQuantity.Add(item, 1);
            }
            //getting supplier
            Supplier supplier;

            using (var sRepo = new SupplierRepo(new InventoryContext()))
            {
                supplier = sRepo.GetByID(1);
                sRepo.Complete();
            }

            //adding new cd
            using (var cdRepo = new CurrentDeliveriesRepo(new InventoryContext()))
            {
                cdRepo.AddNewCurrentDelivery(itemsToQuantity, expectedArrivalDate, supplier);
                cdRepo.Complete();
            }
        }