本文整理汇总了C#中Context.UpdateForum方法的典型用法代码示例。如果您正苦于以下问题:C# Context.UpdateForum方法的具体用法?C# Context.UpdateForum怎么用?C# Context.UpdateForum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context.UpdateForum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ForumUpdate_WithoutUid_ThrowsError
public void ForumUpdate_WithoutUid_ThrowsError()
{
var commentForum = new Forum { Id = "" };
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var site = mocks.DynamicMock<ISite>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
//readerCreator.Stub(x => x.CreateDnaDataReader("getmoderationclasslist")).Return(reader);
mocks.ReplayAll();
var context = new Context(null, readerCreator, cacheManager, null);
try
{
context.UpdateForum(commentForum, site, null);
throw new Exception("Error not thrown within code");
}
catch (ApiException ex)
{
Assert.AreEqual("Forum uid is empty, null or exceeds 255 characters.", ex.Message);
Assert.AreEqual(ErrorType.InvalidForumUid, ex.type);
}
readerCreator.AssertWasNotCalled(x => x.CreateDnaDataReader("commentforumcreate"));
}
示例2: ForumUpdate_WithDuration_ReturnsOK
public void ForumUpdate_WithDuration_ReturnsOK()
{
var commentForum = new Forum
{
Id = "".PadRight(10, 'a'),
ParentUri = "http://www.bbc.co.uk/dna",
Title = "title",
ModerationServiceGroup = ModerationStatus.ForumStatus.PostMod,
CloseDate = DateTime.Now.AddDays(2)
};
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var reader = mocks.DynamicMock<IDnaDataReader>();
var site = mocks.DynamicMock<ISite>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
readerCreator.Stub(x => x.CreateDnaDataReader("commentforumupdate")).Return(reader);
mocks.ReplayAll();
var context = new Context(null, readerCreator, cacheManager, null);
context.UpdateForum(commentForum, site, null);
readerCreator.AssertWasCalled(x => x.CreateDnaDataReader("commentforumupdate"));
}
示例3: ForumUpdate_DBError_ThrowsError
public void ForumUpdate_DBError_ThrowsError()
{
var commentForum = new Forum
{
Id = "".PadRight(10, 'a'),
ParentUri = "http://www.bbc.co.uk/dna",
Title = "title",
ModerationServiceGroup = ModerationStatus.ForumStatus.PostMod,
CloseDate = DateTime.Now.AddDays(2)
};
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var site = mocks.DynamicMock<ISite>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
var reader = mocks.DynamicMock<IDnaDataReader>();
readerCreator.Stub(x => x.CreateDnaDataReader("commentforumupdate")).Return(reader);
reader.Stub(x => x.Execute()).Throw(new Exception("DB ERROR"));
mocks.ReplayAll();
var context = new Context(null, readerCreator, cacheManager, null);
try
{
context.UpdateForum(commentForum, site, null);
throw new Exception("Error not thrown within code");
}
catch (ApiException ex)
{
Assert.AreEqual(ErrorType.Unknown, ex.type);
}
readerCreator.AssertWasCalled(x => x.CreateDnaDataReader("commentforumupdate"));
}
示例4: ForumUpdate_WithoutSite_ThrowsError
public void ForumUpdate_WithoutSite_ThrowsError()
{
var commentForum = new Forum
{
Id = "".PadRight(10, 'a'),
ParentUri = "http://www.bbc.co.uk/dna",
Title = "title"
};
var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
var site = mocks.DynamicMock<ISite>();
var cacheManager = mocks.DynamicMock<ICacheManager>();
//readerCreator.Stub(x => x.CreateDnaDataReader("getmoderationclasslist")).Return(reader);
mocks.ReplayAll();
var context = new Context(null, readerCreator, cacheManager, null);
try
{
context.UpdateForum(commentForum, null, true);
throw new Exception("Error not thrown within code");
}
catch (ApiException ex)
{
Assert.AreEqual(ErrorType.UnknownSite, ex.type);
}
readerCreator.AssertWasNotCalled(x => x.CreateDnaDataReader("commentforumupdate"));
}