fixes test

This commit is contained in:
Shannon
2020-03-09 22:25:58 +11:00
parent bad1913e0e
commit d3ebdb6198
2 changed files with 5 additions and 2 deletions

View File

@@ -178,6 +178,7 @@ namespace Umbraco.Core.Models
/// </summary>
/// <remarks>For generic properties, the value is <c>null</c>.</remarks>
[DataMember]
[DoNotClone]
public Lazy<int> PropertyGroupId
{
get => _propertyGroupId;

View File

@@ -1,5 +1,7 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Core.Serialization;
@@ -49,9 +51,9 @@ namespace Umbraco.Tests.Models
Assert.AreEqual(clone.ValidationRegExp, pt.ValidationRegExp);
Assert.AreEqual(clone.ValueStorageType, pt.ValueStorageType);
//This double verifies by reflection
//This double verifies by reflection (don't test properties marked with [DoNotClone]
var allProps = clone.GetType().GetProperties();
foreach (var propertyInfo in allProps)
foreach (var propertyInfo in allProps.Where(p => p.GetCustomAttribute<DoNotCloneAttribute>(false) == null))
{
Assert.AreEqual(propertyInfo.GetValue(clone, null), propertyInfo.GetValue(pt, null));
}