Ejemplo n.º 1
0
 internal void RegisterMethod(MethodDefinition method)
 {
     if (method.Body.Instructions.All(i => i.SequencePoint == null)) return;
     string sourceFileUrl =
         method.Body.Instructions.First(i => i.SequencePoint != null).SequencePoint.Document.Url;
     _readerWriterLock.EnterUpgradeableReadLock();
     try
     {
         if (SourceFiles.All(s => s.Url != sourceFileUrl))
         {
             _readerWriterLock.EnterWriteLock();
             var newSourceFile = new SourceFile();
             newSourceFile.SetUrl(sourceFileUrl);
             SourceFiles.Add(newSourceFile);
             _readerWriterLock.ExitWriteLock();
         }
     }
     finally
     {
         _readerWriterLock.ExitUpgradeableReadLock();
     }
     var sourceFile = SourceFiles.First(s => s.Url == sourceFileUrl);
     var sequencePoints = method.Body.Instructions
         .Where(i => i.SequencePoint != null && i.ShouldReportSequencePoint())
         .Select(i => i.SequencePoint).Distinct();
     foreach (var point in sequencePoints)
     {
         sourceFile.AddSequencePoint(point);
     }
 }
Ejemplo n.º 2
0
 internal void AddResult(Mono.Cecil.Cil.SequencePoint sequencePoint, MutantMetaData mutantMetaData, bool mutantKilled)
 {
     if (sequencePoint == null || sequencePoint.Document == null) return;
     string sourceFileUrl = sequencePoint.Document.Url;
     _readerWriterLock.EnterUpgradeableReadLock();
     try
     {
         if (SourceFiles.All(s => s.Url != sourceFileUrl))
         {
             _readerWriterLock.EnterWriteLock();
             var newSourceFile = new SourceFile();
             newSourceFile.SetUrl(sourceFileUrl);
             SourceFiles.Add(newSourceFile);
             _readerWriterLock.ExitWriteLock();
         }
     }
     finally
     {
         _readerWriterLock.ExitUpgradeableReadLock();
     }
     var sourceFile = SourceFiles.First(s => s.Url == sourceFileUrl);
     sourceFile.AddResult(sequencePoint, mutantMetaData, mutantKilled);
 }