Skip to content

Instantly share code, notes, and snippets.

@Programazing Programazing/BigramTests.cs Secret
Created Dec 4, 2019

Embed
What would you like to do?
[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
You can’t perform that action at this time.