public void PostTest_new() { UrlController ctrl = CreateController(Enumerable.Empty <Url>()); var result = ctrl.Post(new UrlPostModel { OriginUrl = "https://bitly.com/" }); var urls = GetUrlsFromActionResult(result); Assert.IsTrue(urls.Count() == 1); }
public void PostTest_alreadyExist() { string shortUrl = Settings.GetShortUrl("randomString"); UrlController ctrl = CreateController(new [] { new Url { OriginUrl = "https://bitly.com", ShortUrl = shortUrl } }); var result = ctrl.Post(new UrlPostModel { OriginUrl = "https://bitly.com/" }); var urls = GetUrlsFromActionResult(result); Assert.AreEqual(urls.First().ShortUrl, shortUrl); }