Example #1
0
        public void GetAll_DbStartsEmpty_0()
        {
            //Arrange
            //Act
            int result = MagicCard.GetAll().Count;

            //Assert
            Assert.AreEqual(0, result);
        }
Example #2
0
        public void Save_SavesCardToDatabase_MagicCardList()
        {
            MagicCard testCard = new MagicCard("1", "1", "1", "1", "1", 1);

            testCard.Save();

            List <MagicCard> result   = MagicCard.GetAll();
            List <MagicCard> testList = new List <MagicCard> {
                testCard
            };

            CollectionAssert.AreEqual(testList, result);
        }
Example #3
0
        public void Save_DatabaseAssignsIdToObject_Id()
        {
            //Arrange
            MagicCard testMagicCard  = new MagicCard("1", "1", "1", "1", "1", 1);
            MagicCard testMagicCard2 = new MagicCard("1", "1", "1", "1", "1", 1);

            //Act
            testMagicCard.Save();
            MagicCard savedCard = MagicCard.GetAll()[0];

            int result = savedCard.GetId();
            int testId = testMagicCard.GetId();

            //Assert
            Assert.AreEqual(testId, result);
        }
        public ActionResult Index()
        {
            List <MagicCard> cardList = MagicCard.GetAll();

            return(View(cardList));
        }