Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            if (!typeof(Subteam).IsSubclassOf(typeof(Team)))
            {
                throw new Exception("Subteam class should inherit from Team class");
            }

            String str = Console.ReadLine();

            String[] strArr      = str.Split();
            string   initialName = strArr[0];
            int      count       = Convert.ToInt32(strArr[1]);
            Subteam  teamObj     = new Subteam(initialName, count);

            Console.WriteLine("Team " + teamObj.teamName + " created");

            str   = Console.ReadLine();
            count = Convert.ToInt32(str);
            Console.WriteLine("Current number of players in team " + teamObj.teamName + " is " + teamObj.noOfPlayers);
            teamObj.AddPlayer(count);
            Console.WriteLine("New number of players in team " + teamObj.teamName + " is " + teamObj.noOfPlayers);


            str   = Console.ReadLine();
            count = Convert.ToInt32(str);
            Console.WriteLine("Current number of players in team " + teamObj.teamName + " is " + teamObj.noOfPlayers);
            var res = teamObj.RemovePlayer(count);

            if (res)
            {
                Console.WriteLine("New number of players in team " + teamObj.teamName + " is " + teamObj.noOfPlayers);
            }
            else
            {
                Console.WriteLine("Number of players in team " + teamObj.teamName + " remains same");
            }

            str = Console.ReadLine();
            teamObj.ChangeTeamName(str);
            Console.WriteLine("Team name of team " + initialName + " changed to " + teamObj.teamName);
            Console.ReadLine();
        }
Exemplo n.º 2
0
 public void Group()
 {
     Assert.Equal("<!subteam^SAZ94GDB8>", Subteam.Text("SAZ94GDB8"));
 }