Merge pull request #7820 from umbraco/netcore/feature/unit-test-project
NetCore: Introduces a seperate UnitTest project
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class ConnectionStrings : IConnectionStrings
|
||||
public class ConnectionStrings : IConnectionStrings
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
@@ -17,8 +17,43 @@ namespace Umbraco.Configuration.Models
|
||||
|
||||
public ConfigConnectionString this[string key]
|
||||
{
|
||||
get => new ConfigConnectionString(_configuration.GetConnectionString(key), "System.Data.SqlClient", key);
|
||||
get
|
||||
{
|
||||
var connectionString = _configuration.GetConnectionString(key);
|
||||
var provider = ParseProvider(connectionString);
|
||||
return new ConfigConnectionString(connectionString, provider, key);
|
||||
}
|
||||
set => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private string ParseProvider(string connectionString)
|
||||
{
|
||||
if (string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var builder = new DbConnectionStringBuilder();
|
||||
|
||||
builder.ConnectionString = connectionString;
|
||||
|
||||
if (builder.TryGetValue("Data Source", out var ds) && ds is string dataSource)
|
||||
{
|
||||
if (dataSource.EndsWith(".sdf"))
|
||||
{
|
||||
return Constants.DbProviderNames.SqlCe;
|
||||
}
|
||||
}
|
||||
|
||||
if (builder.TryGetValue("Server", out var s) && s is string server && builder.TryGetValue("Database", out var db) && db is string database)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(server) && !string.IsNullOrEmpty(database))
|
||||
{
|
||||
return Constants.DbProviderNames.SqlServer;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentException("Cannot determine provider name from connection string", nameof(connectionString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public abstract class BuilderBase<T>
|
||||
{
|
||||
public abstract T Build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public abstract class ChildBuilderBase<TParent, TType> : BuilderBase<TType>
|
||||
{
|
||||
private readonly TParent _parentBuilder;
|
||||
|
||||
protected ChildBuilderBase(TParent parentBuilder)
|
||||
{
|
||||
_parentBuilder = parentBuilder;
|
||||
}
|
||||
|
||||
|
||||
public TParent Done()
|
||||
{
|
||||
return _parentBuilder;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class ConfigurationEditorBuilder<TParent> : ChildBuilderBase<TParent, IConfigurationEditor>
|
||||
{
|
||||
private IDictionary<string, object> _defaultConfiguration;
|
||||
|
||||
|
||||
public ConfigurationEditorBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public ConfigurationEditorBuilder<TParent> WithDefaultConfiguration(IDictionary<string, object> defaultConfiguration)
|
||||
{
|
||||
_defaultConfiguration = defaultConfiguration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override IConfigurationEditor Build()
|
||||
{
|
||||
var defaultConfiguration = _defaultConfiguration ?? new Dictionary<string, object>();
|
||||
|
||||
return new ConfigurationEditor()
|
||||
{
|
||||
DefaultConfiguration = defaultConfiguration,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class DataEditorBuilder<TParent> : ChildBuilderBase<TParent, IDataEditor>
|
||||
{
|
||||
private readonly ConfigurationEditorBuilder<DataEditorBuilder<TParent>> _explicitConfigurationEditorBuilder;
|
||||
private readonly DataValueEditorBuilder<DataEditorBuilder<TParent>> _explicitValueEditorBuilder;
|
||||
private IDictionary<string, object> _defaultConfiguration;
|
||||
|
||||
public DataEditorBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
_explicitConfigurationEditorBuilder = new ConfigurationEditorBuilder<DataEditorBuilder<TParent>>(this);
|
||||
_explicitValueEditorBuilder = new DataValueEditorBuilder<DataEditorBuilder<TParent>>(this);
|
||||
}
|
||||
|
||||
public DataEditorBuilder<TParent> WithDefaultConfiguration(IDictionary<string, object> defaultConfiguration)
|
||||
{
|
||||
_defaultConfiguration = defaultConfiguration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ConfigurationEditorBuilder<DataEditorBuilder<TParent>> AddExplicitConfigurationEditorBuilder() =>
|
||||
_explicitConfigurationEditorBuilder;
|
||||
|
||||
public DataValueEditorBuilder<DataEditorBuilder<TParent>> AddExplicitValueEditorBuilder() =>
|
||||
_explicitValueEditorBuilder;
|
||||
|
||||
public override IDataEditor Build()
|
||||
{
|
||||
var defaultConfiguration = _defaultConfiguration ?? new Dictionary<string, object>();
|
||||
var explicitConfigurationEditor = _explicitConfigurationEditorBuilder.Build();
|
||||
var explicitValueEditor = _explicitValueEditorBuilder.Build();
|
||||
|
||||
return new DataEditor(
|
||||
Mock.Of<ILogger>(),
|
||||
Mock.Of<IDataTypeService>(),
|
||||
Mock.Of<ILocalizationService>(),
|
||||
Mock.Of<ILocalizedTextService>(),
|
||||
Mock.Of<IShortStringHelper>()
|
||||
)
|
||||
{
|
||||
DefaultConfiguration = defaultConfiguration,
|
||||
ExplicitConfigurationEditor = explicitConfigurationEditor,
|
||||
ExplicitValueEditor = explicitValueEditor
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders.Interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class DataTypeBuilder
|
||||
: BuilderBase<DataType>,
|
||||
IWithIdBuilder,
|
||||
IWithKeyBuilder,
|
||||
IWithCreateDateBuilder,
|
||||
IWithUpdateDateBuilder,
|
||||
IWithDeleteDateBuilder,
|
||||
IWithNameBuilder
|
||||
{
|
||||
private readonly DataEditorBuilder<DataTypeBuilder> _dataEditorBuilder;
|
||||
private int? _id;
|
||||
private int? _parentId;
|
||||
private Guid? _key;
|
||||
private DateTime? _createDate;
|
||||
private DateTime? _updateDate;
|
||||
private DateTime? _deleteDate;
|
||||
private string _name;
|
||||
private bool? _trashed;
|
||||
// private object _configuration;
|
||||
private int? _level;
|
||||
private string _path;
|
||||
private int? _creatorId;
|
||||
private ValueStorageType? _databaseType;
|
||||
private int? _sortOrder;
|
||||
|
||||
public DataTypeBuilder()
|
||||
{
|
||||
_dataEditorBuilder = new DataEditorBuilder<DataTypeBuilder>(this);
|
||||
}
|
||||
|
||||
public DataTypeBuilder WithParentId(int parentId)
|
||||
{
|
||||
_parentId = parentId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataTypeBuilder WithTrashed(bool trashed)
|
||||
{
|
||||
_trashed = trashed;
|
||||
return this;
|
||||
}
|
||||
|
||||
// public DataTypeBuilder WithConfiguration(object configuration)
|
||||
// {
|
||||
// _configuration = configuration;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public DataTypeBuilder WithLevel(int level)
|
||||
{
|
||||
_level = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataTypeBuilder WithPath(string path)
|
||||
{
|
||||
_path = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataTypeBuilder WithCreatorId(int creatorId)
|
||||
{
|
||||
_creatorId = creatorId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataTypeBuilder WithDatabaseType(ValueStorageType databaseType)
|
||||
{
|
||||
_databaseType = databaseType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataTypeBuilder WithSortOrder(int sortOrder)
|
||||
{
|
||||
_sortOrder = sortOrder;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataEditorBuilder<DataTypeBuilder> AddEditor()
|
||||
{
|
||||
return _dataEditorBuilder;
|
||||
}
|
||||
|
||||
public override DataType Build()
|
||||
{
|
||||
var editor = _dataEditorBuilder.Build();
|
||||
var parentId = _parentId ?? -1;
|
||||
var id = _id ?? 1;
|
||||
var key = _key ?? Guid.NewGuid();
|
||||
var createDate = _createDate ?? DateTime.Now;
|
||||
var updateDate = _updateDate ?? DateTime.Now;
|
||||
var deleteDate = _deleteDate ?? null;
|
||||
var name = _name ?? Guid.NewGuid().ToString();
|
||||
// var configuration = _configuration ?? editor.GetConfigurationEditor().DefaultConfigurationObject;
|
||||
var level = _level ?? 0;
|
||||
var path = _path ?? string.Empty;
|
||||
var creatorId = _creatorId ?? 1;
|
||||
var databaseType = _databaseType ?? ValueStorageType.Ntext;
|
||||
var sortOrder = _sortOrder ?? 0;
|
||||
|
||||
return new DataType(editor, parentId)
|
||||
{
|
||||
Id = id,
|
||||
Key = key,
|
||||
CreateDate = createDate,
|
||||
UpdateDate = updateDate,
|
||||
DeleteDate = deleteDate,
|
||||
Name = name,
|
||||
Trashed = _trashed ?? false,
|
||||
Level = level,
|
||||
Path = path,
|
||||
CreatorId = creatorId,
|
||||
DatabaseType = databaseType,
|
||||
SortOrder = sortOrder,
|
||||
};
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
}
|
||||
|
||||
Guid? IWithKeyBuilder.Key
|
||||
{
|
||||
get => _key;
|
||||
set => _key = value;
|
||||
}
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
get => _createDate;
|
||||
set => _createDate = value;
|
||||
}
|
||||
|
||||
DateTime? IWithUpdateDateBuilder.UpdateDate
|
||||
{
|
||||
get => _updateDate;
|
||||
set => _updateDate = value;
|
||||
}
|
||||
|
||||
DateTime? IWithDeleteDateBuilder.DeleteDate
|
||||
{
|
||||
get => _deleteDate;
|
||||
set => _deleteDate = value;
|
||||
}
|
||||
|
||||
string IWithNameBuilder.Name
|
||||
{
|
||||
get => _name;
|
||||
set => _name = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using Moq;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
|
||||
namespace Umbraco.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<IDataTypeService>(),
|
||||
Mock.Of<ILocalizationService>(),
|
||||
Mock.Of<ILocalizedTextService>(),
|
||||
Mock.Of<IShortStringHelper>()
|
||||
)
|
||||
{
|
||||
Configuration = configuration,
|
||||
View = view,
|
||||
HideLabel = hideLabel,
|
||||
ValueType = valueType,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders.Interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class DictionaryItemBuilder
|
||||
: BuilderBase<DictionaryItem>,
|
||||
IWithIdBuilder,
|
||||
IWithCreateDateBuilder,
|
||||
IWithUpdateDateBuilder,
|
||||
IWithDeleteDateBuilder,
|
||||
IWithKeyBuilder
|
||||
{
|
||||
private readonly List<DictionaryTranslationBuilder> _translationBuilders =
|
||||
new List<DictionaryTranslationBuilder>();
|
||||
|
||||
private DateTime? _createDate;
|
||||
private DateTime? _deleteDate;
|
||||
private int? _id;
|
||||
private string _itemKey;
|
||||
private Guid? _key;
|
||||
private Guid? _parentId;
|
||||
private DateTime? _updateDate;
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
get => _createDate;
|
||||
set => _createDate = value;
|
||||
}
|
||||
|
||||
DateTime? IWithDeleteDateBuilder.DeleteDate
|
||||
{
|
||||
get => _deleteDate;
|
||||
set => _deleteDate = value;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
}
|
||||
|
||||
Guid? IWithKeyBuilder.Key
|
||||
{
|
||||
get => _key;
|
||||
set => _key = value;
|
||||
}
|
||||
|
||||
DateTime? IWithUpdateDateBuilder.UpdateDate
|
||||
{
|
||||
get => _updateDate;
|
||||
set => _updateDate = value;
|
||||
}
|
||||
|
||||
public override DictionaryItem Build()
|
||||
{
|
||||
var createDate = _createDate ?? DateTime.Now;
|
||||
var updateDate = _updateDate ?? DateTime.Now;
|
||||
var deleteDate = _deleteDate ?? null;
|
||||
var id = _id ?? 1;
|
||||
var key = _key ?? Guid.NewGuid();
|
||||
var parentId = _parentId ?? null;
|
||||
var itemKey = _itemKey ?? Guid.NewGuid().ToString();
|
||||
|
||||
var result = new DictionaryItem(itemKey)
|
||||
{
|
||||
Translations = _translationBuilders.Select(x => x.Build()),
|
||||
CreateDate = createDate,
|
||||
UpdateDate = updateDate,
|
||||
DeleteDate = deleteDate,
|
||||
Id = id,
|
||||
ParentId = parentId,
|
||||
Key = key,
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
public DictionaryItemBuilder WithParentId(Guid parentId)
|
||||
{
|
||||
_parentId = parentId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryItemBuilder WithItemKey(string itemKey)
|
||||
{
|
||||
_itemKey = itemKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryTranslationBuilder AddTranslation()
|
||||
{
|
||||
var builder = new DictionaryTranslationBuilder(this);
|
||||
|
||||
_translationBuilders.Add(builder);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
public DictionaryItemBuilder WithRandomTranslations(int count)
|
||||
{
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
AddTranslation().Done();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders.Interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class DictionaryTranslationBuilder
|
||||
: ChildBuilderBase<DictionaryItemBuilder, IDictionaryTranslation>,
|
||||
IWithIdBuilder,
|
||||
IWithCreateDateBuilder,
|
||||
IWithUpdateDateBuilder,
|
||||
IWithDeleteDateBuilder,
|
||||
IWithKeyBuilder
|
||||
{
|
||||
private readonly LanguageBuilder<DictionaryTranslationBuilder> _languageBuilder;
|
||||
private readonly Guid? _uniqueId = null;
|
||||
private DateTime? _createDate;
|
||||
private DateTime? _deleteDate;
|
||||
private int? _id;
|
||||
private Guid? _key;
|
||||
private DateTime? _updateDate;
|
||||
private string _value;
|
||||
|
||||
|
||||
public DictionaryTranslationBuilder(DictionaryItemBuilder parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
_languageBuilder = new LanguageBuilder<DictionaryTranslationBuilder>(this);
|
||||
}
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
get => _createDate;
|
||||
set => _createDate = value;
|
||||
}
|
||||
|
||||
DateTime? IWithDeleteDateBuilder.DeleteDate
|
||||
{
|
||||
get => _deleteDate;
|
||||
set => _deleteDate = value;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
}
|
||||
|
||||
Guid? IWithKeyBuilder.Key
|
||||
{
|
||||
get => _key;
|
||||
set => _key = value;
|
||||
}
|
||||
|
||||
DateTime? IWithUpdateDateBuilder.UpdateDate
|
||||
{
|
||||
get => _updateDate;
|
||||
set => _updateDate = value;
|
||||
}
|
||||
|
||||
public override IDictionaryTranslation Build()
|
||||
{
|
||||
var createDate = _createDate ?? DateTime.Now;
|
||||
var updateDate = _updateDate ?? DateTime.Now;
|
||||
var deleteDate = _deleteDate ?? null;
|
||||
var id = _id ?? 1;
|
||||
var key = _key ?? Guid.NewGuid();
|
||||
|
||||
var result = new DictionaryTranslation(
|
||||
_languageBuilder.Build(),
|
||||
_value ?? Guid.NewGuid().ToString(),
|
||||
_uniqueId ?? key)
|
||||
{
|
||||
CreateDate = createDate,
|
||||
UpdateDate = updateDate,
|
||||
DeleteDate = deleteDate,
|
||||
Id = id
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public LanguageBuilder<DictionaryTranslationBuilder> AddLanguage() => _languageBuilder;
|
||||
|
||||
public DictionaryTranslationBuilder WithValue(string value)
|
||||
{
|
||||
_value = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using Umbraco.Tests.Common.Builders.Interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders.Extensions
|
||||
{
|
||||
public static class BuilderExtensions
|
||||
{
|
||||
public static T WithId<T>(this T builder, int id)
|
||||
where T : IWithIdBuilder
|
||||
{
|
||||
builder.Id = id;
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static T WithCreateDate<T>(this T builder, DateTime createDate)
|
||||
where T : IWithCreateDateBuilder
|
||||
{
|
||||
builder.CreateDate = createDate;
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static T WithUpdateDate<T>(this T builder, DateTime updateDate)
|
||||
where T : IWithUpdateDateBuilder
|
||||
{
|
||||
builder.UpdateDate = updateDate;
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static T WithAlias<T>(this T builder, string alias)
|
||||
where T : IWithAliasBuilder
|
||||
{
|
||||
builder.Alias = alias;
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static T WithName<T>(this T builder, string name)
|
||||
where T : IWithNameBuilder
|
||||
{
|
||||
builder.Name = name;
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static T WithKey<T>(this T builder, Guid key)
|
||||
where T : IWithKeyBuilder
|
||||
{
|
||||
builder.Key = key;
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class GlobalSettingsBuilder : GlobalSettingsBuilder<object>
|
||||
{
|
||||
public GlobalSettingsBuilder() : base(null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class GlobalSettingsBuilder<TParent> : ChildBuilderBase<TParent, IGlobalSettings>
|
||||
{
|
||||
private string _configurationStatus;
|
||||
private string _databaseFactoryServerVersion;
|
||||
private string _defaultUiLanguage;
|
||||
private bool? _disableElectionForSingleServer;
|
||||
private bool? _hideTopLevelNodeFromPath;
|
||||
private bool? _installEmptyDatabase;
|
||||
private bool? _installMissingDatabase;
|
||||
private bool? _isSmtpServerConfigured;
|
||||
private string _path;
|
||||
private string _registerType;
|
||||
private string _reservedPaths;
|
||||
private string _reservedUrls;
|
||||
private int? _timeOutInMinutes;
|
||||
private string _umbracoCssPath;
|
||||
private string _umbracoMediaPath;
|
||||
private string _umbracoPath;
|
||||
private string _umbracoScriptsPath;
|
||||
private string _mainDomLock;
|
||||
private string _noNodesViewPath;
|
||||
private bool? _useHttps;
|
||||
private int? _versionCheckPeriod;
|
||||
private readonly SmtpSettingsBuilder<GlobalSettingsBuilder<TParent>> _smtpSettingsBuilder;
|
||||
|
||||
|
||||
public GlobalSettingsBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
_smtpSettingsBuilder = new SmtpSettingsBuilder<GlobalSettingsBuilder<TParent>>(this);
|
||||
}
|
||||
|
||||
public SmtpSettingsBuilder<GlobalSettingsBuilder<TParent>> AddSmtpSettings() => _smtpSettingsBuilder;
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithConfigurationStatus(string configurationStatus)
|
||||
{
|
||||
_configurationStatus = configurationStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithDatabaseFactoryServerVersion(string databaseFactoryServerVersion)
|
||||
{
|
||||
_databaseFactoryServerVersion = databaseFactoryServerVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithDefaultUiLanguage(string defaultUiLanguage)
|
||||
{
|
||||
_defaultUiLanguage = defaultUiLanguage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithDisableElectionForSingleServer(bool disableElectionForSingleServer)
|
||||
{
|
||||
_disableElectionForSingleServer = disableElectionForSingleServer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithHideTopLevelNodeFromPath(bool hideTopLevelNodeFromPath)
|
||||
{
|
||||
_hideTopLevelNodeFromPath = hideTopLevelNodeFromPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithInstallEmptyDatabase(bool installEmptyDatabase)
|
||||
{
|
||||
_installEmptyDatabase = installEmptyDatabase;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithInstallMissingDatabase(bool installMissingDatabase)
|
||||
{
|
||||
_installMissingDatabase = installMissingDatabase;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithIsSmtpServerConfigured(bool isSmtpServerConfigured)
|
||||
{
|
||||
_isSmtpServerConfigured = isSmtpServerConfigured;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithPath(string path)
|
||||
{
|
||||
_path = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithRegisterType(string registerType)
|
||||
{
|
||||
_registerType = registerType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithReservedPaths(string reservedPaths)
|
||||
{
|
||||
_reservedPaths = reservedPaths;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithReservedUrls(string reservedUrls)
|
||||
{
|
||||
_reservedUrls = reservedUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithUmbracoPath(string umbracoPath)
|
||||
{
|
||||
_umbracoPath = umbracoPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithUseHttps(bool useHttps)
|
||||
{
|
||||
_useHttps = useHttps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithUmbracoCssPath(string umbracoCssPath)
|
||||
{
|
||||
_umbracoCssPath = umbracoCssPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithUmbracoMediaPath(string umbracoMediaPath)
|
||||
{
|
||||
_umbracoMediaPath = umbracoMediaPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithUmbracoScriptsPath(string umbracoScriptsPath)
|
||||
{
|
||||
_umbracoScriptsPath = umbracoScriptsPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithMainDomLock(string mainDomLock)
|
||||
{
|
||||
_mainDomLock = mainDomLock;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithNoNodesViewPath(string noNodesViewPath)
|
||||
{
|
||||
_noNodesViewPath = noNodesViewPath;
|
||||
return this;
|
||||
}
|
||||
public GlobalSettingsBuilder<TParent> WithVersionCheckPeriod(int versionCheckPeriod)
|
||||
{
|
||||
_versionCheckPeriod = versionCheckPeriod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalSettingsBuilder<TParent> WithTimeOutInMinutes(int timeOutInMinutes)
|
||||
{
|
||||
_timeOutInMinutes = timeOutInMinutes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override IGlobalSettings Build()
|
||||
{
|
||||
var configurationStatus = _configurationStatus ?? "9.0.0";
|
||||
var databaseFactoryServerVersion = _databaseFactoryServerVersion ?? null;
|
||||
var defaultUiLanguage = _defaultUiLanguage ?? "en";
|
||||
var disableElectionForSingleServer = _disableElectionForSingleServer ?? false;
|
||||
var hideTopLevelNodeFromPath = _hideTopLevelNodeFromPath ?? false;
|
||||
var installEmptyDatabase = _installEmptyDatabase ?? false;
|
||||
var installMissingDatabase = _installMissingDatabase ?? false;
|
||||
var isSmtpServerConfigured = _isSmtpServerConfigured ?? false;
|
||||
var path = _path ?? "/umbraco";
|
||||
var registerType = _registerType ?? null;
|
||||
var reservedPaths = _reservedPaths ?? "~/app_plugins/,~/install/,~/mini-profiler-resources/,";
|
||||
var reservedUrls = _reservedUrls ?? "~/config/splashes/noNodes.aspx,~/.well-known,";
|
||||
var umbracoPath = _umbracoPath ?? "~/umbraco";
|
||||
var useHttps = _useHttps ?? false;
|
||||
var umbracoCssPath = _umbracoCssPath ?? "~/css";
|
||||
var umbracoMediaPath = _umbracoMediaPath ?? "~/media";
|
||||
var umbracoScriptsPath = _umbracoScriptsPath ?? "~/scripts";
|
||||
var versionCheckPeriod = _versionCheckPeriod ?? 0;
|
||||
var timeOutInMinutes = _timeOutInMinutes ?? 20;
|
||||
var smtpSettings = _smtpSettingsBuilder.Build();
|
||||
var mainDomLock = _mainDomLock ?? string.Empty;
|
||||
var noNodesViewPath = _noNodesViewPath ?? "~/config/splashes/NoNodes.cshtml";
|
||||
|
||||
|
||||
return new TestGlobalSettings
|
||||
{
|
||||
ConfigurationStatus = configurationStatus,
|
||||
DatabaseFactoryServerVersion = databaseFactoryServerVersion,
|
||||
DefaultUILanguage = defaultUiLanguage,
|
||||
DisableElectionForSingleServer = disableElectionForSingleServer,
|
||||
HideTopLevelNodeFromPath = hideTopLevelNodeFromPath,
|
||||
InstallEmptyDatabase = installEmptyDatabase,
|
||||
InstallMissingDatabase = installMissingDatabase,
|
||||
IsSmtpServerConfigured = isSmtpServerConfigured,
|
||||
Path = path,
|
||||
RegisterType = registerType,
|
||||
ReservedPaths = reservedPaths,
|
||||
ReservedUrls = reservedUrls,
|
||||
UmbracoPath = umbracoPath,
|
||||
UseHttps = useHttps,
|
||||
UmbracoCssPath = umbracoCssPath,
|
||||
UmbracoMediaPath = umbracoMediaPath,
|
||||
UmbracoScriptsPath = umbracoScriptsPath,
|
||||
VersionCheckPeriod = versionCheckPeriod,
|
||||
TimeOutInMinutes = timeOutInMinutes,
|
||||
SmtpSettings = smtpSettings,
|
||||
MainDomLock = mainDomLock,
|
||||
NoNodesViewPath = noNodesViewPath,
|
||||
};
|
||||
}
|
||||
|
||||
private class TestGlobalSettings : IGlobalSettings
|
||||
{
|
||||
public string ReservedUrls { get; set; }
|
||||
public string ReservedPaths { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string ConfigurationStatus { get; set; }
|
||||
public int TimeOutInMinutes { get; set; }
|
||||
public string DefaultUILanguage { get; set; }
|
||||
public bool HideTopLevelNodeFromPath { get; set; }
|
||||
public bool UseHttps { get; set; }
|
||||
public int VersionCheckPeriod { get; set; }
|
||||
public string UmbracoPath { get; set; }
|
||||
public string UmbracoCssPath { get; set; }
|
||||
public string UmbracoScriptsPath { get; set; }
|
||||
public string UmbracoMediaPath { get; set; }
|
||||
public bool IsSmtpServerConfigured { get; set; }
|
||||
public ISmtpSettings SmtpSettings { get; set; }
|
||||
public bool InstallMissingDatabase { get; set; }
|
||||
public bool InstallEmptyDatabase { get; set; }
|
||||
public bool DisableElectionForSingleServer { get; set; }
|
||||
public string RegisterType { get; set; }
|
||||
public string DatabaseFactoryServerVersion { get; set; }
|
||||
public string MainDomLock { get; set; }
|
||||
public string NoNodesViewPath { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithAliasBuilder
|
||||
{
|
||||
string Alias { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithCreateDateBuilder
|
||||
{
|
||||
DateTime? CreateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithCultureInfoBuilder
|
||||
{
|
||||
CultureInfo CultureInfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithDeleteDateBuilder
|
||||
{
|
||||
DateTime? DeleteDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithIdBuilder
|
||||
{
|
||||
int? Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithKeyBuilder
|
||||
{
|
||||
Guid? Key { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithNameBuilder
|
||||
{
|
||||
string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders.Interfaces
|
||||
{
|
||||
public interface IWithUpdateDateBuilder
|
||||
{
|
||||
DateTime? UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Moq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders.Interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class LanguageBuilder : LanguageBuilder<object>
|
||||
{
|
||||
public LanguageBuilder() : base(null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class LanguageBuilder<TParent>
|
||||
: ChildBuilderBase<TParent, ILanguage>,
|
||||
IWithIdBuilder,
|
||||
IWithKeyBuilder,
|
||||
IWithCreateDateBuilder,
|
||||
IWithUpdateDateBuilder,
|
||||
IWithDeleteDateBuilder,
|
||||
IWithCultureInfoBuilder
|
||||
{
|
||||
private DateTime? _createDate;
|
||||
private CultureInfo _cultureInfo;
|
||||
private DateTime? _deleteDate;
|
||||
private int? _fallbackLanguageId;
|
||||
private int? _id;
|
||||
private bool? _isDefault;
|
||||
private bool? _isMandatory;
|
||||
private Guid? _key;
|
||||
private DateTime? _updateDate;
|
||||
|
||||
public LanguageBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
get => _createDate;
|
||||
set => _createDate = value;
|
||||
}
|
||||
|
||||
CultureInfo IWithCultureInfoBuilder.CultureInfo
|
||||
{
|
||||
get => _cultureInfo;
|
||||
set => _cultureInfo = value;
|
||||
}
|
||||
|
||||
DateTime? IWithDeleteDateBuilder.DeleteDate
|
||||
{
|
||||
get => _deleteDate;
|
||||
set => _deleteDate = value;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
}
|
||||
|
||||
Guid? IWithKeyBuilder.Key
|
||||
{
|
||||
get => _key;
|
||||
set => _key = value;
|
||||
}
|
||||
|
||||
DateTime? IWithUpdateDateBuilder.UpdateDate
|
||||
{
|
||||
get => _updateDate;
|
||||
set => _updateDate = value;
|
||||
}
|
||||
|
||||
public override ILanguage Build()
|
||||
{
|
||||
var cultureInfo = _cultureInfo ?? CultureInfo.GetCultureInfo("en-US");
|
||||
var key = _key ?? Guid.NewGuid();
|
||||
var createDate = _createDate ?? DateTime.Now;
|
||||
var updateDate = _updateDate ?? DateTime.Now;
|
||||
var deleteDate = _deleteDate ?? null;
|
||||
var fallbackLanguageId = _fallbackLanguageId ?? null;
|
||||
var isDefault = _isDefault ?? false;
|
||||
var isMandatory = _isMandatory ?? false;
|
||||
|
||||
return new Language(Mock.Of<IGlobalSettings>(), cultureInfo.Name)
|
||||
{
|
||||
Id = _id ?? 1,
|
||||
CultureName = cultureInfo.TwoLetterISOLanguageName,
|
||||
IsoCode = new RegionInfo(cultureInfo.LCID).Name,
|
||||
Key = key,
|
||||
CreateDate = createDate,
|
||||
UpdateDate = updateDate,
|
||||
DeleteDate = deleteDate,
|
||||
IsDefault = isDefault,
|
||||
IsMandatory = isMandatory,
|
||||
FallbackLanguageId = fallbackLanguageId
|
||||
};
|
||||
}
|
||||
|
||||
public LanguageBuilder<TParent> WithIsDefault(bool isDefault)
|
||||
{
|
||||
_isDefault = isDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LanguageBuilder<TParent> WithIsMandatory(bool isMandatory)
|
||||
{
|
||||
_isMandatory = isMandatory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LanguageBuilder<TParent> WithFallbackLanguageId(int fallbackLanguageId)
|
||||
{
|
||||
_fallbackLanguageId = fallbackLanguageId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders.Interfaces;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class RelationTypeBuilder : RelationTypeBuilder<object>
|
||||
{
|
||||
public RelationTypeBuilder() : base(null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class RelationTypeBuilder<TParent>
|
||||
: ChildBuilderBase<TParent, IRelationType>,
|
||||
IWithIdBuilder,
|
||||
IWithAliasBuilder,
|
||||
IWithNameBuilder,
|
||||
IWithKeyBuilder,
|
||||
IWithCreateDateBuilder,
|
||||
IWithUpdateDateBuilder,
|
||||
IWithDeleteDateBuilder
|
||||
{
|
||||
private string _alias;
|
||||
private Guid? _childObjectType;
|
||||
private DateTime? _createDate;
|
||||
private DateTime? _deleteDate;
|
||||
private int? _id;
|
||||
private bool? _isBidirectional;
|
||||
private Guid? _key;
|
||||
private string _name;
|
||||
private Guid? _parentObjectType;
|
||||
private DateTime? _updateDate;
|
||||
|
||||
public RelationTypeBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
string IWithAliasBuilder.Alias
|
||||
{
|
||||
get => _alias;
|
||||
set => _alias = value;
|
||||
}
|
||||
|
||||
DateTime? IWithCreateDateBuilder.CreateDate
|
||||
{
|
||||
get => _createDate;
|
||||
set => _createDate = value;
|
||||
}
|
||||
|
||||
DateTime? IWithDeleteDateBuilder.DeleteDate
|
||||
{
|
||||
get => _deleteDate;
|
||||
set => _deleteDate = value;
|
||||
}
|
||||
|
||||
int? IWithIdBuilder.Id
|
||||
{
|
||||
get => _id;
|
||||
set => _id = value;
|
||||
}
|
||||
|
||||
Guid? IWithKeyBuilder.Key
|
||||
{
|
||||
get => _key;
|
||||
set => _key = value;
|
||||
}
|
||||
|
||||
string IWithNameBuilder.Name
|
||||
{
|
||||
get => _name;
|
||||
set => _name = value;
|
||||
}
|
||||
|
||||
DateTime? IWithUpdateDateBuilder.UpdateDate
|
||||
{
|
||||
get => _updateDate;
|
||||
set => _updateDate = value;
|
||||
}
|
||||
|
||||
public override IRelationType Build()
|
||||
{
|
||||
var alias = _alias ?? Guid.NewGuid().ToString();
|
||||
var name = _name ?? Guid.NewGuid().ToString();
|
||||
var parentObjectType = _parentObjectType ?? null;
|
||||
var childObjectType = _childObjectType ?? null;
|
||||
var id = _id ?? 1;
|
||||
var key = _key ?? Guid.NewGuid();
|
||||
var isBidirectional = _isBidirectional ?? false;
|
||||
var createDate = _createDate ?? DateTime.Now;
|
||||
var updateDate = _updateDate ?? DateTime.Now;
|
||||
var deleteDate = _deleteDate ?? null;
|
||||
|
||||
return new RelationType(name, alias, isBidirectional, parentObjectType,
|
||||
childObjectType)
|
||||
{
|
||||
Id = id,
|
||||
Key = key,
|
||||
CreateDate = createDate,
|
||||
UpdateDate = updateDate,
|
||||
DeleteDate = deleteDate
|
||||
};
|
||||
}
|
||||
|
||||
public RelationTypeBuilder<TParent> WithIsBidirectional(bool isBidirectional)
|
||||
{
|
||||
_isBidirectional = isBidirectional;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RelationTypeBuilder<TParent> WithChildObjectType(Guid childObjectType)
|
||||
{
|
||||
_childObjectType = childObjectType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RelationTypeBuilder<TParent> WithParentObjectType(Guid parentObjectType)
|
||||
{
|
||||
_parentObjectType = parentObjectType;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Tests.Common.Builders
|
||||
{
|
||||
public class SmtpSettingsBuilder : SmtpSettingsBuilder<object>
|
||||
{
|
||||
public SmtpSettingsBuilder() : base(null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SmtpSettingsBuilder<TParent>
|
||||
: ChildBuilderBase<TParent, ISmtpSettings>
|
||||
{
|
||||
private string _from;
|
||||
private string _host;
|
||||
private int? _port;
|
||||
private string _pickupDirectoryLocation;
|
||||
|
||||
public SmtpSettingsBuilder(TParent parentBuilder) : base(parentBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
public SmtpSettingsBuilder<TParent> WithFrom(string from)
|
||||
{
|
||||
_from = from;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SmtpSettingsBuilder<TParent> WithHost(string host)
|
||||
{
|
||||
_host = host;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SmtpSettingsBuilder<TParent> WithPost(int port)
|
||||
{
|
||||
_port = port;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SmtpSettingsBuilder<TParent> WithPickupDirectoryLocation(string pickupDirectoryLocation)
|
||||
{
|
||||
_pickupDirectoryLocation = pickupDirectoryLocation;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public override ISmtpSettings Build()
|
||||
{
|
||||
var from = _from ?? null;
|
||||
var host = _host ?? null;
|
||||
var port = _port ?? 25;
|
||||
var pickupDirectoryLocation = _pickupDirectoryLocation ?? null;
|
||||
|
||||
return new TestSmtpSettings()
|
||||
{
|
||||
From = from,
|
||||
Host = host,
|
||||
Port = port,
|
||||
PickupDirectoryLocation = pickupDirectoryLocation,
|
||||
};
|
||||
}
|
||||
|
||||
private class TestSmtpSettings : ISmtpSettings
|
||||
{
|
||||
public string From { get; set; }
|
||||
public string Host { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string PickupDirectoryLocation { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Abstractions\Umbraco.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Configuration\Umbraco.Configuration.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Faker.Net" Version="1.1.1" />
|
||||
<PackageReference Include="Moq" Version="4.13.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,39 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Configuration.Models;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.Models
|
||||
{
|
||||
public class ConnectionStringsTests
|
||||
{
|
||||
[Test]
|
||||
[TestCase("", ExpectedResult = null)]
|
||||
[TestCase(null, ExpectedResult = null)]
|
||||
[TestCase(@"Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;", ExpectedResult = Constants.DbProviderNames.SqlCe)]
|
||||
[TestCase(@"Server=(LocalDb)\Umbraco;Database=NetCore;Integrated Security=true", ExpectedResult = Constants.DbProviderNames.SqlServer)]
|
||||
public string ParseProviderName(string connectionString)
|
||||
{
|
||||
var key = Constants.System.UmbracoConnectionName;
|
||||
var configuration = new Mock<IConfiguration>();
|
||||
|
||||
|
||||
//This is the underlying method that is called by Configuration.GetConnectionString(string)
|
||||
if (connectionString != null)
|
||||
{
|
||||
configuration.Setup(x => x.GetSection("ConnectionStrings")[key]).Returns(connectionString);
|
||||
}
|
||||
|
||||
|
||||
var connectionStrings = new ConnectionStrings(configuration.Object);
|
||||
|
||||
var actual = connectionStrings[key];
|
||||
|
||||
Assert.AreEqual(connectionString, actual.ConnectionString);
|
||||
Assert.AreEqual(key, actual.Name);
|
||||
|
||||
return connectionStrings[key].ProviderName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders;
|
||||
using Umbraco.Tests.Common.Builders.Extensions;
|
||||
|
||||
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class DataTypeTests
|
||||
{
|
||||
|
||||
private readonly DataTypeBuilder _builder = new DataTypeBuilder();
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var dtd = _builder
|
||||
.WithId(3123)
|
||||
.Build();
|
||||
|
||||
var clone = (DataType) dtd.DeepClone();
|
||||
|
||||
Assert.AreNotSame(clone, dtd);
|
||||
Assert.AreEqual(clone, dtd);
|
||||
Assert.AreEqual(clone.CreateDate, dtd.CreateDate);
|
||||
Assert.AreEqual(clone.CreatorId, dtd.CreatorId);
|
||||
Assert.AreEqual(clone.DatabaseType, dtd.DatabaseType);
|
||||
Assert.AreEqual(clone.Id, dtd.Id);
|
||||
Assert.AreEqual(clone.Key, dtd.Key);
|
||||
Assert.AreEqual(clone.Level, dtd.Level);
|
||||
Assert.AreEqual(clone.Name, dtd.Name);
|
||||
Assert.AreEqual(clone.ParentId, dtd.ParentId);
|
||||
Assert.AreEqual(clone.Path, dtd.Path);
|
||||
Assert.AreEqual(clone.SortOrder, dtd.SortOrder);
|
||||
Assert.AreEqual(clone.Trashed, dtd.Trashed);
|
||||
Assert.AreEqual(clone.UpdateDate, dtd.UpdateDate);
|
||||
|
||||
//This double verifies by reflection
|
||||
var allProps = clone.GetType().GetProperties();
|
||||
foreach (var propertyInfo in allProps)
|
||||
{
|
||||
Assert.AreEqual(propertyInfo.GetValue(clone, null), propertyInfo.GetValue(dtd, null));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Serialize_Without_Error()
|
||||
{
|
||||
var item = _builder.Build();
|
||||
|
||||
Assert.DoesNotThrow(() => JsonConvert.SerializeObject(item));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Tests.Common.Builders;
|
||||
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class DictionaryItemTests
|
||||
{
|
||||
private readonly DictionaryItemBuilder _builder = new DictionaryItemBuilder();
|
||||
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var item = _builder
|
||||
.WithRandomTranslations(2)
|
||||
.Build();
|
||||
|
||||
var clone = (DictionaryItem)item.DeepClone();
|
||||
|
||||
Assert.AreNotSame(clone, item);
|
||||
Assert.AreEqual(clone, item);
|
||||
Assert.AreEqual(clone.CreateDate, item.CreateDate);
|
||||
Assert.AreEqual(clone.Id, item.Id);
|
||||
Assert.AreEqual(clone.ItemKey, item.ItemKey);
|
||||
Assert.AreEqual(clone.Key, item.Key);
|
||||
Assert.AreEqual(clone.ParentId, item.ParentId);
|
||||
Assert.AreEqual(clone.UpdateDate, item.UpdateDate);
|
||||
Assert.AreEqual(clone.Translations.Count(), item.Translations.Count());
|
||||
for (var i = 0; i < item.Translations.Count(); i++)
|
||||
{
|
||||
Assert.AreNotSame(clone.Translations.ElementAt(i), item.Translations.ElementAt(i));
|
||||
Assert.AreEqual(clone.Translations.ElementAt(i), item.Translations.ElementAt(i));
|
||||
}
|
||||
|
||||
//This double verifies by reflection
|
||||
var allProps = clone.GetType().GetProperties();
|
||||
foreach (var propertyInfo in allProps)
|
||||
{
|
||||
Assert.AreEqual(propertyInfo.GetValue(clone, null), propertyInfo.GetValue(item, null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Serialize_Without_Error()
|
||||
{
|
||||
var item = _builder
|
||||
.WithRandomTranslations(2)
|
||||
.Build();
|
||||
|
||||
Assert.DoesNotThrow(() => JsonConvert.SerializeObject(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-29
@@ -1,32 +1,19 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Common.Builders;
|
||||
|
||||
namespace Umbraco.Tests.Models
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class LanguageTests
|
||||
{
|
||||
private IGlobalSettings GlobalSettings { get; } = SettingsForTests.GenerateMockGlobalSettings();
|
||||
private readonly LanguageBuilder _builder = new LanguageBuilder();
|
||||
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var item = new Language(GlobalSettings, "en-AU")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CultureName = "AU",
|
||||
Id = 11,
|
||||
IsoCode = "en",
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
};
|
||||
var item = _builder.Build();
|
||||
|
||||
var clone = (Language) item.DeepClone();
|
||||
Assert.AreNotSame(clone, item);
|
||||
@@ -49,18 +36,9 @@ namespace Umbraco.Tests.Models
|
||||
[Test]
|
||||
public void Can_Serialize_Without_Error()
|
||||
{
|
||||
var item = new Language(GlobalSettings, "en-AU")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CultureName = "AU",
|
||||
Id = 11,
|
||||
IsoCode = "en",
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
};
|
||||
var item = _builder.Build();
|
||||
|
||||
var json = JsonConvert.SerializeObject(item);
|
||||
Debug.Print(json);
|
||||
Assert.DoesNotThrow(() => JsonConvert.SerializeObject(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-24
@@ -1,39 +1,37 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Tests.Common.Builders;
|
||||
|
||||
namespace Umbraco.Tests.Models
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class RelationTypeTests
|
||||
{
|
||||
private readonly RelationTypeBuilder _builder = new RelationTypeBuilder();
|
||||
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var item = new RelationType("test", "test", false, Guid.NewGuid(), Guid.NewGuid())
|
||||
{
|
||||
Id = 66,
|
||||
CreateDate = DateTime.Now,
|
||||
IsBidirectional = true,
|
||||
Key = Guid.NewGuid(),
|
||||
Name = "Test",
|
||||
UpdateDate = DateTime.Now
|
||||
};
|
||||
var item = _builder
|
||||
.WithParentObjectType(Guid.NewGuid())
|
||||
.WithChildObjectType(Guid.NewGuid())
|
||||
.Build();
|
||||
|
||||
var clone = (RelationType)item.DeepClone();
|
||||
var clone = (RelationType) item.DeepClone();
|
||||
|
||||
Assert.AreNotSame(clone, item);
|
||||
Assert.AreEqual(clone, item);
|
||||
Assert.AreEqual(clone.Alias, item.Alias);
|
||||
Assert.AreEqual(clone.ChildObjectType, item.ChildObjectType);
|
||||
Assert.AreEqual(clone.ParentObjectType, item.ParentObjectType);
|
||||
Assert.AreEqual(clone.IsBidirectional, item.IsBidirectional);
|
||||
Assert.AreEqual(clone.Id, item.Id);
|
||||
Assert.AreEqual(clone.Key, item.Key);
|
||||
Assert.AreEqual(clone.Name, item.Name);
|
||||
Assert.AreNotSame(clone.ParentObjectType, item.ParentObjectType);
|
||||
Assert.AreNotSame(clone.ChildObjectType, item.ChildObjectType);
|
||||
Assert.AreEqual(clone.UpdateDate, item.UpdateDate);
|
||||
|
||||
//This double verifies by reflection
|
||||
@@ -47,18 +45,9 @@ namespace Umbraco.Tests.Models
|
||||
[Test]
|
||||
public void Can_Serialize_Without_Error()
|
||||
{
|
||||
var item = new RelationType("test", "test", false, Guid.NewGuid(), Guid.NewGuid())
|
||||
{
|
||||
Id = 66,
|
||||
CreateDate = DateTime.Now,
|
||||
IsBidirectional = true,
|
||||
Key = Guid.NewGuid(),
|
||||
Name = "Test",
|
||||
UpdateDate = DateTime.Now
|
||||
};
|
||||
var item = _builder.Build();
|
||||
|
||||
var json = JsonConvert.SerializeObject(item);
|
||||
Debug.Print(json);
|
||||
Assert.DoesNotThrow(() => JsonConvert.SerializeObject(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="obj\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Abstractions\Umbraco.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Tests.Common\Umbraco.Tests.Common.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Tests.Shared\Umbraco.Tests.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
|
||||
namespace Umbraco.Tests.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class DataTypeTests
|
||||
{
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var dtd = new DataType(new VoidEditor(Mock.Of<ILogger>(), Mock.Of<IDataTypeService>(), Mock.Of<ILocalizationService>(),Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>()), 9)
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CreatorId = 5,
|
||||
DatabaseType = ValueStorageType.Nvarchar,
|
||||
Id = 4,
|
||||
Key = Guid.NewGuid(),
|
||||
Level = 7,
|
||||
Name = "Test",
|
||||
ParentId = 9,
|
||||
Path = "-1,2",
|
||||
SortOrder = 8,
|
||||
Trashed = true,
|
||||
UpdateDate = DateTime.Now
|
||||
};
|
||||
var clone = (DataType) dtd.DeepClone();
|
||||
|
||||
Assert.AreNotSame(clone, dtd);
|
||||
Assert.AreEqual(clone, dtd);
|
||||
Assert.AreEqual(clone.CreateDate, dtd.CreateDate);
|
||||
Assert.AreEqual(clone.CreatorId, dtd.CreatorId);
|
||||
Assert.AreEqual(clone.DatabaseType, dtd.DatabaseType);
|
||||
Assert.AreEqual(clone.Id, dtd.Id);
|
||||
Assert.AreEqual(clone.Key, dtd.Key);
|
||||
Assert.AreEqual(clone.Level, dtd.Level);
|
||||
Assert.AreEqual(clone.Name, dtd.Name);
|
||||
Assert.AreEqual(clone.ParentId, dtd.ParentId);
|
||||
Assert.AreEqual(clone.Path, dtd.Path);
|
||||
Assert.AreEqual(clone.SortOrder, dtd.SortOrder);
|
||||
Assert.AreEqual(clone.Trashed, dtd.Trashed);
|
||||
Assert.AreEqual(clone.UpdateDate, dtd.UpdateDate);
|
||||
|
||||
//This double verifies by reflection
|
||||
var allProps = clone.GetType().GetProperties();
|
||||
foreach (var propertyInfo in allProps)
|
||||
{
|
||||
Assert.AreEqual(propertyInfo.GetValue(clone, null), propertyInfo.GetValue(dtd, null));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Serialize_Without_Error()
|
||||
{
|
||||
var dtd = new DataType(new VoidEditor(Mock.Of<ILogger>(), Mock.Of<IDataTypeService>(), Mock.Of<ILocalizationService>(), Mock.Of<ILocalizedTextService>(),Mock.Of<IShortStringHelper>()), 9)
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CreatorId = 5,
|
||||
DatabaseType = ValueStorageType.Nvarchar,
|
||||
Id = 4,
|
||||
Key = Guid.NewGuid(),
|
||||
Level = 7,
|
||||
Name = "Test",
|
||||
ParentId = 9,
|
||||
Path = "-1,2",
|
||||
SortOrder = 8,
|
||||
Trashed = true,
|
||||
UpdateDate = DateTime.Now
|
||||
};
|
||||
|
||||
var json = JsonConvert.SerializeObject(dtd);
|
||||
Debug.Print(json);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class DictionaryItemTests
|
||||
{
|
||||
[Test]
|
||||
public void Can_Deep_Clone()
|
||||
{
|
||||
var item = new DictionaryItem("blah")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Id = 8,
|
||||
ItemKey = "blah",
|
||||
Key = Guid.NewGuid(),
|
||||
ParentId = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now,
|
||||
Translations = new[]
|
||||
{
|
||||
new DictionaryTranslation(new Language(SettingsForTests.GenerateMockGlobalSettings(),"en-AU")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CultureName = "en",
|
||||
Id = 11,
|
||||
IsoCode = "AU",
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
}, "colour")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Id = 88,
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
},
|
||||
new DictionaryTranslation(new Language(SettingsForTests.GenerateMockGlobalSettings(),"en-US")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CultureName = "en",
|
||||
Id = 12,
|
||||
IsoCode = "US",
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
}, "color")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Id = 89,
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
var clone = (DictionaryItem)item.DeepClone();
|
||||
|
||||
Assert.AreNotSame(clone, item);
|
||||
Assert.AreEqual(clone, item);
|
||||
Assert.AreEqual(clone.CreateDate, item.CreateDate);
|
||||
Assert.AreEqual(clone.Id, item.Id);
|
||||
Assert.AreEqual(clone.ItemKey, item.ItemKey);
|
||||
Assert.AreEqual(clone.Key, item.Key);
|
||||
Assert.AreEqual(clone.ParentId, item.ParentId);
|
||||
Assert.AreEqual(clone.UpdateDate, item.UpdateDate);
|
||||
Assert.AreEqual(clone.Translations.Count(), item.Translations.Count());
|
||||
for (var i = 0; i < item.Translations.Count(); i++)
|
||||
{
|
||||
Assert.AreNotSame(clone.Translations.ElementAt(i), item.Translations.ElementAt(i));
|
||||
Assert.AreEqual(clone.Translations.ElementAt(i), item.Translations.ElementAt(i));
|
||||
}
|
||||
|
||||
//This double verifies by reflection
|
||||
var allProps = clone.GetType().GetProperties();
|
||||
foreach (var propertyInfo in allProps)
|
||||
{
|
||||
Assert.AreEqual(propertyInfo.GetValue(clone, null), propertyInfo.GetValue(item, null));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Serialize_Without_Error()
|
||||
{
|
||||
var item = new DictionaryItem("blah")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Id = 8,
|
||||
ItemKey = "blah",
|
||||
Key = Guid.NewGuid(),
|
||||
ParentId = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now,
|
||||
Translations = new[]
|
||||
{
|
||||
new DictionaryTranslation(new Language(SettingsForTests.GenerateMockGlobalSettings(),"en-AU")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CultureName = "en",
|
||||
Id = 11,
|
||||
IsoCode = "AU",
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
}, "colour")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Id = 88,
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
},
|
||||
new DictionaryTranslation(new Language(SettingsForTests.GenerateMockGlobalSettings(),"en-US")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
CultureName = "en",
|
||||
Id = 12,
|
||||
IsoCode = "US",
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
}, "color")
|
||||
{
|
||||
CreateDate = DateTime.Now,
|
||||
Id = 89,
|
||||
Key = Guid.NewGuid(),
|
||||
UpdateDate = DateTime.Now
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var json = JsonConvert.SerializeObject(item);
|
||||
Debug.Print(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,17 +295,13 @@
|
||||
<Compile Include="Models\Collections\OrderItem.cs" />
|
||||
<Compile Include="Models\Collections\SimpleOrder.cs" />
|
||||
<Compile Include="Models\ContentTypeTests.cs" />
|
||||
<Compile Include="Models\DataTypeTests.cs" />
|
||||
<Compile Include="Models\DeepCloneHelperTests.cs" />
|
||||
<Compile Include="Models\DictionaryItemTests.cs" />
|
||||
<Compile Include="Models\DictionaryTranslationTests.cs" />
|
||||
<Compile Include="Models\LanguageTests.cs" />
|
||||
<Compile Include="Models\MemberGroupTests.cs" />
|
||||
<Compile Include="Models\MemberTests.cs" />
|
||||
<Compile Include="Models\PropertyGroupTests.cs" />
|
||||
<Compile Include="Models\PropertyTypeTests.cs" />
|
||||
<Compile Include="Models\RelationTests.cs" />
|
||||
<Compile Include="Models\RelationTypeTests.cs" />
|
||||
<Compile Include="Models\TemplateTests.cs" />
|
||||
<Compile Include="Models\LightEntityTest.cs" />
|
||||
<Compile Include="Models\UserTests.cs" />
|
||||
|
||||
+25
-39
@@ -3775,7 +3775,7 @@
|
||||
"domelementtype": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz",
|
||||
"integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==",
|
||||
"integrity": "sha1-H4vf6R9aeAYydOgDtL3O326U+U0=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
@@ -4233,7 +4233,7 @@
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
@@ -4287,13 +4287,13 @@
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=",
|
||||
"dev": true
|
||||
},
|
||||
"glob-parent": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
|
||||
"integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
|
||||
"integrity": "sha1-X0wdHnSNMM1zrSlEs1d6gbCB6MI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-glob": "^4.0.1"
|
||||
@@ -4321,19 +4321,19 @@
|
||||
"resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
|
||||
"integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
|
||||
"dev": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
@@ -4833,7 +4833,7 @@
|
||||
"braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fill-range": "^7.0.1"
|
||||
@@ -4842,7 +4842,7 @@
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
@@ -4851,7 +4851,7 @@
|
||||
"glob-parent": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
|
||||
"integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
|
||||
"integrity": "sha1-X0wdHnSNMM1zrSlEs1d6gbCB6MI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-glob": "^4.0.1"
|
||||
@@ -4869,13 +4869,13 @@
|
||||
"is-number": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||
"integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss=",
|
||||
"dev": true
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
|
||||
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
|
||||
"integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"braces": "^3.0.1",
|
||||
@@ -4885,7 +4885,7 @@
|
||||
"to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||
"integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-number": "^7.0.0"
|
||||
@@ -5203,7 +5203,7 @@
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"integrity": "sha1-6D0X3hbYp++3cX7b5fsQE17uYps=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
@@ -5400,14 +5400,12 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@@ -5422,20 +5420,17 @@
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@@ -5552,8 +5547,7 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
@@ -5565,7 +5559,6 @@
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
@@ -5580,7 +5573,6 @@
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@@ -5588,14 +5580,12 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@@ -5614,7 +5604,6 @@
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@@ -5695,8 +5684,7 @@
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"dev": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
@@ -5708,7 +5696,6 @@
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
@@ -5830,7 +5817,6 @@
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
@@ -6193,7 +6179,7 @@
|
||||
"ignore": {
|
||||
"version": "5.1.4",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz",
|
||||
"integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==",
|
||||
"integrity": "sha1-hLez2+ZFUrbvDsqZ9nQ9vsbZet8=",
|
||||
"dev": true
|
||||
},
|
||||
"slash": {
|
||||
@@ -8863,7 +8849,7 @@
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
@@ -13046,13 +13032,13 @@
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
|
||||
"integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
|
||||
"integrity": "sha1-B2Srxpxj1ayELdSGfo0CXogN+PM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
|
||||
@@ -125,6 +125,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.Integration",
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.Common", "Umbraco.Tests.Common\Umbraco.Tests.Common.csproj", "{A499779C-1B3B-48A8-B551-458E582E6E96}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.UnitTests", "Umbraco.Tests.UnitTests\Umbraco.Tests.UnitTests.csproj", "{9102ABDF-E537-4E46-B525-C9ED4833EED0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -165,6 +167,10 @@ Global
|
||||
{FBE7C065-DAC0-4025-A78B-63B24D3AB00B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FBE7C065-DAC0-4025-A78B-63B24D3AB00B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FBE7C065-DAC0-4025-A78B-63B24D3AB00B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9102ABDF-E537-4E46-B525-C9ED4833EED0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9102ABDF-E537-4E46-B525-C9ED4833EED0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9102ABDF-E537-4E46-B525-C9ED4833EED0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9102ABDF-E537-4E46-B525-C9ED4833EED0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{33085570-9BF2-4065-A9B0-A29D920D13BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{33085570-9BF2-4065-A9B0-A29D920D13BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{33085570-9BF2-4065-A9B0-A29D920D13BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -213,6 +219,7 @@ Global
|
||||
{53594E5B-64A2-4545-8367-E3627D266AE8} = {FD962632-184C-4005-A5F3-E705D92FC645}
|
||||
{3A33ADC9-C6C0-4DB1-A613-A9AF0210DF3D} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{C7311C00-2184-409B-B506-52A5FAEA8736} = {FD962632-184C-4005-A5F3-E705D92FC645}
|
||||
{9102ABDF-E537-4E46-B525-C9ED4833EED0} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{FB5676ED-7A69-492C-B802-E7B24144C0FC} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{D6319409-777A-4BD0-93ED-B2DFD805B32C} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{A499779C-1B3B-48A8-B551-458E582E6E96} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
|
||||
Reference in New Issue
Block a user