Created
March 22, 2012 15:13
-
-
Save jchannon/2158920 to your computer and use it in GitHub Desktop.
TDD Driving me nuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainEntryPointClass : BaseClass | |
{ | |
private ILogic Logic; | |
public MainEntryPointClass(ILogic Logic) | |
{ | |
this.Logic = Logic; | |
} | |
public MainEntryPointClass () : this(new Logic(new Timer(), new FileLogger())) | |
{ | |
} | |
public SetupProperties() | |
{ | |
this.ConfigProperties.Add(typeof(string), "DirectoryPath", "C:\\"); | |
} | |
public Run() | |
{ | |
//Set some properties on Logic by reading this.ConfigProperties. This is the first time ConfigProperties can be read. | |
Logic.RandomProperty = this.ConfigProperties.Find(..).Value(); | |
} | |
} | |
public class Logic : ILogic | |
{ | |
private ITimer Timer; | |
private ILogger Logger; | |
public class Logic(ITimer Timer, ILogger Logger) | |
{ | |
this.Timer = Timer; | |
this.Logger = Logger; | |
} | |
public SomeMethod() | |
{ | |
this.Logger.Write("Data"); /******* How does DirectoryPath get assigned? *******/ | |
} | |
} | |
public interface IFileLogger | |
{ | |
string DirectoryPath { get; set; } | |
void WriteData(string Data); | |
} | |
public class FileLogger : IFileLogger | |
{ | |
public void WriteData(string Data) | |
{ | |
} | |
public string DirectoryPath { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment