public void Add_Same_Item_To_Existing_Catalogue()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item          = new FakeItem1();

            catalogueItem.Add(item, 10);

            FakeItem1 item2 = new FakeItem1();

            catalogueItem.Add(item2, 2);

            Assert.That(catalogueItem.Quantity.Equals(12));
        }
        public void Add_Different_Item_To_Existing_Catalogue_List()
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item          = new FakeItem1();

            catalogueItem.Add(item);

            FakeItem2 item2     = new FakeItem2();
            var       exception = Assert.Throws <ItemMismatchException>(() =>
            {
                catalogueItem.Add(item2);
            });

            Assert.That(exception.GetType() == typeof(ItemMismatchException));
        }
        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 Equals_Item_Found()
        {
            ICatalogueItem item  = new SimpleCatalogueItem();
            FakeItem1      fake1 = new FakeItem1();

            item.Add(fake1);
            Assert.That(item.Equals(fake1).Equals(true));
        }
        public void Add_Item_To_Catalogue_List(int quantity)
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item          = new FakeItem1();

            catalogueItem.Add(item, quantity);

            Assert.That(catalogueItem.Quantity.Equals(quantity));
        }
        public void CheckCorrectQuantity(int addItem, int resultQuantity)
        {
            SimpleCatalogueItem catalogueItem = new SimpleCatalogueItem();
            FakeItem1           item          = new FakeItem1();

            catalogueItem.Add(item, addItem);

            Assert.That(catalogueItem.Quantity.Equals(resultQuantity));
        }
        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 Check_Item_Types_Unequal()
        {
            ICatalogueItem item      = new SimpleCatalogueItem();
            IItem          fakeItem1 = new FakeItem1();

            item.Add(fakeItem1);
            IItem fakeItem2 = new FakeItem2();

            Assert.That(!item.GetItemType().Equals(fakeItem2.GetType().Name));
        }
        public void Check_Item_Type_Equal()
        {
            ICatalogueItem item      = new SimpleCatalogueItem();
            IItem          fakeItem1 = new FakeItem1();

            item.Add(fakeItem1);
            IItem fakeItem2 = new FakeItem1();

            Assert.That(item.GetItemType() == fakeItem2.GetType());
        }
        public void Equals_Missing_Item()
        {
            ICatalogueItem item  = new SimpleCatalogueItem();
            FakeItem1      fake1 = new FakeItem1();

            item.Add(fake1);
            FakeItem2 fake2 = new FakeItem2();

            Assert.That(item.Equals(fake2).Equals(false));
        }
        public void Get_Amount_Of_Item_You_Can_Purchase_With_Given_Money(int initialAmount, decimal givenMoney, int purchasableAmount)
        {
            ICatalogueItem item = new SimpleCatalogueItem();

            for (int i = 0; i < initialAmount; i++)
            {
                IItem fakeItem = new FakeItem1();
                item.Add(fakeItem);
            }
            Assert.That(purchasableAmount.Equals(item.GetTotalNumberForAGivenPrice(givenMoney)));
        }
        public void Get_Total_Price_For_Some_Items(int quantity, decimal amount)
        {
            ICatalogueItem item = new SimpleCatalogueItem();

            for (int i = 0; i < quantity; i++)
            {
                IItem fakeItem = new FakeItem1();
                item.Add(fakeItem);
            }
            Assert.That(amount.Equals(item.GetTotalPrice()));
        }
        public void Get_Price_When_List_Is_Empty(int initialQuantity, int priceOfQuantity, decimal result)
        {
            ICatalogueItem catalogueItem = new SimpleCatalogueItem();
            IItem          item          = new FakeItem3();

            for (int i = 0; i < initialQuantity; i++)
            {
                catalogueItem.Add(item);
            }
            decimal price = catalogueItem.GetPriceOfQuantity(priceOfQuantity);

            Assert.That(price.Equals(result));
        }
        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_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));
        }