Changed IContentType on IContent to a more simple class with lesser properties

This commit is contained in:
Bjarke Berg
2019-01-03 09:27:52 +01:00
parent 17d818b604
commit eda46a16d0
28 changed files with 278 additions and 150 deletions

View File

@@ -18,7 +18,7 @@ namespace Umbraco.Tests.Manifest
var contentType = Mock.Of<IContentType>();
Mock.Get(contentType).Setup(x => x.Alias).Returns("type1");
var content = Mock.Of<IContent>();
Mock.Get(content).Setup(x => x.ContentType).Returns(contentType);
Mock.Get(content).Setup(x => x.ContentType).Returns(new SimpleContentType(contentType));
var group1 = Mock.Of<IReadOnlyUserGroup>();
Mock.Get(group1).Setup(x => x.Alias).Returns("group1");

View File

@@ -51,7 +51,7 @@ namespace Umbraco.Tests.Models
var content = new Content("content", -1, contentType) { Id = 1, VersionId = 1 };
const string langFr = "fr-FR";
contentType.Variations = ContentVariation.Culture;
Assert.IsFalse(content.IsPropertyDirty("CultureInfos")); //hasn't been changed
@@ -69,7 +69,7 @@ namespace Umbraco.Tests.Models
Thread.Sleep(500); //The "Date" wont be dirty if the test runs too fast since it will be the same date
content.SetCultureName("name-fr", langFr);
Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));
Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));
Assert.IsTrue(content.IsPropertyDirty("CultureInfos")); //it's true now since we've updated a name
}
@@ -83,6 +83,8 @@ namespace Umbraco.Tests.Models
contentType.Variations = ContentVariation.Culture;
content.ChangeContentType(contentType);
Assert.IsFalse(content.IsPropertyDirty("PublishCultureInfos")); //hasn't been changed
Thread.Sleep(500); //The "Date" wont be dirty if the test runs too fast since it will be the same date
@@ -100,7 +102,7 @@ namespace Umbraco.Tests.Models
Thread.Sleep(500); //The "Date" wont be dirty if the test runs too fast since it will be the same date
content.SetCultureName("name-fr", langFr);
content.PublishCulture(langFr); //we've set the name, now we're publishing it
Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));
Assert.IsTrue(frCultureName.IsPropertyDirty("Date"));
Assert.IsTrue(content.IsPropertyDirty("PublishCultureInfos")); //it's true now since we've updated a name
}
@@ -305,7 +307,7 @@ namespace Umbraco.Tests.Models
content.UpdateDate = DateTime.Now;
content.WriterId = 23;
// Act
var clone = (Content)content.DeepClone();
@@ -315,20 +317,7 @@ namespace Umbraco.Tests.Models
Assert.AreEqual(clone, content);
Assert.AreEqual(clone.Id, content.Id);
Assert.AreEqual(clone.VersionId, content.VersionId);
Assert.AreNotSame(clone.ContentType, content.ContentType);
Assert.AreEqual(clone.ContentType, content.ContentType);
Assert.AreEqual(clone.ContentType.PropertyGroups.Count, content.ContentType.PropertyGroups.Count);
for (var index = 0; index < content.ContentType.PropertyGroups.Count; index++)
{
Assert.AreNotSame(clone.ContentType.PropertyGroups[index], content.ContentType.PropertyGroups[index]);
Assert.AreEqual(clone.ContentType.PropertyGroups[index], content.ContentType.PropertyGroups[index]);
}
Assert.AreEqual(clone.ContentType.PropertyTypes.Count(), content.ContentType.PropertyTypes.Count());
for (var index = 0; index < content.ContentType.PropertyTypes.Count(); index++)
{
Assert.AreNotSame(clone.ContentType.PropertyTypes.ElementAt(index), content.ContentType.PropertyTypes.ElementAt(index));
Assert.AreEqual(clone.ContentType.PropertyTypes.ElementAt(index), content.ContentType.PropertyTypes.ElementAt(index));
}
Assert.AreEqual(clone.ContentTypeId, content.ContentTypeId);
Assert.AreEqual(clone.CreateDate, content.CreateDate);
Assert.AreEqual(clone.CreatorId, content.CreatorId);
@@ -402,7 +391,7 @@ namespace Umbraco.Tests.Models
content.SetCultureName("Hello", "en-US");
content.SetCultureName("World", "es-ES");
content.PublishCulture("en-US");
var i = 200;
foreach (var property in content.Properties)
{
@@ -420,13 +409,12 @@ namespace Umbraco.Tests.Models
{
Id = 88
};
content.Trashed = true;
content.UpdateDate = DateTime.Now;
content.WriterId = 23;
content.Template.UpdateDate = DateTime.Now; //update a child object
content.ContentType.UpdateDate = DateTime.Now; //update a child object
// Act
content.ResetDirtyProperties();
@@ -466,7 +454,6 @@ namespace Umbraco.Tests.Models
}
//verify child objects were reset too
Assert.IsTrue(content.Template.WasPropertyDirty("UpdateDate"));
Assert.IsTrue(content.ContentType.WasPropertyDirty("UpdateDate"));
}
[Test]

View File

@@ -27,6 +27,7 @@ namespace Umbraco.Tests.Models.Mapping
base.Compose();
Container.RegisterSingleton(f => Mock.Of<ICultureDictionaryFactory>());
Container.RegisterSingleton(f => Mock.Of<IContentTypeService>());
}
[DataEditor("Test.Test", "Test", "~/Test.html")]
@@ -117,7 +118,12 @@ namespace Umbraco.Tests.Models.Mapping
public void To_Display_Model()
{
var contentType = MockedContentTypes.CreateSimpleContentType();
var contentTypeServiceMock = Mock.Get(Current.Services.ContentTypeService);
contentTypeServiceMock.Setup(x => x.Get(contentType.Id)).Returns(() => contentType);
var content = MockedContent.CreateSimpleContent(contentType);
FixUsers(content);
// need ids for tabs
@@ -146,6 +152,10 @@ namespace Umbraco.Tests.Models.Mapping
{
var contentType = MockedContentTypes.CreateSimpleContentType();
contentType.PropertyGroups.Clear();
var contentTypeServiceMock = Mock.Get(Current.Services.ContentTypeService);
contentTypeServiceMock.Setup(x => x.Get(contentType.Id)).Returns(() => contentType);
var content = new Content("Home", -1, contentType) { Level = 1, SortOrder = 1, CreatorId = 0, WriterId = 0 };
var result = Mapper.Map<IContent, ContentItemDisplay>(content);
@@ -158,7 +168,7 @@ namespace Umbraco.Tests.Models.Mapping
AssertBasicProperty(invariantContent, p);
AssertDisplayProperty(invariantContent, p);
}
Assert.AreEqual(content.PropertyGroups.Count(), invariantContent.Tabs.Count());
}
@@ -177,6 +187,10 @@ namespace Umbraco.Tests.Models.Mapping
p.Id = idSeed;
idSeed++;
}
var contentTypeServiceMock = Mock.Get(Current.Services.ContentTypeService);
contentTypeServiceMock.Setup(x => x.Get(contentType.Id)).Returns(() => contentType);
var content = MockedContent.CreateSimpleContent(contentType);
FixUsers(content);

View File

@@ -59,7 +59,7 @@ namespace Umbraco.Tests.Models
if (x == typeof(ILocalizedTextService)) return serviceContext.LocalizationService;
throw new Exception("oops");
});
}
[Test]
@@ -285,6 +285,7 @@ namespace Umbraco.Tests.Models
// change - now we vary by culture
contentType.Variations |= ContentVariation.Culture;
propertyType.Variations |= ContentVariation.Culture;
content.ChangeContentType(contentType);
// can set value
// and get values
@@ -401,9 +402,12 @@ namespace Umbraco.Tests.Models
var content = new Content("content", -1, contentType) { Id = 1, VersionId = 1 };
// change - now we vary by culture
contentType.Variations |= ContentVariation.Culture;
propertyType.Variations |= ContentVariation.Culture;
content.ChangeContentType(contentType);
Assert.Throws<NotSupportedException>(() => content.SetValue("prop", "a")); // invariant = no
content.SetValue("prop", "a-fr", langFr);
content.SetValue("prop", "a-uk", langUk);
@@ -430,7 +434,7 @@ namespace Umbraco.Tests.Models
Assert.IsTrue(content.IsCultureAvailable(langUk));
Assert.IsFalse(content.IsCulturePublished(langUk));
Assert.IsNull(content.GetPublishName(langUk));
Assert.IsNull(content.GetPublishDate(langUk)); // not published
Assert.IsNull(content.GetPublishDate(langUk)); // not published
Assert.IsFalse(content.IsCultureAvailable(langEs));
Assert.IsFalse(content.IsCultureEdited(langEs)); // not avail, so... not edited
@@ -438,7 +442,7 @@ namespace Umbraco.Tests.Models
// not published!
Assert.IsNull(content.GetPublishName(langEs));
Assert.IsNull(content.GetPublishDate(langEs));
Assert.IsNull(content.GetPublishDate(langEs));
// cannot test IsCultureEdited here - as that requires the content service and repository
// see: ContentServiceTests.Can_SaveRead_Variations

View File

@@ -302,13 +302,15 @@ namespace Umbraco.Tests.Persistence.Repositories
var emptyContentType = MockedContentTypes.CreateBasicContentType();
var hasPropertiesContentType = MockedContentTypes.CreateSimpleContentType("umbTextpage1", "Textpage");
contentTypeRepository.Save(emptyContentType);
contentTypeRepository.Save(hasPropertiesContentType);
ServiceContext.FileService.SaveTemplate(hasPropertiesContentType.DefaultTemplate); // else, FK violation on contentType!
var content1 = MockedContent.CreateSimpleContent(hasPropertiesContentType);
var content2 = MockedContent.CreateBasicContent(emptyContentType);
var content3 = MockedContent.CreateSimpleContent(hasPropertiesContentType);
contentTypeRepository.Save(emptyContentType);
contentTypeRepository.Save(hasPropertiesContentType);
repository.Save(content1);
repository.Save(content2);
repository.Save(content3);
@@ -424,9 +426,9 @@ namespace Umbraco.Tests.Persistence.Repositories
var contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage2", "Textpage");
contentType.AllowedTemplates = Enumerable.Empty<ITemplate>(); // because CreateSimpleContentType assigns one already
contentType.SetDefaultTemplate(template);
var textpage = MockedContent.CreateSimpleContent(contentType);
contentTypeRepository.Save(contentType);
var textpage = MockedContent.CreateSimpleContent(contentType);
repository.Save(textpage);

View File

@@ -148,7 +148,8 @@ namespace Umbraco.Tests.PublishedContent
new TestDefaultCultureAccessor(),
dataSource,
globalSettings,
new SiteDomainHelper());
new SiteDomainHelper(),
contentTypeService);
// get a snapshot, get a published content
var snapshot = snapshotService.CreatePublishedSnapshot(previewToken: null);

View File

@@ -82,6 +82,7 @@ namespace Umbraco.Tests.Scoping
var documentRepository = Mock.Of<IDocumentRepository>();
var mediaRepository = Mock.Of<IMediaRepository>();
var memberRepository = Mock.Of<IMemberRepository>();
var contentTypeService = Current.Services.ContentTypeService;
return new PublishedSnapshotService(
options,
@@ -97,7 +98,7 @@ namespace Umbraco.Tests.Scoping
documentRepository, mediaRepository, memberRepository,
DefaultCultureAccessor,
new DatabaseDataSource(),
Container.GetInstance<IGlobalSettings>(), new SiteDomainHelper());
Container.GetInstance<IGlobalSettings>(), new SiteDomainHelper(), contentTypeService);
}
protected UmbracoContext GetUmbracoContextNu(string url, int templateId = 1234, RouteData routeData = null, bool setSingleton = false, IUmbracoSettingsSection umbracoSettings = null, IEnumerable<IUrlProvider> urlProviders = null)

View File

@@ -139,29 +139,33 @@ namespace Umbraco.Tests.Services
[Test]
public void Create_Content_From_Blueprint()
{
var contentService = ServiceContext.ContentService;
var contentTypeService = ServiceContext.ContentTypeService;
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
var contentService = ServiceContext.ContentService;
var contentTypeService = ServiceContext.ContentTypeService;
var contentType = MockedContentTypes.CreateTextPageContentType();
ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate);
contentTypeService.Save(contentType);
var contentType = MockedContentTypes.CreateTextPageContentType();
ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate);
contentTypeService.Save(contentType);
var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", -1);
blueprint.SetValue("title", "blueprint 1");
blueprint.SetValue("bodyText", "blueprint 2");
blueprint.SetValue("keywords", "blueprint 3");
blueprint.SetValue("description", "blueprint 4");
var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", -1);
blueprint.SetValue("title", "blueprint 1");
blueprint.SetValue("bodyText", "blueprint 2");
blueprint.SetValue("keywords", "blueprint 3");
blueprint.SetValue("description", "blueprint 4");
contentService.SaveBlueprint(blueprint);
contentService.SaveBlueprint(blueprint);
var fromBlueprint = contentService.CreateContentFromBlueprint(blueprint, "hello world");
contentService.Save(fromBlueprint);
var fromBlueprint = contentService.CreateContentFromBlueprint(blueprint, "hello world");
contentService.Save(fromBlueprint);
Assert.IsTrue(fromBlueprint.HasIdentity);
Assert.AreEqual("blueprint 1", fromBlueprint.Properties["title"].GetValue());
Assert.AreEqual("blueprint 2", fromBlueprint.Properties["bodyText"].GetValue());
Assert.AreEqual("blueprint 3", fromBlueprint.Properties["keywords"].GetValue());
Assert.AreEqual("blueprint 4", fromBlueprint.Properties["description"].GetValue());
}
Assert.IsTrue(fromBlueprint.HasIdentity);
Assert.AreEqual("blueprint 1", fromBlueprint.Properties["title"].GetValue());
Assert.AreEqual("blueprint 2", fromBlueprint.Properties["bodyText"].GetValue());
Assert.AreEqual("blueprint 3", fromBlueprint.Properties["keywords"].GetValue());
Assert.AreEqual("blueprint 4", fromBlueprint.Properties["description"].GetValue());
}
[Test]
@@ -222,7 +226,7 @@ namespace Umbraco.Tests.Services
c.ContentSchedule.Add(now.AddSeconds(5), null); //release in 5 seconds
var r = ServiceContext.ContentService.Save(c);
Assert.IsTrue(r.Success, r.Result.ToString());
}
}
else
{
c.ContentSchedule.Add(null, now.AddSeconds(5)); //expire in 5 seconds
@@ -258,7 +262,7 @@ namespace Umbraco.Tests.Services
variant.Add(c);
}
var runSched = ServiceContext.ContentService.PerformScheduledPublish(
now.AddMinutes(1)).ToList(); //process anything scheduled before a minute from now
@@ -742,7 +746,7 @@ namespace Umbraco.Tests.Services
public void Can_Unpublish_Content_Variation()
{
// Arrange
var langUk = new Language("en-GB") { IsDefault = true };
var langFr = new Language("fr-FR");
@@ -1066,7 +1070,7 @@ namespace Umbraco.Tests.Services
foreach (var x in descendants)
Console.WriteLine(" ".Substring(0, x.Level) + x.Id);
}
Console.WriteLine();
// publish parent & its branch
@@ -1420,7 +1424,7 @@ namespace Umbraco.Tests.Services
var descendants = new List<IContent>();
while(page * pageSize < total)
descendants.AddRange(contentService.GetPagedDescendants(content.Id, page++, pageSize, out total));
Assert.AreNotEqual(-20, content.ParentId);
Assert.IsFalse(content.Trashed);
Assert.AreEqual(3, descendants.Count);

View File

@@ -53,6 +53,7 @@ namespace Umbraco.Tests.Services
var documentRepository = Container.GetInstance<IDocumentRepository>();
var mediaRepository = Mock.Of<IMediaRepository>();
var memberRepository = Mock.Of<IMemberRepository>();
var contentTypeService = Current.Services.ContentTypeService;
return new PublishedSnapshotService(
options,
@@ -68,7 +69,7 @@ namespace Umbraco.Tests.Services
documentRepository, mediaRepository, memberRepository,
DefaultCultureAccessor,
new DatabaseDataSource(),
Container.GetInstance<IGlobalSettings>(), new SiteDomainHelper());
Container.GetInstance<IGlobalSettings>(), new SiteDomainHelper(), contentTypeService);
}
public class LocalServerMessenger : ServerMessengerBase
@@ -173,8 +174,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1en", document.GetValue("value1"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsFalse(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'','seg':'','val':'v1en'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -192,8 +191,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1en", document.GetValue("value1"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsFalse(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'','seg':'','val':'v1en'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -210,8 +207,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1fr", document.GetValue("value1", "fr"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsTrue(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'en','seg':'','val':'v1en'},{'culture':'fr','seg':'','val':'v1fr'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -286,8 +281,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1", document.GetValue("value1"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsFalse(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'','seg':'','val':'v1'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -303,8 +296,6 @@ namespace Umbraco.Tests.Services
Assert.IsNull(document.GetValue("value1", "fr"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsTrue(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'en','seg':'','val':'v1'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -322,8 +313,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1", document.GetValue("value1"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsFalse(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'','seg':'','val':'v1'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -399,8 +388,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1en", document.GetValue("value1"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsFalse(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'','seg':'','val':'v1en'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -417,8 +404,6 @@ namespace Umbraco.Tests.Services
Assert.AreEqual("v1fr", document.GetValue("value1", "fr"));
Assert.AreEqual("v2", document.GetValue("value2"));
Assert.IsTrue(document.ContentType.PropertyTypes.First(x => x.Alias == "value1").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'en','seg':'','val':'v1en'},{'culture':'fr','seg':'','val':'v1fr'}],'value2':[{'culture':'','seg':'','val':'v2'}]},'cultureData':");
@@ -437,8 +422,6 @@ namespace Umbraco.Tests.Services
Assert.IsNull(document.GetValue("value2", "fr"));
Assert.IsNull(document.GetValue("value2"));
Assert.IsTrue(document.ContentType.PropertyTypes.First(x => x.Alias == "value2").VariesByCulture());
Console.WriteLine(GetJson(document.Id));
AssertJsonStartsWith(document.Id,
"{'properties':{'value1':[{'culture':'en','seg':'','val':'v1en'},{'culture':'fr','seg':'','val':'v1fr'}],'value2':[{'culture':'en','seg':'','val':'v2'}]},'cultureData':");
@@ -770,4 +753,4 @@ namespace Umbraco.Tests.Services
"{'properties':{'value11':[{'culture':'','seg':'','val':'v11'}],'value12':[{'culture':'','seg':'','val':'v12'}],'value31':[{'culture':'','seg':'','val':'v31'}],'value32':[{'culture':'','seg':'','val':'v32'}]},'cultureData':");
}
}
}
}

View File

@@ -70,7 +70,7 @@ namespace Umbraco.Tests.UmbracoExamine
m.GetCultureName(It.IsAny<string>()) == (string)x.Attribute("nodeName") &&
m.Path == (string)x.Attribute("path") &&
m.Properties == new PropertyCollection() &&
m.ContentType == Mock.Of<IContentType>(mt =>
m.ContentType == Mock.Of<ISimpleContentType>(mt =>
mt.Icon == "test" &&
mt.Alias == x.Name.LocalName &&
mt.Id == (int)x.Attribute("nodeType"))))
@@ -161,7 +161,7 @@ namespace Umbraco.Tests.UmbracoExamine
if (validator == null)
validator = new ContentValueSetValidator(true);
var i = new UmbracoContentIndex(
"testIndexer",
new UmbracoFieldDefinitionCollection(),

View File

@@ -42,7 +42,7 @@ namespace Umbraco.Tests.UmbracoExamine
m.Path == (string)x.Attribute("path") &&
m.Properties == new PropertyCollection() &&
m.Published == true &&
m.ContentType == Mock.Of<IContentType>(mt =>
m.ContentType == Mock.Of<ISimpleContentType>(mt =>
mt.Icon == "test" &&
mt.Alias == x.Name.LocalName &&
mt.Id == (int)x.Attribute("nodeType"))))
@@ -62,7 +62,7 @@ namespace Umbraco.Tests.UmbracoExamine
{
indexer.CreateIndex();
rebuilder.Populate(indexer);
var searcher = indexer.GetSearcher();
var numberSortedCriteria = searcher.CreateQuery()

View File

@@ -82,6 +82,7 @@ namespace Umbraco.Tests.Web.Controllers
textService.Setup(x => x.Localize(It.IsAny<string>(), It.IsAny<CultureInfo>(), It.IsAny<IDictionary<string, string>>())).Returns("text");
Container.RegisterSingleton(f => Mock.Of<IContentService>());
Container.RegisterSingleton(f => Mock.Of<IContentTypeService>());
Container.RegisterSingleton(f => userServiceMock.Object);
Container.RegisterSingleton(f => entityService.Object);
Container.RegisterSingleton(f => dataTypeService.Object);
@@ -308,6 +309,9 @@ namespace Umbraco.Tests.Web.Controllers
contentServiceMock.Setup(x => x.Save(It.IsAny<IContent>(), It.IsAny<int>(), It.IsAny<bool>()))
.Returns(new OperationResult(OperationResultType.Success, new Core.Events.EventMessages())); //success
var contentTypeServiceMock = Mock.Get(Current.Services.ContentTypeService);
contentTypeServiceMock.Setup(x => x.Get(content.ContentTypeId)).Returns(() => MockedContentTypes.CreateSimpleContentType());
var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<DataEditor>()));
var usersController = new ContentController(propertyEditorCollection);
Container.InjectProperties(usersController);
@@ -340,6 +344,9 @@ namespace Umbraco.Tests.Web.Controllers
contentServiceMock.Setup(x => x.Save(It.IsAny<IContent>(), It.IsAny<int>(), It.IsAny<bool>()))
.Returns(new OperationResult(OperationResultType.Success, new Core.Events.EventMessages())); //success
var contentTypeServiceMock = Mock.Get(Current.Services.ContentTypeService);
contentTypeServiceMock.Setup(x => x.Get(content.ContentTypeId)).Returns(() => MockedContentTypes.CreateSimpleContentType());
var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<DataEditor>()));
var usersController = new ContentController(propertyEditorCollection);
Container.InjectProperties(usersController);
@@ -376,6 +383,9 @@ namespace Umbraco.Tests.Web.Controllers
contentServiceMock.Setup(x => x.Save(It.IsAny<IContent>(), It.IsAny<int>(), It.IsAny<bool>()))
.Returns(new OperationResult(OperationResultType.Success, new Core.Events.EventMessages())); //success
var contentTypeServiceMock = Mock.Get(Current.Services.ContentTypeService);
contentTypeServiceMock.Setup(x => x.Get(content.ContentTypeId)).Returns(() => MockedContentTypes.CreateSimpleContentType());
var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<DataEditor>()));
var usersController = new ContentController(propertyEditorCollection);
Container.InjectProperties(usersController);