Ejemplo n.º 1
0
 private IEnumerable <KeyValuePair <string, object> > GetFieldsAndProperties(object expected, TestMemberFilter filter)
 {
     foreach (var f in filter.GetMembers(expected.GetType().GetTypeInfo()))
     {
         if (f is FieldInfo field)
         {
             yield return(new KeyValuePair <string, object>(f.Name, field.GetValue(expected)));
         }
         else
         {
             yield return(new KeyValuePair <string, object>(f.Name, ((PropertyInfo)f).GetValue(expected)));
         }
     }
 }
Ejemplo n.º 2
0
 private void LoadFromObject(object expected, TestMemberFilter filter)
 {
     foreach (var f in filter.GetMembers(expected.GetType().GetTypeInfo()))
     {
         IMemberAccessor accessor;
         accessor = MemberAccessors.PropertyOrField(f);
         object specified = accessor.GetValue(expected);
         _items.Add(f.Name, new ExpectedAccessorData(
                        f.Name,
                        specified,
                        Matcher(specified),
                        accessor
                        ));
     }
 }
Ejemplo n.º 3
0
 private static IEnumerable <string> Names(TestMemberFilter filter)
 {
     return(filter.GetMembers(typeof(PObject).GetTypeInfo()).Select(p => p.Name));
 }