So long Facade

This commit is contained in:
Stephan
2017-10-31 12:48:24 +01:00
parent ab758001ef
commit ec6ba01cbf
169 changed files with 1000 additions and 1011 deletions

View File

@@ -66,7 +66,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbCtx = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),
@@ -87,7 +87,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbCtx = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),
@@ -108,7 +108,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbCtx = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),
@@ -129,7 +129,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbCtx = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),

View File

@@ -39,7 +39,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbracoContext = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
new Mock<HttpContextBase>().Object,
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),
@@ -58,7 +58,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbCtx = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
new Mock<HttpContextBase>().Object,
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),
@@ -75,7 +75,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbracoContext = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
new Mock<HttpContextBase>().Object,
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
TestObjects.GetUmbracoSettings(),
Enumerable.Empty<IUrlProvider>(),
@@ -91,15 +91,15 @@ namespace Umbraco.Tests.Web.Mvc
[Test]
public void Can_Lookup_Content()
{
var facade = new Mock<IFacade>();
facade.Setup(x => x.MemberCache).Returns(Mock.Of<IPublishedMemberCache>());
var facadeService = new Mock<IFacadeService>();
facadeService.Setup(x => x.CreateFacade(It.IsAny<string>())).Returns(facade.Object);
var publishedSnapshot = new Mock<IPublishedShapshot>();
publishedSnapshot.Setup(x => x.MemberCache).Returns(Mock.Of<IPublishedMemberCache>());
var publishedSnapshotService = new Mock<IPublishedSnapshotService>();
publishedSnapshotService.Setup(x => x.CreatePublishedSnapshot(It.IsAny<string>())).Returns(publishedSnapshot.Object);
var umbracoContext = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
new Mock<HttpContextBase>().Object,
facadeService.Object,
publishedSnapshotService.Object,
new Mock<WebSecurity>(null, null).Object,
Mock.Of<IUmbracoSettingsSection>(section => section.WebRouting == Mock.Of<IWebRoutingSection>(routingSection => routingSection.UrlProviderMode == "AutoLegacy")),
Enumerable.Empty<IUrlProvider>(),
@@ -134,7 +134,7 @@ namespace Umbraco.Tests.Web.Mvc
var umbracoContext = UmbracoContext.EnsureContext(
Current.UmbracoContextAccessor,
new Mock<HttpContextBase>().Object,
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
Mock.Of<IUmbracoSettingsSection>(section => section.WebRouting == webRoutingSettings),
Enumerable.Empty<IUrlProvider>(),
@@ -143,8 +143,8 @@ namespace Umbraco.Tests.Web.Mvc
var content = Mock.Of<IPublishedContent>(publishedContent => publishedContent.Id == 12345);
var contextBase = umbracoContext.HttpContext;
var facadeRouter = BaseWebTest.CreateFacadeRouter(TestObjects.GetUmbracoSettings().WebRouting);
var frequest = facadeRouter.CreateRequest(umbracoContext, new Uri("http://localhost/test"));
var publishedRouter = BaseWebTest.CreatePublishedRouter(TestObjects.GetUmbracoSettings().WebRouting);
var frequest = publishedRouter.CreateRequest(umbracoContext, new Uri("http://localhost/test"));
frequest.PublishedContent = content;
var routeDefinition = new RouteDefinition

View File

@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Web.Mvc
[UmbracoTest(WithApplication = true)]
public class UmbracoViewPageTests : UmbracoTestBase
{
private FacadeService _service;
private PublishedSnapshotService _service;
[TearDown]
public override void TearDown()
@@ -395,8 +395,8 @@ namespace Umbraco.Tests.Web.Mvc
logger, settings,
"/dang", 0);
var facadeRouter = BaseWebTest.CreateFacadeRouter(TestObjects.GetUmbracoSettings().WebRouting);
var frequest = facadeRouter.CreateRequest(umbracoContext, new Uri("http://localhost/dang"));
var publishedRouter = BaseWebTest.CreatePublishedRouter(TestObjects.GetUmbracoSettings().WebRouting);
var frequest = publishedRouter.CreateRequest(umbracoContext, new Uri("http://localhost/dang"));
frequest.Culture = CultureInfo.InvariantCulture;
umbracoContext.PublishedContentRequest = frequest;
@@ -425,7 +425,7 @@ namespace Umbraco.Tests.Web.Mvc
var scopeProvider = TestObjects.GetScopeProvider(Mock.Of<ILogger>());
var uowProvider = TestObjects.GetScopeUnitOfWorkProvider(Mock.Of<ILogger>(), scopeProvider: scopeProvider);
var factory = Mock.Of<IPublishedContentTypeFactory>();
_service = new FacadeService(svcCtx, factory, scopeProvider, uowProvider, cache, Enumerable.Empty<IUrlSegmentProvider>(), null, Current.Logger, null, true, false); // no events
_service = new PublishedSnapshotService(svcCtx, factory, scopeProvider, uowProvider, cache, Enumerable.Empty<IUrlSegmentProvider>(), null, Current.Logger, null, true, false); // no events
var http = GetHttpContextFactory(url, routeData).HttpContext;

View File

@@ -78,7 +78,7 @@ namespace Umbraco.Tests.Web
using (var umbCtx = UmbracoContext.EnsureContext(
Umbraco.Web.Composing.Current.UmbracoContextAccessor,
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new Mock<WebSecurity>(null, null).Object,
//setup a quick mock of the WebRouting section
Mock.Of<IUmbracoSettingsSection>(section => section.WebRouting == Mock.Of<IWebRoutingSection>(routingSection => routingSection.UrlProviderMode == "AutoLegacy")),

View File

@@ -25,7 +25,7 @@ namespace Umbraco.Tests.Web
{
var umbCtx = new UmbracoContext(
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new WebSecurity(Mock.Of<HttpContextBase>(), Current.Services.UserService),
TestObjects.GetUmbracoSettings(),
new List<IUrlProvider>());
@@ -41,7 +41,7 @@ namespace Umbraco.Tests.Web
{
var umbCtx = new UmbracoContext(
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new WebSecurity(Mock.Of<HttpContextBase>(), Current.Services.UserService),
TestObjects.GetUmbracoSettings(),
new List<IUrlProvider>());
@@ -67,7 +67,7 @@ namespace Umbraco.Tests.Web
{
var umbCtx = new UmbracoContext(
Mock.Of<HttpContextBase>(),
Mock.Of<IFacadeService>(),
Mock.Of<IPublishedSnapshotService>(),
new WebSecurity(Mock.Of<HttpContextBase>(), Current.Services.UserService),
TestObjects.GetUmbracoSettings(),
new List<IUrlProvider>());