예제 #1
0
        public async Task GetAllReturnAllEntities()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "TrainersGetAllDb").Options;
            var dbContext = new ApplicationDbContext(options);

            dbContext.Trainers.AddRange(
                new Trainer(),
                new Trainer(),
                new Trainer());

            await dbContext.SaveChangesAsync();

            var repository = new EfDeletableEntityRepository <Trainer>(dbContext);

            var service = new TrainersService(repository);

            this.InitializeMapper();

            var result = service.GetAll <TrainerViewModel>();

            Assert.Equal(3, result.Count());
        }
예제 #2
0
 public List <Models.Trainers.Trainer> Get([FromQuery] SearchTrainerParams searchTrainerParams)
 {
     _authenticationService.IsAuthorized(Request, new[] { "EMPLOYEE", "TRAINER", "CLIENT" });
     return(_trainersService.GetAll(searchTrainerParams));
 }