diff --git a/src/Umbraco.Tests/Services/TagServiceTests.cs b/src/Umbraco.Tests.Integration/Services/TagServiceTests.cs similarity index 76% rename from src/Umbraco.Tests/Services/TagServiceTests.cs rename to src/Umbraco.Tests.Integration/Services/TagServiceTests.cs index f4916168d4..09cbafd550 100644 --- a/src/Umbraco.Tests/Services/TagServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Services/TagServiceTests.cs @@ -2,16 +2,15 @@ using System.Threading; using Newtonsoft.Json; using NUnit.Framework; -using NUnit.Framework.Internal; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; -using Umbraco.Tests.TestHelpers; +using Umbraco.Tests.Integration.Testing; using Umbraco.Tests.TestHelpers.Entities; using Umbraco.Tests.Testing; -namespace Umbraco.Tests.Services +namespace Umbraco.Tests.Integration.Services { /// /// Tests covering methods in the TagService class. @@ -21,16 +20,17 @@ namespace Umbraco.Tests.Services [TestFixture] [Apartment(ApartmentState.STA)] [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] - public class TagServiceTests : TestWithSomeContentBase + public class TagServiceTests : UmbracoIntegrationTest { - public PropertyEditorCollection PropertyEditorCollection => Factory.GetInstance(); + public PropertyEditorCollection PropertyEditorCollection => GetRequiredService(); [Test] public void TagApiConsistencyTest() { - var contentService = ServiceContext.ContentService; - var contentTypeService = ServiceContext.ContentTypeService; - var tagService = ServiceContext.TagService; + var contentService = GetRequiredService(); + var contentTypeService = GetRequiredService(); + var tagService = GetRequiredService(); + var dataTypeService = GetRequiredService(); var contentType = MockedContentTypes.CreateSimpleContentType("umbMandatory", "Mandatory Doc Type", true); contentType.PropertyGroups.First().PropertyTypes.Add( new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "tags") @@ -40,18 +40,18 @@ namespace Umbraco.Tests.Services contentTypeService.Save(contentType); IContent content1 = MockedContent.CreateSimpleContent(contentType, "Tagged content 1", -1); - content1.AssignTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "cow", "pig", "goat" }); + content1.AssignTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "cow", "pig", "goat" }); contentService.SaveAndPublish(content1); // change - content1.AssignTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "elephant" }, true); - content1.RemoveTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "cow" }); + content1.AssignTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "elephant" }, true); + content1.RemoveTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "cow" }); contentService.SaveAndPublish(content1); // more changes - content1.AssignTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "mouse" }, true); + content1.AssignTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "mouse" }, true); contentService.SaveAndPublish(content1); - content1.RemoveTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "mouse" }); + content1.RemoveTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "mouse" }); contentService.SaveAndPublish(content1); // get it back @@ -76,9 +76,10 @@ namespace Umbraco.Tests.Services [Test] public void TagList_Contains_NodeCount() { - var contentService = ServiceContext.ContentService; - var contentTypeService = ServiceContext.ContentTypeService; - var tagService = ServiceContext.TagService; + var contentService = GetRequiredService(); + var contentTypeService = GetRequiredService(); + var tagService = GetRequiredService(); + var dataTypeService = GetRequiredService(); var contentType = MockedContentTypes.CreateSimpleContentType("umbMandatory", "Mandatory Doc Type", true); contentType.PropertyGroups.First().PropertyTypes.Add( new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.Tags, ValueStorageType.Ntext, "tags") @@ -88,15 +89,15 @@ namespace Umbraco.Tests.Services contentTypeService.Save(contentType); var content1 = MockedContent.CreateSimpleContent(contentType, "Tagged content 1", -1); - content1.AssignTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "cow", "pig", "goat" }); + content1.AssignTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "cow", "pig", "goat" }); contentService.SaveAndPublish(content1); var content2 = MockedContent.CreateSimpleContent(contentType, "Tagged content 2", -1); - content2.AssignTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "cow", "pig" }); + content2.AssignTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "cow", "pig" }); contentService.SaveAndPublish(content2); var content3 = MockedContent.CreateSimpleContent(contentType, "Tagged content 3", -1); - content3.AssignTags(PropertyEditorCollection, DataTypeService, "tags", new[] { "cow" }); + content3.AssignTags(PropertyEditorCollection, dataTypeService, "tags", new[] { "cow" }); contentService.SaveAndPublish(content3); // Act diff --git a/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj index b72f1d2612..8ddeb42b81 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj +++ b/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj @@ -24,7 +24,6 @@ - all diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 2395542d62..70c0e917cb 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -268,7 +268,6 @@ -