public void CollectFormattedCredits_SingleCredit_Works() { _creditsToFormat.Add("my credit", new List <string> { "Front Cover", "2" }); var results = ImageApi.CollectFormattedCredits(_creditsToFormat); Assert.That(results.Count(), Is.EqualTo(1)); Assert.That(results.First(), Is.EqualTo("Images by my credit."), "Single credit should have non-page format."); }
public void CollectFormattedCredits_MultipleCredits_Works() { _creditsToFormat.Add("my credit", new List <string> { "Front Cover", "2" }); _creditsToFormat.Add("next credit", new List <string> { "2", "4", "Outside Back Cover" }); var results = ImageApi.CollectFormattedCredits(_creditsToFormat); Assert.That(results.Count(), Is.EqualTo(2)); Assert.That(results.First(), Is.EqualTo("Images on pages Front Cover, 2 by my credit.")); Assert.That(results.Last(), Is.EqualTo("Images on pages 2, 4, Outside Back Cover by next credit.")); }
public void CollectFormattedCredits_MultipleCredits_WorksWithEnDash3() { _creditsToFormat.Add("some credit", new List <string> { "1" }); _creditsToFormat.Add("abc credit", new List <string> { "5", "7", "8", "9", "10" }); var results = ImageApi.CollectFormattedCredits(_creditsToFormat); Assert.That(results.Count(), Is.EqualTo(2)); // This is an en-dash, not a hyphen! Assert.That(results.First(), Is.EqualTo("Image on page 1 by some credit.")); Assert.That(results.Last(), Is.EqualTo("Images on pages 5, 7–10 by abc credit.")); }
public void CollectFormattedCredits_MultipleCredits_WorksWithEnDash() { _creditsToFormat.Add("my credit", new List <string> { "2" }); _creditsToFormat.Add("next credit", new List <string> { "2", "3", "4", "Outside Back Cover" }); var results = ImageApi.CollectFormattedCredits(_creditsToFormat); Assert.That(results.Count(), Is.EqualTo(2)); Assert.That(results.First(), Is.EqualTo("Image on page 2 by my credit.")); // This is an en-dash, not a hyphen! Assert.That(results.Last(), Is.EqualTo("Images on pages 2–4, Outside Back Cover by next credit.")); }