예제 #1
0
        public void GetCostTest_1本第1_2_3_4_5集_375元()
        {
            List <IHarryPotterBook> books = new List <IHarryPotterBook> {
                new HarryPotterBook1 {
                    count = 1
                },
                new HarryPotterBook2 {
                    count = 1
                },
                new HarryPotterBook3 {
                    count = 1
                },
                new HarryPotterBook4 {
                    count = 1
                },
                new HarryPotterBook5 {
                    count = 1
                }
            };
            HarryPotter target = new HarryPotter();

            decimal expected = 375;
            var     actual   = target.GetCost(books);

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Hero Jason = new Hero("Jason", 3, 15);

            Ork Harvey = new Ork("Ork Harvey", 1, 5);
            Ork Ben    = new Ork("Ork Ben", 2, 8);

            Klingon Aaron = new Klingon("Klingon Aaron", 3, 12);
            Klingon Josh  = new Klingon("Klingon Josh", 5, 15);

            HarryPotter HarryPotter1 = new HarryPotter("Harry Potter gen.1", 7, 20, 2);
            HarryPotter HarryPotter2 = new HarryPotter("Harry Potter gen.2", 8, 20, 3);
            HarryPotter HarryPotter3 = new HarryPotter("Harry Potter gen.3", 10, 25, 4);

            Story.BeforeOrk();
            Battle.WithOrk(Jason, Harvey);
            Battle.WithOrk(Jason, Ben);

            Jason.LevelUp();

            Story.BeforeKlingon();
            Battle.WithKlingon(Jason, Aaron);
            Battle.WithKlingon(Jason, Josh);

            Jason.LevelUp();

            Story.BeforeHarryPotter();
            Battle.WithHarryPotter(Jason, HarryPotter1);
            Battle.WithHarryPotter(Jason, HarryPotter2);
            Battle.WithHarryPotter(Jason, HarryPotter3);

            Story.TheEnd();
        }
예제 #3
0
        public void GetCostTest_1本第1集_100元()
        {
            List <IHarryPotterBook> books = new List <IHarryPotterBook> {
                new HarryPotterBook1 {
                    count = 1
                }
            };
            HarryPotter target = new HarryPotter();

            decimal expected = 100;
            var     actual   = target.GetCost(books);

            Assert.AreEqual(expected, actual);
        }
예제 #4
0
 public static void WithHarryPotter(Hero hero, HarryPotter HarryPotter)
 {
     while (HarryPotter.health > 0 && hero.health > 0)
     {
         PrintTheStats(HarryPotter, hero);
         hero.YourTurn(hero.Choice(), HarryPotter);
         if (HarryPotter.health > 0)
         {
             HarryPotter.HarryPotterTurn(HarryPotter.EChoice(), hero);
             IsHeroDead(hero);
         }
     }
     Console.WriteLine("{0} was killed !", HarryPotter.name);
     Console.ReadLine();
     Console.Clear();
 }
예제 #5
0
        private void InitializeMonsters() //initializes monsters and adds them to a list
        {
            NiceOldLady niceOldLady = new NiceOldLady();
            Greta       greta       = new Greta();
            Ghandi      ghandi      = new Ghandi();
            MLK         mLK         = new MLK();
            ObiWan      obiWan      = new ObiWan();
            Superman    superman    = new Superman();
            Frodo       frodo       = new Frodo();
            Batman      batman      = new Batman();
            McFly       mcFly       = new McFly();
            HarryPotter harryPotter = new HarryPotter();
            TrashMob    trashMob    = new TrashMob();

            listOfSpecialMonsters.AddRange(new Monster[]
            {
                greta, niceOldLady, ghandi, mLK, obiWan, superman, frodo, batman, mcFly, harryPotter
            });

            List <Monster> listToShuffle = new List <Monster>()
            {
                greta, niceOldLady, ghandi, mLK, obiWan, superman, frodo, batman, mcFly, harryPotter
            };

            //randomizes monsters to a new list so that the player doesnt always meet them in the same order
            int i = listToShuffle.Count;

            while (i > 0)
            {
                if (random.Next(10) <= 7)
                {
                    listOfMonsters.Add(trashMob);
                }
                else
                {
                    i--;
                    int listIndex = random.Next(i + 1);
                    listOfMonsters.Add(listToShuffle[listIndex]);
                    listToShuffle.RemoveAt(listIndex);
                }
            }
        }
 public double CheckOut(HarryPotter[] books)
 {
     var groupedBooks = GroupBooks(books);
     return groupedBooks.Sum(x => CalculateTotalPrice(x));
 }