public void GetVacationOpportunityByVacationLeader_Ok()
        {
            var jsonDataTable = @"[
                    {
                        'VacationOpportunityId': '1',
                        'VacationOpeningNumber': 'PRE - 2020 - 0001234',
                        'VacationOpeningDate': '2021-05-05',
                        'VacationOfferLetterDate':'2021-05-05',
                        'VacationLeader': 'Thomas Anjos',
                        'VacationCancellationdate': '2021-05-05',
                        'VacationOpportunityStatus': 'true',
                        'CareerId': '1',
                        'ProfessionalLevelId': '1',
                        'OpportunityTypeId': '1',
                    }
                ]";

            var vacationLeader = "Thomas Anjos";

            _repositoryConnectionMock.Setup(x => x.SearchCommand("GetVacationOpportunityByVacationLeader", It.IsAny <Dictionary <string, string> >())).Returns(jsonDataTable);

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            var result = repo.GetVacationOpportunityByVacationLeader(vacationLeader);

            Assert.IsNotNull(result);
        }
        public void UpdateVacationOpportunity_Exception()
        {
            var jsonVacationOpportunity = @"{
                        'VacationOpportunityId': '1',
                        'VacationOpeningNumber': 'PRE - 2020 - 0001234',
                        'VacationOpeningDate': '2021-05-05',
                        'VacationOfferLetterDate':'2021-05-05',
                        'VacationLeader': 'Thomas Anjos',
                        'VacationCancellationdate': '2021-05-05',
                        'VacationOpportunityStatus': 'true',
                        'CareerId': '1',
                        'ProfessionalLevelId': '1',
                        'OpportunityTypeId': '1',
                        }";

            var vacationOpportunity = JsonConvert.DeserializeObject <VacationOpportunity>(jsonVacationOpportunity);

            _repositoryConnectionMock.Setup(x => x.SimpleExecuteCommand("UpdateVacationOpportunity", It.IsAny <Dictionary <string, string> >())).Throws(new Exception());

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            repo.UpdateVacationOpportunity(vacationOpportunity);

            Assert.IsTrue(true);
        }
        public void InsertVacationOpportunity_Ok()
        {
            var jsonVacationOpportunity = @"{
                        'vcationOpportunityId': '1',
                        'vacationOpeningNumber': 'PRE - 2020 - 0001234',
                        'vacationOpeningDate': '2021-05-05',
                        'vacationOfferLetterDate':'2021-05-05',
                        'vacationLeader': 'Thomas Anjos',
                        'vacationCancellationdate': '2021-05-05',
                        'vacationOpportunityStatus': 'true',
                        'career': {
                            'careerId': '1'
                        },
                        'professionalLevel': {
                            'professionalLevelId': '1'
                        },
                        'opportunityType': {
                            'opportunityTypeId': 1
                        }
                        }";
            var vacationOpportunity     = JsonConvert.DeserializeObject <VacationOpportunity>(jsonVacationOpportunity);

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            repo.InsertVacationOpportunity(vacationOpportunity);

            Assert.IsTrue(true);
        }
        public void GetAllVacationOpportunities_ArgumentNullException()
        {
            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            var result = repo.GetAllVacationOpportunities();

            Assert.IsNull(result);
        }
        public void GetVacationOpportunityByOpeningDate_ArgumentNullException()
        {
            var openingDate = DateTime.Parse("2021-05-05");

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            var result = repo.GetVacationOpportunityByOpeningDate(openingDate);

            Assert.IsNull(result);
        }
        public void GetVacationOpportunityByVacationLeader_ArgumentNullException()
        {
            var vacationLeader = "Thomas Anjos";

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            var result = repo.GetVacationOpportunityByVacationLeader(vacationLeader);

            Assert.IsNull(result);
        }
        public void GetAllVacationOpportunities_ArgumentException()
        {
            var jsonDataTable = @"[{}]";

            _repositoryConnectionMock.Setup(x => x.SearchCommand("GetAllVacationOpportunities", It.IsAny <Dictionary <string, string> >())).Returns(jsonDataTable);

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            var result = repo.GetAllVacationOpportunities();

            Assert.IsNull(result);
        }
        public void DeleteVacationOpportunity_NullReferenceException()
        {
            var jsonVacationOpportunity = @" ";

            var vacationOpportunity = JsonConvert.DeserializeObject <VacationOpportunity>(jsonVacationOpportunity);

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            repo.DeleteVacationOpportunity(vacationOpportunity);

            Assert.IsTrue(true);
        }
        public void GetVacationOpportunityByOpeningDate_ArgumentException()
        {
            var jsonDataTable = @"[{}]";

            var OpeningDate = DateTime.Parse("2021-05-05");

            _repositoryConnectionMock.Setup(x => x.SearchCommand("GetVacationOpportunityByDateRegister", It.IsAny <Dictionary <string, string> >())).Returns(jsonDataTable);

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            var result = repo.GetVacationOpportunityByOpeningDate(OpeningDate);

            Assert.IsNull(result);
        }
        public void DeleteVacationOpportunity_Exception()
        {
            var jsonVacationOpportunity = @"{
                'vacationOpportunityId': '1'
                }";

            var vacationOpportunity = JsonConvert.DeserializeObject <VacationOpportunity>(jsonVacationOpportunity);

            _repositoryConnectionMock.Setup(x => x.SimpleExecuteCommand("DeleteVacationOpportunity", It.IsAny <Dictionary <string, string> >())).Throws(new Exception());

            var repo = new VacationOpportunityRepository(_configurationMock.Object, _repositoryConnectionMock.Object, _careerRepositoryMock.Object,
                                                         _professionalLevelRepositoryMock.Object, _opportunityTypeRepository.Object);

            repo.DeleteVacationOpportunity(vacationOpportunity);

            Assert.IsTrue(true);
        }