Created
November 12, 2012 07:03
-
-
Save lanceharper/4057901 to your computer and use it in GitHub Desktop.
MapReduce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MapReducing.Tests | |
{ | |
public class MapReducingTests | |
{ | |
private BlogPost[] blogPosts = new[] | |
{ | |
new BlogPost { AuthorName = "jnelson" }, | |
new BlogPost { AuthorName = "jnelson" }, | |
new BlogPost { AuthorName = "jnelson" }, | |
new BlogPost { AuthorName = "jnelson" }, | |
new BlogPost { AuthorName = "chicks" }, | |
new BlogPost { AuthorName = "chicks" }, | |
new BlogPost { AuthorName = "chicks" }, | |
new BlogPost { AuthorName = "cgossler" }, | |
new BlogPost { AuthorName = "lharper" }, | |
new BlogPost { AuthorName = "lharper" } | |
}; | |
[Fact] | |
public void BlogPostCountByAuthorTask_Returns_Correct_Count() | |
{ | |
var mapReduceTask = new BlogPostCountByAuthorTask(); | |
var results = mapReduceTask.Execute(blogPosts); | |
Console.WriteLine(results.Count()); | |
Assert.Equal(4, results.Single(result => result.AuthorName == "jnelson").PostCount); | |
Assert.Equal(3, results.Single(result => result.AuthorName == "chicks").PostCount); | |
Assert.Equal(1, results.Single(result => result.AuthorName == "cgossler").PostCount); | |
Assert.Equal(2, results.Single(result => result.AuthorName == "lharper").PostCount); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment