Exemplo n.º 1
0
        public void TestMethodAssertFileContains()
        {
            const string UnitTestFile = @"c:\temp\TestMethodAssertFileContains.txt";
            var          myLogger     = new Stf.Utilities.StfLogger {
                FileName = @"c:\temp\unittestlogger_AssertFileContains.html"
            };
            var myAsserts = new StfAssert(myLogger);
            var testFile  = File.CreateText(UnitTestFile);

            myAsserts.EnableNegativeTesting = true;

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

            Assert.IsFalse(myAsserts.AssertFileContains("TestStepName 1", @"c:\DoNotExists.nope", "A string"));
            Assert.IsFalse(myAsserts.AssertFileContains("TestStepName 2", UnitTestFile, "Nothing Like it"));
            Assert.IsTrue(myAsserts.AssertFileContains("TestStepName 3", UnitTestFile, "test"));
            Assert.IsTrue(myAsserts.AssertFileContains("TestStepName 4", UnitTestFile, "t[eE]st"));
        }