public static T TrackValue <T>(Func <T> builder) { using (MutantContext context = new MutantContext()) { return(builder()); } }
// 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); }
private static void RegisterCoverage(int id) { lock (_coverageLock) { if (!_coveredMutants.Contains(id)) { _coveredMutants.Add(id); } if (MutantContext.InStatic() && !_coveredStaticdMutants.Contains(id)) { _coveredStaticdMutants.Add(id); } } }
// 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); }