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

            myAsserts.EnableNegativeTesting = true;

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

            Assert.IsFalse(myAsserts.AssertFileExists("TestStepName 1", @"c:\DoNotExists.nope"));
            Assert.IsFalse(myAsserts.AssertFileExists("TestStepName 2", UnitTestFile));

            var testFile = File.CreateText(UnitTestFile);

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

            Assert.IsTrue(myAsserts.AssertFileExists("TestStepName 3", UnitTestFile));
        }