public void RemoveThatDoesNotExistInMedia()
        {
            var item = new InventoryItem
            {
                Type      = "Movie",
                Title     = "TESTTITLEFORTESTINGREMOVE",
                Category  = "Action",
                Condition = "New"
            };
            var inventoryDal = new InventoryDal();

            inventoryDal.AddInventoryItem(item);

            var items      = inventoryDal.GetInventoryItems();
            var itemBefore = items.OrderByDescending(itemSort => itemSort.InventoryId).First();

            inventoryDal.RemoveInventoryItem(itemBefore.InventoryId);

            this.cleanDataBaseWhenDoesNotExistInMedia(itemBefore.MediaId, itemBefore.InventoryId);

            var itemsAfterDelete = inventoryDal.GetInventoryItems();

            Assert.AreEqual("TESTTITLEFORTESTINGREMOVE", itemBefore.Title);

            Assert.AreEqual(true, itemBefore.InStock);
            Assert.AreEqual(false, itemBefore.IsRented);

            Assert.AreNotEqual("TESTTITLEFORTESTINGREMOVE", itemsAfterDelete.OrderByDescending(itemSort => itemSort.InventoryId).First().Title);
        }
        public void GetInventoryItemsTest()
        {
            var inventoryDal = new InventoryDal();
            var result       = inventoryDal.GetInventoryItems();

            Assert.AreEqual(23, result.Count);
        }
Example #3
0
        public void AddItemThatExistsInMedia()
        {
            var item = new InventoryItem
            {
                Type      = "Movie",
                Title     = "Superman",
                Category  = "Action",
                Condition = "New"
            };
            var inventoryDal = new InventoryDal();

            inventoryDal.AddInventoryItem(item);

            var items = inventoryDal.GetInventoryItems();

            this.cleanDataBaseWhenAlreadyExistsInMedia(items.OrderByDescending(itemSort => itemSort.InventoryId).First().InventoryId);
            var itemsAfterDelete = inventoryDal.GetInventoryItems();

            Assert.AreEqual("Superman", items.OrderByDescending(itemSort => itemSort.InventoryId).First().Title);
            Assert.AreNotEqual("Superman", itemsAfterDelete.OrderByDescending(itemSort => itemSort.InventoryId).First().Title);
        }
Example #4
0
        public void AddItemThatDoesNotExistInMedia()
        {
            var item = new InventoryItem
            {
                Type      = "Movie",
                Title     = "TESTTITLEFORTESTING",
                Category  = "Action",
                Condition = "New"
            };
            var inventoryDal = new InventoryDal();

            inventoryDal.AddInventoryItem(item);

            var items     = inventoryDal.GetInventoryItems();
            var itemAdded = items.OrderByDescending(itemSort => itemSort.InventoryId).First();

            this.cleanDataBaseWhenDoesNotExistInMedia(itemAdded.MediaId, itemAdded.InventoryId);
            var itemsAfterDelete = inventoryDal.GetInventoryItems();

            Assert.AreEqual("TESTTITLEFORTESTING", items.OrderByDescending(itemSort => itemSort.InventoryId).First().Title);
            Assert.AreNotEqual("TESTTITLEFORTESTING", itemsAfterDelete.OrderByDescending(itemSort => itemSort.InventoryId).First().Title);
        }