Exemplo n.º 1
0
        public void Can_Mock_UmbracoApiController_Dependencies_With_Injected_UmbracoMapper()
        {
            var umbracoContext = TestObjects.GetUmbracoContextMock();

            var scopeProvider = new Mock <IScopeProvider>();

            scopeProvider
            .Setup(x => x.CreateScope(
                       It.IsAny <IsolationLevel>(),
                       It.IsAny <RepositoryCacheMode>(),
                       It.IsAny <IEventDispatcher>(),
                       It.IsAny <bool?>(),
                       It.IsAny <bool>(),
                       It.IsAny <bool>()))
            .Returns(Mock.Of <IScope>);

            var membershipHelper = new MembershipHelper(umbracoContext.HttpContext, Mock.Of <IPublishedMemberCache>(), Mock.Of <MembershipProvider>(), Mock.Of <RoleProvider>(), Mock.Of <IMemberService>(), Mock.Of <IMemberTypeService>(), Mock.Of <IUserService>(), Mock.Of <IPublicAccessService>(), Mock.Of <AppCaches>(), Mock.Of <ILogger>());
            var umbracoHelper    = new UmbracoHelper(Mock.Of <IPublishedContent>(), Mock.Of <ITagQuery>(), Mock.Of <ICultureDictionaryFactory>(), Mock.Of <IUmbracoComponentRenderer>(), Mock.Of <IPublishedContentQuery>(), membershipHelper);
            var umbracoMapper    = new UmbracoMapper(new MapDefinitionCollection(new[] { Mock.Of <IMapDefinition>() }), scopeProvider.Object);

            // ReSharper disable once UnusedVariable
            var umbracoApiController = new FakeUmbracoApiController(Mock.Of <IGlobalSettings>(), Mock.Of <IUmbracoContextAccessor>(), Mock.Of <ISqlContext>(), ServiceContext.CreatePartial(), AppCaches.NoCache, Mock.Of <IProfilingLogger>(), Mock.Of <IRuntimeState>(), umbracoHelper, umbracoMapper);

            Assert.Pass();
        }
Exemplo n.º 2
0
        public void Can_Mock_UmbracoApiController_Dependencies_With_Injected_UmbracoMapper()
        {
            var umbracoContext = TestObjects.GetUmbracoContextMock();

            var membershipHelper = new MembershipHelper(umbracoContext.HttpContext, Mock.Of <IPublishedMemberCache>(), Mock.Of <MembershipProvider>(), Mock.Of <RoleProvider>(), Mock.Of <IMemberService>(), Mock.Of <IMemberTypeService>(), Mock.Of <IUserService>(), Mock.Of <IPublicAccessService>(), AppCaches.Disabled, Mock.Of <ILogger>());
            var umbracoHelper    = new UmbracoHelper(Mock.Of <IPublishedContent>(), Mock.Of <ITagQuery>(), Mock.Of <ICultureDictionaryFactory>(), Mock.Of <IUmbracoComponentRenderer>(), Mock.Of <IPublishedContentQuery>(), membershipHelper);
            var umbracoMapper    = new UmbracoMapper(new MapDefinitionCollection(new[] { Mock.Of <IMapDefinition>() }));

            // ReSharper disable once UnusedVariable
            var umbracoApiController = new FakeUmbracoApiController(Mock.Of <IGlobalSettings>(), Mock.Of <IUmbracoContextAccessor>(), Mock.Of <ISqlContext>(), ServiceContext.CreatePartial(), AppCaches.NoCache, Mock.Of <IProfilingLogger>(), Mock.Of <IRuntimeState>(), umbracoHelper, umbracoMapper);

            Assert.Pass();
        }