Permalink
Browse files

Added more users and verified the scores were correct.

  • Loading branch information...
1 parent a83a281 commit eb539470ac965980e4e03c2b3fc49f2b17d16b49 @robertgreiner committed Nov 11, 2011
@@ -22,6 +22,20 @@ public void TwoReviewersWithSomeSimilarReviewsShouldHaveAScoreBetweenZeroAndOne(
}
[Test]
+ public void TwoReviewersWithSomeSimilarReviewsShouldHaveAPositiveScore()
+ {
+ euclideanDistance = new EuclideanDistance(ReviewerBuilder.BuildReviewer6(), ReviewerBuilder.BuildReviewer7());
+ Assert.AreEqual(0.148, euclideanDistance.Score());
+ }
+
+ [Test]
+ public void TwoReviewersWithSomeSimilarReviewsShouldHaveAPositiveScoreRegardlessOfOrder()
+ {
+ euclideanDistance = new EuclideanDistance(ReviewerBuilder.BuildReviewer7(), ReviewerBuilder.BuildReviewer6());
+ Assert.AreEqual(0.148, euclideanDistance.Score());
+ }
+
+ [Test]
public void ReviewersThatHaveReviewedUniqueTitlesShouldNotBeSimilar()
{
var r1 = ReviewerBuilder.BuildReviewer1();
@@ -33,12 +33,26 @@ public void ReviewersThatHaveTheSameTasteShouldHaveAPerfectScore()
}
[Test]
- public void TwoReviewersWithSomeSimilarReviewsShouldHaveAScoreBetweenZeroAndOne()
+ public void TwoReviewersWithSomeSimilarReviewsShouldHaveANegativeScore()
{
Assert.AreEqual(-0.777, pearsonCorrelationScore.Score());
}
[Test]
+ public void TwoReviewersWithSomeSimilarReviewsShouldHaveAPostiveScore()
+ {
+ pearsonCorrelationScore = new PearsonCorrelation(ReviewerBuilder.BuildReviewer6(), ReviewerBuilder.BuildReviewer7());
+ Assert.AreEqual(0.396, pearsonCorrelationScore.Score());
+ }
+
+ [Test]
+ public void TwoReviewersWithSomeSimilarReviewsShouldHaveTheSameScoreRegardlessOfOrder()
+ {
+ pearsonCorrelationScore = new PearsonCorrelation(ReviewerBuilder.BuildReviewer7(), ReviewerBuilder.BuildReviewer6());
+ Assert.AreEqual(0.396, pearsonCorrelationScore.Score());
+ }
+
+ [Test]
public void TestValuesOfReviewers()
{
var currentUser = ReviewerBuilder.BuildReviewer1();
@@ -124,6 +124,30 @@ public static Reviewer BuildReviewer5()
return reviewer;
}
+ public static Reviewer BuildReviewer6()
+ {
+ var reviewer = new Reviewer { Name = "Luke" };
+ reviewer.AddReview("Code Complete", 2.5);
+ reviewer.AddReview("C# in Depth", 3.5);
+ reviewer.AddReview("Clean Code", 3.0);
+ reviewer.AddReview("Unit Testing", 3.5);
+ reviewer.AddReview("Joel on Software", 2.5);
+ reviewer.AddReview("C# for Dummies", 3.0);
+ return reviewer;
+ }
+
+ public static Reviewer BuildReviewer7()
+ {
+ var reviewer = new Reviewer { Name = "Paul" };
+ reviewer.AddReview("Code Complete", 3.0);
+ reviewer.AddReview("C# in Depth", 3.5);
+ reviewer.AddReview("Clean Code", 1.5);
+ reviewer.AddReview("Unit Testing", 5.0);
+ reviewer.AddReview("Joel on Software", 3.5);
+ reviewer.AddReview("C# for Dummies", 3.0);
+ return reviewer;
+ }
+
public static Reviewer BuildReviewerWithNoReviews()
{
var reviewer = new Reviewer {Name = "Sam"};
@@ -67,7 +67,9 @@ private static void ReviewersMostSimilarToMe()
{ReviewerBuilder.BuildReviewer2()},
{ReviewerBuilder.BuildReviewer3()},
{ReviewerBuilder.BuildReviewer4()},
- {ReviewerBuilder.BuildReviewer5()}
+ {ReviewerBuilder.BuildReviewer5()},
+ {ReviewerBuilder.BuildReviewer6()},
+ {ReviewerBuilder.BuildReviewer7()}
};
var sortedReviewers = new RankReviewers(currentUser, reviewers).Rank();

0 comments on commit eb53947

Please sign in to comment.