本文整理匯總了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.");
}