private void Setup() { var options = new DbContextOptionsBuilder <ApplicationContext>().Options; _applicationContextMock = new Mock <ApplicationContext>(options); _testedService = new CoachService(Logger, _applicationContextMock.Object); }
public CoachControllerTests() { service = new CoachService(); controller = new CoachController(service); mapping = new ConfigureMapping(); mapping.ConfigureMaping(); }
public async Task <HttpResponseMessage> CoachProfiles([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "profile/coach")] HttpRequestMessage request, ILogger log) { coachService = new CoachService(log); if (request.Method == HttpMethod.Get) { return(await coachService.GetAllCoachProfiles()); } else if (request.Method == HttpMethod.Post) { JObject newCoachProfile = null; /* Read from the requestBody */ using (StringReader reader = new StringReader(await request.Content.ReadAsStringAsync())) { newCoachProfile = JsonConvert.DeserializeObject <JObject>(reader.ReadToEnd()); } return(await coachService.CreateCoachProfile(newCoachProfile)); } else { throw new NotImplementedException(); } }
public ContactUsController(ILogger <ContactUsController> logger, IAboutUsService aboutUsService, IContactUsService contactUsService, ICoachService coachService) { this._aboutUsService = aboutUsService; this._contactUsService = contactUsService; this._coachService = coachService; this._logger = logger; }
public SportsmenController(ITeamService teamService, ISportmanService sportmanService, ICoachService сoachService, IMapper mapper) { _teamService = teamService ?? throw new ArgumentNullException(Resources.Exceptions.teamServiceNullException); _sportmanService = sportmanService ?? throw new ArgumentNullException(Resources.Exceptions.sportmanServiceNullException); _сoachService = сoachService ?? throw new ArgumentNullException(Resources.Exceptions.coachServiceNullException); _mapper = mapper ?? throw new ArgumentNullException(Resources.Exceptions.mapper); }
public CoachController( ICoachService coachService, ICoursesService coursesService) { _coachService = coachService; _coursesService = coursesService; }
public UserController( IUserService userService, ICoachService coachService) { _userService = userService; _coachService = coachService; }
public async Task <HttpResponseMessage> Coach([HttpTrigger(AuthorizationLevel.Anonymous, "get", "put", Route = "coach/{coachID}")] HttpRequestMessage request, int coachID, ILogger log) { coachService = new CoachService(log); if (request.Method == HttpMethod.Get) { return(await coachService.GetCoachByID(coachID)); } else if (request.Method == HttpMethod.Put) { JObject coachData = null; /* Read from the requestBody */ using (StringReader reader = new StringReader(await request.Content.ReadAsStringAsync())) { coachData = JsonConvert.DeserializeObject <JObject>(reader.ReadToEnd()); } return(await coachService.UpdateCoachByID(coachID, coachData)); } else { throw new NotImplementedException(); } }
public CoachesController(Club club, ICoachService coachService, IMemberQuery memberQuery ) { this.club = club; this.coachService = coachService; this.memberQuery = memberQuery; }
public FstController(ITeamService teamService, ICoachService сoachService, IMapper mapper, ICityService cityService, IFstService fstService, ILogger <FstController> logger) { _fstService = fstService ?? throw new ArgumentNullException(Resources.Exceptions.fstServiceNullException); _teamService = teamService ?? throw new ArgumentNullException(Resources.Exceptions.teamServiceNullException); _сoachService = сoachService ?? throw new ArgumentNullException(Resources.Exceptions.coachServiceNullException); _cityService = cityService ?? throw new ArgumentNullException(Resources.Exceptions.coachServiceNullException); _mapper = mapper ?? throw new ArgumentNullException(Resources.Exceptions.mapper); _logger = logger; }
public SelectCoachModalModalViewModel(IKernel kernel, IMapper mapper, ICoachService coachService) : base(kernel, mapper) { Coaches = coachService .GetAll() .Select(dto => _mapper.Map(dto, _kernel.Get <ICoachTileViewModel>())) .ToList(); InitCommands(); }
public AdminController( IUserService userService, IApplicationUserService applicationUserService, ICoachService coachService) { _userService = userService; _applicationUserService = applicationUserService; _coachService = coachService; }
public UserService( UserManager <ApplicationUser> userManager, IPersonalInfoRepository personalInfoRepository, ICoachService coachService ) { _userManager = userManager; _personalInfoRepository = personalInfoRepository; _coachService = coachService; }
public CoachApiController(ITeamService teamService, ICoachService сoachService, IMapper mapper, IConfiguration configuration, ICityService cityService) { _teamService = teamService ?? throw new ArgumentNullException(Resources.Exceptions.teamServiceNullException); _сoachService = сoachService ?? throw new ArgumentNullException(Resources.Exceptions.coachServiceNullException); _cityService = cityService ?? throw new ArgumentNullException(Resources.Exceptions.coachServiceNullException); _mapper = mapper ?? throw new ArgumentNullException(Resources.Exceptions.mapper); _configuration = configuration; coachFolder = _configuration.GetValue <string>("avatar:coach"); _сoachService.CoachFolder = coachFolder; }
public Display(BookmakerContext context) { this.coachService = new CoachService(context); this.playerService = new PlayerService(context); this.teamService = new TeamService(context); this.matchService = new MatchService(context); SetUpConsole(); Home(); }
public ValidateCoachModalViewModel(IKernel kernel, IMapper mapper, IHashService hashService, ICoachService coachService) : base(kernel, mapper) { _hashService = hashService; _coachService = coachService; Coaches = coachService .GetAll() .Select(dto => _mapper.Map(dto, _kernel.Get <ICoachTileViewModel>())) .ToList(); InitCommands(); }
public async Task Take_All_Coaches_Count_Successes() { Setup(); var coaches = GenerateListOfCoches(); _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.TakeAllCoaches()).ToList(); Assert.Equal(result.Count, coaches.Count); }
public async Task Delete_Failed_Incorrect_Id(int id) { Setup(); var coaches = GenerateListOfCoches(); _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.DeleteCoach(id, CancellationToken.None)); Assert.False(result); }
public async Task Take_Coach_By_Incorrect_ID_Check(int id) { Setup(); var coaches = GenerateListOfCoches(); var coachesContract = GenerateListOfCoachesContract(); _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.TakeCoach(id, CancellationToken.None)); Assert.Null(result); }
public async Task <HttpResponseMessage> CoachProfile([HttpTrigger(AuthorizationLevel.Anonymous, "get", "delete", Route = "profile/coach/{coachID}")] HttpRequestMessage request, int coachID, ILogger log) { coachService = new CoachService(log); if (request.Method == HttpMethod.Get) { return(await coachService.GetCoachProfileByID(coachID)); } else if (request.Method == HttpMethod.Delete) { return(await coachService.DeleteCoachProfileByID(coachID)); } else { throw new NotImplementedException(); } }
public async Task Add_Coach() { Setup(); var coaches = GenerateListOfCoches(); var newCoach = new CoachContract() { DateBirth = "01.02.2000", Description = "TestDesc", FirstName = "Denis", LastName = "Denisovich", Id = 0, PhoneNumber = "+380145674584" }; _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.AddCoach(newCoach, CancellationToken.None)); Assert.True(result); }
public async Task Take_All_Service_Check_Last_Successes() { Setup(); var coaches = GenerateListOfCoches(); var coachesContract = GenerateListOfCoachesContract(); _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.TakeAllCoaches()).ToList(); Assert.Equal(result.Last().DateBirth, coachesContract.Last().DateBirth); Assert.Equal(result.Last().FirstName, coachesContract.Last().FirstName); Assert.Equal(result.Last().LastName, coachesContract.Last().LastName); Assert.Equal(result.Last().PhoneNumber, coachesContract.Last().PhoneNumber); Assert.Equal(result.Last().Id, coachesContract.Last().Id); Assert.Equal(result.Last().Description, coachesContract.Last().Description); }
public UserController( IUserService user, IAdressesService adressesService, IPostalcodeService postalcodeService, ITeamService teamService, INationService nationService, IPlayerSkillService playskillService, IPlayerService playerService, IStadiumService stadiumService, ICoachService coachService, ICoachSkillService coachSkillService) { _usermanager = (UserManager)user; _adressmanager = (AdressManager)adressesService; _postalcodeManager = (PostalcodeManager)postalcodeService; _teamManager = (TeamManager)teamService; _nationManager = (NationManager)nationService; _playerskillManager = (PlayerSkillManager)playskillService; _playerManager = (PlayerManager)playerService; _stadiumManager = (StadiumManager)stadiumService; _coachManager = (CoachManager)coachService; _coachSkillManager = (CoachSkillManager)coachSkillService; }
public async Task Take_Coach_By_ID_Check(int id) { Setup(); var coaches = GenerateListOfCoches(); var coachesContract = GenerateListOfCoachesContract(); var expectedCoach = coachesContract[id - 1]; _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.TakeCoach(id, CancellationToken.None)); Assert.Equal(expectedCoach.DateBirth, result.DateBirth); Assert.Equal(expectedCoach.FirstName, result.FirstName); Assert.Equal(expectedCoach.LastName, result.LastName); Assert.Equal(expectedCoach.PhoneNumber, result.PhoneNumber); Assert.Equal(expectedCoach.Id, result.Id); Assert.Equal(expectedCoach.Description, result.Description); }
public async Task Update_Failed_Incorrect_id(int id) { Setup(); var coaches = GenerateListOfCoches(); var newCoach = new CoachContract() { DateBirth = "01.02.1999", Description = "TestDesc", FirstName = "Denis", LastName = "Denisovich", Id = id, PhoneNumber = "+380145674584" }; _applicationContextMock.Setup(x => x.Coaches).ReturnsDbSet(coaches); _testedService = new CoachService(Logger, _applicationContextMock.Object); var result = (await _testedService.UpdateCoach(newCoach, CancellationToken.None)); Assert.False(result); }
public CoachController(ICoachService _service) { service = _service; }
public CoachController(ICoachService coach) { _coachManager = (CoachManager)coach; }
public CoachController(ICoachService coachService, IMapper mapper, ISignedInUserService signedInUserService) { _mapper = mapper; _coachService = coachService; _signedInUserService = signedInUserService; }
public CoachController(ICoachService coachService) { _dbContext = new ApplicationDbContext(); _coachService = coachService; }
public CoachController(ICoachService coachService) { _coachService = coachService; }