public async Task GetDiscipline()
        {
            RepositoryDiscipline
            .Setup(x => x.FindFirstAsync(It.IsAny <ISpecification <DatabaseDiscipline> >()))
            .ReturnsAsync(ModelsCreationHelper.CreateDatabaseDiscipline());

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

            await ServiceDiscipline.GetDisciplineAsync(999);

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

            await ServiceDiscipline.GetDisciplineAsync(999);

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

            await ServiceDiscipline.GetDisciplineAsync(999);
        }
Example #2
0
 public async Task <IActionResult> GetDiscipline([FromRoute] int id)
 {
     return(await Ok(() => _serviceDiscipline.GetDisciplineAsync(id)));
 }