Removed resetting of unit test builders.
This commit is contained in:
@@ -3,7 +3,5 @@ namespace Umbraco.Tests.Common.Builders
|
||||
public abstract class BuilderBase<T>
|
||||
{
|
||||
public abstract T Build();
|
||||
|
||||
protected abstract void Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,16 +21,10 @@ namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
var defaultConfiguration = _defaultConfiguration ?? new Dictionary<string, object>();
|
||||
|
||||
Reset();
|
||||
return new ConfigurationEditor()
|
||||
{
|
||||
DefaultConfiguration = defaultConfiguration,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_defaultConfiguration = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var explicitConfigurationEditor = _explicitConfigurationEditorBuilder.Build();
|
||||
var explicitValueEditor = _explicitValueEditorBuilder.Build();
|
||||
|
||||
Reset();
|
||||
return new DataEditor(
|
||||
Mock.Of<ILogger>(),
|
||||
Mock.Of<IDataTypeService>(),
|
||||
@@ -51,12 +50,5 @@ namespace Umbraco.Tests.Common.Builders
|
||||
ExplicitValueEditor = explicitValueEditor
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_defaultConfiguration = null;
|
||||
_explicitConfigurationEditorBuilder = new ConfigurationEditorBuilder<DataEditorBuilder<TParent>>(this);
|
||||
_explicitValueEditorBuilder = new DataValueEditorBuilder<DataEditorBuilder<TParent>>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var databaseType = _databaseType ?? ValueStorageType.Ntext;
|
||||
var sortOrder = _sortOrder ?? 0;
|
||||
|
||||
Reset();
|
||||
return new DataType(editor, parentId)
|
||||
{
|
||||
Id = id,
|
||||
@@ -84,24 +83,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_dataEditorBuilder = new DataEditorBuilder<DataTypeBuilder>(this);
|
||||
_id = null;
|
||||
_parentId = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_deleteDate = null;
|
||||
_name = null;
|
||||
_trashed = null;
|
||||
_level = null;
|
||||
_path = null;
|
||||
_creatorId = null;
|
||||
_databaseType = null;
|
||||
_sortOrder = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var hideLabel = _hideLabel ?? false;
|
||||
var valueType = _valueType ?? Guid.NewGuid().ToString();
|
||||
|
||||
Reset();
|
||||
return new DataValueEditor(
|
||||
Mock.Of<IDataTypeService>(),
|
||||
Mock.Of<ILocalizationService>(),
|
||||
@@ -62,13 +61,5 @@ namespace Umbraco.Tests.Common.Builders
|
||||
ValueType = valueType,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_configuration = null;
|
||||
_view = null;
|
||||
_hideLabel = null;
|
||||
_valueType = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var parentId = _parentId ?? null;
|
||||
var itemKey = _itemKey ?? Guid.NewGuid().ToString();
|
||||
|
||||
Reset();
|
||||
var result = new DictionaryItem(itemKey)
|
||||
{
|
||||
Translations = _translationBuilders.Select(x => x.Build()),
|
||||
@@ -79,17 +78,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_createDate = null;
|
||||
_deleteDate = null;
|
||||
_id = null;
|
||||
_itemKey = null;
|
||||
_key = null;
|
||||
_parentId = null;
|
||||
_updateDate = null;
|
||||
}
|
||||
|
||||
public DictionaryItemBuilder WithParentId(Guid parentId)
|
||||
{
|
||||
_parentId = parentId;
|
||||
|
||||
@@ -52,20 +52,8 @@ namespace Umbraco.Tests.Common.Builders
|
||||
Id = id
|
||||
};
|
||||
|
||||
Reset();
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_languageBuilder = new LanguageBuilder<DictionaryTranslationBuilder>(this);
|
||||
_createDate = null;
|
||||
_deleteDate = null;
|
||||
_id = null;
|
||||
_key = null;
|
||||
_updateDate = null;
|
||||
_value = null;
|
||||
}
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var id = _id ?? 1;
|
||||
var parentId = _parentId ?? -1;
|
||||
|
||||
Reset();
|
||||
return new EntitySlim
|
||||
{
|
||||
Id = id,
|
||||
@@ -24,12 +23,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_parentId = null;
|
||||
}
|
||||
|
||||
public EntitySlimBuilder WithNoParentId()
|
||||
{
|
||||
_parentId = 0;
|
||||
|
||||
@@ -6,31 +6,21 @@ namespace Umbraco.Tests.Common.Builders
|
||||
public class GenericCollectionBuilder<TBuilder, T>
|
||||
: ChildBuilderBase<TBuilder, IEnumerable<T>>
|
||||
{
|
||||
private IList<T> _collection;
|
||||
private readonly IList<T> _collection;
|
||||
|
||||
public GenericCollectionBuilder(TBuilder parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
_collection = new List<T>();
|
||||
}
|
||||
|
||||
public override IEnumerable<T> Build()
|
||||
{
|
||||
var collection = _collection?.ToList() ?? Enumerable.Empty<T>();
|
||||
Reset();
|
||||
return collection;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_collection = null;
|
||||
}
|
||||
|
||||
public GenericCollectionBuilder<TBuilder, T> WithValue(T value)
|
||||
{
|
||||
if (_collection == null)
|
||||
{
|
||||
_collection = new List<T>();
|
||||
}
|
||||
|
||||
_collection.Add(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -5,34 +5,22 @@ namespace Umbraco.Tests.Common.Builders
|
||||
public class GenericDictionaryBuilder<TBuilder, TKey, TValue>
|
||||
: ChildBuilderBase<TBuilder, IDictionary<TKey, TValue>>
|
||||
{
|
||||
private IDictionary<TKey, TValue> _dictionary;
|
||||
private readonly IDictionary<TKey, TValue> _dictionary;
|
||||
|
||||
public GenericDictionaryBuilder(TBuilder parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
_dictionary = new Dictionary<TKey, TValue>();
|
||||
}
|
||||
|
||||
public override IDictionary<TKey, TValue> Build()
|
||||
{
|
||||
var dictionary = _dictionary == null
|
||||
return _dictionary == null
|
||||
? new Dictionary<TKey, TValue>()
|
||||
: new Dictionary<TKey, TValue>(_dictionary);
|
||||
Reset();
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_dictionary = null;
|
||||
}
|
||||
|
||||
|
||||
public GenericDictionaryBuilder<TBuilder, TKey, TValue> WithKeyValue(TKey key, TValue value)
|
||||
{
|
||||
if (_dictionary == null)
|
||||
{
|
||||
_dictionary = new Dictionary<TKey, TValue>();
|
||||
}
|
||||
|
||||
_dictionary.Add(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Umbraco.Tests.Common.Builders
|
||||
private string _noNodesViewPath;
|
||||
private bool? _useHttps;
|
||||
private int? _versionCheckPeriod;
|
||||
private SmtpSettingsBuilder<GlobalSettingsBuilder<TParent>> _smtpSettingsBuilder;
|
||||
private readonly SmtpSettingsBuilder<GlobalSettingsBuilder<TParent>> _smtpSettingsBuilder;
|
||||
|
||||
public GlobalSettingsBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
@@ -191,7 +191,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var mainDomLock = _mainDomLock ?? string.Empty;
|
||||
var noNodesViewPath = _noNodesViewPath ?? "~/config/splashes/NoNodes.cshtml";
|
||||
|
||||
Reset();
|
||||
return new TestGlobalSettings
|
||||
{
|
||||
ConfigurationStatus = configurationStatus,
|
||||
@@ -219,32 +218,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_configurationStatus = null;
|
||||
_databaseFactoryServerVersion = null;
|
||||
_defaultUiLanguage = null;
|
||||
_disableElectionForSingleServer = null;
|
||||
_hideTopLevelNodeFromPath = null;
|
||||
_installEmptyDatabase = null;
|
||||
_installMissingDatabase = null;
|
||||
_isSmtpServerConfigured = null;
|
||||
_path = null;
|
||||
_registerType = null;
|
||||
_reservedPaths = null;
|
||||
_reservedUrls = null;
|
||||
_timeOutInMinutes = null;
|
||||
_umbracoCssPath = null;
|
||||
_umbracoMediaPath = null;
|
||||
_umbracoPath = null;
|
||||
_umbracoScriptsPath = null;
|
||||
_mainDomLock = null;
|
||||
_noNodesViewPath = null;
|
||||
_useHttps = null;
|
||||
_versionCheckPeriod = null;
|
||||
_smtpSettingsBuilder = new SmtpSettingsBuilder<GlobalSettingsBuilder<TParent>>(this);
|
||||
}
|
||||
|
||||
private class TestGlobalSettings : IGlobalSettings
|
||||
{
|
||||
public string ReservedUrls { get; set; }
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var isDefault = _isDefault ?? false;
|
||||
var isMandatory = _isMandatory ?? false;
|
||||
|
||||
Reset();
|
||||
return new Language(Mock.Of<IGlobalSettings>(), cultureInfo.Name)
|
||||
{
|
||||
Id = _id ?? 1,
|
||||
@@ -82,19 +81,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_createDate = null;
|
||||
_cultureInfo = null;
|
||||
_deleteDate = null;
|
||||
_fallbackLanguageId = null;
|
||||
_id = null;
|
||||
_isDefault = null;
|
||||
_isMandatory = null;
|
||||
_key = null;
|
||||
_updateDate = null;
|
||||
}
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
get => _createDate;
|
||||
|
||||
@@ -95,25 +95,9 @@ namespace Umbraco.Tests.Common.Builders
|
||||
macro.Properties.Add(property);
|
||||
}
|
||||
|
||||
Reset();
|
||||
return macro;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_alias = null;
|
||||
_name = null;
|
||||
_useInEditor = null;
|
||||
_cacheDuration = null;
|
||||
_cacheByPage = null;
|
||||
_cacheByMember = null;
|
||||
_dontRender = null;
|
||||
_macroSource = null;
|
||||
_propertyBuilders = new List<MacroPropertyBuilder>();
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -39,22 +39,9 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var sortOrder = _sortOrder ?? 0;
|
||||
var editorAlias = _editorAlias ?? string.Empty;
|
||||
|
||||
var macroProperty = new MacroProperty(id, key, alias, name, sortOrder, editorAlias);
|
||||
|
||||
Reset();
|
||||
return macroProperty;
|
||||
return new MacroProperty(id, key, alias, name, sortOrder, editorAlias);
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_alias = null;
|
||||
_name = null;
|
||||
_sortOrder = null;
|
||||
_editorAlias = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -161,34 +161,9 @@ namespace Umbraco.Tests.Common.Builders
|
||||
member.ResetDirtyProperties(false);
|
||||
}
|
||||
|
||||
Reset();
|
||||
return member;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_name = null;
|
||||
_creatorId = null;
|
||||
_level = null;
|
||||
_path = null;
|
||||
_username = null;
|
||||
_rawPasswordValue = null;
|
||||
_email = null;
|
||||
_failedPasswordAttempts = null;
|
||||
_isApproved = null;
|
||||
_isLockedOut = null;
|
||||
_lastLockoutDate = null;
|
||||
_lastLoginDate = null;
|
||||
_lastPasswordChangeDate = null;
|
||||
_sortOrder = null;
|
||||
_trashed = null;
|
||||
_propertyIdsIncrementingFrom = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -57,20 +57,9 @@ namespace Umbraco.Tests.Common.Builders
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
return memberGroup;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_name = null;
|
||||
_creatorId = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -134,25 +134,9 @@ namespace Umbraco.Tests.Common.Builders
|
||||
|
||||
memberType.ResetDirtyProperties(false);
|
||||
|
||||
Reset();
|
||||
return memberType;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_alias = null;
|
||||
_name = null;
|
||||
_parentId = null;
|
||||
_sortOrder = null;
|
||||
_creatorId = null;
|
||||
_description = null;
|
||||
_icon = null;
|
||||
_thumbnail = null;
|
||||
_trashed = null;
|
||||
_propertyGroupBuilders.Clear();
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
// Needs to be within collection to support publishing.
|
||||
var propertyTypeCollection = new PropertyTypeCollection(true, new[] { _propertyTypeBuilder.Build() });
|
||||
|
||||
Reset();
|
||||
return new Property(id, propertyTypeCollection[0])
|
||||
{
|
||||
Key = key,
|
||||
@@ -45,14 +44,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -62,7 +62,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
properties.Add(propertyType);
|
||||
}
|
||||
|
||||
Reset();
|
||||
return new PropertyGroup(properties)
|
||||
{
|
||||
Id = id,
|
||||
@@ -74,17 +73,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_name = null;
|
||||
_sortOrder = null;
|
||||
_propertyTypeBuilders.Clear();
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -108,7 +108,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
|
||||
var shortStringHelper = new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
|
||||
Reset();
|
||||
return new PropertyType(shortStringHelper, propertyEditorAlias, valueStorageType)
|
||||
{
|
||||
Id = id,
|
||||
@@ -128,26 +127,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_propertyEditorAlias = null;
|
||||
_valueStorageType = null;
|
||||
_alias = null;
|
||||
_name = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_sortOrder = null;
|
||||
_description = null;
|
||||
_dataTypeId = null;
|
||||
_propertyGroupId = null;
|
||||
_mandatory = null;
|
||||
_mandatoryMessage = null;
|
||||
_validationRegExp = null;
|
||||
_validationRegExpMessage = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
|
||||
var relationType = _relationTypeBuilder.Build();
|
||||
|
||||
Reset();
|
||||
return new Relation(parentId, childId, relationType)
|
||||
{
|
||||
Comment = comment,
|
||||
@@ -69,17 +68,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_parentId = null;
|
||||
_childId = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_comment = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -64,7 +64,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var updateDate = _updateDate ?? DateTime.Now;
|
||||
var deleteDate = _deleteDate ?? null;
|
||||
|
||||
Reset();
|
||||
return new RelationType(name, alias, isBidirectional, parentObjectType, childObjectType)
|
||||
{
|
||||
Id = id,
|
||||
@@ -75,20 +74,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_alias = null;
|
||||
_childObjectType = null;
|
||||
_createDate = null;
|
||||
_deleteDate = null;
|
||||
_id = null;
|
||||
_isBidirectional = null;
|
||||
_key = null;
|
||||
_name = null;
|
||||
_parentObjectType = null;
|
||||
_updateDate = null;
|
||||
}
|
||||
|
||||
string IWithAliasBuilder.Alias
|
||||
{
|
||||
get => _alias;
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var port = _port ?? 25;
|
||||
var pickupDirectoryLocation = _pickupDirectoryLocation ?? null;
|
||||
|
||||
Reset();
|
||||
return new TestSmtpSettings()
|
||||
{
|
||||
From = from,
|
||||
@@ -62,14 +61,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_from = null;
|
||||
_host = null;
|
||||
_port = null;
|
||||
_pickupDirectoryLocation = null;
|
||||
}
|
||||
|
||||
private class TestSmtpSettings : ISmtpSettings
|
||||
{
|
||||
public string From { get; set; }
|
||||
|
||||
@@ -25,17 +25,10 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var path = _path ?? string.Empty;
|
||||
var content = _content ?? string.Empty;
|
||||
|
||||
Reset();
|
||||
return new Stylesheet(path)
|
||||
{
|
||||
Content = content,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_path = null;
|
||||
_content = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
|
||||
var shortStringHelper = new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
|
||||
Reset();
|
||||
return new Template(shortStringHelper, name, alias)
|
||||
{
|
||||
Id = id,
|
||||
@@ -73,21 +72,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_alias = null;
|
||||
_name = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_path = null;
|
||||
_content = null;
|
||||
_isMasterTemplate = null;
|
||||
_masterTemplateAlias = null;
|
||||
_masterTemplateId = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -134,7 +134,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
var startContentIds = _startContentIds ?? new int[0];
|
||||
var startMediaIds = _startMediaIds ?? new int[0];
|
||||
|
||||
Reset();
|
||||
return new User(
|
||||
globalSettings,
|
||||
name,
|
||||
@@ -160,31 +159,6 @@ namespace Umbraco.Tests.Common.Builders
|
||||
};
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_id = null;
|
||||
_key = null;
|
||||
_createDate = null;
|
||||
_updateDate = null;
|
||||
_language = null;
|
||||
_name = null;
|
||||
_username = null;
|
||||
_rawPasswordValue = null;
|
||||
_email = null;
|
||||
_failedPasswordAttempts = null;
|
||||
_isApproved = null;
|
||||
_isLockedOut = null;
|
||||
_lastLockoutDate = null;
|
||||
_lastLoginDate = null;
|
||||
_lastPasswordChangeDate = null;
|
||||
_suffix = string.Empty;
|
||||
_defaultLang = null;
|
||||
_comments = null;
|
||||
_sessionTimeout = null;
|
||||
_startContentIds = null;
|
||||
_startMediaIds = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
|
||||
@@ -68,24 +68,10 @@ namespace Umbraco.Tests.Common.Builders
|
||||
x.Icon == _icon &&
|
||||
x.Permissions == _permissions &&
|
||||
x.AllowedSections == _sectionCollection);
|
||||
Reset();
|
||||
return userGroup;
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
_startContentId = null;
|
||||
_startMediaId = null;
|
||||
_alias = null;
|
||||
_icon = null;
|
||||
_name = null;
|
||||
_permissions = Enumerable.Empty<string>();
|
||||
_sectionCollection = Enumerable.Empty<string>();
|
||||
_suffix = null;
|
||||
_id = null;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
|
||||
[TestFixture]
|
||||
public class PathValidationTests
|
||||
{
|
||||
private readonly EntitySlimBuilder _builder = new EntitySlimBuilder();
|
||||
private EntitySlimBuilder _builder = new EntitySlimBuilder();
|
||||
|
||||
[Test]
|
||||
public void Validate_Path()
|
||||
@@ -93,18 +93,25 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
|
||||
[Test]
|
||||
public void Ensure_Path_Entity_Valid_Recursive_Parent()
|
||||
{
|
||||
// Not using the shared class-level builder as we need to reset after each usage when creating multiple entities.
|
||||
_builder = new EntitySlimBuilder();
|
||||
var parentA = _builder
|
||||
.WithId(999)
|
||||
.Build();
|
||||
|
||||
_builder = new EntitySlimBuilder();
|
||||
var parentB = _builder
|
||||
.WithId(888)
|
||||
.WithParentId(999)
|
||||
.Build();
|
||||
|
||||
_builder = new EntitySlimBuilder();
|
||||
var parentC = _builder
|
||||
.WithId(777)
|
||||
.WithParentId(888)
|
||||
.Build();
|
||||
|
||||
_builder = new EntitySlimBuilder();
|
||||
var entity = _builder
|
||||
.WithId(1234)
|
||||
.WithParentId(777)
|
||||
|
||||
Reference in New Issue
Block a user