Enchilada
Enchilada copied to clipboard
Null is returned when file does not contain a file extension
Given a Enchilada configuration of FileSystem When accessing a file with no extension Then the file should be return
Current output is null
Below is a test that maps to this condition:
[TestFixture]
public class EnchiladaFilesystemTests
{
[Test]
public void ShouldNotReturnNullFileWhenFileNameHasNoExtention()
{
var directory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) + "\\";
var adapter = new FilesystemAdapterConfiguration()
{
AdapterName = "filesystem",
Directory = directory
};
var resolver = new EnchiladaFileProviderResolver(new EnchiladaConfiguration()
{
Adapters = new[] { adapter }
});
var fileWithNoExtention = "this-is-my-file";
var file = resolver.OpenFileReference($"enchilada://filesystem/{fileWithNoExtention}");
Assert.That(file, Is.Not.Null);
}
}
Looks like this might have been intentional (or overlooked), within .\src\Enchilada\Filesystem\FileSystemFileProvider.cs
Line 30:
if ( System.IO.File.Exists( combinedPath ) || Path.HasExtension( combinedPath ) )
It required the file to have an extension or the file to exist.