public void TestCreateCustomShortUrl() { var shorterner = new URLShorterner(); int apiKey = 314159; string longUrl = "http://www.linkedin.com/in/fanchen/"; string customShortUrlKey = "HellO"; string shortUrl = shorterner.CreateCustomShortUrl(apiKey, longUrl, customShortUrlKey); bool condition = shortUrl.Substring(25) == customShortUrlKey; Assert.IsTrue(condition); }
public void TestGetLongUrl() { var shorterner = new URLShorterner(); int apiKey = 314159; string longUrl = "http://www.linkedin.com/in/fanchen/"; string customShortUrlKey = "HellO"; string shortUrl = shorterner.CreateCustomShortUrl(apiKey, longUrl, customShortUrlKey); string expected = longUrl; string actual = shorterner.GetLongUrl(shortUrl); Assert.AreEqual(expected, actual); }