public static void AddFormFile(this DocumentStorage storage, IFormFile file)
        {
            FileItem item = new FileItem
            {
                FileName = file.FileName,
                MimeType = file.ContentType
            };

            file.CopyTo(item.Stream);

            storage.AddFile(item);
        }
Esempio n. 2
0
        public void Test_Open_FileStorage()
        {
            FileStorage storage = new FileStorage("D:\\Test");

            DocumentStorage attach = storage[1];

            FileItem item = new FileItem()
            {
                FileName = "форма временного пропуска.doc",
                MimeType = "doc"
            };

            using (FileStream fileStream = new FileStream(Path.Combine("D:\\Test", item.FileName), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                fileStream.CopyTo(item.Stream);
            }


            attach.AddFile(item);

            int count = attach.GetGuids().Count();

            Assert.True(count == 1);
        }