Fixed: Sort authors by lastname, firstname

This commit is contained in:
ta264
2021-05-13 21:31:46 +01:00
parent 62221c2a7f
commit 96db74494a
26 changed files with 279 additions and 27 deletions
@@ -0,0 +1,42 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using NUnit.Framework;
using NzbDrone.Common.Extensions;
namespace NzbDrone.Common.Test.ExtensionTests.StringExtensionTests
{
[TestFixture]
public class ToSortNameFixture
{
[TestCase("a[b]c(d)e{f}g<h>i", "aceg<h>i")]
[TestCase("a[[b]c(d)e{f}]g(h(i)j[k]l{m})n{{{o}}}p", "agnp")]
[TestCase("a[b(c]d)e", "ae")]
[TestCase("a{b(c}d)e", "ae")]
[TestCase("a]b}c)d", "abcd")]
[TestCase("a[b]c]d(e)f{g)h}i}j)k]l", "acdfijkl")]
[TestCase("a]b[c", "ab")]
[TestCase("a(b[c]d{e}f", "a")]
[TestCase("a{b}c{d[e]f(g)h", "ac")]
public void should_remove_brackets(string input, string expected)
{
input.RemoveBracketedText().Should().Be(expected);
}
[TestCase("Aristotle", "Aristotle")]
[TestCase("Mr. Dr Prof.", "Mr. Dr Prof.")]
[TestCase("Senior Inc", "Senior Inc")]
[TestCase("Don \"Team\" Smith", "Smith, Don \"Team\"")]
[TestCase("Don Team Smith", "Don Team Smith")]
[TestCase("National Lampoon", "National Lampoon")]
[TestCase("Jane Doe", "Doe, Jane")]
[TestCase("Mrs. Jane Q. Doe III", "Doe, Jane Q. III")]
[TestCase("Leonardo Da Vinci", "Da Vinci, Leonardo")]
[TestCase("Van Gogh", "Van Gogh")]
[TestCase("Van", "Van")]
[TestCase("John [x]von Neumann (III)", "von Neumann, John")]
public void should_get_sort_name(string input, string expected)
{
input.ToSortName().Should().Be(expected);
}
}
}