// Make sure to add event handler for Load
 private void Form1_Load(object sender, EventArgs e)
 {
     lanparty = new DinnerParty((int)NumberUpDown1.Value,
                                CheckBoxHealth.Checked,
                                CheckBoxDecotations.Checked);
     GetLanPartyConfiguration();
     DisplayDinnerPartyCost();
 }
        public void T02_CalculateDecorationCostsTest()
        {
            DinnerParty d1 = new DinnerParty(10, false);

            Assert.AreEqual(30 + 7.5 * 10, d1.CalculateDecorationCosts(), 0.1, "Falsche Decokosten bei DinnerParty!");
            BirthdayParty b1 = new BirthdayParty(20, true, "Hello");

            Assert.AreEqual(50 + 15 * 20, b1.CalculateDecorationCosts(), 0.1, "Falsche Decokosten bei Geburtstagsparty!");
        }
        public void T03_CalculateCleaningCostsTest()
        {
            DinnerParty d1 = new DinnerParty(10, false);

            Assert.AreEqual(105 * 0.10, d1.CalculateCleaningCosts(), 0.1, "Falsche Reinigungskosten bei DinnerParty!");
            BirthdayParty b1 = new BirthdayParty(20, true, "Hello");

            Assert.AreEqual(350 * 0.15, b1.CalculateCleaningCosts(), 0.1, "Falsche Reinigungskosten bei Geburtstagsparty!");
        }
 public Form1()
 {
     InitializeComponent();
     dinnerParty = new DinnerParty((int)numericUpDown1.Value,
                         healthyBox.Checked, fancyBox.Checked);
     DisplayDinnerPartyCost();
     birthdayParty = new BirthdayParty((int)numberBirthday.Value,
                         fancyBirthday.Checked, txtCakeWriting.Text);
     DisplayBirthdayPartyCost();
 }
Example #5
0
        public void DinnerPartyTests_FiveFriends()
        {
            DinnerParty myParty = new DinnerParty();

            int[]        guests            = { 1, 2, 3, 4, 5 };
            int          tableSize         = 3;
            List <int[]> guestPermutations = myParty.FindDinnerParties(guests, tableSize);

            Assert.AreEqual(10, guestPermutations.Count);
        }
        public void T01_Constructor()
        {
            Assert.IsTrue(typeof(Party).IsAbstract, "Klasse Party sollte abstract sein!");
            DinnerParty   d1 = new DinnerParty(10, false);
            BirthdayParty b1 = new BirthdayParty(20, true, "Hello");

            Assert.AreEqual(10, d1.NumberOfPeople, "10 Personen sollten auf der Dinnerparty sein!");
            Assert.AreEqual(20, b1.NumberOfPeople, "20 Personen sollten auf der Geburtstagsparty sein!");
            Assert.AreEqual(false, d1.FancyDecorations, "Dinnerparty sollte keine ausgefallene Deco haben!");
            Assert.AreEqual(true, b1.FancyDecorations, "Geburtstagsparty sollte ausgefallene Deco haben!");
        }
Example #7
0
        public void T07_AddPartyTest()
        {
            Controller  target = new Controller(); // TODO: Initialize to an appropriate value
            DinnerParty d1     = new DinnerParty(10, false);

            target.AddParty(d1);
            Assert.AreEqual(1, target.PartyList.Count, "Nach einer hinzugefügten Party sollte eine Party in der Collection sein!");
            BirthdayParty b1 = new BirthdayParty(20, true, "Hello");

            target.AddParty(b1);
            Assert.AreEqual(2, target.PartyList.Count, "Nach zwei hinzugefügten Party sollten zwei Party in der Collection sein!");
        }
        public void NegativeDinnerPartyTest()
        {
            //arrange
            int  numberOfPeople  = -1;
            bool helthyOption    = true;
            bool fancyDecoration = true;

            //act
            DinnerParty party = new DinnerParty(numberOfPeople, helthyOption, fancyDecoration);

            //assert
            Assert.AreEqual(party.NumberOfPeople, numberOfPeople);
        }
        public void NegativeCalculateCostOfBeveregePerPersonTest()
        {
            //arrange
            int  numberOfPeople  = 0;
            bool helthyOption    = true;
            bool fancyDecoration = true;

            //act
            DinnerParty party = new DinnerParty(numberOfPeople, helthyOption, fancyDecoration);

            party.CalculateCostOfBeveregePerPerson();

            //assert
        }
Example #10
0
        public void T11_CountDinnerPartiesTest()
        {
            Controller  target = new Controller(); // TODO: Initialize to an appropriate value
            DinnerParty d1     = new DinnerParty(10, false);

            target.AddParty(d1);
            Assert.AreEqual(1, target.CountDinnerParties, "Es ist eine Dinnerparty in der Liste!");
            BirthdayParty b1 = new BirthdayParty(20, true, "Hello");

            target.AddParty(b1);
            target.AddParty(new DinnerParty(100, true));
            target.AddParty(new BirthdayParty(1, false, ""));
            target.AddParty(new DinnerParty(2, false));
            Assert.AreEqual(3, target.CountDinnerParties, "Es sind drei Dinnerpartys in der Liste!");
        }
Example #11
0
        public void T09_CalculateTotalCostsTest()
        {
            Controller  target = new Controller(); // TODO: Initialize to an appropriate value
            DinnerParty d1     = new DinnerParty(10, false);

            Assert.AreEqual(105 + 10.5 + 10 * 25, d1.CalculateCosts(), 0.1, "Dinnerparty mit normaler Deco liefert falsche Kosten!");
            target.AddParty(d1);
            d1 = new DinnerParty(100, true);
            Assert.AreEqual(1550 + 1550 * 0.10 + 100 * 25, d1.CalculateCosts(), 0.1, "Dinnerparty mit spezieller Deco liefert falsche Kosten!");
            target.AddParty(d1);
            BirthdayParty b1 = new BirthdayParty(20, true, "");

            target.AddParty(b1);
            Assert.AreEqual(350 + 350 * 0.15 + 20 * 25 + 75 + 1550 + 1550 * 0.10 + 100 * 25 + 105 + 10.5 + 10 * 25, target.CalculateTotalCosts(), 0.1, "Birthdayparty mit normaler Deco und unbeschrifteten Kuchen liefert falsche Kosten!");
        }
Example #12
0
        public void T08_AddPartyOrderedTest()
        {
            Controller  target = new Controller(); // TODO: Initialize to an appropriate value
            DinnerParty d1     = new DinnerParty(10, false);

            target.AddParty(d1);
            BirthdayParty b1 = new BirthdayParty(20, true, "Hello");

            target.AddParty(b1);
            Assert.AreEqual(2, target.PartyList.Count, "Nach zwei hinzugefügten Party sollten zwei Party in der Collection sein!");
            Assert.AreEqual(b1, target.PartyList[0], "Die teuerste Party sollte an erster Stelle der Liste stehen!");
            target.AddParty(new DinnerParty(100, true));
            Assert.AreEqual(b1, target.PartyList[1], "Die teuerste Party sollte an erster Stelle der Liste stehen!");
            target.AddParty(new DinnerParty(1, false));
            Assert.AreEqual(1, target.PartyList[3].NumberOfPeople, "Die günstigste Party sollte an letzter Stelle der Liste stehen!");
            target.AddParty(new DinnerParty(2, false));
            Assert.AreEqual(2, target.PartyList[3].NumberOfPeople, "Die zweitgünstigste Party sollte an vorletzter Stelle der Liste stehen!");
        }
Example #13
0
        private static void Main(string[] args)
        {
            string[] parties;
            string[] partyData;
            bool     headingsNotRead = true;

            Controller controller = new Controller();

            parties = File.ReadAllLines("Parties.csv");

            foreach (string party in parties)
            {
                //Partytyp; Personenanzahl; Spezielle Deko; Tortentext;
                //B; 10; nein; Franz;
                //D; 15; nein; ;
                //D; 7; ja; ;
                //B; 5; ja; Happy Birthday;

                if (headingsNotRead)
                {
                    headingsNotRead = false;
                }
                else
                {
                    bool specialDecoration = false;
                    partyData = party.Split(';');
                    if (partyData[2].Contains("j"))
                    {
                        specialDecoration = true;
                    }
                    if (partyData[0].Contains("B"))
                    {
                        BirthdayParty birthdayParty = new BirthdayParty(Convert.ToInt32(partyData[1]), specialDecoration, partyData[3]);
                        controller.AddParty(birthdayParty);
                    }
                    else
                    {
                        DinnerParty dinnerParty = new DinnerParty(Convert.ToInt32(partyData[1]), specialDecoration);
                        controller.AddParty(dinnerParty);
                    }
                }
            }
            Console.WriteLine($"Gesamtkosten aller Parties: {controller.CalculateTotalCosts(),6}");
        }
Example #14
0
        public void CalculateCostOfBeveregePerPersonTest()
        {
            //arrange
            int     numberOfPeople  = 15;
            bool    helthyOption1   = true;
            bool    helthyOption2   = false;
            bool    fancyDecoration = true;
            decimal expected1       = 5M;
            decimal expected2       = 20M;

            //act
            DinnerParty party1  = new DinnerParty(numberOfPeople, helthyOption1, fancyDecoration);
            decimal     actual1 = party1.CalculateCostOfBeveregePerPerson();

            DinnerParty party2  = new DinnerParty(numberOfPeople, helthyOption2, fancyDecoration);
            decimal     actual2 = party2.CalculateCostOfBeveregePerPerson();

            //assert
            Assert.AreEqual(expected1, actual1);
            Assert.AreEqual(expected2, actual2);
        }
Example #15
0
        static List <party> CreatePartiesWithManualInput()
        {
            List <party> parties = new List <party>();

            bool   stopCreatingParties = false;
            EParty partyKeuze;
            int    aantal;
            bool   isLuxe;

            while (!stopCreatingParties)
            {
                try
                {
                    Console.WriteLine("Wilt u een dinner(1) of birthday(2) party?");
                    String partyInputKeuze = Console.ReadLine();
                    if (partyInputKeuze == null || !(partyInputKeuze == "1" || partyInputKeuze == "2"))
                    {
                        throw new PartyException("Je moet kiezen tussen dinner (1) of birtday (2)");
                    }
                    partyKeuze = partyInputKeuze == "1" ? EParty.DINNER : EParty.BIRTHDAY;
                }
                catch (PartyException)
                {
                    continue;
                }

                try
                {
                    Console.WriteLine("Geef het aantal personen voor u feestje?");
                    String aantalPersonenKeuze = Console.ReadLine();
                    if (!int.TryParse(aantalPersonenKeuze, out aantal))
                    {
                        throw new PartyException("Geef het aantal personen voor uw feestje!");
                    }
                }
                catch (PartyException)
                {
                    continue;
                }

                try
                {
                    Console.WriteLine("Wilt u een luxe(Y) of geen luxe(N) party?");
                    String luxeInputKeuze = Console.ReadLine().ToUpper();
                    if (luxeInputKeuze == null || !(luxeInputKeuze == "Y" || luxeInputKeuze == "N"))
                    {
                        throw new PartyException("U moet Y of N invullen!");
                    }
                    isLuxe = luxeInputKeuze == "Y";
                }
                catch (PartyException)
                {
                    continue;
                }

                try
                {
                    if (partyKeuze == EParty.DINNER)
                    {
                        Console.WriteLine("Wilt u een gezonde(Y) of geen gezonde(N) party?");
                        String gezondeInputKeuze = Console.ReadLine().ToUpper();
                        if (gezondeInputKeuze == null || !(gezondeInputKeuze == "Y" || gezondeInputKeuze == "N"))
                        {
                            throw new PartyException("U moet Y of N invullen!");
                        }
                        bool isGezondeKeuze = gezondeInputKeuze == "Y";

                        DinnerParty dp = new DinnerParty(aantal, isGezondeKeuze, isLuxe);

                        parties.Add(dp);
                    }
                    else
                    {
                        //If Birtday party => Boodschap?.
                        //Maak nieuwe party aan en voeg toe aan lijst
                        Console.WriteLine("Welk bericht wilt u op de taart?(leeg laten indien geen)");
                        String taartInputKeuze = Console.ReadLine();

                        BirthdayParty bp = new BirthdayParty(aantal, isLuxe, taartInputKeuze);

                        parties.Add(bp);
                    }
                }
                catch (PartyException)
                {
                    continue;
                }

                try
                {
                    Console.WriteLine("Wilt u een feestje toevoegen(Y) of stoppen(N)?");
                    String nogFeestjeInputKeuze = Console.ReadLine().ToUpper();
                    if (nogFeestjeInputKeuze == null || !(nogFeestjeInputKeuze == "Y" || nogFeestjeInputKeuze == "N"))
                    {
                        throw new PartyException("U moet Y of N invullen!");
                    }
                    stopCreatingParties = nogFeestjeInputKeuze == "N";
                }
                catch (PartyException)
                {
                    continue;
                }
            }

            return(parties);
        }
Example #16
0
     public Form1()
     {
         InitializeComponent();
 
         dinnerParty = new DinnerParty().SetPartyOptions( 5, true );
 private void Form1_Load(object sender, EventArgs e)
 {
     lanparty              = new DinnerParty((int)NumberUpDown1.Value, CheckBoxHealth.Checked, CheckBoxDecotations.Checked);
     lanparty.CostUpdated += lanparty_CostUpdated;
     DisplayDinnerPartyCost();
 }