コード例 #1
0
        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]));
        }
コード例 #2
0
        public void Find_Should_ReturnArtikelWithCertainPredicate_When_Predicate_IsGiven()
        {
            // Arrange
            Bestelling bestelling1 = new BestellingBuilder().SetDummy().Create();
            Bestelling bestelling2 = new BestellingBuilder().SetDummy().SetBestelStatus(BestelStatus.Goedgekeurd).Create();

            _betaalContext.Bestellingen.Add(bestelling1);
            _betaalContext.Bestellingen.Add(bestelling2);
            _betaalContext.SaveChanges();

            var dataMapper = new BestellingDataMapper(_betaalContext);

            // Act
            List <Bestelling> result = dataMapper.Find(b => b.BestelStatus == BestelStatus.Goedgekeurd).ToList();

            // Assert
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(bestelling2.Factuurnummer, result[0].Factuurnummer);
        }