示例#1
0
        public void TestMethodAssertFileNotExists()
        {
            const string UnitTestFile = @"c:\temp\TestMethodAssertFileNotExists.txt";
            var          myLogger     = new Stf.Utilities.StfLogger {
                FileName = @"c:\temp\unittestlogger_AssertFileNotExists.html"
            };
            var myAsserts = new StfAssert(myLogger);

            myAsserts.EnableNegativeTesting = true;

            if (File.Exists(UnitTestFile))
            {
                File.Delete(UnitTestFile);
            }

            Assert.IsTrue(myAsserts.AssertFileNotExists("TestStepName 1", UnitTestFile));

            var testFile = File.CreateText(UnitTestFile);

            testFile.WriteLine("one line of test data");
            testFile.Close();

            Assert.IsFalse(myAsserts.AssertFileNotExists("TestStepName 2", UnitTestFile));
        }