Пример #1
0
        public async Task GetJobProfileReturnsApiModelsWithCorrectUrlPrefixWhenDataExists()
        {
            // Arrange
            var dataModels = GetSegmentDataModel();
            var repository = A.Fake <ICosmosRepository <SegmentDataModel> >();

            A.CallTo(() => repository.GetData(A <Expression <Func <SegmentDataModel, SegmentDataModel> > > .Ignored, A <Expression <Func <SegmentDataModel, bool> > > .Ignored)).Returns(dataModels);

            var dataService      = new ProfileDataService(repository, defaultLogger);
            var expectedOverview = GetOverviewApiModel();

            // Act
            var result = await dataService.GetJobProfile(JobProfileName).ConfigureAwait(false);

            // Assert
            Assert.True(result.Title.Equals(expectedOverview.Title, StringComparison.OrdinalIgnoreCase) &&
                        result.Overview.Equals(expectedOverview.Overview, StringComparison.OrdinalIgnoreCase) &&
                        result.Soc.Equals(expectedOverview.Soc, StringComparison.OrdinalIgnoreCase) &&
                        result.Url.Equals(expectedOverview.Url, StringComparison.OrdinalIgnoreCase));

            result.WhatItTakes.Should().BeEquivalentTo(GetWhatItakesApiModel());
            result.WhatYouWillDo.Should().BeEquivalentTo(GetWhatYouWillDoApiModel());
            result.RelatedCareers.Should().BeEquivalentTo(GetRelatedCareerApiModel());
            result.HowToBecome.Should().BeEquivalentTo(GetHowToBecomeApiModel());
            result.CareerPathAndProgression.Should().BeEquivalentTo(GetCareerPathAndProgressionApiModel());
        }
Пример #2
0
        public async Task GetJobProfileReturnsOverviewOnlyWhenOtherSegmentsDataDoesNotExists()
        {
            // Arrange
            var onlyOverviewSegmentDataModel = GetOnlyOverviewSegmentDataModel();
            var expectedOverview             = GetOverviewApiModel();
            var repository = A.Fake <ICosmosRepository <SegmentDataModel> >();

            A.CallTo(() => repository.GetData(A <Expression <Func <SegmentDataModel, SegmentDataModel> > > .Ignored, A <Expression <Func <SegmentDataModel, bool> > > .Ignored)).Returns(onlyOverviewSegmentDataModel);
            var dataService = new ProfileDataService(repository, defaultLogger);

            // Act
            var result = await dataService.GetJobProfile(JobProfileName).ConfigureAwait(false);

            // Assert
            Assert.True(result.Title.Equals(expectedOverview.Title, StringComparison.OrdinalIgnoreCase) &&
                        result.Overview.Equals(expectedOverview.Overview, StringComparison.OrdinalIgnoreCase) &&
                        result.Soc.Equals(expectedOverview.Soc, StringComparison.OrdinalIgnoreCase) &&
                        result.Url.Equals(expectedOverview.Url, StringComparison.OrdinalIgnoreCase));

            Assert.True(result.HowToBecome is null &&
                        result.CareerPathAndProgression is null &&
                        result.RelatedCareers is null &&
                        result.WhatItTakes is null &&
                        result.WhatYouWillDo is null);
        }
Пример #3
0
        public async Task GetJobProfileReturnsNullWhenDataDoesNotExists()
        {
            // Arrange
            var repository = A.Fake <ICosmosRepository <SegmentDataModel> >();

            A.CallTo(() => repository.GetData(A <Expression <Func <SegmentDataModel, SegmentDataModel> > > .Ignored, A <Expression <Func <SegmentDataModel, bool> > > .Ignored)).Returns((IList <SegmentDataModel>)null);
            var dataService = new ProfileDataService(repository, defaultLogger);

            // Act
            var result = await dataService.GetJobProfile(JobProfileName).ConfigureAwait(false);

            // Assert
            Assert.Null(result);
        }
Пример #4
0
        public async Task GetJobProfileReturnsDataWhenNOSegmentsDataExists()
        {
            // Arrange
            var noSegmentsDataModel = GetWithMissingSegmentsDataModel();
            var repository          = A.Fake <ICosmosRepository <SegmentDataModel> >();

            A.CallTo(() => repository.GetData(A <Expression <Func <SegmentDataModel, SegmentDataModel> > > .Ignored, A <Expression <Func <SegmentDataModel, bool> > > .Ignored)).Returns(noSegmentsDataModel);
            var dataService = new ProfileDataService(repository, defaultLogger);

            // Act
            var result = await dataService.GetJobProfile(JobProfileName).ConfigureAwait(false);

            // Assert
            Assert.True(result.Title is null &&
                        result.Overview is null &&
                        result.Soc is null &&
                        result.Url is null);

            Assert.True(result.HowToBecome is null &&
                        result.CareerPathAndProgression is null &&
                        result.RelatedCareers is null &&
                        result.WhatItTakes is null &&
                        result.WhatYouWillDo is null);
        }