public void WalletAddCoinSuccess() { Wallet wallet = new Wallet(); int currentBalance = wallet.Balance; wallet.AddCoin(5); Assert.AreEqual(currentBalance + 5, wallet.Balance); }
void OnTriggerEnter(Collider collider) { Debug.Log("trigger"); if (collider.tag == "Tower") { Debug.Log("trigger2"); var tower = collider.GetComponent <Tower>(); tower.MessengerArrived(); tower.PickMessenger(prefab); destroying = true; Destroy(Camera.main.gameObject.GetComponent <Follow>()); Destroy(gameObject); GameObject[] go = GameObject.FindGameObjectsWithTag("StarOff"); go[0].tag = "StarOn"; Color color = go[0].GetComponent <Image>().color; go[0].GetComponent <Image>().sprite = starOn; color = Color.white; color.a = 1.0f; } if (collider.tag == "Coin") { if (wallet != null) { wallet.AddCoin(); Destroy(collider.gameObject.GetComponent <Renderer>()); collider.GetComponent <AudioSource>().Play(); } } if (collider.tag == "Finish") { Debug.LogWarning("Winnn"); name = SceneManager.GetActiveScene().name; if (name == "EU") { SceneManager.LoadScene("EEUU"); } else if (name == "EEUU") { SceneManager.LoadScene("Venezuela"); } else { SceneManager.LoadScene("Win"); } } if (collider.tag == "Cloud") { collider.GetComponent <Animator>().SetBool("Collision", true); GetComponent <Rigidbody>().AddForce(cloudBump); collider.GetComponent <AudioSource>().Play(); } }
public void WalletAddAndGetNotExistsCoinExeption() { List <ICoin> coins = new List <ICoin>(); coins.Add(new Coin(1)); coins.Add(new Coin(2)); coins.Add(new Coin(5)); coins.Add(new Coin(10)); Wallet wallet = new Wallet(coins); Action notExistsCoinGet = () => wallet.AddCoin(13); Action notExistsCoinValueAdd = () => wallet.GetCoin(13); Assert.ThrowsException <Exception>(notExistsCoinGet); Assert.ThrowsException <Exception>(notExistsCoinValueAdd); }