Example #1
0
        public void RegisterDeleted_WithPost_RemovesPost(
            string databaseName,
            Post post)
        {
            // Given
            var sut = new DataContext(databaseName);
            sut.RegisterAdded(post);
            sut.Commit();

            // When
            sut.RegisterDeleted(post);
            sut.Commit();
            var result = sut.Get<Post>().Any();

            // Then
            Assert.False(result);
            sut.Database.Delete();
            sut.Dispose();
        }
Example #2
0
        public void RegisterDeleted_WithNullPost_ThrowsArgumentNullException(string databaseName)
        {
            // Given
            var sut = new DataContext(databaseName);

            // Then
            Assert.Throws<ArgumentNullException>(() => sut.RegisterDeleted<Post>(null));
            sut.Database.Delete();
            sut.Dispose();
        }