Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadFlow" /> class from the specified instance.
        /// </summary>
        /// <param name="other">
        /// The instance from which the new instance is to be initialized.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="other" /> is null.
        /// </exception>
        public ThreadFlow(ThreadFlow other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Init(other.Id, other.Message, other.Locations, other.Properties);
        }
Пример #2
0
        public virtual ThreadFlow VisitThreadFlow(ThreadFlow node)
        {
            if (node != null)
            {
                node.Message = VisitNullChecked(node.Message);
                if (node.Locations != null)
                {
                    for (int index_0 = 0; index_0 < node.Locations.Count; ++index_0)
                    {
                        node.Locations[index_0] = VisitNullChecked(node.Locations[index_0]);
                    }
                }
            }

            return(node);
        }
Пример #3
0
        public void SarifConsolidator_ThreadFlow()
        {
            ThreadFlowLocation tfl = new ThreadFlowLocation()
            {
                ExecutionOrder = 3, Module = "Loader"
            };

            // Pre-add a ThreadFlowLocation to the Run, to ensure it is considered for re-use
            Run run = new Run()
            {
                ThreadFlowLocations = new List <ThreadFlowLocation>()
                {
                    new ThreadFlowLocation(tfl)
                }
            };

            SarifConsolidator consolidator = new SarifConsolidator(run);

            // ThreadFlow: Unique Locations added to run; only indices on ThreadFlow
            ThreadFlow flow = new ThreadFlow()
            {
                Locations = new List <ThreadFlowLocation>()
                {
                    new ThreadFlowLocation(tfl),
                    new ThreadFlowLocation()
                    {
                        Location = new Location(SampleLocation)
                    },
                    new ThreadFlowLocation(tfl)
                }
            };

            consolidator.Consolidate(flow);
            Assert.Equal(2, run.ThreadFlowLocations.Count);
            Assert.Equal(tfl.Module, run.ThreadFlowLocations[0].Module);
            Assert.Equal(5, run.ThreadFlowLocations[1].Location.PhysicalLocation.ArtifactLocation.Index);

            Assert.Equal(0, flow.Locations[0].Index);
            Assert.Equal(1, flow.Locations[1].Index);
            Assert.Equal(0, flow.Locations[0].Index);
        }
Пример #4
0
 public bool ValueEquals(ThreadFlow other) => ValueComparer.Equals(this, other);