コード例 #1
0
        public void TestMethod9()
        {
            StubExtensionManager stubManger = new StubExtensionManager();
            FileChecker          fc         = new FileChecker(stubManger);

            bool ret = fc.CheckFile("myfile");

            Assert.AreEqual(true, ret);
        }
コード例 #2
0
 public void Initialize()
 {
     StubExtensionManager stubManager = new StubExtensionManager();
     ExtensionManagerFactory.SetManagerInstance(stubManager);
     JobLoggerFactoryMehtod logger = new JobLoggerFactoryMehtod();
     Log entry = new Log();
     entry.Message = "this is an entry";
     bool result = logger.SaveEntrytoFile(entry);
     Assert.IsTrue(result);
 }
コード例 #3
0
        public void IsValidFileName_ShouldThrowArgumentNullException_WhenNameIsNull()
        {
            //Arrange
            IExtensionManager extensionManager = new StubExtensionManager();
            ILogger           logger           = new StubLogger();
            var logAnalyzer = new LogAnalyzer(extensionManager, logger);

            //Act + Assert
            logAnalyzer.IsValidFileName(null);
        }
コード例 #4
0
        public void TestMethod1()
        {
            //Act
            StubExtensionManager stub    = new StubExtensionManager();
            FileChecker          checker = new FileChecker(stub);

            //Action
            bool IsTrueFile = checker.CheckFile("myFile.whatever");

            //Assert
            Assert.AreEqual(true, IsTrueFile);
        }
コード例 #5
0
        public void IsValidFileName_ShouldBeValid_WhenNameStartsWithProperPrefix()
        {
            //Arrange
            IExtensionManager extensionManager = new StubExtensionManager();
            ILogger           logger           = new StubLogger();
            var logAnalyzer = new LogAnalyzer(extensionManager, logger);

            //Act
            var result = logAnalyzer.IsValidFileName("Log_LGO.json");

            //Assert
            result.Should().BeTrue("The file name must always starts with the prefix Log_");
        }
コード例 #6
0
        public void IsValidFileName_NameShorterThan6CharsButSupportedExtension_ReturnsFalse()
        {
            StubExtensionManager myFakeManager = new StubExtensionManager();

            myFakeManager.ShouldExtensionBeValid = true;

            //create analyzer and inject stub
            var log = new LogAnalyzer(myFakeManager);

            //Assert logic assuming extension is supported

            bool result = log.IsValidLogFileName("short.ext");

            Assert.IsFalse(result, "File name with less than 5 chars should have failed the method, even if the extension is supported");
        }
コード例 #7
0
ファイル: LogAnalyzerTests.cs プロジェクト: 0421cjy/tddCSharp
        public void IsValidFileName_NameShorterThan6CharsButSupportedExtension_RetunsFalse()
        {
            StubExtensionManager myFakeManager = new StubExtensionManager();

            myFakeManager.ShouldExtensionBeValid = true;

            ExtensionManagerFactory.SetManager(myFakeManager);

            // Analyzer 생성 및 스텁 주입
            LogAnalyzer log = new LogAnalyzer();

            // 확장자 지원 확인 로직에 대한 assert
            bool result = log.IsValidLogFileName("short.ext");

            Assert.IsFalse(result, "설사 지원하더라도 파일명이 다섯 글자 미만이면 안 됨");
        }