public void ValidateFileContainsText_SearchText_ReportTextNotFound()
        {
            //Arrange
            var logger = new TestReportLogger();

            Report.AttachLogger(logger);
            var filePath        = Path.Combine(testFilesDirPath, "TextFileForSearch.txt");
            var textToSearchFor = "Maecenas123 tristique consequat est, et condimentum";

            //Act
            FileLibrary.ValidateFileContainsText(filePath, textToSearchFor);

            //Assert
            Report.DetachLogger(logger);
            Assert.AreEqual(
                string.Format("Text '{0}' was not found in file '{1}'.", textToSearchFor, filePath),
                logger.LastLogMessage);
        }
        public void ValidateFileContainsText_SearchText_ReportTextFound()
        {
            //Arrange
            var logger = new TestReportLogger();

            Report.AttachLogger(logger);
            var filePath        = Path.Combine(testFilesDirPath, "TextFileForSearch.txt");
            var textToSearchFor = "Maecenas tristique consequat est, et condimentum";

            //Act
            FileLibrary.ValidateFileContainsText(filePath, textToSearchFor);

            //Assert
            Report.DetachLogger(logger);
            Assert.AreEqual(
                string.Format("Text '{0}' was found on line 7: 'Maecenas tristique consequat est, et condimentum lacus bibendum non. Nam semper malesuada risus ut interdum.'.", textToSearchFor),
                logger.LastLogMessage);
        }
        public void ValidateFileContainsText_SearchTextInNonexistentFile_ReportFileNotExist()
        {
            //Arrange
            var logger = new TestReportLogger();

            Report.AttachLogger(logger);
            var filePath        = Path.Combine(testFilesDirPath, "TextFileForSearch1.txt");
            var textToSearchFor = "Maecenas tristique consequat est, et condimentum";

            //Act
            FileLibrary.ValidateFileContainsText(filePath, textToSearchFor);

            //Assert
            Report.DetachLogger(logger);
            Assert.AreEqual(
                string.Format("The file '{0}' does not exist.", filePath),
                logger.LastLogMessage);
        }