public void Subtract_From_Items_List(int addQuantity, int subtractQuantity, int result)
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item1         = new FakeItem1();

            catalogueItem.Add(item1, addQuantity);
            catalogueItem.SubtractItem(subtractQuantity);
            Assert.That(catalogueItem.Quantity.Equals(result));
        }
        public void Subtract_From_Empty_Items_List()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();

            var exception = Assert.Throws <SubtractionFromLesserQuantityException>(() =>
            {
                catalogueItem.SubtractItem(1);
            });

            Assert.That(() => exception.Message, Does.Contain("Existing amount is less than subtracting amount"));
        }
        public void Subtract_Item_From_Empty_List()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item1         = new FakeItem1();

            var exception = Assert.Throws <EmptyContainerException>(() =>
            {
                catalogueItem.SubtractItem(item1);
            });

            Assert.That(exception.GetType() == typeof(EmptyContainerException));
        }
        public void Subtract_Bigger_From_Smaller_Items_List()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item1         = new FakeItem1();

            catalogueItem.Add(item1, 10);

            var exception = Assert.Throws <SubtractionFromLesserQuantityException>(() =>
            {
                catalogueItem.SubtractItem(20);
            });

            Assert.That(() => exception.Message, Does.Contain("Existing amount is less than subtracting amount"));
        }
        public void Subtract_Item_From_list_Containing_Item()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item1         = new FakeItem1();

            catalogueItem.Add(item1);

            FakeItem1 item2 = new FakeItem1();

            catalogueItem.Add(item2);

            IItem item = catalogueItem.SubtractItem(item2);

            Assert.That(item == item2);
        }
        public void Subtract_Item_From_List_Not_Containing_Item()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item1         = new FakeItem1();

            catalogueItem.Add(item1);

            FakeItem1 item2     = new FakeItem1();
            var       exception = Assert.Throws <ItemNotFoundException>(() =>
            {
                catalogueItem.SubtractItem(item2);
            });

            Assert.That(exception.GetType() == typeof(ItemNotFoundException));
        }