Пример #1
0
        public async Task ShowAllDecks()
        {
            var cards = new Card[]
            {
                new Card {
                    Value = 0, Description = "zero"
                }, new Card {
                    Value = 1, Description = "one"
                }, new Card {
                    Value = 2, Description = "two"
                }, new Card {
                    Value = 4, Description = "four"
                }
            };
            var newDeck = new Deck {
                Name = "testDeck"
            };
            var newDeck2 = new Deck {
                Name = "testDeck2"
            };

            db.Decks.AddRange(newDeck, newDeck2);
            await db.SaveChangesAsync();

            foreach (Card card in cards)
            {
                db.Cards.Add(card);

                newDeck2.Cards.Add(card);
                newDeck.Cards.Add(card);
            }
            await db.SaveChangesAsync();

            var result = await deck.ShowAll();

            var length = result.Count;

            Assert.That(2, Is.EqualTo(length));
        }