public void That_GetCount_Returns0ForNoShotsTaken()
        {
            // given a shot counter
            IShotCounter serviceToTest = new ShotCounter();

            // when no shots taken
            int actual = serviceToTest.GetCount();

            // assert - result is 0
            Assert.AreEqual(0, actual);
        }
        public void That_GetCount_Returns1AfterShotTakenAndCounterWas0()
        {
            // given a shot counter, starting at 0
            IShotCounter serviceToTest = new ShotCounter();

            // when one shot taken
            serviceToTest.AddShot(currentShotCount: 0);
            int actual = serviceToTest.GetCount();

            // assert - result is 1
            Assert.AreEqual(1, actual);
        }
        public void That_GetCount_Returns6AfterShotTakenAndCounterWas5()
        {
            // given a shot counter starting at 5
            int          startCount    = 5;
            IShotCounter serviceToTest = new ShotCounter();

            // when one shot taken
            serviceToTest.AddShot(startCount);
            int actual = serviceToTest.GetCount();

            // assert - result is 6
            Assert.AreEqual(6, actual);
        }
 private void Awake()
 {
     shotCounter    = GameObject.Find("ShotCounter").GetComponent <ShotCounter>();
     ballsCountText = GameObject.Find("BallsCountText").GetComponent <Text>();
     ballContainer  = GameObject.Find("BallContainer");
 }
示例#5
0
    // Update is called once per frame
    /*void Update () {

    }*/
    public void updateShots(string passedString)
    {
        // Initialize shot counter if not done yet
        if(shotCounter == null)
        {
            shotCounter = GameObject.Find("ShotCounter").GetComponent<ShotCounter>();
        }
        shotCounter.updateShotCounter (passedString);
    }