예제 #1
0
        //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);
        }
예제 #3
0
 public LogAnalyzerFactoryInject()
 {
     manager = ExtensionManagerFactory.Create();
 }
예제 #4
0
        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();
 }