public void GivenNullCard_ThenThrowsArgumentNullException() { // arrange var repo = new JsonCardListRepository(new DirectoryInfo(@"."), new DirectoryInfo(@".")); // act repo.Delete <Card>(null); // assert Assert.Fail("ArgumentNullException should have been thrown."); }
public void GivenCardNotFound_ThenThrowsInvalidOperationException() { // arrange var repo = new JsonCardListRepository(new DirectoryInfo(@"."), new DirectoryInfo(@".")); var card = new Card { DbId = Guid.NewGuid() }; // act repo.Delete(card); // assert Assert.Fail("InvalidOperationException should have been thrown."); }
public void GivenCardFound_ThenCardRemoved() { // arrange var repo = new JsonCardListRepository(new DirectoryInfo(@"."), new DirectoryInfo(@".")); var card = new Card { DbId = Guid.NewGuid() }; repo.Data[typeof(Card)].Add(card); // act repo.Delete(card); // assert Assert.AreEqual(0, repo.Data[typeof(Card)].Count); Assert.IsFalse(repo.Data[typeof(Card)].Cast <Card>().Any(x => x.DbId == card.DbId)); }