public void GetCurrentBlog_CustomTemplates(string startPath, string expectedPath) { var blogTemplateId = ID.NewID; var customBlogtemplateId = ID.NewID; var entryTemplateId = ID.NewID; var customEntryTemplateId = ID.NewID; var settings = Mock.Of<IWeBlogSettings>(x => x.BlogTemplateIds == new[] { ID.NewID, ID.NewID, blogTemplateId, ID.NewID } && x.EntryTemplateIds == new[] { ID.NewID, entryTemplateId, ID.NewID } ); using (var db = new Db { new DbTemplate(blogTemplateId), new DbTemplate(entryTemplateId), new DbTemplate(customBlogtemplateId) { BaseIDs = new [] { blogTemplateId } }, new DbTemplate(customEntryTemplateId) { BaseIDs = new [] { entryTemplateId } }, new DbItem("blog", ID.NewID, customBlogtemplateId) { new DbItem("entries") { new DbItem("entry", ID.NewID, customEntryTemplateId) } } }) { var startItem = db.GetItem(startPath); var manager = new BlogManager(settings); var resultItem = manager.GetCurrentBlog(startItem); Assert.That(resultItem.ID, Is.EqualTo(resultItem.ID)); }; }
public void GetCurrentBlog_NullItem() { var settings = Mock.Of<IWeBlogSettings>(x => x.BlogTemplateIds == new[] { ID.NewID } ); var manager = new BlogManager(settings); var resultItem = manager.GetCurrentBlog(null); Assert.That(resultItem, Is.Null); }
public void GetCurrentBlog(string startPath, string expectedPath) { var blogTemplateId = ID.NewID; var entryTemplateId = ID.NewID; var settings = Mock.Of<IWeBlogSettings>(x => x.BlogTemplateIds == new[] { blogTemplateId } && x.EntryTemplateIds == new[] { entryTemplateId } ); using (var db = new Db { new DbItem("blog", ID.NewID, blogTemplateId) { new DbItem("entries") { new DbItem("entry", ID.NewID, entryTemplateId) } } }) { var startItem = db.GetItem(startPath); var manager = new BlogManager(settings); var resultItem = manager.GetCurrentBlog(startItem); if(expectedPath == null) { Assert.That(resultItem, Is.Null); } else { Assert.That(resultItem.ID, Is.EqualTo(resultItem.ID)); } }; }