Пример #1
0
        public Flaw CloneFlaw()
        {
            Flaw clone = this.Clone() as Flaw;

            clone.Guid = Guid.NewGuid();
            return(clone);
        }
Пример #2
0
        /// <summary>
        /// Inherits property values from the provided flaw.
        /// </summary>
        /// <param name="flaw">The flaw to inherit from.</param>
        public void InheritFromFlaw(Flaw flaw)
        {
            var defaults =
                from ProfilePropertyInfo flawProperty in flaw.Properties
                from ProfilePropertyInfo violationProperty in this.Properties
                where violationProperty.Name == flawProperty.Name
                where flawProperty.ValueString != null
                select new { DefaultValue = flawProperty.ValueString, ViolationProperty = violationProperty };

            foreach (var def in defaults)
            {
                def.ViolationProperty.Set(def.DefaultValue);
            }
        }
Пример #3
0
        public IEnumerable <Violation> GetTransitiveViolations(Flaw flaw)
        {
            ForwardGraphNavigator nav = new ForwardGraphNavigator(this.TransitiveMap);

            HashSet <Violation> violations = new HashSet <Violation>();

            nav.Navigate(
                flaw,
                new DelegateGraphVisitor(visit: (graph, vertex) =>
            {
                if (vertex is Violation)
                {
                    violations.Add((vertex as Violation).Clone() as Violation);
                    throw new SkipChildrenException();
                }

                return(true);
            }));

            return(violations);
        }