2020-12-05 11:12:55 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2020-01-13 07:29:12 +01:00
|
|
|
using System.Collections.Generic;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.PropertyEditors;
|
2020-01-13 07:29:12 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.Common.Builders;
|
|
|
|
|
|
|
|
|
|
public class ConfigurationEditorBuilder<TParent> : ChildBuilderBase<TParent, IConfigurationEditor>
|
2020-01-13 07:29:12 +01:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
private IDictionary<string, object> _defaultConfiguration;
|
2020-01-13 07:29:12 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
public ConfigurationEditorBuilder(TParent parentBuilder)
|
|
|
|
|
: base(parentBuilder)
|
|
|
|
|
{
|
|
|
|
|
}
|
2020-01-13 07:29:12 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
public ConfigurationEditorBuilder<TParent> WithDefaultConfiguration(
|
|
|
|
|
IDictionary<string, object> defaultConfiguration)
|
|
|
|
|
{
|
|
|
|
|
_defaultConfiguration = defaultConfiguration;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2020-01-13 07:29:12 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
public override IConfigurationEditor Build()
|
|
|
|
|
{
|
|
|
|
|
var defaultConfiguration = _defaultConfiguration ?? new Dictionary<string, object>();
|
2020-01-13 07:29:12 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
return new ConfigurationEditor { DefaultConfiguration = defaultConfiguration };
|
2020-01-13 07:29:12 +01:00
|
|
|
}
|
|
|
|
|
}
|