private void AddBaseTypesForAffectedTypes()
 {
     foreach (var affectedClass in AffectedTypes.ToList())
     {
         ClassDiagram.GetBaseTypes(affectedClass).ToList().ForEach(baseType =>
         {
             AffectedTypes.Add(baseType);
             Edges.Add(new AffectedEdge(affectedClass, baseType, Edge.Inheritance));
         });
     }
 }
 private void AddSubTypesOverridingMethodsInAffectedTypes()
 {
     foreach (var affectedClass in AffectedTypes.ToList())
     {
         ClassDiagram.GetSubTypesOverridingAnyMethodsIn(affectedClass).ToList().ForEach(type =>
         {
             AffectedTypes.Add(type);
             Edges.Add(new AffectedEdge(type, affectedClass, Edge.IndirectSubtype));
         });
     }
 }
Ejemplo n.º 3
0
    public void ChangeTurnCount(AffectedTypes type, int change)
    {
        switch (type)
        {
        case AffectedTypes.Buffs:
            foreach (var buff in _appliedBuffs)
            {
                buff.Value.TurnCount += change;
                if (buff.Value.TurnCount <= 0)
                {
                    _appliedBuffs.Remove(buff.Key);
                }
                OnBuffsChanged?.Invoke(buff.Value);
            }
            break;

        case AffectedTypes.Dots:
            foreach (var dot in _appliedDots)
            {
                dot.Value.TurnCount += change;
                if (dot.Value.TurnCount <= 0)
                {
                    _appliedDots.Remove(dot.Key);
                }
                OnDotsChanged?.Invoke(dot.Value);
            }
            break;

        case AffectedTypes.Markers:
            foreach (var marker in _appliedMarkers)
            {
                marker.Value.TurnCount += change;
                if (marker.Value.TurnCount <= 0)
                {
                    _appliedMarkers.Remove(marker.Key);
                }
                OnMarkerChanged?.Invoke(marker.Value);
            }
            break;

        case AffectedTypes.Status:
            foreach (var status in _appliedStatuses)
            {
                status.Value.TurnCount += change;
                if (status.Value.TurnCount <= 0)
                {
                    _appliedStatuses.Remove(status.Key);
                }
                OnStatusChanged?.Invoke(status.Value);
            }
            break;
        }
    }
        private void AddTypesUsingAnyAffectedType()
        {
            foreach (var invoke in Coverage.SelectMany(e => e.Value).Where(invoke => !(invoke.From is TestMethod)))
            {
                if (IsInAffectedClass(invoke.Target) && IsAffectedMethod(invoke.Target) && !IsInAffectedClass(invoke.From))
                {
                    var from = ClassDiagram.ResolveType(invoke.From.TypeName);
                    if (from != null)
                    {
                        var fromMethod = from.Methods.First(m => m.Name.Equals(invoke.From.Name));
                        var target     = ClassDiagram.ResolveType(invoke.Target.TypeName);

                        AffectedTypes.Add(from);
                        Edges.Add(new AffectedEdge(from, target, Edge.Use));
                        MethodChanges.Add(new MethodChange(fromMethod, Change.Using));
                    }
                }
            }
        }
 public bool IsInAffectedClass(IMethod method)
 {
     return(AffectedTypes.Any(c => c != null && c.FullName.Equals(method.TypeName)));
 }