public void SetUp() { Fake().DocumentType <Article>(Article.CLASS_NAME); page = new Article { DocumentName = "Name" }; var dataContext = Substitute.For <IPageDataContext <TreeNode> >(); dataContext.Page.Returns(page); pageDataContextRetriever.Retrieve <TreeNode>().Returns(dataContext); Fake <SiteInfo, SiteInfoProvider>().WithData( new SiteInfo { SiteID = SITE_ID, SiteName = "Site", SitePresentationURL = "https://presentation.com" }); Fake <AttachmentInfo, AttachmentInfoProvider>().WithData( new AttachmentInfo { AttachmentGUID = attachmentGuid, AttachmentDocumentID = page.DocumentID, AttachmentSiteID = SITE_ID }); attachmentUrlRetriever = Service.Resolve <IPageAttachmentUrlRetriever>(); controller = new ImageWidgetController(pageDataContextRetriever, outputCacheDependencies, propertiesRetriever, attachmentUrlRetriever); controller.ControllerContext = ControllerContextMock.GetControllerContext(controller); }
public void SetUp() { Fake().DocumentType <Article>(Article.CLASS_NAME); page = new Article { DocumentName = "Name" }; currentPageRetriever.Retrieve(Arg.Any <IPageBuilderFeature>()).Returns(page); Fake <SiteInfo, SiteInfoProvider>().WithData( new SiteInfo { SiteID = SITE_ID, SiteName = "Site" }); Fake <AttachmentInfo, AttachmentInfoProvider>().WithData( new AttachmentInfo { AttachmentGUID = attachmentGuid, AttachmentDocumentID = page.DocumentID, AttachmentSiteID = SITE_ID }); controller = new ImageWidgetController(propertiesRetriever, currentPageRetriever); controller.ControllerContext = ControllerContextMock.GetControllerContext(controller); }