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))
     });
コード例 #2
0
 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))
     });
コード例 #3
0
 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))
     });
コード例 #4
0
 public static string Self(IBehaviorElement behavior)
 {
     return(new MspecReSharperId(behavior).Id);
 }
コード例 #5
0
 public MspecReSharperId(IBehaviorElement behavior)
 {
     Id = $"{behavior.Context.TypeName}.{behavior.FieldName}";
 }
コード例 #6
0
 public IEnumerable <ISpecificationElement> GetSpecifications(IBehaviorElement behavior)
 {
     return(specificationsByBehavior[behavior]);
 }