Dealing with implementation concerns in TDD <p>I've just got started on TDD and very quickly ran into a brick wall. Here's my scenario... I'm trying to model an Image object, and going through the TDD steps I've started with a simple object which eventual grew into...</p> <pre><code>public class ImageObject { public string Name {get; set;} public int Width {get; set;} public int Height {get; set;} public bool IsValid() { //Some rules } } </code></pre> <p>Of course the obligatory tests... </p> <pre><code>[Test] public void ImageWidthCannotBeLessThanZero {...} [Test] public void ImageHeightCannotBeLessThanZero {...} and so forth... </code></pre> <p>So far so good. Next, I want to represent the physical file in the class somehow. It could be with a file path</p> <pre><code>public class ImageObject { public string Path {get; set;} } </code></pre> <p>or a series of bytes</p> <pre><code>public class ImageObject { public byte[] Bytes {get; set;} } </code></pre> <p>(Please this is not an argument about DB vs File system for storage.)</p> <p>At this point I'm not feeling comfortable because my mind is drifting and starting thinking about the infrastructure/implementation details. Where is my flaw?? Should i make the decision upfront on the implementation detail? Do i need a clever design pattern to deal with this? Would a mocking framework help? This is an Object Analysis/Design problem and I should use UML tools? (Wait a minute i thought TDD was about design?)</p> <p>Anyway how do i overcome this of problem? I want to remain focused on designing my objects and not think about infrastructure concerns at this time?</p>