public void testBoundryThreeStarLevelOne() { LevelEnd le = new LevelEnd(); le.threeStarScore = 5000; GameObject gb = new GameObject("stest"); GameObject gb2 = new GameObject("ctest"); UnityEngine.UI.Text st = gb.AddComponent<UnityEngine.UI.Text>(); UnityEngine.UI.Text ct = gb2.AddComponent<UnityEngine.UI.Text>(); Slider suspicionSlider = gb.AddComponent<Slider>(); st.text = "Time: 30"; ct.text = "Cookie: 0"; suspicionSlider.maxValue = 5000f; suspicionSlider.value = 198f; le.cookieText = ct; le.timeText = st; le.suspicionSlider = suspicionSlider; le.CalculateScore(); Assert.AreEqual(5001, le.getScore()); Assert.AreEqual(3, le.getStar()); }
public void testTwostarLevelTwo() { LevelEnd le = new LevelEnd(); le.threeStarScore = 3000; GameObject gb = new GameObject("stest"); GameObject gb2 = new GameObject("ctest"); UnityEngine.UI.Text st = gb.AddComponent<UnityEngine.UI.Text>(); UnityEngine.UI.Text ct = gb2.AddComponent<UnityEngine.UI.Text>(); Slider suspicionSlider = gb.AddComponent<Slider>(); st.text = "Time: 110"; ct.text = "Cookie: 0"; suspicionSlider.value = 0; le.cookieText = ct; le.timeText = st; le.suspicionSlider = suspicionSlider; le.CalculateScore(); Assert.AreEqual(2700, le.getScore()); Assert.AreEqual(2, le.getStar()); }