< Summary

Class:Government
Assembly:Test
File(s):D:/--UnityProject/VR/subjects/UnityCityView/Assets/Scripts/Government.cs
Covered lines:29
Uncovered lines:2
Coverable lines:31
Total lines:52
Line coverage:93.5% (29 of 31)
Covered branches:0
Total branches:0
Covered methods:7
Total methods:7
Method coverage:100% (7 of 7)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%000100%
Update()0%000100%
showlabel()0%000100%
GetLabel()0%00084.21%
GetBuilding8Name()0%000100%
GetBuilding9Name()0%000100%
GetBuilding91Name()0%000100%

File(s)

D:/--UnityProject/VR/subjects/UnityCityView/Assets/Scripts/Government.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using TMPro;
 5
 6public class Government : MonoBehaviour
 7{
 8    // Start is called before the first frame update
 9  GameObject label;
 10
 11    void Start()
 312    {
 313        GameObject player = GameObject.Find("Player");
 314    label = player.transform.GetChild(1).gameObject;
 315    }
 16
 17    // Update is called once per frame
 18    void Update()
 1044619    {
 20
 1044621    }
 622  public void showlabel(){
 623    label.GetComponent<TextMeshPro>().text = GetLabel().Substring(0, 20);
 624  }
 25
 626  string GetLabel(){
 627    string ret = "Government:";
 828    if(gameObject.name == "Building8"){
 229      ret = ret + GetBuilding8Name();
 830    }else if(gameObject.name == "Building9"){
 231      ret = ret + GetBuilding9Name();
 632    }else if(gameObject.name == "Building91"){
 233      ret = ret + GetBuilding91Name();
 234    }else{
 035      ret = ret + "Unknown Department";
 036    }
 637    return ret;
 638  }
 39
 240  string GetBuilding8Name(){
 241    return "Town Hall";
 242  }
 43
 244  string GetBuilding9Name(){
 245    return "Police Department";
 246  }
 47
 248  string GetBuilding91Name(){
 249    return "Financial Department";
 250  }
 51
 52}