public async Task Put() { //Arrange var get = await controller.Get(1); var okgetResult = Assert.IsType <OkObjectResult>(get); var entity = Assert.IsType <file_type>(okgetResult.Value); var newEntity = new file_type(); newEntity.filetype = "photo"; //should test the equals Equatable for all these too var huh = entity.Equals(newEntity); entity.filetype = "testEdit"; //Act var response = await controller.Put(1, entity); // Assert var okResult = Assert.IsType <OkObjectResult>(response); var result = Assert.IsType <file_type>(okResult.Value); Assert.Equal(entity.filetype, result.filetype); }
public override void visit(file_type _file_type) { AddPossibleComments(_file_type, true, false); if (_file_type.file_of_type != null) { _file_type.file_of_type.visit(this); } }
public async Task <IActionResult> Put(int id, [FromBody] file_type entity) { try { if (id < 0 || !isValid(entity)) { return(new BadRequestResult()); } return(Ok(await agent.Update <file_type>(id, entity))); } catch (Exception ex) { return(await HandleExceptionAsync(ex)); } }
public TFile(Form1 parentForm, string filePath, string outFileName, file_type fType) { if (System.IO.File.Exists(filePath) == false) { isExists = false; return; } else { isExists = true; } this.parentForm = parentForm; this.fType = fType; this.filePath = filePath; //outFilePath = System.IO.Directory.GetCurrentDirectory() + "\\" + "[OUT]Data" + "\\"+ System.IO.Path.GetFileName(filePath); outFilePath = System.IO.Directory.GetCurrentDirectory() + "\\" + "[OUT]Data" + "\\" + outFileName + System.IO.Path.GetExtension(filePath); string outDataFolder = System.IO.Directory.GetCurrentDirectory() + "\\" + "[OUT]Data"; if (System.IO.Directory.Exists(outDataFolder) == false) { //создаем путь для выходных файлов System.IO.Directory.CreateDirectory(outDataFolder); //даем права на запись в папку System.IO.File.SetAttributes(outDataFolder, System.IO.FileAttributes.Normal); } try{ System.IO.File.Copy(filePath, outFilePath, true);//делаем дубликат файла для последующего использования } catch (System.Exception ex) { } switch (fType) { case file_type.WORD: { wordApp = new Microsoft.Office.Interop.Word.Application(); //wordApp.Options.DefaultHighlightColorIndex= Microsoft.Office.Interop.Word.WdColorIndex.wdGreen; break; } } }
public async Task <IActionResult> Post([FromBody] file_type entity) { try { if (!isValid(entity)) { return(new BadRequestResult()); } //sm(agent.Messages); return(Ok(await agent.Add <file_type>(entity))); } catch (Exception ex) { //sm(agent.Messages); return(await HandleExceptionAsync(ex)); } }
public async Task Post() { //Arrange var entity = new file_type() { filetype = "TestPost" }; //Act var response = await controller.Post(entity); // Assert var okResult = Assert.IsType <OkObjectResult>(response); var result = Assert.IsType <file_type>(okResult.Value); Assert.Equal("TestPost", result.filetype); }
public override void visit(file_type _file_type) { }
public virtual void visit(file_type _file_type) { DefaultVisit(_file_type); }
public override void visit(file_type _file_type) { DefaultVisit(_file_type); pre_do_visit(_file_type); visit(file_type.file_of_type); post_do_visit(_file_type); }
public virtual void post_do_visit(file_type _file_type) { }
public virtual void visit(file_type _file_type) { }
public override void visit(file_type _file_type) { prepare_node(_file_type.file_of_type, "file_of_type"); }
public override void visit(file_type _file_type) { executer.visit(_file_type); if (_file_type.file_of_type != null) this.visit((dynamic)_file_type.file_of_type); if (_file_type.attr_list != null) this.visit((dynamic)_file_type.attr_list); if (_file_type.attributes != null) this.visit((dynamic)_file_type.attributes); }