public void Insert_Should_InsertArtikel_When_NieuwArtikel_IsGiven() { // Arrange Bestelling bestelling = new BestellingBuilder().SetDummy().Create(); var dataMapper = new BestellingDataMapper(_context); // Act dataMapper.Insert(bestelling); Bestelling result = dataMapper.GetByFactuurnummer(bestelling.Factuurnummer); // Assert Assert.IsNotNull(result); Assert.IsTrue(bestelling.IsEqual(result)); }
public void GetByFactuurnummer_Should_ReturnBestellingWithCertainId_When_Factuurnummer_IsGiven() { // Arrange Bestelling bestelling = new BestellingBuilder().SetDummy().Create(); _context.Bestellingen.Add(bestelling); _context.SaveChanges(); var dataMapper = new BestellingDataMapper(_context); // Act Bestelling result = dataMapper.GetByFactuurnummer(bestelling.Factuurnummer); // Assert Assert.IsNotNull(result); Assert.IsTrue(bestelling.IsEqual(result)); }
public void Find_Should_ReturnArtikelWithCertainPredicate_When_Predicate_IsGiven() { // Arrange Bestelling bestelling1 = new BestellingBuilder().SetDummy().Create(); Bestelling bestelling2 = new BestellingBuilder().SetDummy().SetBestelStatus(BestelStatus.Goedgekeurd).Create(); _context.Bestellingen.Add(bestelling1); _context.Bestellingen.Add(bestelling2); _context.SaveChanges(); var dataMapper = new BestellingDataMapper(_context); // Act List <Bestelling> result = dataMapper.Find(b => b.BestelStatus == BestelStatus.Goedgekeurd).ToList(); // Assert Assert.AreEqual(1, result.Count); Assert.IsTrue(bestelling2.IsEqual(result[0])); }
public void GetAll_ShouldReturnAllArtikelen() { // Arrange Bestelling bestelling1 = new BestellingBuilder().SetDummy().Create(); Bestelling bestelling2 = new BestellingBuilder().SetDummy().Create(); _context.Bestellingen.Add(bestelling1); _context.Bestellingen.Add(bestelling2); _context.SaveChanges(); var dataMapper = new BestellingDataMapper(_context); // Act List <Bestelling> result = dataMapper.GetAll().ToList(); // Assert Assert.AreEqual(2, result.Count); Assert.IsTrue(bestelling1.IsEqual(result[0])); Assert.IsTrue(bestelling2.IsEqual(result[1])); }