本文整理汇总了C#中Subtext.Framework.Data.DatabaseObjectProvider.Get方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseObjectProvider.Get方法的具体用法?C# DatabaseObjectProvider.Get怎么用?C# DatabaseObjectProvider.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subtext.Framework.Data.DatabaseObjectProvider
的用法示例。
在下文中一共展示了DatabaseObjectProvider.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTrackbackSetsFeedbackTypeCorrectly
public void CreateTrackbackSetsFeedbackTypeCorrectly()
{
string hostname = UnitTestHelper.GenerateUniqueString();
var repository = new DatabaseObjectProvider();
repository.CreateBlog("", "username", "password", hostname, string.Empty);
UnitTestHelper.SetHttpContextWithBlogRequest(hostname, string.Empty, string.Empty);
Blog blog = repository.GetBlog(hostname, string.Empty);
BlogRequest.Current.Blog = blog;
Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("phil", "title", "body");
int parentId = UnitTestHelper.Create(entry);
var trackback = new Trackback(parentId, "title", new Uri("http://url"), "phil", "body");
var subtextContext = new Mock<ISubtextContext>();
subtextContext.Setup(c => c.Blog).Returns(Config.CurrentBlog);
//TODO: FIX!!!
subtextContext.Setup(c => c.Repository).Returns(repository);
subtextContext.Setup(c => c.Cache).Returns(new TestCache());
subtextContext.Setup(c => c.HttpContext.Items).Returns(new Hashtable());
var commentService = new CommentService(subtextContext.Object, null);
int id = commentService.Create(trackback, true/*runFilters*/);
FeedbackItem loadedTrackback = repository.Get(id);
Assert.IsNotNull(loadedTrackback, "Was not able to load trackback from storage.");
Assert.AreEqual(FeedbackType.PingTrack, loadedTrackback.FeedbackType, "Feedback should be a PingTrack");
}
示例2: ApproveCommentRemovesDeletedAndConfirmedSpamBits
public void ApproveCommentRemovesDeletedAndConfirmedSpamBits()
{
Entry entry = SetupBlogForCommentsAndCreateEntry();
var repository = new DatabaseObjectProvider();
FeedbackItem comment = CreateAndUpdateFeedbackWithExactStatus(entry, FeedbackType.Comment,
FeedbackStatusFlag.ConfirmedSpam |
FeedbackStatusFlag.Deleted);
Assert.IsFalse(comment.Approved, "should not be approved");
Assert.IsTrue(comment.Deleted, "should be deleted");
Assert.IsTrue(comment.ConfirmedSpam, "should be confirmed spam");
repository.Approve(comment, null);
comment = repository.Get(comment.Id);
Assert.IsTrue(comment.Approved, "Should be approved now.");
Assert.IsFalse(comment.Deleted, "Should not be deleted.");
Assert.IsFalse(comment.ConfirmedSpam, "Should not be confirmed spam.");
}
示例3: CreateAndUpdateFeedbackWithExactStatus
static FeedbackItem CreateAndUpdateFeedbackWithExactStatus(Entry entry, FeedbackType type,
FeedbackStatusFlag status)
{
var repository = new DatabaseObjectProvider();
var feedback = new FeedbackItem(type);
feedback.Title = UnitTestHelper.GenerateUniqueString();
feedback.Body = UnitTestHelper.GenerateUniqueString();
feedback.EntryId = entry.Id;
feedback.Author = "TestAuthor";
var subtextContext = new Mock<ISubtextContext>();
subtextContext.Setup(c => c.Cache).Returns(new TestCache());
subtextContext.SetupBlog(Config.CurrentBlog);
subtextContext.SetupRepository(repository);
subtextContext.Setup(c => c.HttpContext.Items).Returns(new Hashtable());
subtextContext.Setup(c => c.HttpContext).Returns(new HttpContextWrapper(HttpContext.Current));
var service = new CommentService(subtextContext.Object, null);
int id = service.Create(feedback, true/*runFilters*/);
feedback = repository.Get(id);
feedback.Status = status;
repository.Update(feedback);
return repository.Get(id);
}
示例4: DeleteCommentSetsDeletedBit
public void DeleteCommentSetsDeletedBit()
{
Entry entry = SetupBlogForCommentsAndCreateEntry();
var repository = new DatabaseObjectProvider();
FeedbackItem comment = CreateAndUpdateFeedbackWithExactStatus(entry, FeedbackType.Comment, FeedbackStatusFlag.Approved);
Assert.IsTrue(comment.Approved, "should be approved");
repository.Delete(comment);
comment = repository.Get(comment.Id);
Assert.IsFalse(comment.Approved, "Should not be approved now.");
Assert.IsTrue(comment.Deleted, "Should be moved to deleted folder now.");
}