//ncrunch: no coverage start static void Main(string[] args) { FileExtensionManager myManager = new FileExtensionManager(); ExtensionManagerFactory.SetManager(myManager); LogAnalyzer logAn = new LogAnalyzer(); logAn.IsValidLogFileName("ValidFileName.SLF"); }
public void IsValidFileName_SupportedExtension_ReturnTrue() { //设置要使用的桩,并给其赋值使其返回True FakeExtensionManager myFakeManager = new FakeExtensionManager(); myFakeManager.WillBeValid = true; ExtensionManagerFactory factory = new ExtensionManagerFactory(); factory.SetManager(myFakeManager); LogAnalyzerFactoryInject log = new LogAnalyzerFactoryInject(); bool result = log.IsValidLogFileName("anything.anyextension"); Assert.True(result); }
public LogAnalyzerFactoryInject() { manager = ExtensionManagerFactory.Create(); }
public LogAnalyzer() { ExtensionManagerFactory manager = new ExtensionManagerFactory(); //Wykorzystanie fabryki w kodzie produkcyjnym manager.Create(); }
public LogAnalyzer() { _manager = ExtensionManagerFactory.Create(); }
internal LogAnalyzer() { manager = ExtensionManagerFactory.Create(); }
public LogAnalyzer(IExtensionManager mgr) { manager = ExtensionManagerFactory.Create(); }