本文整理汇总了C#中Comments.GetCommentForumsRatingActivity方法的典型用法代码示例。如果您正苦于以下问题:C# Comments.GetCommentForumsRatingActivity方法的具体用法?C# Comments.GetCommentForumsRatingActivity怎么用?C# Comments.GetCommentForumsRatingActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments.GetCommentForumsRatingActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidParamsCalledTwiceWithin1Minute_UsesCachedVersionOnSecondCall
public void ValidParamsCalledTwiceWithin1Minute_UsesCachedVersionOnSecondCall()
{
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var reader = mocks.DynamicMock<IDnaDataReader>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
DateTime startSampleTime = DateTime.Now.AddMinutes(-1);
int minutes = 1; // URL Default
int totalActiveForums = 1;
DateTime closeDate = DateTime.Now.AddDays(1.0);
int count = 5;
DateTime lastRatedDate = DateTime.Now.AddMinutes(-0.5);
int siteId = 1;
string urlName = "h2g2";
string title = "Test Title";
int totalPosts = 20;
string url = "https://local.bbc.co.uk/dna/h2g2/comments";
int upRatings = 20;
int downRatings = 10;
StubDatabaseCall(readerCreator, reader, totalActiveForums, closeDate, count, lastRatedDate, siteId, urlName, title, totalPosts, url, upRatings, downRatings);
CommentForumRatingActivity cachedRatingActivity = new CommentForumRatingActivity();
cachedRatingActivity.ClosingDate = new DateTimeHelper(closeDate);
cachedRatingActivity.Count = count;
cachedRatingActivity.LastRatedDate = new DateTimeHelper(lastRatedDate);
cachedRatingActivity.SiteId = siteId;
cachedRatingActivity.SiteName = urlName;
cachedRatingActivity.Title = title;
cachedRatingActivity.TotalPosts = totalPosts;
cachedRatingActivity.URL = url;
cachedRatingActivity.Up = upRatings;
cachedRatingActivity.Down = downRatings;
CommentForumsRatingActivityList cachedActivityRatingList = new CommentForumsRatingActivityList();
cachedActivityRatingList.CommentForumsRatingActivity = new List<CommentForumRatingActivity>();
cachedActivityRatingList.CommentForumsRatingActivity.Add(cachedRatingActivity);
cachedActivityRatingList.DateChecked = new DateTimeHelper(DateTime.Now);
cachedActivityRatingList.Minutes = minutes;
cachedActivityRatingList.StartDate = new DateTimeHelper(startSampleTime);
cacheManager.Stub(x => x.GetData(Arg<string>.Is.Anything)).Return(null).Repeat.Once(); // Not cached first time
cacheManager.Stub(x => x.GetData(Arg<string>.Is.Anything)).Return(cachedActivityRatingList).Repeat.Once(); // Cached second time
mocks.ReplayAll();
Comments comments = new Comments(null, readerCreator, cacheManager, null);
CommentForumsRatingActivityList activity = comments.GetCommentForumsRatingActivity(minutes, startSampleTime.ToString());
VerifyActivityList(totalActiveForums, minutes, closeDate, startSampleTime, count, lastRatedDate, siteId, urlName, title, totalPosts, url, upRatings, downRatings, activity);
activity = comments.GetCommentForumsRatingActivity(minutes, startSampleTime.ToString());
VerifyActivityList(totalActiveForums, minutes, closeDate, startSampleTime, count, lastRatedDate, siteId, urlName, title, totalPosts, url, upRatings, downRatings, activity);
cacheManager.AssertWasCalled(x => x.GetData(Arg<string>.Is.Anything), options => options.Repeat.Times(2));
cacheManager.AssertWasCalled(x => x.Add(Arg<string>.Is.Anything, Arg<object>.Is.Anything, Arg<CacheItemPriority>.Is.Anything, Arg<ICacheItemRefreshAction>.Is.Anything, Arg<ICacheItemExpiration>.Is.Anything), options => options.Repeat.Once());
}
示例2: DefaultURLParams_ReturnsActivityForOneMinute
public void DefaultURLParams_ReturnsActivityForOneMinute()
{
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var reader = mocks.DynamicMock<IDnaDataReader>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
DateTime startSampleTime = DateTime.Now.AddMinutes(-1); // URL Default is 1 minute
int minutes = 1; // URL Default
int totalActiveForums = 1;
DateTime closeDate = DateTime.Now.AddDays(1.0);
int count = 5;
DateTime lastRatedDate = DateTime.Now.AddMinutes(-0.5);
int siteId = 1;
string urlName = "h2g2";
string title = "Test Title";
int totalPosts = 20;
string url = "https://local.bbc.co.uk/dna/h2g2/comments";
int upRatings = 20;
int downRatings = 10;
StubDatabaseCall(readerCreator, reader, totalActiveForums, closeDate, count, lastRatedDate, siteId, urlName, title, totalPosts, url, upRatings, downRatings);
mocks.ReplayAll();
Comments comments = new Comments(null, readerCreator, cacheManager, null);
CommentForumsRatingActivityList activity = comments.GetCommentForumsRatingActivity(minutes, "");
VerifyActivityList(totalActiveForums, minutes, closeDate, startSampleTime, count, lastRatedDate, siteId, urlName, title, totalPosts, url, upRatings, downRatings, activity);
cacheManager.AssertWasCalled(x => x.GetData(Arg<string>.Is.Anything));
cacheManager.AssertWasCalled(x => x.Add(Arg<string>.Is.Anything, Arg<object>.Is.Anything, Arg<CacheItemPriority>.Is.Anything, Arg<ICacheItemRefreshAction>.Is.Anything, Arg<ICacheItemExpiration>.Is.Anything));
}
示例3: StartDateValueGreaterThan60Minutes_ReturnsActivityCappedAt60Minutes
public void StartDateValueGreaterThan60Minutes_ReturnsActivityCappedAt60Minutes()
{
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var reader = mocks.DynamicMock<IDnaDataReader>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
DateTime requestedStartSampleTime = DateTime.Now.AddMinutes(-70);
DateTime expectedStartSampleTime = DateTime.Now.AddMinutes(-60);
int expectedMinutes = 60;
StubDatabaseCall(readerCreator, reader, 0, DateTime.Now, 0, DateTime.Now, 0, "", "", 0, "", 0, 0);
mocks.ReplayAll();
Comments comments = new Comments(null, readerCreator, cacheManager, null);
CommentForumsRatingActivityList activity = comments.GetCommentForumsRatingActivity(1, requestedStartSampleTime.ToString());
VerifyActivityList(0, expectedMinutes, DateTime.Now, expectedStartSampleTime, 0, DateTime.Now, 0, "", "", 0, "", 0, 0, activity);
cacheManager.AssertWasCalled(x => x.GetData(Arg<string>.Is.Anything));
cacheManager.AssertWasCalled(x => x.Add(Arg<string>.Is.Anything, Arg<object>.Is.Anything, Arg<CacheItemPriority>.Is.Anything, Arg<ICacheItemRefreshAction>.Is.Anything, Arg<ICacheItemExpiration>.Is.Anything));
}