static public IShortenService GetShortenService(string selectedItemText) { IShortenService Output = null; switch (selectedItemText) { case "bit.ly": Output = new bitly(); break; case "is.gd": Output = new isgd(); break; case "Su.pr": Output = new Supr(); break; case "TinyURL": Output = new TinyURL(); break; case "tr.im": Output = new trim(); break; default: break; } return(Output); }
public static IShortenService GetShortenService(string selectedItemText) { IShortenService Output = null; switch (selectedItemText) { case "bit.ly": Output = new bitly(); break; case "is.gd": Output = new isgd(); break; case "Su.pr": Output = new Supr(); break; case "TinyURL": Output = new TinyURL(); break; case "tr.im": Output = new trim(); break; default: break; } return Output; }
public JsonResult Invite(string email, int[] smartReportid, string comment, string ranges, string reportName, bool sendMeACopy) { var shareReports = new List <SharedReportDto>(); var currentUrl = Request.RawUrl; foreach (var id in smartReportid) { var token = Guid.NewGuid().ToString(); shareReports.Add(new SharedReportDto() { Comments = "comment", CreatedBy = WebSecurity.CurrentUserId, CreatedDate = DateTime.Now, ExpiredDate = DateTime.Now.AddDays(365.0), IsActive = true, Token = token, SmartReportId = id, URL = currentUrl, TinyUrl = TinyURL.GetTinyUrl(Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~") + "Share/Redirect?token=" + token) }); } var urlToValidateUser = Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~"); return(Json(_userService.InviteUser(email, shareReports, urlToValidateUser, comment, ranges, reportName, sendMeACopy), JsonRequestBehavior.AllowGet)); }
public JsonResult GetSharedreport(string comments, int smartReportid, string url) { var currentUrl = Request.RawUrl; var token = Guid.NewGuid().ToString(); var sharedReportDto = new SharedReportDto() { Comments = comments, CreatedBy = WebSecurity.CurrentUserId, CreatedDate = DateTime.Now, ExpiredDate = DateTime.Now.AddDays(365.0), IsActive = true, Token = token, SmartReportId = smartReportid, URL = url, TinyUrl = TinyURL.GetTinyUrl(Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~") + "Share/Redirect?token=" + token) }; return(Json(_sharedReportService.AddSharedReport(sharedReportDto), JsonRequestBehavior.AllowGet)); }
public void LeetCodeTest() { var TinyURLInput = "http://www.leetcode.com/faq/?id=10"; Assert.Equal("http://www.leetcode.com/faq/?id=10", TinyURL.Decode(TinyURL.Encode(TinyURLInput))); }
public void encodeThedecodedTinyURL_ReturnsOriginalURL() { var TinyURLInput = "www.google/aaa/bbb"; Assert.Equal("www.google/aaa/bbb", TinyURL.Decode(TinyURL.Encode(TinyURLInput))); }
public void decodingTinyURL_ReturnsANonEmptyString() { var TinyURLInput = "www.TinyURL.com/xxx"; Assert.NotEqual(string.Empty, TinyURL.Decode(TinyURLInput)); }
public void encodingURL_ReturnsANonEmptyString() { var URL = "www.google.com/tests"; Assert.NotEqual(string.Empty, TinyURL.Encode(URL)); }