示例#1
0
        public void VerwijderActie()
        {
            _groep.CurrentState = new MotivatieGoedgekeurdState(_groep);

            var model = new VerwijderActieModel();

            model.actieId = 1;

            var container = new ActieContainer();

            _groep.AddContainer(container);


            var actie = new Actie("Test", "Actie");

            container.VoegActieToe(actie);

            _actieRepository.Setup(c => c.GetById(1)).Returns(actie);


            var result   = _controller.VerWijderActie(_cursist, model);
            var redirect = result as ViewResult;

            _actieRepository.Verify(a => a.SaveChanges(), Times.Once);
            Assert.Equal("MaakActie", redirect?.ViewName);
        }
示例#2
0
        public void VoegActieToeAfgekeurdeContainer()
        {
            _groep.CurrentState = new MotivatieGoedgekeurdState(_groep);
            var model     = new ActieViewModel();
            var container = new ActieContainer();

            container.Beoordeeld = true;
            _groep.AddContainer(container);
            _controller.ActieMaken(_cursist);
            model.Titel        = "Test";
            model.Omschrijving = "Test";
            _controller.VoegActieToe(_cursist, model);

            _actieRepository.Verify(a => a.SaveChanges(), Times.Once);
        }
示例#3
0
        public void VoegActieToeMetContainer()
        {
            _groep.CurrentState = new MotivatieGoedgekeurdState(_groep);
            var model     = new ActieViewModel();
            var container = new ActieContainer();

            _groep.AddContainer(container);
            _controller.ActieMaken(_cursist);
            model.Titel        = "Test";
            model.Omschrijving = "Test";

            _controller.VoegActieToe(_cursist, model);

            _actieRepository.Verify(a => a.SaveChanges(), Times.Once);
            Assert.Equal(container, _groep.GeefLaatsteContainer());
        }
示例#4
0
        public void MaakBericht_MaaktBerichtAan()
        {
            var model = new DeelActieViewModel();

            _groep2.CurrentState = new MotivatieGoedgekeurdState(_groep);

            model.Id = 1;

            var container = new ActieContainer();

            _groep2.AddContainer(container);
            var actie = new Actie("Test", "Actie");

            container.VoegActieToe(actie);
            _actieRepository.Setup(c => c.GeefActie(1)).Returns(actie);
            _actieRepository.Setup(c => c.GetById(1)).Returns(actie);

            model.Aankodiging = "TestBeschrijving";
            _controller.MaakBericht(_cursist2, model);

            _actieRepository.Verify(a => a.SaveChanges());
        }
示例#5
0
        public void MaakBericht_ReturntIndex()
        {
            var model = new DeelActieViewModel();

            _groep2.CurrentState = new MotivatieGoedgekeurdState(_groep);

            model.Id = 1;

            var container = new ActieContainer();

            _groep2.AddContainer(container);
            var actie = new Actie("Test", "Actie");

            container.VoegActieToe(actie);
            _actieRepository.Setup(c => c.GeefActie(1)).Returns(actie);
            _actieRepository.Setup(c => c.GetById(1)).Returns(actie);

            model.Aankodiging = "TestBeschrijving";
            _controller.MaakBericht(_cursist2, model);
            var result = _controller.ActieMaken(_cursist);
            var action = result as RedirectToActionResult;

            Assert.Equal("Index", action?.ActionName);
        }
 public void UpdateContainer(ActieContainer actieContainer)
 {
     _containers.Add(actieContainer);
 }
 public void AddContainer(ActieContainer actieContainer)
 {
     _containers.Add(actieContainer);
 }