Ejemplo n.º 1
0
        public void ValidateFilesBinaryEqual_CompareFilesWithDifferentSize_ReportFilesNotEqual()
        {
            //Arrange
            var logger = new TestReportLogger();

            Report.AttachLogger(logger);
            var filePath1 = Path.Combine(testFilesDirPath, "BinaryFile1kB1.file");
            var filePath2 = Path.Combine(testFilesDirPath, "BinaryFile2kB.file");

            //Act
            FileLibrary.ValidateFilesBinaryEqual(filePath1, filePath2);

            //Assert
            Report.DetachLogger(logger);
            Assert.AreEqual(
                string.Format("Files '{0}' and '{1}' are not equal because they differ in size.", filePath1, filePath2),
                logger.LastLogMessage);
        }
Ejemplo n.º 2
0
        public void ValidateFilesBinaryEqual_CompareEqualFiles_ReportFilesAreEqual()
        {
            //Arrange
            var logger = new TestReportLogger();

            Report.AttachLogger(logger);
            var filePath1 = Path.Combine(testFilesDirPath, "BinaryFile1kB1.file");
            var filePath2 = Path.Combine(testFilesDirPath, "BinaryFile1kB1.file");

            //Act
            FileLibrary.ValidateFilesBinaryEqual(filePath1, filePath2);

            //Assert
            Report.DetachLogger(logger);
            Assert.AreEqual(
                string.Format("Files '{0}' and '{1}' are equal.", filePath1, filePath2),
                logger.LastLogMessage);
        }
Ejemplo n.º 3
0
        public void ValidateFilesBinaryEqual_CompareNonexistentFile_ReportFileNotExist()
        {
            //Arrange
            var logger = new TestReportLogger();

            Report.AttachLogger(logger);
            var filePath1 = Path.Combine(testFilesDirPath, "BinaryFile1kB11.file");
            var filePath2 = Path.Combine(testFilesDirPath, "BinaryFile2kB.file");

            //Act
            FileLibrary.ValidateFilesBinaryEqual(filePath1, filePath2);

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