public Setup() { _createAssetKeyValid = new CreateAssetCommand { Name = Guid.NewGuid().ToString(), FileURI = "key.fbx", CategoriesIds = new List <int> { 2, 4 } }; _createAssetKeyInvalid = new CreateAssetCommand { Name = "", FileURI = "" }; _updateAssetKeyValid = new UpdateAssetComamnd { Name = Guid.NewGuid().ToString(), FileURI = "key.fbx", CategoriesIds = new List <int> { 2 } }; _updateAssetKeyInvalid = new UpdateAssetComamnd { Name = "", FileURI = "" }; _deletAssetKey = new DeleteAssetCommand(); _validManagerUser = new ApplicationUser { Username = "******", Password = "******" }; _validOperatorUser = new ApplicationUser { Username = "******", Password = "******" }; _invalidUser = new ApplicationUser { Username = "******", Password = "******" }; _erroFormatUser = new ApplicationUser { Username = "", Password = "******" }; var baseTestProjectDirectory = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../")); _imgAssetValidPath = $"{baseTestProjectDirectory}TestFiles/helmet.jpg"; _imgAssetValidPath2 = $"{baseTestProjectDirectory}TestFiles/gloves2.jpg"; _imgAssetValidPath3PNG = $"{baseTestProjectDirectory}TestFiles/helmet.png"; _imgAssetInvalidFileTXT = $"{baseTestProjectDirectory}TestFiles/texto.txt"; }
public async Task <ActionResult> Update([FromForm] UpdateAssetComamnd command) { try { await _mediator.Send(command); return(new OkResult()); } catch (ValidationException ve) { return(new BadRequestObjectResult(new { errorMessage = ve.Message, errorList = ve.Errors })); } catch (Exception e) { return(new StatusCodeResult(500)); } }