public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
        {
            IEnumerable<PropertyInfo> propertyInfos =
                selectedMembers.OfType<PropertySelectedMemberInfo>().Select(info => info.PropertyInfo);

            return obsoleteSelectionRule.SelectProperties(propertyInfos, context).Select(SelectedMemberInfo.Create);
        }
Beispiel #2
0
 public Result(ICaseInfo @case, IProcedure procedure, ISubjectInfo subject, IResultData data)
 {
     this.@case = @case;
     this.procedure = procedure;
     this.subject = subject;
     this.data = data;
 }
 public CollectionMemberSubjectInfo(ISubjectInfo subjectInfo)
 {
     CompileTimeType = subjectInfo.CompileTimeType;
     SelectedMemberDescription = subjectInfo.SelectedMemberDescription;
     SelectedMemberInfo = subjectInfo.SelectedMemberInfo;
     SelectedMemberPath = GetAdjustedPropertyPath(subjectInfo.SelectedMemberPath);
     RuntimeType = subjectInfo.RuntimeType;
 }
 public NestedSelectionContext(ISubjectInfo context, PropertyInfo propertyInfo)
 {
     PropertyPath = context.PropertyPath.Combine(propertyInfo.Name);
     PropertyDescription = context.PropertyDescription.Combine(propertyInfo.Name);
     CompileTimeType = propertyInfo.PropertyType;
     RuntimeType = propertyInfo.PropertyType;
     PropertyInfo = propertyInfo;
 }
 public NestedSelectionContext(ISubjectInfo context, SelectedMemberInfo selectedMemberInfo)
 {
     SelectedMemberPath = context.SelectedMemberPath.Combine(selectedMemberInfo.Name);
     SelectedMemberDescription = context.SelectedMemberDescription.Combine(selectedMemberInfo.Name);
     CompileTimeType = selectedMemberInfo.MemberType;
     RuntimeType = selectedMemberInfo.MemberType;
     SelectedMemberInfo = selectedMemberInfo;
 }
        public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
        {
            string path = context.SelectedMemberPath;
            if (!ContainsIndexingQualifiers(pathToExclude))
            {
                path = RemoveInitialIndexQualifier(path);
            }

            return selectedMembers.Where(memberInfo => (path.Combine(memberInfo.Name) != pathToExclude)).ToArray();
        }
        /// <summary>
        /// Adds or removes properties to/from the collection of subject properties that must be included while
        /// comparing two objects for structural equality.
        /// </summary>
        /// <param name="selectedProperties">
        /// A collection of properties that was prepopulated by other selection rules. Can be empty.
        /// </param>
        /// <returns>
        /// The collection of properties after applying this rule. Can contain less or more than was passed in.
        /// </returns>
        public IEnumerable<PropertyInfo> SelectProperties(IEnumerable<PropertyInfo> selectedProperties, ISubjectInfo context)
        {
            string propertyPath = context.PropertyPath;
            if (!ContainsIndexingQualifiers(propertyPathToExclude))
            {
                propertyPath = RemoveInitialIndexQualifier(propertyPath);
            }

            return selectedProperties.Where(pi => propertyPathToExclude != propertyPath.Combine(pi.Name)).ToArray();
        }
        /// <summary>
        /// Determines if ordering of the property refered to by the current <paramref name="subjectInfo"/> is relevant.
        /// </summary>
        public bool AppliesTo(ISubjectInfo subjectInfo)
        {
            string currentPropertyPath = subjectInfo.PropertyPath;
            if (!ContainsIndexingQualifiers(propertyPath))
            {
                currentPropertyPath = RemoveInitialIndexQualifier(currentPropertyPath);
            }

            return currentPropertyPath.Equals(propertyPath, StringComparison.CurrentCultureIgnoreCase);
        }
        protected override IEnumerable<SelectedMemberInfo> OnSelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers,
            string currentPath, ISubjectInfo context)
        {
            var matchingMembers =
                from member in context.RuntimeType.GetNonPrivateMembers()
                where pathToInclude.StartsWith(currentPath.Combine(member.Name))
                select member;

            return selectedMembers.Concat(matchingMembers).ToArray();
        }
Beispiel #10
0
 public IResultData GetSerializationData(ISubjectInfo subject, ICaseInfo @case)
 {
     return this.items
         .Where(x => x.Subject == subject)
         .Where(x => x.Case == @case)
         .Where(x => x.Procedure.Name == "Serialize")
         .Select(x => x.Data)
         .DefaultIfEmpty(new NotSupportedRequirementResult())
         .FirstOrDefault();
 }
        /// <summary>
        /// Adds or removes properties to/from the collection of subject properties that must be included while
        /// comparing two objects for structural equality.
        /// </summary>
        /// <param name="properties">
        /// A collection of properties that was prepopulated by other selection rules. Can be empty.</param>
        /// <returns>
        /// The collection of properties after applying this rule. Can contain less or more than was passed in.
        /// </returns>
        public IEnumerable<PropertyInfo> SelectProperties(IEnumerable<PropertyInfo> properties, ISubjectInfo context)
        {
            var props = new List<PropertyInfo>(properties);

            if (!props.Any(p => p.IsEquivalentTo(propertyInfo)))
            {
                props.Add(propertyInfo);
            }

            return props;
        }
        public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
        {
            List<SelectedMemberInfo> members = selectedMembers.ToList();

            if (!members.Any(member => member.IsEquivalentTo(selectedMemberInfo)))
            {
                members.Add(selectedMemberInfo);
            }

            return members;
        }
        public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context,
            IEquivalencyAssertionOptions config)
        {
            string path = context.SelectedMemberPath;
            if (!ContainsIndexingQualifiers(selectedPath))
            {
                path = RemoveInitialIndexQualifier(path);
            }

            return OnSelectMembers(selectedMembers, path, context);
        }
        protected override IEnumerable<SelectedMemberInfo> OnSelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers,
            string currentPath, ISubjectInfo context)
        {
            List<SelectedMemberInfo> members = selectedMembers.ToList();

            foreach (SelectedMemberInfo member in context.RuntimeType.GetNonPrivateMembers())
            {
                if (pathToInclude.Contains(currentPath.Combine(member.Name)))
                {
                    members.Add(member);
                }
            }

            return members;
        }
        public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
        {
            var members = new List<SelectedMemberInfo>(selectedMembers);

            foreach (SelectedMemberInfo selectedMemberInfo in context.RuntimeType.GetNonPrivateMembers())
            {
                if (predicate(new NestedSelectionContext(context, selectedMemberInfo)))
                {
                    if (!members.Any(p => p.IsEquivalentTo(selectedMemberInfo)))
                    {
                        members.Add(selectedMemberInfo);
                    }
                }
            }

            return members;
        }
        /// <summary>
        /// Determines if ordering of the member referred to by the current <paramref name="subjectInfo"/> is relevant.
        /// </summary>
        public OrderStrictness Evaluate(ISubjectInfo subjectInfo)
        {
            string currentPropertyPath = subjectInfo.SelectedMemberPath;
            if (!ContainsIndexingQualifiers(path))
            {
                currentPropertyPath = RemoveInitialIndexQualifier(currentPropertyPath);
            }

            if (currentPropertyPath.Equals(path, StringComparison.CurrentCultureIgnoreCase))
            {
                return OrderStrictness.Strict;
            }
            else
            {
                return OrderStrictness.Irrelevant;
            }
        }
        /// <summary>
        /// Adds or removes properties to/from the collection of subject properties that must be included while
        /// comparing two objects for structural equality.
        /// </summary>
        /// <param name="selectedProperties">
        /// A collection of properties that was prepopulated by other selection rules. Can be empty.</param>
        /// <returns>
        /// The collection of properties after applying this rule. Can contain less or more than was passed in.
        /// </returns>
        public IEnumerable<PropertyInfo> SelectProperties(IEnumerable<PropertyInfo> selectedProperties, ISubjectInfo context)
        {
            var properties = new List<PropertyInfo>(selectedProperties);

            foreach (PropertyInfo propertyInfo in context.RuntimeType.GetNonPrivateProperties())
            {
                if (predicate(new NestedSelectionContext(context, propertyInfo)))
                {
                    if (!properties.Any(p => p.IsEquivalentTo(propertyInfo)))
                    {
                        properties.Add(propertyInfo);
                    }
                }
            }

            return properties;
        }
 public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers,
     ISubjectInfo context, IEquivalencyAssertionOptions config)
 {
     return selectionRule.SelectMembers(selectedMembers, new CollectionMemberSubjectInfo(context), config);
 }
 public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
 {
     return selectedMembers.Where(p => !predicate(new NestedSelectionContext(context, p))).ToArray();
 }
        internal static Type GetSubjectType(this IEquivalencyAssertionOptions config, ISubjectInfo context)
        {
            bool useRuntimeType = ShouldUseRuntimeType(config);

            return useRuntimeType ? context.RuntimeType : context.CompileTimeType;
        }
Beispiel #21
0
        protected override IEnumerable <SelectedMemberInfo> OnSelectMembers(IEnumerable <SelectedMemberInfo> selectedMembers,
                                                                            string currentPath, ISubjectInfo context)
        {
            var matchingMembers =
                from member in context.RuntimeType.GetNonPrivateMembers()
                where pathToInclude.StartsWith(currentPath.Combine(member.Name))
                select member;

            return(selectedMembers.Concat(matchingMembers).ToArray());
        }
 /// <summary>
 /// Adds or removes properties to/from the collection of subject properties that must be included while
 /// comparing two objects for structural equality.
 /// </summary>
 /// <param name="properties">
 /// A collection of properties that was prepopulated by other selection rules. Can be empty.</param>
 /// <returns>
 /// The collection of properties after applying this rule. Can contain less or more than was passed in.
 /// </returns>
 public IEnumerable<PropertyInfo> SelectProperties(IEnumerable<PropertyInfo> properties, ISubjectInfo context)
 {
     return properties.Where(p => !predicate(new NestedSelectionContext(context, p))).ToArray();
 }
 public bool AppliesTo(ISubjectInfo subjectInfo)
 {
     return subjectInfo.CompileTimeType.Implements<IEnumerable<byte>>();
 }
 protected override IEnumerable<SelectedMemberInfo> OnSelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers,
     string currentPath, ISubjectInfo context)
 {
     return selectedMembers.Where(memberInfo => (currentPath.Combine(memberInfo.Name) != pathToExclude)).ToArray();
 }
 protected abstract IEnumerable<SelectedMemberInfo> OnSelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, string currentPath, ISubjectInfo context);
 public OrderStrictness Evaluate(ISubjectInfo subjectInfo)
 {
     return subjectInfo.CompileTimeType.Implements<IEnumerable<byte>>() ? OrderStrictness.Strict : OrderStrictness.Irrelevant;
 }
Beispiel #27
0
 public IEnumerable <SelectedMemberInfo> SelectMembers(IEnumerable <SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
 {
     return(selectedMembers.Where(pi => !pi.Name.EndsWith("Id")).ToArray());
 }
 /// <summary>
 /// Adds or removes properties to/from the collection of subject properties that must be included while
 /// comparing two objects for structural equality.
 /// </summary>
 /// <param name="properties">
 /// A collection of properties that was prepopulated by other selection rules. Can be empty.</param>
 /// <returns>
 /// The collection of properties after applying this rule. Can contain less or more than was passed in.
 /// </returns>
 public IEnumerable <PropertyInfo> SelectProperties(IEnumerable <PropertyInfo> properties, ISubjectInfo context)
 {
     return(context.RuntimeType.GetNonPrivateProperties());
 }
 public IEnumerable<SelectedMemberInfo> SelectMembers(IEnumerable<SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
 {
     return
         selectedMembers.Union(
             config.GetSubjectType(context).GetNonPrivateProperties().Select(SelectedMemberInfo.Create));
 }
        /// <summary>
        /// Adds or removes properties to/from the collection of subject properties that must be included while
        /// comparing two objects for structural equality.
        /// </summary>
        /// <param name="selectedProperties">
        /// A collection of properties that was prepopulated by other selection rules. Can be empty.
        /// </param>
        /// <returns>
        /// The collection of properties after applying this rule. Can contain less or more than was passed in.
        /// </returns>
        public IEnumerable <PropertyInfo> SelectProperties(IEnumerable <PropertyInfo> selectedProperties, ISubjectInfo context)
        {
            string propertyPath = context.PropertyPath;

            if (!ContainsIndexingQualifiers(propertyPathToExclude))
            {
                propertyPath = RemoveInitialIndexQualifier(propertyPath);
            }

            return(selectedProperties.Where(pi => propertyPathToExclude != propertyPath.Combine(pi.Name)).ToArray());
        }
Beispiel #31
0
 public IEnumerable <PropertyInfo> SelectProperties(IEnumerable <PropertyInfo> selectedProperties, ISubjectInfo context)
 {
     return(selectedProperties.Where(pi => !pi.Name.EndsWith("Id")).ToArray());
 }
 public IEnumerable<PropertyInfo> SelectProperties(IEnumerable<PropertyInfo> properties, ISubjectInfo context)
 {
     return properties.Where(pi => !pi.Name.EndsWith("Id")).ToArray();
 }
Beispiel #33
0
 /// <summary>
 /// Adds or removes properties to/from the collection of subject properties that must be included while
 /// comparing two objects for structural equality.
 /// </summary>
 /// <param name="selectedProperties">
 /// A collection of properties that was prepopulated by other selection rules. Can be empty.</param>
 /// <returns>
 /// The collection of properties after applying this rule. Can contain less or more than was passed in.
 /// </returns>
 public IEnumerable <PropertyInfo> SelectProperties(IEnumerable <PropertyInfo> selectedProperties, ISubjectInfo context)
 {
     return(context.CompileTimeType.GetNonPrivateProperties());
 }
 /// <summary>
 /// Adds or removes properties to/from the collection of subject properties that must be included while
 /// comparing two objects for structural equality.
 /// </summary>
 /// <param name="properties">
 /// A collection of properties that was prepopulated by other selection rules. Can be empty.</param>
 /// <returns>
 /// The collection of properties after applying this rule. Can contain less or more than was passed in.
 /// </returns>
 public IEnumerable<PropertyInfo> SelectProperties(IEnumerable<PropertyInfo> properties, ISubjectInfo context)
 {
     return context.RuntimeType.GetNonPrivateProperties();
 }
 /// <summary>
 /// Determines if ordering of the property refered to by the current <paramref name="subjectInfo"/> is relevant.
 /// </summary>
 public bool AppliesTo(ISubjectInfo subjectInfo)
 {
     return predicate(subjectInfo);
 }
 /// <summary>
 /// Determines if ordering of the member referred to by the current <paramref name="subjectInfo"/> is relevant.
 /// </summary>
 public bool AppliesTo(ISubjectInfo subjectInfo)
 {
     return true;
 }
Beispiel #37
0
 public IEnumerable <SelectedMemberInfo> SelectMembers(IEnumerable <SelectedMemberInfo> selectedMembers, ISubjectInfo context, IEquivalencyAssertionOptions config)
 {
     return
         (selectedMembers.Union(
              config.GetSubjectType(context).GetNonPrivateFields().Select(SelectedMemberInfo.Create)));
 }