예제 #1
0
    public bool AddItem(Item item)
    {
        if (debug)
        {
            Debug.Log("StoreManager Server: Adding item to store: " + item);
        }

        if (!currentStoreInventory.AddItem(item, 1))
        {
            return(false);
        }

        /* Let the clients know that our inventory has been updated */
        UpdateClientStoreInventory();

        return(true);
    }
예제 #2
0
        public void AddItem_ShouldPass()
        {
            using var context = new MarketDbContext(inMemoryConnection);

            Item result = storeInventory.AddItem("newItem", 2, categories1, 3.55, context: context, keywordNames: new HashSet <string>()
            {
                "word1"
            });
            ReadOnlyCollection <Item> items = storeInventory.GetStoreItems();

            Assert.IsNotNull(result);
            Assert.IsTrue(items.Contains(result));
            Assert.AreEqual(1, items.Count);
        }