public void TestTinyUrl() { var mapping = new TinyUrlMapping { TinyId = Guid.NewGuid(), Definition = "PasswordReminderEmail", LongUrl = new ReadOnlyApplicationUrl("~/terms"), }; _tinyUrlCommand.CreateMappings(new[] { mapping }); var url = new ReadOnlyApplicationUrl("~/url/" + mapping.TinyId.ToString("n")); AssertTinyUrl(url, mapping); }
protected override string GetCopyText(TemplateContext context, TemplateProperties properties) { // Create the object to keep track of all mappings used when generating the text. var mappings = new TinyUrlMappings(_webSiteQuery, context.Id, context.Definition, MimeType, _webSite, context.UserId, VerticalId); properties.Add("TinyUrls", mappings); // Get the text. var text = base.GetCopyText(context, properties); // Register those mappings. _tinyUrlCommand.CreateMappings(mappings); return(text); }