public void GetTopResults_Returns_Most_Common_Schemes() { // Arrange var resultStatistics = new TestResultStatistics { Action = 14, Idea = 16, People = 16, Process = 5 }; // Act var analyzer = new UserResultStatAnalyzer(resultStatistics); var topResultArr = analyzer.GetTopResults(); // Assert topResultArr .Length .Should() .Be(2); var topResults = new[] { $"{nameof(resultStatistics.Idea).ToLower()}", $"{nameof(resultStatistics.People).ToLower()}" }; topResultArr[0] .Should() .BeOneOf(topResults); topResults[1] .Should() .BeOneOf(topResults); }
public void GetTopResults_Returns_Most_Common_Single_Scheme() { // Arrange var resultStatistics = new TestResultStatistics { Action = 14, Idea = 16, People = 2, Process = 27 }; // Act var analyzer = new UserResultStatAnalyzer(resultStatistics); var topResultArr = analyzer.GetTopResults(); // Assert topResultArr .Length .Should() .Be(1); topResultArr[0] .Should() .Be(nameof(resultStatistics.Process).ToLower()); }
public UserResultSaved( TestResultStatistics resultStatistics, UserAnswersCollection answersCollection, Guid userIdentifier) { ResultStatistics = resultStatistics; AnswersCollection = answersCollection; UserIdentifier = userIdentifier; }
/// <summary> /// Initializes a new instance of the <see cref="UserResultStatAnalyzer"/> class. /// </summary> /// <param name="userResults"></param> public UserResultStatAnalyzer(TestResultStatistics userResults) { var dictionary = new Dictionary <string, int> { { nameof(userResults.Action).ToLower(), userResults.Action }, { nameof(userResults.Idea).ToLower(), userResults.Idea }, { nameof(userResults.People).ToLower(), userResults.People }, { nameof(userResults.Process).ToLower(), userResults.Process } }; ValuePairs = dictionary.OrderByDescending(pair => pair.Value).ToList(); }
public void ValuesDictionary_Keeps_Right_Order() { // Arrange var resultStatistics = new TestResultStatistics { Action = 8, Idea = 3, People = 5, Process = 17 }; // Act var analyzer = new UserResultStatAnalyzer(resultStatistics); // Assert var keyValuePairs = analyzer.ValuePairs; keyValuePairs[3] .Key .Should() .Be(nameof(resultStatistics.Idea).ToLower()); keyValuePairs[2] .Key .Should() .Be(nameof(resultStatistics.People).ToLower()); keyValuePairs[1] .Key .Should() .Be(nameof(resultStatistics.Action).ToLower()); keyValuePairs[0] .Key .Should() .Be(nameof(resultStatistics.Process).ToLower()); }