Exemple #1
0
        public async Task GetVolgendeBestellingGivesNextBestelling()
        {
            var bestelling = new Bestelling
            {
                KlantId          = "1",
                AdresRegel1      = "Laagstraat 11",
                Plaats           = "Laaghoven",
                Postcode         = "1234FG",
                BestellingStatus = BestellingStatus.GereedVoorBehandeling
            };
            var bestelling2Finished = new Bestelling
            {
                KlantId          = "1",
                AdresRegel1      = "Middenland 34",
                Plaats           = "Middenhoven",
                Postcode         = "4535FF",
                BestellingStatus = BestellingStatus.Verzonden
            };
            var bestelling3 = new Bestelling
            {
                KlantId          = "1",
                AdresRegel1      = "Hoogstraat 27",
                Plaats           = "Hooghoven",
                Postcode         = "4321PD",
                BestellingStatus = BestellingStatus.GereedVoorBehandeling
            };

            using (var context = new BeheerContext(_options))
            {
                var mapper = new BestellingDatamapper(context);
                await mapper.Insert(bestelling);

                await mapper.Insert(bestelling2Finished);

                await mapper.Insert(bestelling3);
            }

            using (var context = new BeheerContext(_options))
            {
                var mapper = new BestellingDatamapper(context);
                var result = await mapper.GetFirstUndone();

                Assert.AreEqual(1, result);

                //Should skip the second one
                var result2 = await mapper.GetFirstUndone();

                Assert.AreEqual(3, result2);
            }
        }
Exemple #2
0
        public async Task GetFirstUndoneReturnsNullWhenNoBestelling()
        {
            using (var context = new BeheerContext(_options))
            {
                var mapper = new BestellingDatamapper(context);
                var result = await mapper.GetFirstUndone();

                Assert.AreEqual(0, result);
            }
        }