コード例 #1
0
        public void TranslateLocalPathToFilePath(string localPath, string appPath, string expectedPath)
        {
            // Arrange
            _applicationSettings.AttachmentsFolder = @"C:\Attachments\";
            AttachmentFileHandler handler = new AttachmentFileHandler(_applicationSettings, _fileService);

            // Act
            string actualPath = handler.TranslateUrlPathToFilePath(localPath, appPath);

            // Assert
            Assert.That(actualPath, Is.EqualTo(expectedPath), "Failed with {0} {1} {2}", localPath, appPath, expectedPath);
        }
コード例 #2
0
        public void TranslateLocalPathToFilePath_Should_Be_Case_Sensitive()
        {
            // Arrange
            _applicationSettings.AttachmentsFolder = @"C:\attachments\";
            AttachmentFileHandler handler = new AttachmentFileHandler(_applicationSettings, _fileService);

            // Act
            string actualPath = handler.TranslateUrlPathToFilePath("/Attachments/a.jpg", "/");

            // Assert
            Assert.That(actualPath, Is.Not.EqualTo(@"c:\Attachments\a.jpg"), "TranslateLocalPathToFilePath does a case sensitive url" +
                                                                             " replacement (this is for Apache compatibility");
        }