mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-26 04:33:01 +01:00
SortHelper.SkipArticles will no longer bomb when a null is passed.
Added tests for SkipArticles.
This commit is contained in:
parent
33930534c2
commit
430fb9aead
41
NzbDrone.Core.Test/SortHelperTest.cs
Normal file
41
NzbDrone.Core.Test/SortHelperTest.cs
Normal file
@ -0,0 +1,41 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class SortHelperTest : TestBase
|
||||
{
|
||||
//American Gladiators
|
||||
//Ancient Apocalypse
|
||||
//There Will Be Brawl
|
||||
|
||||
[TestCase("The Office (US)", "Office (US)")]
|
||||
[TestCase("A Man in Anger", "Man in Anger")]
|
||||
[TestCase("An Idiot Abroad", "Idiot Abroad")]
|
||||
[TestCase("American Gladiators", "American Gladiators")]
|
||||
[TestCase("Ancient Apocalyps", "Ancient Apocalyps")]
|
||||
[TestCase("There Will Be Brawl", "There Will Be Brawl")]
|
||||
[TestCase("30 Rock", "30 Rock")]
|
||||
[TestCase(null, "")]
|
||||
public void SkipArticles(string title, string expected)
|
||||
{
|
||||
var result = SortHelper.SkipArticles(title);
|
||||
result.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,9 @@ namespace NzbDrone.Core.Helpers
|
||||
{
|
||||
public static string SkipArticles(string input)
|
||||
{
|
||||
if (String.IsNullOrEmpty(input))
|
||||
return String.Empty;
|
||||
|
||||
var articles = new List<string> { "The ", "An ", "A " };
|
||||
|
||||
foreach (string article in articles)
|
||||
|
Loading…
Reference in New Issue
Block a user