コード例 #1
0
        public void ShouldNotDeleteIfItemNotFound()
        {
            // Arrange
            var id   = Guid.NewGuid();
            var list = new List <Card>
            {
                new Card {
                    Id = Guid.NewGuid()
                },
                new Card {
                    Id = Guid.NewGuid()
                },
                new Card {
                    Id = Guid.NewGuid()
                },
            };

            // SUT
            var sut = new CardRepository(list);

            // Act
            sut.DeleteBy(id);

            // Assert
            Assert.Equal(3, list.Count);
        }
コード例 #2
0
        public void ShouldDeleteItem()
        {
            // Arrange
            var id   = Guid.NewGuid();
            var list = new List <Card>
            {
                new Card {
                    Id = Guid.NewGuid()
                },
                new Card {
                    Id = id
                },
                new Card {
                    Id = Guid.NewGuid()
                },
            };

            // SUT
            var sut = new CardRepository(list);

            // Act
            sut.DeleteBy(id);

            // Assert
            Assert.Equal(2, list.Count);
            Assert.Null(list.FirstOrDefault(x => x.Id == id));
        }