public void Insert_Should_InsertArtikel_When_NieuwArtikel_IsGiven() { // Arrange BevestigdeBestelling bevestigdeBestelling = new BevestigdeBestellingBuilder().SetDummy().Create(); // Act _target.Insert(bevestigdeBestelling); BevestigdeBestelling result = _target.GetByFactuurnummer(bevestigdeBestelling.Factuurnummer); // Assert Assert.IsNotNull(result); Assert.IsTrue(bevestigdeBestelling.IsEqual(result)); }
public void GetByFactuurnummer_Should_ReturnBevestigdeBestellingWithCertainId_When_Factuurnummer_IsGiven() { // Arrange BevestigdeBestelling bevestigdeBestelling = new BevestigdeBestellingBuilder().SetDummy().Create(); _context.BevestigdeBestellingen.Add(bevestigdeBestelling); _context.SaveChanges(); // Act BevestigdeBestelling result = _target.GetByFactuurnummer(bevestigdeBestelling.Factuurnummer); // Assert Assert.IsNotNull(result); Assert.IsTrue(bevestigdeBestelling.IsEqual(result)); }
public void GetAll_ShouldReturnAllArtikelen() { // Arrange BevestigdeBestelling bevestigdeBestelling1 = new BevestigdeBestellingBuilder().SetDummy().Create(); BevestigdeBestelling bevestigdeBestelling2 = new BevestigdeBestellingBuilder().SetDummy().Create(); _context.BevestigdeBestellingen.Add(bevestigdeBestelling1); _context.BevestigdeBestellingen.Add(bevestigdeBestelling2); _context.SaveChanges(); // Act List <BevestigdeBestelling> result = _target.GetAll().OrderBy(r => r.Besteldatum).ToList(); // Assert Assert.AreEqual(2, result.Count); Assert.IsTrue(bevestigdeBestelling1.IsEqual(result[0])); Assert.IsTrue(bevestigdeBestelling2.IsEqual(result[1])); }
public void Find_Should_ReturnArtikelWithCertainPredicate_When_Predicate_IsGiven() { // Arrange BevestigdeBestelling bevestigdeBestelling1 = new BevestigdeBestellingBuilder().SetDummy().Create(); BevestigdeBestelling bevestigdeBestelling2 = new BevestigdeBestellingBuilder().SetDummy() .SetBestelStatus(BestelStatus.Goedgekeurd).Create(); _context.BevestigdeBestellingen.Add(bevestigdeBestelling1); _context.BevestigdeBestellingen.Add(bevestigdeBestelling2); _context.SaveChanges(); // Act List <BevestigdeBestelling> result = _target.Find(b => b.BestelStatus == BestelStatus.Goedgekeurd) .ToList(); // Assert Assert.AreEqual(1, result.Count); Assert.IsTrue(bevestigdeBestelling2.IsEqual(result[0])); }