Added BlockEditorDataConverter method to BlockListPropertyEditorBase … (#14960)

This commit is contained in:
Brett Smith
2023-12-01 05:21:09 +13:00
committed by GitHub
parent 212b566214
commit ecc31a308a
3 changed files with 33 additions and 8 deletions

View File

@@ -1,8 +1,9 @@
using System.Linq;
using System.Linq;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
@@ -34,9 +35,10 @@ public class DataValueEditorReuseTests
_dataValueEditorFactoryMock
.Setup(m =>
m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>()))
m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter>()))
.Returns(() => new BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor(
new DataEditorAttribute("a", "b", "c"),
new BlockListEditorDataConverter(),
_propertyEditorCollection,
Mock.Of<IDataTypeService>(),
Mock.Of<IContentTypeService>(),
@@ -105,7 +107,7 @@ public class DataValueEditorReuseTests
Assert.NotNull(dataValueEditor2);
Assert.AreNotSame(dataValueEditor1, dataValueEditor2);
_dataValueEditorFactoryMock.Verify(
m => m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>()),
m => m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter>()),
Times.Exactly(2));
}
@@ -128,7 +130,7 @@ public class DataValueEditorReuseTests
Assert.AreEqual("config", ((DataValueEditor)dataValueEditor2).Configuration);
Assert.AreNotSame(dataValueEditor1, dataValueEditor2);
_dataValueEditorFactoryMock.Verify(
m => m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>()),
m => m.Create<BlockListPropertyEditorBase.BlockListEditorPropertyValueEditor>(It.IsAny<DataEditorAttribute>(), It.IsAny<BlockEditorDataConverter>()),
Times.Exactly(2));
}
}