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_Matching_AchievementRates_With_Sector_And_Level(string sectorSubjectArea,
                                                                                                   GetTrainingCourseProviderResult source, GetAchievementRateItem item, GetAchievementRateItem item2, GetAchievementRateItem item3)
        {
            item.SectorSubjectArea = sectorSubjectArea;
            item.Level             = "Two";
            source.ProviderStandard.AchievementRates = new List <GetAchievementRateItem>
            {
                item,
                item2
            };
            item3.SectorSubjectArea        = sectorSubjectArea;
            item3.Level                    = "Two";
            source.OverallAchievementRates = new List <GetAchievementRateItem>
            {
                item2,
                item3
            };

            var response = new GetProviderCourseItem().Map(source, sectorSubjectArea, 2, true);

            response.Name.Should().Be(source.ProviderStandard.Name);
            response.TradingName.Should().Be(source.ProviderStandard.TradingName);
            response.ProviderId.Should().Be(source.ProviderStandard.Ukprn);
            response.OverallCohort.Should().Be(item.OverallCohort);
            response.NationalOverallCohort.Should().Be(item3.OverallCohort);
            response.OverallAchievementRate.Should().Be(item.OverallAchievementRate);
            response.NationalOverallAchievementRate.Should().Be(item3.OverallAchievementRate);
        }
        public void Then_Maps_Fields_Appropriately(
            InnerApi.Responses.GetShortlistItem source)
        {
            var expectedProvider = new GetProviderCourseItem().Map(source);

            var response = (GetShortlistItem)source;

            response.Id.Should().Be(source.Id);
            response.ShortlistUserId.Should().Be(source.ShortlistUserId);
            response.Provider.Should().BeEquivalentTo(expectedProvider);
            response.Course.Should().BeEquivalentTo((GetTrainingCourseListItem)source.Course);
            response.LocationDescription.Should().Be(source.LocationDescription);
            response.CreatedDate.Should().Be(source.CreatedDate);
        }
        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();
        }
        public void Then_Maps_Fields_Appropriately_Returning_Null_For_AchievementRate_Data_If_No_Matching_No_AchievementRates(string sectorSubjectArea,
                                                                                                                              GetTrainingCourseProviderResult source, GetAchievementRateItem item, GetAchievementRateItem item2)
        {
            source.ProviderStandard.AchievementRates = new List <GetAchievementRateItem>
            {
                item,
                item2
            };
            source.OverallAchievementRates = new List <GetAchievementRateItem>
            {
                item,
                item2
            };

            var response = new GetProviderCourseItem().Map(source, sectorSubjectArea, 1, true);

            response.Name.Should().Be(source.ProviderStandard.Name);
            response.TradingName.Should().Be(source.ProviderStandard.TradingName);
            response.ProviderId.Should().Be(source.ProviderStandard.Ukprn);
            response.OverallCohort.Should().BeNull();
            response.NationalOverallCohort.Should().BeNull();
            response.OverallAchievementRate.Should().BeNull();
            response.NationalOverallAchievementRate.Should().BeNull();
        }
        public void Then_The_Fields_Are_Mapped(GetTrainingCourseProviderResult providerStandardItem)
        {
            providerStandardItem.ProviderStandard.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(providerStandardItem, "", 1, true);

            actual.Should().BeEquivalentTo(providerStandardItem.Course, options => options.ExcludingMissingMembers());

            actual.Website.Should().Be(providerStandardItem.ProviderStandard.StandardInfoUrl);
            actual.ProviderId.Should().Be(providerStandardItem.ProviderStandard.Ukprn);
            actual.ProviderAddress.Should().BeEquivalentTo(providerStandardItem.ProviderStandard.ProviderAddress);
            actual.Feedback.TotalEmployerResponses.Should().Be(129);
            actual.Feedback.TotalFeedbackRating.Should().Be(3);
            actual.MarketingInfo.Should().Be(providerStandardItem.ProviderStandard.MarketingInfo);
        }