Пример #1
0
        public static void Main()
        {
            HeroRepository repository = new HeroRepository();

            Item item = new Item(23, 35, 48);

            Console.WriteLine(item);

            Hero hero = new Hero("Hero Name", 24, item);

            Console.WriteLine(hero);

            repository.Add(hero);
            repository.Remove("Hero Name");

            Item secondItem = new Item(100, 20, 13);
            Hero secondHero = new Hero("Second Hero Name", 125, secondItem);

            repository.Add(hero);
            repository.Add(secondHero);

            var heroStrength     = repository.GetHeroWithHighestStrength();
            var heroAbility      = repository.GetHeroWithHighestAbility();
            var heroIntelligence = repository.GetHeroWithHighestIntelligence();

            Console.WriteLine(repository.Count);
            Console.WriteLine(repository);
        }
Пример #2
0
        public static void Main()
        {
            HeroRepository repository = new HeroRepository();
            //Initialize entity
            Item item = new Item(23, 35, 48);

            //Print Item
            Console.WriteLine(item);
            Hero hero = new Hero("Hero Name", 24, item);

            //Print Hero
            Console.WriteLine(hero);

            repository.Add(hero);
            //Remove Hero
            repository.Remove("Hero Name");

            Item secondItem = new Item(100, 20, 13);
            Hero secondHero = new Hero("Second Hero Name", 125, secondItem);

            //Add Heroes
            repository.Add(hero);
            repository.Add(secondHero);

            Hero heroStrength     = repository.GetHeroWithHighestStrength();     // Hero with name Second Hero
            Hero heroAbility      = repository.GetHeroWithHighestAbility();      // Hero with name Hero Name
            Hero heroIntelligence = repository.GetHeroWithHighestIntelligence(); // Hero with name Hero

            Console.WriteLine(repository.Count);                                 //2

            Console.WriteLine(repository);
        }
        public static void Main(string[] args)
        {
            //Initialize the repository
            HeroRepository repository = new HeroRepository();
            //Initialize entity
            Item item = new Item(23, 35, 48);

            //Print Item
            Console.WriteLine(item);

            //Item:
            //    * Strength: 23
            //    * Ability: 35
            //    * Intelligence: 48

            //Initialize entity
            Hero hero = new Hero("Hero Name", 24, item);

            //Print Hero
            Console.WriteLine(hero);

            //Hero: Hero Name - 24lvl
            //Item:
            //    * Strength: 23
            //    * Ability: 35
            //    * Intelligence: 48

            //Add Hero
            repository.Add(hero);
            //Remove Hero
            repository.Remove("Hero Name");

            Item secondItem = new Item(100, 20, 13);
            Hero secondHero = new Hero("Second Hero Name", 125, secondItem);

            //Add Heroes
            repository.Add(hero);
            repository.Add(secondHero);

            Hero heroStrength     = repository.GetHeroWithHighestStrength();     // Hero with name Second Hero
            Hero heroAbility      = repository.GetHeroWithHighestAbility();      // Hero with name Hero Name
            Hero heroIntelligence = repository.GetHeroWithHighestIntelligence(); // Hero with name Hero

            Console.WriteLine(heroStrength);
            Console.WriteLine(heroAbility);
            Console.WriteLine(heroIntelligence);
            Console.WriteLine(repository.Count); //2

            Console.WriteLine(repository);
            //Hero: Hero Name - 24lvl
            //Item:
            //*Strength: 23
            //    * Ability: 35
            //    * Intelligence: 48
            //Hero: Second Hero Name - 125lvl
            //Item:
            //    * Strength: 100
            //    * Ability: 20
            //    * Intelligence: 13
        }
Пример #4
0
        public static void Main()
        {
            //  Item newItem = new Item(11, 12, 13);
            //  Hero newHero = new Hero("Me", 12, newItem);
            // // System.Console.WriteLine(newHero);

            //  Item newItem2 = new Item(14, 15, 16);
            //  Hero newHero2= new Hero("Me2", 12, newItem);
            ////  System.Console.WriteLine(newHero);
            //  HeroRepository data = new HeroRepository();
            //  data.Add(newHero2);
            //  data.Add(newHero);
            //  data.ToString();
            //Initialize the repository
            HeroRepository repository = new HeroRepository();
            //Initialize entity
            Item item = new Item(23, 35, 48);

            //Print Item
            Console.WriteLine(item);

            //Item:
            //    * Strength: 23
            //    * Ability: 35
            //    * Intelligence: 48

            //Initialize entity
            Hero hero = new Hero("Hero Name", 24, item);

            //Print Hero
            //Console.WriteLine(hero);

            //Hero: Hero Name - 24lvl
            //Item:
            //    * Strength: 23
            //    * Ability: 35
            //    * Intelligence: 48

            //Add Hero
            repository.Add(hero);
            //Remove Hero
            repository.Remove("Hero Name");

            Item secondItem = new Item(100, 20, 13);
            Hero secondHero = new Hero("Second Hero Name", 125, secondItem);

            //Add Heroes
            repository.Add(hero);
            repository.Add(secondHero);

            Hero heroStrength     = repository.GetHeroWithHighestStrength();     // Hero with name Second Hero
            Hero heroAbility      = repository.GetHeroWithHighestAbility();      // Hero with name Hero Name
            Hero heroIntelligence = repository.GetHeroWithHighestIntelligence(); // Hero with name Hero

            // Console.WriteLine(repository.Count); //2

            Console.WriteLine(repository);
        }