public async Task GetAllIntrests_Should_Return_Success_Result()
        {
            var interestRepository = new InterestRepository(_pearUpContext);
            var result             = await interestRepository.GetAllInterests();

            result.IsSuccessed.Should().BeTrue();
            result.Value.Should().BeEquivalentTo(_interestsList);
        }
        public async Task GetInterestById_Should_Return_Failure_Result_With_InValid_Interest_Id(int id)
        {
            var interestRepository = new InterestRepository(_pearUpContext);
            var result             = await interestRepository.GetInterestById(id);

            result.IsSuccessed.Should().BeFalse();
            result.GetErrorString().Should().Be(InterestRepository.No_Interests_Found);
        }
        public async Task GetInterestsByIds_Should_Return_Success_Result()
        {
            int[] arr = new int[] { 1, 2 };
            var   interestRepository = new InterestRepository(_pearUpContext);
            var   result             = await interestRepository.GetInterestsByIds(arr);

            result.IsSuccessed.Should().BeTrue();
            result.Value.Should().BeEquivalentTo(_interestsList);
        }
        public async Task GetInterestsByIds_Should_Return_Failure_Result_If_Interest_Id_Not_Available()
        {
            int[] arr = new int[] { 4, 5 };
            var   interestRepository = new InterestRepository(_pearUpContext);
            var   result             = await interestRepository.GetInterestsByIds(arr);

            result.IsSuccessed.Should().BeFalse();
            result.GetErrorString().Should().Be(InterestRepository.No_Interests_Found);
        }
        public async Task GetInterestById_Should_Return_Success_Result_With_Valid_Interest_Id()
        {
            var interestRepository = new InterestRepository(_pearUpContext);
            var result             = await interestRepository.GetInterestById(1);

            result.IsSuccessed.Should().BeTrue();
            result.Value.Id.Should().Be(1);
            result.Value.InterestDescription.Should().Be("mock");
            result.Value.InterestName.Should().Be("mock");
        }
        public ActionResult CreateClinkerInterest(ClinkerInterests clinkerInterestObject)
        {
            var newClinkerInterest = InterestRepository.AddClinkerInterest(clinkerInterestObject);

            return(Created($"api/createdInterest/{newClinkerInterest.Id}", newClinkerInterest));
        }
 public InterestsController()
 {
     _repo = new InterestRepository();
 }
Example #8
0
 public InterestsController()
 {
     _validator          = new CreateInterestValidator();
     _interestRepository = new InterestRepository();
     _userRepository     = new UserRepository();
 }
        public ActionResult updateClinkerInterest(ClinkerInterests newClinkerInterest)
        {
            var updatedClinkerInterestObject = InterestRepository.UpdateClinkerInterest(newClinkerInterest);

            return(Created("api/updatedClinkerInterest", updatedClinkerInterestObject));
        }
        public ActionResult deleteClinkerInterest(int clinkerInterestId)
        {
            var newClinkerInterestList = InterestRepository.DeleteClinkerInterest(clinkerInterestId);

            return(Created("api/clinkerInterestList", newClinkerInterestList));
        }
 internal static InterestUserMapModel CreateInterestUserMap(InterestUserMapModel mapModel)
 {
     return(InterestRepository.CreateInterestUserMap(mapModel));
 }
        public ActionResult <IEnumerable <Interest> > GetAllInterests()
        {
            var repo = new InterestRepository();

            return(repo.GetAll());
        }
        public ActionResult CreateInterest(Interests interestObject)
        {
            var newInterest = InterestRepository.AddInterest(interestObject);

            return(Created($"api/createdInterest/{newInterest.Id}", newInterest));
        }
 public UserController(UserRepository userRepository, InterestRepository interestRepository, ChalangeRepository chalangeRepository)
 {
     _userRepository     = userRepository;
     _interestRepository = interestRepository;
     _chalangeRepository = chalangeRepository;
 }
Example #15
0
        public void Setup()
        {
            var context = DatabaseHelper.Connection();

            _repository = new InterestRepository(context);
        }
Example #16
0
 public IdeasController()
 {
     _ideaRepository     = new IdeaRepository();
     _interestRepository = new InterestRepository();
 }
 public InterestsController()
 {
     _validator          = new InterestRequestValidator();
     _interestRepository = new InterestRepository();
 }
        public ActionResult GetAllInterests()
        {
            var interestList = InterestRepository.GetAllInterests();

            return(Created($"api/getAllInterests", interestList));
        }
        public ActionResult deleteInterest(int interestId)
        {
            var newInterestList = InterestRepository.DeleteInterest(interestId);

            return(Created("api/interestList", newInterestList));
        }
 public InterestsController(InterestRepository interestRepository)
 {
     _interestRepository = interestRepository;
 }
 internal static IEnumerable <InterestModel> GetUserInterests(int userId)
 {
     return(InterestRepository.GetUserInterests(userId));
 }