Permalink
Browse files

testing multiple similar reviews between two users

  • Loading branch information...
1 parent 5b2224c commit da2eff498b4f33919dbb35ba9934cc531a953fee @robertgreiner committed Nov 2, 2011
Showing with 25 additions and 0 deletions.
  1. +13 −0 Recommender.Tests/Steps/SumDifferenceSquaresTests.cs
  2. +12 −0 Recommender/Data/ReviewerBuilder.cs
View
13 Recommender.Tests/Steps/SumDifferenceSquaresTests.cs
@@ -38,5 +38,18 @@ public void ShouldCalculateTheSumOfTheSquareOfTheDifferenceOfASingleSimilarRevie
Assert.AreEqual(4.0, sumDifferenceSquares);
}
+ [Test]
+ public void ShouldCalculateTheSumOfTheSquareOfTheDifferenceOfMultipleSimilarReviews()
+ {
+ var highScoreReviewer = ReviewerBuilder.BuildAllMaxScores();
+ var lowScoreReviewer = ReviewerBuilder.BuildAllMidScores();
+ var similarReviews = new List<string>();
+ similarReviews.Add("C# in Depth");
+ similarReviews.Add("Refactoring");
+ similarReviews.Add("Clean Code");
+ var sumDifferenceSquares = new SumDifferenceSquares(similarReviews, highScoreReviewer.Reviews, lowScoreReviewer.Reviews).Calculate();
+ Assert.AreEqual(12.0, sumDifferenceSquares);
+ }
+
}
}
View
12 Recommender/Data/ReviewerBuilder.cs
@@ -16,6 +16,18 @@ public static Reviewer BuildAllMaxScores()
return reviewer;
}
+ public static Reviewer BuildAllMidScores()
+ {
+ var reviewer = new Reviewer { Name = "Mini" };
+ reviewer.AddReview("Code Complete", 3.0);
+ reviewer.AddReview("C# in Depth", 3.0);
+ reviewer.AddReview("Clean Code", 3.0);
+ reviewer.AddReview("Unit Testing", 3.0);
+ reviewer.AddReview("Joel on Software", 3.0);
+ reviewer.AddReview("Refactoring", 3.0);
+ return reviewer;
+ }
+
public static Reviewer BuildAllMinScores()
{
var reviewer = new Reviewer {Name = "Mini"};

0 comments on commit da2eff4

Please sign in to comment.