* starts cleaning up old test project, removing ones we'll never convert, moves new test to where it should be. * Makes ContentNodeKit immutable properties, moves first nucache tests over * Gets the Nucache unit tests working and refactors a bit to use builder pattern for models. * Migrates first xml based cache test to use nucache. * Migrates a bunch more * Migrates remaining tests for PublishedContentTests * Moves PublishedRouterTests * Moves PublishedContentExtensionTests * Moves more tests. * committing wip * committing wip * Gets PublishedContentLanguageVariantTests converted and working. * Fixes DataTable ext method and moves PublishedContentDataTableTests * Moves PublishedMediaTests * wip - moving EntityXmlSerializerTests * Moves more tests * moves more tests * moves more tests * Move another test * Moves more tests * Fix test * move another test * Moves more tests * Moves more tests * Moves more tests * wip before merge * More tests * More tests * More tests * More tests * More tests * More tests * Cleanup and moving classes. * Remove unused code * Fixed failing tests, due to new null checks, that did not exist in v8 * Avoid breaking changes * Unbreak more things, even that it the old solution was crazy.. * Fixed bug where ordering of stream readings was changed.. * cleanup Co-authored-by: Bjarke Berg <mail@bergmania.dk>
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using Umbraco.Extensions;
|
|
using Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
|
|
using System.Linq;
|
|
|
|
namespace Umbraco.Cms.Tests.Common.Builders
|
|
{
|
|
public class PropertyDataBuilder : BuilderBase<Dictionary<string, PropertyData[]>>
|
|
{
|
|
private readonly Dictionary<string, List<PropertyData>> _properties = new();
|
|
|
|
public PropertyDataBuilder WithPropertyData(string alias, PropertyData propertyData)
|
|
{
|
|
if (!_properties.TryGetValue(alias, out List<PropertyData> propertyDataCollection))
|
|
{
|
|
propertyDataCollection = new List<PropertyData>();
|
|
_properties[alias] = propertyDataCollection;
|
|
}
|
|
|
|
propertyDataCollection.Add(propertyData);
|
|
|
|
return this;
|
|
}
|
|
|
|
public PropertyDataBuilder WithPropertyData(string alias, object value, string culture = null, string segment = null)
|
|
=> WithPropertyData(alias, new PropertyData
|
|
{
|
|
Culture = culture ?? string.Empty,
|
|
Segment = segment ?? string.Empty,
|
|
Value = value
|
|
});
|
|
|
|
public override Dictionary<string, PropertyData[]> Build()
|
|
=> _properties.ToDictionary(x => x.Key, x => x.Value.ToArray());
|
|
}
|
|
}
|