Switched to using a dummy Uri so that runtimeState isn't needed as per review

This commit is contained in:
Jeavon
2019-11-12 10:26:25 +00:00
parent b30f7b6a48
commit 10622cc430
2 changed files with 5 additions and 17 deletions

View File

@@ -16,16 +16,14 @@ namespace Umbraco.Examine
{
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly IUserService _userService;
private readonly IRuntimeState _runtimeState;
public MediaValueSetBuilder(PropertyEditorCollection propertyEditors,
UrlSegmentProviderCollection urlSegmentProviders,
IUserService userService, IRuntimeState runtimeState)
IUserService userService)
: base(propertyEditors, false)
{
_urlSegmentProviders = urlSegmentProviders;
_userService = userService;
_runtimeState = runtimeState;
}
/// <inheritdoc />
@@ -55,8 +53,9 @@ namespace Umbraco.Examine
if (!string.IsNullOrEmpty(umbracoFilePath))
{
var uri = new Uri(_runtimeState.ApplicationUrl.GetLeftPart(UriPartial.Authority) + umbracoFilePath);
umbracoFile = uri.Segments.Last();
// intentional dummy Uri
var uri = new Uri("https://localhost/" + umbracoFilePath);
umbracoFile = uri.Segments.Last();
}
var values = new Dictionary<string, IEnumerable<object>>

View File

@@ -45,21 +45,10 @@ namespace Umbraco.Tests.UmbracoExamine
public static MediaIndexPopulator GetMediaIndexRebuilder(PropertyEditorCollection propertyEditors, IMediaService mediaService)
{
var mediaValueSetBuilder = new MediaValueSetBuilder(propertyEditors, new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }), GetMockUserService(), MockRuntimeState(RuntimeLevel.Run));
var mediaValueSetBuilder = new MediaValueSetBuilder(propertyEditors, new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }), GetMockUserService());
var mediaIndexDataSource = new MediaIndexPopulator(null, mediaService, mediaValueSetBuilder);
return mediaIndexDataSource;
}
public static IRuntimeState MockRuntimeState(RuntimeLevel level)
{
var runtimeState = Mock.Of<IRuntimeState>();
Mock.Get(runtimeState).Setup(x => x.Level).Returns(level);
Mock.Get(runtimeState).SetupGet(m => m.ApplicationUrl).Returns(new Uri("https://localhost/umbraco"));
return runtimeState;
}
public static IContentService GetMockContentService()
{
long longTotalRecs;