public void CheeseItemQualityCannotExceedMaxQuality() { var cheeseItem = new CheeseItem { Name = "AgedBrie", SellIn = 10, Quality = 50 }; ManageInventory.ProcessItem(cheeseItem); Assert.AreEqual(cheeseItem.MaxQuality, cheeseItem.Quality); }
public void CheeseItemQualityIncreasesAsSellInDecreases() { var cheeseItem = new CheeseItem { Name = "AgedBrie", SellIn = 10, Quality = 10 }; var oldQuality = cheeseItem.Quality; ManageInventory.ProcessItem(cheeseItem); Assert.AreEqual(oldQuality + 1, cheeseItem.Quality); }
private void OnCollisionEnter(Collision collision) { // Check for player collision if (collision.gameObject.tag == "Player") { player.GetComponent <PlayerController>().RemoveObserver(this); Collider[] colliders = gameObject.GetComponents <Collider>(); foreach (Collider collider in colliders) { colliderItems.Remove(collider.gameObject); collider.enabled = false; } foreach (Transform child in transform) { child.GetComponent <MeshRenderer>().enabled = false; } if (gameObject.GetComponent <MeshRenderer>() != null) { gameObject.GetComponent <MeshRenderer>().enabled = false; } ParticleBehavior pb = null; switch (itemType) { case ItemType.BREAD: pb = new BreadItem(); break; case ItemType.CAN: pb = new CanItem(); break; case ItemType.CHEESE: pb = new CheeseItem(); break; case ItemType.FRUIT: pb = new FruitItem(); break; case ItemType.LIQUID: pb = new LiquidItem(); break; case ItemType.MEAT: pb = new MeatItem(); break; case ItemType.SHELF: pb = new ShelfItem(); break; } if (gameObject.transform.parent == true) { pb.InstantiateParticles(collision.contacts[0].point, gameObject.transform.parent.gameObject); } else { pb.InstantiateParticles(collision.contacts[0].point, gameObject); } } }