Beispiel #1
0
        public void Insert_InsertsGivenDeck()
        {
            var hashidsMock    = new Mock <IHashids>();
            var deckRepository = new DeckRepository(DbContextFactory.Create(), hashidsMock.Object);

            Assert.That(deckRepository.GetDecks().Count() == 0);
            deckRepository.Insert(new Deck {
            });
            Assert.That(deckRepository.GetDecks().Count() == 1);
        }
Beispiel #2
0
        public void GetDecks_WhenNoDecksFound_ReturnsEmptySet()
        {
            var hashidsMock    = new Mock <IHashids>();
            var deckRepository = new DeckRepository(DbContextFactory.Create(), hashidsMock.Object);
            var decks          = deckRepository.GetDecks();

            Assert.IsEmpty(decks);
        }
Beispiel #3
0
        public void GetDecks_WhenDecksFound_ReturnsAll()
        {
            var hashidsMock    = new Mock <IHashids>();
            var deckRepository = new DeckRepository(DbContextFactory.Create(), hashidsMock.Object);

            deckRepository.Insert(new Deck {
            });
            var decks = deckRepository.GetDecks();

            Assert.AreEqual(decks.Count(), 1);
        }
Beispiel #4
0
        public void Remove_WhenDeckFound_RemovesIt()
        {
            var deckHash    = "deckHash";
            var hashidsMock = new Mock <IHashids>();

            hashidsMock.Setup(x => x.Encode(It.IsAny <int>())).Returns(deckHash);
            var deckRepository = new DeckRepository(DbContextFactory.Create(), hashidsMock.Object);

            deckRepository.Insert(new Deck {
            });
            deckRepository.Remove(deckHash);

            Assert.That(deckRepository.GetDecks().Count() == 0);
        }