Ejemplo n.º 1
0
        public void IsVaildFileName_WhenCalled_ChangeWasLastFileNameValid(string fileName, bool except)
        {
            LogAnalyzerCh2 la = MakeAnalyzer();

            la.IsValidLogFileName(fileName);
            Assert.AreEqual(except, la.WasLastFileNameValid);
        }
Ejemplo n.º 2
0
        public void IsVaildFileName_EmptyFileName_ThrowsFluent()
        {
            LogAnalyzerCh2 la = MakeAnalyzer();
            var            ex = Assert.Catch <Exception>(() => la.IsValidLogFileName(""));

            Assert.That(ex.Message, Is.StringContaining("fileName has to be provided"));
            //// also can use Assert.something();
        }
Ejemplo n.º 3
0
        public void IsVaildFileName_EmptyFileName_Throws()
        {
            LogAnalyzerCh2 la = MakeAnalyzer();
            var            ex = Assert.Catch <Exception>(() => la.IsValidLogFileName(""));

            StringAssert.Contains("fileName has to be provided", ex.Message);
            ////使用assert.catch返回exception對象
        }
Ejemplo n.º 4
0
        [Test] ////nunit filter == [TestMethod]
        public void IsVaildFileName_BadExtension_ReturnsFalse()
        {
            //arrange
            LogAnalyzerCh2 analyzer = new LogAnalyzerCh2();
            //act
            var result = analyzer.IsValidLogFileName("filewithbadextension.foo");

            //Assert
            Assert.False(result);
        }
Ejemplo n.º 5
0
        public void IsVaildFileName_VaildExtension_ChecksThem(string fileName, bool except)
        {
            //arrange
            LogAnalyzerCh2 analyzer = new LogAnalyzerCh2();
            //act
            var result = analyzer.IsValidLogFileName(fileName);

            //Assert
            Assert.AreEqual(except, result);
        }
Ejemplo n.º 6
0
        public void IsVaildFileName_VaildExtension_ReturnsTrue(string fileName)
        {
            //arrange
            LogAnalyzerCh2 analyzer = new LogAnalyzerCh2();
            //act
            var result = analyzer.IsValidLogFileName(fileName);

            //Assert
            Assert.True(result);
        }
Ejemplo n.º 7
0
        public void IsVaildFileName_GoodExtensionUpperCase_ReturnsTrue()
        {
            //arrange
            LogAnalyzerCh2 analyzer = new LogAnalyzerCh2();
            //act
            var result = analyzer.IsValidLogFileName("filewithbadextension.SLF");

            //Assert
            Assert.True(result);
        }
Ejemplo n.º 8
0
 [SetUp] //// == Init
 public void Setup()
 {
     analyzer = new LogAnalyzerCh2();
     ////避免使用setup來做初始化
 }