Skip to content

Instantly share code, notes, and snippets.

@jchannon
Created March 22, 2012 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchannon/2158920 to your computer and use it in GitHub Desktop.
Save jchannon/2158920 to your computer and use it in GitHub Desktop.
TDD Driving me nuts
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