2020-12-19 08:17:35 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2020-08-12 11:35:12 +02:00
|
|
|
using Moq;
|
2021-05-18 12:40:24 +02:00
|
|
|
using Umbraco.Cms.Core.IO;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.PropertyEditors;
|
|
|
|
|
using Umbraco.Cms.Core.Strings;
|
2021-02-15 12:42:26 +01:00
|
|
|
using Umbraco.Cms.Infrastructure.Serialization;
|
2020-08-12 11:35:12 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.Common.TestHelpers;
|
|
|
|
|
|
|
|
|
|
public class MockedValueEditors
|
2020-08-12 11:35:12 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
public static DataValueEditor CreateDataValueEditor(string name)
|
2020-08-12 11:35:12 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
var valueType = ValueTypes.IsValue(name) ? name : ValueTypes.String;
|
2020-08-12 11:35:12 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
return new DataValueEditor(
|
|
|
|
|
Mock.Of<IShortStringHelper>(),
|
2024-02-22 11:22:57 +01:00
|
|
|
new SystemTextJsonSerializer(),
|
2022-06-21 08:09:38 +02:00
|
|
|
Mock.Of<IIOHelper>(),
|
2024-02-15 12:36:23 +01:00
|
|
|
new DataEditorAttribute(name) { ValueType = valueType });
|
2020-08-12 11:35:12 +02:00
|
|
|
}
|
|
|
|
|
}
|