public void InsertTest() { // Arrange bool found = false; deckDB = new DeckDB(); List <DeckModel> beforeDecks = (List <DeckModel>)deckDB.GetAll(); var testDeck = new DeckModel() { DeckName = "TestDeck" }; //Act deckDB.Insert(testDeck); List <DeckModel> afterDecks = (List <DeckModel>)deckDB.GetAll(); //Assert Assert.IsTrue(beforeDecks.Count < afterDecks.Count); //Cleanup for (int i = 0; i < afterDecks.Count && !found; i++) { if (afterDecks[i].DeckName == testDeck.DeckName) { testDeck.Id = afterDecks[i].Id; found = true; } } deckDB.Delete(testDeck); }
public void DeleteTest() { //Arrange deckDB = new DeckDB(); DeckModel deck = new DeckModel { DeckName = "TestDeck" }; deck.Id = deckDB.InsertWithIdentity(deck); //Act deckDB.Delete(deck); deck = deckDB.GetById(deck.Id); //Assert Assert.IsNull(deck); }