Exemple #1
0
            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.");
            }
Exemple #2
0
            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.");
            }
Exemple #3
0
            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));
            }