public async Task When_CreatingModule_Expect_ModuleCreated(string name) { var moduleNew = new ModuleNewDto { Name = name }; var id = await _modulesService.Create(moduleNew); var actualModuleCreated = await _context.Modules.FirstAsync(m => m.Id == id); Assert.Equal(name, actualModuleCreated.Name); }
public async Task <IActionResult> CreateModule([FromBody] ModuleNewDto moduleNew) { try { var id = await _modulesService.Create(moduleNew); return(Ok(id)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }