'code without tests'
Test what the software ACTUALLY DOES
Change requires code to be covered by tests, but code needs changing to bring it under test...
'a place where you can alter behaviour in your program without editing in that place'
public PublishPosts(IList posts) { foreach (var post in posts) { post.Publish(); } publishedPosts.Add(posts); }
public PublishPosts(IList posts) { IList uniquePosts = new List(); foreach (var post in posts) { post.Publish(); if (!uniquePosts.Contains(post) { uniquePosts.Add(post); } } publishedPosts.Add(uniquePosts); } Just think of the SRP!
public PublishPosts(IList posts) { IList uniquePosts = GetUniquePosts(posts); foreach (var post in posts) { post.Publish(); } publishedPosts.Add(uniquePosts); } TDD GetUniquePosts()
...
/