public async Task IfCategoryNotExistsTheItIsCreated()
        {
            var jobCategoryGuid = Guid.NewGuid();

            _siteFinityHttpService.GetAll <SiteFinityTrait>("traits").Returns(Task.FromResult(new List <SiteFinityTrait>
            {
                new SiteFinityTrait {
                    Name = "Leader", JobProfileCategories = new List <Guid> {
                        jobCategoryGuid
                    }
                }
            }));

            _siteFinityHttpService.GetTaxonomyInstances("Job Profile Category").Returns(Task.FromResult(
                                                                                            new List <TaxonomyHierarchy>
            {
                new TaxonomyHierarchy {
                    Id = jobCategoryGuid, Title = "Animal care"
                }
            }));

            await _sut.RunOnce(_logger);

            await _jobCategoryRepository.Received(1).CreateOrUpdateJobCategory(Arg.Any <JobCategory>());
        }
Ejemplo n.º 2
0
        public async Task CreatesAllOfTheCategoriesIfNotExist()
        {
            _siteFinityHttpService
            .GetAll <SiteFinityJobProfile>(
                "jobprofiles?$select=Id,Title,JobProfileCategories&$expand=RelatedSkills&$orderby=Title")
            .Returns(Task.FromResult(JobProfiles));

            _siteFinityHttpService.GetTaxonomyInstances("Job Profile Category").Returns(Task.FromResult(JobCategories));

            await _sut.RunOnce(_logger);

            await _jobCategoryRepository.Received(JobCategories.Count).CreateOrUpdateJobCategory(Arg.Any <JobCategory>());
        }