* Update gitignore * Move csproj * Update project references * Update solutions * Update build scripts * Tests used to share editorconfig with projects in src * Fix broken tests. * Stop copying around .editorconfig merged root one with linting * csharp_style_expression_bodied -> suggestion * Move StyleCop rulesets to matching directories and update shared build properties * Remove legacy build files, update NuGet.cofig and solution files * Restore myget source * Clean up .gitignore * Update .gitignore * Move new test classes to tests after merge * Gitignore + nuget config * Move new test Co-authored-by: Ronald Barendse <ronald@barend.se>
70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
// Copyright (c) Umbraco.
|
|
// See LICENSE for more details.
|
|
|
|
using System;
|
|
using Moq;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Core.PropertyEditors;
|
|
using Umbraco.Cms.Core.Serialization;
|
|
using Umbraco.Cms.Core.Services;
|
|
using Umbraco.Cms.Core.Strings;
|
|
|
|
namespace Umbraco.Cms.Tests.Common.Builders
|
|
{
|
|
public class DataValueEditorBuilder<TParent> : ChildBuilderBase<TParent, IDataValueEditor>
|
|
{
|
|
private string _configuration;
|
|
private string _view;
|
|
private bool? _hideLabel;
|
|
private string _valueType;
|
|
|
|
public DataValueEditorBuilder(TParent parentBuilder)
|
|
: base(parentBuilder)
|
|
{
|
|
}
|
|
|
|
public DataValueEditorBuilder<TParent> WithConfiguration(string configuration)
|
|
{
|
|
_configuration = configuration;
|
|
return this;
|
|
}
|
|
|
|
public DataValueEditorBuilder<TParent> WithView(string view)
|
|
{
|
|
_view = view;
|
|
return this;
|
|
}
|
|
|
|
public DataValueEditorBuilder<TParent> WithHideLabel(bool hideLabel)
|
|
{
|
|
_hideLabel = hideLabel;
|
|
return this;
|
|
}
|
|
|
|
public DataValueEditorBuilder<TParent> WithValueType(string valueType)
|
|
{
|
|
_valueType = valueType;
|
|
return this;
|
|
}
|
|
|
|
public override IDataValueEditor Build()
|
|
{
|
|
var configuration = _configuration ?? null;
|
|
var view = _view ?? null;
|
|
var hideLabel = _hideLabel ?? false;
|
|
var valueType = _valueType ?? Guid.NewGuid().ToString();
|
|
|
|
return new DataValueEditor(
|
|
Mock.Of<ILocalizedTextService>(),
|
|
Mock.Of<IShortStringHelper>(),
|
|
Mock.Of<IJsonSerializer>())
|
|
{
|
|
Configuration = configuration,
|
|
View = view,
|
|
HideLabel = hideLabel,
|
|
ValueType = valueType,
|
|
};
|
|
}
|
|
}
|
|
}
|