diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index 3a7192536c..2bbd70e367 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -2,14 +2,17 @@ using System.Linq; using Moq; using System.Text; +using LightInject; using NUnit.Framework; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Umbraco.Core.Cache; +using Umbraco.Core.Composing; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; using Umbraco.Core.PropertyEditors; using Umbraco.Core.PropertyEditors.Validators; +using Umbraco.Core.Services; namespace Umbraco.Tests.Manifest { @@ -22,10 +25,25 @@ namespace Umbraco.Tests.Manifest [SetUp] public void Setup() { + Current.Reset(); + var container = Mock.Of(); + Current.Container = container; + + var serviceContext = new ServiceContext( + localizedTextService: Mock.Of()); + + Mock.Get(container) + .Setup(x => x.GetInstance(It.IsAny())) + .Returns(x => + { + if (x == typeof(ServiceContext)) return serviceContext; + throw new Exception("oops"); + }); + var validators = new IManifestValueValidator[] { - new RequiredValidator(), - new RegexValidator() + new RequiredValidator(Mock.Of()), + new RegexValidator(Mock.Of(), null) }; _parser = new ManifestParser(NullCacheProvider.Instance, new ManifestValueValidatorCollection(validators), Mock.Of()); } diff --git a/src/Umbraco.Tests/Models/VariationTests.cs b/src/Umbraco.Tests/Models/VariationTests.cs index 19da19bcf0..ba4283af49 100644 --- a/src/Umbraco.Tests/Models/VariationTests.cs +++ b/src/Umbraco.Tests/Models/VariationTests.cs @@ -46,7 +46,9 @@ namespace Umbraco.Tests.Models .Setup(x => x.GetDataType(It.IsAny())) .Returns(x => dataType); - var serviceContext = new ServiceContext(dataTypeService: dataTypeService); + var serviceContext = new ServiceContext( + dataTypeService: dataTypeService, + localizedTextService: Mock.Of()); Mock.Get(container) .Setup(x => x.GetInstance(It.IsAny())) @@ -54,8 +56,10 @@ namespace Umbraco.Tests.Models { if (x == typeof(PropertyEditorCollection)) return propertyEditors; if (x == typeof(ServiceContext)) return serviceContext; + if (x == typeof(ILocalizedTextService)) return serviceContext.LocalizationService; throw new Exception("oops"); }); + } [Test]