Skip to content

Instantly share code, notes, and snippets.

@Programazing
Created December 4, 2019 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Programazing/181a28607fb924f9368a6d68a12a88ea to your computer and use it in GitHub Desktop.
Save Programazing/181a28607fb924f9368a6d68a12a88ea to your computer and use it in GitHub Desktop.
[TestFixture]
public class BigramTests
{
[Theory]
[TestCaseSource(nameof(Create_ReturnsCorrect_NumberOfBrigams_TestData))]
public void Create_ReturnsCorrect_NumberOfBrigams(string input, Dictionary<string, int> actual)
{
var sut = Bigram.GetHistogramData(input);
sut.Count().Should().Be(actual.Count);
}
static IEnumerable<object[]> Create_ReturnsCorrect_NumberOfBrigams_TestData()
{
var testString = "The quick brown fox and the quick blue hare";
var bigram = new Dictionary<string, int>()
{
{ "the quick", 2 },
{ "quick brown", 1 },
{ "brown fox", 1 },
{ "fox and", 1 },
{ "and the", 1 },
{ "quick blue", 1 },
{ "blue hare", 1 }
};
return new[] { new object[] { testString, bigram }, };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment