Repository navigation
Expand file tree
/
Copy pathArticlePrefixSortTests.cs
More file actions
35 lines (33 loc) · 1.91 KB
/
Copy pathArticlePrefixSortTests.cs
File metadata and controls
35 lines (33 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class ArticlePrefixSortTests
{
[Theory]
[InlineData(new[] { "Ant", "The Theater", "The apple", "Fox", "Bear" }, new[] { "Ant", "The apple", "Bear", "Fox", "The Theater" })]
[InlineData(new[] { "An Ant", "The Theater", "the apple", "a Fox", "Bear" }, new[] { "An Ant", "the apple", "Bear", "a Fox", "The Theater" })]
[InlineData(new[] { "Ant", "A Theater", "an apple", "Fox", "Bear" }, new[] { "Ant", "an apple", "Bear", "Fox", "A Theater" })]
[InlineData(new[] { " Ant ", " A Theater ", " an apple ", " Fox", "Bear " }, new[] { "A Theater", "an apple", "Ant", "Bear", "Fox" })]
[InlineData(new[] { "The General Theory of Relativity" }, new[] { "The General Theory of Relativity" })]
public void SortStringArrayIgnoringArticlePrefixes(string[] input, string[] expectedOutput) =>
Assert.Equal(expectedOutput, EnglishArticle.PrependArticleSuffix(EnglishArticle.AppendArticlePrefix(input)));
[Theory]
[InlineData("The Éclair", "Éclair The")]
[InlineData("An Æon", "Æon An")]
[InlineData("The _underscore", "_underscore The")]
[InlineData("The 7th Seal", "7th Seal The")]
[InlineData("The Ⅻ Monkeys", "The Ⅻ Monkeys")]
[InlineData("The \u200Cjoiner", "\u200Cjoiner The")]
[InlineData("The \u200Djoiner", "\u200Djoiner The")]
[InlineData("The Theater!", "Theater! The")]
[InlineData("A Theater", "A Theater")]
[InlineData("The\tTheater", "The\tTheater")]
[InlineData("Theory", "Theory")]
[InlineData("An!", "An!")]
public void AppendArticlePrefixPreservesRegexEquivalentEdges(string input, string expected) =>
Assert.Equal([expected], EnglishArticle.AppendArticlePrefix([input]));
[Fact]
public void An_Empty_String_Array_Throws_ArgumentOutOfRangeException()
{
string[] items = [];
void action() => EnglishArticle.AppendArticlePrefix(items);
Assert.Throws<ArgumentOutOfRangeException>(action);
}
}