Created
August 1, 2011 06:07
-
-
Save Vidarls/1117641 to your computer and use it in GitHub Desktop.
Provisional extension points to modify namer and reporter at runtime.
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 Approvals | |
{ | |
//Default implementation works as before | |
static Func<IApprovalNamer> _defaultNamerSource = (()=> new UnitTestFrameworkNamer()); | |
//Extension point to allow injection of new default namer | |
//at runtime, as vb6 does not support attributes, nor stacktraces. | |
public static Func<IApprovalNamer> DefaultNamerSource | |
{ | |
private get { return _defaultNamerSource; } | |
set { _defaultNamerSource = value; } | |
} | |
//Default Implementation works as before | |
static Func<IApprovalFailureReporter> _defaultReporterSource = (() => new QuietReporter()); | |
//Extension point to allow injection of new default reporter | |
//at runtime, as VB6 does not support attributes. | |
public static Func<IApprovalFailureReporter> DefaultReporterSource | |
{ | |
private get { return _defaultReporterSource; } | |
set { _defaultReporterSource = value; } | |
} | |
//Changes to existing methods to use the new extension points | |
public static IApprovalNamer GetDefaultNamer() | |
{ | |
return DefaultNamerSource(); | |
} | |
public static IApprovalFailureReporter GetReporter() | |
{ | |
return GetReporter(DefaultReporterSource()); | |
{ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment