Example #1
0
        public async Task TaskKeyAndSingleFileModel()
        {
            var guidelineApi = Resolver.GetService <IGuidelineApi>();

            var model = new SingleFileModel
            {
                File = TestHelper.GetFormFile("file")
            };

            await guidelineApi.TaskKeyAndSingleFileModel(_someKey, model);

            Assert.True(true);
        }
Example #2
0
        public async Task TaskSingleFileModel()
        {
            var guidelineApi = Resolver.GetService <IGuidelineApi>();

            var model = new SingleFileModel
            {
                File = TestHelper.GetFormFile("file", "SampleĞüişçWord.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
            };

            await guidelineApi.TaskSingleFileModel(model);

            Assert.True(true);
        }
Example #3
0
        public async Task TaskSingleFileModel(SingleFileModel model)
        {
            await Task.CompletedTask;

            var name     = model.File.Name;
            var fileName = model.File.FileName;
            var length   = model.File.Length;

            using (var ms = new MemoryStream())
            {
                model.File.CopyTo(ms);
                System.IO.File.WriteAllBytes(Path.Combine(_hostingEnvironment.ContentRootPath, fileName), ms.ToArray());
            }

            _logger.LogWarning(JsonConvert.SerializeObject(new { name, fileName, length }));
        }
Example #4
0
        public void ProxyModelMetadataInfoForSingleFile()
        {
            var formFile = TestHelper.GetFormFile("file");
            var length   = formFile.Length;
            var model    = new SingleFileModel
            {
                File = formFile
            };

            var contentResult = GetResolvedContentResult(model);
            var files         = contentResult.Files;
            var dictionary    = contentResult.Dictionary;

            Assert.True(1 == files.Count);
            Assert.True(0 == dictionary.Count);

            Assert.Equal("some_text_file.txt", files["File"].FileName);
            Assert.Equal(length, files["File"].Length);
        }
Example #5
0
 public Task TaskKeySingleFileAndBarModel(string key, SingleFileModel model, Bar bar)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public Task TaskKeyAndSingleFileModel(string key, SingleFileModel model)
 {
     throw new NotImplementedException();
 }