Exemplo n.º 1
0
        public async Task CreateMaterial_NoAccess()
        {
            Context
            .Setup(x => x.GetCurrentUserAsync())
            .ReturnsAsync(ModelsCreationHelper.CreateAdmin);

            await Assert.ThrowsAsync <EducationSystemPublicException>
                (() => ServiceMaterial.CreateMaterialAsync(new Material()));

            Context
            .Setup(x => x.GetCurrentUserAsync())
            .ReturnsAsync(ModelsCreationHelper.CreateStudent);

            await Assert.ThrowsAsync <EducationSystemPublicException>
                (() => ServiceMaterial.CreateMaterialAsync(new Material()));
        }
Exemplo n.º 2
0
 public async Task <IActionResult> CreateMaterial([FromBody] Material material)
 {
     return(await Ok(() => _serviceMaterial.CreateMaterialAsync(material)));
 }