public virtual FileInfoDto Get(string directory, string name, FileInfoType type)
        {
            FileInfoDto vm = null;

            if (!string.IsNullOrEmpty(name))
            {
                directory = Utils.FormatDirectory(directory);
                name      = Utils.FormatName(name);

                using (var db = this.CreateDbContext())
                {
                    var query = from q in db.FileInfo
                                where q.Directory == directory && q.Name == name && q.Type == type && q.IsDelete == false
                                select new FileInfoDto
                    {
                        Id            = q.Id,
                        ParentId      = q.ParentId,
                        Type          = q.Type,
                        Directory     = q.Directory,
                        Name          = q.Name,
                        Length        = q.Length,
                        CreationTime  = q.CreationTime,
                        LastWriteTime = q.LastWriteTime,
                        Key           = q.Key,
                        UpdateTime    = q.UpdateTime,
                        IsDelete      = q.IsDelete
                    };

                    vm = query.FirstOrDefault();
                }
            }

            return(vm);
        }
        public virtual FileInfoDto Get(int id)
        {
            FileInfoDto vm = null;

            if (id > 0)
            {
                using (var db = this.CreateDbContext())
                {
                    var query = from q in db.FileInfo
                                where q.Id == id && q.IsDelete == false
                                select new FileInfoDto
                    {
                        Id            = q.Id,
                        ParentId      = q.ParentId,
                        Type          = q.Type,
                        Directory     = q.Directory,
                        Name          = q.Name,
                        Length        = q.Length,
                        CreationTime  = q.CreationTime,
                        LastWriteTime = q.LastWriteTime,
                        Key           = q.Key,
                        UpdateTime    = q.UpdateTime,
                        IsDelete      = q.IsDelete,
                    };

                    vm = query.FirstOrDefault();
                }
            }

            return(vm);
        }
 public void SetServerPath(int id)
 {
     using (var fileclient = IocUtils.Get <IFileInfoService>(new object[] { MainForm.Current.FileClient }))
     {
         this.ServerPath = fileclient.Get(id);
     }
 }
Ejemplo n.º 4
0
        // Przekazuje administratorowi strony informacje o konkretnym ebooku znajdującym się na serwerze.
        public ContentResult <FileInfoDto> GetFileInfoById(int id)
        {
            var file = context.Files
                       .Include(x => x.User)
                       .SingleOrDefault(x => x.Id == id);

            if (file == null)
            {
                return(new ContentResult <FileInfoDto>
                {
                    Content = null
                });
            }


            var dto = new FileInfoDto
            {
                Id                = file.Id,
                Url               = hostingEnvironment.ContentRootPath + "/" + file.Name,
                Name              = file.Name.Split('/').Last().Split('.').First(),
                SizeInMb          = Math.Round(new FileInfo(hostingEnvironment.ContentRootPath + "/" + file.Name).Length / 1024.0 / 1024.0, 2),
                UploadDate        = file.UploadDate,
                Username          = file.User?.Name,
                NameWithExtension = file.Name.Split('/').Last()
            };

            return(new ContentResult <FileInfoDto>
            {
                Content = dto
            });
        }
Ejemplo n.º 5
0
        internal FileInfoDto GetParent(string path)
        {
            FileInfoDto vm = null;

            if (!string.IsNullOrEmpty(path) && path != "\\")
            {
                string dir  = Utils.GetParent(path);
                string name = Utils.GetName(path);
                var    fileInfoRepository = this.GetRepository <IFileInfoRepository>();
                vm = fileInfoRepository.Get(dir, name, FileInfoType.Directory);
                if (vm == null)
                {
                    var           parent   = this.GetParent(dir);
                    string        fullPath = Utils.Combine(ConfigUtils.FileRootPath, path);
                    DirectoryInfo dirInfo  = new DirectoryInfo(fullPath);
                    vm = new FileInfoDto()
                    {
                        Type          = FileInfoType.Directory,
                        Directory     = path,
                        Name          = dirInfo.Name,
                        CreationTime  = dirInfo.CreationTime,
                        LastWriteTime = dirInfo.LastWriteTime
                    };
                    if (parent != null)
                    {
                        vm.ParentId = parent.Id;
                    }
                    fileInfoRepository.AddOrUpdate(vm);
                }
            }

            return(vm);
        }
        private bool GetLocalFile(FileInfoDto m, string saveFullDirectory, FilePositionCallback call = null)
        {
            bool   result     = false;
            string serverfile = this.GetLocalPath(Utils.Combine(m.Directory, m.Name));

            if (File.Exists(serverfile))
            {
                var serverinfo = new FileInfo(serverfile);
                this.OnFilePositionCallback(call, serverinfo.Length, 0);
                string localFullFileName = Utils.Combine(saveFullDirectory, m.Name);
                if (File.Exists(localFullFileName))
                {
                    var localInfo = new FileInfo(localFullFileName);
                    if (serverinfo.Length != localInfo.Length || serverinfo.CreationTime != localInfo.CreationTime || serverinfo.LastAccessTime != localInfo.LastAccessTime)
                    {
                        serverinfo.CopyTo(localFullFileName, true);
                    }
                }
                else
                {
                    serverinfo.CopyTo(localFullFileName, true);
                }
                this.OnFilePositionCallback(call, serverinfo.Length, serverinfo.Length);
                result = true;
            }

            return(result);
        }
Ejemplo n.º 7
0
 public virtual async Task OnGetAsync()
 {
     if (ParentId.HasValue)
     {
         CurrentDirectory = await _service.GetAsync(ParentId.Value);
     }
 }
Ejemplo n.º 8
0
        public async Task <ActionResult> PostAsync([FromBody] FileInfoDto fileInfo)
        {
            if (fileInfo == null)
            {
                return(BadRequest());;
            }
            if (string.IsNullOrWhiteSpace(fileInfo.fileContent))
            {
                return(BadRequest());
            }

            var buffer = System.Convert.FromBase64String(fileInfo.fileContent);

            var fileFullName = fullFileName(fileInfo.fileName);

            if (System.IO.File.Exists(fileFullName))
            {
                return(BadRequest(new { msg = "文件已经存在" + fileInfo.fileName, status = 8001, isSuccess = false }));
            }

            var   task = System.IO.File.WriteAllBytesAsync(fileFullName, buffer);
            await task;

            fileInfo.fileContent = "";
            return(CreatedAtRoute(nameof(Get), new
            {
                id = fileInfo.fileName
            }, fileInfo));
        }
 public async Task <IActionResult> Remove(
     [FromServices] IFileProvider provider,
     [FromBody] FileInfoDto filiInfo)
 {
     provider.RemoveFile(filiInfo.Path);
     return(Ok());
 }
        public virtual bool GetDirectory(FileInfoDto m, string saveFullDirectory)
        {
            bool result = false;

            try
            {
                if (m != null && m.Type == FileInfoType.Directory &&
                    !string.IsNullOrEmpty(m.Name) && !string.IsNullOrEmpty(saveFullDirectory))
                {
                    if (!Directory.Exists(saveFullDirectory))
                    {
                        Directory.CreateDirectory(saveFullDirectory);
                    }
                    var dir = Utils.Combine(saveFullDirectory, m.Directory, m.Name);
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }
                    Directory.SetCreationTime(dir, m.CreationTime);
                    Directory.SetLastAccessTime(dir, m.LastWriteTime);

                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogUtils.Error("【FileInfoClient.GetDirectory】", ex);
            }

            return(result);
        }
        private void listView_Server_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var item = this.listView_Server.GetItemAt(e.X, e.Y);

            if (item != null && item.Tag != null)
            {
                var m = item.Tag as FileInfoDto;
                if (m.Type == FileInfoType.Directory)
                {
                    this.ServerPath = m;
                    this.GetServerList();
                }
                else if (m.Type == (int)FileInfoType.None)
                {
                    if (this.ServerPath != null)
                    {
                        using (var fileclient = IocUtils.Get <IFileInfoService>(new object[] { MainForm.Current.FileClient }))
                        {
                            this.ServerPath = fileclient.Get(this.ServerPath.ParentId);
                        }
                    }
                    this.GetServerList();
                }
            }
        }
Ejemplo n.º 12
0
        FileInfoDto strToDto(string nameStr)
        {
            var rValue = new FileInfoDto
            {
                fileName = nameStr,
            };

            return(rValue);
        }
Ejemplo n.º 13
0
 public void ConvertFromFileInfoDto(FileInfoDto dto)
 {
     this.FileType   = dto.file_Type;
     this.FileName   = dto.file_Name;
     this.FileSize   = dto.file_Size;
     this.Version    = dto.version;
     this.PathHTTP   = dto.path_HTTP;
     this.IsComplete = dto.isComplete;
 }
Ejemplo n.º 14
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            OperationResult    objOperationResult = new OperationResult();
            List <FileInfoDto> objDetailData      = Session["objMainEntityDetail"] as List <FileInfoDto>;
            FileInfoDto        fileInfo           = null;

            foreach (var item in objDetailData)
            {
                //Obtener CategoriaId
                //var oKeyValues = (KeyValueDTO)ddlComponentId.SelectedItem;
                var CategoriaId = int.Parse(ddlConsultorio.SelectedValue.ToString());

                //Obtener lista de componentes de un protocolo por su categoria
                ProtocolBL oProtocolBL = new ProtocolBL();
                var        ListaComponentesCategoria = oProtocolBL.GetProtocolComponents(ref objOperationResult, item.ProtocolId).FindAll(p => p.i_CategoryId == CategoriaId);

                var OrdenDescListaComponentesCategoria = ListaComponentesCategoria.OrderBy(o => o.v_ComponentId).ToList();



                var oserviceComponent = oServiceBL.GetServiceComponentByServiceIdAndComponentId(item.ServiceId, OrdenDescListaComponentesCategoria[0].v_ComponentId);
                if (oserviceComponent != null)
                {
                    string serviceComponentId = oserviceComponent.v_ServiceComponentId;


                    LoadFileNoLock(item.RutaLarga);

                    fileInfo = new FileInfoDto();

                    fileInfo.Id                 = null;
                    fileInfo.PersonId           = item.PersonId;
                    fileInfo.ServiceComponentId = serviceComponentId;
                    fileInfo.FileName           = item.RutaCorta;
                    fileInfo.Description        = "";
                    fileInfo.ByteArrayFile      = _file;
                    //fileInfo.ThumbnailFile = Common.Utils.imageToByteArray1(pbFile.Image);
                    fileInfo.Action = (int)ActionForm.Add;

                    // Grabar
                    oServiceBL.AddMultimediaFileComponent(ref objOperationResult, fileInfo, ((ClientSession)Session["objClientSession"]).GetAsList());
                }

                //Analizar el resultado de la operación
                if (objOperationResult.Success == 1)  // Operación sin error
                {
                    // Cerrar página actual y hacer postback en el padre para actualizar
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else  // Operación con error
                {
                    Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                    // Se queda en el formulario.
                }
            }
        }
Ejemplo n.º 15
0
        public void CreateFolder(FileInfoDto folder)
        {
            var directory = Path.Combine(basePath, folder.Path.Trim('/'), folder.Name.Trim('/'));

            if (Directory.Exists(directory))
            {
                throw new ServiceFrameworkException("文件夹已存在");
            }
            Directory.CreateDirectory(directory);
        }
Ejemplo n.º 16
0
        private void UrlConverter(FileInfoDto fileInfoDto)
        {
            var relativePath = Path.GetRelativePath(_webHostEnvironment.WebRootPath, fileInfoDto.FullPath);

            fileInfoDto.Url = new Uri(new Uri(HttpContext.Request.GetHostUri()), relativePath).ToString();
            if (fileInfoDto.Url.StartsWith(@"file://"))
            {
                fileInfoDto.Url = new Uri(new Uri(HttpContext.Request.GetHostUri()), "/images/no_preview.png").ToString();
            }
        }
 private void toolStripMenuItem_ServerPrve_Click(object sender, EventArgs e)
 {
     if (this.ServerPath != null)
     {
         using (var fileclient = IocUtils.Get <IFileInfoService>(new object[] { MainForm.Current.FileClient }))
         {
             this.ServerPath = fileclient.Get(this.ServerPath.ParentId);
         }
         this.GetServerList();
     }
 }
        public virtual FileInfoDto Get(int id)
        {
            FileInfoDto m = null;

            if (id > 0 && this.Client.IsLogin)
            {
                m = this.Client.Request <FileInfoDto, int>(MsgCmd.GetFileInfo, id);
            }

            return(m);
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            FileInfoDto   fileInfo   = null;
            DirectoryInfo rutaOrigen = null;
            string        ext        = "";

            rutaOrigen = new DirectoryInfo(Common.Utils.GetApplicationConfigValue("Consentimiento").ToString());

            ext = Path.GetExtension(_filePath);
            File.Copy(_filePath, rutaOrigen + _serviceId + "-" + Constants.CONSENTIMIENTO_INFORMADO + ext);
            MessageBox.Show("Se adjuntó correctamente", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            FileInfoDto   fileInfo   = null;
            DirectoryInfo rutaOrigen = null;
            string        ext        = "";

            rutaOrigen = new DirectoryInfo(Common.Utils.GetApplicationConfigValue("DeclaracionJurada"));

            ext = Path.GetExtension(_filePath);
            File.Copy(_filePath, rutaOrigen + _serviceId + "-" + "DJ" + ext);
            MessageBox.Show("Se adjuntó correctamente", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 21
0
        private FileInfo GetFile(string withFullIndex)
        {
            var dto = new FileInfoDto
            {
                Index    = withFullIndex,
                Name     = "Name1",
                Category = "cat1",
                Size     = 5
            };

            return(FileInfo.From(dto, new FileCategory(dto.Category)));
        }
 private void toolStripMenuItem_ServerOpen_Click(object sender, EventArgs e)
 {
     if (this.listView_Server.SelectedIndices.Count > 0)
     {
         var m = this.serverList[this.listView_Server.SelectedIndices[0]];
         if (m.Type == FileInfoType.Directory)
         {
             this.ServerPath = m;
             this.GetServerList();
         }
     }
 }
        public virtual int UpdateSync(FileInfoDto vm)
        {
            int count = 0;

            if (vm != null)
            {
                vm.Directory = Utils.FormatDirectory(vm.Directory);
                vm.Name      = Utils.FormatName(vm.Name);

                using (var db = this.CreateDbContext())
                {
                    using (db.BeginTransaction(IsolationLevel.Serializable))
                    {
                        db.Configuration.AutoDetectChangesEnabled = true;
                        FileInfo m = db.FileInfo.Where(q => q.Directory == vm.Directory && q.Name == vm.Name && q.Type == vm.Type).FirstOrDefault();
                        if (m == null)
                        {
                            m = new FileInfo()
                            {
                                Type      = vm.Type,
                                ParentId  = vm.ParentId,
                                Directory = vm.Directory,
                                Name      = vm.Name,
                                Key       = Guid.NewGuid().ToString("n")
                            };
                        }

                        m.Length        = vm.Length;
                        m.CreationTime  = vm.CreationTime;
                        m.LastWriteTime = vm.LastWriteTime;
                        m.IsDelete      = vm.IsDelete;
                        m.UpdateTime    = vm.UpdateTime;
                        m.CheckStatus   = (int)CheckStatusType.None;

                        if (m.Id == 0)
                        {
                            db.FileInfo.Add(m);
                        }

                        count += db.SaveChanges();
                        db.Commit();
                    }
                }
            }

            return(count);
        }
Ejemplo n.º 24
0
        //[SessionInterceptor]
        public async Task <FileInfoDto> Save(FileInfoDto fileInfo, byte[] fileBuffer)
        {
            //var uploadFileDto = await this.Get<UploadFileDto>(f => f.MD5Code == fileInfo.MD5);
            //if (uploadFileDto == null)
            //{
            var filePath = Path.Combine(basePath, fileInfo.Path.Trim('/'), fileInfo.Name);

            try
            {
                if (!File.Exists(filePath))
                {
                    using (var file = File.Create(filePath))
                    {
                        await file.WriteAsync(fileBuffer);
                    }
                }

                fileInfo.Url = new Uri(filePath).PathAndQuery;
            }
            catch (Exception e)
            {
                throw new ServiceFrameworkException("上传失败", e);
            }

            //    uploadFileDto = new UploadFileDto
            //    {
            //        MD5Code = fileInfo.MD5,
            //        RUrl = fileInfo.Url,
            //        Filename = fileInfo.Name,
            //        Extention = Path.GetExtension(fileInfo.Name).ToLower()

            //    };

            //    await this.AddOrUpdate<UploadFileDto, int>(uploadFileDto);
            //}
            //else
            //{
            //    fileInfo = GetFileInfo(Path.Combine(basePath, uploadFileDto.RUrl));
            //    //fileInfo.Url = uploadFileDto.RUrl;
            //    //fileInfo.Name = uploadFileDto.Filename;
            //    //fileInfo.Path=uploadFileDto.
            //}

            return(fileInfo);
        }
Ejemplo n.º 25
0
        public async Task <ResponseResult <dynamic> > UploadFile([FromForm] UploadInfo uploadInfo)
        {
            var formFile = uploadInfo.File;
            var data     = new ResponseResult <dynamic>();

            if (formFile == null)
            {
                data.Message = nameof(BusinessCode.Image_Empty);
                data.Code    = BusinessCode.Image_Empty;
                return(data);
            }
            if (_uploadOptions.AllowedFileTypes?.Contains(formFile.ContentType.ToLower()) == false)
            {
                data.Message = nameof(BusinessCode.Image_Type_Error);
                data.Code    = BusinessCode.Image_Type_Error;
                return(data);
            }
            if (formFile.Length > _uploadOptions.UploadLimitSize)
            {
                data.Message = nameof(BusinessCode.Image_Size_Error);;
                data.Code    = BusinessCode.Image_Size_Error;
                return(data);
            }
            byte[] bytes = new byte[formFile.Length];
            using (var stream = formFile.OpenReadStream())
            {
                await stream.ReadAsync(bytes, 0, (int)formFile.Length);
            }
            var md5Code     = Encrypt.Md5(bytes, null, null);
            var fileInfoDto = new FileInfoDto
            {
                MD5         = md5Code,
                Name        = formFile.FileName,
                Size        = formFile.Length,
                UpdateTime  = DateTime.Now,
                Dir         = false,
                ContentType = formFile.ContentType,
                Path        = uploadInfo.Prefix,
            };

            fileInfoDto = await _fileService.Save(fileInfoDto, bytes);

            data.Data = fileInfoDto;
            return(data);
        }
        public virtual int AddOrUpdate(FileInfoDto vm)
        {
            int count = 0;

            if (vm != null)
            {
                using (var db = this.CreateDbContext())
                {
                    using (db.BeginTransaction(IsolationLevel.Serializable))
                    {
                        count += this.AddOrUpdate(vm, db);
                        db.Commit();
                    }
                }
            }

            return(count);
        }
Ejemplo n.º 27
0
        private string[] SavePrepared(string multimediaFileId, string serviceComponentMultimediaId, string personId, string serviceComponentId, string fileName, string description, byte[] chartImagen)
        {
            string[] IDs = null;

            fileInfo = new FileInfoDto();

            fileInfo.PersonId           = personId;
            fileInfo.ServiceComponentId = serviceComponentId;
            fileInfo.FileName           = fileName;
            fileInfo.Description        = description;
            fileInfo.ByteArrayFile      = chartImagen;

            OperationResult operationResult = null;

            if (string.IsNullOrEmpty(multimediaFileId))     // GRABAR
            {
                // Grabar
                operationResult = new OperationResult();
                IDs             = _multimediaFileBL.AddMultimediaFileComponent(ref operationResult, fileInfo, Globals.ClientSession.GetAsList());

                // Analizar el resultado de la operación
                if (operationResult.Success != 1)
                {
                    MessageBox.Show(Constants.GenericErrorMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
            }
            else        // ACTUALIZAR
            {
                operationResult                       = new OperationResult();
                fileInfo.MultimediaFileId             = multimediaFileId;
                fileInfo.ServiceComponentMultimediaId = serviceComponentMultimediaId;
                _multimediaFileBL.UpdateMultimediaFileComponent(ref operationResult, fileInfo, Globals.ClientSession.GetAsList());

                // Analizar el resultado de la operación
                if (operationResult.Success != 1)
                {
                    MessageBox.Show(Constants.GenericErrorMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
            }

            return(IDs);
        }
Ejemplo n.º 28
0
        public virtual bool AddFileInfo(AddFileInfoDto vm)
        {
            bool result = false;

            if (vm != null && !string.IsNullOrEmpty(vm.Name))
            {
                string fullname = Utils.Combine(ConfigUtils.FileRootPath, vm.Directory, vm.Name);
                if (vm.Type == FileInfoType.File && File.Exists(fullname) ||
                    vm.Type == FileInfoType.Directory && Directory.Exists(vm.Directory))
                {
                    FileInfoDto m = new FileInfoDto()
                    {
                        Type      = vm.Type,
                        Directory = vm.Directory,
                        Name      = vm.Name,
                        IsDelete  = false
                    };
                    if (vm.Type == FileInfoType.File)
                    {
                        var info = new FileInfo(fullname);
                        m.CreationTime  = info.CreationTime;
                        m.LastWriteTime = info.LastAccessTime;
                        m.Length        = info.Length;
                    }
                    else
                    {
                        var info = new DirectoryInfo(fullname);
                        m.CreationTime  = info.CreationTime;
                        m.LastWriteTime = info.LastAccessTime;
                    }
                    var parent = FileInfoService.Instance.GetParent(vm.Directory);
                    if (parent != null)
                    {
                        m.ParentId = parent.ParentId;
                    }
                    var fileInfoRepository = this.GetRepository <IFileInfoRepository>();
                    fileInfoRepository.AddOrUpdate(m);
                    result = true;
                }
            }

            return(result);
        }
Ejemplo n.º 29
0
        public virtual bool CreateDirectory(CreateDirectoryParamDto vm)
        {
            bool result = false;

            if (!string.IsNullOrEmpty(vm.Name) && vm.CreationTime != DateTime.MinValue && vm.LastWriteTime != DateTime.MinValue)
            {
                string fullname = Utils.Combine(ConfigUtils.FileRootPath, vm.Directory, vm.Name);
                if (!Directory.Exists(fullname))
                {
                    Directory.CreateDirectory(fullname);
                    Directory.SetCreationTime(fullname, vm.CreationTime);
                    Directory.SetLastAccessTime(fullname, vm.LastWriteTime);
                }

                var fileInfoRepository = this.GetRepository <IFileInfoRepository>();
                var m = fileInfoRepository.Get(vm.Directory, vm.Name, FileInfoType.Directory);
                if (m == null)
                {
                    m = new FileInfoDto()
                    {
                        Type          = FileInfoType.Directory,
                        Directory     = vm.Directory,
                        Name          = vm.Name,
                        CreationTime  = vm.CreationTime,
                        LastWriteTime = vm.LastWriteTime,
                        IsDelete      = false,
                    };
                    var parent = FileInfoService.Instance.GetParent(vm.Directory);
                    if (parent != null)
                    {
                        m.ParentId = parent.Id;
                    }
                    fileInfoRepository.AddOrUpdate(m);
                }
                result = true;

                string log = string.Format("创建目录, Directory: {0}, Name: {1}, CreationTime: {2:yyyy-MM-dd HH:mm:ss}, LastWriteTime: {3:yyyy-MM-dd HH:mm:ss}", m.Directory, m.Name, m.Length, m.CreationTime, m.LastWriteTime);
                OptionLogService.Instance.Add(OptionLogType.CreateDirectory, log);
            }

            return(result);
        }
        public async Task GetAllFilesAsync_SavesDataCorrectly()
        {
            var newFile = new FileInfoDto
            {
                Index    = "1.1",
                Name     = "Name1.1",
                Category = "cat1",
                Size     = 4
            };
            await _fileServ.SaveAsync(new List <FileInfoDto> {
                newFile
            });

            var filesFromDb = await _fileServ.GetAllFilesAsync();

            Assert.Single(filesFromDb);
            var fileFromDb = filesFromDb.Single();

            Assert.True(AreObjectsEqualByValue(newFile, fileFromDb));
        }