using Incremental.Kick.Helpers; using MbUnit.Core.Exceptions; using MbUnit.Framework; namespace Incremental.Kick.Tests.HelperTests { [TestFixture] public class TextHelperTests { [Row("", "")] [Row("no link", "no link")] [Row("htp://www.ireland.com/", "htp://www.ireland.com/")] //only valid links should be replaced //testing period at the end of a link [Row("http://iol.ie.", @"http://iol.ie.")] [Row("http://iol.ie/.", @"http://iol.ie/.")] //testing bracket and period at the end of a link [Row("(http://code.google.com/p/dotnetkicks/issues/detail?id=112).", @"(http://code.google.com/p/dotnetkicks/issues/detail?id=112).")] //Testing two links on a line [Row("This is a link http://www.iol.ie/ and this is another one: http://www.iol.ie/.", @"This is a link http://www.iol.ie/ and this is another one: http://www.iol.ie/.")] [Row("http://iol.ie/foo.bar(vs.80).aspx", @"http://iol.ie/foo.bar(vs.80).aspx")] //Valid Links: [Row("http://www.ireland.com/", @"http://www.ireland.com/")] [Row("http://ireland.com/", @"http://ireland.com/")] [Row("http://ireland.ie/", @"http://ireland.ie/")] [Row("http://ireland.ie", @"http://ireland.ie")] [Row("http://iol.ie", @"http://iol.ie")] [Row("The first link is http://www.dotnetkicks.com/ and the second one is http://www.kick.ie/", @"The first link is http://www.dotnetkicks.com/ and the second one is http://www.kick.ie/")] [Row(@" Line 1 http://news.bbc.co.uk/ Line 2 http://ireland.com", @" Line 1 http://news.bbc.co.uk/ Line 2 http://ireland.com")] [RowTest] [Row("http://www.aaa.com/page.php?forum_id=15&thread_id=12537&pid=40798#post_40798", @"http://www.aaa.com/page.php?forum_id=15&thread_id=12537&pid=40798#post_40798")] public void UrlifyTest(string input, string expected) { Assert.AreEqual(expected, TextHelper.Urlify(input)); } [Row("", "")] [Row(@":,(", "")] [Row(@":)", "")] [Row(@":D", "")] [Row(@";(", "")] [Row(@";)", "")] [Row(@":(", "")] [Row(@"=)", "")] [Row(@"=):)", "")] [RowTest] public void ReplaceEmoticonsTest(string input, string expected) { Assert.AreEqual(expected, TextHelper.ReplaceEmoticons(input, "")); } [Row(@":d", "")] [RowTest] public void ReplaceEmoticonsTestInvalid(string input, string expected) { Assert.AreNotEqual(expected, TextHelper.ReplaceEmoticons(input, "")); } } }