public void EnginePositionTest() { var content = _unitTestEngine.WithPublishedContentPage(index: 1); var controller = new BasicTestSurfaceController(_unitTestEngine.UmbracoContext, _unitTestEngine.UmbracoHelper); var res = controller.BasicPositionAction(content.Id); var model = (bool)res.Model; Assert.IsFalse(model); }
public void BasicPositionTest() { var appCtx = ApplicationContext.EnsureContext( new DatabaseContext(Mock.Of <IDatabaseFactory>(), Mock.Of <ILogger>(), new SqlSyntaxProviders(new[] { Mock.Of <ISqlSyntaxProvider>() })), new ServiceContext(), CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger( Mock.Of <ILogger>(), Mock.Of <IProfiler>()), true); var ctx = UmbracoContext.EnsureContext( Mock.Of <HttpContextBase>(), appCtx, new Mock <WebSecurity>(null, null).Object, Mock.Of <IUmbracoSettingsSection>(), Enumerable.Empty <IUrlProvider>(), true); var contentId = 2; //get a mocked IPublishedContent var contentMock = BasicHelpers.GetPublishedContentMock(); contentMock.Setup(s => s.GetIndex()).Returns(1); var mockedTypedQuery = new Mock <ITypedPublishedContentQuery>(); mockedTypedQuery.Setup(s => s.TypedContent(contentId)).Returns(contentMock.Object); //give our dynamic query mock to the longer version of the UmbracoHelper constructor var helper = new UmbracoHelper(ctx, Mock.Of <IPublishedContent>(), mockedTypedQuery.Object, Mock.Of <IDynamicPublishedContentQuery>(), Mock.Of <ITagQuery>(), Mock.Of <IDataTypeService>(), new UrlProvider(ctx, Mock.Of <IWebRoutingSection>(section => section.UrlProviderMode == UrlProviderMode.Auto.ToString()), new[] { Mock.Of <IUrlProvider>() }), Mock.Of <ICultureDictionary>(), Mock.Of <IUmbracoComponentRenderer>(), new MembershipHelper(ctx, Mock.Of <MembershipProvider>(), Mock.Of <RoleProvider>())); var controller = new BasicTestSurfaceController(ctx, helper); var res = controller.BasicPositionAction(contentId); var model = (bool)res.Model; //not first Assert.IsFalse(model); }
public void HelperPositionTest() { var ctx = UmbracoUnitTestHelper.GetUmbracoContext(); var contentId = 2; //get a mocked IPublishedContent var contentMock = UmbracoUnitTestHelper.GetPublishedContentMock(index: 1); var mockedTypedQuery = new Mock <ITypedPublishedContentQuery>(); mockedTypedQuery.Setup(s => s.TypedContent(contentId)).Returns(contentMock.Object); //give our dynamic query mock to the longer version of the UmbracoHelper constructor var helper = UmbracoUnitTestHelper.GetUmbracoHelper(ctx, typedQuery: mockedTypedQuery.Object); var controller = new BasicTestSurfaceController(ctx, helper); var res = controller.BasicPositionAction(contentId); var model = (bool)res.Model; Assert.IsFalse(model); }