2020-12-19 08:17:35 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Web;
|
2016-11-07 19:12:09 +01:00
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
namespace Umbraco.Cms.Tests.Common
|
2016-11-07 19:12:09 +01:00
|
|
|
{
|
|
|
|
|
public class TestUmbracoContextAccessor : IUmbracoContextAccessor
|
|
|
|
|
{
|
2020-02-09 18:53:37 +01:00
|
|
|
public IUmbracoContext UmbracoContext { get; set; }
|
2018-06-28 23:28:22 +02:00
|
|
|
|
|
|
|
|
public TestUmbracoContextAccessor()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-09 18:53:37 +01:00
|
|
|
public TestUmbracoContextAccessor(IUmbracoContext umbracoContext)
|
2018-06-28 23:28:22 +02:00
|
|
|
{
|
|
|
|
|
UmbracoContext = umbracoContext;
|
|
|
|
|
}
|
2021-08-11 11:06:55 +02:00
|
|
|
|
|
|
|
|
public bool TryGetUmbracoContext(out IUmbracoContext umbracoContext)
|
|
|
|
|
{
|
|
|
|
|
umbracoContext = UmbracoContext;
|
|
|
|
|
return umbracoContext is not null;
|
|
|
|
|
}
|
2021-08-11 11:33:46 +02:00
|
|
|
|
|
|
|
|
public void Clear() => UmbracoContext = null;
|
2021-08-11 13:25:17 +02:00
|
|
|
public void Set(IUmbracoContext umbracoContext) => UmbracoContext = umbracoContext;
|
2016-11-07 19:12:09 +01:00
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
}
|