public ActionResult AzureFiles_Read([DataSourceRequest] DataSourceRequest request) { var files = AzureFilesUtils.ListAllFiles(); var resultList = new List <AzureCloudFileViewModel>(); foreach (var file in files) { AzureCloudFileViewModel model = new AzureCloudFileViewModel(); model.Uri = file.Uri; int index = file.Name.IndexOf("_"); string fileName = file.Name.Substring(index + 1); model.FileName = fileName; model.DirectoryName = file.Name.Split("_").FirstOrDefault(); model.Extension = Path.GetExtension(file.Name); model.Length = file.Properties.Length; resultList.Add(model); var test = model.SafeUri; } var result = Json(resultList.ToDataSourceResult(request)); return(result); }
public void ListFilesTest() { var list = AzureFilesUtils.ListAllFiles(); Assert.NotEmpty(list); }