Example #1
0
        public void DeleteDeckTest()
        {
            //Arrange
            DatabaseSvc testDAL = new DatabaseSvc(_connectionString);

            int testId = _deckId1;

            //Act
            int  oldDeckCount        = testDAL.GetAllDecksForUser(_userId).Count();
            bool cardDeletionSuccess = testDAL.DeleteDeck(testId);
            int  newDeckCount        = testDAL.GetAllDecksForUser(_userId).Count();
            bool removedDeck         = false;

            if (oldDeckCount - newDeckCount == 1)
            {
                removedDeck = true;
            }

            //Assert
            Assert.AreEqual(true, cardDeletionSuccess, "Confirm method success");
            Assert.AreEqual(true, removedDeck, "Confirm removal from database");
        }
Example #2
0
        public void GetAllDecksForUserTest()
        {
            //Arrange
            DatabaseSvc testDAL = new DatabaseSvc(_connectionString);

            //Act
            List <DeckItem> decks = testDAL.GetAllDecksForUser(_userId);

            //Assert
            Assert.AreEqual(1, decks.Count(), "Confirm number of decks");
            Assert.AreEqual(TestDeckName, decks[0].Name, "Confirm deck name");
            Assert.AreEqual(1, decks[0].CardCount, "Confirm card count");
        }