protected override void Establish_context() { base.Establish_context(); _sut = Container.Create <TalkPlugin>(); _post = MockRepository.GenerateStub <DataBuddyBase>(); Mocks.ReplayAll(); }
protected override void Establish_context() { base.Establish_context(); _sut = Container.Create <TalkPlugin>(); _sut.CategoryName = "Talk category"; _post = new Post(); IoC.Resolve <IPostRepository>().Stub(x => x.GetCategoryNameOf(_post)).Return(_sut.CategoryName); IoC.Resolve <ITalkValidator>().Expect(x => x.Validate(_post)).Return(new ValidationReport()); Mocks.ReplayAll(); }
void CreateSampleTalks(int count, IUser user) { TalkPlugin talkPlugin = PluginHelper.GetPluginWithCurrentSettings <TalkPlugin>(); Category talkCategory = _categoryRepository.GetCategory(talkPlugin.CategoryName); DateTime date = DateTime.Today.AddMonths(-count / 2).AddDays(1); for (int i = 1; i <= count; i++) { Post post = CreatePost(user); post.Title = String.Format("Sample Talk {0}", i); post.PostBody = String.Format("<h3>Sample Talk {0} Heading</h3><p>Sample Talk {0} contents</p>", i); post.CategoryId = talkCategory.Id; // One talk every two months. date = date.AddMonths(2).AddDays(1); post[talkPlugin.DateField] = date.ToString(); post[talkPlugin.SpeakerField] = "Sample speaker"; _postRepository.Save(post); } }
public string TalkCategoryName() { TalkPlugin talkPlugin = PluginHelper.GetPluginWithCurrentSettings <TalkPlugin>(); return(talkPlugin.CategoryName); }