public string GetPostUrl(Post p) { if (!string.IsNullOrEmpty(p.LegacyUrl)) return p.LegacyUrl.ToLower(); return AbsoluteUrlWithDomain("~/post/" + p.Slug); }
public void setup() { _repository = new Mock<IRepository>(); _urlContext = new Mock<IUrlContext>(); _post = Post.CreatePost("test", "test", "test", null); _urlContext .Setup(x => x.GetPostUrl(_post)) .Returns("http://bjarte.com/test"); _repository .Setup(x => x.List<BlogSettings>()) .Returns((new List<BlogSettings> { new BlogSettings() }).AsQueryable); _repository .Setup(x => x.List<Post>()) .Returns((new List<Post> { _post }).AsQueryable); }
public virtual void setup() { var mongoRepository = new MongoRepository("blogspecs"); mongoRepository.DeleteCollection<BlogSettings>(); mongoRepository.DeleteCollection<Post>(); _repository = mongoRepository; _blog = new BlogSettings { VirtualMediaPath = "" }; _repository.Save(_blog); _fakePost = Post.CreatePost("Hello world", "", "BjartN", null); _repository.Save(_fakePost); _api = new Infrastructure.MetaWeblogApi.MetaWeblog(_repository, new FakeUrlContext(),new FakeAuthenticationService()); }
public string GetPostUrl(Post p) { return ""; }
public static void Save(Post post, IRepository repository) { repository.Save(post); }
public static string TwitterUrl(this HtmlHelper helper, Post p) { var message = "\"" + p.Title + "\" " + helper.PostUrl(p); return string.Format("http://twitter.com/home?status={0}", urlEncode(message)); }
public static string PostUrl(this HtmlHelper helper, Post p) { return UrlContext.Instance.GetPostUrl(p); }
public static string FacebookUrl(this HtmlHelper helper, Post p) { return string.Format("http://www.facebook.com/sharer.php?u={0}&t={1}", urlEncode(PostUrl(helper, p)), urlEncode(p.Title)); }