示例#1
0
 public void testCookieScore()
 {
     LevelEnd le = new LevelEnd();
     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: 0";
     ct.text = "Cookie: 1";
     suspicionSlider.value = 0;
     le.cookieText = ct;
     le.timeText = st;
     le.suspicionSlider = suspicionSlider;
     le.CalculateScore();
     Assert.AreEqual(6500, le.getScore());
 }
示例#2
0
 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());
 }