public void LedenToevoegenMetGoedgekeurdeMotivatie()
        {
            motivatie.Goedgekeurd = true;

            groep.Motivaties.Add(motivatie);
            Assert.Throws <ArgumentException>(() => groep.VoegCursistToe(cursist1));
        }
        public IActionResult AccepteerGroep(Cursist cursist, AccepteerGroepViewModel model)
        {
            try
            {
                Groep groep = _groepRepository.GetBy(model.GroepNaam);
                groep.VoegCursistToe(cursist);
                _groepRepository.UpdateGroep(groep);
                _cursistRepository.UpdateCursist(cursist);

                _groepRepository.SaveChanges();
                // melding verwijderen + message meegeven?
                //ViewBag._userMessage = $"U bent succesvol toegevoegd aan {groep.Naam} ";
                return(RedirectToAction(nameof(ToonLeden), "BeherenGroep"));
            }
            catch (ArgumentException e)
            {
                cursist.Meldingen.Remove(cursist.Meldingen.Find(c => c.GroepNaam == model.GroepNaam));
                _cursistRepository.SaveChanges();
                @ViewBag._userError = e.Message;
                List <Melding> meldingen = cursist.Meldingen;
                List <Groep>   groepen   = new List <Groep>();

                meldingen.ForEach(m =>
                {
                    String naam = m.GroepNaam;
                    if (naam != null)
                    {
                        groepen.Add(_groepRepository.GetBy(naam));
                    }
                });

                ViewBag.groep = groepen;
                return(View("MaakGroep"));
            }
        }
        public GroepTest()
        {
            locatie = new Locatie("a", 2, "Bel", 9000, "Gent");
            school  = school = new School("Test", "*****@*****.**", locatie);

            groep  = new Groep("groep1", false);
            groep1 = new Groep("blablabla", false);

            cursist1 = new Cursist("Steve", "Sinaeve", "*****@*****.**");
            cursist6 = new Cursist("test", "testen", "*****@*****.**");

            Melding melding = new Melding("U bent uitgenodigd", groep.Naam);

            cursist6.Meldingen.Add(melding);

            cursist = new Cursist("Jochem", "Van Hespen", "*****@*****.**");
            groep.VoegCursistToe(cursist);

            cursist2 = new Cursist("Jochem", "Van Hespen", "*****@*****.**");
            cursist3 = new Cursist("Jochem", "Van Hespen", "*****@*****.**");
            cursist4 = new Cursist("Jochem", "Van Hespen", "*****@*****.**");
            cursist5 = new Cursist("Jochem", "Van Hespen", "*****@*****.**");
            groep1.VoegCursistToe(cursist2);
            groep1.VoegCursistToe(cursist3);
            groep1.VoegCursistToe(cursist4);
            groep1.VoegCursistToe(cursist5);
            Locatie locatie5 = new Locatie("Poortstraat", 52, "Belgiƫ", 8820, "Torhout");

            Organisatie org2 = new Organisatie("SK Torhout", "*****@*****.**", locatie5, "iets");

            org2.Contactpersonen.Add(It.IsAny <Contactpersoon>());
            String inhoudMotivatie =
                "ok ok ok ok ok ok  kook ok ok o kok ok ok o kok o ko kook ok ok o kok ok ok o kok o ko kook ok ok o kok ok ok o kok o ko kook ok ok o kok ok ok o kok o ko ko ko ko ko k ok ok ok o k ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok okk ok ok ok o ko k ok ok ok o k";

            motivatie  = new Motivatie(inhoudMotivatie, org2);
            motivatie1 = new Motivatie(inhoudMotivatie, org2);
        }
Example #4
0
        public ActieControllerTest()
        {
            _groepRepository     = new Mock <IGroepRepository>();
            _actieRepository     = new Mock <IActieRepository>();
            _cursistRepository   = new Mock <ICursistRepository>();
            _containerRepository = new Mock <IActieContainerRepository>();
            _berichtRepository   = new Mock <IBerichtRepository>();
            _controller          = new ActieController(_actieRepository.Object, _groepRepository.Object,
                                                       _cursistRepository.Object, _containerRepository.Object, _berichtRepository.Object);
            _cursist       = new Cursist("Fulvio", "Gentile", "*****@*****.**");
            _groep         = new Groep("G11", false);
            _cursist.Groep = _groep;
            _groep.VoegCursistToe(_cursist);

            _cursist2       = new Cursist("Robin", "Gammoudi", "*****@*****.**");
            _groep2         = new Groep("G12", false);
            _cursist2.Groep = _groep2;
            _groep2.VoegCursistToe(_cursist2);
            _groep2.CurrentState = new MotivatieGoedgekeurdState(_groep);
            _groep2.AddContainer(new ActieContainer());

            _groep2.VoegActieToe(new Actie("Testactie", "Testomschrijving"));
            _controller.DienActiesIn(_cursist2);
        }