diff --git a/Dynamitey/DynamicObjects/FauxType.cs b/Dynamitey/DynamicObjects/FauxType.cs
index 7102219..c2fa7b6 100644
--- a/Dynamitey/DynamicObjects/FauxType.cs
+++ b/Dynamitey/DynamicObjects/FauxType.cs
@@ -37,6 +37,8 @@ public static implicit operator FauxType(Type type)
///
public abstract Type[] GetContainedTypes();
+ public abstract IEnumerable GetMemberNames();
+
///
/// Determines whether the specified type contains the type.
///
@@ -72,6 +74,11 @@ public override IEnumerable GetMember(string binderName)
return Enumerable.Empty();
}
+ public override IEnumerable GetMemberNames()
+ {
+ return PropertySpec.Keys;
+ }
+
public override Type[] GetContainedTypes()
{
return new Type []{};
@@ -129,6 +136,17 @@ public override IEnumerable GetMember(string binderName)
return TargetType.GetTypeInfo().GetMember(binderName);
}
+ public override IEnumerable GetMemberNames()
+ {
+
+ var members = TargetType.GetTypeInfo()
+ .GetMembers(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance)
+ .Where(it=> !((it as MethodInfo)?.IsHideBySig ?? false))
+ .Select(it => it.Name)
+ .Distinct();
+ return members.ToList();
+ }
+
///
/// Gets the contained types.
///
@@ -188,6 +206,11 @@ public Type[] GetInterfaceTypes()
return Types.SelectMany(it => it.GetContainedTypes()).Where(it => it.GetTypeInfo().IsInterface).ToArray();
}
+ public override IEnumerable GetMemberNames()
+ {
+ return Types.SelectMany(it => it.GetMemberNames()).Distinct();
+ }
+
///
/// Adds the type.
///
@@ -195,7 +218,9 @@ public Type[] GetInterfaceTypes()
public void AddType(Type type)
{
if (!ContainsType(type))
+ {
Types.Add(type);
+ }
}
///
diff --git a/Tests/Impromptu.cs b/Tests/Impromptu.cs
index f6b5960..1202111 100644
--- a/Tests/Impromptu.cs
+++ b/Tests/Impromptu.cs
@@ -5,8 +5,10 @@
using System.Threading.Tasks;
using NUnit.Framework;
using Dynamitey;
+using Dynamitey.DynamicObjects;
using Dynamitey.SupportLibrary;
using ImpromptuInterface;
+using NUnit.Framework.Constraints;
namespace Dynamitey.Tests
{
@@ -22,20 +24,46 @@ public static readonly dynamic Interfacing
[Test]
public void DictionaryInterfaceNullMethodsTest()
{
-
dynamic tNew = new DynamicObjects.Dictionary();
ISimpleStringMethod tActsLike = ImpromptuInterface.Impromptu.ActLike(tNew);
Assert.AreEqual(false, tActsLike.StartsWith("Te"));
+ }
+
+
+ [Test]
+ public void FauxTypeTest()
+ {
+ var testProp = new Dictionary(){
+ {"test", typeof(bool)}
+ };
+
+ var propType = new PropretySpecType(testProp);
+ var propMembers = propType.GetMemberNames();
+ Expect(propMembers, Contains("test"));
+
+ var realType = new RealType(typeof(ISimpeleClassProps));
+ var realMembers = realType.GetMemberNames();
+
+ Expect(realMembers, Contains("Prop2"));
+
+
+
+ var aggrType = new AggreType(propType, realType);
+
+ var aggrMembers = aggrType.GetMemberNames();
+
+ Expect(aggrMembers, Contains("Prop2"));
+ Expect(aggrMembers, Contains("test"));
}
+
[Test]
public void PropertySpecTest()
-
{ var testProp = new Dictionary(){
{"test", typeof(bool)}
};
@@ -55,7 +83,6 @@ public void PropertySpecTest()
[Test]
public void InterfaceSpecTest()
-
{
var baseObj = new DynamicObjects.Dictionary();
var output = ImpromptuInterface.Impromptu.ActLike(baseObj);
diff --git a/Version.props b/Version.props
index 10a5226..80d1d3f 100644
--- a/Version.props
+++ b/Version.props
@@ -1,5 +1,5 @@
- 2.0.7
+ 2.0.8
\ No newline at end of file