public void LectorMaakReservatieMetMeerderGeblokkeerdeDagenInDeWeek() { Lector lector = context.LectorGebruiker as Lector; IDictionary <Materiaal, int> materiaalMap = new Dictionary <Materiaal, int>(); materiaalMap.Add(context.Bol, 5); string[] dagenGeblokkeerd = new[] { "23/3/2016", "25/3/2016" }; lector.MaakBlokkeringen(materiaalMap, "23/3/2016", dagenGeblokkeerd); Assert.AreEqual(1, lector.Reservaties.Count); Assert.IsTrue(lector.Reservaties.First().ReservatieState is Geblokkeerd); Assert.AreEqual(5, lector.Reservaties.First().AantalGereserveerd); }
public void LectorMaakBlokkeringWaarStudentAlHeeftGereserveerdWaarBlokkeringNodigIsMetEenMateriaal() { Student student = context.Toon as Student; Lector lector = context.LectorGebruiker as Lector; IDictionary <Materiaal, int> materiaalMap = new Dictionary <Materiaal, int>(); IDictionary <Materiaal, int> materiaalLectorMap = new Dictionary <Materiaal, int>(); materiaalMap.Add(context.Bok, 1); materiaalLectorMap.Add(context.Bok, 1); string[] dagenGeblokkeerd = new[] { "23/3/2016" }; student.MaakReservaties(materiaalMap, "23/3/2016"); lector.MaakBlokkeringen(materiaalLectorMap, "23/3/2016", dagenGeblokkeerd); Assert.AreEqual(1, lector.Reservaties.Count); Assert.IsTrue(lector.Reservaties.First().ReservatieState is Geblokkeerd); Assert.AreEqual(1, student.Reservaties.Count); Assert.IsTrue(student.Reservaties.First().ReservatieState is Overruled); }
public void LectorMaakBlokkeringWaarStudentAlHeeftGereserveerdMaarErIsNogGenoegOver() { Student student = context.Toon as Student; Lector lector = context.LectorGebruiker as Lector; IDictionary <Materiaal, int> materiaalMap = new Dictionary <Materiaal, int>(); materiaalMap.Add(context.Bol, 5); string[] dagenGeblokkeerd = new[] { "23/3/2016" }; student.MaakReservaties(materiaalMap, "23/3/2016"); lector.MaakBlokkeringen(materiaalMap, "23/3/2016", dagenGeblokkeerd); Assert.AreEqual(1, lector.Reservaties.Count); Assert.IsTrue(lector.Reservaties.First().ReservatieState is Geblokkeerd); Assert.AreEqual(5, lector.Reservaties.First().AantalGereserveerd); Assert.AreEqual(1, student.Reservaties.Count); Assert.IsTrue(student.Reservaties.First().ReservatieState is Gereserveerd); Assert.AreEqual(5, student.Reservaties.First().AantalGereserveerd); }
public void LectorOverruultTweeStudenten() { Student student1 = context.Toon as Student; Student student2 = context.Manu as Student; Lector lector = context.LectorGebruiker as Lector; IDictionary <Materiaal, int> materiaalMap = new Dictionary <Materiaal, int>(); IDictionary <Materiaal, int> materiaalLectorMap = new Dictionary <Materiaal, int>(); materiaalMap.Add(context.GeoDriehoek, 1); materiaalLectorMap.Add(context.GeoDriehoek, 2); student1.MaakReservaties(materiaalMap, "23/3/2016"); student2.MaakReservaties(materiaalMap, "23/3/2016"); string[] dagenGeblokkeerd = new[] { "23/3/2016" }; lector.MaakBlokkeringen(materiaalLectorMap, "23/3/2016", dagenGeblokkeerd); Assert.IsTrue(student1.Reservaties.First().ReservatieState is Overruled); Assert.IsTrue(student2.Reservaties.First().ReservatieState is Overruled); }
public void MaakReservatie(Gebruiker gebruiker, int[] materiaal, int[] aantal, string startDatum, string[] dagen) { IList <Materiaal> materialen = GeefMaterialenVanId(materiaal); string eersteDag = HulpMethode.GetStartDatum(startDatum).ToShortDateString(); if (materialen.Count > 0) { IDictionary <Materiaal, int> potentieleReservaties = InvullenVanMapMetPotentieleReservaties(aantal, materialen); try { if (gebruiker is Student) { Student student = gebruiker as Student; student.MaakReservaties(potentieleReservaties, eersteDag); VerstuurMailStudent(potentieleReservaties, eersteDag, student); TempData["Info"] = $"Reservatie werd aangemaakt"; } else { Lector lector = gebruiker as Lector; lector.MaakBlokkeringen(potentieleReservaties, eersteDag, dagen); VerstuurMailBlokkeringLector(potentieleReservaties, dagen, lector); IList <Reservatie> overruled = lector.OverruledeReservaties; VerstuurMailNaarStudentDieOverruledIs(overruled); TempData["Info"] = $"Reservatie werd aangemaakt"; } gebruikerRepository.SaveChanges(); } catch (ArgumentException ex) { TempData["Error"] = ex.Message; } } }
public void LectorBlokkeertZelfdeWeekAlsAndereLectorMaarAndereDagen() { Lector lector1 = context.LectorGebruiker as Lector; Lector lector2 = context.LectorGebruiker2 as Lector; IDictionary <Materiaal, int> materiaalLectorMap = new Dictionary <Materiaal, int>(); materiaalLectorMap.Add(context.Bol, 10); /* IDictionary<Materiaal, int> materiaalLectorMap = new Dictionary<Materiaal, int>(); * * materiaalLectorMap.Add(context.Bol, 10);*/ string[] dagenGeblokkeerd1 = new[] { "24/3/2016" }; lector1.MaakBlokkeringen(materiaalLectorMap, "23/3/2016", dagenGeblokkeerd1); string[] dagenGeblokkeerd2 = new[] { "23/3/2016" }; lector2.MaakBlokkeringen(materiaalLectorMap, "23/3/2016", dagenGeblokkeerd2); Assert.AreEqual(1, lector1.Reservaties.Count); Assert.AreEqual(1, lector2.Reservaties.Count); }
public void LectorOverruultTweeStudentenEnBlokkeertMetLector() { Student student1 = context.Toon as Student; Student student2 = context.Manu as Student; Lector lector1 = context.LectorGebruiker as Lector; Lector lector2 = context.LectorGebruiker2 as Lector; IDictionary <Materiaal, int> materiaalMap = new Dictionary <Materiaal, int>(); IDictionary <Materiaal, int> materiaalLectorMap = new Dictionary <Materiaal, int>(); materiaalMap.Add(context.Bol, 4); materiaalLectorMap.Add(context.Bol, 3); student1.MaakReservaties(materiaalMap, "23/3/2016"); string[] dagenGeblokkeerd1 = new[] { "24/3/2016" }; lector1.MaakBlokkeringen(materiaalLectorMap, "23/3/2016", dagenGeblokkeerd1); student2.MaakReservaties(materiaalMap, "23/3/2016"); string[] dagenGeblokkeerd2 = new[] { "23/3/2016" }; lector2.MaakBlokkeringen(materiaalLectorMap, "23/3/2016", dagenGeblokkeerd2); Assert.IsTrue(student1.Reservaties.First().ReservatieState is Gereserveerd); Assert.IsTrue(student2.Reservaties.First().ReservatieState is Overruled); }