public static MspecRemoteTask GetRemoteTask(IMspecElement element) { return(element switch { IContextElement context => FromContext(context), IBehaviorElement behavior => FromBehavior(behavior), ISpecificationElement specification => FromSpecification(specification), _ => throw new ArgumentOutOfRangeException(nameof(element)) });
public static MspecReSharperId Create(IMspecElement element) { return(element switch { IContextElement context => new MspecReSharperId(context), ISpecificationElement specification => new MspecReSharperId(specification), IBehaviorElement behavior => new MspecReSharperId(behavior), _ => throw new ArgumentOutOfRangeException(nameof(element)) });
private IMspecElement?GetParent(IMspecElement element) { return(element switch { IContextElement => null, IBehaviorElement behavior => behavior.Context, ISpecificationElement { Behavior : null } specification => specification.Context, ISpecificationElement { Behavior : not null } specification => specification.Behavior, _ => throw new ArgumentOutOfRangeException(nameof(element)) });
public static string Self(IBehaviorElement behavior) { return(new MspecReSharperId(behavior).Id); }
public MspecReSharperId(IBehaviorElement behavior) { Id = $"{behavior.Context.TypeName}.{behavior.FieldName}"; }
public IEnumerable <ISpecificationElement> GetSpecifications(IBehaviorElement behavior) { return(specificationsByBehavior[behavior]); }