public void NoFeedbackResults_FeedbackNotSet_OnProvider() { // Arrange var feedbackResult = new ProviderFeedbackResult(new List <EmployerFeedbackSourceDto>()); var provider = new CoreProvider(); // Act _sut.SetProviderFeedback(feedbackResult, provider); // Assert Assert.IsNull(provider.ProviderFeedback); }
public void FeedbackResults_FeedbackSet_ShouldCalcRatings(string providerRating, int amount) { // Arrange SetRatings(providerRating, amount); var feedbackResult = new ProviderFeedbackResult(_feedbackEntries); var provider = new CoreProvider { Ukprn = Ukprn }; // Act _sut.SetProviderFeedback(feedbackResult, provider); int ratingCountToCheck = GetRatingCount(providerRating, provider); // Assert Assert.AreEqual(amount, ratingCountToCheck); }
public void FeedbackResults_FeedbackSet_WithWeaknesses_OnProvider() { // Arrange SetProviderAttributesWeaknesses(3); var feedbackResult = new ProviderFeedbackResult(_feedbackEntries); var provider = new CoreProvider { Ukprn = Ukprn }; // Act _sut.SetProviderFeedback(feedbackResult, provider); // Assert Assert.IsNotNull(provider.ProviderFeedback); Assert.IsNotEmpty(provider.ProviderFeedback.Weaknesses); Assert.AreEqual(3, provider.ProviderFeedback.Weaknesses.Count); }
public void SetProviderFeedback(ProviderFeedbackResult providerFeedbackResult, Core.Models.Provider.Provider provider) { try { var feedbackToSet = new Feedback(); var resultsForProvider = providerFeedbackResult.EmployerFeedback.Where(feedback => feedback.Ukprn == provider.Ukprn); if (resultsForProvider.Any()) { SetProviderRatings(feedbackToSet, resultsForProvider); SetProviderStrengthsAndWeaknesses(feedbackToSet, resultsForProvider); provider.ProviderFeedback = feedbackToSet; } } catch (Exception ex) { _logger.Error(ex, $"Unable to set provider feedback for UKPRN: {provider.Ukprn}"); } }
public void FeedbackResults_FeedbackSet_Attributes_ShouldContain_DistinctList() { // Arrange SetProviderAttributesStrengths(9); var feedbackDiffAttributes = new EmployerFeedbackSourceDto { ProviderAttributes = new List <ProviderAttributeSourceDto> { new ProviderAttributeSourceDto { Name = "NewPa", Value = 1 } }, Ukprn = Ukprn }; _feedbackEntries.Add(feedbackDiffAttributes); var feedbackResult = new ProviderFeedbackResult(_feedbackEntries); var provider = new CoreProvider { Ukprn = Ukprn }; // Act _sut.SetProviderFeedback(feedbackResult, provider); // Assert Assert.AreEqual(10, provider.ProviderFeedback.Strengths.Count); }