public void When_GetFileInfo_and_resource_does_not_exist_then_should_not_get_file_info() { var provider = new EmbeddedResourceFileSystem(this.GetType().Assembly, ""); var fileInfo = provider.GetFileInfo("DoesNotExist.Txt"); fileInfo.ShouldNotBe(null); fileInfo.Exists.ShouldBe(false); }
public void When_GetFileInfo_and_resources_in_path_then_should_get_file_infos() { var provider = new EmbeddedResourceFileSystem(this.GetType().Assembly, ""); var fileInfo = provider.GetFileInfo("Resources/File.txt"); fileInfo.ShouldNotBe(null); fileInfo.Exists.ShouldBe(true); fileInfo.LastModified.ShouldNotBe(default(DateTime)); fileInfo.Length.ShouldBeGreaterThan(0); fileInfo.IsDirectory.ShouldBe(false); fileInfo.PhysicalPath.ShouldBe(null); fileInfo.Name.ShouldBe("File.txt"); }
public void When_GetFileInfo_and_resource_exists_in_root_then_should_get_file_info() { var provider = new EmbeddedResourceFileSystem(this.GetType().Assembly, ""); var expectedFileLength = new FileInfo("File.txt").Length; var fileInfo = provider.GetFileInfo("File.txt"); fileInfo.ShouldNotBe(null); fileInfo.Exists.ShouldBe(true); fileInfo.LastModified.ShouldNotBe(default(DateTime)); fileInfo.Length.ShouldBe(expectedFileLength); fileInfo.IsDirectory.ShouldBe(false); fileInfo.PhysicalPath.ShouldBe(null); fileInfo.Name.ShouldBe("File.txt"); //Passing in a leading slash fileInfo = provider.GetFileInfo("/File.txt"); fileInfo.ShouldNotBe(null); fileInfo.Exists.ShouldBe(true); fileInfo.LastModified.ShouldNotBe(default(DateTime)); fileInfo.Length.ShouldBe(expectedFileLength); fileInfo.IsDirectory.ShouldBe(false); fileInfo.PhysicalPath.ShouldBe(null); fileInfo.Name.ShouldBe("File.txt"); }