예제 #1
0
 public static T TrackValue <T>(Func <T> builder)
 {
     using (MutantContext context = new MutantContext())
     {
         return(builder());
     }
 }
예제 #2
0
        // check with: Stryker.MutantControl.IsActive(ID)
        public static bool IsActive(int id)
        {
            if (captureCoverage)
            {
                lock (_coveredMutants)
                {
                    if (!usePipe)
                    {
                        if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable(envName)))
                        {
                            _coveredMutants = new HashSet <int>();
                            _staticMutants  = new HashSet <int>();
                        }
                    }
                    if (_coveredMutants.Add(id))
                    {
                        if (!usePipe)
                        {
                            Environment.SetEnvironmentVariable(envName, string.Join(",", _coveredMutants));
                        }
                    }

                    if (MutantContext.InStatic())
                    {
                        _staticMutants.Add(id);
                    }
                }
            }
            return(ActiveMutation == id);
        }
예제 #3
0
 private static void RegisterCoverage(int id)
 {
     lock (_coverageLock)
     {
         if (!_coveredMutants.Contains(id))
         {
             _coveredMutants.Add(id);
         }
         if (MutantContext.InStatic() && !_coveredStaticdMutants.Contains(id))
         {
             _coveredStaticdMutants.Add(id);
         }
     }
 }
예제 #4
0
        // check with: Stryker.MutantControl.IsActive(ID)
        public static bool IsActive(int id)
        {
            if (captureCoverage)
            {
                lock (_coverageLock)
                {
                    if (!usePipe)
                    {
                        if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable(envName)))
                        {
                            ResetCoverage();
                        }
                    }

                    bool add = false;
                    if (!_coveredMutants.Contains(id))
                    {
                        _coveredMutants.Add(id);
                        if (_mutantsAsString.Length > 0)
                        {
                            _mutantsAsString.Append(',');
                        }
                        _mutantsAsString.Append(id.ToString());
                        add = true;
                    }
                    if (MutantContext.InStatic() && _coveredMutants.Contains(id))
                    {
                        if (_staticMutantsAsStrings.Length > 0)
                        {
                            _staticMutantsAsStrings.Append(',');
                        }
                        _staticMutantsAsStrings.Append(id.ToString());
                        add = true;
                    }

                    if (add)
                    {
                        if (!usePipe)
                        {
                            Environment.SetEnvironmentVariable(envName, BuildReport());
                        }
                    }
                }
            }
            return(ActiveMutation == id);
        }