public void IsValidFileName_NameSuportedExtension_ReturnsTrue()
        {
            FakeExtensionManager myFakeManager = new FakeExtensionManager();

            myFakeManager.WillBeValid = true;
            LogAnalyzer log    = new LogAnalyzer(myFakeManager);
            bool        result = log.IsValidLogFileName("short.ext");

            Assert.True(result);
        }
        public void overrideTest()
        {
            FakeExtensionManager stub = new FakeExtensionManager();

            stub.WillBeValid = true;

            TestableLogAnalyzer logAnalyzer = new TestableLogAnalyzer(stub);
            bool result = logAnalyzer.IsValidLogFileName("file.txt");

            Assert.True(result);
        }
        public void IsValidFileName_NameSupportedExtension_ReturnTrue()
        {
            FakeExtensionManager fakeManager = new FakeExtensionManager();

            fakeManager.WillBeValid = true;
            ExtensionManagerFactory.SetManager(fakeManager);
            LogAnalyzer analyzer = new LogAnalyzer();
            bool        result   = analyzer.IsValidLogFileName("wtf.wtf");

            Assert.True(result);
        }
        public void IsValidFileName_OverrideTest_ReturnsTrue()
        {
            FakeExtensionManager stub = new FakeExtensionManager();

            stub.WillBeValid = true;

            TestableLogAnalyzer logan =
                new TestableLogAnalyzer(stub);

            bool result = logan.IsValidLogFileName("file.ext");

            Assert.True(result);
        }
        public void IsValidFileName_PreProccessorDirective_ReturnsFalse()
        {
            FakeExtensionManager stub = new FakeExtensionManager();

            stub.WillBeValid = false;

            PreProccessorDirective_ProtectingObjectOrientedDesignLogAnalyzer logan =
                new PreProccessorDirective_ProtectingObjectOrientedDesignLogAnalyzer(stub);

            bool result = logan.IsValidLogFileName("file.ext");

            Assert.False(result);
        }
        public void IsValidFileName_UsingInternalKeyword_ReturnsTrue()
        {
            FakeExtensionManager stub = new FakeExtensionManager();

            stub.WillBeValid = true;

            Internal_ProtectingObjectOrientedDesignLogAnalyzer logan =
                new Internal_ProtectingObjectOrientedDesignLogAnalyzer(stub);

            bool result = logan.IsValidLogFileName("file.ext");

            Assert.True(result);
        }
        public void IsValidFileName_SupportedExtensionFactoryMethod_ReturnsTrue()
        {
            FakeExtensionManager myFakeManager =
                new FakeExtensionManager();

            myFakeManager.WillBeValid = true;

            ExtensionManagerFactory.SetManager(myFakeManager);
            FactoryPatternLogAnalyzer log =
                new FactoryPatternLogAnalyzer();
            bool result = log.IsValidLogFilename("anyfilename.htmlc");

            Assert.True(result);
        }
        public void IsValidFileName_UsingConditionalDebug_ReturnsFalse()
        {
            FakeExtensionManager stub = new FakeExtensionManager();

            stub.WillBeValid = false;

            ConditionalDebug_ProtectingObjectOrientedDesignLogAnalyzer logan =
                new ConditionalDebug_ProtectingObjectOrientedDesignLogAnalyzer();

            logan.ExtensionManager(stub);

            bool result = logan.IsValidLogFileName("file.slf");

            Assert.False(result);
        }
        public void IsValidFileName_SupportedExtension_ReturnsTrue()
        {
            // set up the stub to use, make sure it returns true

            FakeExtensionManager myFakeManager =
                new FakeExtensionManager();

            myFakeManager.WillBeValid = true;

            PropertyLogAnalyzer log = new PropertyLogAnalyzer();

            log.ExtensionManager = myFakeManager;

            bool result = log.IsValidLogFileName("anyfilename.anyExtension");

            Assert.True(result);
        }
        public void IsValidFileName_ExtManagerThrowsException_ReturnsFalse()
        {
            bool result;

            try
            {
                FakeExtensionManager myFakeManager =
                    new FakeExtensionManager();
                myFakeManager.WillThrow = new Exception("this is fake");

                ConstructorInjectionLogAnalyzer log =
                    new ConstructorInjectionLogAnalyzer(myFakeManager);
                result = log.IsValidLogFileName("anything.anyextension");
            }
            catch (Exception)
            {
                result = false;
            }

            Assert.False(result);
        }