public void Then_The_Fields_Are_Mapped(InnerApi.Responses.GetShortlistItem shortlistItem)
        {
            shortlistItem.ProviderDetails.FeedbackRatings = new List <GetFeedbackRatingItem>
            {
                new GetFeedbackRatingItem
                {
                    FeedbackName  = "Good",
                    FeedbackCount = 92,
                },
                new GetFeedbackRatingItem
                {
                    FeedbackName  = "Excellent",
                    FeedbackCount = 29,
                },
                new GetFeedbackRatingItem
                {
                    FeedbackName  = "Poor",
                    FeedbackCount = 7,
                },
                new GetFeedbackRatingItem
                {
                    FeedbackName  = "Very Poor",
                    FeedbackCount = 1,
                }
            };

            var actual = new GetProviderCourseItem().Map(shortlistItem);

            actual.Should().BeEquivalentTo(shortlistItem.Course, options => options.ExcludingMissingMembers());
            actual.Website.Should().Be(shortlistItem.ProviderDetails.StandardInfoUrl);
            actual.ProviderId.Should().Be(shortlistItem.ProviderDetails.Ukprn);
            actual.ProviderAddress.Should().BeEquivalentTo(shortlistItem.ProviderDetails.ProviderAddress);
            actual.Feedback.TotalEmployerResponses.Should().Be(129);
            actual.Feedback.TotalFeedbackRating.Should().Be(3);
        }
        public void Then_Maps_Fields_Appropriately_Matching_AchievementRates_With_Sector_And_Level(
            InnerApi.Responses.GetShortlistItem shortlistItem,
            GetAchievementRateItem item,
            GetAchievementRateItem item2,
            GetAchievementRateItem item3)
        {
            shortlistItem.Course.Level = 2;
            item.SectorSubjectArea     = shortlistItem.Course.SectorSubjectAreaTier2Description;
            item.Level = "Two";
            shortlistItem.ProviderDetails.AchievementRates = new List <GetAchievementRateItem>
            {
                item,
                item2
            };
            item3.SectorSubjectArea = shortlistItem.Course.SectorSubjectAreaTier2Description;
            item3.Level             = "Two";

            var response = new GetProviderCourseItem().Map(shortlistItem);

            response.Name.Should().Be(shortlistItem.ProviderDetails.Name);
            response.TradingName.Should().Be(shortlistItem.ProviderDetails.TradingName);
            response.ProviderId.Should().Be(shortlistItem.ProviderDetails.Ukprn);
            response.OverallCohort.Should().Be(item.OverallCohort);
            response.OverallAchievementRate.Should().Be(item.OverallAchievementRate);
        }
        public void Then_Maps_Fields_Appropriately_Returning_Null_For_AchievementRate_Data_If_No_Matching_No_AchievementRates(
            InnerApi.Responses.GetShortlistItem shortlistItem,
            GetAchievementRateItem item,
            GetAchievementRateItem item2)
        {
            shortlistItem.ProviderDetails.AchievementRates = new List <GetAchievementRateItem>
            {
                item,
                item2
            };

            var response = new GetProviderCourseItem().Map(shortlistItem);

            response.Name.Should().Be(shortlistItem.ProviderDetails.Name);
            response.TradingName.Should().Be(shortlistItem.ProviderDetails.TradingName);
            response.ProviderId.Should().Be(shortlistItem.ProviderDetails.Ukprn);
            response.OverallCohort.Should().BeNull();
            response.OverallAchievementRate.Should().BeNull();
        }
Exemple #4
0
        public GetProviderCourseItem Map(InnerApi.Responses.GetShortlistItem shortlistItem)
        {
            var achievementRate     = GetAchievementRateItem(shortlistItem.ProviderDetails.AchievementRates, shortlistItem.Course.SectorSubjectAreaTier2Description, shortlistItem.Course.Level);
            var deliveryModes       = FilterDeliveryModes(shortlistItem.ProviderDetails.DeliveryTypes);
            var getFeedbackResponse = ProviderFeedbackResponse(shortlistItem.ProviderDetails.FeedbackRatings, shortlistItem.ProviderDetails.FeedbackAttributes);

            return(new GetProviderCourseItem
            {
                ProviderAddress = new GetProviderAddress().Map(shortlistItem.ProviderDetails.ProviderAddress, !string.IsNullOrEmpty(shortlistItem.LocationDescription)),
                Website = shortlistItem.ProviderDetails.StandardInfoUrl,
                Phone = shortlistItem.ProviderDetails.Phone,
                Email = shortlistItem.ProviderDetails.Email,
                Name = shortlistItem.ProviderDetails.Name,
                TradingName = shortlistItem.ProviderDetails.TradingName,
                ProviderId = shortlistItem.ProviderDetails.Ukprn,
                OverallCohort = achievementRate?.OverallCohort,
                OverallAchievementRate = achievementRate?.OverallAchievementRate,
                DeliveryModes = deliveryModes,
                Feedback = getFeedbackResponse,
            });
        }