Skip to content

Commit

Permalink
MarimerLLC#3802 - add test for containingType
Browse files Browse the repository at this point in the history
  • Loading branch information
19bibo85 committed Apr 28, 2024
1 parent fd4bf2a commit 83179c2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 14 additions & 1 deletion Source/Csla.test/PropertyInfo/PropertyInfoRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,27 @@ public string NameDefaultValue
get { return GetProperty(NameDefaultValueProperty); }
set { SetProperty(NameDefaultValueProperty, value); }
}

public static readonly PropertyInfo<string> StringNullDefaultValueProperty = RegisterProperty<string>(c => c.StringNullDefaultValue, string.Empty, null);
public string StringNullDefaultValue
{
get { return GetProperty(StringNullDefaultValueProperty); }
set { SetProperty(StringNullDefaultValueProperty, value); }
}

public static readonly PropertyInfo<string> ContainingTypeProperty = RegisterProperty<string>(c => c.ContainingType);
public string ContainingType
{
get { return GetProperty(ContainingTypeProperty); }
set { SetProperty(ContainingTypeProperty, value); }
}

public static readonly PropertyInfo<string> ContainingTypeNullProperty = RegisterProperty<string>(new PropertyInfo<string>(nameof(ContainingTypeNull), null, null, RelationshipTypes.None));
public string ContainingTypeNull
{
get { return GetProperty(ContainingTypeNullProperty); }
set { SetProperty(ContainingTypeNullProperty, value); }
}

#endregion
}
Expand Down
9 changes: 8 additions & 1 deletion Source/Csla.test/PropertyInfo/PropertyInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void TestDefaultValue()
Assert.AreEqual("x", PropertyInfoRoot.NameDefaultValueProperty.DefaultValue);
Assert.AreEqual("x", PropertyInfoRoot.NewPropertyInfoRoot(dataPortal).NameDefaultValue);
}

[TestMethod]
public void TestStringNullDefaultValue()
{
Expand All @@ -69,5 +69,12 @@ public void TestStringNullDefaultValue()
Assert.AreEqual(null, PropertyInfoRoot.StringNullDefaultValueProperty.DefaultValue);
Assert.AreEqual(null, PropertyInfoRoot.NewPropertyInfoRoot(dataPortal).StringNullDefaultValue);
}

[TestMethod]
public void TestContainingType()
{
Assert.IsTrue(ReferenceEquals(typeof(PropertyInfoRoot).GetProperty(nameof(PropertyInfoRoot.ContainingType)), PropertyInfoRoot.ContainingTypeProperty.GetPropertyInfo()));
Assert.IsTrue(ReferenceEquals(null, PropertyInfoRoot.ContainingTypeNullProperty.GetPropertyInfo()));
}
}
}

0 comments on commit 83179c2

Please sign in to comment.